From 6945d15be0895cdd08306dac7dfb4f19f9345264 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 22 Sep 2005 21:42:24 +0000 Subject: 64-bit fixes Subversion-branch: /trunk/chocolate-doom Subversion-revision: 125 --- src/r_data.c | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/r_data.c b/src/r_data.c index 98d49aac..3d193c39 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: r_data.c 120 2005-09-22 13:13:47Z fraggle $ +// $Id: r_data.c 125 2005-09-22 21:42:24Z fraggle $ // // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 2005 Simon Howard @@ -22,6 +22,9 @@ // 02111-1307, USA. // // $Log$ +// Revision 1.8 2005/09/22 21:42:24 fraggle +// 64-bit fixes +// // Revision 1.7 2005/09/22 13:13:47 fraggle // Remove external statistics driver support (-statcopy): // nonfunctional on modern systems and never used. @@ -55,7 +58,7 @@ static const char -rcsid[] = "$Id: r_data.c 120 2005-09-22 13:13:47Z fraggle $"; +rcsid[] = "$Id: r_data.c 125 2005-09-22 21:42:24Z fraggle $"; #include "i_system.h" #include "z_zone.h" @@ -113,7 +116,7 @@ typedef struct boolean masked; short width; short height; - void **columndirectory; // OBSOLETE + int obsolete; short patchcount; mappatch_t patches[1]; } maptexture_t; @@ -345,10 +348,10 @@ void R_GenerateLookup (int texnum) // that are covered by more than one patch. // Fill in the lump / offset, so columns // with only a single patch are all done. - patchcount = (byte *) Z_Malloc(texture->width, PU_STATIC, NULL); + patchcount = (byte *) Z_Malloc(texture->width, PU_STATIC, &patchcount); memset (patchcount, 0, texture->width); patch = texture->patches; - + for (i=0 , patch = texture->patches; ipatchcount; i++, patch++) @@ -507,13 +510,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(*textures), PU_STATIC, 0); + texturecolumnlump = Z_Malloc (numtextures * sizeof(*texturecolumnlump), PU_STATIC, 0); + texturecolumnofs = Z_Malloc (numtextures * sizeof(*texturecolumnofs), PU_STATIC, 0); + texturecomposite = Z_Malloc (numtextures * sizeof(*texturecomposite), PU_STATIC, 0); + texturecompositesize = Z_Malloc (numtextures * sizeof(*texturecompositesize), PU_STATIC, 0); + texturewidthmask = Z_Malloc (numtextures * sizeof(*texturewidthmask), PU_STATIC, 0); + textureheight = Z_Malloc (numtextures * sizeof(*textureheight), PU_STATIC, 0); totalwidth = 0; @@ -557,7 +560,7 @@ void R_InitTextures (void) texture->width = SHORT(mtexture->width); texture->height = SHORT(mtexture->height); texture->patchcount = SHORT(mtexture->patchcount); - + memcpy (texture->name, mtexture->name, sizeof(texture->name)); mpatch = &mtexture->patches[0]; patch = &texture->patches[0]; @@ -573,8 +576,8 @@ void R_InitTextures (void) 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(**texturecolumnlump), PU_STATIC,0); + texturecolumnofs[i] = Z_Malloc (texture->width*sizeof(**texturecolumnofs), PU_STATIC,0); j = 1; while (j*2 <= texture->width) @@ -593,11 +596,12 @@ void R_InitTextures (void) Z_Free (maptex2); // Precalculate whatever possible. + for (i=0 ; i