TheForceEngine icon indicating copy to clipboard operation
TheForceEngine copied to clipboard

Raid on the Ovarid Crash

Open DatMaxNub opened this issue 2 years ago • 4 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

Screenshot 2023-09-11 01-42-26

ovaridcrash.zip

DatMaxNub avatar Sep 11 '23 05:09 DatMaxNub

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.

mlauss2 avatar Oct 09 '23 09:10 mlauss2

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.

DatMaxNub avatar Oct 10 '23 00:10 DatMaxNub

Interesting, I get 2, the captions even read "Menacing electronic buzz" whey they are spawned.

mlauss2 avatar Oct 10 '23 07:10 mlauss2

I will debug it soon(tm) - the attackMod should not be null, so I'll have to get to the root cause.

luciusDXL avatar Oct 25 '23 17:10 luciusDXL

This one is fixed, yes? I cannot reproduce the crash any more.

mlauss2 avatar Jul 16 '24 19:07 mlauss2