summaryrefslogtreecommitdiff
path: root/sys/src/games/doom/r_data.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-02-04 01:09:46 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2014-02-04 01:09:46 +0100
commit3f522c745a91dabfa577b4bf1045e58fa436066e (patch)
treed9c41d05dc28a1b5fffe5d60a60ba98d829320e3 /sys/src/games/doom/r_data.c
parent88505bff06822e2d6313de477874a7a816935ea7 (diff)
doom: port to amd64
Diffstat (limited to 'sys/src/games/doom/r_data.c')
-rw-r--r--sys/src/games/doom/r_data.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/sys/src/games/doom/r_data.c b/sys/src/games/doom/r_data.c
index 2c31cf313..ecbba8da8 100644
--- a/sys/src/games/doom/r_data.c
+++ b/sys/src/games/doom/r_data.c
@@ -59,7 +59,6 @@ rcsid[] = "$Id: r_data.c,v 1.4 1997/02/03 16:47:55 b1 Exp $";
#pragma pack on
-
/* Texture definition.
** Each texture is composed of one or more patches,
** with patches being lumps stored in the WAD.
@@ -87,7 +86,7 @@ typedef struct
boolean masked;
short width;
short height;
- void **columndirectory; // OBSOLETE
+ long columndirectory; // OBSOLETE
short patchcount;
mappatch_t patches[1];
} maptexture_t;
@@ -483,13 +482,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(void*), PU_STATIC, 0);
+ texturecolumnlump = Z_Malloc (numtextures*sizeof(void*), PU_STATIC, 0);
+ texturecolumnofs = Z_Malloc (numtextures*sizeof(void*), PU_STATIC, 0);
+ texturecomposite = Z_Malloc (numtextures*sizeof(void*), 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;
@@ -519,12 +518,10 @@ void R_InitTextures (void)
}
offset = LONG(*directory);
-
if (offset > maxoff)
I_Error ("R_InitTextures: bad texture directory");
mtexture = (maptexture_t *) ( (byte *)maptex + offset);
-
texture = textures[i] =
Z_Malloc (sizeof(texture_t)
+ sizeof(texpatch_t)*(SHORT(mtexture->patchcount)-1),
@@ -549,8 +546,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(short), PU_STATIC,0);
+ texturecolumnofs[i] = Z_Malloc (texture->width*sizeof(short), PU_STATIC,0);
j = 1;
while (j*2 <= texture->width)
@@ -571,7 +568,7 @@ void R_InitTextures (void)
R_GenerateLookup (i);
// Create 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;
@@ -593,7 +590,7 @@ void R_InitFlats (void)
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(int), PU_STATIC, 0);
for (i=0 ; i<numflats ; i++)
flattranslation[i] = i;
@@ -615,9 +612,9 @@ void R_InitSpriteLumps (void)
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++)
{
@@ -645,7 +642,7 @@ void R_InitColormaps (void)
lump = W_GetNumForName("COLORMAP");
length = W_LumpLength (lump) + 255;
colormaps = Z_Malloc (length, PU_STATIC, 0);
- colormaps = (byte *)( ((int)colormaps + 255)&~0xff);
+ colormaps = (byte *)( ((uintptr)colormaps + 255)&~0xff);
W_ReadLump (lump,colormaps);
}