First off in gl_draw.c we have some nice cleanup code for the upload

code.

Then we have the completely purge of treating 'unsigned' as a type, it
is NOT a type, it is a TYPE MODIFIER!

Under gcc for x86 it happens to try and do something sane, just treat it
as a unsigned int, but that is EVIL, it is a MODIFIER and if ANYONE adds
code which uses unsigned as a type in itself I /WILL/ harm them!!!
This commit is contained in:
Zephaniah E. Hull 2000-09-22 09:08:08 +00:00
parent 9691cca81d
commit 210ba16069
40 changed files with 222 additions and 244 deletions

View file

@ -115,8 +115,8 @@ typedef struct
typedef struct miptex_s
{
char name[16];
unsigned width, height;
unsigned offsets[MIPLEVELS]; // four mip maps stored
unsigned int width, height;
unsigned int offsets[MIPLEVELS]; // four mip maps stored
} miptex_t;

View file

@ -31,9 +31,9 @@
#include "qtypes.h"
unsigned Com_BlockChecksum (void *buffer, int length);
unsigned int Com_BlockChecksum (void *buffer, int length);
void Com_BlockFullChecksum (void *buffer, int len, unsigned char *outbuf);
byte COM_BlockSequenceCheckByte (byte *base, int length, int sequence, unsigned mapchecksum);
byte COM_BlockSequenceCheckByte (byte *base, int length, int sequence, unsigned int mapchecksum);
byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence);
#endif // _CHECKSUM_H

View file

@ -51,8 +51,8 @@ typedef struct surfcache_s
int lightadj[MAXLIGHTMAPS]; // checked for strobe flush
int dlight;
int size; // including header
unsigned width;
unsigned height; // DEBUG only needed for debug
unsigned int width;
unsigned int height; // DEBUG only needed for debug
float mipscale;
struct texture_s *texture; // checked for animating textures
byte data[4]; // width*height elements

View file

@ -142,8 +142,8 @@ typedef struct surfcache_s
int lightadj[MAXLIGHTMAPS]; // checked for strobe flush
int dlight;
int size; // including header
unsigned width;
unsigned height; // DEBUG only needed for debug
unsigned int width;
unsigned int height; // DEBUG only needed for debug
float mipscale;
struct texture_s *texture; // checked for animating textures
byte data[4]; // width*height elements

View file

@ -90,7 +90,7 @@ typedef struct mplane_s
typedef struct texture_s
{
char name[16];
unsigned width, height;
unsigned int width, height;
int gl_texturenum;
int gl_fb_texturenum;
struct msurface_s *texturechain; // for gl_texsort drawing
@ -98,7 +98,7 @@ typedef struct texture_s
int anim_min, anim_max; // time for this frame min <=time< max
struct texture_s *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frmae 1 use these
unsigned offsets[MIPLEVELS]; // four mip maps stored
unsigned int offsets[MIPLEVELS]; // four mip maps stored
} texture_t;
@ -433,8 +433,8 @@ typedef struct model_s
byte *lightdata;
char *entities;
unsigned checksum;
unsigned checksum2;
unsigned int checksum;
unsigned int checksum2;
//
// additional model data

View file

@ -68,8 +68,8 @@ typedef struct
qboolean paused; // are we paused?
//check player/eyes models for hacks
unsigned model_player_checksum;
unsigned eyes_player_checksum;
unsigned int model_player_checksum;
unsigned int eyes_player_checksum;
char name[64]; // map name
char modelname[MAX_QPATH]; // maps/<name>.bsp, for model_precache[0]
@ -146,7 +146,7 @@ typedef struct client_s
// this prevents malicious multiple broadcasts
float lastnametime; // time of last name change
int lastnamecount; // time of last name change
unsigned checksum; // checksum for calcs
unsigned int checksum; // checksum for calcs
qboolean drop; // lose this guy next opportunity
int lossage; // loss percentage

View file

@ -46,16 +46,16 @@ typedef struct
pixel_t *colormap; // 256 * VID_GRADES size
unsigned short *colormap16; // 256 * VID_GRADES size
int fullbright; // index of first fullbright color
unsigned rowbytes; // may be > width if displayed in a window
unsigned width;
unsigned height;
unsigned int rowbytes; // may be > width if displayed in a window
unsigned int width;
unsigned int height;
float aspect; // width / height -- < 0 is taller than wide
int numpages;
int recalc_refdef; // if true, recalc vid-based stuff
pixel_t *conbuffer;
int conrowbytes;
unsigned conwidth;
unsigned conheight;
unsigned int conwidth;
unsigned int conheight;
int maxwarpwidth;
int maxwarpheight;
pixel_t *direct; // direct drawing to framebuffer, if not
@ -64,7 +64,7 @@ typedef struct
extern viddef_t vid; // global video state
extern unsigned short d_8to16table[256];
extern unsigned d_8to24table[256];
extern unsigned int d_8to24table[256];
extern void (*vid_menudrawfn)(void);
extern void (*vid_menukeyfn)(int key);

View file

@ -911,8 +911,8 @@ void CL_ConnectionlessPacket (void)
Con_Printf ("client command\n");
if ((*(unsigned *)net_from.ip != *(unsigned *)net_local_adr.ip
&& *(unsigned *)net_from.ip != htonl(INADDR_LOOPBACK)) )
if ((*(unsigned int *)net_from.ip != *(unsigned int *)net_local_adr.ip
&& *(unsigned int *)net_from.ip != htonl(INADDR_LOOPBACK)) )
{
Con_Printf ("Command packet from remote host. Ignored.\n");
return;

View file

@ -1082,7 +1082,7 @@ void CL_MuzzleFlash (void)
i = MSG_ReadShort ();
if ((unsigned)(i-1) >= MAX_CLIENTS)
if ((unsigned int)(i-1) >= MAX_CLIENTS)
return;
// don't draw our own muzzle flash in gl if flashblending

View file

@ -41,7 +41,7 @@ void D_FillRect (vrect_t *rect, int color)
{
int rx, ry, rwidth, rheight;
unsigned char *dest;
unsigned *ldest;
unsigned int *ldest;
rx = rect->x;
ry = rect->y;
@ -71,7 +71,7 @@ void D_FillRect (vrect_t *rect, int color)
if (((rwidth & 0x03) == 0) && (((long)dest & 0x03) == 0))
{
// faster aligned dword clear
ldest = (unsigned *)dest;
ldest = (unsigned int *)dest;
color += color << 16;
rwidth >>= 2;
@ -81,7 +81,7 @@ void D_FillRect (vrect_t *rect, int color)
{
for (rx=0 ; rx<rwidth ; rx++)
ldest[rx] = color;
ldest = (unsigned *)((byte*)ldest + vid.rowbytes);
ldest = (unsigned int *)((byte*)ldest + vid.rowbytes);
}
}
else

View file

@ -403,7 +403,7 @@ void D_DrawZSpans (espan_t *pspan)
int count, doublecount, izistep;
int izi;
short *pdest;
unsigned ltemp;
unsigned int ltemp;
double zi;
float du, dv;

View file

@ -437,8 +437,8 @@ void Draw_TransPic (int x, int y, qpic_t *pic)
unsigned short *pusdest;
int v, u;
if (x < 0 || (unsigned)(x + pic->width) > vid.width || y < 0 ||
(unsigned)(y + pic->height) > vid.height)
if (x < 0 || (unsigned int)(x + pic->width) > vid.width || y < 0 ||
(unsigned int)(y + pic->height) > vid.height)
{
Sys_Error ("Draw_TransPic: bad coordinates");
}
@ -524,8 +524,8 @@ void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation)
unsigned short *pusdest;
int v, u;
if (x < 0 || (unsigned)(x + pic->width) > vid.width || y < 0 ||
(unsigned)(y + pic->height) > vid.height)
if (x < 0 || (unsigned int)(x + pic->width) > vid.width || y < 0 ||
(unsigned int)(y + pic->height) > vid.height)
{
Sys_Error ("Draw_TransPic: bad coordinates");
}
@ -869,7 +869,7 @@ void Draw_Fill (int x, int y, int w, int h, int c)
{
byte *dest;
unsigned short *pusdest;
unsigned uc;
unsigned int uc;
int u, v;
if (x < 0 || x + w > vid.width ||

View file

@ -676,8 +676,8 @@ Draw_TransPic
void Draw_TransPic (int x, int y, qpic_t *pic)
{
if (x < 0 || (unsigned)(x + pic->width) > vid.width || y < 0 ||
(unsigned)(y + pic->height) > vid.height)
if (x < 0 || (unsigned int)(x + pic->width) > vid.width || y < 0 ||
(unsigned int)(y + pic->height) > vid.height)
{
Sys_Error ("Draw_TransPic: bad coordinates");
}
@ -696,7 +696,7 @@ Only used for the player color selection menu
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation)
{
int v, u, c;
unsigned trans[64*64], *dest;
unsigned int trans[64*64], *dest;
byte *src;
int p;
@ -985,11 +985,11 @@ void GL_Set2D (void)
GL_ResampleTexture
================
*/
static void GL_ResampleTexture (unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight)
static void GL_ResampleTexture (unsigned int *in, int inwidth, int inheight, unsigned int *out, int outwidth, int outheight)
{
int i, j;
unsigned *inrow;
unsigned frac, fracstep;
unsigned int *inrow;
unsigned int frac, fracstep;
fracstep = inwidth*0x10000/outwidth;
for (i=0 ; i<outheight ; i++, out += outwidth)
@ -1019,7 +1019,7 @@ static void GL_Resample8BitTexture (unsigned char *in, int inwidth, int inheight
{
int i, j;
unsigned char *inrow;
unsigned frac, fracstep;
unsigned int frac, fracstep;
fracstep = inwidth*0x10000/outwidth;
for (i=0 ; i<outheight ; i++, out += outwidth)
@ -1104,16 +1104,14 @@ static void GL_MipMap8Bit (byte *in, int width, int height)
GL_Upload32
===============
*/
static void GL_Upload32 (unsigned *data, int width, int height, qboolean mipmap, qboolean alpha)
static void GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap, qboolean alpha)
{
int samples;
static unsigned scaled[1024*512]; // [512*256];
int scaled_width, scaled_height;
unsigned int *scaled;
int scaled_width, scaled_height, samples;
for (scaled_width = 1 ; scaled_width < width ; scaled_width<<=1)
;
for (scaled_height = 1 ; scaled_height < height ; scaled_height<<=1)
;
// Snap the height and width to a power of 2.
for (scaled_width = 1 ; scaled_width < width ; scaled_width<<=1) ;
for (scaled_height = 1 ; scaled_height < height ; scaled_height<<=1) ;
scaled_width >>= (int)gl_picmip->value;
scaled_height >>= (int)gl_picmip->value;
@ -1121,44 +1119,26 @@ static unsigned scaled[1024*512]; // [512*256];
scaled_width = min(scaled_width, gl_max_size->value);
scaled_height = min(scaled_height, gl_max_size->value);
if (scaled_width * scaled_height > sizeof(scaled)/4)
if (!(scaled = malloc(scaled_width * scaled_height * 4 * sizeof(unsigned int))))
Sys_Error ("GL_LoadTexture: too big");
samples = alpha ? gl_alpha_format : gl_solid_format;
#if 0
if (mipmap)
gluBuild2DMipmaps (GL_TEXTURE_2D, samples, width, height, GL_RGBA, GL_UNSIGNED_BYTE, trans);
else if (scaled_width == width && scaled_height == height)
glTexImage2D (GL_TEXTURE_2D, 0, samples, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, trans);
else
{
gluScaleImage (GL_RGBA, width, height, GL_UNSIGNED_BYTE, trans,
scaled_width, scaled_height, GL_UNSIGNED_BYTE, scaled);
glTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
}
#else
if (scaled_width == width && scaled_height == height)
{
if (!mipmap)
{
glTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
goto done;
}
// If the real width/height and the 'scaled' width/height then we
// rescale it.
if (scaled_width == width && scaled_height == height) {
memcpy (scaled, data, width*height*4);
}
else
} else {
GL_ResampleTexture (data, width, height, scaled, scaled_width, scaled_height);
}
glTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
if (mipmap)
{
if (mipmap) {
int miplevel;
miplevel = 0;
while (scaled_width > 1 || scaled_height > 1)
{
while (scaled_width > 1 || scaled_height > 1) {
GL_MipMap ((byte *)scaled, scaled_width, scaled_height);
scaled_width >>= 1;
scaled_height >>= 1;
@ -1170,49 +1150,27 @@ static unsigned scaled[1024*512]; // [512*256];
glTexImage2D (GL_TEXTURE_2D, miplevel, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
}
}
done: ;
#endif
if (mipmap)
{
if (mipmap) {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
}
else
{
} else {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
}
free(scaled);
}
void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha)
{
int i, s;
qboolean noalpha;
int samples;
static unsigned char scaled[1024*512]; // [512*256];
#ifdef HAVE_GL_COLOR_INDEX8_EXT
byte *scaled;
int scaled_width, scaled_height;
s = width*height;
// if there are no transparent pixels, make it a 3 component
// texture even if it was specified as otherwise
if (alpha)
{
noalpha = true;
for (i=0 ; i<s ; i++)
{
if (data[i] == 255)
noalpha = false;
}
if (alpha && noalpha)
alpha = false;
}
for (scaled_width = 1 ; scaled_width < width ; scaled_width<<=1)
;
for (scaled_height = 1 ; scaled_height < height ; scaled_height<<=1)
;
// Snap the height and width to a power of 2.
for (scaled_width = 1 ; scaled_width < width ; scaled_width<<=1) ;
for (scaled_height = 1 ; scaled_height < height ; scaled_height<<=1) ;
scaled_width >>= (int)gl_picmip->value;
scaled_height >>= (int)gl_picmip->value;
@ -1220,41 +1178,24 @@ void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboole
scaled_width = min(scaled_width, gl_max_size->value);
scaled_height = min(scaled_height, gl_max_size->value);
if (scaled_width * scaled_height > sizeof(scaled))
if (!(scaled = malloc(scaled_width * scaled_height)))
Sys_Error ("GL_LoadTexture: too big");
samples = 1; // alpha ? gl_alpha_format : gl_solid_format;
if (scaled_width == width && scaled_height == height)
{
if (!mipmap)
{
/* FIXME - what if this extension isn't available? */
#ifdef HAVE_GL_COLOR_INDEX8_EXT
glTexImage2D (GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, scaled_width, scaled_height, 0, GL_COLOR_INDEX , GL_UNSIGNED_BYTE, data);
#else
/* FIXME - should warn that this isn't available */
#endif
goto done;
}
// If the real width/height and the 'scaled' width/height then we
// rescale it.
if (scaled_width == width && scaled_height == height) {
memcpy (scaled, data, width*height);
}
else
} else {
GL_Resample8BitTexture (data, width, height, scaled, scaled_width, scaled_height);
}
// FIXME - what if this extension isn't available?
#ifdef HAVE_GL_COLOR_INDEX8_EXT
glTexImage2D (GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, scaled_width, scaled_height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, scaled);
#else
/* FIXME - should warn that this isn't available */
#endif
if (mipmap)
{
if (mipmap) {
int miplevel;
miplevel = 0;
while (scaled_width > 1 || scaled_height > 1)
{
while (scaled_width > 1 || scaled_height > 1) {
GL_MipMap8Bit ((byte *)scaled, scaled_width, scaled_height);
scaled_width >>= 1;
scaled_height >>= 1;
@ -1263,26 +1204,22 @@ void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboole
if (scaled_height < 1)
scaled_height = 1;
miplevel++;
/* FIXME - what if this extension isn't available? */
#ifdef HAVE_GL_COLOR_INDEX8_EXT
glTexImage2D (GL_TEXTURE_2D, miplevel, GL_COLOR_INDEX8_EXT, scaled_width, scaled_height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, scaled);
#else
/* FIXME - should warn that this isn't available */
#endif
}
}
done: ;
if (mipmap)
{
if (mipmap) {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
}
else
{
} else {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
}
free(scaled);
#else
Sys_Error ("GL_Upload8_EXT without HAVE_GL_COLOR_INDEX8_EXT");
#endif
}
extern qboolean VID_Is8bit();
@ -1294,7 +1231,47 @@ GL_Upload8
*/
void GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean alpha)
{
static unsigned trans[640*480]; // FIXME, temporary
#if 1
unsigned int *trans = NULL;
int i, s, p;
s = width*height;
trans = malloc(s * sizeof(unsigned int));
// if there are no transparent pixels, make it a 3 component
// texture even if it was specified as otherwise
if (alpha) {
alpha = false;
for (i=0 ; i<s ; i++) {
p = data[i];
if (p == 255) alpha = true;
trans[i] = d_8to24table[p];
}
} else {
if (s&3)
Sys_Error ("GL_Upload8: s&3");
for (i=0 ; i<s ; i+=4) {
trans[i] = d_8to24table[data[i]];
trans[i+1] = d_8to24table[data[i+1]];
trans[i+2] = d_8to24table[data[i+2]];
trans[i+3] = d_8to24table[data[i+3]];
}
}
#ifdef gl_draw_scraps
if (VID_Is8bit() && !alpha && (data!=scrap_texels[0]))
#else
if (VID_Is8bit() && !alpha)
#endif
{
GL_Upload8_EXT (data, width, height, mipmap, alpha);
} else {
GL_Upload32 (trans, width, height, mipmap, alpha);
}
free(trans);
#else
static unsigned int trans[640*480]; // FIXME, temporary
int i, s;
qboolean noalpha;
int p;
@ -1340,6 +1317,7 @@ static unsigned trans[640*480]; // FIXME, temporary
}
GL_Upload32 (trans, width, height, mipmap, alpha);
#endif
}
/*
@ -1405,7 +1383,7 @@ SetupTexture:
GL_Upload8 (data, width, height, mipmap, alpha);
break;
case 4:
GL_Upload32 ((unsigned *)data, width, height, mipmap, alpha);
GL_Upload32 ((unsigned int *) data, width, height, mipmap, alpha);
break;
default:
Sys_Error ("SetupTexture: unknown bytesperpixel %i",

View file

@ -76,7 +76,7 @@ typedef struct
short x, y;
} floodfill_t;
extern unsigned d_8to24table[];
extern unsigned int d_8to24table[];
// must be a power of 2
#define FLOODFILL_FIFO_SIZE 0x1000

View file

@ -124,7 +124,7 @@ void R_NetGraph (void)
int a, x, i, y;
int lost;
char st[80];
unsigned ngraph_pixels[NET_GRAPHHEIGHT][NET_TIMINGS];
unsigned int ngraph_pixels[NET_GRAPHHEIGHT][NET_TIMINGS];
x = 0;
lost = CL_CalcNet();

View file

@ -333,7 +333,7 @@ int RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
int i;
mtexinfo_t *tex;
byte *lightmap;
unsigned scale;
unsigned int scale;
int maps;
if (node->contents < 0)

View file

@ -304,15 +304,15 @@ void R_TranslatePlayerSkin (int playernum)
{
int top, bottom;
byte translate[256];
unsigned translate32[256];
unsigned int translate32[256];
int i, j;
byte *original;
unsigned pixels[512*256], *out;
unsigned scaled_width, scaled_height;
unsigned int pixels[512*256], *out;
unsigned int scaled_width, scaled_height;
int inwidth, inheight;
int tinwidth, tinheight;
byte *inrow;
unsigned frac, fracstep;
unsigned int frac, fracstep;
player_info_t *player;
extern byte player_8bit_texels[320*200];
char s[512];

View file

@ -63,7 +63,7 @@ int lightmap_bytes; // 1 or 3
int lightmap_textures;
unsigned blocklights[18*18*3];
unsigned int blocklights[18*18*3];
cvar_t *gl_colorlights;
@ -136,7 +136,7 @@ R_AddDynamicLights
void R_AddDynamicLights (msurface_t *surf)
{
int sdtable[18], lnum, td, maxdist, maxdist2, maxdist3, i, s, t, smax, tmax, red, green, blue, j;
unsigned *bl;
unsigned int *bl;
float dist, f;
vec3_t impact, local;
// use 64bit integer... shame it's not very standardized...
@ -238,10 +238,10 @@ R_BuildLightMap (msurface_t *surf, byte *dest, int stride)
int t;
int i, j, size;
byte *lightmap;
unsigned scale;
unsigned int scale;
int maps;
float t2;
unsigned *bl;
unsigned int *bl;
surf->cached_dlight = (surf->dlightframe == r_framecount);

View file

@ -795,10 +795,10 @@ void R_InitSky (texture_t *mt)
{
int i, j, p;
byte *src;
unsigned trans[128*128];
unsigned transpix;
unsigned int trans[128*128];
unsigned int transpix;
int r, g, b;
unsigned *rgba;
unsigned int *rgba;
src = (byte *)mt + mt->offsets[0];

View file

@ -125,7 +125,7 @@ Loads a model into the cache
model_t *Mod_LoadModel (model_t *mod, qboolean crash)
{
void *d;
unsigned *buf;
unsigned int *buf;
byte stackbuf[1024]; // avoid dirtying the cache heap
if (!mod->needload)
@ -143,7 +143,7 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
//
// load the file
//
buf = (unsigned *)COM_LoadStackFile (mod->name, stackbuf, sizeof(stackbuf));
buf = (unsigned int *)COM_LoadStackFile (mod->name, stackbuf, sizeof(stackbuf));
if (!buf)
{
if (crash)
@ -166,7 +166,7 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
mod->needload = false;
mod->hasfullbrights = false;
switch (LittleLong(*(unsigned *)buf))
switch (LittleLong(*(unsigned int *)buf))
{
case IDPOLYHEADER:
Mod_LoadAliasModel (mod, buf);

View file

@ -254,7 +254,7 @@ void Netchan_Transmit (netchan_t *chan, int length, byte *data)
sizebuf_t send;
byte send_buf[MAX_MSGLEN + PACKET_HEADER];
qboolean send_reliable;
unsigned w1, w2;
unsigned int w1, w2;
int i;
// check for message overflow
@ -352,8 +352,8 @@ modifies net_message so that it points to the packet payload
*/
qboolean Netchan_Process (netchan_t *chan)
{
unsigned sequence, sequence_ack;
unsigned reliable_ack, reliable_message;
unsigned int sequence, sequence_ack;
unsigned int reliable_ack, reliable_message;
int qport;
if (is_server)
@ -424,7 +424,7 @@ qboolean Netchan_Process (netchan_t *chan)
//
// discard stale or duplicated packets
//
if (sequence <= (unsigned)chan->incoming_sequence)
if (sequence <= (unsigned int)chan->incoming_sequence)
{
if (showdrop->value)
Con_Printf ("%s:Out of order packet %i at %i\n"
@ -453,7 +453,7 @@ qboolean Netchan_Process (netchan_t *chan)
// if the current outgoing reliable message has been acknowledged
// clear the buffer to make way for the next
//
if (reliable_ack == (unsigned)chan->reliable_sequence)
if (reliable_ack == (unsigned int)chan->reliable_sequence)
chan->reliable_length = 0; // it has been received
//

View file

@ -34,10 +34,10 @@
#endif
#include <mdfour.h>
unsigned Com_BlockChecksum (void *buffer, int length)
unsigned int Com_BlockChecksum (void *buffer, int length)
{
int digest[4];
unsigned val;
unsigned int val;
mdfour ( (unsigned char *) digest, (unsigned char *) buffer, length );

View file

@ -176,7 +176,7 @@ void PR_PrintStatement (dstatement_t *s)
{
int i;
if ( (unsigned)s->op < sizeof(pr_opnames)/sizeof(pr_opnames[0]))
if ( (unsigned int)s->op < sizeof(pr_opnames)/sizeof(pr_opnames[0]))
{
Con_Printf ("%s ", pr_opnames[s->op]);
i = strlen(pr_opnames[s->op]);
@ -190,7 +190,7 @@ void PR_PrintStatement (dstatement_t *s)
{
Con_Printf ("branch %i",s->a);
}
else if ( (unsigned)(s->op - OP_STORE_F) < 6)
else if ( (unsigned int)(s->op - OP_STORE_F) < 6)
{
Con_Printf ("%s",PR_GlobalString(s->a));
Con_Printf ("%s", PR_GlobalStringNoContents(s->b));

View file

@ -247,7 +247,7 @@ void R_AliasClipTriangle (mtriangle_t *ptri)
{
int i, k, pingpong;
mtriangle_t mtri;
unsigned clipflags;
unsigned int clipflags;
// copy vertexes and fix seam texture coordinates
if (ptri->facesfront)

View file

@ -107,7 +107,7 @@ qboolean R_AliasCheckBBox (void)
auxvert_t *pa0, *pa1, viewaux[16];
maliasframedesc_t *pframedesc;
qboolean zclipped, zfullyclipped;
unsigned anyclip, allclip;
unsigned int anyclip, allclip;
int minz;
// expand, rotate, and translate points into worldspace

View file

@ -395,7 +395,7 @@ R_RenderFace
void R_RenderFace (msurface_t *fa, int clipflags)
{
int i, lindex;
unsigned mask;
unsigned int mask;
mplane_t *pplane;
float distinv;
vec3_t p_normal;
@ -593,7 +593,7 @@ R_RenderBmodelFace
void R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf)
{
int i;
unsigned mask;
unsigned int mask;
mplane_t *pplane;
float distinv;
vec3_t p_normal;
@ -709,7 +709,7 @@ void R_RenderPoly (msurface_t *fa, int clipflags)
{
int i, lindex, lnumverts, s_axis, t_axis;
float dist, lastdist, lzi, scale, u, v, frac;
unsigned mask;
unsigned int mask;
vec3_t local, transformed;
clipplane_t *pclip;
medge_t *pedges;

View file

@ -162,7 +162,7 @@ int RecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
int i;
mtexinfo_t *tex;
byte *lightmap;
unsigned scale;
unsigned int scale;
int maps;
if (node->contents < 0)

View file

@ -109,7 +109,7 @@ void R_MakeSky (void)
int x, y;
int ofs, baseofs;
int xshift, yshift;
unsigned *pnewsky;
unsigned int *pnewsky;
static int xlast = -1, ylast = -1;
xshift = skytime*skyspeed;
@ -121,7 +121,7 @@ void R_MakeSky (void)
xlast = xshift;
ylast = yshift;
pnewsky = (unsigned *)&newsky[0];
pnewsky = (unsigned int *)&newsky[0];
for (y=0 ; y<SKYSIZE ; y++)
{
@ -136,9 +136,9 @@ void R_MakeSky (void)
// PORT: unaligned dword access to bottommask and bottomsky
*pnewsky = (*(pnewsky + (128 / sizeof (unsigned))) &
*(unsigned *)&bottommask[ofs]) |
*(unsigned *)&bottomsky[ofs];
*pnewsky = (*(pnewsky + (128 / sizeof (unsigned int))) &
*(unsigned int *)&bottommask[ofs]) |
*(unsigned int *)&bottomsky[ofs];
pnewsky++;
}
@ -151,12 +151,12 @@ void R_MakeSky (void)
*(byte *)pnewsky = (*((byte *)pnewsky + 128) &
*(byte *)&bottommask[ofs]) |
*(byte *)&bottomsky[ofs];
pnewsky = (unsigned *)((byte *)pnewsky + 1);
pnewsky = (unsigned int *)((byte *)pnewsky + 1);
}
#endif
pnewsky += 128 / sizeof (unsigned);
pnewsky += 128 / sizeof (unsigned int);
}
r_skymade = 1;
@ -173,14 +173,14 @@ void R_GenSkyTile (void *pdest)
int x, y;
int ofs, baseofs;
int xshift, yshift;
unsigned *pnewsky;
unsigned *pd;
unsigned int *pnewsky;
unsigned int *pd;
xshift = skytime*skyspeed;
yshift = skytime*skyspeed;
pnewsky = (unsigned *)&newsky[0];
pd = (unsigned *)pdest;
pnewsky = (unsigned int *)&newsky[0];
pd = (unsigned int *)pdest;
for (y=0 ; y<SKYSIZE ; y++)
{
@ -195,9 +195,9 @@ void R_GenSkyTile (void *pdest)
// PORT: unaligned dword access to bottommask and bottomsky
*pd = (*(pnewsky + (128 / sizeof (unsigned))) &
*(unsigned *)&bottommask[ofs]) |
*(unsigned *)&bottomsky[ofs];
*pd = (*(pnewsky + (128 / sizeof (unsigned int))) &
*(unsigned int *)&bottommask[ofs]) |
*(unsigned int *)&bottomsky[ofs];
pnewsky++;
pd++;
}
@ -211,13 +211,13 @@ void R_GenSkyTile (void *pdest)
*(byte *)pd = (*((byte *)pnewsky + 128) &
*(byte *)&bottommask[ofs]) |
*(byte *)&bottomsky[ofs];
pnewsky = (unsigned *)((byte *)pnewsky + 1);
pd = (unsigned *)((byte *)pd + 1);
pnewsky = (unsigned int *)((byte *)pnewsky + 1);
pd = (unsigned int *)((byte *)pd + 1);
}
#endif
pnewsky += 128 / sizeof (unsigned);
pnewsky += 128 / sizeof (unsigned int);
}
}

View file

@ -38,11 +38,11 @@ drawsurf_t r_drawsurf;
int lightleft, sourcesstep, blocksize, sourcetstep;
int lightdelta, lightdeltastep;
int lightright, lightleftstep, lightrightstep, blockdivshift;
unsigned blockdivmask;
unsigned int blockdivmask;
void *prowdestbase;
unsigned char *pbasesource;
int surfrowbytes; // used by ASM files
unsigned *r_lightptr;
unsigned int *r_lightptr;
int r_stepback;
int r_lightwidth;
int r_numhblocks, r_numvblocks;
@ -62,7 +62,7 @@ static void (*surfmiptable[4])(void) = {
unsigned blocklights[18*18];
unsigned int blocklights[18*18];
/*
===============
@ -144,7 +144,7 @@ void R_BuildLightMap (void)
int t;
int i, size;
byte *lightmap;
unsigned scale;
unsigned int scale;
int maps;
msurface_t *surf;

View file

@ -880,7 +880,7 @@ void S_ExtraUpdate (void)
void S_Update_(void)
{
unsigned endtime;
unsigned int endtime;
int samps;
if (!sound_started || (snd_blocked > 0))

View file

@ -209,7 +209,7 @@ void SV_CalcPHS (void)
int rowbytes, rowwords;
int i, j, k, l, index, num;
int bitbyte;
unsigned *dest, *src;
unsigned int *dest, *src;
byte *scan;
int count, vcount;
@ -241,7 +241,7 @@ void SV_CalcPHS (void)
sv.phs = Hunk_Alloc (rowbytes*num);
count = 0;
scan = sv.pvs;
dest = (unsigned *)sv.phs;
dest = (unsigned int *)sv.phs;
for (i=0 ; i<num ; i++, dest += rowwords, scan += rowbytes)
{
memcpy (dest, scan, rowbytes);
@ -259,7 +259,7 @@ void SV_CalcPHS (void)
index = ((j<<3)+k+1);
if (index >= num)
continue;
src = (unsigned *)sv.pvs + index*rowwords;
src = (unsigned int *)sv.pvs + index*rowwords;
for (l=0 ; l<rowwords ; l++)
dest[l] |= src[l];
}
@ -276,7 +276,7 @@ void SV_CalcPHS (void)
, vcount/num, count/num, num);
}
unsigned SV_CheckModel(char *mdl)
unsigned int SV_CheckModel(char *mdl)
{
byte stackbuf[1024]; // avoid dirtying the cache heap
byte *buf;

View file

@ -1008,8 +1008,8 @@ If 0, then only addresses matching the list will be allowed. This lets you easi
typedef struct
{
unsigned mask;
unsigned compare;
unsigned int mask;
unsigned int compare;
} ipfilter_t;
#define MAX_IPFILTERS 1024
@ -1060,8 +1060,8 @@ qboolean StringToFilter (char *s, ipfilter_t *f)
s++;
}
f->mask = *(unsigned *)m;
f->compare = *(unsigned *)b;
f->mask = *(unsigned int *)m;
f->compare = *(unsigned int *)b;
return true;
}
@ -1130,7 +1130,7 @@ void SV_ListIP_f (void)
Con_Printf ("Filter list:\n");
for (i=0 ; i<numipfilters ; i++)
{
*(unsigned *)b = ipfilters[i].compare;
*(unsigned int *)b = ipfilters[i].compare;
Con_Printf ("%3i.%3i.%3i.%3i\n", b[0], b[1], b[2], b[3]);
}
}
@ -1160,7 +1160,7 @@ void SV_WriteIP_f (void)
for (i=0 ; i<numipfilters ; i++)
{
*(unsigned *)b = ipfilters[i].compare;
*(unsigned int *)b = ipfilters[i].compare;
fprintf (f, "addip %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]);
}
@ -1258,9 +1258,9 @@ SV_FilterPacket
qboolean SV_FilterPacket (void)
{
int i;
unsigned in;
unsigned int in;
in = *(unsigned *)net_from.ip;
in = *(unsigned int *)net_from.ip;
for (i=0 ; i<numipfilters ; i++)
if ( (in & ipfilters[i].mask) == ipfilters[i].compare)

View file

@ -266,8 +266,8 @@ SV_PreSpawn_f
*/
void SV_PreSpawn_f (void)
{
unsigned buf;
unsigned check;
unsigned int buf;
unsigned int check;
if (host_client->state != cs_connected)
{
@ -468,7 +468,7 @@ SV_Begin_f
*/
void SV_Begin_f (void)
{
unsigned pmodel = 0, emodel = 0;
unsigned int pmodel = 0, emodel = 0;
int i;
if (host_client->state == cs_spawned)

View file

@ -64,7 +64,7 @@
//unsigned short d_8to16table[256];
unsigned d_8to24table[256];
unsigned int d_8to24table[256];
unsigned char d_15to8table[65536];
static cvar_t *vid_mode;
@ -153,12 +153,12 @@ void VID_ShiftPalette(unsigned char *p)
void VID_SetPalette (unsigned char *palette)
{
byte *pal;
unsigned r,g,b;
unsigned v;
unsigned int r,g,b;
unsigned int v;
int r1,g1,b1;
int k;
unsigned short i;
unsigned *table;
unsigned int *table;
FILE *f;
char s[255];
//#endif

View file

@ -92,7 +92,7 @@ static Cursor nullcursor = None;
#define X_MASK (VisibilityChangeMask | StructureNotifyMask)
unsigned short d_8to16table[256];
unsigned d_8to24table[256];
unsigned int d_8to24table[256];
unsigned char d_15to8table[65536];
cvar_t *vid_mode;
@ -254,12 +254,12 @@ void VID_ShiftPalette(unsigned char *p)
void VID_SetPalette (unsigned char *palette)
{
byte *pal;
unsigned r,g,b;
unsigned v;
unsigned int r,g,b;
unsigned int v;
int r1,g1,b1;
int k;
unsigned short i;
unsigned *table;
unsigned int *table;
FILE *f;
char s[255];
float dist, bestdist;

View file

@ -138,7 +138,7 @@ static int VID_highhunkmark;
unsigned char vid_curpal[256*3];
unsigned short d_8to16table[256];
unsigned d_8to24table[256];
unsigned int d_8to24table[256];
int driver = grDETECT,mode;
qboolean useWinDirect = true, useDirectDraw = true;

View file

@ -42,7 +42,7 @@ short zbuffer[BASEWIDTH*BASEHEIGHT];
byte surfcache[256*1024];
unsigned short d_8to16table[256];
unsigned d_8to24table[256];
unsigned int d_8to24table[256];
void VID_SetPalette (unsigned char *palette)
{

View file

@ -69,7 +69,7 @@ HWND mainwindow;
#endif
unsigned short d_8to16table[256];
unsigned d_8to24table[256];
unsigned int d_8to24table[256];
unsigned char d_15to8table[65536];
int scr_width, scr_height;
@ -148,12 +148,12 @@ void
VID_SetPalette (unsigned char *palette)
{
byte *pal;
unsigned r,g,b;
unsigned v;
unsigned int r,g,b;
unsigned int v;
int r1,g1,b1;
int k;
unsigned short i;
unsigned *table;
unsigned int *table;
FILE *f;
char s[256];
float dist, bestdist;

View file

@ -127,7 +127,7 @@ HWND WINAPI InitializeWindow (HINSTANCE hInstance, int nCmdShow);
extern viddef_t vid; // global video state
unsigned short d_8to16table[256];
unsigned d_8to24table[256];
unsigned int d_8to24table[256];
unsigned char d_15to8table[65536];
float gldepthmin, gldepthmax;
@ -715,12 +715,12 @@ void GL_EndRendering (void)
void VID_SetPalette (unsigned char *palette)
{
byte *pal;
unsigned r,g,b;
unsigned v;
unsigned int r,g,b;
unsigned int v;
int r1,g1,b1;
int k;
unsigned short i;
unsigned *table;
unsigned int *table;
FILE *f;
char s[255];
float dist, bestdist;

View file

@ -82,7 +82,7 @@ void W_LoadWadFile (char *filename)
{
lumpinfo_t *lump_p;
wadinfo_t *header;
unsigned i;
unsigned int i;
int infotableofs;
wad_base = COM_LoadHunkFile (filename);