shithub: choc

Download patch

ref: bb9ceef0a9b9af7ef83a72bf8a69293227d2db53
parent: 9736ada9a68709c1aea0093aef12f2855d152b2c
author: Simon Howard <[email protected]>
date: Thu Oct 9 14:46:10 EDT 2008

Replace Z_ChangeTag/Z_Free usage with W_ReleaseLump*

Subversion-branch: /branches/raven-branch
Subversion-revision: 1346

--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -1996,7 +1996,7 @@
         if (singledemo)
             I_Quit();
 
-        Z_ChangeTag(demobuffer, PU_CACHE);
+        W_ReleaseLumpName(defdemoname);
         demoplayback = false;
         H2_AdvanceDemo();
         return true;
--- a/src/hexen/in_lude.c
+++ b/src/hexen/in_lude.c
@@ -290,14 +290,17 @@
 
     if (HubCount || gametype == DEATHMATCH)
     {
-        Z_ChangeTag(patchINTERPIC, PU_CACHE);
+        W_ReleaseLumpName("INTERPIC");
+
+        patchINTERPIC = W_CacheLumpName("INTERPIC", PU_STATIC);
+        FontBLumpBase = W_GetNumForName("FONTB16");
         for (i = 0; i < 10; i++)
         {
-            Z_ChangeTag(FontBNumbers[i], PU_CACHE);
+            W_ReleaseLumpNum(FontBLumpBase + i);
         }
-        Z_ChangeTag(FontBNegative, PU_CACHE);
-        Z_ChangeTag(FontBSlash, PU_CACHE);
-        Z_ChangeTag(FontBPercent, PU_CACHE);
+        W_ReleaseLumpName("FONTB13");
+        W_ReleaseLumpName("FONTB15");
+        W_ReleaseLumpName("FONTB05");
     }
 }
 
--- a/src/hexen/p_setup.c
+++ b/src/hexen/p_setup.c
@@ -186,7 +186,7 @@
         li->y = SHORT(ml->y) << FRACBITS;
     }
 
-    Z_Free(data);
+    W_ReleaseLumpNum(lump);
 }
 
 
@@ -233,7 +233,7 @@
             li->backsector = 0;
     }
 
-    Z_Free(data);
+    W_ReleaseLumpNum(lump);
 }
 
 
@@ -265,7 +265,7 @@
         ss->firstline = SHORT(ms->firstseg);
     }
 
-    Z_Free(data);
+    W_ReleaseLumpNum(lump);
 }
 
 
@@ -304,7 +304,7 @@
         ss->thinglist = NULL;
         ss->seqType = SEQTYPE_STONE;    // default seqType
     }
-    Z_Free(data);
+    W_ReleaseLumpNum(lump);
 }
 
 
@@ -342,7 +342,7 @@
                 no->bbox[j][k] = SHORT(mn->bbox[j][k]) << FRACBITS;
         }
     }
-    Z_Free(data);
+    W_ReleaseLumpNum(lump);
 }
 
 //==========================================================================
@@ -377,7 +377,7 @@
     }
     P_CreateTIDList();
     P_InitCreatureCorpseQueue(false);   // false = do NOT scan for corpses
-    Z_Free(data);
+    W_ReleaseLumpNum(lump);
 
     if (!deathmatch)
     {                           // Don't need to check deathmatch spots
@@ -483,7 +483,7 @@
             ld->backsector = 0;
     }
 
-    Z_Free(data);
+    W_ReleaseLumpNum(lump);
 }
 
 
@@ -519,7 +519,7 @@
         sd->midtexture = R_TextureNumForName(msd->midtexture);
         sd->sector = &sectors[SHORT(msd->sector)];
     }
-    Z_Free(data);
+    W_ReleaseLumpNum(lump);
 }
 
 /*
--- a/src/hexen/po_man.c
+++ b/src/hexen/po_man.c
@@ -1477,7 +1477,7 @@
                                  mt->y << FRACBITS);
         }
     }
-    Z_Free(data);
+    W_ReleaseLumpNum(lump);
     // check for a startspot without an anchor point
     for (i = 0; i < po_NumPolyobjs; i++)
     {
--- a/src/hexen/r_data.c
+++ b/src/hexen/r_data.c
@@ -324,7 +324,7 @@
         strncpy(name, name_p + i * 8, 8);
         patchlookup[i] = W_CheckNumForName(name);
     }
-    Z_Free(names);
+    W_ReleaseLumpName("PNAMES");
 
 //
 // load the map texture definitions from textures.lmp
@@ -402,9 +402,9 @@
         totalwidth += texture->width;
     }
 
-    Z_Free(maptex1);
+    W_ReleaseLumpName("TEXTURE1");
     if (maptex2)
-        Z_Free(maptex2);
+        W_ReleaseLumpName("TEXTURE2");
 
 //
 // precalculate whatever possible
--- a/src/hexen/r_draw.c
+++ b/src/hexen/r_draw.c
@@ -322,6 +322,7 @@
 {
     int i;
     byte *transLump;
+    int lumpnum;
 
     V_LoadTintTable();
 
@@ -332,10 +333,10 @@
 
     for (i = 0; i < 3 * (MAXPLAYERS - 1); i++)
     {
-        transLump =
-            W_CacheLumpNum(W_GetNumForName("trantbl0") + i, PU_STATIC);
+        lumpnum = W_GetNumForName("trantbl0") + i;
+        transLump = W_CacheLumpNum(lumpnum, PU_STATIC);
         memcpy(translationtables + i * 256, transLump, 256);
-        Z_Free(transLump);
+        W_ReleaseLumpNum(lumpnum);
     }
 }
 
--- a/src/hexen/r_plane.c
+++ b/src/hexen/r_plane.c
@@ -584,6 +584,6 @@
             R_MakeSpans(x, pl->top[x - 1], pl->bottom[x - 1],
                         pl->top[x], pl->bottom[x]);
         }
-        Z_ChangeTag(tempSource, PU_CACHE);
+        W_ReleaseLumpNum(firstflat + flattranslation[pl->picnum]);
     }
 }
--- a/src/hexen/sc_man.c
+++ b/src/hexen/sc_man.c
@@ -68,8 +68,8 @@
 static char *ScriptPtr;
 static char *ScriptEndPtr;
 static char StringBuffer[MAX_STRING_SIZE];
+static int ScriptLumpNum;
 static boolean ScriptOpen = false;
-static boolean ScriptFreeCLib;  // true = de-allocate using free()
 static int ScriptSize;
 static boolean AlreadyGot = false;
 
@@ -134,16 +134,16 @@
     SC_Close();
     if (type == LUMP_SCRIPT)
     {                           // Lump script
-        ScriptBuffer = (char *) W_CacheLumpName(name, PU_STATIC);
-        ScriptSize = W_LumpLength(W_GetNumForName(name));
+        ScriptLumpNum = W_GetNumForName(name);
+        ScriptBuffer = (char *) W_CacheLumpNum(ScriptLumpNum, PU_STATIC);
+        ScriptSize = W_LumpLength(ScriptLumpNum);
         strcpy(ScriptName, name);
-        ScriptFreeCLib = false; // De-allocate using Z_Free()
     }
     else if (type == FILE_ZONE_SCRIPT)
     {                           // File script - zone
+        ScriptLumpNum = -1;
         ScriptSize = M_ReadFile(name, (byte **) & ScriptBuffer);
         M_ExtractFileBase(name, ScriptName);
-        ScriptFreeCLib = false; // De-allocate using Z_Free()
     }
     ScriptPtr = ScriptBuffer;
     ScriptEndPtr = ScriptPtr + ScriptSize;
@@ -164,9 +164,9 @@
 {
     if (ScriptOpen)
     {
-        if (ScriptFreeCLib == true)
+        if (ScriptLumpNum >= 0)
         {
-            free(ScriptBuffer);
+            W_ReleaseLumpNum(ScriptLumpNum);
         }
         else
         {