Skip to content

Commit 6d52158

Browse files
WIP
1 parent 706a283 commit 6d52158

4 files changed

Lines changed: 925 additions & 1320 deletions

File tree

GeneralsMD/Code/GameEngine/Include/GameLogic/Scripts.h

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class DataChunkOutput;
8585
#define MORE_COMPLEX_SKIRMISH_SCRIPTS
8686
#endif
8787

88-
88+
enum { AT_END = 0x00FFFFFF };
8989
// There is undoubtedly a more sophisticated way to do this, but for some reason my brain hurts.
9090
// The corresponding UnsignedInt values that we pass around are:
9191
// 1 means ground
@@ -113,14 +113,13 @@ class ScriptGroup : public MemoryPoolObject, public Snapshot
113113

114114
protected:
115115
Script *m_firstScript;
116-
ScriptGroup* m_firstSubGroup;
117116
AsciiString m_groupName;
118117
Bool m_isGroupActive;
119118
Bool m_isGroupSubroutine;
119+
Int m_parentIndex;
120120
ScriptGroup *m_nextGroup;
121-
Int m_groupId;
122121
Bool m_hasWarnings; ///< Runtime flag used by the editor only.
123-
122+
124123
public:
125124
ScriptGroup();
126125
//~ScriptGroup();
@@ -136,27 +135,19 @@ class ScriptGroup : public MemoryPoolObject, public Snapshot
136135
void setSubroutine(Bool subr) { m_isGroupSubroutine = subr;}
137136
void setWarnings(Bool warnings) { m_hasWarnings = warnings;}
138137
void setNextGroup(ScriptGroup *pGr) {m_nextGroup = pGr;}
139-
void setFirstSubGroup(ScriptGroup* pGr) { m_firstSubGroup = pGr; }
140138

141139
AsciiString getName(void) const { return m_groupName;}
142140
Bool isActive(void) const { return m_isGroupActive;}
143141
Bool isSubroutine(void) const { return m_isGroupSubroutine;}
144142
Bool hasWarnings(void) const { return m_hasWarnings;}
145143
ScriptGroup *getNext(void) const {return m_nextGroup;};
146144
Script *getScript(void) {return m_firstScript;};
147-
const Script* getScript(void) const { return m_firstScript; };
148-
ScriptGroup * getFirstSubGroup(void) const { return m_firstSubGroup; }
149-
Int getGroupId(void) const { return m_groupId; }
145+
Int getParentIndex(void) const {return m_parentIndex;};
146+
void setParentIndex(Int idx) {m_parentIndex = idx;}
150147

151148
void addScript(Script *pScr, Int ndx);
152149
void deleteScript(Script *pScr);
153150

154-
void addSubGroup(ScriptGroup* pGrp, Int ndx);
155-
void deleteSubGroup(ScriptGroup * pGrp);
156-
157-
bool removeChildRecursive(ScriptGroup* pGrp);
158-
ScriptGroup* findParentOfChild(ScriptGroup* pGrp);
159-
160151
static void WriteGroupDataChunk(DataChunkOutput &chunkWriter, ScriptGroup *pGroup);
161152
static Bool ParseGroupDataChunk(DataChunkInput &file, DataChunkInfo *info, void *userData);
162153
};
@@ -241,7 +232,7 @@ class ScriptAction : public MemoryPoolObject // This is the action class.
241232
CAMERA_MOD_SET_FINAL_PITCH, ///< Sets the final pitch for a camera movement
242233
CAMERA_MOD_FREEZE_ANGLE, ///< Freeze camera angle during a camera movement.
243234
CAMERA_MOD_SET_FINAL_SPEED_MULTIPLIER,///< Sets the final time multiplier for a camera movement.
244-
CAMERA_MOD_SET_ROLLING_AVERAGE, ///< Sets the number of frames to average changes (angle, position) to smooth out a camera movement.
235+
CAMERA_MOD_SET_ROLLING_AVERAGE, ///< Sets the number of frames to average changes (angle, positoin) to smooth out a camera movement.
245236
CAMERA_MOD_FINAL_LOOK_TOWARD, ///< Sets the look toward point for the end of a camera movement.
246237
CAMERA_MOD_LOOK_TOWARD, ///< Sets the look toward point during a camera movement.
247238
TEAM_ATTACK_TEAM, ///< Tell team to attack other team
@@ -521,7 +512,7 @@ class ScriptAction : public MemoryPoolObject // This is the action class.
521512
COMMANDBAR_REMOVE_BUTTON_OBJECTTYPE, ///< Remove a button from a command bar for an objecttype
522513
COMMANDBAR_ADD_BUTTON_OBJECTTYPE_SLOT, ///< Add a button to the command bar for an objecttype, in a specific slot
523514
UNIT_SPAWN_NAMED_LOCATION_ORIENTATION, ///< Create a named unit at the specified location, altitude, and orientation
524-
PLAYER_AFFECT_RECEIVING_EXPERIENCE, ///< Adjust whether or not a player is receiving experience for kills
515+
PLAYER_AFFECT_RECEIVING_EXPERIENCE, ///< Adjust whether or not a player is receieving experience for kills
525516
PLAYER_EXCLUDE_FROM_SCORE_SCREEN, ///< This player should be listed in the score screen. Should only be used in campaign games.
526517
TEAM_GUARD_SUPPLY_CENTER, ///< Have an ai team guard the nearest available supply center..
527518
ENABLE_SCORING, ///< Turn on scoring of kills, units destroyed, etc.
@@ -736,9 +727,9 @@ class Script : public MemoryPoolObject, public Snapshot
736727
void setEasy(Bool easy) { m_easy = easy;}
737728
void setNormal(Bool normal) { m_normal = normal;}
738729
void setHard(Bool hard) { m_hard = hard;}
739-
void setBrutal(Bool brutal) { m_brutal = brutal; }
740-
void setAbsurd(Bool absurd) { m_absurd = absurd; }
741-
void setInhumane(Bool inhumane) { m_inhumane = inhumane; }
730+
void setBrutal(Bool brutal) { m_brutal = brutal;}
731+
void setAbsurd(Bool absurd) { m_absurd = absurd;}
732+
void setInhumane(Bool inhumane) { m_inhumane = inhumane;}
742733
void setSubroutine(Bool subr) { m_isSubroutine = subr;}
743734
void setNextScript(Script *pScr) {m_nextScript = pScr;}
744735
void setOrCondition(OrCondition *pCond) {m_condition = pCond;}
@@ -767,9 +758,9 @@ class Script : public MemoryPoolObject, public Snapshot
767758
Bool isEasy(void) const { return m_easy;}
768759
Bool isNormal(void) const { return m_normal;}
769760
Bool isHard(void) const { return m_hard;}
770-
Bool isBrutal(void) const { return m_brutal; }
771-
Bool isAbsurd(void) const { return m_absurd; }
772-
Bool isInhumane(void) const { return m_inhumane; }
761+
Bool isBrutal(void) const { return m_brutal;}
762+
Bool isAbsurd(void) const { return m_absurd;}
763+
Bool isInhumane(void) const { return m_inhumane;}
773764
Bool isSubroutine(void) const { return m_isSubroutine;}
774765
Script *getNext(void) const {return m_nextScript;}
775766
OrCondition *getOrCondition(void) const {return m_condition;}
@@ -950,7 +941,7 @@ extern const char* const TheObjectFlagsNames[];
950941
ConditionTemplates created in ScriptEngine::init.
951942
952943
// SPECIAL NOTE ABOUT Skirmish Scripts: Please note that ALL Skirmish conditions should first pass a pSkirmishPlayerParm to
953-
// prevent the necessity of having to write additional scripts for other players / skirmish types later.
944+
// prevet the necessity of having to write additional scripts for other players / skirmish types later.
954945
*/
955946

956947
class Condition : public MemoryPoolObject // This is the conditional class.
@@ -1237,8 +1228,6 @@ class ScriptList : public MemoryPoolObject, public Snapshot
12371228
public:
12381229
ScriptGroup *getScriptGroup(void) {return m_firstGroup;};
12391230
Script *getScript(void) {return m_firstScript;};
1240-
const ScriptGroup* getScriptGroup(void) const { return m_firstGroup; };
1241-
const Script* getScript(void) const { return m_firstScript; };
12421231
void WriteScriptListDataChunk(DataChunkOutput &chunkWriter);
12431232
static Bool ParseScriptListDataChunk(DataChunkInput &file, DataChunkInfo *info, void *userData);
12441233

@@ -1257,9 +1246,6 @@ class ScriptList : public MemoryPoolObject, public Snapshot
12571246
/// Writes sides (including build list info.)
12581247
static void WriteScriptsDataChunk(DataChunkOutput &chunkWriter, ScriptList *scriptLists[], Int numLists);
12591248

1260-
bool removeGroupRecursive(ScriptGroup* pGrp);
1261-
ScriptGroup* findParentOfGroup(ScriptGroup* pGrp);
1262-
12631249
/// Returns array of script list pointers. This can only be called once after scripts
12641250
/// are read, and the caller is responsible for deleting the scripts.
12651251
static Int getReadScripts(ScriptList *scriptLists[MAX_PLAYER_COUNT]);

0 commit comments

Comments
 (0)