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 typedef struct miptex_s
{ {
char name[16]; char name[16];
unsigned width, height; unsigned int width, height;
unsigned offsets[MIPLEVELS]; // four mip maps stored unsigned int offsets[MIPLEVELS]; // four mip maps stored
} miptex_t; } miptex_t;

View file

@ -31,9 +31,9 @@
#include "qtypes.h" #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); 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); byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence);
#endif // _CHECKSUM_H #endif // _CHECKSUM_H

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1082,7 +1082,7 @@ void CL_MuzzleFlash (void)
i = MSG_ReadShort (); i = MSG_ReadShort ();
if ((unsigned)(i-1) >= MAX_CLIENTS) if ((unsigned int)(i-1) >= MAX_CLIENTS)
return; return;
// don't draw our own muzzle flash in gl if flashblending // 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; int rx, ry, rwidth, rheight;
unsigned char *dest; unsigned char *dest;
unsigned *ldest; unsigned int *ldest;
rx = rect->x; rx = rect->x;
ry = rect->y; ry = rect->y;
@ -71,7 +71,7 @@ void D_FillRect (vrect_t *rect, int color)
if (((rwidth & 0x03) == 0) && (((long)dest & 0x03) == 0)) if (((rwidth & 0x03) == 0) && (((long)dest & 0x03) == 0))
{ {
// faster aligned dword clear // faster aligned dword clear
ldest = (unsigned *)dest; ldest = (unsigned int *)dest;
color += color << 16; color += color << 16;
rwidth >>= 2; rwidth >>= 2;
@ -81,7 +81,7 @@ void D_FillRect (vrect_t *rect, int color)
{ {
for (rx=0 ; rx<rwidth ; rx++) for (rx=0 ; rx<rwidth ; rx++)
ldest[rx] = color; ldest[rx] = color;
ldest = (unsigned *)((byte*)ldest + vid.rowbytes); ldest = (unsigned int *)((byte*)ldest + vid.rowbytes);
} }
} }
else else

View file

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

View file

@ -437,8 +437,8 @@ void Draw_TransPic (int x, int y, qpic_t *pic)
unsigned short *pusdest; unsigned short *pusdest;
int v, u; int v, u;
if (x < 0 || (unsigned)(x + pic->width) > vid.width || y < 0 || if (x < 0 || (unsigned int)(x + pic->width) > vid.width || y < 0 ||
(unsigned)(y + pic->height) > vid.height) (unsigned int)(y + pic->height) > vid.height)
{ {
Sys_Error ("Draw_TransPic: bad coordinates"); 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; unsigned short *pusdest;
int v, u; int v, u;
if (x < 0 || (unsigned)(x + pic->width) > vid.width || y < 0 || if (x < 0 || (unsigned int)(x + pic->width) > vid.width || y < 0 ||
(unsigned)(y + pic->height) > vid.height) (unsigned int)(y + pic->height) > vid.height)
{ {
Sys_Error ("Draw_TransPic: bad coordinates"); 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; byte *dest;
unsigned short *pusdest; unsigned short *pusdest;
unsigned uc; unsigned int uc;
int u, v; int u, v;
if (x < 0 || x + w > vid.width || 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) void Draw_TransPic (int x, int y, qpic_t *pic)
{ {
if (x < 0 || (unsigned)(x + pic->width) > vid.width || y < 0 || if (x < 0 || (unsigned int)(x + pic->width) > vid.width || y < 0 ||
(unsigned)(y + pic->height) > vid.height) (unsigned int)(y + pic->height) > vid.height)
{ {
Sys_Error ("Draw_TransPic: bad coordinates"); 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) void Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte *translation)
{ {
int v, u, c; int v, u, c;
unsigned trans[64*64], *dest; unsigned int trans[64*64], *dest;
byte *src; byte *src;
int p; int p;
@ -985,11 +985,11 @@ void GL_Set2D (void)
GL_ResampleTexture 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; int i, j;
unsigned *inrow; unsigned int *inrow;
unsigned frac, fracstep; unsigned int frac, fracstep;
fracstep = inwidth*0x10000/outwidth; fracstep = inwidth*0x10000/outwidth;
for (i=0 ; i<outheight ; i++, out += 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; int i, j;
unsigned char *inrow; unsigned char *inrow;
unsigned frac, fracstep; unsigned int frac, fracstep;
fracstep = inwidth*0x10000/outwidth; fracstep = inwidth*0x10000/outwidth;
for (i=0 ; i<outheight ; i++, out += 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 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; unsigned int *scaled;
static unsigned scaled[1024*512]; // [512*256]; int scaled_width, scaled_height, samples;
int scaled_width, scaled_height;
for (scaled_width = 1 ; scaled_width < width ; scaled_width<<=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) for (scaled_height = 1 ; scaled_height < height ; scaled_height<<=1) ;
;
scaled_width >>= (int)gl_picmip->value; scaled_width >>= (int)gl_picmip->value;
scaled_height >>= (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_width = min(scaled_width, gl_max_size->value);
scaled_height = min(scaled_height, 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"); Sys_Error ("GL_LoadTexture: too big");
samples = alpha ? gl_alpha_format : gl_solid_format; samples = alpha ? gl_alpha_format : gl_solid_format;
#if 0 // If the real width/height and the 'scaled' width/height then we
if (mipmap) // rescale it.
gluBuild2DMipmaps (GL_TEXTURE_2D, samples, width, height, GL_RGBA, GL_UNSIGNED_BYTE, trans); if (scaled_width == width && scaled_height == height) {
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;
}
memcpy (scaled, data, width*height*4); memcpy (scaled, data, width*height*4);
} } else {
else
GL_ResampleTexture (data, width, height, scaled, scaled_width, scaled_height); 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); glTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
if (mipmap)
{ if (mipmap) {
int miplevel; int miplevel;
miplevel = 0; miplevel = 0;
while (scaled_width > 1 || scaled_height > 1) while (scaled_width > 1 || scaled_height > 1) {
{
GL_MipMap ((byte *)scaled, scaled_width, scaled_height); GL_MipMap ((byte *)scaled, scaled_width, scaled_height);
scaled_width >>= 1; scaled_width >>= 1;
scaled_height >>= 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); 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_MIN_FILTER, gl_filter_min);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); 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_MIN_FILTER, gl_filter_max);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_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) void GL_Upload8_EXT (byte *data, int width, int height, qboolean mipmap, qboolean alpha)
{ {
int i, s; #ifdef HAVE_GL_COLOR_INDEX8_EXT
qboolean noalpha; byte *scaled;
int samples;
static unsigned char scaled[1024*512]; // [512*256];
int scaled_width, scaled_height; int scaled_width, scaled_height;
s = width*height; // Snap the height and width to a power of 2.
// if there are no transparent pixels, make it a 3 component for (scaled_width = 1 ; scaled_width < width ; scaled_width<<=1) ;
// texture even if it was specified as otherwise for (scaled_height = 1 ; scaled_height < height ; scaled_height<<=1) ;
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)
;
scaled_width >>= (int)gl_picmip->value; scaled_width >>= (int)gl_picmip->value;
scaled_height >>= (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_width = min(scaled_width, gl_max_size->value);
scaled_height = min(scaled_height, 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"); Sys_Error ("GL_LoadTexture: too big");
samples = 1; // alpha ? gl_alpha_format : gl_solid_format; // If the real width/height and the 'scaled' width/height then we
// rescale it.
if (scaled_width == width && scaled_height == height) 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;
}
memcpy (scaled, data, width*height); memcpy (scaled, data, width*height);
} } else {
else
GL_Resample8BitTexture (data, width, height, scaled, scaled_width, scaled_height); 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); 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 */ if (mipmap) {
#endif
if (mipmap)
{
int miplevel; int miplevel;
miplevel = 0; miplevel = 0;
while (scaled_width > 1 || scaled_height > 1) while (scaled_width > 1 || scaled_height > 1) {
{
GL_MipMap8Bit ((byte *)scaled, scaled_width, scaled_height); GL_MipMap8Bit ((byte *)scaled, scaled_width, scaled_height);
scaled_width >>= 1; scaled_width >>= 1;
scaled_height >>= 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) if (scaled_height < 1)
scaled_height = 1; scaled_height = 1;
miplevel++; 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); 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_MIN_FILTER, gl_filter_min);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max); 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_MIN_FILTER, gl_filter_max);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_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(); extern qboolean VID_Is8bit();
@ -1294,7 +1231,47 @@ GL_Upload8
*/ */
void GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean alpha) 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; int i, s;
qboolean noalpha; qboolean noalpha;
int p; int p;
@ -1340,6 +1317,7 @@ static unsigned trans[640*480]; // FIXME, temporary
} }
GL_Upload32 (trans, width, height, mipmap, alpha); GL_Upload32 (trans, width, height, mipmap, alpha);
#endif
} }
/* /*
@ -1405,7 +1383,7 @@ SetupTexture:
GL_Upload8 (data, width, height, mipmap, alpha); GL_Upload8 (data, width, height, mipmap, alpha);
break; break;
case 4: case 4:
GL_Upload32 ((unsigned *)data, width, height, mipmap, alpha); GL_Upload32 ((unsigned int *) data, width, height, mipmap, alpha);
break; break;
default: default:
Sys_Error ("SetupTexture: unknown bytesperpixel %i", Sys_Error ("SetupTexture: unknown bytesperpixel %i",

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -795,10 +795,10 @@ void R_InitSky (texture_t *mt)
{ {
int i, j, p; int i, j, p;
byte *src; byte *src;
unsigned trans[128*128]; unsigned int trans[128*128];
unsigned transpix; unsigned int transpix;
int r, g, b; int r, g, b;
unsigned *rgba; unsigned int *rgba;
src = (byte *)mt + mt->offsets[0]; 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) model_t *Mod_LoadModel (model_t *mod, qboolean crash)
{ {
void *d; void *d;
unsigned *buf; unsigned int *buf;
byte stackbuf[1024]; // avoid dirtying the cache heap byte stackbuf[1024]; // avoid dirtying the cache heap
if (!mod->needload) if (!mod->needload)
@ -143,7 +143,7 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
// //
// load the file // 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 (!buf)
{ {
if (crash) if (crash)
@ -166,7 +166,7 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
mod->needload = false; mod->needload = false;
mod->hasfullbrights = false; mod->hasfullbrights = false;
switch (LittleLong(*(unsigned *)buf)) switch (LittleLong(*(unsigned int *)buf))
{ {
case IDPOLYHEADER: case IDPOLYHEADER:
Mod_LoadAliasModel (mod, buf); Mod_LoadAliasModel (mod, buf);

View file

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

View file

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

View file

@ -176,7 +176,7 @@ void PR_PrintStatement (dstatement_t *s)
{ {
int i; 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]); Con_Printf ("%s ", pr_opnames[s->op]);
i = strlen(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); 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_GlobalString(s->a));
Con_Printf ("%s", PR_GlobalStringNoContents(s->b)); Con_Printf ("%s", PR_GlobalStringNoContents(s->b));

View file

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

View file

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

View file

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

View file

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

View file

@ -109,7 +109,7 @@ void R_MakeSky (void)
int x, y; int x, y;
int ofs, baseofs; int ofs, baseofs;
int xshift, yshift; int xshift, yshift;
unsigned *pnewsky; unsigned int *pnewsky;
static int xlast = -1, ylast = -1; static int xlast = -1, ylast = -1;
xshift = skytime*skyspeed; xshift = skytime*skyspeed;
@ -121,7 +121,7 @@ void R_MakeSky (void)
xlast = xshift; xlast = xshift;
ylast = yshift; ylast = yshift;
pnewsky = (unsigned *)&newsky[0]; pnewsky = (unsigned int *)&newsky[0];
for (y=0 ; y<SKYSIZE ; y++) for (y=0 ; y<SKYSIZE ; y++)
{ {
@ -136,9 +136,9 @@ void R_MakeSky (void)
// PORT: unaligned dword access to bottommask and bottomsky // PORT: unaligned dword access to bottommask and bottomsky
*pnewsky = (*(pnewsky + (128 / sizeof (unsigned))) & *pnewsky = (*(pnewsky + (128 / sizeof (unsigned int))) &
*(unsigned *)&bottommask[ofs]) | *(unsigned int *)&bottommask[ofs]) |
*(unsigned *)&bottomsky[ofs]; *(unsigned int *)&bottomsky[ofs];
pnewsky++; pnewsky++;
} }
@ -151,12 +151,12 @@ void R_MakeSky (void)
*(byte *)pnewsky = (*((byte *)pnewsky + 128) & *(byte *)pnewsky = (*((byte *)pnewsky + 128) &
*(byte *)&bottommask[ofs]) | *(byte *)&bottommask[ofs]) |
*(byte *)&bottomsky[ofs]; *(byte *)&bottomsky[ofs];
pnewsky = (unsigned *)((byte *)pnewsky + 1); pnewsky = (unsigned int *)((byte *)pnewsky + 1);
} }
#endif #endif
pnewsky += 128 / sizeof (unsigned); pnewsky += 128 / sizeof (unsigned int);
} }
r_skymade = 1; r_skymade = 1;
@ -173,14 +173,14 @@ void R_GenSkyTile (void *pdest)
int x, y; int x, y;
int ofs, baseofs; int ofs, baseofs;
int xshift, yshift; int xshift, yshift;
unsigned *pnewsky; unsigned int *pnewsky;
unsigned *pd; unsigned int *pd;
xshift = skytime*skyspeed; xshift = skytime*skyspeed;
yshift = skytime*skyspeed; yshift = skytime*skyspeed;
pnewsky = (unsigned *)&newsky[0]; pnewsky = (unsigned int *)&newsky[0];
pd = (unsigned *)pdest; pd = (unsigned int *)pdest;
for (y=0 ; y<SKYSIZE ; y++) for (y=0 ; y<SKYSIZE ; y++)
{ {
@ -195,9 +195,9 @@ void R_GenSkyTile (void *pdest)
// PORT: unaligned dword access to bottommask and bottomsky // PORT: unaligned dword access to bottommask and bottomsky
*pd = (*(pnewsky + (128 / sizeof (unsigned))) & *pd = (*(pnewsky + (128 / sizeof (unsigned int))) &
*(unsigned *)&bottommask[ofs]) | *(unsigned int *)&bottommask[ofs]) |
*(unsigned *)&bottomsky[ofs]; *(unsigned int *)&bottomsky[ofs];
pnewsky++; pnewsky++;
pd++; pd++;
} }
@ -211,13 +211,13 @@ void R_GenSkyTile (void *pdest)
*(byte *)pd = (*((byte *)pnewsky + 128) & *(byte *)pd = (*((byte *)pnewsky + 128) &
*(byte *)&bottommask[ofs]) | *(byte *)&bottommask[ofs]) |
*(byte *)&bottomsky[ofs]; *(byte *)&bottomsky[ofs];
pnewsky = (unsigned *)((byte *)pnewsky + 1); pnewsky = (unsigned int *)((byte *)pnewsky + 1);
pd = (unsigned *)((byte *)pd + 1); pd = (unsigned int *)((byte *)pd + 1);
} }
#endif #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 lightleft, sourcesstep, blocksize, sourcetstep;
int lightdelta, lightdeltastep; int lightdelta, lightdeltastep;
int lightright, lightleftstep, lightrightstep, blockdivshift; int lightright, lightleftstep, lightrightstep, blockdivshift;
unsigned blockdivmask; unsigned int blockdivmask;
void *prowdestbase; void *prowdestbase;
unsigned char *pbasesource; unsigned char *pbasesource;
int surfrowbytes; // used by ASM files int surfrowbytes; // used by ASM files
unsigned *r_lightptr; unsigned int *r_lightptr;
int r_stepback; int r_stepback;
int r_lightwidth; int r_lightwidth;
int r_numhblocks, r_numvblocks; 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 t;
int i, size; int i, size;
byte *lightmap; byte *lightmap;
unsigned scale; unsigned int scale;
int maps; int maps;
msurface_t *surf; msurface_t *surf;

View file

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

View file

@ -209,7 +209,7 @@ void SV_CalcPHS (void)
int rowbytes, rowwords; int rowbytes, rowwords;
int i, j, k, l, index, num; int i, j, k, l, index, num;
int bitbyte; int bitbyte;
unsigned *dest, *src; unsigned int *dest, *src;
byte *scan; byte *scan;
int count, vcount; int count, vcount;
@ -241,7 +241,7 @@ void SV_CalcPHS (void)
sv.phs = Hunk_Alloc (rowbytes*num); sv.phs = Hunk_Alloc (rowbytes*num);
count = 0; count = 0;
scan = sv.pvs; scan = sv.pvs;
dest = (unsigned *)sv.phs; dest = (unsigned int *)sv.phs;
for (i=0 ; i<num ; i++, dest += rowwords, scan += rowbytes) for (i=0 ; i<num ; i++, dest += rowwords, scan += rowbytes)
{ {
memcpy (dest, scan, rowbytes); memcpy (dest, scan, rowbytes);
@ -259,7 +259,7 @@ void SV_CalcPHS (void)
index = ((j<<3)+k+1); index = ((j<<3)+k+1);
if (index >= num) if (index >= num)
continue; continue;
src = (unsigned *)sv.pvs + index*rowwords; src = (unsigned int *)sv.pvs + index*rowwords;
for (l=0 ; l<rowwords ; l++) for (l=0 ; l<rowwords ; l++)
dest[l] |= src[l]; dest[l] |= src[l];
} }
@ -276,7 +276,7 @@ void SV_CalcPHS (void)
, vcount/num, count/num, num); , 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 stackbuf[1024]; // avoid dirtying the cache heap
byte *buf; 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 typedef struct
{ {
unsigned mask; unsigned int mask;
unsigned compare; unsigned int compare;
} ipfilter_t; } ipfilter_t;
#define MAX_IPFILTERS 1024 #define MAX_IPFILTERS 1024
@ -1060,8 +1060,8 @@ qboolean StringToFilter (char *s, ipfilter_t *f)
s++; s++;
} }
f->mask = *(unsigned *)m; f->mask = *(unsigned int *)m;
f->compare = *(unsigned *)b; f->compare = *(unsigned int *)b;
return true; return true;
} }
@ -1130,7 +1130,7 @@ void SV_ListIP_f (void)
Con_Printf ("Filter list:\n"); Con_Printf ("Filter list:\n");
for (i=0 ; i<numipfilters ; i++) 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]); 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++) 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]); 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) qboolean SV_FilterPacket (void)
{ {
int i; int i;
unsigned in; unsigned int in;
in = *(unsigned *)net_from.ip; in = *(unsigned int *)net_from.ip;
for (i=0 ; i<numipfilters ; i++) for (i=0 ; i<numipfilters ; i++)
if ( (in & ipfilters[i].mask) == ipfilters[i].compare) if ( (in & ipfilters[i].mask) == ipfilters[i].compare)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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