shithub: rott

Download patch

ref: 49b143489b897fe26c3eed076daeebbd5a378fbf
parent: ef770bb2842cf0b3018326ee00fb94a798003973
author: levesqu8 <levesqu8@msu.edu>
date: Fri Oct 6 14:51:52 EDT 2017

fixed inf loop bug

--- a/rott/rt_actor.c
+++ b/rott/rt_actor.c
@@ -3604,9 +3604,7 @@
         case highguardobj:
             return gamestate.TimeCount/VBLCOUNTER + 90;
             break;
-        case overpatrolobj:
-            return gamestate.TimeCount/VBLCOUNTER + 75;
-            break;
+
         case strikeguardobj:
             return gamestate.TimeCount/VBLCOUNTER + 65;
             break;
@@ -3616,6 +3614,10 @@
         case triadenforcerobj:
             return gamestate.TimeCount/VBLCOUNTER + 200;
             break;
+    #if (SHAREWARE == 0)
+        case overpatrolobj:
+            return gamestate.TimeCount/VBLCOUNTER + 75;
+            break;
         case deathmonkobj:
             return gamestate.TimeCount/VBLCOUNTER + 150;
             break;
@@ -3622,6 +3624,7 @@
         case dfiremonkobj:
             return gamestate.TimeCount/VBLCOUNTER + 175;
             break;
+    #endif
         default:
             Error("DeterminetimeUntilEnemyIsResurrected was given a case it couldn't handle");
             break;
@@ -3629,36 +3632,32 @@
     
 }
 
-
-
-
 extern resItem* enemiesToRes;
 extern unsigned int freeSlot;
-int numOfNonGibbedEnemies = 0;
 void AddEnemyToResurrectList(resItem * res)
 {
-    res->timeOfResurrect = DetermineTimeUntilEnemyIsResurrected(res->actor->obclass);
+    int timeOfResurrect = DetermineTimeUntilEnemyIsResurrected(res->actor->obclass);
     objtype * actor = res->actor;
-    resItem* compareWith;
-    compareWith = 0;
     SetReverseDeathState(actor);
-    if (!ZomROTTResFreeSlots[freeSlot])
+    if (ZomROTTResFreeSlots[freeSlot])
     {
         //FIND AN EMPTY SLOT
-        for(freeSlot; ZomROTTResFreeSlots[freeSlot] != false; freeSlot++)
+        for(freeSlot; ZomROTTResFreeSlots[freeSlot] == false; freeSlot++)
         {
             if (freeSlot >= sizeof(*enemiesToRes))
             {
-                freeSlot = 0;
+                Error("ZomROTT couldn't find a free slot to insert entry in!");
             }
         }
     }
-    res->isInitialized = 1;
+    resItem newEntry;
     
-    enemiesToRes[freeSlot] = *res;
+    newEntry.actor = actor;
+    newEntry.isInitialized = 1;
+    newEntry.timeOfResurrect = timeOfResurrect;
+    
+    enemiesToRes[freeSlot] = newEntry;
     ZomROTTResFreeSlots[freeSlot] = false;
-    freeSlot++;
-    numOfNonGibbedEnemies++;
 }
 
 void CleanUpResurrectList()
@@ -3734,28 +3733,21 @@
 {   
     resItem * thing;
     
-    if (&enemiesToRes[0] == 0)
-    {
-        return;
-    }
     int index = 0;
-    for (thing = &enemiesToRes[0]; thing < &enemiesToRes[sizeof(*enemiesToRes)]; thing++)
+    for (thing = &enemiesToRes[0]; thing < &enemiesToRes[sizeof(*enemiesToRes)]; thing++, index++)
     {
-        if (thing->isInitialized == 0)
+        if (thing->timeOfResurrect == 0)
         {
             continue;
         }
-        else if (gamestate.TimeCount/(VBLCOUNTER) >= thing->timeOfResurrect)
+        else if (gamestate.TimeCount/(VBLCOUNTER) >= thing->timeOfResurrect && ZomROTTResFreeSlots[index] == false)
         {
             SD_PlaySoundRTP(SD_PLAYERSPAWNSND, thing->actor->x, thing->actor->y);
             SpawnDuringGameWithState (thing->actor->obclass,thing->actor->tilex,thing->actor->tiley,thing->actor->dir, 1, thing->actor->state);
-            thing->isInitialized = 0;
+            thing->timeOfResurrect = 0;
             ZomROTTResFreeSlots[index] = true;
-        }   
-        index++;
+        }
     }
-    //CleanUpResurrectList();
-    
 }
 
 /*
@@ -3977,7 +3969,6 @@
 {
     playertype *pstate;
     M_LINKSTATE(ob,pstate);
-
 
     ob->flags &= ~(FL_ELASTO|FL_GODMODE|FL_DOGMODE|FL_NOFRICTION|FL_RIDING);
 
--- a/rott/rt_debug.c
+++ b/rott/rt_debug.c
@@ -49,6 +49,8 @@
 extern int		iDemoNames;
 extern boolean iG_aimCross;
 
+boolean ricochetingRocketsEnabled = false;
+
 
 extern void DisplayMessage   (int num,int position);
 
--- a/rott/rt_game.c
+++ b/rott/rt_game.c
@@ -5238,7 +5238,8 @@
 //
 //******************************************************************************
 
-extern objtype* enemiesToRes;
+
+extern resItem* enemiesToRes;
 extern unsigned int freeSlot;
 
 boolean LoadTheGame (int num, gamestorage_t * game)
@@ -5568,7 +5569,7 @@
     //ZomROTT Stuff
     if(enableZomROTT)
     {
-        enemiesToRes = calloc(sizeof(objtype), gamestate.killtotal);
+        enemiesToRes = calloc(sizeof(resItem), gamestate.killtotal);
         memset(enemiesToRes, 0, sizeof(*enemiesToRes));
         size = sizeof(enemiesToRes);
         memcpy(enemiesToRes, bufptr, size);
--- a/rott/rt_main.c
+++ b/rott/rt_main.c
@@ -1894,9 +1894,10 @@
         UpdateLightning ();
         TriggerStuff();
         CheckCriticalStatics();
-        if (enableZomROTT && numOfNonGibbedEnemies > 0)
+        if (enableZomROTT)
+        {
             ResurrectEnemies();
-
+        }
         
         for(j=0; j<numclocks; j++)
             if (Clocks[j].time1 &&
--- a/rott/rt_menu.c
+++ b/rott/rt_menu.c
@@ -4904,7 +4904,7 @@
             mouseactive = 1;
         }
 #else
-#error please define your platform.  /* or maybe just nuke the DOS section? */
+    #error please define your platform.
 #endif
 
         buttons = IN_GetMouseButtons();
--- a/rott/rt_ted.c
+++ b/rott/rt_ted.c
@@ -5672,14 +5672,14 @@
 
 void SetupZomROTTStuff()
 {
-    resItem uninitializedRes;
-    uninitializedRes.isInitialized = false;
+    resItem * uninitializedRes = malloc(sizeof(resItem));
+    uninitializedRes->isInitialized=false;
     if (enemiesToRes)
     {
         FreeUpResurrectList();
     }
     enemiesToRes = calloc(sizeof(resItem), gamestate.killtotal);
-    memset(enemiesToRes, &uninitializedRes, sizeof(*enemiesToRes));
+    memset(enemiesToRes, uninitializedRes, sizeof(*enemiesToRes));
     ZomROTTResFreeSlots = calloc(sizeof(int), gamestate.killtotal);
     memset(ZomROTTResFreeSlots, true, sizeof(*ZomROTTResFreeSlots));
     //freeSlot = 0;