From bb9ceef0a9b9af7ef83a72bf8a69293227d2db53 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 9 Oct 2008 18:46:10 +0000 Subject: Replace Z_ChangeTag/Z_Free usage with W_ReleaseLump* Subversion-branch: /branches/raven-branch Subversion-revision: 1346 --- src/hexen/g_game.c | 2 +- src/hexen/in_lude.c | 13 ++++++++----- src/hexen/p_setup.c | 16 ++++++++-------- src/hexen/po_man.c | 2 +- src/hexen/r_data.c | 6 +++--- src/hexen/r_draw.c | 7 ++++--- src/hexen/r_plane.c | 2 +- src/hexen/sc_man.c | 14 +++++++------- 8 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c index 564c1f27..5aae6063 100644 --- a/src/hexen/g_game.c +++ b/src/hexen/g_game.c @@ -1996,7 +1996,7 @@ boolean G_CheckDemoStatus(void) if (singledemo) I_Quit(); - Z_ChangeTag(demobuffer, PU_CACHE); + W_ReleaseLumpName(defdemoname); demoplayback = false; H2_AdvanceDemo(); return true; diff --git a/src/hexen/in_lude.c b/src/hexen/in_lude.c index 160d8827..4d11b7c8 100644 --- a/src/hexen/in_lude.c +++ b/src/hexen/in_lude.c @@ -290,14 +290,17 @@ static void UnloadPics(void) 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"); } } diff --git a/src/hexen/p_setup.c b/src/hexen/p_setup.c index 34f39485..695c262e 100644 --- a/src/hexen/p_setup.c +++ b/src/hexen/p_setup.c @@ -186,7 +186,7 @@ void P_LoadVertexes(int lump) li->y = SHORT(ml->y) << FRACBITS; } - Z_Free(data); + W_ReleaseLumpNum(lump); } @@ -233,7 +233,7 @@ void P_LoadSegs(int lump) li->backsector = 0; } - Z_Free(data); + W_ReleaseLumpNum(lump); } @@ -265,7 +265,7 @@ void P_LoadSubsectors(int lump) ss->firstline = SHORT(ms->firstseg); } - Z_Free(data); + W_ReleaseLumpNum(lump); } @@ -304,7 +304,7 @@ void P_LoadSectors(int lump) ss->thinglist = NULL; ss->seqType = SEQTYPE_STONE; // default seqType } - Z_Free(data); + W_ReleaseLumpNum(lump); } @@ -342,7 +342,7 @@ void P_LoadNodes(int lump) no->bbox[j][k] = SHORT(mn->bbox[j][k]) << FRACBITS; } } - Z_Free(data); + W_ReleaseLumpNum(lump); } //========================================================================== @@ -377,7 +377,7 @@ void P_LoadThings(int lump) } 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 @@ void P_LoadLineDefs(int lump) ld->backsector = 0; } - Z_Free(data); + W_ReleaseLumpNum(lump); } @@ -519,7 +519,7 @@ void P_LoadSideDefs(int lump) sd->midtexture = R_TextureNumForName(msd->midtexture); sd->sector = §ors[SHORT(msd->sector)]; } - Z_Free(data); + W_ReleaseLumpNum(lump); } /* diff --git a/src/hexen/po_man.c b/src/hexen/po_man.c index 4214e785..ec5bb621 100644 --- a/src/hexen/po_man.c +++ b/src/hexen/po_man.c @@ -1477,7 +1477,7 @@ void PO_Init(int lump) mt->y << FRACBITS); } } - Z_Free(data); + W_ReleaseLumpNum(lump); // check for a startspot without an anchor point for (i = 0; i < po_NumPolyobjs; i++) { diff --git a/src/hexen/r_data.c b/src/hexen/r_data.c index 927b6419..dfb9b246 100644 --- a/src/hexen/r_data.c +++ b/src/hexen/r_data.c @@ -324,7 +324,7 @@ void R_InitTextures(void) 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 @@ void R_InitTextures(void) totalwidth += texture->width; } - Z_Free(maptex1); + W_ReleaseLumpName("TEXTURE1"); if (maptex2) - Z_Free(maptex2); + W_ReleaseLumpName("TEXTURE2"); // // precalculate whatever possible diff --git a/src/hexen/r_draw.c b/src/hexen/r_draw.c index da413ed3..96bb52c0 100644 --- a/src/hexen/r_draw.c +++ b/src/hexen/r_draw.c @@ -322,6 +322,7 @@ void R_InitTranslationTables(void) { int i; byte *transLump; + int lumpnum; V_LoadTintTable(); @@ -332,10 +333,10 @@ void R_InitTranslationTables(void) 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); } } diff --git a/src/hexen/r_plane.c b/src/hexen/r_plane.c index deebdf80..f27cd0d4 100644 --- a/src/hexen/r_plane.c +++ b/src/hexen/r_plane.c @@ -584,6 +584,6 @@ void R_DrawPlanes(void) 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]); } } diff --git a/src/hexen/sc_man.c b/src/hexen/sc_man.c index a0156095..da86100e 100644 --- a/src/hexen/sc_man.c +++ b/src/hexen/sc_man.c @@ -68,8 +68,8 @@ static char *ScriptBuffer; 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 @@ static void OpenScript(char *name, int type) 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 @@ void SC_Close(void) { if (ScriptOpen) { - if (ScriptFreeCLib == true) + if (ScriptLumpNum >= 0) { - free(ScriptBuffer); + W_ReleaseLumpNum(ScriptLumpNum); } else { -- cgit v1.2.3