ref: 6945d15be0895cdd08306dac7dfb4f19f9345264
parent: 7e52d346063168d7061a9483ffb8052db5222bf8
author: Simon Howard <[email protected]>
date: Thu Sep 22 17:42:24 EDT 2005
64-bit fixes Subversion-branch: /trunk/chocolate-doom Subversion-revision: 125
--- 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 @@
boolean masked;
short width;
short height;
- void **columndirectory; // OBSOLETE
+ int obsolete;
short patchcount;
mappatch_t patches[1];
} maptexture_t;
@@ -345,10 +348,10 @@
// 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;
i<texture->patchcount;
i++, patch++)
@@ -507,13 +510,13 @@
}
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 @@
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 @@
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 @@
Z_Free (maptex2);
// Precalculate whatever possible.
+
for (i=0 ; i<numtextures ; i++)
R_GenerateLookup (i);
// Create translation table for global animation.
- texturetranslation = Z_Malloc ((numtextures+1)*4, PU_STATIC, 0);
+ texturetranslation = Z_Malloc ((numtextures+1)*sizeof(*texturetranslation), PU_STATIC, 0);
for (i=0 ; i<numtextures ; i++)
texturetranslation[i] = i;
@@ -617,7 +621,7 @@
numflats = lastflat - firstflat + 1;
// Create translation table for global animation.
- flattranslation = Z_Malloc ((numflats+1)*4, PU_STATIC, 0);
+ flattranslation = Z_Malloc ((numflats+1)*sizeof(*flattranslation), PU_STATIC, 0);
for (i=0 ; i<numflats ; i++)
flattranslation[i] = i;
@@ -639,9 +643,9 @@
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(*spritewidth), PU_STATIC, 0);
+ spriteoffset = Z_Malloc (numspritelumps*sizeof(*spriteoffset), PU_STATIC, 0);
+ spritetopoffset = Z_Malloc (numspritelumps*sizeof(*spritetopoffset), PU_STATIC, 0);
for (i=0 ; i< numspritelumps ; i++)
{