diff options
Diffstat (limited to 'src/heretic/r_data.c')
-rw-r--r-- | src/heretic/r_data.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/heretic/r_data.c b/src/heretic/r_data.c index 9846196a..ee005248 100644 --- a/src/heretic/r_data.c +++ b/src/heretic/r_data.c @@ -221,7 +221,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; @@ -263,6 +263,8 @@ void R_GenerateLookup(int texnum) texturecompositesize[texnum] += texture->height; } } + + Z_Free(patchcount); } @@ -322,7 +324,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); @@ -423,6 +425,8 @@ void R_InitTextures(void) totalwidth += texture->width; } + Z_Free(patchlookup); + W_ReleaseLumpName("TEXTURE1"); if (maptex2) { @@ -654,7 +658,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++) { @@ -671,10 +675,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++) @@ -700,10 +706,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) @@ -728,4 +736,6 @@ void R_PrecacheLevel(void) } } } + + Z_Free(spritepresent); } |