shithub: rott

Download patch

ref: 90585736cf4c536224028466119d311446d1febd
parent: 665cda618b74efce0373cc49bed530cba0feeb80
author: levesqu8 <levesqu8@msu.edu>
date: Mon Oct 16 22:20:55 EDT 2017

Revert "Save/Load is functional with ZomROTT"

This reverts commit e1de7bdf07eeb410f734b2de212885bf7de6699e.

--- a/rott/rt_actor.c
+++ b/rott/rt_actor.c
@@ -3634,11 +3634,13 @@
 }
 
 extern Queue enemiesToRes;
-
+extern unsigned int freeSlot;
+//extern STACK s;
 void AddEnemyToResurrectList(objtype * ob)
 {
     ob->resurrectAtTime = DetermineTimeUntilEnemyIsResurrected(ob->obclass);
     SetReverseDeathState(ob);
+    //freeSlot = pop();
     enqueue(&enemiesToRes, ob);
 }
 
@@ -3717,10 +3719,10 @@
     
     if (currTime >= actor->resurrectAtTime)
     {
+        //dequeue(&enemiesToRes, actor);
         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--;
     }
 }
 
@@ -3774,36 +3776,14 @@
 void SaveResurrectList(byte ** buffer, int *size)
 {
 /*
-    //objtype * arrayOfStuff = calloc(sizeof(objtype), enemiesToRes.sizeOfQueue);
+    byte*tptr;
     
-    //memset(arrayOfStuff, 0, enemiesToRes.sizeOfQueue);
-    
-    int x;
-    
-    node * thingToSave = enemiesToRes.head;
-    
-    for (x = 0; x < enemiesToRes.sizeOfQueue; x++)
-    {
-        //objtype * copyOfObject = malloc(sizeof(objtype));
-        
-        //objtype * ob = (objtype *) thingToSave->data;
-        
-        //memcpy(copyOfObject, ob, sizeof(objtype));
-
-        //arrayOfStuff[x] = *copyOfObject;
-        //thingToSave = thingToSave->next;
-    }
-    
-    
-    
-    byte* tptr;
-    
-    *size = sizeof(arrayOfStuff);
+    *size = sizeof(enemiesToRes);
     *buffer = (byte*)SafeMalloc(*size);
     tptr = *buffer;
     
-    memcpy(tptr, arrayOfStuff, sizeof(*arrayOfStuff));
-    tptr += sizeof(arrayOfStuff);
+    memcpy(tptr, enemiesToRes, sizeof(enemiesToRes));
+    tptr += sizeof(enemiesToRes);
 */
 
 }
--- a/rott/rt_game.c
+++ b/rott/rt_game.c
@@ -4900,7 +4900,6 @@
 extern boolean enableZomROTT;
 extern boolean allowBlitzMoreMissileWeps;
 extern boolean enableAmmoPickups;
-extern Queue enemiesToRes;
 
 boolean SaveTheGame (int num, gamestorage_t * game)
 {
@@ -5175,20 +5174,9 @@
     //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++)
-        {
-            SafeWrite(savehandle, (objtype *) thingToSave->data, size);
-            thingToSave = thingToSave->next;
-        }
-        //SaveResurrectList(&altbuffer, &size);
-        //StoreBuffer(savehandle,altbuffer,size);
-        //SafeFree(altbuffer);
+        SaveResurrectList(&altbuffer, &size);
+        StoreBuffer(savehandle,altbuffer,size);
+        SafeFree(altbuffer);
     }
 
     close (savehandle);
@@ -5251,6 +5239,7 @@
 //******************************************************************************
 
 
+extern objtype* enemiesToRes;
 extern unsigned int freeSlot;
 
 boolean LoadTheGame (int num, gamestorage_t * game)
@@ -5577,34 +5566,23 @@
     bufptr += size;
     
     
-    //ZomROTT Stuff (rebuild the queue))
+    //ZomROTT Stuff
     if(enableZomROTT)
     {
-        queueInit(&enemiesToRes, sizeof(objtype));
+/*
+        enemiesToRes = calloc(sizeof(objtype), gamestate.killtotal);
+        memset(enemiesToRes, 0, sizeof(*enemiesToRes));
+        size = sizeof(enemiesToRes);
+        memcpy(enemiesToRes, bufptr, size);
+        bufptr += size;
         
-        int origQueueSize = 0;
-        
-        size = sizeof(int);
-        
-        memcpy(&origQueueSize, bufptr, size);
-        bufptr+=size;
-        
-        size = sizeof(objtype);
-        
-        int x = 0;
-        
-        while(x < origQueueSize)
+        objtype * findFreeSlotPtr;
+        //find index of free
+        for (findFreeSlotPtr = &enemiesToRes[0]; findFreeSlotPtr != 0; findFreeSlotPtr++)
         {
-            objtype * item = (objtype *) malloc(sizeof(objtype));
-            
-            memcpy(item, bufptr, size);
-            
-            enqueue(&enemiesToRes, item);
-            
-            bufptr+=size;
-            
-            x++;
+            freeSlot++;
         }
+*/
     }
 
     // Set the viewsize
--- a/rott/rt_main.c
+++ b/rott/rt_main.c
@@ -1857,6 +1857,7 @@
 
 
 extern boolean enableZomROTT;
+extern int numOfNonGibbedEnemies;
 void UpdateGameObjects ( void )
 {
     int j;