MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / object_parseSeq

Function object_parseSeq

TheForceEngine/TFE_DarkForces/logic.cpp:122–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120 }
121
122 JBool object_parseSeq(SecObject* obj, TFE_Parser* parser, size_t* bufferPos)
123 {
124 LogicSetupFunc setupFunc = nullptr;
125
126 const char* line = parser->readLine(*bufferPos);
127 if (!line || !strstr(line, "SEQ"))
128 {
129 return JFALSE;
130 }
131
132 Logic* newLogic = nullptr;
133 while (1)
134 {
135 line = parser->readLine(*bufferPos);
136 if (!line) { return JFALSE; }
137
138 s_objSeqArgCount = sscanf(line, " %s %s %s %s %s %s", s_objSeqArg0, s_objSeqArg1, s_objSeqArg2, s_objSeqArg3, s_objSeqArg4, s_objSeqArg5);
139 KEYWORD key = getKeywordIndex(s_objSeqArg0);
140 if (key == KW_TYPE || key == KW_LOGIC)
141 {
142 KEYWORD logicId = getKeywordIndex(s_objSeqArg1);
143
144 // First, search the externally defined logics for a match (if the setting is enabled)
145 TFE_ExternalData::CustomActorLogic* customLogic = (logicId != KW_PLAYER)
146 ? tryFindCustomActorLogic(s_objSeqArg1)
147 : nullptr; // do not allow "LOGIC: PLAYER" to be overridden !!
148
149 if (TFE_Settings::jsonAiLogics() && customLogic)
150 {
151 newLogic = obj_setCustomActorLogic(obj, customLogic);
152 setupFunc = nullptr;
153 }
154 // Then go to the hardcoded logics
155 else if (logicId == KW_PLAYER) // Player Logic.
156 {
157 player_setupObject(obj);
158 setupFunc = nullptr;
159 }
160 else if (logicId == KW_ANIM) // Animated Sprites Logic.
161 {
162 newLogic = obj_setSpriteAnim(obj);
163 setupFunc = nullptr;
164 }
165 else if (logicId == KW_UPDATE) // "Update" logic is usually used for rotating 3D objects, like the Death Star.
166 {
167 newLogic = obj_setUpdate(obj, &setupFunc);
168 }
169 else if (logicId >= KW_TROOP && logicId <= KW_SCENERY) // Enemies, explosives barrels, land mines, and scenery.
170 {
171 newLogic = obj_setEnemyLogic(obj, logicId);
172 setupFunc = nullptr;
173 }
174 else if (logicId == KW_KEY) // Vue animation logic.
175 {
176 newLogic = obj_createVueLogic(obj, &setupFunc);
177 }
178 else if (logicId == KW_GENERATOR) // Enemy generator, used for in-level enemy spawning.
179 {

Callers 1

level_loadObjectsFunction · 0.85

Calls 15

getKeywordIndexFunction · 0.85
tryFindCustomActorLogicFunction · 0.85
jsonAiLogicsFunction · 0.85
obj_setCustomActorLogicFunction · 0.85
player_setupObjectFunction · 0.85
obj_setSpriteAnimFunction · 0.85
obj_setUpdateFunction · 0.85
obj_setEnemyLogicFunction · 0.85
obj_createVueLogicFunction · 0.85
obj_createGeneratorFunction · 0.85
actor_createDispatchFunction · 0.85
getPickupItemIdFunction · 0.85

Tested by

no test coverage detected