diff options
author | Simon Howard | 2009-01-27 21:21:56 +0000 |
---|---|---|
committer | Simon Howard | 2009-01-27 21:21:56 +0000 |
commit | 1583812848e2704977df5a7a055610e5f63c8742 (patch) | |
tree | 3fbdc5f06572775c2de7e03f43b732292d69c7c2 /src | |
parent | 03771945c7fce016919fe53d60b6faff3fe09742 (diff) | |
download | chocolate-doom-1583812848e2704977df5a7a055610e5f63c8742.tar.gz chocolate-doom-1583812848e2704977df5a7a055610e5f63c8742.tar.bz2 chocolate-doom-1583812848e2704977df5a7a055610e5f63c8742.zip |
Use sizeof() to calculate amounts to allocate, rather than hard-coded
sizes.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1431
Diffstat (limited to 'src')
-rw-r--r-- | src/hexen/r_data.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/hexen/r_data.c b/src/hexen/r_data.c index bfa1f2a9..3c2c652f 100644 --- a/src/hexen/r_data.c +++ b/src/hexen/r_data.c @@ -349,13 +349,13 @@ void R_InitTextures(void) } numtextures = numtextures1 + numtextures2; - textures = Z_Malloc(numtextures * 4, PU_STATIC, 0); - texturecolumnlump = Z_Malloc(numtextures * 4, PU_STATIC, 0); - texturecolumnofs = Z_Malloc(numtextures * 4, PU_STATIC, 0); - texturecomposite = Z_Malloc(numtextures * 4, PU_STATIC, 0); - texturecompositesize = Z_Malloc(numtextures * 4, PU_STATIC, 0); - texturewidthmask = Z_Malloc(numtextures * 4, PU_STATIC, 0); - textureheight = Z_Malloc(numtextures * 4, PU_STATIC, 0); + textures = Z_Malloc(numtextures * sizeof(texture_t *), PU_STATIC, 0); + texturecolumnlump = Z_Malloc(numtextures * sizeof(short *), PU_STATIC, 0); + texturecolumnofs = Z_Malloc(numtextures * sizeof(short *), PU_STATIC, 0); + texturecomposite = Z_Malloc(numtextures * sizeof(byte *), PU_STATIC, 0); + texturecompositesize = Z_Malloc(numtextures * sizeof(int), PU_STATIC, 0); + texturewidthmask = Z_Malloc(numtextures * sizeof(int), PU_STATIC, 0); + textureheight = Z_Malloc(numtextures * sizeof(fixed_t), PU_STATIC, 0); totalwidth = 0; @@ -392,8 +392,8 @@ void R_InitTextures(void) I_Error("R_InitTextures: Missing patch in texture %s", texture->name); } - texturecolumnlump[i] = Z_Malloc(texture->width * 2, PU_STATIC, 0); - texturecolumnofs[i] = Z_Malloc(texture->width * 2, PU_STATIC, 0); + texturecolumnlump[i] = Z_Malloc(texture->width * sizeof(short), PU_STATIC, 0); + texturecolumnofs[i] = Z_Malloc(texture->width * sizeof(short), PU_STATIC, 0); j = 1; while (j * 2 <= texture->width) j <<= 1; @@ -420,7 +420,7 @@ void R_InitTextures(void) // // translation table for global animation // - texturetranslation = Z_Malloc((numtextures + 1) * 4, PU_STATIC, 0); + texturetranslation = Z_Malloc((numtextures + 1) * sizeof(int), PU_STATIC, 0); for (i = 0; i < numtextures; i++) texturetranslation[i] = i; } @@ -443,7 +443,7 @@ void R_InitFlats(void) numflats = lastflat - firstflat + 1; // translation table for global animation - flattranslation = Z_Malloc((numflats + 1) * 4, PU_STATIC, 0); + flattranslation = Z_Malloc((numflats + 1) * sizeof(int), PU_STATIC, 0); for (i = 0; i < numflats; i++) flattranslation[i] = i; } @@ -467,9 +467,9 @@ void R_InitSpriteLumps(void) firstspritelump = W_GetNumForName("S_START") + 1; lastspritelump = W_GetNumForName("S_END") - 1; numspritelumps = lastspritelump - firstspritelump + 1; - spritewidth = Z_Malloc(numspritelumps * 4, PU_STATIC, 0); - spriteoffset = Z_Malloc(numspritelumps * 4, PU_STATIC, 0); - spritetopoffset = Z_Malloc(numspritelumps * 4, PU_STATIC, 0); + spritewidth = Z_Malloc(numspritelumps * sizeof(fixed_t), PU_STATIC, 0); + spriteoffset = Z_Malloc(numspritelumps * sizeof(fixed_t), PU_STATIC, 0); + spritetopoffset = Z_Malloc(numspritelumps * sizeof(fixed_t), PU_STATIC, 0); for (i = 0; i < numspritelumps; i++) { |