MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / DoShivaMeshSwap

Function DoShivaMeshSwap

TombEngine/Objects/TR3/Entity/Shiva.cpp:204–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202 }
203
204 static bool DoShivaMeshSwap(ItemInfo& item, bool isDead)
205 {
206 const auto& object = Objects[item.ObjectNumber];
207 auto& creature = *GetCreatureInfo(&item);
208
209 // Do mesh swaps.
210 if (creature.Flags == 0)
211 {
212 switch (item.ItemFlags[3])
213 {
214 // Stone to normal.
215 case 0:
216 SwapShivaMeshToNormal(item, item.ItemFlags[0]);
217 item.ItemFlags[0]++;
218 if (item.ItemFlags[0] >= object.nmeshes)
219 {
220 item.ItemFlags[0] = 0;
221 item.ItemFlags[1] = 0;
222 item.ItemFlags[3] = 0;
223 return true;
224 }
225
226 break;
227
228 // Normal to stone.
229 case 1:
230 SwapShivaMeshToStone(item, item.ItemFlags[0]);
231 item.ItemFlags[0]--;
232
233 if (item.ItemFlags[0] < 0)
234 {
235 item.ItemFlags[0] = 0;
236 item.ItemFlags[1] = 1;
237 item.ItemFlags[3] = 1;
238 return true;
239 }
240
241 break;
242 }
243
244 creature.Flags = SHIVA_SWAPMESH_TIME;
245 }
246 else
247 {
248 creature.Flags--;
249 }
250
251 return false;
252 }
253
254 void InitializeShiva(short itemNumber)
255 {

Callers 1

ShivaControlFunction · 0.85

Calls 3

GetCreatureInfoFunction · 0.85
SwapShivaMeshToNormalFunction · 0.85
SwapShivaMeshToStoneFunction · 0.85

Tested by

no test coverage detected