Raid on the Ovarid Crash
DatMaxNub opened this issue · comments
Version: 1.09.410-7-gdead22da
Game: Dark Forces
Mod: Raid on the Ovarid
https://df-21.net/downloads/contests/ovarid.zip
Game crashes during the Phase 1 boarding. Works correctly in DOS
Issue is that the s_actorState has .attackMod==nullptr.
Thread 1 "theforceengine" received signal SIGSEGV, Segmentation fault.
0x0000555555622621 in TFE_DarkForces::generatorTaskFunc (msg=<optimized out>) at TheForceEngine/TFE_DarkForces/generator.cpp:127
127 s_actorState.attackMod->timing.nextTick = s_curTick + gen->wanderTime + floor16(randomWanderOffset);
(gdb) p s_actorState
$1 = {curAnimation = 0x0, curLogic = 0x7fffbd97ab90, attackMod = 0x0, nextAlertTick = 0, officerAlertIndex = 0, stormtrooperAlertIndex = 0}
index f43685fa..97336db3 100644
--- a/TheForceEngine/TFE_DarkForces/generator.cpp
+++ b/TheForceEngine/TFE_DarkForces/generator.cpp
@@ -117,14 +117,17 @@ namespace TFE_DarkForces
actorLogic->freeTask = task_getCurrent();
gen->aliveCount++;
gen->numTerminate--;
- if (gen->wanderTime == 0xffffffff)
+ if (s_actorState.attackMod)
{
- s_actorState.attackMod->timing.nextTick = 0xffffffff;
- }
- else
- {
- s32 randomWanderOffset = floor16(random(intToFixed16(gen->wanderTime >> 1)));
- s_actorState.attackMod->timing.nextTick = s_curTick + gen->wanderTime + floor16(randomWanderOffset);
+ if (gen->wanderTime == 0xffffffff)
+ {
+ s_actorState.attackMod->timing.nextTick = 0xffffffff;
+ }
+ else
+ {
+ s32 randomWanderOffset = floor16(random(intToFixed16(gen->wanderTime >> 1)));
+ s_actorState.attackMod->timing.nextTick = s_curTick + gen->wanderTime + floor16(randomWanderOffset);
+ }
}
SecObject** entityPtr = (SecObject**)allocator_newItem(gen->entities);
This level is super short, right? Go down the elevator, get red key, go up, use key and grab mask, wait for the shaking to stop, go down elevator again, fight phase 1, push button, go back up, grab datatape, done.
Very short, but it was the winner of the one room wonder contest. Also the crash doesn't seem to happen now, but the Phase 1s don't even show up.
Interesting, I get 2, the captions even read "Menacing electronic buzz" whey they are spawned.
I will debug it soon(tm) - the attackMod should not be null, so I'll have to get to the root cause.
This one is fixed, yes? I cannot reproduce the crash any more.