From c4ee1bbcc6b2f917465f07269ad09942bbf40849 Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Wed, 27 Feb 2002 03:58:07 +0000 Subject: [PATCH] renamed byte to qbyte throughout engine to eliminate a mingw conflict git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1579 d7cf8633-e32d-0410-b094-e92efae38249 --- bspfile.h | 14 +++--- cd_linux.c | 22 +++++----- cd_win.c | 24 +++++------ cdaudio.h | 2 +- cgamevm.c | 6 +-- cgamevm.h | 2 +- cl_input.c | 2 +- cl_main.c | 4 +- cl_parse.c | 12 +++--- cl_particles.c | 4 +- cl_screen.c | 10 ++--- cl_screen.h | 4 +- cl_tent.c | 4 +- client.h | 2 +- common.c | 46 ++++++++++---------- common.h | 4 +- console.h | 6 +-- crc.c | 6 +-- crc.h | 6 +-- fractalnoise.c | 12 +++--- gl_backend.c | 6 +-- gl_draw.c | 16 +++---- gl_models.c | 10 ++--- gl_rsurf.c | 28 ++++++------ gl_textures.c | 110 +++++++++++++++++++++++------------------------ image.c | 56 ++++++++++++------------ image.h | 18 ++++---- mathlib.c | 4 +- mathlib.h | 4 +- menu.c | 8 ++-- model_alias.c | 16 +++---- model_brush.c | 31 +++++++------ model_brush.h | 10 ++--- model_shared.c | 2 +- model_shared.h | 8 ++-- model_sprite.c | 12 +++--- modelgen.h | 4 +- net.h | 10 ++--- net_dgrm.c | 18 ++++---- net_loop.c | 12 +++--- net_udp.c | 6 +-- net_udp.h | 6 +-- net_wins.c | 8 ++-- net_wins.h | 6 +-- net_wipx.c | 8 ++-- net_wipx.h | 6 +-- palette.c | 18 ++++---- palette.h | 4 +- pr_cmds.c | 4 +- pr_comp.h | 2 +- pr_edict.c | 18 ++++---- pr_execprogram.h | 12 +++--- progs.h | 14 +++--- protocol.c | 6 +-- protocol.h | 20 ++++----- quakedef.h | 21 ++++----- r_clip.c | 14 +++--- r_crosshairs.c | 4 +- r_explosion.c | 4 +- r_light.c | 6 +-- r_particles.c | 14 +++--- r_sky.c | 53 +++++++++++------------ r_textures.h | 6 +-- render.h | 4 +- sbar.c | 24 +++++------ server.h | 8 ++-- snd_mem.c | 16 +++---- sound.h | 4 +- sv_light.c | 2 +- sv_main.c | 22 +++++----- sys_win.c | 18 ++++---- ui.c | 2 +- vid_3dfxsvga.c | 2 +- vid_shared.c | 2 + vid_wgl.c | 14 +++--- wad.c | 16 +++---- wad.h | 8 ++-- winquake.h | 5 ++- world.c | 4 +- zone.h | 2 +- 80 files changed, 492 insertions(+), 496 deletions(-) diff --git a/bspfile.h b/bspfile.h index 7c8d489a..24c3c148 100644 --- a/bspfile.h +++ b/bspfile.h @@ -197,7 +197,7 @@ typedef struct short texinfo; // lighting info - byte styles[MAXLIGHTMAPS]; + qbyte styles[MAXLIGHTMAPS]; int lightofs; // start of [numstyles*surfsize] samples } dface_t; @@ -223,7 +223,7 @@ typedef struct unsigned short firstmarksurface; unsigned short nummarksurfaces; - byte ambient_level[NUM_AMBIENTS]; + qbyte ambient_level[NUM_AMBIENTS]; } dleaf_t; @@ -241,13 +241,13 @@ extern int nummodels; extern dmodel_t dmodels[MAX_MAP_MODELS]; extern int visdatasize; -extern byte dvisdata[MAX_MAP_VISIBILITY]; +extern qbyte dvisdata[MAX_MAP_VISIBILITY]; extern int lightdatasize; -extern byte dlightdata[MAX_MAP_LIGHTING]; +extern qbyte dlightdata[MAX_MAP_LIGHTING]; extern int texdatasize; -extern byte dtexdata[MAX_MAP_MIPTEX]; // (dmiptexlump_t) +extern qbyte dtexdata[MAX_MAP_MIPTEX]; // (dmiptexlump_t) extern int entdatasize; extern char dentdata[MAX_MAP_ENTSTRING]; @@ -283,8 +283,8 @@ extern int numsurfedges; extern int dsurfedges[MAX_MAP_SURFEDGES]; -void DecompressVis (byte *in, byte *decompressed); -int CompressVis (byte *vis, byte *dest); +void DecompressVis (qbyte *in, qbyte *decompressed); +int CompressVis (qbyte *vis, qbyte *dest); void LoadBSPFile (char *filename); void WriteBSPFile (char *filename); diff --git a/cd_linux.c b/cd_linux.c index bdfea606..d188b8e1 100644 --- a/cd_linux.c +++ b/cd_linux.c @@ -38,15 +38,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // used by menu to ghost CD audio slider qboolean cdaudioinitialized = false; static qboolean cdValid = false; -static qboolean playing = false; -static qboolean wasPlaying = false; -static qboolean initialized = false; -static qboolean enabled = true; +static qboolean playing = false; +static qboolean wasPlaying = false; +static qboolean initialized = false; +static qboolean enabled = true; static qboolean playLooping = false; -static float cdvolume; -static byte remap[100]; -static byte playTrack; -static byte maxTrack; +static float cdvolume; +static qbyte remap[100]; +static qbyte playTrack; +static qbyte maxTrack; static int cdfile = -1; static char cd_dev[64] = "/dev/cdrom"; @@ -95,7 +95,7 @@ static int CDAudio_GetAudioDiskInfo(void) } -void CDAudio_Play(byte track, qboolean looping) +void CDAudio_Play(qbyte track, qboolean looping) { struct cdrom_tocentry entry; struct cdrom_ti ti; @@ -278,13 +278,13 @@ static void CD_f (void) if (Q_strcasecmp(command, "play") == 0) { - CDAudio_Play((byte)atoi(Cmd_Argv (2)), false); + CDAudio_Play((qbyte)atoi(Cmd_Argv (2)), false); return; } if (Q_strcasecmp(command, "loop") == 0) { - CDAudio_Play((byte)atoi(Cmd_Argv (2)), true); + CDAudio_Play((qbyte)atoi(Cmd_Argv (2)), true); return; } diff --git a/cd_win.c b/cd_win.c index 7766e552..5b35239f 100644 --- a/cd_win.c +++ b/cd_win.c @@ -27,16 +27,16 @@ extern HWND mainwindow; qboolean cdaudioinitialized = false; static qboolean cdValid = false; -static qboolean playing = false; -static qboolean wasPlaying = false; -static qboolean initialized = false; -static qboolean enabled = false; +static qboolean playing = false; +static qboolean wasPlaying = false; +static qboolean initialized = false; +static qboolean enabled = false; static qboolean playLooping = false; -static float cdvolume; -static byte remap[100]; -static byte cdrom; -static byte playTrack; -static byte maxTrack; +static float cdvolume; +static qbyte remap[100]; +static qbyte cdrom; +static qbyte playTrack; +static qbyte maxTrack; UINT wDeviceID; @@ -100,7 +100,7 @@ static int CDAudio_GetAudioDiskInfo(void) } -void CDAudio_Play(byte track, qboolean looping) +void CDAudio_Play(qbyte track, qboolean looping) { DWORD dwReturn; MCI_PLAY_PARMS mciPlayParms; @@ -309,13 +309,13 @@ static void CD_f (void) if (Q_strcasecmp(command, "play") == 0) { - CDAudio_Play((byte)atoi(Cmd_Argv (2)), false); + CDAudio_Play((qbyte)atoi(Cmd_Argv (2)), false); return; } if (Q_strcasecmp(command, "loop") == 0) { - CDAudio_Play((byte)atoi(Cmd_Argv (2)), true); + CDAudio_Play((qbyte)atoi(Cmd_Argv (2)), true); return; } diff --git a/cdaudio.h b/cdaudio.h index 80e975be..e8519cd6 100644 --- a/cdaudio.h +++ b/cdaudio.h @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ int CDAudio_Init(void); -void CDAudio_Play(byte track, qboolean looping); +void CDAudio_Play(qbyte track, qboolean looping); void CDAudio_Stop(void); void CDAudio_Pause(void); void CDAudio_Resume(void); diff --git a/cgamevm.c b/cgamevm.c index 9dd567e2..249185e2 100644 --- a/cgamevm.c +++ b/cgamevm.c @@ -11,7 +11,7 @@ static mempool_t *cgvm_mempool; static void (*cgvm_networkcode[256])(unsigned char num); -static byte *cgvm_netbuffer; +static qbyte *cgvm_netbuffer; static int cgvm_netbufferlength; static int cgvm_netbufferpos; @@ -46,7 +46,7 @@ void CL_CGVM_Start(void) CG_Init(); // API call } -void CL_CGVM_ParseNetwork(byte *netbuffer, int length) +void CL_CGVM_ParseNetwork(qbyte *netbuffer, int length) { int num; cgvm_netbuffer = netbuffer; @@ -56,7 +56,7 @@ void CL_CGVM_ParseNetwork(byte *netbuffer, int length) { num = CGVM_MSG_ReadByte(); if (cgvm_networkcode[num]) - cgvm_networkcode[num]((byte)num); + cgvm_networkcode[num]((qbyte)num); else Host_Error("CL_CGVM_ParseNetwork: unregistered network code %i", num); } diff --git a/cgamevm.h b/cgamevm.h index c4a29238..75ce188d 100644 --- a/cgamevm.h +++ b/cgamevm.h @@ -6,7 +6,7 @@ void CL_CGVM_Init(void); void CL_CGVM_Clear(void); void CL_CGVM_Frame(void); void CL_CGVM_Start(void); -void CL_CGVM_ParseNetwork(byte *netbuffer, int length); +void CL_CGVM_ParseNetwork(qbyte *netbuffer, int length); #endif diff --git a/cl_input.c b/cl_input.c index 0943007d..030ffa29 100644 --- a/cl_input.c +++ b/cl_input.c @@ -350,7 +350,7 @@ void CL_SendMove (usercmd_t *cmd) int i; int bits; sizebuf_t buf; - byte data[128]; + qbyte data[128]; static double lastmovetime; static float forwardmove, sidemove, upmove, total; // accumulation diff --git a/cl_main.c b/cl_main.c index 7ee3d2d9..13037820 100644 --- a/cl_main.c +++ b/cl_main.c @@ -228,7 +228,7 @@ Host should be either "local" or a net address to be passed on void CL_EstablishConnection (char *host) { sizebuf_t buf; - byte data[128]; + qbyte data[128]; buf.maxsize = 128; buf.cursize = 0; @@ -595,7 +595,7 @@ static void CL_RelinkNetworkEntities() glowcolor = ent->state_current.glowcolor; if (glowsize) { - byte *tempcolor = (byte *)&d_8to24table[glowcolor]; + qbyte *tempcolor = (qbyte *)&d_8to24table[glowcolor]; dlightcolor[0] += glowsize * tempcolor[0] * (1.0f / 255.0f); dlightcolor[1] += glowsize * tempcolor[1] * (1.0f / 255.0f); dlightcolor[2] += glowsize * tempcolor[2] * (1.0f / 255.0f); diff --git a/cl_parse.c b/cl_parse.c index 576bd1d2..5a1b5b5f 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -198,7 +198,7 @@ void CL_KeepaliveMessage (void) static float lastmsg; int ret; sizebuf_t old; - byte olddata[8192]; + qbyte olddata[8192]; if (sv.active) return; // no need if server is local @@ -527,7 +527,7 @@ If an entities model or origin changes from frame to frame, it must be relinked. Other attributes can change without relinking. ================== */ -byte entkill[MAX_EDICTS]; +qbyte entkill[MAX_EDICTS]; int bitprofile[32], bitprofilecount = 0; void CL_ParseUpdate (int bits) { @@ -953,7 +953,7 @@ void CL_ParseEffect2 (void) #define SHOWNET(x) if(cl_shownet.integer==2)Con_Printf ("%3i:%s\n", msg_readcount-1, x); -static byte cgamenetbuffer[65536]; +static qbyte cgamenetbuffer[65536]; /* ===================== @@ -964,7 +964,7 @@ void CL_ParseServerMessage (void) { int cmd; int i, entitiesupdated; - byte cmdlog[32]; + qbyte cmdlog[32]; char *cmdlogname[32], *temp; int cmdindex, cmdcount = 0; @@ -1235,9 +1235,9 @@ void CL_ParseServerMessage (void) cl.cdtrack = MSG_ReadByte (); cl.looptrack = MSG_ReadByte (); if ( (cls.demoplayback || cls.demorecording) && (cls.forcetrack != -1) ) - CDAudio_Play ((byte)cls.forcetrack, true); + CDAudio_Play ((qbyte)cls.forcetrack, true); else - CDAudio_Play ((byte)cl.cdtrack, true); + CDAudio_Play ((qbyte)cl.cdtrack, true); break; case svc_intermission: diff --git a/cl_particles.c b/cl_particles.c index 2798ef68..823c68bf 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -48,7 +48,7 @@ typedef struct particle_s float friction; // how much air friction affects this object (objects with a low mass/size ratio tend to get more air friction) float pressure; // if non-zero, apply pressure to other particles int dynlight; // if set the particle will be dynamically lit (if cl_dynamicparticles is on), used for smoke and blood - byte color[4]; + qbyte color[4]; } particle_t; @@ -325,7 +325,7 @@ void CL_ParticleExplosion (vec3_t org, int smoke) int i, j; float f; vec3_t v, end, ang; - byte noise1[32*32], noise2[32*32]; + qbyte noise1[32*32], noise2[32*32]; VectorClear(end); // hush MSVC i = Mod_PointInLeaf(org, cl.worldmodel)->contents; diff --git a/cl_screen.c b/cl_screen.c index 8f2f269d..a56acc4d 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -23,7 +23,7 @@ qboolean scr_disabled_for_loading; //qboolean scr_drawloading; //float scr_disabled_time; -static byte menuplyr_pixels[4096]; +static qbyte menuplyr_pixels[4096]; /* =============================================================================== @@ -634,7 +634,7 @@ void DrawQ_Fill (float x, float y, float w, float h, float red, float green, flo } //only used for the player color selection menu -void DrawQ_PicTranslate (int x, int y, char *picname, byte *translation) +void DrawQ_PicTranslate (int x, int y, char *picname, qbyte *translation) { int i, c; unsigned int trans[4096]; @@ -655,7 +655,7 @@ void DrawQ_PicTranslate (int x, int y, char *picname, byte *translation) trans[i] = d_8to24table[translation[menuplyr_pixels[i]]]; // FIXME: this is renderer stuff? - R_UpdateTexture (pic->tex, (byte *)trans); + R_UpdateTexture (pic->tex, (qbyte *)trans); DrawQ_Pic(x, y, picname, 0, 0, 1, 1, 1, 1, 0); } @@ -774,7 +774,7 @@ showlmp_t showlmp[SHOWLMP_MAXLABELS]; void SHOWLMP_decodehide(void) { int i; - byte *lmplabel; + qbyte *lmplabel; lmplabel = MSG_ReadString(); for (i = 0;i < SHOWLMP_MAXLABELS;i++) if (showlmp[i].isactive && strcmp(showlmp[i].label, lmplabel) == 0) @@ -787,7 +787,7 @@ void SHOWLMP_decodehide(void) void SHOWLMP_decodeshow(void) { int i, k; - byte lmplabel[256], picname[256]; + qbyte lmplabel[256], picname[256]; float x, y; strcpy(lmplabel,MSG_ReadString()); strcpy(picname, MSG_ReadString()); diff --git a/cl_screen.h b/cl_screen.h index 9d5290d4..69fc7206 100644 --- a/cl_screen.h +++ b/cl_screen.h @@ -8,7 +8,7 @@ typedef struct drawqueue_s { unsigned short size; - byte command, flags; + qbyte command, flags; unsigned int color; float x, y, scalex, scaley; } @@ -21,7 +21,7 @@ void DrawQ_Pic(float x, float y, char *picname, float width, float height, float void DrawQ_String(float x, float y, char *string, int maxlen, float scalex, float scaley, float red, float green, float blue, float alpha, int flags); void DrawQ_Fill (float x, float y, float w, float h, float red, float green, float blue, float alpha, int flags); // only used for player config menu -void DrawQ_PicTranslate (int x, int y, char *picname, byte *translation); +void DrawQ_PicTranslate (int x, int y, char *picname, qbyte *translation); void SHOWLMP_decodehide(void); void SHOWLMP_decodeshow(void); diff --git a/cl_tent.c b/cl_tent.c index 387a64cb..971dc6ef 100644 --- a/cl_tent.c +++ b/cl_tent.c @@ -114,7 +114,7 @@ void CL_ParseTEnt (void) int rnd; int colorStart, colorLength, count; float velspeed, radius; - byte *tempcolor; + qbyte *tempcolor; type = MSG_ReadByte (); switch (type) @@ -429,7 +429,7 @@ void CL_ParseTEnt (void) colorLength = MSG_ReadByte (); CL_ParticleExplosion2 (pos, colorStart, colorLength); // CL_BlastParticles (pos, 80, 80); - tempcolor = (byte *)&d_8to24table[(rand()%colorLength) + colorStart]; + tempcolor = (qbyte *)&d_8to24table[(rand()%colorLength) + colorStart]; CL_AllocDlight (NULL, pos, 350, tempcolor[0] * (1.0f / 255.0f), tempcolor[1] * (1.0f / 255.0f), tempcolor[2] * (1.0f / 255.0f), 700, 0.5); S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); break; diff --git a/client.h b/client.h index 3513a3f7..2b7505c2 100644 --- a/client.h +++ b/client.h @@ -507,7 +507,7 @@ typedef struct int numparticles; struct renderparticle_s *particles; - byte drawqueue[MAX_DRAWQUEUE]; + qbyte drawqueue[MAX_DRAWQUEUE]; int drawqueuesize; } refdef_t; diff --git a/common.c b/common.c index b1c684b4..daa7fbde 100644 --- a/common.c +++ b/common.c @@ -109,7 +109,7 @@ void Q_memset (void *dest, int fill, int count) } else for (i=0 ; i>8)&255; @@ -421,7 +421,7 @@ short ShortNoSwap (short l) int LongSwap (int l) { - byte b1,b2,b3,b4; + qbyte b1,b2,b3,b4; b1 = l&255; b2 = (l>>8)&255; @@ -443,7 +443,7 @@ float FloatSwap (float f) union { float f; - byte b[4]; + qbyte b[4]; } dat1, dat2; @@ -477,7 +477,7 @@ Handles byte ordering and avoids alignment errors void MSG_WriteChar (sizebuf_t *sb, int c) { - byte *buf; + qbyte *buf; //#ifdef PARANOID // if (c < -128 || c > 127) @@ -490,7 +490,7 @@ void MSG_WriteChar (sizebuf_t *sb, int c) void MSG_WriteByte (sizebuf_t *sb, int c) { - byte *buf; + qbyte *buf; //#ifdef PARANOID // if (c < 0 || c > 255) @@ -503,7 +503,7 @@ void MSG_WriteByte (sizebuf_t *sb, int c) void MSG_WriteShort (sizebuf_t *sb, int c) { - byte *buf; + qbyte *buf; //#ifdef PARANOID // if (c < ((short)0x8000) || c > (short)0x7fff) @@ -517,7 +517,7 @@ void MSG_WriteShort (sizebuf_t *sb, int c) void MSG_WriteLong (sizebuf_t *sb, int c) { - byte *buf; + qbyte *buf; buf = SZ_GetSpace (sb, 4); buf[0] = c&0xff; @@ -689,7 +689,7 @@ float MSG_ReadFloat (void) { union { - byte b[4]; + qbyte b[4]; float f; int l; } dat; @@ -822,9 +822,9 @@ void SZ_Print (sizebuf_t *buf, char *data) // byte * cast to keep VC++ happy if (buf->data[buf->cursize-1]) - memcpy ((byte *)SZ_GetSpace(buf, len),data,len); // no trailing 0 + memcpy ((qbyte *)SZ_GetSpace(buf, len),data,len); // no trailing 0 else - memcpy ((byte *)SZ_GetSpace(buf, len-1)-1,data,len); // write over trailing 0 + memcpy ((qbyte *)SZ_GetSpace(buf, len-1)-1,data,len); // write over trailing 0 } @@ -1202,7 +1202,7 @@ COM_Init void COM_Init (void) { #if !defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG) - byte swaptest[2] = {1,0}; + qbyte swaptest[2] = {1,0}; // set the byte swapping variables in a portable manner if ( *(short *)swaptest == 1) @@ -1265,7 +1265,7 @@ char *va(char *format, ...) /// just for debugging -int memsearch (byte *start, int count, int search) +int memsearch (qbyte *start, int count, int search) { int i; @@ -1630,14 +1630,14 @@ Filename are reletive to the quake directory. Always appends a 0 byte. ============ */ -byte *loadbuf; -int loadsize; -byte *COM_LoadFile (char *path, qboolean quiet) +qbyte *loadbuf; +int loadsize; +qbyte *COM_LoadFile (char *path, qboolean quiet) { - QFile *h; - byte *buf; - char base[1024]; - int len; + QFile *h; + qbyte *buf; + char base[1024]; + int len; buf = NULL; // quiet compiler warning loadsize = 0; @@ -1656,7 +1656,7 @@ byte *COM_LoadFile (char *path, qboolean quiet) if (!buf) Sys_Error ("COM_LoadFile: not enough available memory for %s (size %i)", path, len); - ((byte *)buf)[len] = 0; + ((qbyte *)buf)[len] = 0; Qread (h, buf, len); Qclose (h); diff --git a/common.h b/common.h index 85aba74d..98753e27 100644 --- a/common.h +++ b/common.h @@ -30,7 +30,7 @@ typedef struct sizebuf_s { qboolean allowoverflow; // if false, do a Sys_Error qboolean overflowed; // set to true if the buffer size failed - byte *data; + qbyte *data; mempool_t *mempool; int maxsize; int cursize; @@ -179,7 +179,7 @@ int COM_FOpenFile (char *filename, QFile **file, qboolean quiet, qboolean zip); // set by COM_LoadFile functions extern int loadsize; -byte *COM_LoadFile (char *path, qboolean quiet); +qbyte *COM_LoadFile (char *path, qboolean quiet); int COM_FileExists(char *filename); diff --git a/console.h b/console.h index 3122584d..43a538f7 100644 --- a/console.h +++ b/console.h @@ -23,10 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // extern int con_totallines; extern int con_backscroll; -extern qboolean con_forcedup; // because no entities to refresh +extern qboolean con_forcedup; // because no entities to refresh extern qboolean con_initialized; -extern byte *con_chars; -extern int con_notifylines; // scan lines to clear for notify lines +extern qbyte *con_chars; +extern int con_notifylines; // scan lines to clear for notify lines void Con_DrawCharacter (int cx, int line, int num); diff --git a/crc.c b/crc.c index 84dd8559..9024e073 100644 --- a/crc.c +++ b/crc.c @@ -70,13 +70,13 @@ void CRC_Init(unsigned short *crcvalue) *crcvalue = CRC_INIT_VALUE; } -void CRC_ProcessByte(unsigned short *crcvalue, byte data) +void CRC_ProcessByte(unsigned short *crcvalue, qbyte data) { *crcvalue = (*crcvalue << 8) ^ crctable[(*crcvalue >> 8) ^ data]; } // LordHavoc: added for speed reasons -void CRC_ProcessBytes(unsigned short *crcvalue, byte *data, int size) +void CRC_ProcessBytes(unsigned short *crcvalue, qbyte *data, int size) { unsigned short crc; crc = *crcvalue; @@ -91,7 +91,7 @@ unsigned short CRC_Value(unsigned short crcvalue) } // LordHavoc: further speed and usability improvement -unsigned short CRC_Block(byte *data, int size) +unsigned short CRC_Block(qbyte *data, int size) { unsigned short crc = CRC_INIT_VALUE; while (size--) diff --git a/crc.h b/crc.h index c613ebc4..7bf4092a 100644 --- a/crc.h +++ b/crc.h @@ -20,9 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* crc.h */ void CRC_Init(unsigned short *crcvalue); -void CRC_ProcessByte(unsigned short *crcvalue, byte data); +void CRC_ProcessByte(unsigned short *crcvalue, qbyte data); // LordHavoc: added this for speed reasons -void CRC_ProcessBytes(unsigned short *crcvalue, byte *data, int size); +void CRC_ProcessBytes(unsigned short *crcvalue, qbyte *data, int size); unsigned short CRC_Value(unsigned short crcvalue); // LordHavoc: further speed and usability improvement -unsigned short CRC_Block(byte *data, int size); +unsigned short CRC_Block(qbyte *data, int size); diff --git a/fractalnoise.c b/fractalnoise.c index ad9d91ed..73f122ec 100644 --- a/fractalnoise.c +++ b/fractalnoise.c @@ -1,7 +1,7 @@ #include "quakedef.h" -void fractalnoise(byte *noise, int size, int startgrid) +void fractalnoise(qbyte *noise, int size, int startgrid) { int x, y, g, g2, amplitude, min, max, size1 = size - 1, sizepower, gridpower; int *noisebuf; @@ -59,13 +59,13 @@ void fractalnoise(byte *noise, int size, int startgrid) // normalize noise and copy to output for (y = 0;y < size;y++) for (x = 0;x < size;x++) - *noise++ = (byte) (((n(x,y) - min) * 256) / max); + *noise++ = (qbyte) (((n(x,y) - min) * 256) / max); Mem_Free(noisebuf); #undef n } // unnormalized, used for explosions mainly, does not allocate/free memory (hence the name quick) -void fractalnoisequick(byte *noise, int size, int startgrid) +void fractalnoisequick(qbyte *noise, int size, int startgrid) { int x, y, g, g2, amplitude, size1 = size - 1, sizepower, gridpower; #define n(x,y) noise[((y)&size1)*size+((x)&size1)] @@ -98,13 +98,13 @@ void fractalnoisequick(byte *noise, int size, int startgrid) // diamond for (y = 0;y < size;y += g2) for (x = 0;x < size;x += g2) - n(x+g,y+g) = (byte) (((int) n(x,y) + (int) n(x+g2,y) + (int) n(x,y+g2) + (int) n(x+g2,y+g2)) >> 2); + n(x+g,y+g) = (qbyte) (((int) n(x,y) + (int) n(x+g2,y) + (int) n(x,y+g2) + (int) n(x+g2,y+g2)) >> 2); // square for (y = 0;y < size;y += g2) for (x = 0;x < size;x += g2) { - n(x+g,y) = (byte) (((int) n(x,y) + (int) n(x+g2,y) + (int) n(x+g,y-g) + (int) n(x+g,y+g)) >> 2); - n(x,y+g) = (byte) (((int) n(x,y) + (int) n(x,y+g2) + (int) n(x-g,y+g) + (int) n(x+g,y+g)) >> 2); + n(x+g,y) = (qbyte) (((int) n(x,y) + (int) n(x+g2,y) + (int) n(x+g,y-g) + (int) n(x+g,y+g)) >> 2); + n(x,y+g) = (qbyte) (((int) n(x,y) + (int) n(x,y+g2) + (int) n(x-g,y+g) + (int) n(x+g,y+g)) >> 2); } } } diff --git a/gl_backend.c b/gl_backend.c index 6def9336..810900a7 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -66,7 +66,7 @@ buf_fcolor_t; typedef struct { - byte c[4]; + qbyte c[4]; } buf_bcolor_t; @@ -364,7 +364,7 @@ void R_Mesh_Render(void) // float to byte color conversion int *icolor; float *fcolor; - byte *bcolor; + qbyte *bcolor; if (!backendactive) Sys_Error("R_Mesh_Render: called when backend is not active\n"); if (!currentmesh) @@ -1372,7 +1372,7 @@ void R_ClearScreen(void); void SCR_ScreenShot(char *filename, int x, int y, int width, int height) { int i; - byte *buffer; + qbyte *buffer; buffer = Mem_Alloc(tempmempool, width*height*3); glReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer); diff --git a/gl_draw.c b/gl_draw.c index e104cef9..f5cb2bb2 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -37,7 +37,7 @@ static int numcachepics; static rtexturepool_t *drawtexturepool; -static byte pointerimage[256] = +static qbyte pointerimage[256] = { "333333332......." "26777761........" @@ -60,7 +60,7 @@ static byte pointerimage[256] = static rtexture_t *draw_generatemousepointer(void) { int i; - byte buffer[256][4]; + qbyte buffer[256][4]; for (i = 0;i < 256;i++) { if (pointerimage[i] == '.') @@ -84,7 +84,7 @@ static rtexture_t *draw_generatemousepointer(void) // must match NUMCROSSHAIRS in r_crosshairs.c #define NUMCROSSHAIRS 5 -static byte *crosshairtexdata[NUMCROSSHAIRS] = +static qbyte *crosshairtexdata[NUMCROSSHAIRS] = { "................" "................" @@ -176,7 +176,7 @@ static rtexture_t *draw_generatecrosshair(int num) { int i; char *in; - byte data[16*16][4]; + qbyte data[16*16][4]; in = crosshairtexdata[num]; for (i = 0;i < 16*16;i++) { @@ -192,7 +192,7 @@ static rtexture_t *draw_generatecrosshair(int num) data[i][0] = 255; data[i][1] = 255; data[i][2] = 255; - data[i][3] = (byte) ((int) (in[i] - '0') * 255 / 7); + data[i][3] = (qbyte) ((int) (in[i] - '0') * 255 / 7); } } return R_LoadTexture(drawtexturepool, va("crosshair%i", num), 16, 16, &data[0][0], TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE); @@ -233,9 +233,9 @@ cachepic_t *Draw_CachePic (char *path) { if (!strcmp(path, "conchars")) { - byte *pix; + qbyte *pix; // conchars is a raw image and with the wrong transparent color - pix = (byte *)p; + pix = (qbyte *)p; for (i = 0;i < 128 * 128;i++) if (pix[i] == 0) pix[i] = 255; @@ -391,7 +391,7 @@ void R_DrawQueue(void) if (color != dq->color) { color = dq->color; - glColor4ub((byte)(((color >> 24) & 0xFF) >> overbright), (byte)(((color >> 16) & 0xFF) >> overbright), (byte)(((color >> 8) & 0xFF) >> overbright), (byte)(color & 0xFF)); + glColor4ub((qbyte)(((color >> 24) & 0xFF) >> overbright), (qbyte)(((color >> 16) & 0xFF) >> overbright), (qbyte)(((color >> 8) & 0xFF) >> overbright), (qbyte)(color & 0xFF)); } x = dq->x; y = dq->y; diff --git a/gl_models.c b/gl_models.c index 76862b2d..63869689 100644 --- a/gl_models.c +++ b/gl_models.c @@ -62,8 +62,8 @@ rtexturepool_t *chrometexturepool; void makechrometexture(void) { int i; - byte noise[64*64]; - byte data[64*64][4]; + qbyte noise[64*64]; + qbyte data[64*64][4]; fractalnoise(noise, 64, 8); @@ -396,13 +396,13 @@ void R_DrawQ1Q2AliasModel (void) if (currentrenderentity->colormap >= 0 && (skinframe->base || skinframe->pants || skinframe->shirt)) { int c; - byte *color; + qbyte *color; if (skinframe->base) R_DrawModelMesh(skinframe->base, aliasvertcolor, 0, 0, 0); if (skinframe->pants) { c = (currentrenderentity->colormap & 0xF) << 4;c += (c >= 128 && c < 224) ? 4 : 12; // 128-224 are backwards ranges - color = (byte *) (&d_8to24table[c]); + color = (qbyte *) (&d_8to24table[c]); if (c >= 224) // fullbright ranges R_DrawModelMesh(skinframe->pants, NULL, color[0] * (1.0f / 255.0f), color[1] * (1.0f / 255.0f), color[2] * (1.0f / 255.0f)); else @@ -414,7 +414,7 @@ void R_DrawQ1Q2AliasModel (void) if (skinframe->shirt) { c = currentrenderentity->colormap & 0xF0 ;c += (c >= 128 && c < 224) ? 4 : 12; // 128-224 are backwards ranges - color = (byte *) (&d_8to24table[c]); + color = (qbyte *) (&d_8to24table[c]); if (c >= 224) // fullbright ranges R_DrawModelMesh(skinframe->shirt, NULL, color[0] * (1.0f / 255.0f), color[1] * (1.0f / 255.0f), color[2] * (1.0f / 255.0f)); else diff --git a/gl_rsurf.c b/gl_rsurf.c index 4a8fe723..494a93a5 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static signed int blocklights[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*3]; // LordHavoc: *3 for colored lighting -static byte templight[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*4]; +static qbyte templight[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*4]; cvar_t r_ambient = {0, "r_ambient", "0"}; cvar_t r_vertexsurfaces = {0, "r_vertexsurfaces", "0"}; @@ -168,7 +168,7 @@ void R_StainNode (mnode_t *node, model_t *model, vec3_t origin, float radius, in float ndist; msurface_t *surf, *endsurf; int sdtable[256], td, maxdist, maxdist2, maxdist3, i, s, t, smax, tmax, smax3, dist2, impacts, impactt, subtract, a, stained, cr, cg, cb, ca, ratio; - byte *bl; + qbyte *bl; vec3_t impact; // LordHavoc: use 64bit integer... shame it's not very standardized... #if _MSC_VER || __BORLANDC__ @@ -262,9 +262,9 @@ loc0: cr = (((icolor[4] - icolor[0]) * ratio) >> 8) + icolor[0]; cg = (((icolor[5] - icolor[1]) * ratio) >> 8) + icolor[1]; cb = (((icolor[6] - icolor[2]) * ratio) >> 8) + icolor[2]; - bl[0] = (byte) ((((cr - (int) bl[0]) * a) >> 8) + (int) bl[0]); - bl[1] = (byte) ((((cg - (int) bl[1]) * a) >> 8) + (int) bl[1]); - bl[2] = (byte) ((((cb - (int) bl[2]) * a) >> 8) + (int) bl[2]); + bl[0] = (qbyte) ((((cr - (int) bl[0]) * a) >> 8) + (int) bl[0]); + bl[1] = (qbyte) ((((cg - (int) bl[1]) * a) >> 8) + (int) bl[1]); + bl[2] = (qbyte) ((((cb - (int) bl[2]) * a) >> 8) + (int) bl[2]); stained = true; } } @@ -349,8 +349,8 @@ Combine and scale multiple lightmaps into the 8.8 format in blocklights */ static void R_BuildLightMap (msurface_t *surf, int dlightchanged) { - int smax, tmax, i, j, size, size3, shift, scale, maps, *bl, stride, l; - byte *lightmap, *out, *stain; + int smax, tmax, i, j, size, size3, shift, scale, maps, *bl, stride, l; + qbyte *lightmap, *out, *stain; // update cached lighting info surf->cached_dlight = 0; @@ -1088,12 +1088,12 @@ static void RSurfShader_Wall_Pass_BaseLightmap(msurface_t *s) static void RSurfShader_Wall_Pass_BaseVertex(msurface_t *s) { - int i, size3; - float c[3], base[3], scale, diff[3], ifog; - surfvertex_t *v; - surfvert_t *sv; - rmeshinfo_t m; - byte *lm; + int i, size3; + float c[3], base[3], scale, diff[3], ifog; + surfvertex_t *v; + surfvert_t *sv; + rmeshinfo_t m; + qbyte *lm; size3 = ((s->extents[0]>>4)+1)*((s->extents[1]>>4)+1)*3; @@ -1813,7 +1813,7 @@ static void R_PVSWorldNode() msurface_t *surf, **mark, **endmark; mleaf_t *leaf; tinyplane_t plane; - byte *worldvis; + qbyte *worldvis; worldvis = Mod_LeafPVS (r_viewleaf, cl.worldmodel); diff --git a/gl_textures.c b/gl_textures.c index c1682318..2ef38e93 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -33,7 +33,7 @@ static int block_size; // since there is only one set of GL texture numbers, we have to track them // globally, everything else is per texture pool -static byte *gltexnuminuse; +static qbyte *gltexnuminuse; typedef struct { @@ -86,16 +86,16 @@ typedef struct gltexture_s // location in the image, and size int x, y, width, height; // copy of the original texture supplied to the upload function, for re-uploading or deferred uploads (non-precached) - byte *inputtexels; + qbyte *inputtexels; // to identify cache mismatchs (this might be removed someday) int crc; // flags supplied to the LoadTexture/ProceduralTexture functions // (might be altered to remove TEXF_ALPHA), and GLTEXF_ private flags int flags; // procedural texture generation function, called once per frame if the texture is used - int (*generate)(byte *buffer, int width, int height, void *parameterdata, int parameterdatasize); + int (*generate)(qbyte *buffer, int width, int height, void *parameterdata, int parameterdatasize); // data provided to generate, persistent from call to call - byte *proceduraldata; + qbyte *proceduraldata; // size of data int proceduraldatasize; // used only to avoid updating the texture more than once per frame @@ -118,11 +118,11 @@ gltexturepool_t; static gltexturepool_t *gltexturepoolchain = NULL; -static byte *resamplerow1 = NULL, *resamplerow2 = NULL; +static qbyte *resamplerow1 = NULL, *resamplerow2 = NULL; static int resamplerowsize = 0; -static byte *resizebuffer = NULL, *colorconvertbuffer; +static qbyte *resizebuffer = NULL, *colorconvertbuffer; static int resizebuffersize = 0; -static byte *texturebuffer; +static qbyte *texturebuffer; static int texturebuffersize = 0; static int realmaxsize = 0; @@ -523,7 +523,7 @@ void R_Textures_Init (void) R_RegisterModule("R_Textures", r_textures_start, r_textures_shutdown, r_textures_newmap); } -static void R_ResampleTextureLerpLine (byte *in, byte *out, int inwidth, int outwidth, int bytesperpixel) +static void R_ResampleTextureLerpLine (qbyte *in, qbyte *out, int inwidth, int outwidth, int bytesperpixel) { int j, xi, oldx = 0, f, fstep, endx, lerp; fstep = (int) (inwidth*65536.0f/outwidth); @@ -541,10 +541,10 @@ static void R_ResampleTextureLerpLine (byte *in, byte *out, int inwidth, int out if (xi < endx) { lerp = f & 0xFFFF; - *out++ = (byte) ((((in[4] - in[0]) * lerp) >> 16) + in[0]); - *out++ = (byte) ((((in[5] - in[1]) * lerp) >> 16) + in[1]); - *out++ = (byte) ((((in[6] - in[2]) * lerp) >> 16) + in[2]); - *out++ = (byte) ((((in[7] - in[3]) * lerp) >> 16) + in[3]); + *out++ = (qbyte) ((((in[4] - in[0]) * lerp) >> 16) + in[0]); + *out++ = (qbyte) ((((in[5] - in[1]) * lerp) >> 16) + in[1]); + *out++ = (qbyte) ((((in[6] - in[2]) * lerp) >> 16) + in[2]); + *out++ = (qbyte) ((((in[7] - in[3]) * lerp) >> 16) + in[3]); } else // last pixel of the line has no pixel to lerp to { @@ -568,9 +568,9 @@ static void R_ResampleTextureLerpLine (byte *in, byte *out, int inwidth, int out if (xi < endx) { lerp = f & 0xFFFF; - *out++ = (byte) ((((in[3] - in[0]) * lerp) >> 16) + in[0]); - *out++ = (byte) ((((in[4] - in[1]) * lerp) >> 16) + in[1]); - *out++ = (byte) ((((in[5] - in[2]) * lerp) >> 16) + in[2]); + *out++ = (qbyte) ((((in[3] - in[0]) * lerp) >> 16) + in[0]); + *out++ = (qbyte) ((((in[4] - in[1]) * lerp) >> 16) + in[1]); + *out++ = (qbyte) ((((in[5] - in[2]) * lerp) >> 16) + in[2]); } else // last pixel of the line has no pixel to lerp to { @@ -607,8 +607,8 @@ static void R_ResampleTexture (void *indata, int inwidth, int inheight, void *ou { if (r_lerpimages.integer) { - int i, j, yi, oldy, f, fstep, lerp, endy = (inheight-1), inwidth4 = inwidth*4, outwidth4 = outwidth*4; - byte *inrow, *out; + int i, j, yi, oldy, f, fstep, lerp, endy = (inheight-1), inwidth4 = inwidth*4, outwidth4 = outwidth*4; + qbyte *inrow, *out; out = outdata; fstep = (int) (inheight*65536.0f/outheight); @@ -624,7 +624,7 @@ static void R_ResampleTexture (void *indata, int inwidth, int inheight, void *ou lerp = f & 0xFFFF; if (yi != oldy) { - inrow = (byte *)indata + inwidth4*yi; + inrow = (qbyte *)indata + inwidth4*yi; if (yi == oldy+1) memcpy(row1, row2, outwidth4); else @@ -635,7 +635,7 @@ static void R_ResampleTexture (void *indata, int inwidth, int inheight, void *ou j = outwidth - 4; while(j >= 0) { -#define LERPBYTE(i) out[i] = (byte) ((((row2[i] - row1[i]) * lerp) >> 16) + row1[i]) +#define LERPBYTE(i) out[i] = (qbyte) ((((row2[i] - row1[i]) * lerp) >> 16) + row1[i]) LERPBYTE( 0); LERPBYTE( 1); LERPBYTE( 2); @@ -688,7 +688,7 @@ static void R_ResampleTexture (void *indata, int inwidth, int inheight, void *ou { if (yi != oldy) { - inrow = (byte *)indata + inwidth4*yi; + inrow = (qbyte *)indata + inwidth4*yi; if (yi == oldy+1) memcpy(row1, row2, outwidth4); else @@ -740,8 +740,8 @@ static void R_ResampleTexture (void *indata, int inwidth, int inheight, void *ou { if (r_lerpimages.integer) { - int i, j, yi, oldy, f, fstep, lerp, endy = (inheight-1), inwidth3 = inwidth * 3, outwidth3 = outwidth * 3; - byte *inrow, *out; + int i, j, yi, oldy, f, fstep, lerp, endy = (inheight-1), inwidth3 = inwidth * 3, outwidth3 = outwidth * 3; + qbyte *inrow, *out; out = outdata; fstep = (int) (inheight*65536.0f/outheight); @@ -757,7 +757,7 @@ static void R_ResampleTexture (void *indata, int inwidth, int inheight, void *ou lerp = f & 0xFFFF; if (yi != oldy) { - inrow = (byte *)indata + inwidth3*yi; + inrow = (qbyte *)indata + inwidth3*yi; if (yi == oldy+1) memcpy(row1, row2, outwidth3); else @@ -768,7 +768,7 @@ static void R_ResampleTexture (void *indata, int inwidth, int inheight, void *ou j = outwidth - 4; while(j >= 0) { -#define LERPBYTE(i) out[i] = (byte) ((((row2[i] - row1[i]) * lerp) >> 16) + row1[i]) +#define LERPBYTE(i) out[i] = (qbyte) ((((row2[i] - row1[i]) * lerp) >> 16) + row1[i]) LERPBYTE( 0); LERPBYTE( 1); LERPBYTE( 2); @@ -814,7 +814,7 @@ static void R_ResampleTexture (void *indata, int inwidth, int inheight, void *ou { if (yi != oldy) { - inrow = (byte *)indata + inwidth3*yi; + inrow = (qbyte *)indata + inwidth3*yi; if (yi == oldy+1) memcpy(row1, row2, outwidth3); else @@ -829,13 +829,13 @@ static void R_ResampleTexture (void *indata, int inwidth, int inheight, void *ou { int i, j, f, inwidth3 = inwidth * 3; unsigned frac, fracstep; - byte *inrow, *out; + qbyte *inrow, *out; out = outdata; fracstep = inwidth*0x10000/outwidth; for (i = 0;i < outheight;i++) { - inrow = (byte *)indata + inwidth3*(i*inheight/outheight); + inrow = (qbyte *)indata + inwidth3*(i*inheight/outheight); frac = fracstep >> 1; j = outwidth - 4; while (j >= 0) @@ -867,7 +867,7 @@ static void R_ResampleTexture (void *indata, int inwidth, int inheight, void *ou } // in can be the same as out -static void R_MipReduce(byte *in, byte *out, int *width, int *height, int destwidth, int destheight, int bytesperpixel) +static void R_MipReduce(qbyte *in, qbyte *out, int *width, int *height, int destwidth, int destheight, int bytesperpixel) { int x, y, nextrow; nextrow = *width * bytesperpixel; @@ -884,10 +884,10 @@ static void R_MipReduce(byte *in, byte *out, int *width, int *height, int destwi { for (x = 0;x < *width;x++) { - out[0] = (byte) ((in[0] + in[4] + in[nextrow ] + in[nextrow+4]) >> 2); - out[1] = (byte) ((in[1] + in[5] + in[nextrow+1] + in[nextrow+5]) >> 2); - out[2] = (byte) ((in[2] + in[6] + in[nextrow+2] + in[nextrow+6]) >> 2); - out[3] = (byte) ((in[3] + in[7] + in[nextrow+3] + in[nextrow+7]) >> 2); + out[0] = (qbyte) ((in[0] + in[4] + in[nextrow ] + in[nextrow+4]) >> 2); + out[1] = (qbyte) ((in[1] + in[5] + in[nextrow+1] + in[nextrow+5]) >> 2); + out[2] = (qbyte) ((in[2] + in[6] + in[nextrow+2] + in[nextrow+6]) >> 2); + out[3] = (qbyte) ((in[3] + in[7] + in[nextrow+3] + in[nextrow+7]) >> 2); out += 4; in += 8; } @@ -900,9 +900,9 @@ static void R_MipReduce(byte *in, byte *out, int *width, int *height, int destwi { for (x = 0;x < *width;x++) { - out[0] = (byte) ((in[0] + in[3] + in[nextrow ] + in[nextrow+3]) >> 2); - out[1] = (byte) ((in[1] + in[4] + in[nextrow+1] + in[nextrow+4]) >> 2); - out[2] = (byte) ((in[2] + in[5] + in[nextrow+2] + in[nextrow+5]) >> 2); + out[0] = (qbyte) ((in[0] + in[3] + in[nextrow ] + in[nextrow+3]) >> 2); + out[1] = (qbyte) ((in[1] + in[4] + in[nextrow+1] + in[nextrow+4]) >> 2); + out[2] = (qbyte) ((in[2] + in[5] + in[nextrow+2] + in[nextrow+5]) >> 2); out += 3; in += 6; } @@ -921,10 +921,10 @@ static void R_MipReduce(byte *in, byte *out, int *width, int *height, int destwi { for (x = 0;x < *width;x++) { - out[0] = (byte) ((in[0] + in[4]) >> 1); - out[1] = (byte) ((in[1] + in[5]) >> 1); - out[2] = (byte) ((in[2] + in[6]) >> 1); - out[3] = (byte) ((in[3] + in[7]) >> 1); + out[0] = (qbyte) ((in[0] + in[4]) >> 1); + out[1] = (qbyte) ((in[1] + in[5]) >> 1); + out[2] = (qbyte) ((in[2] + in[6]) >> 1); + out[3] = (qbyte) ((in[3] + in[7]) >> 1); out += 4; in += 8; } @@ -936,9 +936,9 @@ static void R_MipReduce(byte *in, byte *out, int *width, int *height, int destwi { for (x = 0;x < *width;x++) { - out[0] = (byte) ((in[0] + in[3]) >> 1); - out[1] = (byte) ((in[1] + in[4]) >> 1); - out[2] = (byte) ((in[2] + in[5]) >> 1); + out[0] = (qbyte) ((in[0] + in[3]) >> 1); + out[1] = (qbyte) ((in[1] + in[4]) >> 1); + out[2] = (qbyte) ((in[2] + in[5]) >> 1); out += 3; in += 6; } @@ -960,10 +960,10 @@ static void R_MipReduce(byte *in, byte *out, int *width, int *height, int destwi { for (x = 0;x < *width;x++) { - out[0] = (byte) ((in[0] + in[nextrow ]) >> 1); - out[1] = (byte) ((in[1] + in[nextrow+1]) >> 1); - out[2] = (byte) ((in[2] + in[nextrow+2]) >> 1); - out[3] = (byte) ((in[3] + in[nextrow+3]) >> 1); + out[0] = (qbyte) ((in[0] + in[nextrow ]) >> 1); + out[1] = (qbyte) ((in[1] + in[nextrow+1]) >> 1); + out[2] = (qbyte) ((in[2] + in[nextrow+2]) >> 1); + out[3] = (qbyte) ((in[3] + in[nextrow+3]) >> 1); out += 4; in += 4; } @@ -976,9 +976,9 @@ static void R_MipReduce(byte *in, byte *out, int *width, int *height, int destwi { for (x = 0;x < *width;x++) { - out[0] = (byte) ((in[0] + in[nextrow ]) >> 1); - out[1] = (byte) ((in[1] + in[nextrow+1]) >> 1); - out[2] = (byte) ((in[2] + in[nextrow+2]) >> 1); + out[0] = (qbyte) ((in[0] + in[nextrow ]) >> 1); + out[1] = (qbyte) ((in[1] + in[nextrow+1]) >> 1); + out[2] = (qbyte) ((in[2] + in[nextrow+2]) >> 1); out += 3; in += 3; } @@ -993,10 +993,10 @@ static void R_MipReduce(byte *in, byte *out, int *width, int *height, int destwi } } -static void R_Upload(gltexture_t *glt, byte *data) +static void R_Upload(gltexture_t *glt, qbyte *data) { int mip, width, height, internalformat; - byte *prevbuffer; + qbyte *prevbuffer; prevbuffer = data; glBindTexture(GL_TEXTURE_2D, glt->image->texnum); @@ -1278,7 +1278,7 @@ static void R_UploadTexture (gltexture_t *glt) } } -static gltexture_t *R_SetupTexture(gltexturepool_t *pool, char *identifier, int crc, int width, int height, int flags, textypeinfo_t *texinfo, byte *data, int (*generate)(byte *buffer, int width, int height, void *proceduraldata, int proceduraldatasize), void *proceduraldata, int proceduraldatasize) +static gltexture_t *R_SetupTexture(gltexturepool_t *pool, char *identifier, int crc, int width, int height, int flags, textypeinfo_t *texinfo, qbyte *data, int (*generate)(qbyte *buffer, int width, int height, void *proceduraldata, int proceduraldatasize), void *proceduraldata, int proceduraldatasize) { gltexture_t *glt; glt = Mem_Alloc(texturemempool, sizeof(gltexture_t)); @@ -1331,7 +1331,7 @@ static gltexture_t *R_SetupTexture(gltexturepool_t *pool, char *identifier, int R_LoadTexture ================ */ -rtexture_t *R_LoadTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, byte *data, int textype, int flags) +rtexture_t *R_LoadTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, qbyte *data, int textype, int flags) { int i; gltexture_t *glt; @@ -1416,7 +1416,7 @@ rtexture_t *R_LoadTexture (rtexturepool_t *rtexturepool, char *identifier, int w return (rtexture_t *)R_SetupTexture(pool, identifier, crc, width, height, flags | GLTEXF_UPLOAD, texinfo, data, NULL, NULL, 0); } -rtexture_t *R_ProceduralTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, int textype, int flags, int (*generate)(byte *buffer, int width, int height, void *proceduraldata, int proceduraldatasize), void *proceduraldata, int proceduraldatasize) +rtexture_t *R_ProceduralTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, int textype, int flags, int (*generate)(qbyte *buffer, int width, int height, void *proceduraldata, int proceduraldatasize), void *proceduraldata, int proceduraldatasize) { gltexture_t *glt; gltexturepool_t *pool = (gltexturepool_t *)rtexturepool; @@ -1550,7 +1550,7 @@ int R_CompatibleFragmentWidth(int width, int textype, int flags) return width; } -void R_UpdateTexture(rtexture_t *rt, byte *data) +void R_UpdateTexture(rtexture_t *rt, qbyte *data) { gltexture_t *glt; if (rt == NULL) diff --git a/image.c b/image.c index dbad08ff..bcd2bc77 100644 --- a/image.c +++ b/image.c @@ -4,7 +4,7 @@ int image_width; int image_height; -void Image_GammaRemapRGB(byte *in, byte *out, int pixels, byte *gammar, byte *gammag, byte *gammab) +void Image_GammaRemapRGB(qbyte *in, qbyte *out, int pixels, qbyte *gammar, qbyte *gammag, qbyte *gammab) { while (pixels--) { @@ -17,7 +17,7 @@ void Image_GammaRemapRGB(byte *in, byte *out, int pixels, byte *gammar, byte *ga } // note: pal must be 32bit color -void Image_Copy8bitRGBA(byte *in, byte *out, int pixels, int *pal) +void Image_Copy8bitRGBA(qbyte *in, qbyte *out, int pixels, int *pal) { int *iout = (void *)out; while (pixels >= 8) @@ -83,11 +83,11 @@ typedef struct LoadPCX ============ */ -byte* LoadPCX (byte *f, int matchwidth, int matchheight) +qbyte* LoadPCX (qbyte *f, int matchwidth, int matchheight) { - pcx_t pcx; - byte *palette, *a, *b, *image_rgba, *fin, *pbuf, *enddata; - int x, y, x2, dataByte; + pcx_t pcx; + qbyte *palette, *a, *b, *image_rgba, *fin, *pbuf, *enddata; + int x, y, x2, dataByte; if (loadsize < sizeof(pcx) + 768) { @@ -204,10 +204,10 @@ TargaHeader targa_header; LoadTGA ============= */ -byte* LoadTGA (byte *f, int matchwidth, int matchheight) +qbyte *LoadTGA (qbyte *f, int matchwidth, int matchheight) { int columns, rows, row, column; - byte *pixbuf, *image_rgba, *fin, *enddata; + qbyte *pixbuf, *image_rgba, *fin, *enddata; if (loadsize < 18+3) return NULL; @@ -399,10 +399,10 @@ outofdata:; LoadLMP ============ */ -byte* LoadLMP (byte *f, int matchwidth, int matchheight) +qbyte *LoadLMP (qbyte *f, int matchwidth, int matchheight) { - byte *image_rgba; - int width, height; + qbyte *image_rgba; + int width, height; if (loadsize < 9) { @@ -457,10 +457,10 @@ void Image_StripImageExtension (char *in, char *out) strcpy(out, in); } -byte* loadimagepixels (char* filename, qboolean complain, int matchwidth, int matchheight) +qbyte *loadimagepixels (char *filename, qboolean complain, int matchwidth, int matchheight) { - byte *f, *data; - char basename[256], name[256], *c; + qbyte *f, *data; + char basename[256], name[256], *c; Image_StripImageExtension(filename, basename); // strip .tga, .pcx and .lmp extensions to allow replacement by other types // replace *'s with #, so commandline utils don't get confused when dealing with the external files for (c = basename;*c;c++) @@ -511,7 +511,7 @@ byte* loadimagepixels (char* filename, qboolean complain, int matchwidth, int ma return NULL; } -int image_makemask (byte *in, byte *out, int size) +int image_makemask (qbyte *in, qbyte *out, int size) { int i, count; count = 0; @@ -527,9 +527,9 @@ int image_makemask (byte *in, byte *out, int size) return count; } -byte* loadimagepixelsmask (char* filename, qboolean complain, int matchwidth, int matchheight) +qbyte* loadimagepixelsmask (char* filename, qboolean complain, int matchwidth, int matchheight) { - byte *in, *data; + qbyte *in, *data; in = data = loadimagepixels(filename, complain, matchwidth, matchheight); if (!data) return NULL; @@ -544,7 +544,7 @@ byte* loadimagepixelsmask (char* filename, qboolean complain, int matchwidth, in rtexture_t *loadtextureimage (rtexturepool_t *pool, char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap, qboolean precache) { - byte *data; + qbyte *data; rtexture_t *rt; if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight))) return 0; @@ -555,7 +555,7 @@ rtexture_t *loadtextureimage (rtexturepool_t *pool, char* filename, int matchwid rtexture_t *loadtextureimagemask (rtexturepool_t *pool, char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap, qboolean precache) { - byte *data; + qbyte *data; rtexture_t *rt; if (!(data = loadimagepixelsmask (filename, complain, matchwidth, matchheight))) return 0; @@ -568,7 +568,7 @@ rtexture_t *image_masktex; rtexture_t *loadtextureimagewithmask (rtexturepool_t *pool, char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap, qboolean precache) { int count; - byte *data; + qbyte *data; char *filename2; rtexture_t *rt; image_masktex = NULL; @@ -587,9 +587,9 @@ rtexture_t *loadtextureimagewithmask (rtexturepool_t *pool, char* filename, int return rt; } -void Image_WriteTGARGB_preflipped (char *filename, int width, int height, byte *data) +void Image_WriteTGARGB_preflipped (char *filename, int width, int height, qbyte *data) { - byte *buffer, *in, *out, *end; + qbyte *buffer, *in, *out, *end; buffer = Mem_Alloc(tempmempool, width*height*3 + 18); @@ -616,10 +616,10 @@ void Image_WriteTGARGB_preflipped (char *filename, int width, int height, byte * Mem_Free(buffer); } -void Image_WriteTGARGB (char *filename, int width, int height, byte *data) +void Image_WriteTGARGB (char *filename, int width, int height, qbyte *data) { int y; - byte *buffer, *in, *out, *end; + qbyte *buffer, *in, *out, *end; buffer = Mem_Alloc(tempmempool, width*height*3 + 18); @@ -649,10 +649,10 @@ void Image_WriteTGARGB (char *filename, int width, int height, byte *data) Mem_Free(buffer); } -void Image_WriteTGARGBA (char *filename, int width, int height, byte *data) +void Image_WriteTGARGBA (char *filename, int width, int height, qbyte *data) { int y; - byte *buffer, *in, *out, *end; + qbyte *buffer, *in, *out, *end; buffer = Mem_Alloc(tempmempool, width*height*4 + 18); @@ -683,9 +683,9 @@ void Image_WriteTGARGBA (char *filename, int width, int height, byte *data) Mem_Free(buffer); } -qboolean Image_CheckAlpha(byte *data, int size, qboolean rgba) +qboolean Image_CheckAlpha(qbyte *data, int size, qboolean rgba) { - byte *end; + qbyte *end; if (rgba) { // check alpha bytes diff --git a/image.h b/image.h index c955fafb..f8d4608c 100644 --- a/image.h +++ b/image.h @@ -1,14 +1,14 @@ -void Image_GammaRemapRGB(byte *in, byte *out, int pixels, byte *gammar, byte *gammag, byte *gammab); -void Image_Copy8bitRGBA(byte *in, byte *out, int pixels, int *pal); -int image_makemask (byte *in, byte *out, int size); -byte* loadimagepixels (char* filename, qboolean complain, int matchwidth, int matchheight); +void Image_GammaRemapRGB(qbyte *in, qbyte *out, int pixels, qbyte *gammar, qbyte *gammag, qbyte *gammab); +void Image_Copy8bitRGBA(qbyte *in, qbyte *out, int pixels, int *pal); +int image_makemask (qbyte *in, qbyte *out, int size); +qbyte *loadimagepixels (char* filename, qboolean complain, int matchwidth, int matchheight); rtexture_t *loadtextureimage (rtexturepool_t *pool, char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap, qboolean precache); -byte* loadimagepixelsmask (char* filename, qboolean complain, int matchwidth, int matchheight); +qbyte *loadimagepixelsmask (char* filename, qboolean complain, int matchwidth, int matchheight); rtexture_t *loadtextureimagemask (rtexturepool_t *pool, char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap, qboolean precache); rtexture_t *image_masktex; rtexture_t *loadtextureimagewithmask (rtexturepool_t *pool, char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap, qboolean precache); -void Image_WriteTGARGB_preflipped (char *filename, int width, int height, byte *data); -void Image_WriteTGARGB (char *filename, int width, int height, byte *data); -void Image_WriteTGARGBA (char *filename, int width, int height, byte *data); -qboolean Image_CheckAlpha(byte *data, int size, qboolean rgba); +void Image_WriteTGARGB_preflipped (char *filename, int width, int height, qbyte *data); +void Image_WriteTGARGB (char *filename, int width, int height, qbyte *data); +void Image_WriteTGARGBA (char *filename, int width, int height, qbyte *data); +qboolean Image_CheckAlpha(qbyte *data, int size, qboolean rgba); diff --git a/mathlib.c b/mathlib.c index 8f73d5ea..d45bb356 100644 --- a/mathlib.c +++ b/mathlib.c @@ -114,7 +114,7 @@ float m_bytenormals[NUMVERTEXNORMALS][3] = {-0.587785, -0.425325, -0.688191}, {-0.688191, -0.587785, -0.425325}, }; -byte NormalToByte(vec3_t n) +qbyte NormalToByte(vec3_t n) { int i, best; float bestdistance, distance; @@ -134,7 +134,7 @@ byte NormalToByte(vec3_t n) } // note: uses byte partly to force unsigned for the validity check -void ByteToNormal(byte num, vec3_t n) +void ByteToNormal(qbyte num, vec3_t n) { if (num < NUMVERTEXNORMALS) VectorCopy(m_bytenormals[num], n); diff --git a/mathlib.h b/mathlib.h index d3e3753f..7e17c7a4 100644 --- a/mathlib.h +++ b/mathlib.h @@ -144,8 +144,8 @@ float Q_RSqrt(float number); #define NUMVERTEXNORMALS 162 extern float m_bytenormals[NUMVERTEXNORMALS][3]; -byte NormalToByte(vec3_t n); -void ByteToNormal(byte num, vec3_t n); +qbyte NormalToByte(vec3_t n); +void ByteToNormal(qbyte num, vec3_t n); void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]); void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]); diff --git a/menu.c b/menu.c index 8320bbf8..e822267d 100644 --- a/menu.c +++ b/menu.c @@ -173,13 +173,13 @@ void M_DrawPic (float cx, float cy, char *picname) DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0); } -byte identityTable[256]; -byte translationTable[256]; +qbyte identityTable[256]; +qbyte translationTable[256]; void M_BuildTranslationTable(int top, int bottom) { - int j; - byte *dest, *source; + int j; + qbyte *dest, *source; for (j = 0; j < 256; j++) identityTable[j] = j; diff --git a/model_alias.c b/model_alias.c index 85c6ddd2..926e64f7 100644 --- a/model_alias.c +++ b/model_alias.c @@ -160,10 +160,10 @@ static void Mod_MDL_LoadFrames (long datapointer, int inverts, int outverts, vec } } -static rtexture_t *GL_SkinSplitShirt(byte *in, byte *out, int width, int height, int bits, char *name, int precache) +static rtexture_t *GL_SkinSplitShirt(qbyte *in, qbyte *out, int width, int height, int bits, char *name, int precache) { int i, pixels, passed; - byte pixeltest[16]; + qbyte pixeltest[16]; for (i = 0;i < 16;i++) pixeltest[i] = (bits & (1 << i)) != 0; pixels = width*height; @@ -190,10 +190,10 @@ static rtexture_t *GL_SkinSplitShirt(byte *in, byte *out, int width, int height, return NULL; } -static rtexture_t *GL_SkinSplit(byte *in, byte *out, int width, int height, int bits, char *name, int precache) +static rtexture_t *GL_SkinSplit(qbyte *in, qbyte *out, int width, int height, int bits, char *name, int precache) { int i, pixels, passed; - byte pixeltest[16]; + qbyte pixeltest[16]; for (i = 0;i < 16;i++) pixeltest[i] = (bits & (1 << i)) != 0; pixels = width*height; @@ -216,7 +216,7 @@ static rtexture_t *GL_SkinSplit(byte *in, byte *out, int width, int height, int return NULL; } -static void Mod_LoadSkin (char *basename, byte *skindata, byte *skintemp, int width, int height, skinframe_t *skinframe, int precache) +static void Mod_LoadSkin (char *basename, qbyte *skindata, qbyte *skintemp, int width, int height, skinframe_t *skinframe, int precache) { skinframe->base = loadtextureimagewithmask(loadmodel->texturepool, va("%s_normal", basename), 0, 0, false, r_mipskins.integer, precache); skinframe->fog = image_masktex; @@ -267,7 +267,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) float scales, scalet, scale[3], translate[3], interval; long datapointer, startframes, startskins; char name[MAX_QPATH]; - byte *skintemp = NULL; + qbyte *skintemp = NULL; modelyawradius = 0; modelradius = 0; @@ -401,7 +401,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer) sprintf (name, "%s_%i_%i", loadmodel->name, i, j); else sprintf (name, "%s_%i", loadmodel->name, i); - Mod_LoadSkin(name, (byte *)datapointer, skintemp, skinwidth, skinheight, loadmodel->skinframes + totalskins, i == 0); + Mod_LoadSkin(name, (qbyte *)datapointer, skintemp, skinwidth, skinheight, loadmodel->skinframes + totalskins, i == 0); datapointer += skinwidth * skinheight; totalskins++; } @@ -900,7 +900,7 @@ void Mod_LoadZymoticModel(model_t *mod, void *buffer) zymswapintblock((void *) (pheader->lump_render.start + pbase), pheader->lump_render.length); // validate renderlist and swap winding order of tris renderlist = (void *) (pheader->lump_render.start + pbase); - renderlistend = (void *) ((byte *) renderlist + pheader->lump_render.length); + renderlistend = (void *) ((qbyte *) renderlist + pheader->lump_render.length); i = pheader->numshaders * sizeof(int) + pheader->numtris * sizeof(int[3]); if (pheader->lump_render.length != i) Host_Error("Mod_LoadZymoticModel: renderlist is wrong size in %s (is %i bytes, should be %i bytes)\n", loadmodel->name, pheader->lump_render.length, i); diff --git a/model_brush.c b/model_brush.c index ca010f05..9b0a3454 100644 --- a/model_brush.c +++ b/model_brush.c @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -byte mod_novis[(MAX_MAP_LEAFS + 7)/ 8]; +qbyte mod_novis[(MAX_MAP_LEAFS + 7)/ 8]; cvar_t r_subdivide_size = {CVAR_SAVE, "r_subdivide_size", "128"}; cvar_t halflifebsp = {0, "halflifebsp", "0"}; @@ -118,12 +118,12 @@ mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model) Mod_DecompressVis =================== */ -static byte *Mod_DecompressVis (byte *in, model_t *model) +static qbyte *Mod_DecompressVis (qbyte *in, model_t *model) { - static byte decompressed[MAX_MAP_LEAFS/8]; - int c; - byte *out; - int row; + static qbyte decompressed[MAX_MAP_LEAFS/8]; + int c; + qbyte *out; + int row; row = (model->numleafs+7)>>3; out = decompressed; @@ -160,7 +160,7 @@ static byte *Mod_DecompressVis (byte *in, model_t *model) return decompressed; } -byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model) +qbyte *Mod_LeafPVS (mleaf_t *leaf, model_t *model) { if (r_novis.integer || leaf == model->leafs || leaf->compressed_vis == NULL) return mod_novis; @@ -169,8 +169,8 @@ byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model) void Mod_SetupNoTexture(void) { - int x, y; - byte pix[16][16][4]; + int x, y; + qbyte pix[16][16][4]; for (y = 0;y < 16;y++) { @@ -212,7 +212,7 @@ static void Mod_LoadTextures (lump_t *l) miptex_t *dmiptex; texture_t *tx, *tx2, *anims[10], *altanims[10]; dmiptexlump_t *m; - byte *data, *mtdata, *data2; + qbyte *data, *mtdata, *data2; char name[256]; Mod_SetupNoTexture(); @@ -237,7 +237,7 @@ static void Mod_LoadTextures (lump_t *l) dofs[i] = LittleLong(dofs[i]); if (dofs[i] == -1) continue; - dmiptex = (miptex_t *)((byte *)m + dofs[i]); + dmiptex = (miptex_t *)((qbyte *)m + dofs[i]); mtwidth = LittleLong (dmiptex->width); mtheight = LittleLong (dmiptex->height); mtdata = NULL; @@ -247,7 +247,7 @@ static void Mod_LoadTextures (lump_t *l) // texture included if (j < 40 || j + mtwidth * mtheight > l->filelen) Host_Error ("Texture %s is corrupt or incomplete\n", dmiptex->name); - mtdata = (byte *)dmiptex + j; + mtdata = (qbyte *)dmiptex + j; } if ((mtwidth & 15) || (mtheight & 15)) @@ -486,8 +486,7 @@ Mod_LoadLighting static void Mod_LoadLighting (lump_t *l) { int i; - byte *in, *out, *data; - byte d; + qbyte *in, *out, *data, d; char litfilename[1024]; loadmodel->lightdata = NULL; if (loadmodel->ishlbsp) // LordHavoc: load the colored lighting data straight @@ -501,7 +500,7 @@ static void Mod_LoadLighting (lump_t *l) strcpy(litfilename, loadmodel->name); COM_StripExtension(litfilename, litfilename); strcat(litfilename, ".lit"); - data = (byte*) COM_LoadFile (litfilename, false); + data = (qbyte*) COM_LoadFile (litfilename, false); if (data) { if (loadsize > 8 && data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T') @@ -2393,7 +2392,7 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer) Cvar_SetValue("halflifebsp", mod->ishlbsp); // swap all the lumps - mod_base = (byte *)header; + mod_base = (qbyte *)header; for (i=0 ; isprdata_frames[realframes].texture = R_LoadTexture (loadmodel->texturepool, name, width, height, pixbuf, TEXTYPE_RGBA, TEXF_ALPHA | (r_mipsprites.integer ? TEXF_MIPMAP : 0) | TEXF_PRECACHE); @@ -264,7 +264,7 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer) else if (version == SPRITEHL_VERSION) { int i, rendermode; - byte palette[256][4], *in; + qbyte palette[256][4], *in; dspritehl_t *pinsprite; long datapointer; @@ -278,12 +278,12 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer) loadmodel->synctype = LittleLong (pinsprite->synctype); rendermode = pinsprite->rendermode; - in = (byte *)datapointer; + in = (qbyte *)datapointer; datapointer += 2; i = in[0] + in[1] * 256; if (i != 256) Host_Error ("Mod_LoadHLSprite: unexpected number of palette colors %i (should be 256)", i); - in = (byte *)datapointer; + in = (qbyte *)datapointer; datapointer += 768; switch(rendermode) { diff --git a/modelgen.h b/modelgen.h index 951ed91f..3b5fd543 100644 --- a/modelgen.h +++ b/modelgen.h @@ -72,8 +72,8 @@ typedef struct dtriangle_s { // load this data typedef struct { - byte v[3]; - byte lightnormalindex; + qbyte v[3]; + qbyte lightnormalindex; } trivertx_t; typedef struct { diff --git a/net.h b/net.h index c962f626..9684aa68 100644 --- a/net.h +++ b/net.h @@ -136,12 +136,12 @@ typedef struct qsocket_s unsigned int sendSequence; unsigned int unreliableSendSequence; int sendMessageLength; - byte sendMessage [NET_MAXMESSAGE]; + qbyte sendMessage [NET_MAXMESSAGE]; unsigned int receiveSequence; unsigned int unreliableReceiveSequence; int receiveMessageLength; - byte receiveMessage [NET_MAXMESSAGE]; + qbyte receiveMessage [NET_MAXMESSAGE]; struct qsockaddr addr; char address[NET_NAMELEN]; @@ -166,9 +166,9 @@ typedef struct int (*CloseSocket) (int socket); int (*Connect) (int socket, struct qsockaddr *addr); int (*CheckNewConnections) (void); - int (*Read) (int socket, byte *buf, int len, struct qsockaddr *addr); - int (*Write) (int socket, byte *buf, int len, struct qsockaddr *addr); - int (*Broadcast) (int socket, byte *buf, int len); + int (*Read) (int socket, qbyte *buf, int len, struct qsockaddr *addr); + int (*Write) (int socket, qbyte *buf, int len, struct qsockaddr *addr); + int (*Broadcast) (int socket, qbyte *buf, int len); char * (*AddrToString) (struct qsockaddr *addr); int (*StringToAddr) (char *string, struct qsockaddr *addr); int (*GetSocketAddr) (int socket, struct qsockaddr *addr); diff --git a/net_dgrm.c b/net_dgrm.c index dd4ed8a0..db5f46bc 100644 --- a/net_dgrm.c +++ b/net_dgrm.c @@ -77,7 +77,7 @@ struct { unsigned int length; unsigned int sequence; - byte data[MAX_DATAGRAM]; + qbyte data[MAX_DATAGRAM]; } packetBuffer; @@ -85,7 +85,7 @@ struct char *StrAddr (struct qsockaddr *addr) { static char buf[34]; - byte *p = (byte *)addr; + qbyte *p = (qbyte *)addr; int n; for (n = 0; n < 16; n++) @@ -193,7 +193,7 @@ int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data) sock->canSend = false; - if (sfunc.Write (sock->socket, (byte *)&packetBuffer, packetLen, &sock->addr) == -1) + if (sfunc.Write (sock->socket, (qbyte *)&packetBuffer, packetLen, &sock->addr) == -1) return -1; sock->lastSendTime = net_time; @@ -226,7 +226,7 @@ int SendMessageNext (qsocket_t *sock) sock->sendNext = false; - if (sfunc.Write (sock->socket, (byte *)&packetBuffer, packetLen, &sock->addr) == -1) + if (sfunc.Write (sock->socket, (qbyte *)&packetBuffer, packetLen, &sock->addr) == -1) return -1; sock->lastSendTime = net_time; @@ -259,7 +259,7 @@ int ReSendMessage (qsocket_t *sock) sock->sendNext = false; - if (sfunc.Write (sock->socket, (byte *)&packetBuffer, packetLen, &sock->addr) == -1) + if (sfunc.Write (sock->socket, (qbyte *)&packetBuffer, packetLen, &sock->addr) == -1) return -1; sock->lastSendTime = net_time; @@ -301,7 +301,7 @@ int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data) packetBuffer.sequence = BigLong(sock->unreliableSendSequence++); memcpy (packetBuffer.data, data->data, data->cursize); - if (sfunc.Write (sock->socket, (byte *)&packetBuffer, packetLen, &sock->addr) == -1) + if (sfunc.Write (sock->socket, (qbyte *)&packetBuffer, packetLen, &sock->addr) == -1) return -1; packetsSent++; @@ -324,7 +324,7 @@ int Datagram_GetMessage (qsocket_t *sock) while(1) { - length = sfunc.Read (sock->socket, (byte *)&packetBuffer, NET_DATAGRAMSIZE, &readaddr); + length = sfunc.Read (sock->socket, (qbyte *)&packetBuffer, NET_DATAGRAMSIZE, &readaddr); // if ((rand() & 255) > 220) // continue; @@ -425,7 +425,7 @@ int Datagram_GetMessage (qsocket_t *sock) { packetBuffer.length = BigLong(NET_HEADERSIZE | NETFLAG_ACK); packetBuffer.sequence = BigLong(sequence); - sfunc.Write (sock->socket, (byte *)&packetBuffer, NET_HEADERSIZE, &readaddr); + sfunc.Write (sock->socket, (qbyte *)&packetBuffer, NET_HEADERSIZE, &readaddr); if (sequence != sock->receiveSequence) { @@ -528,7 +528,7 @@ static void Test_Poll(void) int colors; int frags; int connectTime; - byte playerNumber; + qbyte playerNumber; net_landriverlevel = testDriver; diff --git a/net_loop.c b/net_loop.c index 1ad3fee9..8424ca9c 100644 --- a/net_loop.c +++ b/net_loop.c @@ -153,8 +153,8 @@ int Loop_GetMessage (qsocket_t *sock) int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data) { - byte *buffer; - int *bufferLength; + qbyte *buffer; + int *bufferLength; if (!sock->driverdata) return -1; @@ -187,16 +187,16 @@ int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data) int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data) { - byte *buffer; - int *bufferLength; + qbyte *buffer; + int *bufferLength; if (!sock->driverdata) return -1; bufferLength = &((qsocket_t *)sock->driverdata)->receiveMessageLength; - // LordHavoc: added an extra sizeof(byte) to account for alignment - if ((*bufferLength + data->cursize + sizeof(byte) + sizeof(short) + sizeof(byte)) > NET_MAXMESSAGE) + // LordHavoc: added an extra sizeof(qbyte) to account for alignment + if ((*bufferLength + data->cursize + sizeof(qbyte) + sizeof(short) + sizeof(qbyte)) > NET_MAXMESSAGE) return 0; buffer = ((qsocket_t *)sock->driverdata)->receiveMessage + *bufferLength; diff --git a/net_udp.c b/net_udp.c index ed5d066e..9b913306 100644 --- a/net_udp.c +++ b/net_udp.c @@ -244,7 +244,7 @@ int UDP_CheckNewConnections (void) //============================================================================= -int UDP_Read (int socket, byte *buf, int len, struct qsockaddr *addr) +int UDP_Read (int socket, qbyte *buf, int len, struct qsockaddr *addr) { int addrlen = sizeof (struct qsockaddr); int ret; @@ -271,7 +271,7 @@ int UDP_MakeSocketBroadcastCapable (int socket) //============================================================================= -int UDP_Broadcast (int socket, byte *buf, int len) +int UDP_Broadcast (int socket, qbyte *buf, int len) { int ret; @@ -292,7 +292,7 @@ int UDP_Broadcast (int socket, byte *buf, int len) //============================================================================= -int UDP_Write (int socket, byte *buf, int len, struct qsockaddr *addr) +int UDP_Write (int socket, qbyte *buf, int len, struct qsockaddr *addr) { int ret; diff --git a/net_udp.h b/net_udp.h index 75303011..87ab879d 100644 --- a/net_udp.h +++ b/net_udp.h @@ -26,9 +26,9 @@ int UDP_OpenSocket (int port); int UDP_CloseSocket (int socket); int UDP_Connect (int socket, struct qsockaddr *addr); int UDP_CheckNewConnections (void); -int UDP_Read (int socket, byte *buf, int len, struct qsockaddr *addr); -int UDP_Write (int socket, byte *buf, int len, struct qsockaddr *addr); -int UDP_Broadcast (int socket, byte *buf, int len); +int UDP_Read (int socket, qbyte *buf, int len, struct qsockaddr *addr); +int UDP_Write (int socket, qbyte *buf, int len, struct qsockaddr *addr); +int UDP_Broadcast (int socket, qbyte *buf, int len); char *UDP_AddrToString (struct qsockaddr *addr); int UDP_StringToAddr (char *string, struct qsockaddr *addr); int UDP_GetSocketAddr (int socket, struct qsockaddr *addr); diff --git a/net_wins.c b/net_wins.c index 21eedf8c..236c3554 100644 --- a/net_wins.c +++ b/net_wins.c @@ -108,7 +108,7 @@ void WINS_GetLocalAddress(void) myAddr = *(int *)local->h_addr_list[0]; addr = ntohl(myAddr); - sprintf(my_tcpip_address, "%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff); + sprintf(my_tcpip_address, "%d.%d.%d.%d", (int) ((addr >> 24) & 0xff), (int) ((addr >> 16) & 0xff), (int) ((addr >> 8) & 0xff), (int) (addr & 0xff)); } @@ -392,7 +392,7 @@ int WINS_CheckNewConnections (void) //============================================================================= -int WINS_Read (int socket, byte *buf, int len, struct qsockaddr *addr) +int WINS_Read (int socket, qbyte *buf, int len, struct qsockaddr *addr) { int addrlen = sizeof (struct qsockaddr); int ret; @@ -426,7 +426,7 @@ int WINS_MakeSocketBroadcastCapable (int socket) //============================================================================= -int WINS_Broadcast (int socket, byte *buf, int len) +int WINS_Broadcast (int socket, qbyte *buf, int len) { int ret; @@ -448,7 +448,7 @@ int WINS_Broadcast (int socket, byte *buf, int len) //============================================================================= -int WINS_Write (int socket, byte *buf, int len, struct qsockaddr *addr) +int WINS_Write (int socket, qbyte *buf, int len, struct qsockaddr *addr) { int ret; diff --git a/net_wins.h b/net_wins.h index 756ce645..d9072485 100644 --- a/net_wins.h +++ b/net_wins.h @@ -26,9 +26,9 @@ int WINS_OpenSocket (int port); int WINS_CloseSocket (int socket); int WINS_Connect (int socket, struct qsockaddr *addr); int WINS_CheckNewConnections (void); -int WINS_Read (int socket, byte *buf, int len, struct qsockaddr *addr); -int WINS_Write (int socket, byte *buf, int len, struct qsockaddr *addr); -int WINS_Broadcast (int socket, byte *buf, int len); +int WINS_Read (int socket, qbyte *buf, int len, struct qsockaddr *addr); +int WINS_Write (int socket, qbyte *buf, int len, struct qsockaddr *addr); +int WINS_Broadcast (int socket, qbyte *buf, int len); char *WINS_AddrToString (struct qsockaddr *addr); int WINS_StringToAddr (char *string, struct qsockaddr *addr); int WINS_GetSocketAddr (int socket, struct qsockaddr *addr); diff --git a/net_wipx.c b/net_wipx.c index 20f550a4..bf53adb5 100644 --- a/net_wipx.c +++ b/net_wipx.c @@ -230,9 +230,9 @@ int WIPX_CheckNewConnections (void) //============================================================================= -static byte packetBuffer[NET_DATAGRAMSIZE + 4]; +static qbyte packetBuffer[NET_DATAGRAMSIZE + 4]; -int WIPX_Read (int handle, byte *buf, int len, struct qsockaddr *addr) +int WIPX_Read (int handle, qbyte *buf, int len, struct qsockaddr *addr) { int addrlen = sizeof (struct qsockaddr); int socket = ipxsocket[handle]; @@ -261,14 +261,14 @@ int WIPX_Read (int handle, byte *buf, int len, struct qsockaddr *addr) //============================================================================= -int WIPX_Broadcast (int handle, byte *buf, int len) +int WIPX_Broadcast (int handle, qbyte *buf, int len) { return WIPX_Write (handle, buf, len, &broadcastaddr); } //============================================================================= -int WIPX_Write (int handle, byte *buf, int len, struct qsockaddr *addr) +int WIPX_Write (int handle, qbyte *buf, int len, struct qsockaddr *addr) { int socket = ipxsocket[handle]; int ret; diff --git a/net_wipx.h b/net_wipx.h index ed82dc1d..109120ea 100644 --- a/net_wipx.h +++ b/net_wipx.h @@ -26,9 +26,9 @@ int WIPX_OpenSocket (int port); int WIPX_CloseSocket (int socket); int WIPX_Connect (int socket, struct qsockaddr *addr); int WIPX_CheckNewConnections (void); -int WIPX_Read (int socket, byte *buf, int len, struct qsockaddr *addr); -int WIPX_Write (int socket, byte *buf, int len, struct qsockaddr *addr); -int WIPX_Broadcast (int socket, byte *buf, int len); +int WIPX_Read (int socket, qbyte *buf, int len, struct qsockaddr *addr); +int WIPX_Write (int socket, qbyte *buf, int len, struct qsockaddr *addr); +int WIPX_Broadcast (int socket, qbyte *buf, int len); char *WIPX_AddrToString (struct qsockaddr *addr); int WIPX_StringToAddr (char *string, struct qsockaddr *addr); int WIPX_GetSocketAddr (int socket, struct qsockaddr *addr); diff --git a/palette.c b/palette.c index 76a2de55..6b4aa922 100644 --- a/palette.c +++ b/palette.c @@ -2,9 +2,9 @@ #include "quakedef.h" unsigned int d_8to24table[256]; -//byte d_15to8table[32768]; -byte host_basepal[768]; -byte texgamma[256]; +//qbyte d_15to8table[32768]; +qbyte host_basepal[768]; +qbyte texgamma[256]; cvar_t v_gamma = {CVAR_SAVE, "v_gamma", "1"}; cvar_t v_contrast = {CVAR_SAVE, "v_contrast", "1"}; @@ -14,11 +14,11 @@ cvar_t v_hwgamma = {0, "v_hwgamma", "1"}; void Palette_Setup8to24(void) { - byte *in, *out; + qbyte *in, *out; unsigned short i; in = host_basepal; - out = (byte *) d_8to24table; // d_8to24table is accessed as 32bit for speed reasons, but is created as 8bit bytes + out = (qbyte *) d_8to24table; // d_8to24table is accessed as 32bit for speed reasons, but is created as 8bit bytes for (i=0 ; i<255 ; i++) { *out++ = *in++; @@ -32,7 +32,7 @@ void Palette_Setup8to24(void) /* void Palette_Setup15to8(void) { - byte *pal; + qbyte *pal; unsigned r,g,b; unsigned v; int r1,g1,b1; @@ -62,7 +62,7 @@ void Palette_Setup15to8(void) } */ -void BuildGammaTable8(float prescale, float gamma, float scale, float base, byte *out) +void BuildGammaTable8(float prescale, float gamma, float scale, float base, qbyte *out) { int i, adjusted; double invgamma, d; @@ -174,8 +174,8 @@ void Gamma_Init(void) void Palette_Init(void) { - byte *pal; - pal = (byte *)COM_LoadFile ("gfx/palette.lmp", false); + qbyte *pal; + pal = (qbyte *)COM_LoadFile ("gfx/palette.lmp", false); if (!pal) Sys_Error ("Couldn't load gfx/palette.lmp"); memcpy(host_basepal, pal, 765); diff --git a/palette.h b/palette.h index 7e3ef152..f6e862e0 100644 --- a/palette.h +++ b/palette.h @@ -6,14 +6,14 @@ extern cvar_t v_overbrightbits; extern cvar_t v_hwgamma; extern unsigned int d_8to24table[256]; -//extern byte d_15to8table[32768]; +//extern qbyte d_15to8table[32768]; extern qboolean hardwaregammasupported; void VID_UpdateGamma(qboolean force); // used by hardware gamma functions in vid_* files -void BuildGammaTable8(float prescale, float gamma, float scale, float base, byte *out); +void BuildGammaTable8(float prescale, float gamma, float scale, float base, qbyte *out); void BuildGammaTable16(float prescale, float gamma, float scale, float base, unsigned short *out); void Gamma_Init(void); diff --git a/pr_cmds.c b/pr_cmds.c index c002f3cf..7b1a1782 100644 --- a/pr_cmds.c +++ b/pr_cmds.c @@ -858,12 +858,12 @@ void PF_checkpos (void) //============================================================================ -byte checkpvs[MAX_MAP_LEAFS/8]; +qbyte checkpvs[MAX_MAP_LEAFS/8]; int PF_newcheckclient (int check) { int i; - byte *pvs; + qbyte *pvs; edict_t *ent; mleaf_t *leaf; vec3_t org; diff --git a/pr_comp.h b/pr_comp.h index 94410c41..614881ac 100644 --- a/pr_comp.h +++ b/pr_comp.h @@ -147,7 +147,7 @@ typedef struct int s_file; // source file defined in int numparms; - byte parm_size[MAX_PARMS]; + qbyte parm_size[MAX_PARMS]; } dfunction_t; diff --git a/pr_edict.c b/pr_edict.c index 4b17da13..78fd1176 100644 --- a/pr_edict.c +++ b/pr_edict.c @@ -1204,7 +1204,7 @@ void PR_LoadProgs (void) Con_DPrintf ("Programs occupy %iK.\n", com_filesize/1024); - pr_crc = CRC_Block((byte *)progs, com_filesize); + pr_crc = CRC_Block((qbyte *)progs, com_filesize); // byte swap the header for (i=0 ; icrc != PROGHEADER_CRC) Host_Error ("progs.dat system vars have been modified, progdefs.h is out of date"); - pr_functions = (dfunction_t *)((byte *)progs + progs->ofs_functions); + pr_functions = (dfunction_t *)((qbyte *)progs + progs->ofs_functions); pr_strings = (char *)progs + progs->ofs_strings; - pr_globaldefs = (ddef_t *)((byte *)progs + progs->ofs_globaldefs); + pr_globaldefs = (ddef_t *)((qbyte *)progs + progs->ofs_globaldefs); // we need to expand the fielddefs list to include all the engine fields, // so allocate a new place for it - infielddefs = (ddef_t *)((byte *)progs + progs->ofs_fielddefs); + infielddefs = (ddef_t *)((qbyte *)progs + progs->ofs_fielddefs); pr_fielddefs = Mem_Alloc(progs_mempool, (progs->numfielddefs + DPFIELDS) * sizeof(ddef_t)); - pr_statements = (dstatement_t *)((byte *)progs + progs->ofs_statements); + pr_statements = (dstatement_t *)((qbyte *)progs + progs->ofs_statements); // moved edict_size calculation down below field adding code - pr_global_struct = (globalvars_t *)((byte *)progs + progs->ofs_globals); + pr_global_struct = (globalvars_t *)((qbyte *)progs + progs->ofs_globals); pr_globals = (float *)pr_global_struct; // byte swap the lumps @@ -1477,7 +1477,7 @@ edict_t *EDICT_NUM(int n) { if (n < 0 || n >= sv.max_edicts) Sys_Error ("EDICT_NUM: bad number %i", n); - return (edict_t *)((byte *)sv.edicts+ (n)*pr_edict_size); + return (edict_t *)((qbyte *)sv.edicts+ (n)*pr_edict_size); } */ @@ -1485,7 +1485,7 @@ int NUM_FOR_EDICT(edict_t *e) { int b; - b = (byte *)e - (byte *)sv.edicts; + b = (qbyte *)e - (qbyte *)sv.edicts; b = b / pr_edict_size; if (b < 0 || b >= sv.num_edicts) @@ -1497,7 +1497,7 @@ int NoCrash_NUM_FOR_EDICT(edict_t *e) { int b; - b = (byte *)e - (byte *)sv.edicts; + b = (qbyte *)e - (qbyte *)sv.edicts; b = b / pr_edict_size; return b; } diff --git a/pr_execprogram.h b/pr_execprogram.h index 524ca44f..838a0036 100644 --- a/pr_execprogram.h +++ b/pr_execprogram.h @@ -144,14 +144,14 @@ PR_RunError("Progs attempted to write to an out of bounds edict\n"); return; } - if (OPB->_int % pr_edict_size < ((byte *)&sv.edicts->v - (byte *)sv.edicts)) + if (OPB->_int % pr_edict_size < ((qbyte *)&sv.edicts->v - (qbyte *)sv.edicts)) { pr_xstatement = st - pr_statements; PR_RunError("Progs attempted to write to an engine edict field\n"); return; } #endif - ptr = (eval_t *)((byte *)sv.edicts + OPB->_int); + ptr = (eval_t *)((qbyte *)sv.edicts + OPB->_int); ptr->_int = OPA->_int; break; case OP_STOREP_V: @@ -163,7 +163,7 @@ return; } #endif - ptr = (eval_t *)((byte *)sv.edicts + OPB->_int); + ptr = (eval_t *)((qbyte *)sv.edicts + OPB->_int); ptr->vector[0] = OPA->vector[0]; ptr->vector[1] = OPA->vector[1]; ptr->vector[2] = OPA->vector[2]; @@ -207,7 +207,7 @@ } #endif ed = PROG_TO_EDICT(OPA->edict); - OPC->_int = (byte *)((int *)&ed->v + OPB->_int) - (byte *)sv.edicts; + OPC->_int = (qbyte *)((int *)&ed->v + OPB->_int) - (qbyte *)sv.edicts; break; case OP_LOAD_F: @@ -480,14 +480,14 @@ PR_RunError("Progs attempted to write to an out of bounds edict\n"); return; } - if (OPB->_int % pr_edict_size < ((byte *)&sv.edicts->v - (byte *)sv.edicts)) + if (OPB->_int % pr_edict_size < ((qbyte *)&sv.edicts->v - (qbyte *)sv.edicts)) { pr_xstatement = st - pr_statements; PR_RunError("Progs attempted to write to an engine edict field\n"); return; } #endif - ptr = (eval_t *)((byte *)sv.edicts + OPB->_int); + ptr = (eval_t *)((qbyte *)sv.edicts + OPB->_int); ptr->_int = OPA->_int; break; case OP_LOAD_I: diff --git a/progs.h b/progs.h index 289f4214..c377ec0c 100644 --- a/progs.h +++ b/progs.h @@ -52,7 +52,7 @@ typedef struct edict_s entvars_t v; // C exported fields from progs // other fields from progs come immediately after } edict_t; -//#define EDICT_FROM_AREA(l) ((edict_t *)((byte *)l - (int)&(((edict_t *)0)->area))) +//#define EDICT_FROM_AREA(l) ((edict_t *)((qbyte *)l - (int)&(((edict_t *)0)->area))) //#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area) // LordHavoc: in an effort to eliminate time wasted on GetEdictFieldValue... see pr_edict.c for the functions which use these. @@ -136,23 +136,23 @@ void ED_ParseGlobals (char *data); void ED_LoadFromFile (char *data); edict_t *EDICT_NUM_ERROR(int n); -#define EDICT_NUM(n) (n >= 0 ? (n < sv.max_edicts ? (edict_t *)((byte *)sv.edicts + (n) * pr_edict_size) : EDICT_NUM_ERROR(n)) : EDICT_NUM_ERROR(n)) +#define EDICT_NUM(n) (n >= 0 ? (n < sv.max_edicts ? (edict_t *)((qbyte *)sv.edicts + (n) * pr_edict_size) : EDICT_NUM_ERROR(n)) : EDICT_NUM_ERROR(n)) //define EDICT_NUM(n) ((edict_t *)(sv.edicts+ (n)*pr_edict_size)) -//define NUM_FOR_EDICT(e) (((byte *)(e) - sv.edicts)/pr_edict_size) +//define NUM_FOR_EDICT(e) (((qbyte *)(e) - sv.edicts)/pr_edict_size) //edict_t *EDICT_NUM(int n); int NUM_FOR_EDICT(edict_t *e); -#define NEXT_EDICT(e) ((edict_t *)( (byte *)e + pr_edict_size)) +#define NEXT_EDICT(e) ((edict_t *)( (qbyte *)e + pr_edict_size)) -#define EDICT_TO_PROG(e) ((byte *)e - (byte *)sv.edicts) -#define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e)) +#define EDICT_TO_PROG(e) ((qbyte *)e - (qbyte *)sv.edicts) +#define PROG_TO_EDICT(e) ((edict_t *)((qbyte *)sv.edicts + e)) //============================================================================ #define G_FLOAT(o) (pr_globals[o]) #define G_INT(o) (*(int *)&pr_globals[o]) -#define G_EDICT(o) ((edict_t *)((byte *)sv.edicts+ *(int *)&pr_globals[o])) +#define G_EDICT(o) ((edict_t *)((qbyte *)sv.edicts+ *(int *)&pr_globals[o])) #define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o)) #define G_VECTOR(o) (&pr_globals[o]) #define G_STRING(o) (pr_strings + *(string_t *)&pr_globals[o]) diff --git a/protocol.c b/protocol.c index be9c9e79..a5e16ab2 100644 --- a/protocol.c +++ b/protocol.c @@ -181,11 +181,11 @@ void EntityFrame_Write(entity_database_t *d, entity_frame_t *f, sizebuf_t *msg) bits |= E_ORIGIN2; if ((int) ent->origin[2] != (int) delta->origin[2]) bits |= E_ORIGIN3; - if ((byte) (ent->angles[0] * (256.0f / 360.0f)) != (byte) (delta->angles[0] * (256.0f / 360.0f))) + if ((qbyte) (ent->angles[0] * (256.0f / 360.0f)) != (qbyte) (delta->angles[0] * (256.0f / 360.0f))) bits |= E_ANGLE1; - if ((byte) (ent->angles[1] * (256.0f / 360.0f)) != (byte) (delta->angles[1] * (256.0f / 360.0f))) + if ((qbyte) (ent->angles[1] * (256.0f / 360.0f)) != (qbyte) (delta->angles[1] * (256.0f / 360.0f))) bits |= E_ANGLE2; - if ((byte) (ent->angles[2] * (256.0f / 360.0f)) != (byte) (delta->angles[2] * (256.0f / 360.0f))) + if ((qbyte) (ent->angles[2] * (256.0f / 360.0f)) != (qbyte) (delta->angles[2] * (256.0f / 360.0f))) bits |= E_ANGLE3; if ((ent->modelindex ^ delta->modelindex) & 0x00FF) bits |= E_MODEL1; diff --git a/protocol.h b/protocol.h index ad839c2b..2ed2326a 100644 --- a/protocol.h +++ b/protocol.h @@ -288,21 +288,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct { - double time; // time this state was built - vec3_t origin; - vec3_t angles; + double time; // time this state was built + vec3_t origin; + vec3_t angles; int number; // entity number this state is for unsigned short active; // true if a valid state unsigned short modelindex; unsigned short frame; unsigned short effects; - byte colormap; - byte skin; - byte alpha; - byte scale; - byte glowsize; - byte glowcolor; - byte flags; + qbyte colormap; + qbyte skin; + qbyte alpha; + qbyte scale; + qbyte glowsize; + qbyte glowcolor; + qbyte flags; } entity_state_t; diff --git a/quakedef.h b/quakedef.h index 85760aba..dbaf99cc 100644 --- a/quakedef.h +++ b/quakedef.h @@ -21,12 +21,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define QUAKE_GAME // as opposed to utilities +#include +#include +#include +#include +#include +#include + extern char *buildstring; -#if !defined BYTE_DEFINED -typedef unsigned char byte; -#define BYTE_DEFINED 1 -#endif +typedef unsigned char qbyte; #undef true #undef false @@ -51,13 +55,6 @@ typedef enum {false, true} qboolean; #define GAMENAME "id1" -#include -#include -#include -#include -#include -#include - #define MAX_NUM_ARGVS 50 // up / down @@ -294,7 +291,7 @@ void Chase_Reset (void); void Chase_Update (void); void fractalnoise(unsigned char *noise, int size, int startgrid); -void fractalnoisequick(byte *noise, int size, int startgrid); +void fractalnoisequick(unsigned char *noise, int size, int startgrid); #include "palette.h" #include "image.h" diff --git a/r_clip.c b/r_clip.c index d0134e03..8625a2a1 100644 --- a/r_clip.c +++ b/r_clip.c @@ -248,7 +248,7 @@ int R_Clip_ClipPolygonToPlane(float *in, float *out, int inpoints, int stride, t float *prevpoint, prevdist, dist, dot; // begin with the last point, then enter the loop with the first point as current - prevpoint = (float *) ((byte *)in + stride * (inpoints - 1)); + prevpoint = (float *) ((qbyte *)in + stride * (inpoints - 1)); prevdist = DotProduct(prevpoint, plane->normal) - plane->dist; prevside = prevdist >= 0 ? SIDE_FRONT : SIDE_BACK; i = 0; @@ -259,7 +259,7 @@ int R_Clip_ClipPolygonToPlane(float *in, float *out, int inpoints, int stride, t prevpoint = in; prevdist = dist; prevside = side; - (byte *)in += stride; + (qbyte *)in += stride; begin: dist = DotProduct(in, plane->normal) - plane->dist; @@ -313,12 +313,12 @@ void R_Clip_AddPolygon (vec_t *points, int numverts, int stride, int solid, void { polyplane = &localplane; // calculate the plane for the polygon - if (!R_Clip_TriangleToPlane((float *) points, (float *) ((byte *)points + stride), (float *) ((byte *)points + 2 * stride), polyplane)) + if (!R_Clip_TriangleToPlane((float *) points, (float *) ((qbyte *)points + stride), (float *) ((qbyte *)points + 2 * stride), polyplane)) { for (i = 0;i < numverts;i++) for (j = i + 1;j < numverts;j++) for (k = j + 1;k < numverts;k++) - if (R_Clip_TriangleToPlane((float *) ((byte *)points + i * stride), (float *) ((byte *)points + j * stride), (float *) ((byte *)points + k * stride), polyplane)) + if (R_Clip_TriangleToPlane((float *) ((qbyte *)points + i * stride), (float *) ((qbyte *)points + j * stride), (float *) ((qbyte *)points + k * stride), polyplane)) goto valid1; return; // gave up valid1:; @@ -332,12 +332,12 @@ void R_Clip_AddPolygon (vec_t *points, int numverts, int stride, int solid, void else { // calculate the plane for the polygon - if (!R_Clip_TriangleToPlane((float *) points, (float *) ((byte *)points + stride), (float *) ((byte *)points + 2 * stride), &localplane)) + if (!R_Clip_TriangleToPlane((float *) points, (float *) ((qbyte *)points + stride), (float *) ((qbyte *)points + 2 * stride), &localplane)) { for (i = 0;i < numverts;i++) for (j = i + 1;j < numverts;j++) for (k = j + 1;k < numverts;k++) - if (R_Clip_TriangleToPlane((float *) ((byte *)points + i * stride), (float *) ((byte *)points + j * stride), (float *) ((byte *)points + k * stride), &localplane)) + if (R_Clip_TriangleToPlane((float *) ((qbyte *)points + i * stride), (float *) ((qbyte *)points + j * stride), (float *) ((qbyte *)points + k * stride), &localplane)) goto valid4; return; // gave up valid4:; @@ -874,7 +874,7 @@ void R_Clip_DisplayBuffer(void) #if CLIPTEST int i; static int firstupload = true; - byte clipbuffertex[256*256], *b; + qbyte clipbuffertex[256*256], *b; if (!r_render.integer) return; if (clipwidth > 256 || clipheight > 256) diff --git a/r_crosshairs.c b/r_crosshairs.c index 042a42c9..83a45ecb 100644 --- a/r_crosshairs.c +++ b/r_crosshairs.c @@ -21,7 +21,7 @@ void R_Crosshairs_Init(void) void DrawCrosshair(int num) { int i; - byte *color; + qbyte *color; float scale, base; char *picname; cachepic_t *pic; @@ -37,7 +37,7 @@ void DrawCrosshair(int num) } else i = 15; - color = (byte *) &d_8to24table[i]; + color = (qbyte *) &d_8to24table[i]; if (crosshair_flashspeed.value >= 0.01f) base = (sin(realtime * crosshair_flashspeed.value * (M_PI*2.0f)) * crosshair_flashrange.value); else diff --git a/r_explosion.c b/r_explosion.c index 8bfd09d7..f46fe648 100644 --- a/r_explosion.c +++ b/r_explosion.c @@ -77,7 +77,7 @@ cvar_t r_drawexplosions = {0, "r_drawexplosions", "1"}; void r_explosion_start(void) { int x, y; - byte noise1[128][128], noise2[128][128], noise3[128][128], data[128][128][4]; + qbyte noise1[128][128], noise2[128][128], noise3[128][128], data[128][128][4]; explosiontexturepool = R_AllocTexturePool(); fractalnoise(&noise1[0][0], 128, 32); fractalnoise(&noise2[0][0], 128, 4); @@ -169,7 +169,7 @@ void R_NewExplosion(vec3_t org) { int i, j; float dist; - byte noise[EXPLOSIONGRID*EXPLOSIONGRID]; + qbyte noise[EXPLOSIONGRID*EXPLOSIONGRID]; fractalnoisequick(noise, EXPLOSIONGRID, 4); for (i = 0;i < MAX_EXPLOSIONS;i++) { diff --git a/r_light.c b/r_light.c index 2f8625d9..aa35da8e 100644 --- a/r_light.c +++ b/r_light.c @@ -35,7 +35,7 @@ void r_light_start(void) { float dx, dy; int x, y, a; - byte pixels[32][32][4]; + qbyte pixels[32][32][4]; lighttexturepool = R_AllocTexturePool(); for (y = 0;y < 32;y++) { @@ -395,7 +395,7 @@ static void R_VisMarkLights (rdlight_t *rd, int bit, int bitindex) int i, k, m, c, leafnum; msurface_t *surf, **mark; mleaf_t *leaf; - byte *in; + qbyte *in; int row; float low[3], high[3], dist, maxdist; @@ -662,7 +662,7 @@ loc0: if (surf->samples) { - byte *lightmap; + qbyte *lightmap; int maps, line3, size3, dsfrac = ds & 15, dtfrac = dt & 15, scale = 0, r00 = 0, g00 = 0, b00 = 0, r01 = 0, g01 = 0, b01 = 0, r10 = 0, g10 = 0, b10 = 0, r11 = 0, g11 = 0, b11 = 0; line3 = ((surf->extents[0]>>4)+1)*3; size3 = ((surf->extents[0]>>4)+1) * ((surf->extents[1]>>4)+1)*3; // LordHavoc: *3 for colored lighting diff --git a/r_particles.c b/r_particles.c index f69405bf..cb5795a8 100644 --- a/r_particles.c +++ b/r_particles.c @@ -29,7 +29,7 @@ static particletexture_t particletexture[MAX_PARTICLETEXTURES][2]; static cvar_t r_drawparticles = {0, "r_drawparticles", "1"}; static cvar_t r_particles_lighting = {0, "r_particles_lighting", "1"}; -static byte shadebubble(float dx, float dy, vec3_t light) +static qbyte shadebubble(float dx, float dy, vec3_t light) { float dz, f, dot; vec3_t normal; @@ -56,13 +56,13 @@ static byte shadebubble(float dx, float dy, vec3_t light) f *= 128; f += 16; // just to give it a haze so you can see the outline f = bound(0, f, 255); - return (byte) f; + return (qbyte) f; } else return 0; } -static void setuptex(int cltexnum, int fog, int rtexnum, byte *data, byte *particletexturedata) +static void setuptex(int cltexnum, int fog, int rtexnum, qbyte *data, qbyte *particletexturedata) { int basex, basey, y; basex = ((rtexnum >> 0) & 7) * 32; @@ -79,9 +79,9 @@ static void R_InitParticleTexture (void) { int x,y,d,i,m; float dx, dy, radius, f, f2; - byte data[32][32][4], noise1[64][64], noise2[64][64]; + qbyte data[32][32][4], noise1[64][64], noise2[64][64]; vec3_t light; - byte particletexturedata[256*256*4]; + qbyte particletexturedata[256*256*4]; memset(particletexturedata, 255, sizeof(particletexturedata)); @@ -107,7 +107,7 @@ static void R_InitParticleTexture (void) if (d > 0) d = (d * (256 - (int) (dx*dx+dy*dy))) >> 8; d = bound(0, d, 255); - data[y][x][3] = (byte) d; + data[y][x][3] = (qbyte) d; if (m < d) m = d; } @@ -153,7 +153,7 @@ static void R_InitParticleTexture (void) dx = x - 16; d = (256 - (dx*dx+dy*dy)); d = bound(0, d, 255); - data[y][x][3] = (byte) d; + data[y][x][3] = (qbyte) d; } } setuptex(24, 0, 32, &data[0][0][0], particletexturedata); diff --git a/r_sky.c b/r_sky.c index 5a4ddf1b..72da6c91 100644 --- a/r_sky.c +++ b/r_sky.c @@ -94,9 +94,9 @@ static char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"}; static rtexture_t *skyboxside[6]; int R_SetSkyBox(char *sky) { - int i; - char name[1024]; - byte* image_rgba; + int i; + char name[1024]; + qbyte *image_rgba; if (strcmp(sky, skyname) == 0) // no change return true; @@ -361,9 +361,6 @@ void R_Sky(void) //=============================================================== -static byte skyupperlayerpixels[128*128*4]; -static byte skylowerlayerpixels[128*128*4]; - /* ============= R_InitSky @@ -371,13 +368,11 @@ R_InitSky A sky texture is 256*128, with the right side being a masked overlay ============== */ -void R_InitSky (byte *src, int bytesperpixel) +void R_InitSky (qbyte *src, int bytesperpixel) { - int i, j, p; - unsigned trans[128*128]; - unsigned transpix; - int r, g, b; - unsigned *rgba; + int i, j, p, r, g, b; + qbyte skyupperlayerpixels[128*128*4], skylowerlayerpixels[128*128*4]; + unsigned trans[128*128], transpix, *rgba; strcpy(skyworldname, loadmodel->name); @@ -405,29 +400,29 @@ void R_InitSky (byte *src, int bytesperpixel) p = src[i*256 + j + 128]; rgba = &d_8to24table[p]; trans[(i*128) + j] = *rgba; - r += ((byte *)rgba)[0]; - g += ((byte *)rgba)[1]; - b += ((byte *)rgba)[2]; + r += ((qbyte *)rgba)[0]; + g += ((qbyte *)rgba)[1]; + b += ((qbyte *)rgba)[2]; } } - ((byte *)&transpix)[0] = r/(128*128); - ((byte *)&transpix)[1] = g/(128*128); - ((byte *)&transpix)[2] = b/(128*128); - ((byte *)&transpix)[3] = 0; + ((qbyte *)&transpix)[0] = r/(128*128); + ((qbyte *)&transpix)[1] = g/(128*128); + ((qbyte *)&transpix)[2] = b/(128*128); + ((qbyte *)&transpix)[3] = 0; } memcpy(skyupperlayerpixels, trans, 128*128*4); - solidskytexture = R_LoadTexture (skytexturepool, "sky_solidtexture", 128, 128, (byte *) trans, TEXTYPE_RGBA, TEXF_PRECACHE); + solidskytexture = R_LoadTexture (skytexturepool, "sky_solidtexture", 128, 128, (qbyte *) trans, TEXTYPE_RGBA, TEXF_PRECACHE); /* for (i = 0;i < 128*128;i++) { - ((byte *)&trans[i])[0] >>= 1; - ((byte *)&trans[i])[1] >>= 1; - ((byte *)&trans[i])[2] >>= 1; + ((qbyte *)&trans[i])[0] >>= 1; + ((qbyte *)&trans[i])[1] >>= 1; + ((qbyte *)&trans[i])[2] >>= 1; } - solidskytexture_half = R_LoadTexture (skytexturepool, "sky_solidtexture_half", 128, 128, (byte *) trans, TEXTYPE_RGBA, TEXF_PRECACHE); + solidskytexture_half = R_LoadTexture (skytexturepool, "sky_solidtexture_half", 128, 128, (qbyte *) trans, TEXTYPE_RGBA, TEXF_PRECACHE); */ if (bytesperpixel == 4) @@ -453,14 +448,14 @@ void R_InitSky (byte *src, int bytesperpixel) memcpy(skylowerlayerpixels, trans, 128*128*4); - alphaskytexture = R_LoadTexture (skytexturepool, "sky_alphatexture", 128, 128, (byte *) trans, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE); + alphaskytexture = R_LoadTexture (skytexturepool, "sky_alphatexture", 128, 128, (qbyte *) trans, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE); /* for (i = 0;i < 128*128;i++) { - ((byte *)&trans[i])[0] >>= 1; - ((byte *)&trans[i])[1] >>= 1; - ((byte *)&trans[i])[2] >>= 1; + ((qbyte *)&trans[i])[0] >>= 1; + ((qbyte *)&trans[i])[1] >>= 1; + ((qbyte *)&trans[i])[2] >>= 1; } - alphaskytexture_half = R_LoadTexture (skytexturepool, "sky_alphatexture_half", 128, 128, (byte *) trans, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE); + alphaskytexture_half = R_LoadTexture (skytexturepool, "sky_alphatexture_half", 128, 128, (qbyte *) trans, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE); */ } diff --git a/r_textures.h b/r_textures.h index 3684133f..5d810b93 100644 --- a/r_textures.h +++ b/r_textures.h @@ -46,13 +46,13 @@ int R_CompatibleFragmentWidth(int width, int textype, int flags); // these two functions add a texture to a pool, and may precache (upload) it // a normal static texture -rtexture_t *R_LoadTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, byte *data, int textype, int flags); +rtexture_t *R_LoadTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, qbyte *data, int textype, int flags); // a procedurally generated texture, often animated over time, note: generate can be NULL (for odd uses) -rtexture_t *R_ProceduralTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, int textype, int flags, int (*generate)(byte *buffer, int width, int height, void *parameterdata, int parameterdatasize), void *parameterdata, int parameterdatasize); +rtexture_t *R_ProceduralTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, int textype, int flags, int (*generate)(qbyte *buffer, int width, int height, void *parameterdata, int parameterdatasize), void *parameterdata, int parameterdatasize); // update the image data of a texture, used by lightmap updates and procedural // textures. -void R_UpdateTexture(rtexture_t *rt, byte *data); +void R_UpdateTexture(rtexture_t *rt, qbyte *data); // location of the fragment in the texture (note: any parameter except rt can be NULL) void R_FragmentLocation(rtexture_t *rt, int *x, int *y, float *fx1, float *fy1, float *fx2, float *fy2); diff --git a/render.h b/render.h index 70f42d9e..76777d16 100644 --- a/render.h +++ b/render.h @@ -106,7 +106,7 @@ void R_Init (void); void R_RenderView (void); // must set r_refdef first -void R_InitSky (byte *src, int bytesperpixel); // called at level load +void R_InitSky (qbyte *src, int bytesperpixel); // called at level load //int R_VisibleCullBox (vec3_t mins, vec3_t maxs); @@ -140,7 +140,7 @@ extern vec3_t fogcolor; extern vec_t fogdensity; //#define calcfog(v) (exp(-(fogdensity*fogdensity*(((v)[0] - r_origin[0]) * vpn[0] + ((v)[1] - r_origin[1]) * vpn[1] + ((v)[2] - r_origin[2]) * vpn[2])*(((v)[0] - r_origin[0]) * vpn[0] + ((v)[1] - r_origin[1]) * vpn[1] + ((v)[2] - r_origin[2]) * vpn[2])))) #define calcfog(v) (exp(-(fogdensity*fogdensity*(((v)[0] - r_origin[0])*((v)[0] - r_origin[0])+((v)[1] - r_origin[1])*((v)[1] - r_origin[1])+((v)[2] - r_origin[2])*((v)[2] - r_origin[2]))))) -#define calcfogbyte(v) ((byte) (bound(0, ((int) ((float) (calcfog((v)) * 255.0f))), 255))) +#define calcfogbyte(v) ((qbyte) (bound(0, ((int) ((float) (calcfog((v)) * 255.0f))), 255))) #include "r_modules.h" diff --git a/sbar.c b/sbar.c index a85875df..82305a38 100644 --- a/sbar.c +++ b/sbar.c @@ -607,7 +607,7 @@ void Sbar_DrawFrags (void) int i, k, l, x, f; char num[12]; scoreboard_t *s; - byte *c; + qbyte *c; Sbar_SortFrags (); @@ -624,9 +624,9 @@ void Sbar_DrawFrags (void) continue; // draw background - c = (byte *)&d_8to24table[(s->colors & 0xf0) + 8]; + c = (qbyte *)&d_8to24table[(s->colors & 0xf0) + 8]; DrawQ_Fill (sbar_x + x + 10, sbar_y - 23, 28, 4, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0); - c = (byte *)&d_8to24table[((s->colors & 15)<<4) + 8]; + c = (qbyte *)&d_8to24table[((s->colors & 15)<<4) + 8]; DrawQ_Fill (sbar_x + x + 10, sbar_y + 4 - 23, 28, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0); // draw number @@ -664,14 +664,14 @@ void Sbar_DrawFace (void) { char num[12]; scoreboard_t *s; - byte *c; + qbyte *c; s = &cl.scores[cl.viewentity - 1]; // draw background Sbar_DrawPic (112, 0, rsb_teambord); - c = (byte *)&d_8to24table[(s->colors & 0xf0) + 8]; + c = (qbyte *)&d_8to24table[(s->colors & 0xf0) + 8]; DrawQ_Fill (sbar_x + 113, vid.conheight-SBAR_HEIGHT+3, 22, 9, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0); - c = (byte *)&d_8to24table[((s->colors & 15)<<4) + 8]; + c = (qbyte *)&d_8to24table[((s->colors & 15)<<4) + 8]; DrawQ_Fill (sbar_x + 113, vid.conheight-SBAR_HEIGHT+12, 22, 9, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0); // draw number @@ -892,7 +892,7 @@ void Sbar_DeathmatchOverlay (void) int i, k, l, x, y, total, n, minutes, tens, units, fph; char num[128]; scoreboard_t *s; - byte *c; + qbyte *c; pic = Draw_CachePic ("gfx/ranking.lmp"); DrawQ_Pic ((vid.conwidth - pic->width)/2, 8, "gfx/ranking.lmp", 0, 0, 1, 1, 1, 1, 0); @@ -913,9 +913,9 @@ void Sbar_DeathmatchOverlay (void) continue; // draw background - c = (byte *)&d_8to24table[(s->colors & 0xf0) + 8]; + c = (qbyte *)&d_8to24table[(s->colors & 0xf0) + 8]; DrawQ_Fill ( x, y+1, 88, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0); - c = (byte *)&d_8to24table[((s->colors & 15)<<4) + 8]; + c = (qbyte *)&d_8to24table[((s->colors & 15)<<4) + 8]; DrawQ_Fill ( x, y+4, 88, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0); total = cl.time - s->entertime; @@ -947,7 +947,7 @@ void Sbar_MiniDeathmatchOverlay (void) int i, l, k, x, y, fph, numlines; char num[128]; scoreboard_t *s; - byte *c; + qbyte *c; if (vid.conwidth < 512 || !sb_lines) return; @@ -986,9 +986,9 @@ void Sbar_MiniDeathmatchOverlay (void) continue; // draw background - c = (byte *)&d_8to24table[(s->colors & 0xf0) + 8]; + c = (qbyte *)&d_8to24table[(s->colors & 0xf0) + 8]; DrawQ_Fill ( x, y+1, 72, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0); - c = (byte *)&d_8to24table[((s->colors & 15)<<4) + 8]; + c = (qbyte *)&d_8to24table[((s->colors & 15)<<4) + 8]; DrawQ_Fill ( x, y+4, 72, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0); fph = (cl.time - s->entertime) ? (int) ((float) s->frags * 3600.0 / (cl.time - s->entertime)) : 0; diff --git a/server.h b/server.h index 175cd41f..68d6ca17 100644 --- a/server.h +++ b/server.h @@ -61,13 +61,13 @@ typedef struct server_state_t state; // some actions are only valid during load sizebuf_t datagram; - byte datagram_buf[MAX_DATAGRAM]; + qbyte datagram_buf[MAX_DATAGRAM]; sizebuf_t reliable_datagram; // copied to all clients at end of frame - byte reliable_datagram_buf[MAX_DATAGRAM]; + qbyte reliable_datagram_buf[MAX_DATAGRAM]; sizebuf_t signon; - byte signon_buf[32768]; // LordHavoc: increased signon message buffer from 8192 to 32768 + qbyte signon_buf[32768]; // LordHavoc: increased signon message buffer from 8192 to 32768 } server_t; @@ -95,7 +95,7 @@ typedef struct client_s sizebuf_t message; // can be added to at any time, // copied and clear once per frame - byte msgbuf[MAX_MSGLEN]; + qbyte msgbuf[MAX_MSGLEN]; edict_t *edict; // EDICT_NUM(clientnum+1) char name[32]; // for printing to other people int colors; diff --git a/snd_mem.c b/snd_mem.c index af98487d..8183e42e 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -21,14 +21,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -byte *S_Alloc (int size); +qbyte *S_Alloc (int size); /* ================ ResampleSfx ================ */ -void ResampleSfx (sfx_t *sfx, int inrate, byte *data, char *name) +void ResampleSfx (sfx_t *sfx, int inrate, qbyte *data, char *name) { int outcount; int srcsample, srclength; @@ -251,7 +251,7 @@ S_LoadSound sfxcache_t *S_LoadSound (sfx_t *s) { char namebuffer[256]; - byte *data; + qbyte *data; wavinfo_t info; int len; float stepscale; @@ -330,10 +330,10 @@ WAV loading */ -byte *data_p; -byte *iff_end; -byte *last_chunk; -byte *iff_data; +qbyte *data_p; +qbyte *iff_end; +qbyte *last_chunk; +qbyte *iff_data; int iff_chunk_len; @@ -413,7 +413,7 @@ void DumpChunks(void) GetWavinfo ============ */ -wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength) +wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength) { wavinfo_t info; int i; diff --git a/sound.h b/sound.h index 89e56a93..8f34de9a 100644 --- a/sound.h +++ b/sound.h @@ -38,7 +38,7 @@ typedef struct int speed; int width; int stereo; - byte data[1]; // variable sized + qbyte data[1]; // variable sized } sfxcache_t; typedef struct sfx_s @@ -169,7 +169,7 @@ extern int snd_blocked; void S_LocalSound (char *s); sfxcache_t *S_LoadSound (sfx_t *s); -wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength); +wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength); void SND_InitScaletable (void); void SNDDMA_Submit(void); diff --git a/sv_light.c b/sv_light.c index 7e4c5e96..c54dd552 100644 --- a/sv_light.c +++ b/sv_light.c @@ -102,7 +102,7 @@ loc0: if (surf->samples) { - byte *lightmap; + qbyte *lightmap; int maps, line3, size3, dsfrac = ds & 15, dtfrac = dt & 15, scale = 0, r00 = 0, g00 = 0, b00 = 0, r01 = 0, g01 = 0, b01 = 0, r10 = 0, g10 = 0, b10 = 0, r11 = 0, g11 = 0, b11 = 0; line3 = ((surf->extents[0]>>4)+1)*3; size3 = ((surf->extents[0]>>4)+1) * ((surf->extents[1]>>4)+1)*3; // LordHavoc: *3 for colored lighting diff --git a/sv_main.c b/sv_main.c index ba3d483b..a335a7f9 100644 --- a/sv_main.c +++ b/sv_main.c @@ -409,12 +409,12 @@ crosses a waterline. */ int fatbytes; -byte fatpvs[MAX_MAP_LEAFS/8]; +qbyte fatpvs[MAX_MAP_LEAFS/8]; void SV_AddToFatPVS (vec3_t org, mnode_t *node) { int i; - byte *pvs; + qbyte *pvs; mplane_t *plane; float d; @@ -454,7 +454,7 @@ Calculates a PVS that is the inclusive or of all leafs within 8 pixels of the given point. ============= */ -byte *SV_FatPVS (vec3_t org) +qbyte *SV_FatPVS (vec3_t org) { fatbytes = (sv.worldmodel->numleafs+31)>>3; memset (fatpvs, 0, fatbytes); @@ -465,7 +465,7 @@ byte *SV_FatPVS (vec3_t org) //============================================================================= -int SV_BoxTouchingPVS (byte *pvs, vec3_t mins, vec3_t maxs, mnode_t *node) +int SV_BoxTouchingPVS (qbyte *pvs, vec3_t mins, vec3_t maxs, mnode_t *node) { int leafnum; loc0: @@ -510,7 +510,7 @@ void SV_WriteEntitiesToClient (client_t *client, edict_t *clent, sizebuf_t *msg) { int e, clentnum, bits, alpha, glowcolor, glowsize, scale, effects; int culled_pvs, culled_portal, culled_trace, visibleentities, totalentities; - byte *pvs; + qbyte *pvs; vec3_t org, origin, angles, entmins, entmaxs; float nextfullupdate; edict_t *ent; @@ -787,8 +787,8 @@ void SV_WriteEntitiesToClient (client_t *client, edict_t *clent, sizebuf_t *msg) if (((int)(angles[0]*(256.0/360.0)) & 255) != ((int)(baseline->angles[0]*(256.0/360.0)) & 255)) bits |= U_ANGLE1; if (((int)(angles[1]*(256.0/360.0)) & 255) != ((int)(baseline->angles[1]*(256.0/360.0)) & 255)) bits |= U_ANGLE2; if (((int)(angles[2]*(256.0/360.0)) & 255) != ((int)(baseline->angles[2]*(256.0/360.0)) & 255)) bits |= U_ANGLE3; - if (baseline->colormap != (byte) ent->v.colormap) bits |= U_COLORMAP; - if (baseline->skin != (byte) ent->v.skin) bits |= U_SKIN; + if (baseline->colormap != (qbyte) ent->v.colormap) bits |= U_COLORMAP; + if (baseline->skin != (qbyte) ent->v.skin) bits |= U_SKIN; if ((baseline->frame & 0x00FF) != ((int) ent->v.frame & 0x00FF)) bits |= U_FRAME; if ((baseline->effects & 0x00FF) != ((int) ent->v.effects & 0x00FF)) bits |= U_EFFECTS; if ((baseline->modelindex & 0x00FF) != ((int) ent->v.modelindex & 0x00FF)) bits |= U_MODEL; @@ -868,7 +868,7 @@ void SV_WriteEntitiesToClient (client_t *client, edict_t *clent, sizebuf_t *msg) { int e, clentnum, flags, alpha, glowcolor, glowsize, scale, effects; int culled_pvs, culled_portal, culled_trace, visibleentities, totalentities; - byte *pvs; + qbyte *pvs; vec3_t org, origin, angles, entmins, entmaxs; edict_t *ent; eval_t *val; @@ -1147,7 +1147,7 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) int items; eval_t *val; vec3_t punchvector; - byte viewzoom; + qbyte viewzoom; // // send a damage message @@ -1317,7 +1317,7 @@ SV_SendClientDatagram */ qboolean SV_SendClientDatagram (client_t *client) { - byte buf[MAX_DATAGRAM]; + qbyte buf[MAX_DATAGRAM]; sizebuf_t msg; msg.data = buf; @@ -1399,7 +1399,7 @@ message buffer void SV_SendNop (client_t *client) { sizebuf_t msg; - byte buf[4]; + qbyte buf[4]; msg.data = buf; msg.maxsize = sizeof(buf); diff --git a/sys_win.c b/sys_win.c index bbf95e6b..10226f3a 100644 --- a/sys_win.c +++ b/sys_win.c @@ -39,7 +39,7 @@ qboolean ActiveApp, Minimized; static qboolean sc_return_on_enter = false; HANDLE hinput, houtput; -static char *tracking_tag = "Clams & Mooses"; +//static char *tracking_tag = "Clams & Mooses"; static HANDLE tevent; static HANDLE hFile; @@ -71,10 +71,10 @@ int findhandle (void) /* ================ -filelength +Sys_FileLength ================ */ -int filelength (QFile *f) +int Sys_FileLength (QFile *f) { int pos; int end; @@ -105,7 +105,7 @@ int Sys_FileOpenRead (char *path, int *hndl) { sys_handles[i] = f; *hndl = i; - retval = filelength(f); + retval = Sys_FileLength(f); } return retval; @@ -368,11 +368,11 @@ double Sys_DoubleTime (void) char *Sys_ConsoleInput (void) { - static char text[256]; - static int len; - INPUT_RECORD recs[1024]; - int dummy; - int ch, numread, numevents; + static char text[256]; + static int len; + INPUT_RECORD recs[1024]; + int ch; + DWORD numread, numevents, dummy; if (cls.state != ca_dedicated) return NULL; diff --git a/ui.c b/ui.c index e00fd7d6..6a41d9b8 100644 --- a/ui.c +++ b/ui.c @@ -233,7 +233,7 @@ int ui_isactive(void) } #define UI_QUEUE_SIZE 256 -static byte ui_keyqueue[UI_QUEUE_SIZE]; +static qbyte ui_keyqueue[UI_QUEUE_SIZE]; static int ui_keyqueuepos = 0; void ui_leftkeyupdate(int pressed) diff --git a/vid_3dfxsvga.c b/vid_3dfxsvga.c index 88a617f5..813a9d55 100644 --- a/vid_3dfxsvga.c +++ b/vid_3dfxsvga.c @@ -65,7 +65,7 @@ const char *gl_version; const char *gl_extensions; /*-----------------------------------------------------------------------*/ -void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height) +void D_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height) { } diff --git a/vid_shared.c b/vid_shared.c index e7ce03c5..79451a54 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -64,7 +64,9 @@ static gl_extensionfunctionlist_t compiledvertexarrayfuncs[] = #include #endif +#ifndef WIN32 static void *prjobj = NULL; +#endif static void gl_getfuncs_begin(void) { diff --git a/vid_wgl.c b/vid_wgl.c index 9ce018a8..e6f3133f 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -66,7 +66,7 @@ qboolean scr_skipupdate; static vmode_t modelist[MAX_MODE_LIST]; static int nummodes; -static vmode_t *pcurrentmode; +//static vmode_t *pcurrentmode; static vmode_t badmode; static DEVMODE gdevmode; @@ -252,7 +252,7 @@ qboolean VID_SetFullDIBMode (int modenum) int VID_SetMode (int modenum) { int original_mode, temp; - qboolean stat; + qboolean stat = 0; MSG msg; if ((windowed && (modenum != 0)) || (!windowed && (modenum < 1)) || (!windowed && (modenum >= nummodes))) @@ -503,7 +503,7 @@ BOOL bSetupPixelFormat(HDC hDC) -byte scantokey[128] = +qbyte scantokey[128] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 ,27 ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' ,'0' ,'-' ,'=' ,K_BACKSPACE,9 , // 0 @@ -517,7 +517,7 @@ byte scantokey[128] = }; /* -byte shiftscantokey[128] = +qbyte shiftscantokey[128] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 ,27 ,'!' ,'@' ,'#' ,'$' ,'%' ,'^' ,'&' ,'*' ,'(' ,')' ,'_' ,'+' ,K_BACKSPACE,9 , // 0 @@ -1178,7 +1178,7 @@ void VID_InitFullDIB (HINSTANCE hInstance) Con_SafePrintf ("No fullscreen DIB modes found\n"); } -static int grabsysgamma = true; +//static int grabsysgamma = true; WORD systemgammaramps[3][256], currentgammaramps[3][256]; int VID_SetGamma(float prescale, float gamma, float scale, float base) @@ -1231,7 +1231,7 @@ void VID_Init (void) { int i; // int existingmode; - int basenummodes, width, height, bpp, findbpp, done; + int basenummodes, width, height = 0, bpp, findbpp, done; HDC hdc; DEVMODE devmode; @@ -1457,7 +1457,7 @@ extern void M_PrintWhite (int cx, int cy, char *str); extern void M_DrawCharacter (int cx, int line, int num); extern void M_DrawPic (int x, int y, char *picname); -static int vid_line, vid_wmodes; +static int vid_wmodes; typedef struct { diff --git a/wad.c b/wad.c index 5eba9d35..4414197f 100644 --- a/wad.c +++ b/wad.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static int wad_numlumps; static lumpinfo_t *wad_lumps; -static byte *wad_base = NULL; +static qbyte *wad_base = NULL; static mempool_t *wad_mempool = NULL; void SwapPic (qpic_t *pic); @@ -212,7 +212,7 @@ void W_LoadTextureWadFile (char *filename, int complain) } /* -byte hlpalette[768] = +qbyte hlpalette[768] = { 0x00,0x00,0x00,0x0F,0x0F,0x0F,0x1F,0x1F,0x1F,0x2F,0x2F,0x2F,0x3F,0x3F,0x3F,0x4B, 0x4B,0x4B,0x5B,0x5B,0x5B,0x6B,0x6B,0x6B,0x7B,0x7B,0x7B,0x8B,0x8B,0x8B,0x9B,0x9B, @@ -265,12 +265,12 @@ byte hlpalette[768] = }; */ -byte *W_ConvertWAD3Texture(miptex_t *tex) +qbyte *W_ConvertWAD3Texture(miptex_t *tex) { - byte *in, *data, *out, *pal; + qbyte *in, *data, *out, *pal; // int palsize; int d, p; - in = (byte *)((int) tex + tex->offsets[0]); + in = (qbyte *)((int) tex + tex->offsets[0]); data = out = Mem_Alloc(tempmempool, tex->width * tex->height * 4); if (!data) return NULL; @@ -299,16 +299,16 @@ byte *W_ConvertWAD3Texture(miptex_t *tex) return data; } -byte *W_GetTexture(char *name) +qbyte *W_GetTexture(char *name) { // int i, c, datasize; // short colorcount; -// byte pal[256][3], *indata, *outdata, *data; +// qbyte pal[256][3], *indata, *outdata, *data; char texname[17]; int i, j; QFile *file; miptex_t *tex; - byte *data; + qbyte *data; texname[16] = 0; W_CleanupName (name, texname); for (i = 0;i < TEXWAD_MAXIMAGES;i++) diff --git a/wad.h b/wad.h index 6a20203e..ac8199bf 100644 --- a/wad.h +++ b/wad.h @@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct { int width, height; - byte data[4]; // variably sized + qbyte data[4]; // variably sized } qpic_t; @@ -64,7 +64,7 @@ typedef struct extern int wad_numlumps; extern lumpinfo_t *wad_lumps; -extern byte *wad_base; +extern qbyte *wad_base; void W_LoadWadFile (char *filename); void *W_GetLumpName (char *name); @@ -74,5 +74,5 @@ void SwapPic (qpic_t *pic); // LordHavoc: added alternate texture WAD2/WAD3 system for easier loading of HalfLife texture wads extern int image_width, image_height; void W_LoadTextureWadFile (char *filename, int complain); -byte *W_GetTexture (char *name); // returns tempmempool allocated image data, width and height are in image_width and image_height -byte *W_ConvertWAD3Texture(miptex_t *tex); // returns tempmempool allocated image data, width and height are in image_width and image_height +qbyte *W_GetTexture (char *name); // returns tempmempool allocated image data, width and height are in image_width and image_height +qbyte *W_ConvertWAD3Texture(miptex_t *tex); // returns tempmempool allocated image data, width and height are in image_width and image_height diff --git a/winquake.h b/winquake.h index 850958b2..6849014e 100644 --- a/winquake.h +++ b/winquake.h @@ -22,13 +22,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma warning( disable : 4229 ) // mgraph gets this #include -#define WM_MOUSEWHEEL 0x020A #ifndef SERVERONLY #include #include #endif +#ifndef WM_MOUSEWHEEL +#define WM_MOUSEWHEEL 0x020A +#endif + extern HINSTANCE global_hInstance; extern int global_nCmdShow; diff --git a/world.c b/world.c index 54f59ecc..764023a2 100644 --- a/world.c +++ b/world.c @@ -45,9 +45,9 @@ void InsertLinkAfter (link_t *l, link_t *after); // (type *)STRUCT_FROM_LINK(link_t *link, type, member) // ent = STRUCT_FROM_LINK(link,entity_t,order) // FIXME: remove this mess! -//#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m))) +//#define STRUCT_FROM_LINK(l,t,m) ((t *)((qbyte *)l - (int)&(((t *)0)->m))) -#define EDICT_FROM_AREA(l) ((edict_t *)((byte *)l - (int)&(((edict_t *)0)->area))) +#define EDICT_FROM_AREA(l) ((edict_t *)((qbyte *)l - (int)&(((edict_t *)0)->area))) //============================================================================ diff --git a/zone.h b/zone.h index 79b81e5f..0b77463a 100644 --- a/zone.h +++ b/zone.h @@ -53,7 +53,7 @@ memheader_t; typedef struct memclump_s { // contents of the clump - byte block[MEMCLUMPSIZE]; + qbyte block[MEMCLUMPSIZE]; // should always be MEMCLUMP_SENTINEL int sentinel1; // if a bit is on, it means that the MEMUNIT bytes it represents are -- 2.39.2