shithub: rott

Download patch

ref: 1ebe91bc4f7e12626d90bacde1142bc77dc39b41
parent: 01b9ebdc22472f503e5807c64cffd41ad7cc10d3
author: levesqu8 <levesqu8@msu.edu>
date: Mon Nov 20 13:52:58 EST 2017

added seperate queues for each enemy type

--- a/rott/rt_actor.c
+++ b/rott/rt_actor.c
@@ -3633,18 +3633,55 @@
     
 }
 
-extern Queue enemiesToRes;
+extern Queue * enemiesToRes[8];
 
 void AddEnemyToResurrectList(objtype * ob)
 {
     ob->resurrectAtTime = DetermineTimeUntilEnemyIsResurrected(ob->obclass);
     SetReverseDeathState(ob);
-    enqueue(&enemiesToRes, ob);
+    switch(ob->obclass)
+    {
+        case lowguardobj:
+            enqueue(enemiesToRes[0], ob);
+            break;
+        case highguardobj:
+            enqueue(enemiesToRes[1], ob);
+            break;
+
+        case strikeguardobj:
+            enqueue(enemiesToRes[2], ob);
+            break;
+        case blitzguardobj:
+            enqueue(enemiesToRes[3], ob);
+            break;
+        case triadenforcerobj:
+            enqueue(enemiesToRes[4], ob);
+            break;
+    #if (SHAREWARE == 0)
+        case overpatrolobj:
+            enqueue(enemiesToRes[5], ob);
+            break;
+        case deathmonkobj:
+            enqueue(enemiesToRes[6], ob);
+            break;
+        case dfiremonkobj:
+            enqueue(enemiesToRes[7], ob);
+            break;
+    #endif
+        default:
+            Error("Unknown organic enemy type detected in AddEnemyToResurrectList");
+            break;
+    }
+    //enqueue(&enemiesToRes, ob);
 }
 
 void FreeUpResurrectList()
 {
-    clearQueue(&enemiesToRes);
+    int x = 0;
+    for (x = 0; x < 8; x++)
+    {
+        clearQueue(enemiesToRes[x]);
+    }
 }
 
 void SetAfterResurrectState(objtype * actor, statetype * doWhat)
@@ -3713,14 +3750,22 @@
     
     int index = 0;
     
-    actor = enemiesToRes.head->data;
+    //actor = enemiesToRes.head->data;
     
-    if (currTime >= actor->resurrectAtTime)
+    for (index = 0; index < 8; index++)
     {
-        SD_PlaySoundRTP(SD_PLAYERSPAWNSND, actor->x, actor->y);
-        SpawnDuringGameWithState (actor->obclass,actor->tilex,actor->tiley,actor->dir, 1, actor->state);
-        dequeue(&enemiesToRes, actor);
-        gamestate.killcount--;
+        if (enemiesToRes[index]->sizeOfQueue == 0)
+        {
+            continue;
+        }
+        actor = enemiesToRes[index]->head->data;
+        if (currTime >= actor->resurrectAtTime)
+        {
+            SD_PlaySoundRTP(SD_PLAYERSPAWNSND, actor->x, actor->y);
+            SpawnDuringGameWithState (actor->obclass,actor->tilex,actor->tiley,actor->dir, 1, actor->state);
+            dequeue(enemiesToRes[index], actor);
+            gamestate.killcount--;
+        }
     }
 }
 
--- a/rott/rt_cfg.c
+++ b/rott/rt_cfg.c
@@ -119,7 +119,7 @@
 boolean autoAimMissileWeps = 0;
 boolean autoAim = 1;
 boolean enableExtraPistolDrops = 0;
-boolean ricochetingRocketsEnabled = 0;
+//boolean ricochetingRocketsEnabled = 0;
 
 
 boolean joystickenabled  = 0;
@@ -1776,11 +1776,7 @@
     SafeWriteString(file, "\n;\n");
     SafeWriteString(file, "; 1 - Enemies equipped with pistols have a chance of dropping an extra pistol when killed.\n");
     SafeWriteString(file, "; 0 - Enemies will not drop extra pistols at all. (Default)\n");
-<<<<<<< HEAD
     WriteParameter(file, "EnableExtraPistolDrops     ", enableExtraPistolDrops);
-=======
-    WriteParameter(file, "EnableExtraPistolDrops    ", enableExtraPistolDrops);
->>>>>>> master
     
     // Write out MouseEnabled
 
--- a/rott/rt_game.c
+++ b/rott/rt_game.c
@@ -4900,7 +4900,7 @@
 extern boolean enableZomROTT;
 extern boolean allowBlitzMoreMissileWeps;
 extern boolean enableAmmoPickups;
-extern Queue enemiesToRes;
+extern Queue * enemiesToRes[8];
 
 boolean SaveTheGame (int num, gamestorage_t * game)
 {
@@ -5174,21 +5174,26 @@
     
     //ZomROTT Stuff
     if(enableZomROTT)
-    {
-        size = sizeof(int);
-        SafeWrite(savehandle, &enemiesToRes.sizeOfQueue, size);
-        
-        int x = 0;
-        node * thingToSave = enemiesToRes.head;
-        size = sizeof(objtype);
-        for (x = 0; x < enemiesToRes.sizeOfQueue; x++)
+    {   
+        int z;
+        for (z = 0; z < 8; z++)
         {
-            SafeWrite(savehandle, (objtype *) thingToSave->data, size);
-            thingToSave = thingToSave->next;
+            size = sizeof(int);
+            SafeWrite(savehandle,&enemiesToRes[z]->sizeOfQueue, size);
+            if (enemiesToRes[z]->sizeOfQueue == 0)
+            {
+                continue;
+            }
+            
+            int x;
+            node * thingToSave = enemiesToRes[z]->head;
+            size = sizeof(objtype);
+            for (x = 0; x < enemiesToRes[z]->sizeOfQueue; x++)
+            {
+                SafeWrite(savehandle, (objtype *) thingToSave->data, size);
+                thingToSave = thingToSave->next;
+            }
         }
-        //SaveResurrectList(&altbuffer, &size);
-        //StoreBuffer(savehandle,altbuffer,size);
-        //SafeFree(altbuffer);
     }
 
     close (savehandle);
@@ -5580,31 +5585,43 @@
     //ZomROTT Stuff (rebuild the queue))
     if(enableZomROTT)
     {
-        queueInit(&enemiesToRes, sizeof(objtype));
+        int z;
+        for (z = 0; z < 8; z++)
+        {
+            size = sizeof(int);
+            
+            int origQueueSize = 0;
+            Queue * enemyQueue;
+            
+            origQueueSize = 0;
+                
+            enemyQueue = malloc(sizeof(Queue));
+            queueInit(enemyQueue, sizeof(objtype));
+                
+            memcpy(&origQueueSize, bufptr, size);
+            bufptr+=size;
+            enemiesToRes[z] = enemyQueue;
         
-        int origQueueSize = 0;
+            //memcpy(&origQueueSize, bufptr, size);
+            //bufptr+=size;
         
-        size = sizeof(int);
+            size = sizeof(objtype);
         
-        memcpy(&origQueueSize, bufptr, size);
-        bufptr+=size;
+            int x = 0;
         
-        size = sizeof(objtype);
-        
-        int x = 0;
-        
-        while(x < origQueueSize)
-        {
-            objtype * item = (objtype *) malloc(sizeof(objtype));
+            while(x < origQueueSize)
+            {
+                objtype * item = (objtype *) malloc(sizeof(objtype));
             
-            memcpy(item, bufptr, size);
+                memcpy(item, bufptr, size);
             
-            enqueue(&enemiesToRes, item);
+                enqueue(enemyQueue, item);
             
-            bufptr+=size;
+                bufptr+=size;
             
-            x++;
-        }
+                x++;
+            }
+        }   
     }
 
     // Set the viewsize
--- a/rott/rt_ted.c
+++ b/rott/rt_ted.c
@@ -5667,15 +5667,23 @@
     DoLowMemoryConversionIconPlane ();
 }
 
-int freeSlot = 0;
-Queue enemiesToRes;
+//int freeSlot = 0;
+//Queue enemiesToRes;
+Queue * enemiesToRes[8]; //8 "Organic enemy Types"
+
 void SetupZomROTTStuff()
-{
-    if (enemiesToRes.head != NULL && enemiesToRes.tail != NULL)
+{   
+    int x;
+    for (x = 0; x < 8; x++)
     {
-        clearQueue(&enemiesToRes);
+        //if (enemiesToRes[x]->head != NULL && enemiesToRes[x]->tail != NULL)
+        //{
+            //clearQueue(enemiesToRes[x]);
+        //}
+        Queue * enemyQueue = malloc(sizeof(Queue));
+        queueInit(enemyQueue, sizeof(objtype));
+        enemiesToRes[x] = enemyQueue;
     }
-    queueInit(&enemiesToRes, sizeof(objtype));
 }
 
 /*