summaryrefslogtreecommitdiff
path: root/src/hexen/r_data.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hexen/r_data.c')
-rw-r--r--src/hexen/r_data.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/hexen/r_data.c b/src/hexen/r_data.c
index bd020073..b82c0ff6 100644
--- a/src/hexen/r_data.c
+++ b/src/hexen/r_data.c
@@ -218,7 +218,7 @@ void R_GenerateLookup(int texnum)
// fill in the lump / offset, so columns with only a single patch are
// all done
//
- patchcount = (byte *) alloca(texture->width);
+ patchcount = (byte *) Z_Malloc(texture->width, PU_STATIC, &patchcount);
memset(patchcount, 0, texture->width);
patch = texture->patches;
@@ -260,6 +260,8 @@ void R_GenerateLookup(int texnum)
texturecompositesize[texnum] += texture->height;
}
}
+
+ Z_Free(patchcount);
}
@@ -319,7 +321,7 @@ void R_InitTextures(void)
names = W_CacheLumpName("PNAMES", PU_STATIC);
nummappatches = LONG(*((int *) names));
name_p = names + 4;
- patchlookup = alloca(nummappatches * sizeof(*patchlookup));
+ patchlookup = Z_Malloc(nummappatches * sizeof(*patchlookup), PU_STATIC, NULL);
for (i = 0; i < nummappatches; i++)
{
strncpy(name, name_p + i * 8, 8);
@@ -403,6 +405,8 @@ void R_InitTextures(void)
totalwidth += texture->width;
}
+ Z_Free(patchlookup);
+
W_ReleaseLumpName("TEXTURE1");
if (maptex2)
W_ReleaseLumpName("TEXTURE2");
@@ -620,7 +624,7 @@ void R_PrecacheLevel(void)
//
// precache flats
//
- flatpresent = alloca(numflats);
+ flatpresent = Z_Malloc(numflats, PU_STATIC, NULL);
memset(flatpresent, 0, numflats);
for (i = 0; i < numsectors; i++)
{
@@ -637,10 +641,12 @@ void R_PrecacheLevel(void)
W_CacheLumpNum(lump, PU_CACHE);
}
+ Z_Free(flatpresent);
+
//
// precache textures
//
- texturepresent = alloca(numtextures);
+ texturepresent = Z_Malloc(numtextures, PU_STATIC, NULL);
memset(texturepresent, 0, numtextures);
for (i = 0; i < numsides; i++)
@@ -667,10 +673,12 @@ void R_PrecacheLevel(void)
}
}
+ Z_Free(texturepresent);
+
//
// precache sprites
//
- spritepresent = alloca(numsprites);
+ spritepresent = Z_Malloc(numsprites, PU_STATIC, NULL);
memset(spritepresent, 0, numsprites);
for (th = thinkercap.next; th != &thinkercap; th = th->next)
@@ -695,4 +703,6 @@ void R_PrecacheLevel(void)
}
}
}
+
+ Z_Free(spritepresent);
}