From: havoc Date: Sat, 5 Nov 2005 07:48:17 +0000 (+0000) Subject: eliminated qbyte type, now uses unsigned char throughout the engine for this purpose X-Git-Tag: xonotic-v0.1.0preview~4495 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=6824d8ddc8a43cae0609be5bbe8bee01fa1a4225;ds=sidebyside eliminated qbyte type, now uses unsigned char throughout the engine for this purpose git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5789 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/bspfile.h b/bspfile.h index 0755c030..35137c31 100644 --- a/bspfile.h +++ b/bspfile.h @@ -262,7 +262,7 @@ typedef struct dface_s short texinfo; // lighting info - qbyte styles[MAXLIGHTMAPS]; + unsigned char styles[MAXLIGHTMAPS]; int lightofs; // start of [numstyles*surfsize] samples } dface_t; @@ -288,6 +288,6 @@ typedef struct dleaf_s unsigned short firstmarksurface; unsigned short nummarksurfaces; - qbyte ambient_level[NUM_AMBIENTS]; + unsigned char ambient_level[NUM_AMBIENTS]; } dleaf_t; diff --git a/cd_bsd.c b/cd_bsd.c index 83ae1a74..a514fc0b 100644 --- a/cd_bsd.c +++ b/cd_bsd.c @@ -121,7 +121,7 @@ void CDAudio_SysSetVolume (float volume) } -int CDAudio_SysPlay (qbyte track) +int CDAudio_SysPlay (unsigned char track) { struct ioc_read_toc_entry rte; struct cd_toc_entry entry; diff --git a/cd_linux.c b/cd_linux.c index 6a64e4b5..b0e4fb00 100644 --- a/cd_linux.c +++ b/cd_linux.c @@ -113,7 +113,7 @@ void CDAudio_SysSetVolume (float volume) } -int CDAudio_SysPlay (qbyte track) +int CDAudio_SysPlay (unsigned char track) { struct cdrom_tocentry entry; struct cdrom_ti ti; diff --git a/cd_null.c b/cd_null.c index 300334a2..d639614f 100644 --- a/cd_null.c +++ b/cd_null.c @@ -48,7 +48,7 @@ void CDAudio_SysSetVolume (float volume) } -int CDAudio_SysPlay (qbyte track) +int CDAudio_SysPlay (unsigned char track) { return -1; } diff --git a/cd_sdl.c b/cd_sdl.c index 9e6cb034..1f98c49d 100644 --- a/cd_sdl.c +++ b/cd_sdl.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "cdaudio.h" #include -/*IMPORTANT: +/*IMPORTANT: SDL 1.2.7 and older seems to have a strange bug regarding CDPause and CDResume under WIN32. If CDResume is called, it plays to end of the CD regardless what values for lasttrack and lastframe were passed to CDPlayTracks. @@ -80,7 +80,7 @@ void CDAudio_SysSetVolume (float volume) } -int CDAudio_SysPlay (qbyte track) +int CDAudio_SysPlay (unsigned char track) { SDL_CDStop( cd ); endtime = realtime + (float) cd->track[ track - 1 ].length / CD_FPS; @@ -129,7 +129,7 @@ int CDAudio_SysUpdate (void) void CDAudio_SysInit (void) { - if( SDL_InitSubSystem( SDL_INIT_CDROM ) == -1 ) + if( SDL_InitSubSystem( SDL_INIT_CDROM ) == -1 ) Con_Print( "Failed to init the CDROM SDL subsystem!\n" ); Cmd_AddCommand( "cddrive", CDAudio_SDL_CDDrive_f ); @@ -148,7 +148,7 @@ int CDAudio_SysStartup (void) { int i; int numdrives; - + numdrives = SDL_CDNumDrives(); if( numdrives == -1 ) // was the CDROM system initialized correctly? return -1; @@ -210,8 +210,8 @@ void CDAudio_SDL_CDDrive_f( void ) if( !cd ) { Con_Printf( "Couldn't open drive %i.\n", i ); return; - } - + } + if( !CD_INDRIVE( SDL_CDStatus( cd ) ) ) Con_Printf( "No cd in drive %i.\n", i ); else if( !IsAudioCD() ) @@ -224,4 +224,4 @@ void CDAudio_SDL_CDDrive_f( void ) - + diff --git a/cd_shared.c b/cd_shared.c index 5d093e73..a4cf1e82 100644 --- a/cd_shared.c +++ b/cd_shared.c @@ -32,7 +32,7 @@ extern void CDAudio_SysCloseDoor (void); extern int CDAudio_SysGetAudioDiskInfo (void); extern float CDAudio_SysGetVolume (void); extern void CDAudio_SysSetVolume (float volume); -extern int CDAudio_SysPlay (qbyte track); +extern int CDAudio_SysPlay (unsigned char track); extern int CDAudio_SysStop (void); extern int CDAudio_SysPause (void); extern int CDAudio_SysResume (void); @@ -48,8 +48,8 @@ static qboolean wasPlaying = false; static qboolean initialized = false; static qboolean enabled = false; static float cdvolume; -static qbyte remap[MAXTRACKS]; -static qbyte maxTrack; +static unsigned char remap[MAXTRACKS]; +static unsigned char maxTrack; static int faketrack = -1; static float saved_vol = 1.0f; @@ -58,7 +58,7 @@ static float saved_vol = 1.0f; qboolean cdValid = false; qboolean cdPlaying = false; qboolean cdPlayLooping = false; -qbyte cdPlayTrack; +unsigned char cdPlayTrack; static void CDAudio_Eject (void) @@ -95,7 +95,7 @@ static int CDAudio_GetAudioDiskInfo (void) } -void CDAudio_Play (qbyte track, qboolean looping) +void CDAudio_Play (unsigned char track, qboolean looping) { sfx_t* sfx; @@ -268,13 +268,13 @@ static void CD_f (void) if (strcasecmp(command, "play") == 0) { - CDAudio_Play((qbyte)atoi(Cmd_Argv (2)), false); + CDAudio_Play((unsigned char)atoi(Cmd_Argv (2)), false); return; } if (strcasecmp(command, "loop") == 0) { - CDAudio_Play((qbyte)atoi(Cmd_Argv (2)), true); + CDAudio_Play((unsigned char)atoi(Cmd_Argv (2)), true); return; } diff --git a/cd_win.c b/cd_win.c index 2eec19ac..41f2a3ca 100644 --- a/cd_win.c +++ b/cd_win.c @@ -98,7 +98,7 @@ void CDAudio_SysSetVolume (float volume) } -int CDAudio_SysPlay (qbyte track) +int CDAudio_SysPlay (unsigned char track) { DWORD dwReturn; MCI_PLAY_PARMS mciPlayParms; @@ -187,7 +187,7 @@ int CDAudio_SysResume (void) Con_Printf("CDAudio_SysResume: MCI_PLAY failed (%i)\n", dwReturn); return -1; } - return 0; + return 0; } LONG CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) diff --git a/cdaudio.h b/cdaudio.h index eefb0c98..02e3fa1b 100644 --- a/cdaudio.h +++ b/cdaudio.h @@ -21,14 +21,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern qboolean cdValid; extern qboolean cdPlaying; extern qboolean cdPlayLooping; -extern qbyte cdPlayTrack; +extern unsigned char cdPlayTrack; extern cvar_t cdaudioinitialized; int CDAudio_Init(void); void CDAudio_Open(void); void CDAudio_Close(void); -void CDAudio_Play(qbyte track, qboolean looping); +void CDAudio_Play(unsigned char track, qboolean looping); void CDAudio_Stop(void); void CDAudio_Pause(void); void CDAudio_Resume(void); diff --git a/cgamevm.c b/cgamevm.c index 666afd84..45b81c4e 100644 --- a/cgamevm.c +++ b/cgamevm.c @@ -12,7 +12,7 @@ static mempool_t *cgvm_mempool; static void (*cgvm_networkcode[256])(unsigned char num); -static qbyte *cgvm_netbuffer; +static unsigned char *cgvm_netbuffer; static int cgvm_netbufferlength; static int cgvm_netbufferpos; @@ -52,7 +52,7 @@ void CL_CGVM_Start(void) CG_Init(); // API call } -void CL_CGVM_ParseNetwork(qbyte *netbuffer, int length) +void CL_CGVM_ParseNetwork(unsigned char *netbuffer, int length) { int num; cgvm_netbuffer = netbuffer; @@ -62,7 +62,7 @@ void CL_CGVM_ParseNetwork(qbyte *netbuffer, int length) { num = CGVM_MSG_ReadByte(); if (cgvm_networkcode[num]) - cgvm_networkcode[num]((qbyte)num); + cgvm_networkcode[num]((unsigned char)num); else Host_Error("CL_CGVM_ParseNetwork: unregistered network code %i", num); } diff --git a/cgamevm.h b/cgamevm.h index f5f0887e..76f0c1a0 100644 --- a/cgamevm.h +++ b/cgamevm.h @@ -7,7 +7,7 @@ void CL_CGVM_Shutdown(void); void CL_CGVM_Clear(void); void CL_CGVM_Frame(void); void CL_CGVM_Start(void); -void CL_CGVM_ParseNetwork(qbyte *netbuffer, int length); +void CL_CGVM_ParseNetwork(unsigned char *netbuffer, int length); #endif diff --git a/cl_input.c b/cl_input.c index 6cd5315b..85bfd8b0 100644 --- a/cl_input.c +++ b/cl_input.c @@ -782,7 +782,7 @@ void CL_SendMove(void) int i; int bits; sizebuf_t buf; - qbyte data[128]; + unsigned char data[128]; #define MOVEAVERAGING 0 #if MOVEAVERAGING static float forwardmove, sidemove, upmove, total; // accumulation diff --git a/cl_main.c b/cl_main.c index 4b0ab04f..241b278c 100644 --- a/cl_main.c +++ b/cl_main.c @@ -87,7 +87,7 @@ int cl_max_brushmodel_entities; int cl_activedlights; entity_t *cl_entities; -qbyte *cl_entities_active; +unsigned char *cl_entities_active; entity_t *cl_static_entities; entity_t *cl_temp_entities; cl_effect_t *cl_effects; @@ -103,7 +103,7 @@ int cl_num_brushmodel_entities; // keep track of quake entities because they need to be killed if they get stale extern int cl_lastquakeentity; -extern qbyte cl_isquakeentity[MAX_EDICTS]; +extern unsigned char cl_isquakeentity[MAX_EDICTS]; /* ===================== @@ -155,7 +155,7 @@ void CL_ClearState(void) cl_activedlights = 0; cl_entities = (entity_t *)Mem_Alloc(cl_mempool, cl_max_entities * sizeof(entity_t)); - cl_entities_active = (qbyte *)Mem_Alloc(cl_mempool, cl_max_brushmodel_entities * sizeof(qbyte)); + cl_entities_active = (unsigned char *)Mem_Alloc(cl_mempool, cl_max_brushmodel_entities * sizeof(unsigned char)); cl_static_entities = (entity_t *)Mem_Alloc(cl_mempool, cl_max_static_entities * sizeof(entity_t)); cl_temp_entities = (entity_t *)Mem_Alloc(cl_mempool, cl_max_temp_entities * sizeof(entity_t)); cl_effects = (cl_effect_t *)Mem_Alloc(cl_mempool, cl_max_effects * sizeof(cl_effect_t)); @@ -655,15 +655,15 @@ void CL_LinkNetworkEntity(entity_t *e) if (e->state_current.flags & RENDER_COLORMAPPED) { int cb; - qbyte *cbcolor; + unsigned char *cbcolor; e->render.colormap = e->state_current.colormap; cb = (e->render.colormap & 0xF) << 4;cb += (cb >= 128 && cb < 224) ? 4 : 12; - cbcolor = (qbyte *) (&palette_complete[cb]); + cbcolor = (unsigned char *) (&palette_complete[cb]); e->render.colormap_pantscolor[0] = cbcolor[0] * (1.0f / 255.0f) * e->render.colormod[0]; e->render.colormap_pantscolor[1] = cbcolor[1] * (1.0f / 255.0f) * e->render.colormod[1]; e->render.colormap_pantscolor[2] = cbcolor[2] * (1.0f / 255.0f) * e->render.colormod[2]; cb = (e->render.colormap & 0xF0);cb += (cb >= 128 && cb < 224) ? 4 : 12; - cbcolor = (qbyte *) (&palette_complete[cb]); + cbcolor = (unsigned char *) (&palette_complete[cb]); e->render.colormap_shirtcolor[0] = cbcolor[0] * (1.0f / 255.0f) * e->render.colormod[0]; e->render.colormap_shirtcolor[1] = cbcolor[1] * (1.0f / 255.0f) * e->render.colormod[1]; e->render.colormap_shirtcolor[2] = cbcolor[2] * (1.0f / 255.0f) * e->render.colormod[2]; @@ -671,15 +671,15 @@ void CL_LinkNetworkEntity(entity_t *e) else if (e->state_current.colormap && cl.scores != NULL) { int cb; - qbyte *cbcolor; + unsigned char *cbcolor; e->render.colormap = cl.scores[e->state_current.colormap - 1].colors; // color it cb = (e->render.colormap & 0xF) << 4;cb += (cb >= 128 && cb < 224) ? 4 : 12; - cbcolor = (qbyte *) (&palette_complete[cb]); + cbcolor = (unsigned char *) (&palette_complete[cb]); e->render.colormap_pantscolor[0] = cbcolor[0] * (1.0f / 255.0f) * e->render.colormod[0]; e->render.colormap_pantscolor[1] = cbcolor[1] * (1.0f / 255.0f) * e->render.colormod[1]; e->render.colormap_pantscolor[2] = cbcolor[2] * (1.0f / 255.0f) * e->render.colormod[2]; cb = (e->render.colormap & 0xF0);cb += (cb >= 128 && cb < 224) ? 4 : 12; - cbcolor = (qbyte *) (&palette_complete[cb]); + cbcolor = (unsigned char *) (&palette_complete[cb]); e->render.colormap_shirtcolor[0] = cbcolor[0] * (1.0f / 255.0f) * e->render.colormod[0]; e->render.colormap_shirtcolor[1] = cbcolor[1] * (1.0f / 255.0f) * e->render.colormod[1]; e->render.colormap_shirtcolor[2] = cbcolor[2] * (1.0f / 255.0f) * e->render.colormod[2]; @@ -993,7 +993,7 @@ void CL_LinkNetworkEntity(entity_t *e) // * 4 for the expansion from 0-255 to 0-1023 range, // / 255 to scale down byte colors dlightradius = max(dlightradius, e->state_current.glowsize * 4); - VectorMA(dlightcolor, (1.0f / 255.0f), (qbyte *)&palette_complete[e->state_current.glowcolor], dlightcolor); + VectorMA(dlightcolor, (1.0f / 255.0f), (unsigned char *)&palette_complete[e->state_current.glowcolor], dlightcolor); } // make the glow dlight if (dlightradius > 0 && (dlightcolor[0] || dlightcolor[1] || dlightcolor[2]) && !(e->render.flags & RENDER_VIEWMODEL)) @@ -1508,7 +1508,7 @@ void CL_Init (void) r_refdef.entities = (entity_render_t **)Mem_Alloc(cl_mempool, sizeof(entity_render_t *) * r_refdef.maxentities); // 256k drawqueue buffer r_refdef.maxdrawqueuesize = 256 * 1024; - r_refdef.drawqueue = (qbyte *)Mem_Alloc(cl_mempool, r_refdef.maxdrawqueuesize); + r_refdef.drawqueue = (unsigned char *)Mem_Alloc(cl_mempool, r_refdef.maxdrawqueuesize); cls.message.data = cls.message_buf; cls.message.maxsize = sizeof(cls.message_buf); diff --git a/cl_parse.c b/cl_parse.c index a5aea072..e2769baa 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -168,7 +168,7 @@ so the server doesn't disconnect. ================== */ -static qbyte olddata[NET_MAXMESSAGE]; +static unsigned char olddata[NET_MAXMESSAGE]; void CL_KeepaliveMessage (void) { float time; @@ -197,7 +197,7 @@ void CL_KeepaliveMessage (void) if (cls.netcon && NetConn_CanSendMessage(cls.netcon) && (time = Sys_DoubleTime()) - lastmsg >= 5) { sizebuf_t msg; - qbyte buf[4]; + unsigned char buf[4]; lastmsg = time; // write out a nop // LordHavoc: must use unreliable because reliable could kill the sigon message! @@ -903,7 +903,7 @@ void CL_ParseTempEntity(void) int rnd; int colorStart, colorLength, count; float velspeed, radius; - qbyte *tempcolor; + unsigned char *tempcolor; matrix4x4_t tempmatrix; type = MSG_ReadByte(); @@ -1252,7 +1252,7 @@ void CL_ParseTempEntity(void) colorStart = MSG_ReadByte(); colorLength = MSG_ReadByte(); CL_ParticleExplosion2(pos, colorStart, colorLength); - tempcolor = (qbyte *)&palette_complete[(rand()%colorLength) + colorStart]; + tempcolor = (unsigned char *)&palette_complete[(rand()%colorLength) + colorStart]; color[0] = tempcolor[0] * (2.0f / 255.0f); color[1] = tempcolor[1] * (2.0f / 255.0f); color[2] = tempcolor[2] * (2.0f / 255.0f); @@ -1304,7 +1304,7 @@ void CL_ParseTempEntity(void) #define SHOWNET(x) if(cl_shownet.integer==2)Con_Printf("%3i:%s\n", msg_readcount-1, x); -static qbyte cgamenetbuffer[65536]; +static unsigned char cgamenetbuffer[65536]; /* ===================== @@ -1317,7 +1317,7 @@ void CL_ParseServerMessage(void) int cmd; int i; protocolversion_t protocol; - qbyte cmdlog[32]; + unsigned char cmdlog[32]; char *cmdlogname[32], *temp; int cmdindex, cmdcount = 0; qboolean sendmove = false; @@ -1651,9 +1651,9 @@ void CL_ParseServerMessage(void) cl.cdtrack = MSG_ReadByte (); cl.looptrack = MSG_ReadByte (); if ( (cls.demoplayback || cls.demorecording) && (cls.forcetrack != -1) ) - CDAudio_Play ((qbyte)cls.forcetrack, true); + CDAudio_Play ((unsigned char)cls.forcetrack, true); else - CDAudio_Play ((qbyte)cl.cdtrack, true); + CDAudio_Play ((unsigned char)cl.cdtrack, true); break; case svc_intermission: diff --git a/cl_particles.c b/cl_particles.c index d43ce7d8..c5030ab5 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. siextern float r_avertexnormals[NUMVERTEXNORMALS][3]; #define m_bytenormals r_avertexnormals #define CL_PointQ1Contents(v) (Mod_PointInLeaf(v,cl.worldmodel)->contents) -typedef unsigned char qbyte; +typedef unsigned char unsigned char; #define cl_stainmaps.integer 0 void R_Stain (vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2) { @@ -70,7 +70,7 @@ void R_CalcBeam_Vertex3f (float *vert, vec3_t org1, vec3_t org2, float width) vert[10] = org2[1] + width * right2[1]; vert[11] = org2[2] + width * right2[2]; } -void fractalnoise(qbyte *noise, int size, int startgrid) +void fractalnoise(unsigned char *noise, int size, int startgrid) { int x, y, g, g2, amplitude, min, max, size1 = size - 1, sizepower, gridpower; int *noisebuf; @@ -134,7 +134,7 @@ void fractalnoise(qbyte *noise, int size, int startgrid) // normalize noise and copy to output for (y = 0;y < size;y++) for (x = 0;x < size;x++) - *noise++ = (qbyte) (((n(x,y) - min) * 256) / max); + *noise++ = (unsigned char) (((n(x,y) - min) * 256) / max); free(noisebuf); #undef n } @@ -243,7 +243,7 @@ typedef struct particle_s float bounce; // how much bounce-back from a surface the particle hits (0 = no physics, 1 = stop and slide, 2 = keep bouncing forever, 1.5 is typical) float gravity; // how much gravity affects this particle (1.0 = normal gravity, 0.0 = none) float friction; // how much air friction affects this object (objects with a low mass/size ratio tend to get more air friction) - qbyte color[4]; + unsigned char color[4]; unsigned short owner; // decal stuck to this entity model_t *ownermodel; // model the decal is stuck to (used to make sure the entity is still alive) vec3_t relativeorigin; // decal at this location in entity's coordinate space @@ -1542,7 +1542,7 @@ static cvar_t r_drawparticles = {0, "r_drawparticles", "1"}; #define PARTICLETEXTURESIZE 64 #define PARTICLEFONTSIZE (PARTICLETEXTURESIZE*8) -static qbyte shadebubble(float dx, float dy, vec3_t light) +static unsigned char shadebubble(float dx, float dy, vec3_t light) { float dz, f, dot; vec3_t normal; @@ -1569,13 +1569,13 @@ static qbyte 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 (qbyte) f; + return (unsigned char) f; } else return 0; } -static void setuptex(int texnum, qbyte *data, qbyte *particletexturedata) +static void setuptex(int texnum, unsigned char *data, unsigned char *particletexturedata) { int basex, basey, y; basex = ((texnum >> 0) & 7) * PARTICLETEXTURESIZE; @@ -1588,11 +1588,11 @@ static void setuptex(int texnum, qbyte *data, qbyte *particletexturedata) memcpy(particletexturedata + ((basey + y) * PARTICLEFONTSIZE + basex) * 4, data + y * PARTICLETEXTURESIZE * 4, PARTICLETEXTURESIZE * 4); } -void particletextureblotch(qbyte *data, float radius, float red, float green, float blue, float alpha) +void particletextureblotch(unsigned char *data, float radius, float red, float green, float blue, float alpha) { int x, y; float cx, cy, dx, dy, f, iradius; - qbyte *d; + unsigned char *d; cx = (lhrandom(radius + 1, PARTICLETEXTURESIZE - 2 - radius) + lhrandom(radius + 1, PARTICLETEXTURESIZE - 2 - radius)) * 0.5f; cy = (lhrandom(radius + 1, PARTICLETEXTURESIZE - 2 - radius) + lhrandom(radius + 1, PARTICLETEXTURESIZE - 2 - radius)) * 0.5f; iradius = 1.0f / radius; @@ -1615,7 +1615,7 @@ void particletextureblotch(qbyte *data, float radius, float red, float green, fl } } -void particletextureclamp(qbyte *data, int minr, int ming, int minb, int maxr, int maxg, int maxb) +void particletextureclamp(unsigned char *data, int minr, int ming, int minb, int maxr, int maxg, int maxb) { int i; for (i = 0;i < PARTICLETEXTURESIZE*PARTICLETEXTURESIZE;i++, data += 4) @@ -1626,7 +1626,7 @@ void particletextureclamp(qbyte *data, int minr, int ming, int minb, int maxr, i } } -void particletextureinvert(qbyte *data) +void particletextureinvert(unsigned char *data) { int i; for (i = 0;i < PARTICLETEXTURESIZE*PARTICLETEXTURESIZE;i++, data += 4) @@ -1638,10 +1638,10 @@ void particletextureinvert(qbyte *data) } // Those loops are in a separate function to work around an optimization bug in Mac OS X's GCC -static void R_InitBloodTextures (qbyte *particletexturedata) +static void R_InitBloodTextures (unsigned char *particletexturedata) { int i, j, k, m; - qbyte data[PARTICLETEXTURESIZE][PARTICLETEXTURESIZE][4]; + unsigned char data[PARTICLETEXTURESIZE][PARTICLETEXTURESIZE][4]; // blood particles for (i = 0;i < 8;i++) @@ -1673,9 +1673,9 @@ static void R_InitParticleTexture (void) { int x, y, d, i, k, m; float dx, dy, radius, f, f2; - qbyte data[PARTICLETEXTURESIZE][PARTICLETEXTURESIZE][4], noise3[64][64], data2[64][16][4]; + unsigned char data[PARTICLETEXTURESIZE][PARTICLETEXTURESIZE][4], noise3[64][64], data2[64][16][4]; vec3_t light; - qbyte *particletexturedata; + unsigned char *particletexturedata; // a note: decals need to modulate (multiply) the background color to // properly darken it (stain), and they need to be able to alpha fade, @@ -1686,7 +1686,7 @@ static void R_InitParticleTexture (void) // and white on black background) so we can alpha fade it to black, then // we invert it again during the blendfunc to make it work... - particletexturedata = (qbyte *)Mem_Alloc(tempmempool, PARTICLEFONTSIZE*PARTICLEFONTSIZE*4); + particletexturedata = (unsigned char *)Mem_Alloc(tempmempool, PARTICLEFONTSIZE*PARTICLEFONTSIZE*4); memset(particletexturedata, 255, PARTICLEFONTSIZE*PARTICLEFONTSIZE*4); // smoke @@ -1695,7 +1695,7 @@ static void R_InitParticleTexture (void) memset(&data[0][0][0], 255, sizeof(data)); do { - qbyte noise1[PARTICLETEXTURESIZE*2][PARTICLETEXTURESIZE*2], noise2[PARTICLETEXTURESIZE*2][PARTICLETEXTURESIZE*2]; + unsigned char noise1[PARTICLETEXTURESIZE*2][PARTICLETEXTURESIZE*2], noise2[PARTICLETEXTURESIZE*2][PARTICLETEXTURESIZE*2]; fractalnoise(&noise1[0][0], PARTICLETEXTURESIZE*2, PARTICLETEXTURESIZE/8); fractalnoise(&noise2[0][0], PARTICLETEXTURESIZE*2, PARTICLETEXTURESIZE/4); @@ -1711,7 +1711,7 @@ static void R_InitParticleTexture (void) d = d * (1-(dx*dx+dy*dy)); d = (d * noise1[y][x]) >> 7; d = bound(0, d, 255); - data[y][x][3] = (qbyte) d; + data[y][x][3] = (unsigned char) d; if (m < d) m = d; } @@ -1750,7 +1750,7 @@ static void R_InitParticleTexture (void) dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1); d = 256 * (1 - (dx*dx+dy*dy)); d = bound(0, d, 255); - data[y][x][3] = (qbyte) d; + data[y][x][3] = (unsigned char) d; } } setuptex(tex_particle, &data[0][0][0], particletexturedata); @@ -1835,7 +1835,7 @@ static void R_InitParticleTexture (void) { dx = (x - 0.5f*16) / (16*0.5f-2); d = (1 - sqrt(fabs(dx))) * noise3[y][x]; - data2[y][x][0] = data2[y][x][1] = data2[y][x][2] = (qbyte) bound(0, d, 255); + data2[y][x][0] = data2[y][x][1] = data2[y][x][2] = (unsigned char) bound(0, d, 255); data2[y][x][3] = 255; } } diff --git a/cl_screen.c b/cl_screen.c index 1d5b410f..9fc16596 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -744,14 +744,14 @@ void DrawQ_Mesh (drawqueuemesh_t *mesh, int flags) dq->scalex = 0; dq->scaley = 0; p = (void *)(dq + 1); - m = (drawqueuemesh_t *)p;p = (qbyte*)p + sizeof(drawqueuemesh_t); + m = (drawqueuemesh_t *)p;p = (unsigned char*)p + sizeof(drawqueuemesh_t); m->num_triangles = mesh->num_triangles; m->num_vertices = mesh->num_vertices; m->texture = mesh->texture; - m->data_element3i = (int *)p;memcpy(m->data_element3i , mesh->data_element3i , m->num_triangles * sizeof(int[3]));p = (qbyte*)p + m->num_triangles * sizeof(int[3]); - m->data_vertex3f = (float *)p;memcpy(m->data_vertex3f , mesh->data_vertex3f , m->num_vertices * sizeof(float[3]));p = (qbyte*)p + m->num_vertices * sizeof(float[3]); - m->data_texcoord2f = (float *)p;memcpy(m->data_texcoord2f, mesh->data_texcoord2f, m->num_vertices * sizeof(float[2]));p = (qbyte*)p + m->num_vertices * sizeof(float[2]); - m->data_color4f = (float *)p;memcpy(m->data_color4f , mesh->data_color4f , m->num_vertices * sizeof(float[4]));p = (qbyte*)p + m->num_vertices * sizeof(float[4]); + m->data_element3i = (int *)p;memcpy(m->data_element3i , mesh->data_element3i , m->num_triangles * sizeof(int[3]));p = (unsigned char*)p + m->num_triangles * sizeof(int[3]); + m->data_vertex3f = (float *)p;memcpy(m->data_vertex3f , mesh->data_vertex3f , m->num_vertices * sizeof(float[3]));p = (unsigned char*)p + m->num_vertices * sizeof(float[3]); + m->data_texcoord2f = (float *)p;memcpy(m->data_texcoord2f, mesh->data_texcoord2f, m->num_vertices * sizeof(float[2]));p = (unsigned char*)p + m->num_vertices * sizeof(float[2]); + m->data_color4f = (float *)p;memcpy(m->data_color4f , mesh->data_color4f , m->num_vertices * sizeof(float[4]));p = (unsigned char*)p + m->num_vertices * sizeof(float[4]); r_refdef.drawqueuesize += dq->size; } @@ -808,9 +808,9 @@ void SCR_ScreenShot_f (void) static char oldname[MAX_QPATH]; char base[MAX_QPATH]; char filename[MAX_QPATH]; - qbyte *buffer1; - qbyte *buffer2; - qbyte *buffer3; + unsigned char *buffer1; + unsigned char *buffer2; + unsigned char *buffer3; qboolean jpeg = (scr_screenshot_jpeg.integer != 0); sprintf (base, "screenshots/%s", scr_screenshot_name.string); @@ -833,9 +833,9 @@ void SCR_ScreenShot_f (void) sprintf(filename, "%s%06d.%s", base, shotnumber, jpeg ? "jpg" : "tga"); - buffer1 = (qbyte *)Mem_Alloc(tempmempool, vid.width * vid.height * 3); - buffer2 = (qbyte *)Mem_Alloc(tempmempool, vid.width * vid.height * 3); - buffer3 = (qbyte *)Mem_Alloc(tempmempool, vid.width * vid.height * 3 + 18); + buffer1 = (unsigned char *)Mem_Alloc(tempmempool, vid.width * vid.height * 3); + buffer2 = (unsigned char *)Mem_Alloc(tempmempool, vid.width * vid.height * 3); + buffer3 = (unsigned char *)Mem_Alloc(tempmempool, vid.width * vid.height * 3 + 18); if (SCR_ScreenShot (filename, buffer1, buffer2, buffer3, 0, 0, vid.width, vid.height, false, false, false, jpeg, true)) Con_Printf("Wrote %s\n", filename); @@ -864,7 +864,7 @@ static double cl_capturevideo_starttime = 0; double cl_capturevideo_framerate = 0; static int cl_capturevideo_soundrate = 0; static int cl_capturevideo_frame = 0; -static qbyte *cl_capturevideo_buffer = NULL; +static unsigned char *cl_capturevideo_buffer = NULL; static qfile_t *cl_capturevideo_videofile = NULL; qfile_t *cl_capturevideo_soundfile = NULL; static short cl_capturevideo_rgbtoyuvscaletable[3][3][256]; @@ -875,7 +875,7 @@ void SCR_CaptureVideo_BeginVideo(void) { double gamma, g; unsigned int i; - qbyte out[44]; + unsigned char out[44]; if (cl_capturevideo_active) return; // soundrate is figured out on the first SoundFrame @@ -884,7 +884,7 @@ void SCR_CaptureVideo_BeginVideo(void) cl_capturevideo_framerate = bound(1, cl_capturevideo_fps.value, 1000); cl_capturevideo_soundrate = 0; cl_capturevideo_frame = 0; - cl_capturevideo_buffer = (qbyte *)Mem_Alloc(tempmempool, vid.width * vid.height * (3+3+3) + 18); + cl_capturevideo_buffer = (unsigned char *)Mem_Alloc(tempmempool, vid.width * vid.height * (3+3+3) + 18); gamma = 1.0/scr_screenshot_gamma.value; /* @@ -960,7 +960,7 @@ Cr = R * .500 + G * -.419 + B * -.0813 + 128.; void SCR_CaptureVideo_EndVideo(void) { int i, n; - qbyte out[44]; + unsigned char out[44]; if (!cl_capturevideo_active) return; cl_capturevideo_active = false; @@ -1113,7 +1113,7 @@ qboolean SCR_CaptureVideo_VideoFrame(int newframenum) } } -void SCR_CaptureVideo_SoundFrame(qbyte *bufstereo16le, size_t length, int rate) +void SCR_CaptureVideo_SoundFrame(unsigned char *bufstereo16le, size_t length, int rate) { if (!cl_capturevideo_soundfile) return; @@ -1199,9 +1199,9 @@ static void R_Envmap_f (void) { int j, size; char filename[256], basename[256]; - qbyte *buffer1; - qbyte *buffer2; - qbyte *buffer3; + unsigned char *buffer1; + unsigned char *buffer2; + unsigned char *buffer3; if (Cmd_Argc() != 3) { @@ -1232,9 +1232,9 @@ static void R_Envmap_f (void) r_refdef.fov_x = 90; r_refdef.fov_y = 90; - buffer1 = (qbyte *)Mem_Alloc(tempmempool, size * size * 3); - buffer2 = (qbyte *)Mem_Alloc(tempmempool, size * size * 3); - buffer3 = (qbyte *)Mem_Alloc(tempmempool, size * size * 3 + 18); + buffer1 = (unsigned char *)Mem_Alloc(tempmempool, size * size * 3); + buffer2 = (unsigned char *)Mem_Alloc(tempmempool, size * size * 3); + buffer3 = (unsigned char *)Mem_Alloc(tempmempool, size * size * 3 + 18); for (j = 0;j < 12;j++) { diff --git a/cl_screen.h b/cl_screen.h index 79fb54f1..49175273 100644 --- a/cl_screen.h +++ b/cl_screen.h @@ -11,7 +11,7 @@ typedef struct drawqueue_s { unsigned short size; - qbyte command, flags; + unsigned char command, flags; unsigned int color; float x, y, scalex, scaley; } diff --git a/cl_video.c b/cl_video.c index c3a7fc98..1055cf00 100644 --- a/cl_video.c +++ b/cl_video.c @@ -195,7 +195,7 @@ static void VideoFrame( clvideo_t *video ) return; } } while( video->framenum < destframe ); - R_UpdateTexture( video->cpif.tex, (qbyte *)video->imagedata ); + R_UpdateTexture( video->cpif.tex, (unsigned char *)video->imagedata ); } } diff --git a/client.h b/client.h index 28a0c65c..995db0a4 100644 --- a/client.h +++ b/client.h @@ -138,7 +138,7 @@ typedef struct rtlight_s int static_numleafs; int static_numleafpvsbytes; int *static_leaflist; - qbyte *static_leafpvs; + unsigned char *static_leafpvs; // surfaces seen by light int static_numsurfaces; int *static_surfacelist; @@ -452,7 +452,7 @@ typedef struct client_static_s netconn_t *netcon; // writing buffer to send to server sizebuf_t message; - qbyte message_buf[1024]; + unsigned char message_buf[1024]; } client_static_t; @@ -697,7 +697,7 @@ extern int cl_num_brushmodel_entities; extern mempool_t *cl_mempool; extern entity_t *cl_entities; -extern qbyte *cl_entities_active; +extern unsigned char *cl_entities_active; extern entity_t *cl_static_entities; extern entity_t *cl_temp_entities; extern int *cl_brushmodel_entities; @@ -910,7 +910,7 @@ typedef struct refdef_s // 2D art drawing queue // TODO: get rid of this - qbyte *drawqueue; + unsigned char *drawqueue; int drawqueuesize; int maxdrawqueuesize; } diff --git a/cmd.c b/cmd.c index 2939779e..12fe19fd 100644 --- a/cmd.c +++ b/cmd.c @@ -66,7 +66,7 @@ static void Cmd_Wait_f (void) // LordHavoc: inreased this from 8192 to 32768 static sizebuf_t cmd_text; -static qbyte cmd_text_buf[32768]; +static unsigned char cmd_text_buf[32768]; /* ============ @@ -87,7 +87,7 @@ void Cbuf_AddText (const char *text) return; } - SZ_Write (&cmd_text, (const qbyte *)text, (int)strlen (text)); + SZ_Write (&cmd_text, (const unsigned char *)text, (int)strlen (text)); } @@ -122,7 +122,7 @@ void Cbuf_InsertText (const char *text) // add the copied off data if (temp != NULL) { - SZ_Write (&cmd_text, (const qbyte *)temp, templen); + SZ_Write (&cmd_text, (const unsigned char *)temp, templen); Mem_Free (temp); } } @@ -977,7 +977,7 @@ void Cmd_ForwardStringToServer (const char *s) // attention, it has been eradicated from here, its only (former) use in // all of darkplaces. MSG_WriteByte(&cls.message, clc_stringcmd); - SZ_Write(&cls.message, (const qbyte *)s, (int)strlen(s) + 1); + SZ_Write(&cls.message, (const unsigned char *)s, (int)strlen(s) + 1); } /* diff --git a/common.c b/common.c index c34ca93a..391d840f 100644 --- a/common.c +++ b/common.c @@ -59,7 +59,7 @@ char com_modname[MAX_OSPATH] = ""; short ShortSwap (short l) { - qbyte b1,b2; + unsigned char b1,b2; b1 = l&255; b2 = (l>>8)&255; @@ -69,7 +69,7 @@ short ShortSwap (short l) int LongSwap (int l) { - qbyte b1,b2,b3,b4; + unsigned char b1,b2,b3,b4; b1 = l&255; b2 = (l>>8)&255; @@ -84,7 +84,7 @@ float FloatSwap (float f) union { float f; - qbyte b[4]; + unsigned char b[4]; } dat1, dat2; @@ -99,22 +99,22 @@ float FloatSwap (float f) // Extract integers from buffers -unsigned int BuffBigLong (const qbyte *buffer) +unsigned int BuffBigLong (const unsigned char *buffer) { return (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]; } -unsigned short BuffBigShort (const qbyte *buffer) +unsigned short BuffBigShort (const unsigned char *buffer) { return (buffer[0] << 8) | buffer[1]; } -unsigned int BuffLittleLong (const qbyte *buffer) +unsigned int BuffLittleLong (const unsigned char *buffer) { return (buffer[3] << 24) | (buffer[2] << 16) | (buffer[1] << 8) | buffer[0]; } -unsigned short BuffLittleShort (const qbyte *buffer) +unsigned short BuffLittleShort (const unsigned char *buffer) { return (buffer[1] << 8) | buffer[0]; } @@ -171,7 +171,7 @@ static unsigned short crctable[256] = 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0 }; -unsigned short CRC_Block(const qbyte *data, size_t size) +unsigned short CRC_Block(const unsigned char *data, size_t size) { unsigned short crc = CRC_INIT_VALUE; while (size--) @@ -195,7 +195,7 @@ Handles byte ordering and avoids alignment errors void MSG_WriteChar (sizebuf_t *sb, int c) { - qbyte *buf; + unsigned char *buf; buf = SZ_GetSpace (sb, 1); buf[0] = c; @@ -203,7 +203,7 @@ void MSG_WriteChar (sizebuf_t *sb, int c) void MSG_WriteByte (sizebuf_t *sb, int c) { - qbyte *buf; + unsigned char *buf; buf = SZ_GetSpace (sb, 1); buf[0] = c; @@ -211,7 +211,7 @@ void MSG_WriteByte (sizebuf_t *sb, int c) void MSG_WriteShort (sizebuf_t *sb, int c) { - qbyte *buf; + unsigned char *buf; buf = SZ_GetSpace (sb, 2); buf[0] = c&0xff; @@ -220,7 +220,7 @@ void MSG_WriteShort (sizebuf_t *sb, int c) void MSG_WriteLong (sizebuf_t *sb, int c) { - qbyte *buf; + unsigned char *buf; buf = SZ_GetSpace (sb, 4); buf[0] = c&0xff; @@ -241,21 +241,21 @@ void MSG_WriteFloat (sizebuf_t *sb, float f) dat.f = f; dat.l = LittleLong (dat.l); - SZ_Write (sb, (qbyte *)&dat.l, 4); + SZ_Write (sb, (unsigned char *)&dat.l, 4); } void MSG_WriteString (sizebuf_t *sb, const char *s) { if (!s) - SZ_Write (sb, (qbyte *)"", 1); + SZ_Write (sb, (unsigned char *)"", 1); else - SZ_Write (sb, (qbyte *)s, (int)strlen(s)+1); + SZ_Write (sb, (unsigned char *)s, (int)strlen(s)+1); } void MSG_WriteUnterminatedString (sizebuf_t *sb, const char *s) { if (s) - SZ_Write (sb, (qbyte *)s, (int)strlen(s)); + SZ_Write (sb, (unsigned char *)s, (int)strlen(s)); } void MSG_WriteCoord13i (sizebuf_t *sb, float f) @@ -502,9 +502,9 @@ void SZ_Clear (sizebuf_t *buf) buf->cursize = 0; } -qbyte *SZ_GetSpace (sizebuf_t *buf, int length) +unsigned char *SZ_GetSpace (sizebuf_t *buf, int length) { - qbyte *data; + unsigned char *data; if (buf->cursize + length > buf->maxsize) { @@ -525,7 +525,7 @@ qbyte *SZ_GetSpace (sizebuf_t *buf, int length) return data; } -void SZ_Write (sizebuf_t *buf, const qbyte *data, int length) +void SZ_Write (sizebuf_t *buf, const unsigned char *data, int length) { memcpy (SZ_GetSpace(buf,length),data,length); } @@ -535,12 +535,12 @@ void SZ_Write (sizebuf_t *buf, const qbyte *data, int length) // all of darkplaces. static char *hexchar = "0123456789ABCDEF"; -void Com_HexDumpToConsole(const qbyte *data, int size) +void Com_HexDumpToConsole(const unsigned char *data, int size) { int i, j, n; char text[1024]; char *cur, *flushpointer; - const qbyte *d; + const unsigned char *d; cur = text; flushpointer = text + 512; for (i = 0;i < size;) diff --git a/common.h b/common.h index 699c4598..3f6c0dde 100644 --- a/common.h +++ b/common.h @@ -44,19 +44,19 @@ typedef struct sizebuf_s { qboolean allowoverflow; // if false, do a Sys_Error qboolean overflowed; // set to true if the buffer size failed - qbyte *data; + unsigned char *data; int maxsize; int cursize; } sizebuf_t; void SZ_Clear (sizebuf_t *buf); -qbyte *SZ_GetSpace (sizebuf_t *buf, int length); -void SZ_Write (sizebuf_t *buf, const qbyte *data, int length); +unsigned char *SZ_GetSpace (sizebuf_t *buf, int length); +void SZ_Write (sizebuf_t *buf, const unsigned char *data, int length); void SZ_HexDumpToConsole(const sizebuf_t *buf); -void Com_HexDumpToConsole(const qbyte *data, int size); +void Com_HexDumpToConsole(const unsigned char *data, int size); -unsigned short CRC_Block(const qbyte *data, size_t size); +unsigned short CRC_Block(const unsigned char *data, size_t size); //============================================================================ @@ -115,10 +115,10 @@ float FloatSwap (float f); #define LittleFloat(l) FloatSwap(l) #endif -unsigned int BuffBigLong (const qbyte *buffer); -unsigned short BuffBigShort (const qbyte *buffer); -unsigned int BuffLittleLong (const qbyte *buffer); -unsigned short BuffLittleShort (const qbyte *buffer); +unsigned int BuffBigLong (const unsigned char *buffer); +unsigned short BuffBigShort (const unsigned char *buffer); +unsigned int BuffLittleLong (const unsigned char *buffer); +unsigned short BuffLittleShort (const unsigned char *buffer); //============================================================================ diff --git a/console.c b/console.c index 7fbe3056..5eb85031 100644 --- a/console.c +++ b/console.c @@ -66,7 +66,7 @@ cvar_t log_file = {0, "log_file",""}; char crt_log_file [MAX_OSPATH] = ""; qfile_t* logfile = NULL; -qbyte* logqueue = NULL; +unsigned char* logqueue = NULL; size_t logq_ind = 0; size_t logq_size = 0; @@ -183,10 +183,10 @@ void Log_ConPrint (const char *msg) if (len > remain) { size_t factor = ((logq_ind + len) / logq_size) + 1; - qbyte* newqueue; + unsigned char* newqueue; logq_size *= factor; - newqueue = (qbyte *)Mem_Alloc (tempmempool, logq_size); + newqueue = (unsigned char *)Mem_Alloc (tempmempool, logq_size); memcpy (newqueue, logqueue, logq_ind); Mem_Free (logqueue); logqueue = newqueue; @@ -369,7 +369,7 @@ void Con_Init (void) // Allocate a log queue logq_size = 512; - logqueue = (qbyte *)Mem_Alloc (tempmempool, logq_size); + logqueue = (unsigned char *)Mem_Alloc (tempmempool, logq_size); logq_ind = 0; Cvar_RegisterVariable (&log_file); diff --git a/draw.h b/draw.h index 61d50af9..5fe0b8bf 100644 --- a/draw.h +++ b/draw.h @@ -41,7 +41,7 @@ cachepic_t; void Draw_Init (void); cachepic_t *Draw_CachePic (const char *path, qboolean persistent); // create or update a pic's image -cachepic_t *Draw_NewPic(const char *picname, int width, int height, int alpha, qbyte *pixels); +cachepic_t *Draw_NewPic(const char *picname, int width, int height, int alpha, unsigned char *pixels); // free the texture memory used by a pic void Draw_FreePic(const char *picname); diff --git a/fractalnoise.c b/fractalnoise.c index eabe7ead..c161f12b 100644 --- a/fractalnoise.c +++ b/fractalnoise.c @@ -1,7 +1,7 @@ #include "quakedef.h" -void fractalnoise(qbyte *noise, int size, int startgrid) +void fractalnoise(unsigned char *noise, int size, int startgrid) { int x, y, g, g2, amplitude, min, max, size1 = size - 1, sizepower, gridpower; int *noisebuf; @@ -65,13 +65,13 @@ void fractalnoise(qbyte *noise, int size, int startgrid) // normalize noise and copy to output for (y = 0;y < size;y++) for (x = 0;x < size;x++) - *noise++ = (qbyte) (((n(x,y) - min) * 256) / max); + *noise++ = (unsigned char) (((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(qbyte *noise, int size, int startgrid) +void fractalnoisequick(unsigned char *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)] @@ -110,13 +110,13 @@ void fractalnoisequick(qbyte *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) = (qbyte) (((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) = (unsigned char) (((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) = (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); + n(x+g,y) = (unsigned char) (((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) = (unsigned char) (((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/fs.c b/fs.c index 67ffa9fd..df394998 100644 --- a/fs.c +++ b/fs.c @@ -114,11 +114,11 @@ TYPES // been cast to "void*" for a matter of simplicity typedef struct { - qbyte *next_in; // next input byte + unsigned char *next_in; // next input byte unsigned int avail_in; // number of bytes available at next_in unsigned long total_in; // total nb of input bytes read so far - qbyte *next_out; // next output byte should be put there + unsigned char *next_out; // next output byte should be put there unsigned int avail_out; // remaining free space at next_out unsigned long total_out; // total nb of bytes output so far @@ -147,7 +147,7 @@ typedef struct size_t comp_length; // length of the compressed file size_t in_ind, in_len; // input buffer current index and length size_t in_position; // position in the compressed file - qbyte input [FILE_BUFF_SIZE]; + unsigned char input [FILE_BUFF_SIZE]; } ztoolkit_t; struct qfile_s @@ -161,7 +161,7 @@ struct qfile_s // Contents buffer fs_offset_t buff_ind, buff_len; // buffer current index and length - qbyte buff [FILE_BUFF_SIZE]; + unsigned char buff [FILE_BUFF_SIZE]; // For zipped files ztoolkit_t* ztk; @@ -382,7 +382,7 @@ Extract the end of the central directory from a PK3 package qboolean PK3_GetEndOfCentralDir (const char *packfile, int packhandle, pk3_endOfCentralDir_t *eocd) { long filesize, maxsize; - qbyte *buffer, *ptr; + unsigned char *buffer, *ptr; int ind; // Get the package size @@ -395,7 +395,7 @@ qboolean PK3_GetEndOfCentralDir (const char *packfile, int packhandle, pk3_endOf maxsize = filesize; else maxsize = ZIP_MAX_COMMENTS_SIZE + ZIP_END_CDIR_SIZE; - buffer = (qbyte *)Mem_Alloc (tempmempool, maxsize); + buffer = (unsigned char *)Mem_Alloc (tempmempool, maxsize); lseek (packhandle, filesize - maxsize, SEEK_SET); if (read (packhandle, buffer, maxsize) != (fs_offset_t) maxsize) { @@ -444,12 +444,12 @@ Extract the file list from a PK3 file */ int PK3_BuildFileList (pack_t *pack, const pk3_endOfCentralDir_t *eocd) { - qbyte *central_dir, *ptr; + unsigned char *central_dir, *ptr; unsigned int ind; fs_offset_t remaining; // Load the central directory in memory - central_dir = (qbyte *)Mem_Alloc (tempmempool, eocd->cdir_size); + central_dir = (unsigned char *)Mem_Alloc (tempmempool, eocd->cdir_size); lseek (pack->handle, eocd->cdir_offset, SEEK_SET); read (pack->handle, central_dir, eocd->cdir_size); @@ -609,7 +609,7 @@ Find where the true file data offset is */ qboolean PK3_GetTrueFileOffset (packfile_t *pfile, pack_t *pack) { - qbyte buffer [ZIP_LOCAL_CHUNK_BASE_SIZE]; + unsigned char buffer [ZIP_LOCAL_CHUNK_BASE_SIZE]; fs_offset_t count; // Already found? @@ -1567,7 +1567,7 @@ fs_offset_t FS_Read (qfile_t* file, void* buffer, size_t buffersize) if (count > (fs_offset_t)buffersize) count = (fs_offset_t)buffersize; lseek (file->handle, file->offset + file->position, SEEK_SET); - nb = read (file->handle, &((qbyte*)buffer)[done], count); + nb = read (file->handle, &((unsigned char*)buffer)[done], count); if (nb > 0) { done += nb; @@ -1590,7 +1590,7 @@ fs_offset_t FS_Read (qfile_t* file, void* buffer, size_t buffersize) // Copy the requested data in "buffer" (as much as we can) count = (fs_offset_t)buffersize > file->buff_len ? file->buff_len : (fs_offset_t)buffersize; - memcpy (&((qbyte*)buffer)[done], file->buff, count); + memcpy (&((unsigned char*)buffer)[done], file->buff, count); file->buff_ind = count; done += count; } @@ -1654,14 +1654,14 @@ fs_offset_t FS_Read (qfile_t* file, void* buffer, size_t buffersize) // Copy the requested data in "buffer" (as much as we can) count = (fs_offset_t)buffersize > file->buff_len ? file->buff_len : (fs_offset_t)buffersize; - memcpy (&((qbyte*)buffer)[done], file->buff, count); + memcpy (&((unsigned char*)buffer)[done], file->buff, count); file->buff_ind = count; } // Else, we inflate directly in "buffer" else { - ztk->zstream.next_out = &((qbyte*)buffer)[done]; + ztk->zstream.next_out = &((unsigned char*)buffer)[done]; ztk->zstream.avail_out = (unsigned int)buffersize; error = qz_inflate (&ztk->zstream, Z_SYNC_FLUSH); if (error != Z_OK && error != Z_STREAM_END) @@ -1796,7 +1796,7 @@ Move the position index in a file int FS_Seek (qfile_t* file, fs_offset_t offset, int whence) { ztoolkit_t *ztk; - qbyte* buffer; + unsigned char* buffer; fs_offset_t buffersize; // Compute the file offset @@ -1859,7 +1859,7 @@ int FS_Seek (qfile_t* file, fs_offset_t offset, int whence) // We need a big buffer to force inflating into it directly buffersize = 2 * sizeof (file->buff); - buffer = (qbyte *)Mem_Alloc (tempmempool, buffersize); + buffer = (unsigned char *)Mem_Alloc (tempmempool, buffersize); // Skip all data until we reach the requested offset while (offset > file->position) @@ -1917,16 +1917,16 @@ Filename are relative to the quake directory. Always appends a 0 byte. ============ */ -qbyte *FS_LoadFile (const char *path, mempool_t *pool, qboolean quiet) +unsigned char *FS_LoadFile (const char *path, mempool_t *pool, qboolean quiet) { qfile_t *file; - qbyte *buf; + unsigned char *buf; file = FS_Open (path, "rb", quiet, false); if (!file) return NULL; - buf = (qbyte *)Mem_Alloc (pool, fs_filesize + 1); + buf = (unsigned char *)Mem_Alloc (pool, fs_filesize + 1); buf[fs_filesize] = '\0'; FS_Read (file, buf, fs_filesize); diff --git a/fs.h b/fs.h index b0398d72..c86870f9 100644 --- a/fs.h +++ b/fs.h @@ -77,7 +77,7 @@ fssearch_t; fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet); void FS_FreeSearch(fssearch_t *search); -qbyte *FS_LoadFile (const char *path, mempool_t *pool, qboolean quiet); +unsigned char *FS_LoadFile (const char *path, mempool_t *pool, qboolean quiet); qboolean FS_WriteFile (const char *filename, void *data, fs_offset_t len); diff --git a/gl_backend.c b/gl_backend.c index a2e10d70..677da0e4 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -1671,7 +1671,7 @@ void R_Mesh_Draw_ShowTris(int firstvertex, int numvertices, int numtriangles, co ============================================================================== */ -qboolean SCR_ScreenShot(char *filename, qbyte *buffer1, qbyte *buffer2, qbyte *buffer3, int x, int y, int width, int height, qboolean flipx, qboolean flipy, qboolean flipdiagonal, qboolean jpeg, qboolean gammacorrect) +qboolean SCR_ScreenShot(char *filename, unsigned char *buffer1, unsigned char *buffer2, unsigned char *buffer3, int x, int y, int width, int height, qboolean flipx, qboolean flipy, qboolean flipdiagonal, qboolean jpeg, qboolean gammacorrect) { int indices[3] = {0,1,2}; qboolean ret; @@ -2039,7 +2039,7 @@ static rcachearrayitem_t r_mesh_rcacheitems[RCACHEARRAY_ITEMS]; // size of data buffer static int r_mesh_rcachedata_size = RCACHEARRAY_DEFAULTSIZE; // data buffer -static qbyte r_mesh_rcachedata[RCACHEARRAY_DEFAULTSIZE]; +static unsigned char r_mesh_rcachedata[RCACHEARRAY_DEFAULTSIZE]; // current state static int r_mesh_rcachedata_offset; @@ -2100,7 +2100,7 @@ int R_Mesh_CacheArray(rcachearrayrequest_t *r) //R_Mesh_CacheArray_ValidateState(3); // calculate a hashindex to choose a cache chain r->data = NULL; - hashindex = CRC_Block((qbyte *)r, sizeof(*r)) % RCACHEARRAY_HASHSIZE; + hashindex = CRC_Block((unsigned char *)r, sizeof(*r)) % RCACHEARRAY_HASHSIZE; // is it already cached? for (lhead = &r_mesh_rcachechain[hashindex], l = lhead->next;l != lhead;l = l->next) diff --git a/gl_backend.h b/gl_backend.h index 32ede019..198e17f8 100644 --- a/gl_backend.h +++ b/gl_backend.h @@ -98,7 +98,7 @@ void R_Mesh_Draw(int firstvertex, int numvertices, int numtriangles, const int * void R_Mesh_Draw_ShowTris(int firstvertex, int numvertices, int numtriangles, const int *elements); // saves a section of the rendered frame to a .tga or .jpg file -qboolean SCR_ScreenShot(char *filename, qbyte *buffer1, qbyte *buffer2, qbyte *buffer3, int x, int y, int width, int height, qboolean flipx, qboolean flipy, qboolean flipdiagonal, qboolean jpeg, qboolean gammacorrect); +qboolean SCR_ScreenShot(char *filename, unsigned char *buffer1, unsigned char *buffer2, unsigned char *buffer3, int x, int y, int width, int height, qboolean flipx, qboolean flipy, qboolean flipdiagonal, qboolean jpeg, qboolean gammacorrect); // used by R_Envmap_f and internally in backend, clears the frame void R_ClearScreen(void); // invoke refresh of frame diff --git a/gl_draw.c b/gl_draw.c index d6879c8b..59603aa2 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -39,7 +39,7 @@ static int numcachepics; static rtexturepool_t *drawtexturepool; -static qbyte concharimage[FONT_FILESIZE] = +static unsigned char concharimage[FONT_FILESIZE] = { #include "lhfont.h" }; @@ -47,7 +47,7 @@ static qbyte concharimage[FONT_FILESIZE] = static rtexture_t *draw_generateconchars(void) { int i; - qbyte buffer[65536][4], *data = NULL; + unsigned char buffer[65536][4], *data = NULL; double random; fs_filesize = FONT_FILESIZE; @@ -57,36 +57,36 @@ static rtexture_t *draw_generateconchars(void) for (i = 0;i < 8192;i++) { random = lhrandom (0.0,1.0); - buffer[i][0] = 83 + (qbyte)(random * 64); - buffer[i][1] = 71 + (qbyte)(random * 32); - buffer[i][2] = 23 + (qbyte)(random * 16); + buffer[i][0] = 83 + (unsigned char)(random * 64); + buffer[i][1] = 71 + (unsigned char)(random * 32); + buffer[i][2] = 23 + (unsigned char)(random * 16); buffer[i][3] = data[i*4+0]; } // White chars for (i = 8192;i < 32768;i++) { random = lhrandom (0.0,1.0); - buffer[i][0] = 95 + (qbyte)(random * 64); - buffer[i][1] = 95 + (qbyte)(random * 64); - buffer[i][2] = 95 + (qbyte)(random * 64); + buffer[i][0] = 95 + (unsigned char)(random * 64); + buffer[i][1] = 95 + (unsigned char)(random * 64); + buffer[i][2] = 95 + (unsigned char)(random * 64); buffer[i][3] = data[i*4+0]; } // Gold numbers for (i = 32768;i < 40960;i++) { random = lhrandom (0.0,1.0); - buffer[i][0] = 83 + (qbyte)(random * 64); - buffer[i][1] = 71 + (qbyte)(random * 32); - buffer[i][2] = 23 + (qbyte)(random * 16); + buffer[i][0] = 83 + (unsigned char)(random * 64); + buffer[i][1] = 71 + (unsigned char)(random * 32); + buffer[i][2] = 23 + (unsigned char)(random * 16); buffer[i][3] = data[i*4+0]; } // Red chars for (i = 40960;i < 65536;i++) { random = lhrandom (0.0,1.0); - buffer[i][0] = 96 + (qbyte)(random * 64); - buffer[i][1] = 43 + (qbyte)(random * 32); - buffer[i][2] = 27 + (qbyte)(random * 32); + buffer[i][0] = 96 + (unsigned char)(random * 64); + buffer[i][1] = 43 + (unsigned char)(random * 32); + buffer[i][2] = 27 + (unsigned char)(random * 32); buffer[i][3] = data[i*4+0]; } @@ -120,7 +120,7 @@ static char *pointerimage = static rtexture_t *draw_generatemousepointer(void) { int i; - qbyte buffer[256][4]; + unsigned char buffer[256][4]; for (i = 0;i < 256;i++) { if (pointerimage[i] == '.') @@ -253,7 +253,7 @@ static rtexture_t *draw_generatecrosshair(int num) { int i; char *in; - qbyte data[16*16][4]; + unsigned char data[16*16][4]; in = crosshairtexdata[num]; for (i = 0;i < 16*16;i++) { @@ -269,7 +269,7 @@ static rtexture_t *draw_generatecrosshair(int num) data[i][0] = 255; data[i][1] = 255; data[i][2] = 255; - data[i][3] = (qbyte) ((int) (in[i] - '0') * 255 / 7); + data[i][3] = (unsigned char) ((int) (in[i] - '0') * 255 / 7); } } return R_LoadTexture2D(drawtexturepool, va("crosshair%i", num), 16, 16, &data[0][0], TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE, NULL); @@ -279,7 +279,7 @@ static rtexture_t *draw_generateditherpattern(void) { #if 1 int x, y; - qbyte data[8*8*4]; + unsigned char data[8*8*4]; for (y = 0;y < 8;y++) { for (x = 0;x < 8;x++) @@ -290,7 +290,7 @@ static rtexture_t *draw_generateditherpattern(void) } return R_LoadTexture2D(drawtexturepool, "ditherpattern", 8, 8, data, TEXTYPE_RGBA, TEXF_FORCENEAREST | TEXF_PRECACHE, NULL); #else - qbyte data[16]; + unsigned char data[16]; memset(data, 255, sizeof(data)); data[0] = data[1] = data[2] = data[12] = data[13] = data[14] = 0; return R_LoadTexture2D(drawtexturepool, "ditherpattern", 2, 2, data, TEXTYPE_RGBA, TEXF_FORCENEAREST | TEXF_PRECACHE, NULL); @@ -320,7 +320,7 @@ cachepic_t *Draw_CachePic (const char *path, qboolean persistent) return &video->cpif; } - crc = CRC_Block((qbyte *)path, strlen(path)); + crc = CRC_Block((unsigned char *)path, strlen(path)); hashkey = ((crc >> 8) ^ crc) % CACHEPICHASHSIZE; for (pic = cachepichash[hashkey];pic;pic = pic->chain) if (!strcmp (path, pic->name)) @@ -355,9 +355,9 @@ cachepic_t *Draw_CachePic (const char *path, qboolean persistent) { if (!strcmp(path, "gfx/conchars")) { - qbyte *pix; + unsigned char *pix; // conchars is a raw image and with the wrong transparent color - pix = (qbyte *)p; + pix = (unsigned char *)p; for (i = 0;i < 128 * 128;i++) if (pix[i] == 0) pix[i] = 255; @@ -399,12 +399,12 @@ cachepic_t *Draw_CachePic (const char *path, qboolean persistent) return pic; } -cachepic_t *Draw_NewPic(const char *picname, int width, int height, int alpha, qbyte *pixels) +cachepic_t *Draw_NewPic(const char *picname, int width, int height, int alpha, unsigned char *pixels) { int crc, hashkey; cachepic_t *pic; - crc = CRC_Block((qbyte *)picname, strlen(picname)); + crc = CRC_Block((unsigned char *)picname, strlen(picname)); hashkey = ((crc >> 8) ^ crc) % CACHEPICHASHSIZE; for (pic = cachepichash[hashkey];pic;pic = pic->chain) if (!strcmp (picname, pic->name)) @@ -450,7 +450,7 @@ void Draw_FreePic(const char *picname) int hashkey; cachepic_t *pic; // this doesn't really free the pic, but does free it's texture - crc = CRC_Block((qbyte *)picname, strlen(picname)); + crc = CRC_Block((unsigned char *)picname, strlen(picname)); hashkey = ((crc >> 8) ^ crc) % CACHEPICHASHSIZE; for (pic = cachepichash[hashkey];pic;pic = pic->chain) { diff --git a/gl_rmain.c b/gl_rmain.c index 3b19095a..b73ebca9 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -244,7 +244,7 @@ void FOG_registercvars(void) static void R_BuildBlankTextures(void) { - qbyte data[4]; + unsigned char data[4]; data[0] = 128; // normal X data[1] = 128; // normal Y data[2] = 255; // normal Z @@ -265,7 +265,7 @@ static void R_BuildBlankTextures(void) static void R_BuildNoTexture(void) { int x, y; - qbyte pix[16][16][4]; + unsigned char pix[16][16][4]; // this makes a light grey/dark grey checkerboard texture for (y = 0;y < 16;y++) { @@ -292,7 +292,7 @@ static void R_BuildNoTexture(void) static void R_BuildWhiteCube(void) { - qbyte data[6*1*1*4]; + unsigned char data[6*1*1*4]; data[ 0] = 255;data[ 1] = 255;data[ 2] = 255;data[ 3] = 255; data[ 4] = 255;data[ 5] = 255;data[ 6] = 255;data[ 7] = 255; data[ 8] = 255;data[ 9] = 255;data[10] = 255;data[11] = 255; @@ -308,7 +308,7 @@ static void R_BuildNormalizationCube(void) vec3_t v; vec_t s, t, intensity; #define NORMSIZE 64 - qbyte data[6][NORMSIZE][NORMSIZE][4]; + unsigned char data[6][NORMSIZE][NORMSIZE][4]; for (side = 0;side < 6;side++) { for (y = 0;y < NORMSIZE;y++) @@ -367,8 +367,8 @@ static void R_BuildFogTexture(void) int x, b; double r, alpha; #define FOGWIDTH 64 - qbyte data1[FOGWIDTH][4]; - qbyte data2[FOGWIDTH][4]; + unsigned char data1[FOGWIDTH][4]; + unsigned char data2[FOGWIDTH][4]; r = (-1.0/256.0) * (FOGWIDTH * FOGWIDTH); for (x = 0;x < FOGWIDTH;x++) { @@ -1705,7 +1705,7 @@ void RSurf_SetColorPointer(const entity_render_t *ent, const msurface_t *surface { for (i = 0, c = varray_color4f + 4 * surface->num_firstvertex;i < surface->num_vertices;i++, c += 4) { - const qbyte *lm = surface->lightmapinfo->samples + (surface->groupmesh->data_lightmapoffsets + surface->num_firstvertex)[i]; + const unsigned char *lm = surface->lightmapinfo->samples + (surface->groupmesh->data_lightmapoffsets + surface->num_firstvertex)[i]; if (lm) { float scale = r_refdef.lightstylevalue[surface->lightmapinfo->styles[0]] * (1.0f / 32768.0f); diff --git a/gl_rsurf.c b/gl_rsurf.c index 2591649a..68ac13e4 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -36,11 +36,11 @@ cvar_t r_q3bsp_renderskydepth = {0, "r_q3bsp_renderskydepth", "0"}; // flag arrays used for visibility checking on world model // (all other entities have no per-surface/per-leaf visibility checks) // TODO: dynamic resize according to r_refdef.worldmodel->brush.num_clusters -qbyte r_pvsbits[(32768+7)>>3]; +unsigned char r_pvsbits[(32768+7)>>3]; // TODO: dynamic resize according to r_refdef.worldmodel->brush.num_leafs -qbyte r_worldleafvisible[32768]; +unsigned char r_worldleafvisible[32768]; // TODO: dynamic resize according to r_refdef.worldmodel->num_surfaces -qbyte r_worldsurfacevisible[262144]; +unsigned char r_worldsurfacevisible[262144]; /* =============== @@ -53,9 +53,9 @@ void R_BuildLightMap (const entity_render_t *ent, msurface_t *surface) { int smax, tmax, i, j, size, size3, maps, stride, l; unsigned int *bl, scale; - qbyte *lightmap, *out, *stain; + unsigned char *lightmap, *out, *stain; static unsigned int intblocklights[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*3]; // LordHavoc: *3 for colored lighting - static qbyte templight[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*4]; + static unsigned char templight[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*4]; // update cached lighting info surface->cached_dlight = 0; @@ -131,7 +131,7 @@ void R_StainNode (mnode_t *node, model_t *model, const vec3_t origin, float radi float ndist, a, ratio, maxdist, maxdist2, maxdist3, invradius, sdtable[256], td, dist2; msurface_t *surface, *endsurface; int i, s, t, smax, tmax, smax3, impacts, impactt, stained; - qbyte *bl; + unsigned char *bl; vec3_t impact; maxdist = radius * radius; @@ -209,9 +209,9 @@ loc0: { if (a > 1) a = 1; - bl[0] = (qbyte) ((float) bl[0] + a * ((fcolor[0] + ratio * fcolor[4]) - (float) bl[0])); - bl[1] = (qbyte) ((float) bl[1] + a * ((fcolor[1] + ratio * fcolor[5]) - (float) bl[1])); - bl[2] = (qbyte) ((float) bl[2] + a * ((fcolor[2] + ratio * fcolor[6]) - (float) bl[2])); + bl[0] = (unsigned char) ((float) bl[0] + a * ((fcolor[0] + ratio * fcolor[4]) - (float) bl[0])); + bl[1] = (unsigned char) ((float) bl[1] + a * ((fcolor[1] + ratio * fcolor[5]) - (float) bl[1])); + bl[2] = (unsigned char) ((float) bl[2] + a * ((fcolor[2] + ratio * fcolor[6]) - (float) bl[2])); stained = true; } } @@ -510,16 +510,16 @@ typedef struct r_q1bsp_getlightinfo_s vec3_t relativelightorigin; float lightradius; int *outleaflist; - qbyte *outleafpvs; + unsigned char *outleafpvs; int outnumleafs; int *outsurfacelist; - qbyte *outsurfacepvs; + unsigned char *outsurfacepvs; int outnumsurfaces; vec3_t outmins; vec3_t outmaxs; vec3_t lightmins; vec3_t lightmaxs; - const qbyte *pvs; + const unsigned char *pvs; } r_q1bsp_getlightinfo_t; @@ -598,7 +598,7 @@ void R_Q1BSP_RecursiveGetLightInfo(r_q1bsp_getlightinfo_t *info, mnode_t *node) } } -void R_Q1BSP_GetLightInfo(entity_render_t *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, qbyte *outleafpvs, int *outnumleafspointer, int *outsurfacelist, qbyte *outsurfacepvs, int *outnumsurfacespointer) +void R_Q1BSP_GetLightInfo(entity_render_t *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, unsigned char *outleafpvs, int *outnumleafspointer, int *outsurfacelist, unsigned char *outsurfacepvs, int *outnumsurfacespointer) { r_q1bsp_getlightinfo_t info; VectorCopy(relativelightorigin, info.relativelightorigin); diff --git a/gl_textures.c b/gl_textures.c index e8476796..1a2889e7 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -103,7 +103,7 @@ typedef struct gltexture_s int x, y, z, width, height, depth; // copy of the original texture(s) supplied to the upload function, for // delayed uploads (non-precached) - qbyte *inputtexels; + unsigned char *inputtexels; // original data size in *inputtexels int inputdatasize; // flags supplied to the LoadTexture function @@ -131,9 +131,9 @@ gltexturepool_t; static gltexturepool_t *gltexturepoolchain = NULL; -static qbyte *resizebuffer = NULL, *colorconvertbuffer; +static unsigned char *resizebuffer = NULL, *colorconvertbuffer; static int resizebuffersize = 0; -static qbyte *texturebuffer; +static unsigned char *texturebuffer; static int texturebuffersize = 0; static int realmaxsize = 0; @@ -573,8 +573,8 @@ void R_MakeResizeBufferBigger(int size) Mem_Free(resizebuffer); if (colorconvertbuffer) Mem_Free(colorconvertbuffer); - resizebuffer = (qbyte *)Mem_Alloc(texturemempool, resizebuffersize); - colorconvertbuffer = (qbyte *)Mem_Alloc(texturemempool, resizebuffersize); + resizebuffer = (unsigned char *)Mem_Alloc(texturemempool, resizebuffersize); + colorconvertbuffer = (unsigned char *)Mem_Alloc(texturemempool, resizebuffersize); if (!resizebuffer || !colorconvertbuffer) Host_Error("R_Upload: out of memory\n"); } @@ -649,11 +649,11 @@ static void GL_SetupTextureParameters(int flags, int texturetype) CHECKGLERROR } -static void R_Upload(gltexture_t *glt, qbyte *data) +static void R_Upload(gltexture_t *glt, unsigned char *data) { int i, mip, width, height, depth; GLint oldbindtexnum; - qbyte *prevbuffer; + unsigned char *prevbuffer; prevbuffer = data; CHECKGLERROR @@ -1011,7 +1011,7 @@ static void R_UploadTexture (gltexture_t *glt) Con_Printf("R_UploadTexture: Texture %s already uploaded and destroyed. Can not upload original image again. Uploaded blank texture.\n", glt->identifier); } -static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, int depth, int sides, int flags, int textype, int texturetype, const qbyte *data, const unsigned int *palette) +static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, int depth, int sides, int flags, int textype, int texturetype, const unsigned char *data, const unsigned int *palette) { int i, size; gltexture_t *glt; @@ -1056,7 +1056,7 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden { for (i = 0;i < size;i++) { - if (((qbyte *)&palette[data[i]])[3] < 255) + if (((unsigned char *)&palette[data[i]])[3] < 255) { flags |= TEXF_ALPHA; break; @@ -1109,7 +1109,7 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden if (data) { - glt->inputtexels = (qbyte *)Mem_Alloc(texturemempool, size); + glt->inputtexels = (unsigned char *)Mem_Alloc(texturemempool, size); if (glt->inputtexels == NULL) Con_Printf ("R_LoadTexture: out of memory\n"); else @@ -1124,22 +1124,22 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden return (rtexture_t *)glt; } -rtexture_t *R_LoadTexture1D(rtexturepool_t *rtexturepool, const char *identifier, int width, const qbyte *data, int textype, int flags, const unsigned int *palette) +rtexture_t *R_LoadTexture1D(rtexturepool_t *rtexturepool, const char *identifier, int width, const unsigned char *data, int textype, int flags, const unsigned int *palette) { return R_SetupTexture(rtexturepool, identifier, width, 1, 1, 1, flags, textype, GLTEXTURETYPE_1D, data, palette); } -rtexture_t *R_LoadTexture2D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, const qbyte *data, int textype, int flags, const unsigned int *palette) +rtexture_t *R_LoadTexture2D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, const unsigned char *data, int textype, int flags, const unsigned int *palette) { return R_SetupTexture(rtexturepool, identifier, width, height, 1, 1, flags, textype, GLTEXTURETYPE_2D, data, palette); } -rtexture_t *R_LoadTexture3D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, int depth, const qbyte *data, int textype, int flags, const unsigned int *palette) +rtexture_t *R_LoadTexture3D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, int depth, const unsigned char *data, int textype, int flags, const unsigned int *palette) { return R_SetupTexture(rtexturepool, identifier, width, height, depth, 1, flags, textype, GLTEXTURETYPE_3D, data, palette); } -rtexture_t *R_LoadTextureCubeMap(rtexturepool_t *rtexturepool, const char *identifier, int width, const qbyte *data, int textype, int flags, const unsigned int *palette) +rtexture_t *R_LoadTextureCubeMap(rtexturepool_t *rtexturepool, const char *identifier, int width, const unsigned char *data, int textype, int flags, const unsigned int *palette) { return R_SetupTexture(rtexturepool, identifier, width, width, 1, 6, flags, textype, GLTEXTURETYPE_CUBEMAP, data, palette); } @@ -1252,7 +1252,7 @@ int R_CompatibleFragmentWidth(int width, int textype, int flags) return width; } -void R_UpdateTexture(rtexture_t *rt, qbyte *data) +void R_UpdateTexture(rtexture_t *rt, unsigned char *data) { gltexture_t *glt; if (rt == NULL) diff --git a/host.c b/host.c index 67ee4c16..e02d6cce 100644 --- a/host.c +++ b/host.c @@ -479,7 +479,7 @@ void Host_ShutdownServer(qboolean crash) { int i, count; sizebuf_t buf; - qbyte message[4]; + unsigned char message[4]; Con_DPrintf("Host_ShutdownServer\n"); diff --git a/image.c b/image.c index fd971ecc..623ed589 100644 --- a/image.c +++ b/image.c @@ -9,10 +9,10 @@ int image_height; #if 1 // written by LordHavoc in a readable way, optimized by Vic, further optimized by LordHavoc (the non-special index case), readable version preserved below this -void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int inputwidth, int inputheight, qboolean inputflipx, qboolean inputflipy, qboolean inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices) +void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int inputwidth, int inputheight, qboolean inputflipx, qboolean inputflipy, qboolean inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices) { int index, c, x, y; - const qbyte *in, *line; + const unsigned char *in, *line; int row_inc = (inputflipy ? -inputwidth : inputwidth) * numinputcomponents, col_inc = (inputflipx ? -1 : 1) * numinputcomponents; int row_ofs = (inputflipy ? (inputheight - 1) * inputwidth * numinputcomponents : 0), col_ofs = (inputflipx ? (inputwidth - 1) * numinputcomponents : 0); @@ -58,10 +58,10 @@ void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int inputwidth, int } #else // intentionally readable version -void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int inputwidth, int inputheight, qboolean inputflipx, qboolean inputflipy, qboolean inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices) +void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int inputwidth, int inputheight, qboolean inputflipx, qboolean inputflipy, qboolean inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices) { int index, c, x, y; - const qbyte *in, *inrow, *incolumn; + const unsigned char *in, *inrow, *incolumn; if (inputflipdiagonal) { for (x = 0;x < inputwidth;x++) @@ -101,7 +101,7 @@ void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int inputwidth, int } #endif -void Image_GammaRemapRGB(const qbyte *in, qbyte *out, int pixels, const qbyte *gammar, const qbyte *gammag, const qbyte *gammab) +void Image_GammaRemapRGB(const unsigned char *in, unsigned char *out, int pixels, const unsigned char *gammar, const unsigned char *gammag, const unsigned char *gammab) { while (pixels--) { @@ -114,7 +114,7 @@ void Image_GammaRemapRGB(const qbyte *in, qbyte *out, int pixels, const qbyte *g } // note: pal must be 32bit color -void Image_Copy8bitRGBA(const qbyte *in, qbyte *out, int pixels, const unsigned int *pal) +void Image_Copy8bitRGBA(const unsigned char *in, unsigned char *out, int pixels, const unsigned int *pal) { int *iout = (int *)out; while (pixels >= 8) @@ -180,11 +180,11 @@ typedef struct pcx_s LoadPCX ============ */ -qbyte* LoadPCX (const qbyte *f, int matchwidth, int matchheight) +unsigned char* LoadPCX (const unsigned char *f, int matchwidth, int matchheight) { pcx_t pcx; - qbyte *a, *b, *image_rgba, *pbuf; - const qbyte *palette, *fin, *enddata; + unsigned char *a, *b, *image_rgba, *pbuf; + const unsigned char *palette, *fin, *enddata; int x, y, x2, dataByte; if (fs_filesize < (int)sizeof(pcx) + 768) @@ -220,7 +220,7 @@ qbyte* LoadPCX (const qbyte *f, int matchwidth, int matchheight) palette = f + fs_filesize - 768; - image_rgba = (qbyte *)Mem_Alloc(tempmempool, image_width*image_height*4); + image_rgba = (unsigned char *)Mem_Alloc(tempmempool, image_width*image_height*4); if (!image_rgba) { Con_Printf("LoadPCX: not enough memory for %i by %i image\n", image_width, image_height); @@ -297,11 +297,11 @@ void PrintTargaHeader(TargaHeader *t) LoadTGA ============= */ -qbyte *LoadTGA (const qbyte *f, int matchwidth, int matchheight) +unsigned char *LoadTGA (const unsigned char *f, int matchwidth, int matchheight) { int x, y, row_inc, compressed, readpixelcount, red, green, blue, alpha, runlen, pindex, alphabits; - qbyte *pixbuf, *image_rgba; - const qbyte *fin, *enddata; + unsigned char *pixbuf, *image_rgba; + const unsigned char *fin, *enddata; unsigned char *p; TargaHeader targa_header; unsigned char palette[256*4]; @@ -433,7 +433,7 @@ qbyte *LoadTGA (const qbyte *f, int matchwidth, int matchheight) return NULL; } - image_rgba = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4); + image_rgba = (unsigned char *)Mem_Alloc(tempmempool, image_width * image_height * 4); if (!image_rgba) { Con_Printf("LoadTGA: not enough memory for %i by %i image\n", image_width, image_height); @@ -536,9 +536,9 @@ qbyte *LoadTGA (const qbyte *f, int matchwidth, int matchheight) LoadLMP ============ */ -qbyte *LoadLMP (const qbyte *f, int matchwidth, int matchheight, qboolean loadAs8Bit) +unsigned char *LoadLMP (const unsigned char *f, int matchwidth, int matchheight, qboolean loadAs8Bit) { - qbyte *image_buffer; + unsigned char *image_buffer; if (fs_filesize < 9) { @@ -565,18 +565,18 @@ qbyte *LoadLMP (const qbyte *f, int matchwidth, int matchheight, qboolean loadAs if (loadAs8Bit) { - image_buffer = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height); + image_buffer = (unsigned char *)Mem_Alloc(tempmempool, image_width * image_height); memcpy(image_buffer, f + 8, image_width * image_height); } else { - image_buffer = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4); + image_buffer = (unsigned char *)Mem_Alloc(tempmempool, image_width * image_height * 4); Image_Copy8bitRGBA(f + 8, image_buffer, image_width * image_height, palette_complete); } return image_buffer; } -static qbyte *LoadLMPRGBA (const qbyte *f, int matchwidth, int matchheight) +static unsigned char *LoadLMPRGBA (const unsigned char *f, int matchwidth, int matchheight) { return LoadLMP(f, matchwidth, matchheight, false); } @@ -593,9 +593,9 @@ typedef struct q2wal_s int value; } q2wal_t; -qbyte *LoadWAL (const qbyte *f, int matchwidth, int matchheight) +unsigned char *LoadWAL (const unsigned char *f, int matchwidth, int matchheight) { - qbyte *image_rgba; + unsigned char *image_rgba; const q2wal_t *inwal = (const q2wal_t *)f; if (fs_filesize < (int) sizeof(q2wal_t)) @@ -620,7 +620,7 @@ qbyte *LoadWAL (const qbyte *f, int matchwidth, int matchheight) return NULL; } - image_rgba = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4); + image_rgba = (unsigned char *)Mem_Alloc(tempmempool, image_width * image_height * 4); if (!image_rgba) { Con_Printf("LoadLMP: not enough memory for %i by %i image\n", image_width, image_height); @@ -655,7 +655,7 @@ void Image_StripImageExtension (const char *in, char *out) struct imageformat_s { const char *formatstring; - qbyte *(*loadfunc)(const qbyte *f, int matchwidth, int matchheight); + unsigned char *(*loadfunc)(const unsigned char *f, int matchwidth, int matchheight); } imageformats[] = { @@ -672,10 +672,10 @@ imageformats[] = {NULL, NULL} }; -qbyte *loadimagepixels (const char *filename, qboolean complain, int matchwidth, int matchheight) +unsigned char *loadimagepixels (const char *filename, qboolean complain, int matchwidth, int matchheight) { int i; - qbyte *f, *data = NULL; + unsigned char *f, *data = NULL; char basename[MAX_QPATH], name[MAX_QPATH], *c; if (developer_memorydebug.integer) Mem_CheckSentinelsGlobal(); @@ -718,7 +718,7 @@ qbyte *loadimagepixels (const char *filename, qboolean complain, int matchwidth, return NULL; } -int image_makemask (const qbyte *in, qbyte *out, int size) +int image_makemask (const unsigned char *in, unsigned char *out, int size) { int i, count; count = 0; @@ -734,9 +734,9 @@ int image_makemask (const qbyte *in, qbyte *out, int size) return count; } -qbyte* loadimagepixelsmask (const char *filename, qboolean complain, int matchwidth, int matchheight) +unsigned char* loadimagepixelsmask (const char *filename, qboolean complain, int matchwidth, int matchheight) { - qbyte *in, *data; + unsigned char *in, *data; in = data = loadimagepixels(filename, complain, matchwidth, matchheight); if (!data) return NULL; @@ -751,7 +751,7 @@ qbyte* loadimagepixelsmask (const char *filename, qboolean complain, int matchwi rtexture_t *loadtextureimage (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags) { - qbyte *data; + unsigned char *data; rtexture_t *rt; if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight))) return 0; @@ -762,7 +762,7 @@ rtexture_t *loadtextureimage (rtexturepool_t *pool, const char *filename, int ma rtexture_t *loadtextureimagemask (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags) { - qbyte *data; + unsigned char *data; rtexture_t *rt; if (!(data = loadimagepixelsmask (filename, complain, matchwidth, matchheight))) return 0; @@ -775,7 +775,7 @@ rtexture_t *image_masktex; rtexture_t *image_nmaptex; rtexture_t *loadtextureimagewithmask (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags) { - qbyte *data; + unsigned char *data; rtexture_t *rt; image_masktex = NULL; image_nmaptex = NULL; @@ -793,14 +793,14 @@ rtexture_t *loadtextureimagewithmask (rtexturepool_t *pool, const char *filename rtexture_t *loadtextureimagewithmaskandnmap (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags, float bumpscale) { - qbyte *data, *data2; + unsigned char *data, *data2; rtexture_t *rt; image_masktex = NULL; image_nmaptex = NULL; if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight))) return 0; - data2 = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4); + data2 = (unsigned char *)Mem_Alloc(tempmempool, image_width * image_height * 4); rt = R_LoadTexture2D(pool, filename, image_width, image_height, data, TEXTYPE_RGBA, flags, NULL); @@ -818,11 +818,11 @@ rtexture_t *loadtextureimagewithmaskandnmap (rtexturepool_t *pool, const char *f rtexture_t *loadtextureimagebumpasnmap (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags, float bumpscale) { - qbyte *data, *data2; + unsigned char *data, *data2; rtexture_t *rt; if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight))) return 0; - data2 = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4); + data2 = (unsigned char *)Mem_Alloc(tempmempool, image_width * image_height * 4); Image_HeightmapToNormalmap(data, data2, image_width, image_height, (flags & TEXF_CLAMP) != 0, bumpscale); rt = R_LoadTexture2D(pool, filename, image_width, image_height, data2, TEXTYPE_RGBA, flags, NULL); @@ -832,11 +832,11 @@ rtexture_t *loadtextureimagebumpasnmap (rtexturepool_t *pool, const char *filena return rt; } -qboolean Image_WriteTGARGB_preflipped (const char *filename, int width, int height, const qbyte *data, qbyte *buffer) +qboolean Image_WriteTGARGB_preflipped (const char *filename, int width, int height, const unsigned char *data, unsigned char *buffer) { qboolean ret; - qbyte *out; - const qbyte *in, *end; + unsigned char *out; + const unsigned char *in, *end; memset (buffer, 0, 18); buffer[2] = 2; // uncompressed type @@ -861,13 +861,13 @@ qboolean Image_WriteTGARGB_preflipped (const char *filename, int width, int heig return ret; } -void Image_WriteTGARGB (const char *filename, int width, int height, const qbyte *data) +void Image_WriteTGARGB (const char *filename, int width, int height, const unsigned char *data) { int y; - qbyte *buffer, *out; - const qbyte *in, *end; + unsigned char *buffer, *out; + const unsigned char *in, *end; - buffer = (qbyte *)Mem_Alloc(tempmempool, width*height*3 + 18); + buffer = (unsigned char *)Mem_Alloc(tempmempool, width*height*3 + 18); memset (buffer, 0, 18); buffer[2] = 2; // uncompressed type @@ -895,13 +895,13 @@ void Image_WriteTGARGB (const char *filename, int width, int height, const qbyte Mem_Free(buffer); } -void Image_WriteTGARGBA (const char *filename, int width, int height, const qbyte *data) +void Image_WriteTGARGBA (const char *filename, int width, int height, const unsigned char *data) { int y; - qbyte *buffer, *out; - const qbyte *in, *end; + unsigned char *buffer, *out; + const unsigned char *in, *end; - buffer = (qbyte *)Mem_Alloc(tempmempool, width*height*4 + 18); + buffer = (unsigned char *)Mem_Alloc(tempmempool, width*height*4 + 18); memset (buffer, 0, 18); buffer[2] = 2; // uncompressed type @@ -931,9 +931,9 @@ void Image_WriteTGARGBA (const char *filename, int width, int height, const qbyt Mem_Free(buffer); } -qboolean Image_CheckAlpha(const qbyte *data, int size, qboolean rgba) +qboolean Image_CheckAlpha(const unsigned char *data, int size, qboolean rgba) { - const qbyte *end; + const unsigned char *end; if (rgba) { // check alpha bytes @@ -951,7 +951,7 @@ qboolean Image_CheckAlpha(const qbyte *data, int size, qboolean rgba) return 0; } -static void Image_Resample32LerpLine (const qbyte *in, qbyte *out, int inwidth, int outwidth) +static void Image_Resample32LerpLine (const unsigned char *in, unsigned char *out, int inwidth, int outwidth) { int j, xi, oldx = 0, f, fstep, endx, lerp; fstep = (int) (inwidth*65536.0f/outwidth); @@ -967,10 +967,10 @@ static void Image_Resample32LerpLine (const qbyte *in, qbyte *out, int inwidth, if (xi < endx) { lerp = f & 0xFFFF; - *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]); + *out++ = (unsigned char) ((((in[4] - in[0]) * lerp) >> 16) + in[0]); + *out++ = (unsigned char) ((((in[5] - in[1]) * lerp) >> 16) + in[1]); + *out++ = (unsigned char) ((((in[6] - in[2]) * lerp) >> 16) + in[2]); + *out++ = (unsigned char) ((((in[7] - in[3]) * lerp) >> 16) + in[3]); } else // last pixel of the line has no pixel to lerp to { @@ -982,7 +982,7 @@ static void Image_Resample32LerpLine (const qbyte *in, qbyte *out, int inwidth, } } -static void Image_Resample24LerpLine (const qbyte *in, qbyte *out, int inwidth, int outwidth) +static void Image_Resample24LerpLine (const unsigned char *in, unsigned char *out, int inwidth, int outwidth) { int j, xi, oldx = 0, f, fstep, endx, lerp; fstep = (int) (inwidth*65536.0f/outwidth); @@ -998,9 +998,9 @@ static void Image_Resample24LerpLine (const qbyte *in, qbyte *out, int inwidth, if (xi < endx) { lerp = f & 0xFFFF; - *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]); + *out++ = (unsigned char) ((((in[3] - in[0]) * lerp) >> 16) + in[0]); + *out++ = (unsigned char) ((((in[4] - in[1]) * lerp) >> 16) + in[1]); + *out++ = (unsigned char) ((((in[5] - in[2]) * lerp) >> 16) + in[2]); } else // last pixel of the line has no pixel to lerp to { @@ -1011,21 +1011,21 @@ static void Image_Resample24LerpLine (const qbyte *in, qbyte *out, int inwidth, } } -#define LERPBYTE(i) r = resamplerow1[i];out[i] = (qbyte) ((((resamplerow2[i] - r) * lerp) >> 16) + r) +#define LERPBYTE(i) r = resamplerow1[i];out[i] = (unsigned char) ((((resamplerow2[i] - r) * lerp) >> 16) + r) void Image_Resample32Lerp(const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight) { int i, j, r, yi, oldy, f, fstep, lerp, endy = (inheight-1), inwidth4 = inwidth*4, outwidth4 = outwidth*4; - qbyte *out; - const qbyte *inrow; - qbyte *resamplerow1; - qbyte *resamplerow2; - out = (qbyte *)outdata; + unsigned char *out; + const unsigned char *inrow; + unsigned char *resamplerow1; + unsigned char *resamplerow2; + out = (unsigned char *)outdata; fstep = (int) (inheight*65536.0f/outheight); - resamplerow1 = (qbyte *)Mem_Alloc(tempmempool, outwidth*4*2); + resamplerow1 = (unsigned char *)Mem_Alloc(tempmempool, outwidth*4*2); resamplerow2 = resamplerow1 + outwidth*4; - inrow = (const qbyte *)indata; + inrow = (const unsigned char *)indata; oldy = 0; Image_Resample32LerpLine (inrow, resamplerow1, inwidth, outwidth); Image_Resample32LerpLine (inrow + inwidth4, resamplerow2, inwidth, outwidth); @@ -1037,7 +1037,7 @@ void Image_Resample32Lerp(const void *indata, int inwidth, int inheight, void *o lerp = f & 0xFFFF; if (yi != oldy) { - inrow = (qbyte *)indata + inwidth4*yi; + inrow = (unsigned char *)indata + inwidth4*yi; if (yi == oldy+1) memcpy(resamplerow1, resamplerow2, outwidth4); else @@ -1100,7 +1100,7 @@ void Image_Resample32Lerp(const void *indata, int inwidth, int inheight, void *o { if (yi != oldy) { - inrow = (qbyte *)indata + inwidth4*yi; + inrow = (unsigned char *)indata + inwidth4*yi; if (yi == oldy+1) memcpy(resamplerow1, resamplerow2, outwidth4); else @@ -1156,17 +1156,17 @@ void Image_Resample32Nolerp(const void *indata, int inwidth, int inheight, void void Image_Resample24Lerp(const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight) { int i, j, r, yi, oldy, f, fstep, lerp, endy = (inheight-1), inwidth3 = inwidth * 3, outwidth3 = outwidth * 3; - qbyte *out; - const qbyte *inrow; - qbyte *resamplerow1; - qbyte *resamplerow2; - out = (qbyte *)outdata; + unsigned char *out; + const unsigned char *inrow; + unsigned char *resamplerow1; + unsigned char *resamplerow2; + out = (unsigned char *)outdata; fstep = (int) (inheight*65536.0f/outheight); - resamplerow1 = (qbyte *)Mem_Alloc(tempmempool, outwidth*3*2); + resamplerow1 = (unsigned char *)Mem_Alloc(tempmempool, outwidth*3*2); resamplerow2 = resamplerow1 + outwidth*3; - inrow = (const qbyte *)indata; + inrow = (const unsigned char *)indata; oldy = 0; Image_Resample24LerpLine (inrow, resamplerow1, inwidth, outwidth); Image_Resample24LerpLine (inrow + inwidth3, resamplerow2, inwidth, outwidth); @@ -1178,7 +1178,7 @@ void Image_Resample24Lerp(const void *indata, int inwidth, int inheight, void *o lerp = f & 0xFFFF; if (yi != oldy) { - inrow = (qbyte *)indata + inwidth3*yi; + inrow = (unsigned char *)indata + inwidth3*yi; if (yi == oldy+1) memcpy(resamplerow1, resamplerow2, outwidth3); else @@ -1234,7 +1234,7 @@ void Image_Resample24Lerp(const void *indata, int inwidth, int inheight, void *o { if (yi != oldy) { - inrow = (qbyte *)indata + inwidth3*yi; + inrow = (unsigned char *)indata + inwidth3*yi; if (yi == oldy+1) memcpy(resamplerow1, resamplerow2, outwidth3); else @@ -1253,13 +1253,13 @@ void Image_Resample24Nolerp(const void *indata, int inwidth, int inheight, void { int i, j, f, inwidth3 = inwidth * 3; unsigned frac, fracstep; - qbyte *inrow, *out; - out = (qbyte *)outdata; + unsigned char *inrow, *out; + out = (unsigned char *)outdata; fracstep = inwidth*0x10000/outwidth; for (i = 0;i < outheight;i++) { - inrow = (qbyte *)indata + inwidth3*(i*inheight/outheight); + inrow = (unsigned char *)indata + inwidth3*(i*inheight/outheight); frac = fracstep >> 1; j = outwidth - 4; while (j >= 0) @@ -1315,7 +1315,7 @@ void Image_Resample (const void *indata, int inwidth, int inheight, int indepth, } // in can be the same as out -void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int *depth, int destwidth, int destheight, int destdepth, int bytesperpixel) +void Image_MipReduce(const unsigned char *in, unsigned char *out, int *width, int *height, int *depth, int destwidth, int destheight, int destdepth, int bytesperpixel) { int x, y, nextrow; if (*depth != 1 || destdepth != 1) @@ -1337,10 +1337,10 @@ void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int * { for (x = 0;x < *width;x++) { - 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[0] = (unsigned char) ((in[0] + in[4] + in[nextrow ] + in[nextrow+4]) >> 2); + out[1] = (unsigned char) ((in[1] + in[5] + in[nextrow+1] + in[nextrow+5]) >> 2); + out[2] = (unsigned char) ((in[2] + in[6] + in[nextrow+2] + in[nextrow+6]) >> 2); + out[3] = (unsigned char) ((in[3] + in[7] + in[nextrow+3] + in[nextrow+7]) >> 2); out += 4; in += 8; } @@ -1353,9 +1353,9 @@ void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int * { for (x = 0;x < *width;x++) { - 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[0] = (unsigned char) ((in[0] + in[3] + in[nextrow ] + in[nextrow+3]) >> 2); + out[1] = (unsigned char) ((in[1] + in[4] + in[nextrow+1] + in[nextrow+4]) >> 2); + out[2] = (unsigned char) ((in[2] + in[5] + in[nextrow+2] + in[nextrow+5]) >> 2); out += 3; in += 6; } @@ -1374,10 +1374,10 @@ void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int * { for (x = 0;x < *width;x++) { - 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[0] = (unsigned char) ((in[0] + in[4]) >> 1); + out[1] = (unsigned char) ((in[1] + in[5]) >> 1); + out[2] = (unsigned char) ((in[2] + in[6]) >> 1); + out[3] = (unsigned char) ((in[3] + in[7]) >> 1); out += 4; in += 8; } @@ -1389,9 +1389,9 @@ void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int * { for (x = 0;x < *width;x++) { - 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[0] = (unsigned char) ((in[0] + in[3]) >> 1); + out[1] = (unsigned char) ((in[1] + in[4]) >> 1); + out[2] = (unsigned char) ((in[2] + in[5]) >> 1); out += 3; in += 6; } @@ -1413,10 +1413,10 @@ void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int * { for (x = 0;x < *width;x++) { - 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[0] = (unsigned char) ((in[0] + in[nextrow ]) >> 1); + out[1] = (unsigned char) ((in[1] + in[nextrow+1]) >> 1); + out[2] = (unsigned char) ((in[2] + in[nextrow+2]) >> 1); + out[3] = (unsigned char) ((in[3] + in[nextrow+3]) >> 1); out += 4; in += 4; } @@ -1429,9 +1429,9 @@ void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int * { for (x = 0;x < *width;x++) { - 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[0] = (unsigned char) ((in[0] + in[nextrow ]) >> 1); + out[1] = (unsigned char) ((in[1] + in[nextrow+1]) >> 1); + out[2] = (unsigned char) ((in[2] + in[nextrow+2]) >> 1); out += 3; in += 3; } @@ -1514,7 +1514,7 @@ void Image_HeightmapToNormalmap(const unsigned char *inpixels, unsigned char *ou int image_loadskin(imageskin_t *s, char *shadername) { int j; - qbyte *bumppixels; + unsigned char *bumppixels; int bumppixels_width, bumppixels_height; char name[MAX_QPATH]; strlcpy(name, shadername, sizeof(name)); @@ -1529,7 +1529,7 @@ int image_loadskin(imageskin_t *s, char *shadername) bumppixels = NULL;bumppixels_width = 0;bumppixels_height = 0; if (Image_CheckAlpha(s->basepixels, s->basepixels_width * s->basepixels_height, true)) { - s->maskpixels = (qbyte *)Mem_Alloc(loadmodel->mempool, s->basepixels_width * s->basepixels_height * 4); + s->maskpixels = (unsigned char *)Mem_Alloc(loadmodel->mempool, s->basepixels_width * s->basepixels_height * 4); s->maskpixels_width = s->basepixels_width; s->maskpixels_height = s->basepixels_height; memcpy(s->maskpixels, s->basepixels, s->maskpixels_width * s->maskpixels_height * 4); @@ -1583,7 +1583,7 @@ int image_loadskin(imageskin_t *s, char *shadername) { if (r_shadow_bumpscale_bumpmap.value > 0) { - s->nmappixels = (qbyte *)Mem_Alloc(loadmodel->mempool, bumppixels_width * bumppixels_height * 4); + s->nmappixels = (unsigned char *)Mem_Alloc(loadmodel->mempool, bumppixels_width * bumppixels_height * 4); s->nmappixels_width = bumppixels_width; s->nmappixels_height = bumppixels_height; Image_HeightmapToNormalmap(bumppixels, s->nmappixels, s->nmappixels_width, s->nmappixels_height, false, r_shadow_bumpscale_bumpmap.value); @@ -1593,7 +1593,7 @@ int image_loadskin(imageskin_t *s, char *shadername) { if (r_shadow_bumpscale_basetexture.value > 0) { - s->nmappixels = (qbyte *)Mem_Alloc(loadmodel->mempool, s->basepixels_width * s->basepixels_height * 4); + s->nmappixels = (unsigned char *)Mem_Alloc(loadmodel->mempool, s->basepixels_width * s->basepixels_height * 4); s->nmappixels_width = s->basepixels_width; s->nmappixels_height = s->basepixels_height; Image_HeightmapToNormalmap(s->basepixels, s->nmappixels, s->nmappixels_width, s->nmappixels_height, false, r_shadow_bumpscale_basetexture.value); diff --git a/image.h b/image.h index b9464c46..1a9e30d1 100644 --- a/image.h +++ b/image.h @@ -10,27 +10,27 @@ extern int image_width, image_height; // (warning: input must be different than output due to non-linear read/write) // (tip: component indices can contain values | 0x80000000 to tell it to // store them directly into output, so 255 | 0x80000000 would write 255) -void Image_CopyMux(qbyte *outpixels, const qbyte *inpixels, int inputwidth, int inputheight, qboolean inputflipx, qboolean inputflipy, qboolean inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices); +void Image_CopyMux(unsigned char *outpixels, const unsigned char *inpixels, int inputwidth, int inputheight, qboolean inputflipx, qboolean inputflipy, qboolean inputflipdiagonal, int numoutputcomponents, int numinputcomponents, int *outputinputcomponentindices); // applies gamma correction to RGB pixels, in can be the same as out -void Image_GammaRemapRGB(const qbyte *in, qbyte *out, int pixels, const qbyte *gammar, const qbyte *gammag, const qbyte *gammab); +void Image_GammaRemapRGB(const unsigned char *in, unsigned char *out, int pixels, const unsigned char *gammar, const unsigned char *gammag, const unsigned char *gammab); // converts 8bit image data to RGBA, in can not be the same as out -void Image_Copy8bitRGBA(const qbyte *in, qbyte *out, int pixels, const unsigned int *pal); +void Image_Copy8bitRGBA(const unsigned char *in, unsigned char *out, int pixels, const unsigned int *pal); // makes a RGBA mask from RGBA input, in can be the same as out -int image_makemask (const qbyte *in, qbyte *out, int size); +int image_makemask (const unsigned char *in, unsigned char *out, int size); -qbyte *LoadTGA (const qbyte *f, int matchwidth, int matchheight); +unsigned char *LoadTGA (const unsigned char *f, int matchwidth, int matchheight); // loads a texture, as pixel data -qbyte *loadimagepixels (const char *filename, qboolean complain, int matchwidth, int matchheight); +unsigned char *loadimagepixels (const char *filename, qboolean complain, int matchwidth, int matchheight); // loads a texture, as a texture rtexture_t *loadtextureimage (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags); // loads a texture's alpha mask, as pixel data -qbyte *loadimagepixelsmask (const char *filename, qboolean complain, int matchwidth, int matchheight); +unsigned char *loadimagepixelsmask (const char *filename, qboolean complain, int matchwidth, int matchheight); // loads a texture's alpha mask, as a texture rtexture_t *loadtextureimagemask (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags); @@ -43,37 +43,37 @@ rtexture_t *loadtextureimagewithmaskandnmap (rtexturepool_t *pool, const char *f rtexture_t *loadtextureimagebumpasnmap (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags, float bumpscale); // writes a RGB TGA that is already upside down (which TGA wants) -qboolean Image_WriteTGARGB_preflipped (const char *filename, int width, int height, const qbyte *data, qbyte *buffer); +qboolean Image_WriteTGARGB_preflipped (const char *filename, int width, int height, const unsigned char *data, unsigned char *buffer); // writes a RGB TGA -void Image_WriteTGARGB (const char *filename, int width, int height, const qbyte *data); +void Image_WriteTGARGB (const char *filename, int width, int height, const unsigned char *data); // writes a RGBA TGA -void Image_WriteTGARGBA (const char *filename, int width, int height, const qbyte *data); +void Image_WriteTGARGBA (const char *filename, int width, int height, const unsigned char *data); // returns true if the image has some translucent pixels -qboolean Image_CheckAlpha(const qbyte *data, int size, qboolean rgba); +qboolean Image_CheckAlpha(const unsigned char *data, int size, qboolean rgba); // resizes the image (in can not be the same as out) void Image_Resample (const void *indata, int inwidth, int inheight, int indepth, void *outdata, int outwidth, int outheight, int outdepth, int bytesperpixel, int quality); // scales the image down by a power of 2 (in can be the same as out) -void Image_MipReduce(const qbyte *in, qbyte *out, int *width, int *height, int *depth, int destwidth, int destheight, int destdepth, int bytesperpixel); +void Image_MipReduce(const unsigned char *in, unsigned char *out, int *width, int *height, int *depth, int destwidth, int destheight, int destdepth, int bytesperpixel); // only used by menuplyr coloring -qbyte *LoadLMP (const qbyte *f, int matchwidth, int matchheight, qboolean loadAs8Bit); +unsigned char *LoadLMP (const unsigned char *f, int matchwidth, int matchheight, qboolean loadAs8Bit); void Image_HeightmapToNormalmap(const unsigned char *inpixels, unsigned char *outpixels, int width, int height, int clamp, float bumpscale); typedef struct imageskin_s { - qbyte *basepixels;int basepixels_width;int basepixels_height; - qbyte *nmappixels;int nmappixels_width;int nmappixels_height; - qbyte *glowpixels;int glowpixels_width;int glowpixels_height; - qbyte *glosspixels;int glosspixels_width;int glosspixels_height; - qbyte *pantspixels;int pantspixels_width;int pantspixels_height; - qbyte *shirtpixels;int shirtpixels_width;int shirtpixels_height; - qbyte *maskpixels;int maskpixels_width;int maskpixels_height; + unsigned char *basepixels;int basepixels_width;int basepixels_height; + unsigned char *nmappixels;int nmappixels_width;int nmappixels_height; + unsigned char *glowpixels;int glowpixels_width;int glowpixels_height; + unsigned char *glosspixels;int glosspixels_width;int glosspixels_height; + unsigned char *pantspixels;int pantspixels_width;int pantspixels_height; + unsigned char *shirtpixels;int shirtpixels_width;int shirtpixels_height; + unsigned char *maskpixels;int maskpixels_width;int maskpixels_height; } imageskin_t; diff --git a/jpeg.c b/jpeg.c index 4934b758..44bbb5fe 100644 --- a/jpeg.c +++ b/jpeg.c @@ -38,9 +38,9 @@ ================================================================= */ -// jboolean is qbyte instead of int on Win32 +// jboolean is unsigned char instead of int on Win32 #ifdef WIN32 -typedef qbyte jboolean; +typedef unsigned char jboolean; #else typedef int jboolean; #endif @@ -119,7 +119,7 @@ struct jpeg_error_mgr struct jpeg_source_mgr { - const qbyte *next_input_byte; + const unsigned char *next_input_byte; size_t bytes_in_buffer; void (*init_source) (j_decompress_ptr cinfo); @@ -186,18 +186,18 @@ struct jpeg_decompress_struct void *comp_info; jboolean progressive_mode; jboolean arith_code; - qbyte arith_dc_L[NUM_ARITH_TBLS]; - qbyte arith_dc_U[NUM_ARITH_TBLS]; - qbyte arith_ac_K[NUM_ARITH_TBLS]; + unsigned char arith_dc_L[NUM_ARITH_TBLS]; + unsigned char arith_dc_U[NUM_ARITH_TBLS]; + unsigned char arith_ac_K[NUM_ARITH_TBLS]; unsigned int restart_interval; jboolean saw_JFIF_marker; - qbyte JFIF_major_version; - qbyte JFIF_minor_version; - qbyte density_unit; + unsigned char JFIF_major_version; + unsigned char JFIF_minor_version; + unsigned char density_unit; unsigned short X_density; unsigned short Y_density; jboolean saw_Adobe_marker; - qbyte Adobe_transform; + unsigned char Adobe_transform; jboolean CCIR601_sampling; void *marker_list; int max_h_samp_factor; @@ -250,9 +250,9 @@ struct jpeg_compress_struct void *quant_tbl_ptrs[NUM_QUANT_TBLS]; void *dc_huff_tbl_ptrs[NUM_HUFF_TBLS]; void *ac_huff_tbl_ptrs[NUM_HUFF_TBLS]; - qbyte arith_dc_L[NUM_ARITH_TBLS]; - qbyte arith_dc_U[NUM_ARITH_TBLS]; - qbyte arith_ac_K[NUM_ARITH_TBLS]; + unsigned char arith_dc_L[NUM_ARITH_TBLS]; + unsigned char arith_dc_U[NUM_ARITH_TBLS]; + unsigned char arith_ac_K[NUM_ARITH_TBLS]; int num_scans; const void *scan_info; @@ -267,9 +267,9 @@ struct jpeg_compress_struct int restart_in_rows; jboolean write_JFIF_header; - qbyte JFIF_major_version; - qbyte JFIF_minor_version; - qbyte density_unit; + unsigned char JFIF_major_version; + unsigned char JFIF_minor_version; + unsigned char density_unit; unsigned short X_density; unsigned short Y_density; jboolean write_Adobe_marker; @@ -302,7 +302,7 @@ struct jpeg_compress_struct struct jpeg_destination_mgr { - qbyte* next_output_byte; + unsigned char* next_output_byte; size_t free_in_buffer; void (*init_destination) (j_compress_ptr cinfo); @@ -333,13 +333,13 @@ static void (*qjpeg_finish_compress) (j_compress_ptr cinfo); static jboolean (*qjpeg_finish_decompress) (j_decompress_ptr cinfo); static jboolean (*qjpeg_resync_to_restart) (j_decompress_ptr cinfo, int desired); static int (*qjpeg_read_header) (j_decompress_ptr cinfo, jboolean require_image); -static JDIMENSION (*qjpeg_read_scanlines) (j_decompress_ptr cinfo, qbyte** scanlines, JDIMENSION max_lines); +static JDIMENSION (*qjpeg_read_scanlines) (j_decompress_ptr cinfo, unsigned char** scanlines, JDIMENSION max_lines); static void (*qjpeg_set_defaults) (j_compress_ptr cinfo); static void (*qjpeg_set_quality) (j_compress_ptr cinfo, int quality, jboolean force_baseline); static jboolean (*qjpeg_start_compress) (j_compress_ptr cinfo, jboolean write_all_tables); static jboolean (*qjpeg_start_decompress) (j_decompress_ptr cinfo); static struct jpeg_error_mgr* (*qjpeg_std_error) (struct jpeg_error_mgr *err); -static JDIMENSION (*qjpeg_write_scanlines) (j_compress_ptr cinfo, qbyte** scanlines, JDIMENSION num_lines); +static JDIMENSION (*qjpeg_write_scanlines) (j_compress_ptr cinfo, unsigned char** scanlines, JDIMENSION num_lines); static dllfunction_t jpegfuncs[] = { @@ -364,7 +364,7 @@ static dllfunction_t jpegfuncs[] = // Handle for JPEG DLL dllhandle_t jpeg_dll = NULL; -static qbyte jpeg_eoi_marker [2] = {0xFF, JPEG_EOI}; +static unsigned char jpeg_eoi_marker [2] = {0xFF, JPEG_EOI}; static qboolean error_in_jpeg; // Our own output manager for JPEG compression @@ -373,7 +373,7 @@ typedef struct struct jpeg_destination_mgr pub; qfile_t* outfile; - qbyte* buffer; + unsigned char* buffer; } my_destination_mgr; typedef my_destination_mgr* my_dest_ptr; @@ -470,7 +470,7 @@ static void JPEG_SkipInputData (j_decompress_ptr cinfo, long num_bytes) cinfo->src->bytes_in_buffer -= num_bytes; } -static void JPEG_MemSrc (j_decompress_ptr cinfo, const qbyte *buffer) +static void JPEG_MemSrc (j_decompress_ptr cinfo, const unsigned char *buffer) { cinfo->src = (struct jpeg_source_mgr *)cinfo->mem->alloc_small ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof (struct jpeg_source_mgr)); @@ -498,11 +498,11 @@ JPEG_LoadImage Load a JPEG image into a RGBA buffer ==================== */ -qbyte* JPEG_LoadImage (const qbyte *f, int matchwidth, int matchheight) +unsigned char* JPEG_LoadImage (const unsigned char *f, int matchwidth, int matchheight) { struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; - qbyte *image_rgba, *scanline; + unsigned char *image_rgba, *scanline; unsigned int line; // No DLL = no JPEGs @@ -530,8 +530,8 @@ qbyte* JPEG_LoadImage (const qbyte *f, int matchwidth, int matchheight) return NULL; } - image_rgba = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4); - scanline = (qbyte *)Mem_Alloc(tempmempool, image_width * cinfo.output_components); + image_rgba = (unsigned char *)Mem_Alloc(tempmempool, image_width * image_height * 4); + scanline = (unsigned char *)Mem_Alloc(tempmempool, image_width * cinfo.output_components); if (!image_rgba || !scanline) { if (!image_rgba) @@ -547,7 +547,7 @@ qbyte* JPEG_LoadImage (const qbyte *f, int matchwidth, int matchheight) line = 0; while (cinfo.output_scanline < cinfo.output_height) { - qbyte *buffer_ptr; + unsigned char *buffer_ptr; int ind; qjpeg_read_scanlines (&cinfo, &scanline, 1); @@ -603,7 +603,7 @@ qbyte* JPEG_LoadImage (const qbyte *f, int matchwidth, int matchheight) static void JPEG_InitDestination (j_compress_ptr cinfo) { my_dest_ptr dest = (my_dest_ptr)cinfo->dest; - dest->buffer = (qbyte*)cinfo->mem->alloc_small ((j_common_ptr) cinfo, JPOOL_IMAGE, JPEG_OUTPUT_BUF_SIZE * sizeof(qbyte)); + dest->buffer = (unsigned char*)cinfo->mem->alloc_small ((j_common_ptr) cinfo, JPOOL_IMAGE, JPEG_OUTPUT_BUF_SIZE * sizeof(unsigned char)); dest->pub.next_output_byte = dest->buffer; dest->pub.free_in_buffer = JPEG_OUTPUT_BUF_SIZE; } @@ -657,11 +657,11 @@ JPEG_SaveImage_preflipped Save a preflipped JPEG image to a file ==================== */ -qboolean JPEG_SaveImage_preflipped (const char *filename, int width, int height, qbyte *data) +qboolean JPEG_SaveImage_preflipped (const char *filename, int width, int height, unsigned char *data) { struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; - qbyte *scanline; + unsigned char *scanline; unsigned int offset, linesize; qfile_t* file; diff --git a/jpeg.h b/jpeg.h index d6bf4808..6a9dd563 100644 --- a/jpeg.h +++ b/jpeg.h @@ -27,8 +27,8 @@ qboolean JPEG_OpenLibrary (void); void JPEG_CloseLibrary (void); -qbyte* JPEG_LoadImage (const qbyte *f, int matchwidth, int matchheight); -qboolean JPEG_SaveImage_preflipped (const char *filename, int width, int height, qbyte *data); +unsigned char* JPEG_LoadImage (const unsigned char *f, int matchwidth, int matchheight); +qboolean JPEG_SaveImage_preflipped (const char *filename, int width, int height, unsigned char *data); #endif diff --git a/keys.c b/keys.c index 7a218b58..3df1d01e 100644 --- a/keys.c +++ b/keys.c @@ -37,7 +37,7 @@ int key_consoleactive; char *keybindings[MAX_BINDMAPS][MAX_KEYS]; static int key_bmap, key_bmap2; -static qbyte keydown[MAX_KEYS]; // 0 = up, 1 = down, 2 = repeating +static unsigned char keydown[MAX_KEYS]; // 0 = up, 1 = down, 2 = repeating typedef struct keyname_s { diff --git a/mathlib.c b/mathlib.c index 6bb3f487..36e858de 100644 --- a/mathlib.c +++ b/mathlib.c @@ -113,7 +113,7 @@ float m_bytenormals[NUMVERTEXNORMALS][3] = }; #if 0 -qbyte NormalToByte(const vec3_t n) +unsigned char NormalToByte(const vec3_t n) { int i, best; float bestdistance, distance; @@ -133,7 +133,7 @@ qbyte NormalToByte(const vec3_t n) } // note: uses byte partly to force unsigned for the validity check -void ByteToNormal(qbyte num, vec3_t n) +void ByteToNormal(unsigned char num, vec3_t n) { if (num < NUMVERTEXNORMALS) VectorCopy(m_bytenormals[num], n); diff --git a/mathlib.h b/mathlib.h index 8c5f8243..b40e6f33 100644 --- a/mathlib.h +++ b/mathlib.h @@ -180,8 +180,8 @@ float VectorNormalizeLength2 (vec3_t v, vec3_t dest); // returns vector length #define NUMVERTEXNORMALS 162 extern float m_bytenormals[NUMVERTEXNORMALS][3]; -qbyte NormalToByte(const vec3_t n); -void ByteToNormal(qbyte num, vec3_t n); +unsigned char NormalToByte(const vec3_t n); +void ByteToNormal(unsigned char num, vec3_t n); void R_ConcatRotations (const float in1[3*3], const float in2[3*3], float out[3*3]); void R_ConcatTransforms (const float in1[3*4], const float in2[3*4], float out[3*4]); diff --git a/menu.c b/menu.c index 55e7b4f1..68888fcd 100644 --- a/menu.c +++ b/menu.c @@ -209,13 +209,13 @@ void M_DrawPic (float cx, float cy, const char *picname) DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0); } -qbyte identityTable[256]; -qbyte translationTable[256]; +unsigned char identityTable[256]; +unsigned char translationTable[256]; void M_BuildTranslationTable(int top, int bottom) { int j; - qbyte *dest, *source; + unsigned char *dest, *source; for (j = 0; j < 256; j++) identityTable[j] = j; @@ -1254,7 +1254,7 @@ void M_Menu_Setup_f (void) } static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load; -static qbyte *menuplyr_pixels; +static unsigned char *menuplyr_pixels; static unsigned int *menuplyr_translated; typedef struct ratetable_s @@ -1320,7 +1320,7 @@ void M_Setup_Draw (void) // LordHavoc: rewrote this code greatly if (menuplyr_load) { - qbyte *data, *f; + unsigned char *data, *f; menuplyr_load = false; menuplyr_top = -1; menuplyr_bottom = -1; @@ -1330,7 +1330,7 @@ void M_Setup_Draw (void) menuplyr_width = image_width; menuplyr_height = image_height; Mem_Free(f); - menuplyr_pixels = (qbyte *)Mem_Alloc(cl_mempool, menuplyr_width * menuplyr_height); + menuplyr_pixels = (unsigned char *)Mem_Alloc(cl_mempool, menuplyr_width * menuplyr_height); menuplyr_translated = (unsigned int *)Mem_Alloc(cl_mempool, menuplyr_width * menuplyr_height * 4); memcpy(menuplyr_pixels, data, menuplyr_width * menuplyr_height); Mem_Free(data); @@ -1346,7 +1346,7 @@ void M_Setup_Draw (void) M_BuildTranslationTable(menuplyr_top*16, menuplyr_bottom*16); for (i = 0;i < menuplyr_width * menuplyr_height;i++) menuplyr_translated[i] = palette_complete[translationTable[menuplyr_pixels[i]]]; - Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (qbyte *)menuplyr_translated); + Draw_NewPic("gfx/menuplyr.lmp", menuplyr_width, menuplyr_height, true, (unsigned char *)menuplyr_translated); } M_DrawPic(160, 48, "gfx/bigbox.lmp"); M_DrawPic(172, 56, "gfx/menuplyr.lmp"); diff --git a/model_alias.c b/model_alias.c index 16e0235d..ea42d2bb 100644 --- a/model_alias.c +++ b/model_alias.c @@ -301,7 +301,7 @@ static void Mod_ConvertAliasVerts (int inverts, vec3_t scale, vec3_t translate, } } -static void Mod_MDL_LoadFrames (qbyte* datapointer, int inverts, vec3_t scale, vec3_t translate, int *vertremap) +static void Mod_MDL_LoadFrames (unsigned char* datapointer, int inverts, vec3_t scale, vec3_t translate, int *vertremap) { int i, f, pose, groupframes; float interval; @@ -439,7 +439,7 @@ void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend) int i, j, version, totalskins, skinwidth, skinheight, groupframes, groupskins, numverts; float scales, scalet, scale[3], translate[3], interval; msurface_t *surface; - qbyte *data; + unsigned char *data; mdl_t *pinmodel; stvert_t *pinstverts; dtriangle_t *pintriangles; @@ -448,7 +448,7 @@ void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend) daliasskininterval_t *pinskinintervals; daliasframetype_t *pinframetype; daliasgroup_t *pinframegroup; - qbyte *datapointer, *startframes, *startskins; + unsigned char *datapointer, *startframes, *startskins; char name[MAX_QPATH]; skinframe_t tempskinframe; animscene_t *tempskinscenes; @@ -457,7 +457,7 @@ void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend) int *vertonseam, *vertremap; skinfile_t *skinfiles; - datapointer = (qbyte *)buffer; + datapointer = (unsigned char *)buffer; pinmodel = (mdl_t *)datapointer; datapointer += sizeof(mdl_t); @@ -477,7 +477,7 @@ void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend) loadmodel->num_surfaces = 1; loadmodel->nummodelsurfaces = loadmodel->num_surfaces; loadmodel->nummeshes = loadmodel->num_surfaces; - data = (qbyte *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t)); + data = (unsigned char *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t)); loadmodel->data_surfaces = (msurface_t *)data;data += loadmodel->num_surfaces * sizeof(msurface_t); loadmodel->surfacelist = (int *)data;data += loadmodel->num_surfaces * sizeof(int); loadmodel->meshlist = (surfmesh_t **)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *); @@ -700,7 +700,7 @@ void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend) else sprintf (name, "%s_%i", loadmodel->name, i); if (!Mod_LoadSkinFrame(&tempskinframe, name, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PICMIP, true, true)) - Mod_LoadSkinFrame_Internal(&tempskinframe, name, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PICMIP, true, r_fullbrights.integer, (qbyte *)datapointer, skinwidth, skinheight); + Mod_LoadSkinFrame_Internal(&tempskinframe, name, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PICMIP, true, r_fullbrights.integer, (unsigned char *)datapointer, skinwidth, skinheight); Mod_BuildAliasSkinFromSkinFrame(loadmodel->data_textures + totalskins * loadmodel->num_surfaces, &tempskinframe); datapointer += skinwidth * skinheight; totalskins++; @@ -761,10 +761,10 @@ void Mod_IDP2_Load(model_t *mod, void *buffer, void *bufferend) { int i, j, k, hashindex, num, numxyz, numst, xyz, st, skinwidth, skinheight, *vertremap, version, end, numverts; float *stverts, s, t, scale[3], translate[3]; - qbyte *data; + unsigned char *data; msurface_t *surface; md2_t *pinmodel; - qbyte *base, *datapointer; + unsigned char *base, *datapointer; md2frame_t *pinframe; char *inskin; md2triangle_t *intri; @@ -780,7 +780,7 @@ void Mod_IDP2_Load(model_t *mod, void *buffer, void *bufferend) skinfile_t *skinfiles; pinmodel = (md2_t *)buffer; - base = (qbyte *)buffer; + base = (unsigned char *)buffer; version = LittleLong (pinmodel->version); if (version != MD2ALIAS_VERSION) @@ -819,7 +819,7 @@ void Mod_IDP2_Load(model_t *mod, void *buffer, void *bufferend) loadmodel->num_surfaces = 1; loadmodel->nummodelsurfaces = loadmodel->num_surfaces; loadmodel->nummeshes = loadmodel->num_surfaces; - data = (qbyte *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t)); + data = (unsigned char *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t)); loadmodel->data_surfaces = (msurface_t *)data;data += loadmodel->num_surfaces * sizeof(msurface_t); loadmodel->surfacelist = (int *)data;data += loadmodel->num_surfaces * sizeof(int); loadmodel->meshlist = (surfmesh_t **)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *); @@ -1005,7 +1005,7 @@ void Mod_IDP2_Load(model_t *mod, void *buffer, void *bufferend) void Mod_IDP3_Load(model_t *mod, void *buffer, void *bufferend) { int i, j, k, version; - qbyte *data; + unsigned char *data; msurface_t *surface; surfmesh_t *mesh; md3modelheader_t *pinmodel; @@ -1053,7 +1053,7 @@ void Mod_IDP3_Load(model_t *mod, void *buffer, void *bufferend) // load frameinfo loadmodel->animscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, loadmodel->numframes * sizeof(animscene_t)); - for (i = 0, pinframe = (md3frameinfo_t *)((qbyte *)pinmodel + LittleLong(pinmodel->lump_frameinfo));i < loadmodel->numframes;i++, pinframe++) + for (i = 0, pinframe = (md3frameinfo_t *)((unsigned char *)pinmodel + LittleLong(pinmodel->lump_frameinfo));i < loadmodel->numframes;i++, pinframe++) { strcpy(loadmodel->animscenes[i].name, pinframe->name); loadmodel->animscenes[i].firstframe = i; @@ -1066,7 +1066,7 @@ void Mod_IDP3_Load(model_t *mod, void *buffer, void *bufferend) loadmodel->num_tagframes = loadmodel->numframes; loadmodel->num_tags = LittleLong(pinmodel->num_tags); loadmodel->data_tags = (aliastag_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_tagframes * loadmodel->num_tags * sizeof(aliastag_t)); - for (i = 0, pintag = (md3tag_t *)((qbyte *)pinmodel + LittleLong(pinmodel->lump_tags));i < loadmodel->num_tagframes * loadmodel->num_tags;i++, pintag++) + for (i = 0, pintag = (md3tag_t *)((unsigned char *)pinmodel + LittleLong(pinmodel->lump_tags));i < loadmodel->num_tagframes * loadmodel->num_tags;i++, pintag++) { strcpy(loadmodel->data_tags[i].name, pintag->name); Matrix4x4_CreateIdentity(&loadmodel->data_tags[i].matrix); @@ -1083,7 +1083,7 @@ void Mod_IDP3_Load(model_t *mod, void *buffer, void *bufferend) loadmodel->nummodelsurfaces = loadmodel->num_surfaces; loadmodel->nummeshes = loadmodel->num_surfaces; loadmodel->num_textures = loadmodel->num_surfaces; - data = (qbyte *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t) + loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t)); + data = (unsigned char *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t) + loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t)); loadmodel->data_surfaces = (msurface_t *)data;data += loadmodel->num_surfaces * sizeof(msurface_t); loadmodel->surfacelist = (int *)data;data += loadmodel->num_surfaces * sizeof(int); loadmodel->meshlist = (surfmesh_t **)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *); @@ -1093,7 +1093,7 @@ void Mod_IDP3_Load(model_t *mod, void *buffer, void *bufferend) loadmodel->surfacelist[i] = i; loadmodel->meshlist[i] = (surfmesh_t *)data;data += sizeof(surfmesh_t); } - for (i = 0, pinmesh = (md3mesh_t *)((qbyte *)pinmodel + LittleLong(pinmodel->lump_meshes));i < loadmodel->num_surfaces;i++, pinmesh = (md3mesh_t *)((qbyte *)pinmesh + LittleLong(pinmesh->lump_end))) + for (i = 0, pinmesh = (md3mesh_t *)((unsigned char *)pinmodel + LittleLong(pinmodel->lump_meshes));i < loadmodel->num_surfaces;i++, pinmesh = (md3mesh_t *)((unsigned char *)pinmesh + LittleLong(pinmesh->lump_end))) { if (memcmp(pinmesh->identifier, "IDP3", 4)) Host_Error("Mod_IDP3_Load: invalid mesh identifier (not IDP3)\n"); @@ -1106,17 +1106,17 @@ void Mod_IDP3_Load(model_t *mod, void *buffer, void *bufferend) mesh->data_texcoordtexture2f = (float *)Mem_Alloc(loadmodel->mempool, mesh->num_vertices * sizeof(float[2])); mesh->data_morphvertex3f = (float *)Mem_Alloc(loadmodel->mempool, mesh->num_vertices * mesh->num_morphframes * sizeof(float[3])); for (j = 0;j < mesh->num_triangles * 3;j++) - mesh->data_element3i[j] = LittleLong(((int *)((qbyte *)pinmesh + LittleLong(pinmesh->lump_elements)))[j]); + mesh->data_element3i[j] = LittleLong(((int *)((unsigned char *)pinmesh + LittleLong(pinmesh->lump_elements)))[j]); for (j = 0;j < mesh->num_vertices;j++) { - mesh->data_texcoordtexture2f[j * 2 + 0] = LittleFloat(((float *)((qbyte *)pinmesh + LittleLong(pinmesh->lump_texcoords)))[j * 2 + 0]); - mesh->data_texcoordtexture2f[j * 2 + 1] = LittleFloat(((float *)((qbyte *)pinmesh + LittleLong(pinmesh->lump_texcoords)))[j * 2 + 1]); + mesh->data_texcoordtexture2f[j * 2 + 0] = LittleFloat(((float *)((unsigned char *)pinmesh + LittleLong(pinmesh->lump_texcoords)))[j * 2 + 0]); + mesh->data_texcoordtexture2f[j * 2 + 1] = LittleFloat(((float *)((unsigned char *)pinmesh + LittleLong(pinmesh->lump_texcoords)))[j * 2 + 1]); } for (j = 0;j < mesh->num_vertices * mesh->num_morphframes;j++) { - mesh->data_morphvertex3f[j * 3 + 0] = LittleShort(((short *)((qbyte *)pinmesh + LittleLong(pinmesh->lump_framevertices)))[j * 4 + 0]) * (1.0f / 64.0f); - mesh->data_morphvertex3f[j * 3 + 1] = LittleShort(((short *)((qbyte *)pinmesh + LittleLong(pinmesh->lump_framevertices)))[j * 4 + 1]) * (1.0f / 64.0f); - mesh->data_morphvertex3f[j * 3 + 2] = LittleShort(((short *)((qbyte *)pinmesh + LittleLong(pinmesh->lump_framevertices)))[j * 4 + 2]) * (1.0f / 64.0f); + mesh->data_morphvertex3f[j * 3 + 0] = LittleShort(((short *)((unsigned char *)pinmesh + LittleLong(pinmesh->lump_framevertices)))[j * 4 + 0]) * (1.0f / 64.0f); + mesh->data_morphvertex3f[j * 3 + 1] = LittleShort(((short *)((unsigned char *)pinmesh + LittleLong(pinmesh->lump_framevertices)))[j * 4 + 1]) * (1.0f / 64.0f); + mesh->data_morphvertex3f[j * 3 + 2] = LittleShort(((short *)((unsigned char *)pinmesh + LittleLong(pinmesh->lump_framevertices)))[j * 4 + 2]) * (1.0f / 64.0f); } Mod_ValidateElements(mesh->data_element3i, mesh->num_triangles, mesh->num_vertices, __FILE__, __LINE__); @@ -1124,7 +1124,7 @@ void Mod_IDP3_Load(model_t *mod, void *buffer, void *bufferend) Mod_Alias_Mesh_CompileFrameZero(mesh); if (LittleLong(pinmesh->num_shaders) >= 1) - Mod_BuildAliasSkinsFromSkinFiles(loadmodel->data_textures + i, skinfiles, pinmesh->name, ((md3shader_t *)((qbyte *) pinmesh + LittleLong(pinmesh->lump_shaders)))->name); + Mod_BuildAliasSkinsFromSkinFiles(loadmodel->data_textures + i, skinfiles, pinmesh->name, ((md3shader_t *)((unsigned char *) pinmesh + LittleLong(pinmesh->lump_shaders)))->name); else for (j = 0;j < loadmodel->numskins;j++) Mod_BuildAliasSkinFromSkinFrame(loadmodel->data_textures + i + j * loadmodel->num_surfaces, NULL); @@ -1144,7 +1144,7 @@ void Mod_IDP3_Load(model_t *mod, void *buffer, void *bufferend) void Mod_ZYMOTICMODEL_Load(model_t *mod, void *buffer, void *bufferend) { zymtype1header_t *pinmodel, *pheader; - qbyte *pbase; + unsigned char *pbase; int i, j, k, l, numposes, *bonecount, *vertbonecounts, count, *renderlist, *renderlistend, *outelements, *remapvertices; float modelradius, corner[2], *poses, *intexcoord2f, *outtexcoord2f; zymvertex_t *verts, *vertdata; @@ -1152,12 +1152,12 @@ void Mod_ZYMOTICMODEL_Load(model_t *mod, void *buffer, void *bufferend) zymbone_t *bone; char *shadername; skinfile_t *skinfiles; - qbyte *data; + unsigned char *data; msurface_t *surface; surfmesh_t *mesh; pinmodel = (zymtype1header_t *)buffer; - pbase = (qbyte *)buffer; + pbase = (unsigned char *)buffer; if (memcmp(pinmodel->id, "ZYMOTICMODEL", 12)) Host_Error ("Mod_ZYMOTICMODEL_Load: %s is not a zymotic model\n"); if (BigLong(pinmodel->type) != 1) @@ -1325,7 +1325,7 @@ void Mod_ZYMOTICMODEL_Load(model_t *mod, void *buffer, void *bufferend) loadmodel->nummodelsurfaces = loadmodel->num_surfaces; loadmodel->nummeshes = loadmodel->num_surfaces; loadmodel->num_textures = loadmodel->num_surfaces; - data = (qbyte *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t) + loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t)); + data = (unsigned char *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t) + loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t)); loadmodel->data_surfaces = (msurface_t *)data;data += loadmodel->num_surfaces * sizeof(msurface_t); loadmodel->surfacelist = (int *)data;data += loadmodel->num_surfaces * sizeof(int); loadmodel->meshlist = (surfmesh_t **)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *); @@ -1343,7 +1343,7 @@ void Mod_ZYMOTICMODEL_Load(model_t *mod, void *buffer, void *bufferend) if (pheader->lump_render.length != count) Host_Error("%s renderlist is wrong size (%i bytes, should be %i bytes)\n", loadmodel->name, pheader->lump_render.length, count); renderlist = (int *) (pheader->lump_render.start + pbase); - renderlistend = (int *) ((qbyte *) renderlist + pheader->lump_render.length); + renderlistend = (int *) ((unsigned char *) renderlist + pheader->lump_render.length); for (i = 0;i < loadmodel->num_surfaces;i++) { if (renderlist >= renderlistend) @@ -1444,13 +1444,13 @@ void Mod_DARKPLACESMODEL_Load(model_t *mod, void *buffer, void *bufferend) dpmframe_t *frame; dpmbone_t *bone; dpmmesh_t *dpmmesh; - qbyte *pbase; + unsigned char *pbase; int i, j, k; skinfile_t *skinfiles; - qbyte *data; + unsigned char *data; pheader = (dpmheader_t *)buffer; - pbase = (qbyte *)buffer; + pbase = (unsigned char *)buffer; if (memcmp(pheader->id, "DARKPLACESMODEL\0", 16)) Host_Error ("Mod_DARKPLACESMODEL_Load: %s is not a darkplaces model\n"); if (BigLong(pheader->type) != 2) @@ -1508,7 +1508,7 @@ void Mod_DARKPLACESMODEL_Load(model_t *mod, void *buffer, void *bufferend) loadmodel->num_textures = loadmodel->nummeshes = loadmodel->nummodelsurfaces = loadmodel->num_surfaces = pheader->num_meshs; // do most allocations as one merged chunk - data = (qbyte *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t) + loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t) + loadmodel->numskins * sizeof(animscene_t) + loadmodel->num_bones * sizeof(aliasbone_t) + loadmodel->num_poses * sizeof(float[12]) + loadmodel->numframes * sizeof(animscene_t)); + data = (unsigned char *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t) + loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t) + loadmodel->numskins * sizeof(animscene_t) + loadmodel->num_bones * sizeof(aliasbone_t) + loadmodel->num_poses * sizeof(float[12]) + loadmodel->numframes * sizeof(animscene_t)); loadmodel->data_surfaces = (msurface_t *)data;data += loadmodel->num_surfaces * sizeof(msurface_t); loadmodel->surfacelist = (int *)data;data += loadmodel->num_surfaces * sizeof(int); loadmodel->meshlist = (surfmesh_t **)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *); @@ -1575,7 +1575,7 @@ void Mod_DARKPLACESMODEL_Load(model_t *mod, void *buffer, void *bufferend) // to find out how many weights exist we two a two-stage load... mesh->num_vertexboneweights = 0; - data = (qbyte *) (pbase + BigLong(dpmmesh->ofs_verts)); + data = (unsigned char *) (pbase + BigLong(dpmmesh->ofs_verts)); for (j = 0;j < mesh->num_vertices;j++) { int numweights = BigLong(((dpmvertex_t *)data)->numbones); @@ -1608,7 +1608,7 @@ void Mod_DARKPLACESMODEL_Load(model_t *mod, void *buffer, void *bufferend) // now load them for real mesh->num_vertexboneweights = 0; - data = (qbyte *) (pbase + BigLong(dpmmesh->ofs_verts)); + data = (unsigned char *) (pbase + BigLong(dpmmesh->ofs_verts)); for (j = 0;j < mesh->num_vertices;j++) { int numweights = BigLong(((dpmvertex_t *)data)->numbones); diff --git a/model_brush.c b/model_brush.c index cd92bb8c..8622d3d0 100644 --- a/model_brush.c +++ b/model_brush.c @@ -83,7 +83,7 @@ static mleaf_t *Mod_Q1BSP_PointInLeaf(model_t *model, const vec3_t p) return (mleaf_t *)node; } -static void Mod_Q1BSP_AmbientSoundLevelsForPoint(model_t *model, const vec3_t p, qbyte *out, int outsize) +static void Mod_Q1BSP_AmbientSoundLevelsForPoint(model_t *model, const vec3_t p, unsigned char *out, int outsize) { int i; mleaf_t *leaf; @@ -166,7 +166,7 @@ static int Mod_Q1BSP_FindBoxClusters(model_t *model, const vec3_t mins, const ve return numclusters; } -static int Mod_Q1BSP_BoxTouchingPVS(model_t *model, const qbyte *pvs, const vec3_t mins, const vec3_t maxs) +static int Mod_Q1BSP_BoxTouchingPVS(model_t *model, const unsigned char *pvs, const vec3_t mins, const vec3_t maxs) { int nodestackindex = 0; mnode_t *node, *nodestack[1024]; @@ -235,7 +235,7 @@ static int Mod_Q1BSP_BoxTouchingPVS(model_t *model, const qbyte *pvs, const vec3 return false; } -static int Mod_Q1BSP_BoxTouchingLeafPVS(model_t *model, const qbyte *pvs, const vec3_t mins, const vec3_t maxs) +static int Mod_Q1BSP_BoxTouchingLeafPVS(model_t *model, const unsigned char *pvs, const vec3_t mins, const vec3_t maxs) { int nodestackindex = 0; mnode_t *node, *nodestack[1024]; @@ -304,7 +304,7 @@ static int Mod_Q1BSP_BoxTouchingLeafPVS(model_t *model, const qbyte *pvs, const return false; } -static int Mod_Q1BSP_BoxTouchingVisibleLeafs(model_t *model, const qbyte *visibleleafs, const vec3_t mins, const vec3_t maxs) +static int Mod_Q1BSP_BoxTouchingVisibleLeafs(model_t *model, const unsigned char *visibleleafs, const vec3_t mins, const vec3_t maxs) { int nodestackindex = 0; mnode_t *node, *nodestack[1024]; @@ -973,7 +973,7 @@ loc0: if (ds >= 0 && ds < surface->lightmapinfo->extents[0] && dt >= 0 && dt < surface->lightmapinfo->extents[1]) { - qbyte *lightmap; + unsigned char *lightmap; int lmwidth, lmheight, 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; lmwidth = ((surface->lightmapinfo->extents[0]>>4)+1); lmheight = ((surface->lightmapinfo->extents[1]>>4)+1); @@ -1046,10 +1046,10 @@ void Mod_Q1BSP_LightPoint(model_t *model, const vec3_t p, vec3_t ambientcolor, v Mod_Q1BSP_LightPoint_RecursiveBSPNode(model, ambientcolor, diffusecolor, diffusenormal, model->brush.data_nodes + model->brushq1.hulls[0].firstclipnode, p[0], p[1], p[2], p[2] - 65536); } -static void Mod_Q1BSP_DecompressVis(const qbyte *in, const qbyte *inend, qbyte *out, qbyte *outend) +static void Mod_Q1BSP_DecompressVis(const unsigned char *in, const unsigned char *inend, unsigned char *out, unsigned char *outend) { int c; - qbyte *outstart = out; + unsigned char *outstart = out; while (out < outend) { if (in == inend) @@ -1087,7 +1087,7 @@ R_Q1BSP_LoadSplitSky A sky texture is 256*128, with the right side being a masked overlay ============== */ -void R_Q1BSP_LoadSplitSky (qbyte *src, int width, int height, int bytesperpixel) +void R_Q1BSP_LoadSplitSky (unsigned char *src, int width, int height, int bytesperpixel) { int i, j; unsigned solidpixels[128*128], alphapixels[128*128]; @@ -1147,8 +1147,8 @@ void R_Q1BSP_LoadSplitSky (qbyte *src, int width, int height, int bytesperpixel) } } - loadmodel->brush.solidskytexture = R_LoadTexture2D(loadmodel->texturepool, "sky_solidtexture", 128, 128, (qbyte *) solidpixels, TEXTYPE_RGBA, TEXF_PRECACHE, NULL); - loadmodel->brush.alphaskytexture = R_LoadTexture2D(loadmodel->texturepool, "sky_alphatexture", 128, 128, (qbyte *) alphapixels, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE, NULL); + loadmodel->brush.solidskytexture = R_LoadTexture2D(loadmodel->texturepool, "sky_solidtexture", 128, 128, (unsigned char *) solidpixels, TEXTYPE_RGBA, TEXF_PRECACHE, NULL); + loadmodel->brush.alphaskytexture = R_LoadTexture2D(loadmodel->texturepool, "sky_alphatexture", 128, 128, (unsigned char *) alphapixels, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE, NULL); } static void Mod_Q1BSP_LoadTextures(lump_t *l) @@ -1157,7 +1157,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l) miptex_t *dmiptex; texture_t *tx, *tx2, *anims[10], *altanims[10]; dmiptexlump_t *m; - qbyte *data, *mtdata; + unsigned char *data, *mtdata; char name[256]; loadmodel->data_textures = NULL; @@ -1209,7 +1209,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l) dofs[i] = LittleLong(dofs[i]); if (dofs[i] == -1 || r_nosurftextures.integer) continue; - dmiptex = (miptex_t *)((qbyte *)m + dofs[i]); + dmiptex = (miptex_t *)((unsigned char *)m + dofs[i]); // make sure name is no more than 15 characters for (j = 0;dmiptex->name[j] && j < 15;j++) @@ -1228,7 +1228,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l) Con_Printf("Texture \"%s\" in \"%s\"is corrupt or incomplete\n", dmiptex->name, loadmodel->name); continue; } - mtdata = (qbyte *)dmiptex + j; + mtdata = (unsigned char *)dmiptex + j; } if ((mtwidth & 15) || (mtheight & 15)) @@ -1273,7 +1273,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l) if (loadmodel->brush.ishlbsp) { // internal texture overrides wad - qbyte *pixels, *freepixels, *fogpixels; + unsigned char *pixels, *freepixels, *fogpixels; pixels = freepixels = NULL; if (mtdata) pixels = W_ConvertWAD3Texture(dmiptex); @@ -1286,7 +1286,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l) tx->skin.base = tx->skin.merged = R_LoadTexture2D(loadmodel->texturepool, tx->name, image_width, image_height, pixels, TEXTYPE_RGBA, TEXF_MIPMAP | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, NULL); if (Image_CheckAlpha(pixels, image_width * image_height, true)) { - fogpixels = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4); + fogpixels = (unsigned char *)Mem_Alloc(tempmempool, image_width * image_height * 4); for (j = 0;j < image_width * image_height * 4;j += 4) { fogpixels[j + 0] = 255; @@ -1454,18 +1454,18 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l) static void Mod_Q1BSP_LoadLighting(lump_t *l) { int i; - qbyte *in, *out, *data, d; + unsigned char *in, *out, *data, d; char litfilename[1024]; loadmodel->brushq1.lightdata = NULL; if (loadmodel->brush.ishlbsp) // LordHavoc: load the colored lighting data straight { - loadmodel->brushq1.lightdata = (qbyte *)Mem_Alloc(loadmodel->mempool, l->filelen); + loadmodel->brushq1.lightdata = (unsigned char *)Mem_Alloc(loadmodel->mempool, l->filelen); for (i=0; ifilelen; i++) loadmodel->brushq1.lightdata[i] = mod_base[l->fileofs+i] >>= 1; } else if (loadmodel->brush.ismcbsp) { - loadmodel->brushq1.lightdata = (qbyte *)Mem_Alloc(loadmodel->mempool, l->filelen); + loadmodel->brushq1.lightdata = (unsigned char *)Mem_Alloc(loadmodel->mempool, l->filelen); memcpy(loadmodel->brushq1.lightdata, mod_base + l->fileofs, l->filelen); } else // LordHavoc: bsp version 29 (normal white lighting) @@ -1474,7 +1474,7 @@ static void Mod_Q1BSP_LoadLighting(lump_t *l) strlcpy (litfilename, loadmodel->name, sizeof (litfilename)); FS_StripExtension (litfilename, litfilename, sizeof (litfilename)); strlcat (litfilename, ".lit", sizeof (litfilename)); - data = (qbyte*) FS_LoadFile(litfilename, tempmempool, false); + data = (unsigned char*) FS_LoadFile(litfilename, tempmempool, false); if (data) { if (fs_filesize == (fs_offset_t)(8 + l->filelen * 3) && data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T') @@ -1483,7 +1483,7 @@ static void Mod_Q1BSP_LoadLighting(lump_t *l) if (i == 1) { Con_DPrintf("loaded %s\n", litfilename); - loadmodel->brushq1.lightdata = (qbyte *)Mem_Alloc(loadmodel->mempool, fs_filesize - 8); + loadmodel->brushq1.lightdata = (unsigned char *)Mem_Alloc(loadmodel->mempool, fs_filesize - 8); memcpy(loadmodel->brushq1.lightdata, data + 8, fs_filesize - 8); Mem_Free(data); return; @@ -1506,7 +1506,7 @@ static void Mod_Q1BSP_LoadLighting(lump_t *l) // LordHavoc: oh well, expand the white lighting data if (!l->filelen) return; - loadmodel->brushq1.lightdata = (qbyte *)Mem_Alloc(loadmodel->mempool, l->filelen*3); + loadmodel->brushq1.lightdata = (unsigned char *)Mem_Alloc(loadmodel->mempool, l->filelen*3); in = loadmodel->brushq1.lightdata + l->filelen*2; // place the file at the end, so it will not be overwritten until the very last write out = loadmodel->brushq1.lightdata; memcpy(in, mod_base + l->fileofs, l->filelen); @@ -1589,7 +1589,7 @@ static void Mod_Q1BSP_LoadVisibility(lump_t *l) if (!l->filelen) return; loadmodel->brushq1.num_compressedpvs = l->filelen; - loadmodel->brushq1.data_compressedpvs = (qbyte *)Mem_Alloc(loadmodel->mempool, l->filelen); + loadmodel->brushq1.data_compressedpvs = (unsigned char *)Mem_Alloc(loadmodel->mempool, l->filelen); memcpy(loadmodel->brushq1.data_compressedpvs, mod_base + l->fileofs, l->filelen); } @@ -1691,7 +1691,7 @@ static void Mod_Q1BSP_LoadVertexes(lump_t *l) // The following two functions should be removed and MSG_* or SZ_* function sets adjusted so they // can be used for this // REMOVEME -int SB_ReadInt (qbyte **buffer) +int SB_ReadInt (unsigned char **buffer) { int i; i = ((*buffer)[0]) + 256*((*buffer)[1]) + 65536*((*buffer)[2]) + 16777216*((*buffer)[3]); @@ -1700,7 +1700,7 @@ int SB_ReadInt (qbyte **buffer) } // REMOVEME -float SB_ReadFloat (qbyte **buffer) +float SB_ReadFloat (unsigned char **buffer) { union { @@ -1714,11 +1714,11 @@ float SB_ReadFloat (qbyte **buffer) static void Mod_Q1BSP_LoadSubmodels(lump_t *l, hullinfo_t *hullinfo) { - qbyte *index; + unsigned char *index; dmodel_t *out; int i, j, count; - index = (qbyte *)(mod_base + l->fileofs); + index = (unsigned char *)(mod_base + l->fileofs); if (l->filelen % (48+4*hullinfo->filehulls)) Host_Error ("Mod_Q1BSP_LoadSubmodels: funny lump size in %s", loadmodel->name); @@ -2101,7 +2101,7 @@ static void Mod_Q1BSP_LoadFaces(lump_t *l) // give non-lightmapped water a 1x white lightmap if ((surface->texture->basematerialflags & MATERIALFLAG_WATER) && (surface->lightmapinfo->texinfo->flags & TEX_SPECIAL) && ssize <= 256 && tsize <= 256) { - surface->lightmapinfo->samples = (qbyte *)Mem_Alloc(loadmodel->mempool, ssize * tsize * 3); + surface->lightmapinfo->samples = (unsigned char *)Mem_Alloc(loadmodel->mempool, ssize * tsize * 3); surface->lightmapinfo->styles[0] = 0; memset(surface->lightmapinfo->samples, 128, ssize * tsize * 3); } @@ -2119,7 +2119,7 @@ static void Mod_Q1BSP_LoadFaces(lump_t *l) if (ssize > 256 || tsize > 256) Host_Error("Bad surface extents"); // stainmap for permanent marks on walls - surface->lightmapinfo->stainsamples = (qbyte *)Mem_Alloc(loadmodel->mempool, ssize * tsize * 3); + surface->lightmapinfo->stainsamples = (unsigned char *)Mem_Alloc(loadmodel->mempool, ssize * tsize * 3); // clear to white memset(surface->lightmapinfo->stainsamples, 255, ssize * tsize * 3); @@ -2405,7 +2405,7 @@ static void Mod_Q1BSP_LoadMapBrushes(void) char mapfilename[MAX_QPATH]; FS_StripExtension (loadmodel->name, mapfilename, sizeof (mapfilename)); strlcat (mapfilename, ".map", sizeof (mapfilename)); - maptext = (qbyte*) FS_LoadFile(mapfilename, tempmempool, false); + maptext = (unsigned char*) FS_LoadFile(mapfilename, tempmempool, false); if (!maptext) return; text = maptext; @@ -2577,7 +2577,7 @@ static void Mod_Q1BSP_FinalizePortals(void) } loadmodel->brush.data_portals = (mportal_t *)Mem_Alloc(loadmodel->mempool, numportals * sizeof(mportal_t) + numpoints * sizeof(mvertex_t)); loadmodel->brush.num_portals = numportals; - loadmodel->brush.data_portalpoints = (mvertex_t *)((qbyte *) loadmodel->brush.data_portals + numportals * sizeof(mportal_t)); + loadmodel->brush.data_portalpoints = (mvertex_t *)((unsigned char *) loadmodel->brush.data_portals + numportals * sizeof(mportal_t)); loadmodel->brush.num_portalpoints = numpoints; // clear all leaf portal chains for (i = 0;i < loadmodel->brush.num_leafs;i++) @@ -2899,7 +2899,7 @@ static void Mod_Q1BSP_BuildLightmapUpdateChains(mempool_t *mempool, model_t *mod } if (!totalcount) return; - model->brushq1.light_style = (qbyte *)Mem_Alloc(mempool, model->brushq1.light_styles * sizeof(qbyte)); + model->brushq1.light_style = (unsigned char *)Mem_Alloc(mempool, model->brushq1.light_styles * sizeof(unsigned char)); model->brushq1.light_stylevalue = (int *)Mem_Alloc(mempool, model->brushq1.light_styles * sizeof(int)); model->brushq1.light_styleupdatechains = (msurface_t ***)Mem_Alloc(mempool, model->brushq1.light_styles * sizeof(msurface_t **)); model->brushq1.light_styleupdatechainsbuffer = (msurface_t **)Mem_Alloc(mempool, totalcount * sizeof(msurface_t *)); @@ -2931,7 +2931,7 @@ static void Mod_Q1BSP_BuildLightmapUpdateChains(mempool_t *mempool, model_t *mod //Returns PVS data for a given point //(note: can return NULL) -static qbyte *Mod_Q1BSP_GetPVS(model_t *model, const vec3_t p) +static unsigned char *Mod_Q1BSP_GetPVS(model_t *model, const vec3_t p) { mnode_t *node; node = model->brush.data_nodes; @@ -2943,7 +2943,7 @@ static qbyte *Mod_Q1BSP_GetPVS(model_t *model, const vec3_t p) return NULL; } -static void Mod_Q1BSP_FatPVS_RecursiveBSPNode(model_t *model, const vec3_t org, vec_t radius, qbyte *pvsbuffer, int pvsbytes, mnode_t *node) +static void Mod_Q1BSP_FatPVS_RecursiveBSPNode(model_t *model, const vec3_t org, vec_t radius, unsigned char *pvsbuffer, int pvsbytes, mnode_t *node) { while (node->plane) { @@ -2963,7 +2963,7 @@ static void Mod_Q1BSP_FatPVS_RecursiveBSPNode(model_t *model, const vec3_t org, if (((mleaf_t *)node)->clusterindex >= 0) { int i; - qbyte *pvs = model->brush.data_pvsclusters + ((mleaf_t *)node)->clusterindex * model->brush.num_pvsclusterbytes; + unsigned char *pvs = model->brush.data_pvsclusters + ((mleaf_t *)node)->clusterindex * model->brush.num_pvsclusterbytes; for (i = 0;i < pvsbytes;i++) pvsbuffer[i] |= pvs[i]; } @@ -2971,7 +2971,7 @@ static void Mod_Q1BSP_FatPVS_RecursiveBSPNode(model_t *model, const vec3_t org, //Calculates a PVS that is the inclusive or of all leafs within radius pixels //of the given point. -static int Mod_Q1BSP_FatPVS(model_t *model, const vec3_t org, vec_t radius, qbyte *pvsbuffer, int pvsbufferlength) +static int Mod_Q1BSP_FatPVS(model_t *model, const vec3_t org, vec_t radius, unsigned char *pvsbuffer, int pvsbufferlength) { int bytes = model->brush.num_pvsclusterbytes; bytes = min(bytes, pvsbufferlength); @@ -3043,12 +3043,12 @@ void Mod_Q1BSP_Load(model_t *mod, void *buffer, void *bufferend) if (!memcmp (buffer, "MCBSPpad", 8)) { - qbyte *index; + unsigned char *index; mod->brush.ismcbsp = true; mod->brush.ishlbsp = false; - mod_base = (qbyte*)buffer; + mod_base = (unsigned char*)buffer; index = mod_base; index += 8; @@ -3116,7 +3116,7 @@ void Mod_Q1BSP_Load(model_t *mod, void *buffer, void *bufferend) } // read lumps - mod_base = (qbyte*)buffer; + mod_base = (unsigned char*)buffer; for (i = 0; i < HEADER_LUMPS; i++) { header->lumps[i].fileofs = LittleLong(header->lumps[i].fileofs); @@ -3745,7 +3745,7 @@ void static Mod_Q2BSP_Load(model_t *mod, void *buffer, void *bufferend) Cvar_SetValue("mcbsp", mod->brush.ismcbsp); } - mod_base = (qbyte *)header; + mod_base = (unsigned char *)header; // swap all the lumps for (i = 0;i < (int) sizeof(*header) / 4;i++) @@ -4924,7 +4924,7 @@ static void Mod_Q3BSP_LoadPVS(lump_t *l) Host_Error("Mod_Q3BSP_LoadPVS: lump too small ((numclusters = %i) * (chainlength = %i) + sizeof(q3dpvs_t) == %i bytes, lump is %i bytes)\n", loadmodel->brush.num_pvsclusters, loadmodel->brush.num_pvsclusterbytes, totalchains + sizeof(*in), l->filelen); loadmodel->brush.data_pvsclusters = (unsigned char *)Mem_Alloc(loadmodel->mempool, totalchains); - memcpy(loadmodel->brush.data_pvsclusters, (qbyte *)(in + 1), totalchains); + memcpy(loadmodel->brush.data_pvsclusters, (unsigned char *)(in + 1), totalchains); } static void Mod_Q3BSP_LightPoint(model_t *model, const vec3_t p, vec3_t ambientcolor, vec3_t diffusecolor, vec3_t diffusenormal) @@ -5697,7 +5697,7 @@ void Mod_Q3BSP_Load(model_t *mod, void *buffer, void *bufferend) mod->DrawShadowVolume = R_Q1BSP_DrawShadowVolume; mod->DrawLight = R_Q1BSP_DrawLight; - mod_base = (qbyte *)header; + mod_base = (unsigned char *)header; // swap all the lumps header->ident = LittleLong(header->ident); diff --git a/model_brush.h b/model_brush.h index 7fe0a591..bcb79f10 100644 --- a/model_brush.h +++ b/model_brush.h @@ -134,7 +134,7 @@ typedef struct mleaf_s int *firstleafsurface; int numleafbrushes; // q3bsp int *firstleafbrush; // q3bsp - qbyte ambient_sound_level[NUM_AMBIENTS]; // q1bsp + unsigned char ambient_sound_level[NUM_AMBIENTS]; // q1bsp int contents; // q1bsp: // TODO: remove (only used temporarily during loading when making collision hull 0) int portalmarkid; // q1bsp // used by see-polygon-through-portals visibility checker } diff --git a/model_shared.c b/model_shared.c index e100139c..6b3a8e79 100644 --- a/model_shared.c +++ b/model_shared.c @@ -153,7 +153,7 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean checkdisk, qboolea buf = FS_LoadFile (mod->name, tempmempool, false); if (buf) { - crc = CRC_Block((qbyte *)buf, fs_filesize); + crc = CRC_Block((unsigned char *)buf, fs_filesize); if (mod->crc != crc) mod->loaded = false; } @@ -328,7 +328,7 @@ model_t *Mod_ForName(const char *name, qboolean crash, qboolean checkdisk, qbool return model; } -qbyte *mod_base; +unsigned char *mod_base; //============================================================================= @@ -365,8 +365,8 @@ static void Mod_Precache(void) int Mod_BuildVertexRemapTableFromElements(int numelements, const int *elements, int numvertices, int *remapvertices) { int i, count; - qbyte *used; - used = (qbyte *)Mem_Alloc(tempmempool, numvertices); + unsigned char *used; + used = (unsigned char *)Mem_Alloc(tempmempool, numvertices); memset(used, 0, numvertices); for (i = 0;i < numelements;i++) used[elements[i]] = 1; @@ -639,11 +639,11 @@ void Mod_BuildTextureVectorsAndNormals(int firstvertex, int numvertices, int num surfmesh_t *Mod_AllocSurfMesh(mempool_t *mempool, int numvertices, int numtriangles, qboolean lightmapoffsets, qboolean vertexcolors, qboolean neighbors) { surfmesh_t *mesh; - qbyte *data; + unsigned char *data; mesh = (surfmesh_t *)Mem_Alloc(mempool, sizeof(surfmesh_t) + numvertices * (3 + 3 + 3 + 3 + 2 + 2 + (vertexcolors ? 4 : 0)) * sizeof(float) + numvertices * (lightmapoffsets ? 1 : 0) * sizeof(int) + numtriangles * (3 + (neighbors ? 3 : 0)) * sizeof(int)); mesh->num_vertices = numvertices; mesh->num_triangles = numtriangles; - data = (qbyte *)(mesh + 1); + data = (unsigned char *)(mesh + 1); if (mesh->num_vertices) { mesh->data_vertex3f = (float *)data, data += sizeof(float[3]) * mesh->num_vertices; @@ -669,7 +669,7 @@ surfmesh_t *Mod_AllocSurfMesh(mempool_t *mempool, int numvertices, int numtriang shadowmesh_t *Mod_ShadowMesh_Alloc(mempool_t *mempool, int maxverts, int maxtriangles, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, int light, int neighbors, int expandable) { shadowmesh_t *newmesh; - qbyte *data; + unsigned char *data; int size; size = sizeof(shadowmesh_t); size += maxverts * sizeof(float[3]); @@ -680,7 +680,7 @@ shadowmesh_t *Mod_ShadowMesh_Alloc(mempool_t *mempool, int maxverts, int maxtria size += maxtriangles * sizeof(int[3]); if (expandable) size += SHADOWMESHVERTEXHASH * sizeof(shadowmeshvertexhash_t *) + maxverts * sizeof(shadowmeshvertexhash_t); - data = (qbyte *)Mem_Alloc(mempool, size); + data = (unsigned char *)Mem_Alloc(mempool, size); newmesh = (shadowmesh_t *)data;data += sizeof(*newmesh); newmesh->map_diffuse = map_diffuse; newmesh->map_specular = map_specular; @@ -908,11 +908,11 @@ void Mod_ShadowMesh_Free(shadowmesh_t *mesh) } } -static rtexture_t *GL_TextureForSkinLayer(const qbyte *in, int width, int height, const char *name, const unsigned int *palette, int textureflags) +static rtexture_t *GL_TextureForSkinLayer(const unsigned char *in, int width, int height, const char *name, const unsigned int *palette, int textureflags) { int i; for (i = 0;i < width*height;i++) - if (((qbyte *)&palette[in[i]])[3] > 0) + if (((unsigned char *)&palette[in[i]])[3] > 0) return R_LoadTexture2D (loadmodel->texturepool, name, width, height, in, TEXTYPE_PALETTE, textureflags, palette); return NULL; } @@ -947,15 +947,15 @@ int Mod_LoadSkinFrame(skinframe_t *skinframe, char *basename, int textureflags, return true; } -int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int loadglowtexture, qbyte *skindata, int width, int height) +int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int loadglowtexture, unsigned char *skindata, int width, int height) { - qbyte *temp1, *temp2; + unsigned char *temp1, *temp2; memset(skinframe, 0, sizeof(*skinframe)); if (!skindata) return false; if (r_shadow_bumpscale_basetexture.value > 0) { - temp1 = (qbyte *)Mem_Alloc(loadmodel->mempool, width * height * 8); + temp1 = (unsigned char *)Mem_Alloc(loadmodel->mempool, width * height * 8); temp2 = temp1 + width * height * 4; Image_Copy8bitRGBA(skindata, temp1, width * height, palette_nofullbrights); Image_HeightmapToNormalmap(temp1, temp2, width, height, false, r_shadow_bumpscale_basetexture.value); @@ -990,7 +990,7 @@ int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textu return true; } -void Mod_GetTerrainVertex3fTexCoord2fFromRGBA(const qbyte *imagepixels, int imagewidth, int imageheight, int ix, int iy, float *vertex3f, float *texcoord2f, matrix4x4_t *pixelstepmatrix, matrix4x4_t *pixeltexturestepmatrix) +void Mod_GetTerrainVertex3fTexCoord2fFromRGBA(const unsigned char *imagepixels, int imagewidth, int imageheight, int ix, int iy, float *vertex3f, float *texcoord2f, matrix4x4_t *pixelstepmatrix, matrix4x4_t *pixeltexturestepmatrix) { float v[3], tc[3]; v[0] = ix; @@ -1005,7 +1005,7 @@ void Mod_GetTerrainVertex3fTexCoord2fFromRGBA(const qbyte *imagepixels, int imag texcoord2f[1] = tc[1]; } -void Mod_GetTerrainVertexFromRGBA(const qbyte *imagepixels, int imagewidth, int imageheight, int ix, int iy, float *vertex3f, float *svector3f, float *tvector3f, float *normal3f, float *texcoord2f, matrix4x4_t *pixelstepmatrix, matrix4x4_t *pixeltexturestepmatrix) +void Mod_GetTerrainVertexFromRGBA(const unsigned char *imagepixels, int imagewidth, int imageheight, int ix, int iy, float *vertex3f, float *svector3f, float *tvector3f, float *normal3f, float *texcoord2f, matrix4x4_t *pixelstepmatrix, matrix4x4_t *pixeltexturestepmatrix) { float vup[3], vdown[3], vleft[3], vright[3]; float tcup[3], tcdown[3], tcleft[3], tcright[3]; @@ -1030,7 +1030,7 @@ void Mod_GetTerrainVertexFromRGBA(const qbyte *imagepixels, int imagewidth, int VectorAdd(normal3f, nl, normal3f); } -void Mod_ConstructTerrainPatchFromRGBA(const qbyte *imagepixels, int imagewidth, int imageheight, int x1, int y1, int width, int height, int *element3i, int *neighbor3i, float *vertex3f, float *svector3f, float *tvector3f, float *normal3f, float *texcoord2f, matrix4x4_t *pixelstepmatrix, matrix4x4_t *pixeltexturestepmatrix) +void Mod_ConstructTerrainPatchFromRGBA(const unsigned char *imagepixels, int imagewidth, int imageheight, int x1, int y1, int width, int height, int *element3i, int *neighbor3i, float *vertex3f, float *svector3f, float *tvector3f, float *normal3f, float *texcoord2f, matrix4x4_t *pixelstepmatrix, matrix4x4_t *pixeltexturestepmatrix) { int x, y, ix, iy, *e; e = element3i; diff --git a/model_shared.h b/model_shared.h index 3dc5644b..4af1f029 100644 --- a/model_shared.h +++ b/model_shared.h @@ -236,11 +236,11 @@ typedef struct msurface_lightmapinfo_s // texture mapping properties used by this surface mtexinfo_t *texinfo; // q1bsp // index into r_refdef.lightstylevalue array, 255 means not used (black) - qbyte styles[MAXLIGHTMAPS]; // q1bsp + unsigned char styles[MAXLIGHTMAPS]; // q1bsp // RGB lighting data [numstyles][height][width][3] - qbyte *samples; // q1bsp + unsigned char *samples; // q1bsp // stain to apply on lightmap (soot/dirt/blood/whatever) - qbyte *stainsamples; // q1bsp + unsigned char *stainsamples; // q1bsp // the stride when building lightmaps to comply with fragment update int lightmaptexturestride; // q1bsp int texturemins[2]; // q1bsp @@ -362,17 +362,17 @@ typedef struct model_brush_s // common functions int (*SuperContentsFromNativeContents)(struct model_s *model, int nativecontents); int (*NativeContentsFromSuperContents)(struct model_s *model, int supercontents); - qbyte *(*GetPVS)(struct model_s *model, const vec3_t p); - int (*FatPVS)(struct model_s *model, const vec3_t org, vec_t radius, qbyte *pvsbuffer, int pvsbufferlength); - int (*BoxTouchingPVS)(struct model_s *model, const qbyte *pvs, const vec3_t mins, const vec3_t maxs); - int (*BoxTouchingLeafPVS)(struct model_s *model, const qbyte *pvs, const vec3_t mins, const vec3_t maxs); - int (*BoxTouchingVisibleLeafs)(struct model_s *model, const qbyte *visibleleafs, const vec3_t mins, const vec3_t maxs); + unsigned char *(*GetPVS)(struct model_s *model, const vec3_t p); + int (*FatPVS)(struct model_s *model, const vec3_t org, vec_t radius, unsigned char *pvsbuffer, int pvsbufferlength); + int (*BoxTouchingPVS)(struct model_s *model, const unsigned char *pvs, const vec3_t mins, const vec3_t maxs); + int (*BoxTouchingLeafPVS)(struct model_s *model, const unsigned char *pvs, const vec3_t mins, const vec3_t maxs); + int (*BoxTouchingVisibleLeafs)(struct model_s *model, const unsigned char *visibleleafs, const vec3_t mins, const vec3_t maxs); int (*FindBoxClusters)(struct model_s *model, const vec3_t mins, const vec3_t maxs, int maxclusters, int *clusterlist); void (*LightPoint)(struct model_s *model, const vec3_t p, vec3_t ambientcolor, vec3_t diffusecolor, vec3_t diffusenormal); void (*FindNonSolidLocation)(struct model_s *model, const vec3_t in, vec3_t out, vec_t radius); mleaf_t *(*PointInLeaf)(struct model_s *model, const float *p); // these are actually only found on brushq1, but NULL is handled gracefully - void (*AmbientSoundLevelsForPoint)(struct model_s *model, const vec3_t p, qbyte *out, int outsize); + void (*AmbientSoundLevelsForPoint)(struct model_s *model, const vec3_t p, unsigned char *out, int outsize); void (*RoundUpToHullSize)(struct model_s *cmodel, const vec3_t inmins, const vec3_t inmaxs, vec3_t outmins, vec3_t outmaxs); char skybox[64]; @@ -407,17 +407,17 @@ typedef struct model_brushq1_s hull_t hulls[MAX_MAP_HULLS]; int num_compressedpvs; - qbyte *data_compressedpvs; + unsigned char *data_compressedpvs; int num_lightdata; - qbyte *lightdata; + unsigned char *lightdata; int numlights; mlight_t *lights; // lightmap update chains for light styles int light_styles; - qbyte *light_style; + unsigned char *light_style; int *light_stylevalue; msurface_t ***light_styleupdatechains; msurface_t **light_styleupdatechainsbuffer; @@ -549,7 +549,7 @@ typedef struct model_s // draw the model using lightmap/dlight shading void(*Draw)(struct entity_render_s *ent); // gathers info on which clusters and surfaces are lit by light, as well as calculating a bounding box - void(*GetLightInfo)(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, qbyte *outleafpvs, int *outnumleafspointer, int *outsurfacelist, qbyte *outsurfacepvs, int *outnumsurfacespointer); + void(*GetLightInfo)(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, unsigned char *outleafpvs, int *outnumleafspointer, int *outsurfacelist, unsigned char *outsurfacepvs, int *outnumsurfacespointer); // compile a shadow volume for the model based on light source void(*CompileShadowVolume)(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, int numsurfaces, const int *surfacelist); // draw a shadow volume for the model based on light source @@ -577,7 +577,7 @@ model_t; // model loading extern model_t *loadmodel; -extern qbyte *mod_base; +extern unsigned char *mod_base; // sky/water subdivision //extern cvar_t gl_subdivide_size; // texture fullbrights @@ -616,7 +616,7 @@ void Mod_ShadowMesh_CalcBBox(shadowmesh_t *firstmesh, vec3_t mins, vec3_t maxs, void Mod_ShadowMesh_Free(shadowmesh_t *mesh); int Mod_LoadSkinFrame(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int loadglowtexture); -int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int loadglowtexture, qbyte *skindata, int width, int height); +int Mod_LoadSkinFrame_Internal(skinframe_t *skinframe, char *basename, int textureflags, int loadpantsandshirt, int loadglowtexture, unsigned char *skindata, int width, int height); extern cvar_t r_mipskins; @@ -652,7 +652,7 @@ int Mod_Q1BSP_SuperContentsFromNativeContents(struct model_s *model, int nativec struct entity_render_s; void R_Q1BSP_DrawSky(struct entity_render_s *ent); void R_Q1BSP_Draw(struct entity_render_s *ent); -void R_Q1BSP_GetLightInfo(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, qbyte *outleafpvs, int *outnumleafspointer, int *outsurfacelist, qbyte *outsurfacepvs, int *outnumsurfacespointer); +void R_Q1BSP_GetLightInfo(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, vec3_t outmins, vec3_t outmaxs, int *outleaflist, unsigned char *outleafpvs, int *outnumleafspointer, int *outsurfacelist, unsigned char *outsurfacepvs, int *outnumsurfacespointer); void R_Q1BSP_CompileShadowVolume(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, int numsurfaces, const int *surfacelist); void R_Q1BSP_DrawShadowVolume(struct entity_render_s *ent, vec3_t relativelightorigin, float lightradius, int numsurfaces, const int *surfacelist, const vec3_t lightmins, const vec3_t lightmaxs); void R_Q1BSP_DrawLight(struct entity_render_s *ent, vec3_t lightcolorbase, vec3_t lightcolorpants, vec3_t lightcolorshirt, int numsurfaces, const int *surfacelist); diff --git a/model_sprite.c b/model_sprite.c index b6c69c27..acab785a 100644 --- a/model_sprite.c +++ b/model_sprite.c @@ -38,7 +38,7 @@ void Mod_SpriteInit (void) } static int alphaonlytable[4] = {255 | 0x80000000, 255 | 0x80000000, 255 | 0x80000000, 3}; -static void Mod_Sprite_SharedSetup(const qbyte *datapointer, int version, const unsigned int *palette, const unsigned int *alphapalette) +static void Mod_Sprite_SharedSetup(const unsigned char *datapointer, int version, const unsigned int *palette, const unsigned int *alphapalette) { int i, j, groupframes, realframes, x, y, origin[2], width, height; dspriteframetype_t *pinframetype; @@ -47,7 +47,7 @@ static void Mod_Sprite_SharedSetup(const qbyte *datapointer, int version, const dspriteinterval_t *pinintervals; float modelradius, interval; char name[MAX_QPATH], fogname[MAX_QPATH]; - qbyte *pixbuf; + unsigned char *pixbuf; const void *startframes; modelradius = 0; @@ -100,7 +100,7 @@ static void Mod_Sprite_SharedSetup(const qbyte *datapointer, int version, const loadmodel->animscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numframes); loadmodel->sprite.sprdata_frames = (mspriteframe_t *)Mem_Alloc(loadmodel->mempool, sizeof(mspriteframe_t) * realframes); - datapointer = (qbyte *)startframes; + datapointer = (unsigned char *)startframes; realframes = 0; for (i = 0;i < loadmodel->numframes;i++) { @@ -172,7 +172,7 @@ static void Mod_Sprite_SharedSetup(const qbyte *datapointer, int version, const { loadmodel->sprite.sprdata_frames[realframes].texture = R_LoadTexture2D(loadmodel->texturepool, name, width, height, datapointer, TEXTYPE_RGBA, TEXF_ALPHA | (r_mipsprites.integer ? TEXF_MIPMAP : 0) | TEXF_CLAMP | TEXF_PRECACHE | TEXF_PICMIP, NULL); // make fog version (just alpha) - pixbuf = (qbyte *)Mem_Alloc(tempmempool, width*height*4); + pixbuf = (unsigned char *)Mem_Alloc(tempmempool, width*height*4); Image_CopyMux(pixbuf, datapointer, width, height, false, false, false, 4, 4, alphaonlytable); loadmodel->sprite.sprdata_frames[realframes].fogtexture = R_LoadTexture2D(loadmodel->texturepool, fogname, width, height, pixbuf, TEXTYPE_RGBA, TEXF_ALPHA | (r_mipsprites.integer ? TEXF_MIPMAP : 0) | TEXF_CLAMP | TEXF_PRECACHE | TEXF_PICMIP, NULL); Mem_Free(pixbuf); @@ -207,9 +207,9 @@ extern void R_Model_Sprite_Draw(entity_render_t *ent); void Mod_IDSP_Load(model_t *mod, void *buffer, void *bufferend) { int version; - const qbyte *datapointer; + const unsigned char *datapointer; - datapointer = (qbyte *)buffer; + datapointer = (unsigned char *)buffer; loadmodel->type = mod_sprite; loadmodel->flags2 = EF_FULLBRIGHT; @@ -237,8 +237,8 @@ void Mod_IDSP_Load(model_t *mod, void *buffer, void *bufferend) else if (version == SPRITEHL_VERSION) { int i, rendermode; - qbyte palette[256][4], alphapalette[256][4]; - const qbyte *in; + unsigned char palette[256][4], alphapalette[256][4]; + const unsigned char *in; dspritehl_t *pinhlsprite; pinhlsprite = (dspritehl_t *)datapointer; diff --git a/modelgen.h b/modelgen.h index c399f5e4..0ddb7761 100644 --- a/modelgen.h +++ b/modelgen.h @@ -82,8 +82,8 @@ dtriangle_t; typedef struct trivertx_s { - qbyte v[3]; - qbyte lightnormalindex; + unsigned char v[3]; + unsigned char lightnormalindex; } trivertx_t; diff --git a/netconn.c b/netconn.c index 9afda91b..1ce0b0c8 100755 --- a/netconn.c +++ b/netconn.c @@ -45,7 +45,7 @@ static cvar_t sv_masters [] = static double nextheartbeattime = 0; sizebuf_t net_message; -static qbyte net_message_buf[NET_MAXMESSAGE]; +static unsigned char net_message_buf[NET_MAXMESSAGE]; cvar_t net_messagetimeout = {0, "net_messagetimeout","300"}; cvar_t net_messagerejointimeout = {0, "net_messagerejointimeout","10"}; @@ -81,8 +81,8 @@ int serverreplycount = 0; // this is only false if there are still servers left to query int serverlist_querysleep = true; -static qbyte sendbuffer[NET_HEADERSIZE+NET_MAXMESSAGE]; -static qbyte readbuffer[NET_HEADERSIZE+NET_MAXMESSAGE]; +static unsigned char sendbuffer[NET_HEADERSIZE+NET_MAXMESSAGE]; +static unsigned char readbuffer[NET_HEADERSIZE+NET_MAXMESSAGE]; int cl_numsockets; lhnetsocket_t *cl_sockets[16]; @@ -397,7 +397,7 @@ int NetConn_Read(lhnetsocket_t *mysocket, void *data, int maxlength, lhnetaddres { LHNETADDRESS_ToString(peeraddress, addressstring2, sizeof(addressstring2), true); Con_Printf("LHNET_Read(%p (%s), %p, %i, %p) = %i from %s:\n", mysocket, addressstring, data, maxlength, peeraddress, length, addressstring2); - Com_HexDumpToConsole((qbyte *)data, length); + Com_HexDumpToConsole((unsigned char *)data, length); } else Con_Printf("LHNET_Read(%p (%s), %p, %i, %p) = %i\n", mysocket, addressstring, data, maxlength, peeraddress, length); @@ -420,7 +420,7 @@ int NetConn_Write(lhnetsocket_t *mysocket, const void *data, int length, const l LHNETADDRESS_ToString(LHNET_AddressFromSocket(mysocket), addressstring, sizeof(addressstring), true); LHNETADDRESS_ToString(peeraddress, addressstring2, sizeof(addressstring2), true); Con_Printf("LHNET_Write(%p (%s), %p, %i, %p (%s)) = %i%s\n", mysocket, addressstring, data, length, peeraddress, addressstring2, length, ret == length ? "" : " (ERROR)"); - Com_HexDumpToConsole((qbyte *)data, length); + Com_HexDumpToConsole((unsigned char *)data, length); } return ret; } @@ -802,7 +802,7 @@ static void NetConn_UpdateServerStuff(void) } } -int NetConn_ReceivedMessage(netconn_t *conn, qbyte *data, int length) +int NetConn_ReceivedMessage(netconn_t *conn, unsigned char *data, int length) { unsigned int count; unsigned int flags; @@ -883,7 +883,7 @@ int NetConn_ReceivedMessage(netconn_t *conn, qbyte *data, int length) unsigned int temppacket[2]; temppacket[0] = BigLong(8 | NETFLAG_ACK); temppacket[1] = BigLong(sequence); - NetConn_Write(conn->mysocket, (qbyte *)temppacket, 8, &conn->peeraddress); + NetConn_Write(conn->mysocket, (unsigned char *)temppacket, 8, &conn->peeraddress); if (sequence == conn->receiveSequence) { conn->lastMessageTime = realtime; @@ -947,7 +947,7 @@ int NetConn_IsLocalGame(void) return false; } -int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, lhnetaddress_t *peeraddress) +int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *data, int length, lhnetaddress_t *peeraddress) { int ret, c, control; const char *s; @@ -1442,7 +1442,7 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg } extern void SV_SendServerinfo (client_t *client); -int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, lhnetaddress_t *peeraddress) +int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *data, int length, lhnetaddress_t *peeraddress) { int i, ret, clientnum, best; double besttime; @@ -1946,7 +1946,7 @@ void NetConn_Heartbeat(int priority) int NetConn_SendToAll(sizebuf_t *data, double blocktime) { int i, count = 0; - qbyte sent[MAX_SCOREBOARD]; + unsigned char sent[MAX_SCOREBOARD]; memset(sent, 0, sizeof(sent)); diff --git a/netconn.h b/netconn.h index 4c021544..1597f892 100755 --- a/netconn.h +++ b/netconn.h @@ -132,12 +132,12 @@ typedef struct netconn_s unsigned int sendSequence; unsigned int unreliableSendSequence; int sendMessageLength; - qbyte sendMessage[NET_MAXMESSAGE]; + unsigned char sendMessage[NET_MAXMESSAGE]; unsigned int receiveSequence; unsigned int unreliableReceiveSequence; int receiveMessageLength; - qbyte receiveMessage[NET_MAXMESSAGE]; + unsigned char receiveMessage[NET_MAXMESSAGE]; char address[128]; } netconn_t; @@ -299,9 +299,9 @@ netconn_t *NetConn_Open(lhnetsocket_t *mysocket, lhnetaddress_t *peeraddress); void NetConn_Close(netconn_t *conn); void NetConn_Listen(qboolean state); int NetConn_IsLocalGame(void); -//int NetConn_ReceivedMessage(netconn_t *conn, qbyte *data, int length); -//int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, lhnetaddress_t *peeraddress); -//int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, lhnetaddress_t *peeraddress); +//int NetConn_ReceivedMessage(netconn_t *conn, unsigned char *data, int length); +//int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *data, int length, lhnetaddress_t *peeraddress); +//int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *data, int length, lhnetaddress_t *peeraddress); void NetConn_ClientFrame(void); void NetConn_ServerFrame(void); void NetConn_QueryMasters(void); diff --git a/palette.c b/palette.c index d9cafbe4..67bcd0cc 100644 --- a/palette.c +++ b/palette.c @@ -12,7 +12,7 @@ unsigned int palette_alpha[256]; unsigned int palette_font[256]; // John Carmack said the quake palette.lmp can be considered public domain because it is not an important asset to id, so I include it here as a fallback if no external palette file is found. -qbyte host_quakepal[768] = +unsigned char host_quakepal[768] = { 0,0,0,15,15,15,31,31,31,47,47,47,63,63,63,75,75,75,91,91,91,107,107,107,123,123,123,139,139,139,155,155,155,171,171,171,187,187,187,203,203,203,219,219,219,235,235,235,15,11,7,23,15,11,31,23,11,39,27,15,47,35,19,55,43,23,63,47,23,75,55,27,83,59,27,91,67,31,99,75,31,107,83,31,115,87,31,123,95,35,131,103,35,143,111,35,11,11,15,19,19,27,27,27,39,39,39,51,47,47,63,55,55,75,63,63,87,71,71,103,79,79,115,91,91,127,99,99, 139,107,107,151,115,115,163,123,123,175,131,131,187,139,139,203,0,0,0,7,7,0,11,11,0,19,19,0,27,27,0,35,35,0,43,43,7,47,47,7,55,55,7,63,63,7,71,71,7,75,75,11,83,83,11,91,91,11,99,99,11,107,107,15,7,0,0,15,0,0,23,0,0,31,0,0,39,0,0,47,0,0,55,0,0,63,0,0,71,0,0,79,0,0,87,0,0,95,0,0,103,0,0,111,0,0,119,0,0,127,0,0,19,19,0,27,27,0,35,35,0,47,43,0,55,47,0,67, @@ -29,7 +29,7 @@ void Palette_SetupSpecialPalettes(void) int pants_start, pants_end; int shirt_start, shirt_end; int reversed_start, reversed_end; - qbyte *colormap; + unsigned char *colormap; colormap = FS_LoadFile("gfx/colormap.lmp", tempmempool, true); if (colormap && fs_filesize >= 16385) @@ -106,7 +106,7 @@ void Palette_SetupSpecialPalettes(void) palette_font[255] = 0; } -void BuildGammaTable8(float prescale, float gamma, float scale, float base, qbyte *out) +void BuildGammaTable8(float prescale, float gamma, float scale, float base, unsigned char *out) { int i, adjusted; double invgamma, d; @@ -164,8 +164,8 @@ void Palette_Init(void) { int i; float gamma, scale, base; - qbyte *in, *out, *palfile; - qbyte texturegammaramp[256]; + unsigned char *in, *out, *palfile; + unsigned char texturegammaramp[256]; gamma = 1; scale = 1; @@ -188,7 +188,7 @@ void Palette_Init(void) BuildGammaTable8(1.0f, gamma, scale, base, texturegammaramp); - palfile = (qbyte *)FS_LoadFile ("gfx/palette.lmp", tempmempool, false); + palfile = (unsigned char *)FS_LoadFile ("gfx/palette.lmp", tempmempool, false); if (palfile && fs_filesize >= 768) in = palfile; else @@ -196,7 +196,7 @@ void Palette_Init(void) Con_DPrint("Couldn't load gfx/palette.lmp, falling back on internal palette\n"); in = host_quakepal; } - out = (qbyte *) palette_complete; // palette is accessed as 32bit for speed reasons, but is created as 8bit bytes + out = (unsigned char *) palette_complete; // palette is accessed as 32bit for speed reasons, but is created as 8bit bytes for (i = 0;i < 255;i++) { *out++ = texturegammaramp[*in++]; diff --git a/palette.h b/palette.h index 2824717a..d344df27 100644 --- a/palette.h +++ b/palette.h @@ -13,7 +13,7 @@ extern unsigned int palette_alpha[256]; extern unsigned int palette_font[256]; // used by hardware gamma functions in vid_* files -void BuildGammaTable8(float prescale, float gamma, float scale, float base, qbyte *out); +void BuildGammaTable8(float prescale, float gamma, float scale, float base, unsigned char *out); void BuildGammaTable16(float prescale, float gamma, float scale, float base, unsigned short *out); void Palette_Init(void); diff --git a/portals.c b/portals.c index 98d742f4..2eae8792 100644 --- a/portals.c +++ b/portals.c @@ -272,10 +272,10 @@ typedef struct portalrecursioninfo_s vec3_t boxmaxs; int numsurfaces; int *surfacelist; - qbyte *surfacepvs; + unsigned char *surfacepvs; int numleafs; int *leaflist; - qbyte *leafpvs; + unsigned char *leafpvs; model_t *model; vec3_t eye; float *updateleafsmins; @@ -419,7 +419,7 @@ static void Portal_RecursiveFindLeafForFlow(portalrecursioninfo_t *info, mnode_t } } -void Portal_Visibility(model_t *model, const vec3_t eye, int *leaflist, qbyte *leafpvs, int *numleafspointer, int *surfacelist, qbyte *surfacepvs, int *numsurfacespointer, const mplane_t *frustumplanes, int numfrustumplanes, int exact, const float *boxmins, const float *boxmaxs, float *updateleafsmins, float *updateleafsmaxs) +void Portal_Visibility(model_t *model, const vec3_t eye, int *leaflist, unsigned char *leafpvs, int *numleafspointer, int *surfacelist, unsigned char *surfacepvs, int *numsurfacespointer, const mplane_t *frustumplanes, int numfrustumplanes, int exact, const float *boxmins, const float *boxmaxs, float *updateleafsmins, float *updateleafsmaxs) { int i; portalrecursioninfo_t info; diff --git a/portals.h b/portals.h index 416e431e..1c5fecd5 100644 --- a/portals.h +++ b/portals.h @@ -4,7 +4,7 @@ int Portal_CheckPolygon(model_t *model, vec3_t eye, float *polypoints, int numpoints); int Portal_CheckBox(model_t *model, vec3_t eye, vec3_t a, vec3_t b); -void Portal_Visibility(model_t *model, const vec3_t eye, int *leaflist, qbyte *leafpvs, int *numleafspointer, int *surfacelist, qbyte *surfacepvs, int *numsurfacespointer, const mplane_t *frustumplanes, int numfrustumplanes, int exact, const float *boxmins, const float *boxmaxs, float *updateleafsmins, float *updateleafsmaxs); +void Portal_Visibility(model_t *model, const vec3_t eye, int *leaflist, unsigned char *leafpvs, int *numleafspointer, int *surfacelist, unsigned char *surfacepvs, int *numsurfacespointer, const mplane_t *frustumplanes, int numfrustumplanes, int exact, const float *boxmins, const float *boxmaxs, float *updateleafsmins, float *updateleafsmaxs); #endif diff --git a/pr_cmds.c b/pr_cmds.c index cc5c4141..cbc06add 100644 --- a/pr_cmds.c +++ b/pr_cmds.c @@ -855,7 +855,7 @@ void PF_checkpos (void) //============================================================================ int checkpvsbytes; -qbyte checkpvs[MAX_MAP_LEAFS/8]; +unsigned char checkpvs[MAX_MAP_LEAFS/8]; int PF_newcheckclient (int check) { diff --git a/pr_comp.h b/pr_comp.h index 5fd9f048..912491e6 100644 --- a/pr_comp.h +++ b/pr_comp.h @@ -153,7 +153,7 @@ typedef struct dfunction_s int s_file; // source file defined in int numparms; - qbyte parm_size[MAX_PARMS]; + unsigned char parm_size[MAX_PARMS]; } dfunction_t; @@ -171,7 +171,7 @@ typedef struct mfunction_s int s_file; // source file defined in int numparms; - qbyte parm_size[MAX_PARMS]; + unsigned char parm_size[MAX_PARMS]; } mfunction_t; diff --git a/pr_edict.c b/pr_edict.c index 1fe3079d..43330f39 100644 --- a/pr_edict.c +++ b/pr_edict.c @@ -1289,7 +1289,7 @@ void PR_LoadProgs (const char *progsname) Con_DPrintf("Programs occupy %iK.\n", fs_filesize/1024); - pr_crc = CRC_Block((qbyte *)progs, fs_filesize); + pr_crc = CRC_Block((unsigned char *)progs, fs_filesize); // byte swap the header for (i = 0;i < (int) sizeof(*progs) / 4;i++) @@ -1300,8 +1300,8 @@ void PR_LoadProgs (const char *progsname) if (progs->crc != PROGHEADER_CRC && progs->crc != 32401) // tenebrae crc also allowed Host_Error ("progs.dat system vars have been modified, progdefs.h is out of date"); - //prog->functions = (dfunction_t *)((qbyte *)progs + progs->ofs_functions); - dfunctions = (dfunction_t *)((qbyte *)progs + progs->ofs_functions); + //prog->functions = (dfunction_t *)((unsigned char *)progs + progs->ofs_functions); + dfunctions = (dfunction_t *)((unsigned char *)progs + progs->ofs_functions); pr_strings = (char *)progs + progs->ofs_strings; pr_stringssize = 0; @@ -1315,19 +1315,19 @@ void PR_LoadProgs (const char *progsname) pr_maxknownstrings = 0; pr_knownstrings = NULL; - pr_globaldefs = (ddef_t *)((qbyte *)progs + progs->ofs_globaldefs); + pr_globaldefs = (ddef_t *)((unsigned char *)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 *)((qbyte *)progs + progs->ofs_fielddefs); + infielddefs = (ddef_t *)((unsigned char *)progs + progs->ofs_fielddefs); pr_fielddefs = PR_Alloc((progs->numfielddefs + DPFIELDS) * sizeof(ddef_t)); prog->functions = PR_Alloc(sizeof(mfunction_t) * progs->numfunctions); - pr_statements = (dstatement_t *)((qbyte *)progs + progs->ofs_statements); + pr_statements = (dstatement_t *)((unsigned char *)progs + progs->ofs_statements); // moved edict_size calculation down below field adding code - pr_global_struct = (globalvars_t *)((qbyte *)progs + progs->ofs_globals); + pr_global_struct = (globalvars_t *)((unsigned char *)progs + progs->ofs_globals); pr_globals = (float *)pr_global_struct; // byte swap the lumps @@ -1724,7 +1724,7 @@ int PRVM_NUM_FOR_EDICT(prvm_edict_t *e) // return e - prog->edicts; //} -//#define PRVM_EDICT_TO_PROG(e) ((qbyte *)(((prvm_edict_t *)e)->v) - (qbyte *)(prog->edictsfields)) +//#define PRVM_EDICT_TO_PROG(e) ((unsigned char *)(((prvm_edict_t *)e)->v) - (unsigned char *)(prog->edictsfields)) //#define PRVM_PROG_TO_EDICT(e) (prog->edicts + ((e) / (progs->entityfields * 4))) int PRVM_EDICT_TO_PROG(prvm_edict_t *e) { @@ -1733,7 +1733,7 @@ int PRVM_EDICT_TO_PROG(prvm_edict_t *e) if ((unsigned int)n >= (unsigned int)prog->max_edicts) Host_Error("PRVM_EDICT_TO_PROG: invalid edict %8p (number %i compared to world at %8p)\n", e, n, prog->edicts); return n;// EXPERIMENTAL - //return (qbyte *)e->v - (qbyte *)prog->edictsfields; + //return (unsigned char *)e->v - (unsigned char *)prog->edictsfields; } prvm_edict_t *PRVM_PROG_TO_EDICT(int n) { diff --git a/pr_execprogram.h b/pr_execprogram.h index f70f100e..0be877c2 100644 --- a/pr_execprogram.h +++ b/pr_execprogram.h @@ -158,7 +158,7 @@ return; } #endif - ptr = (prvm_eval_t *)((qbyte *)prog->edictsfields + OPB->_int); + ptr = (prvm_eval_t *)((unsigned char *)prog->edictsfields + OPB->_int); ptr->_int = OPA->_int; break; case OP_STOREP_V: @@ -172,7 +172,7 @@ return; } #endif - ptr = (prvm_eval_t *)((qbyte *)prog->edictsfields + OPB->_int); + ptr = (prvm_eval_t *)((unsigned char *)prog->edictsfields + OPB->_int); ptr->vector[0] = OPA->vector[0]; ptr->vector[1] = OPA->vector[1]; ptr->vector[2] = OPA->vector[2]; @@ -198,7 +198,7 @@ return; } ed = PRVM_PROG_TO_EDICT(OPA->edict); - OPC->_int = (qbyte *)((int *)ed->v + OPB->_int) - (qbyte *)prog->edictsfields; + OPC->_int = (unsigned char *)((int *)ed->v + OPB->_int) - (unsigned char *)prog->edictsfields; break; case OP_LOAD_F: @@ -481,7 +481,7 @@ return; } #endif - ptr = (prvm_eval_t *)((qbyte *)prog->edictsfields + OPB->_int); + ptr = (prvm_eval_t *)((unsigned char *)prog->edictsfields + OPB->_int); ptr->_int = OPA->_int; break; case OP_LOAD_I: diff --git a/progs.h b/progs.h index 7461320e..56cecb90 100644 --- a/progs.h +++ b/progs.h @@ -249,7 +249,7 @@ extern int eval_colormod; extern int eval_playermodel; extern int eval_playerskin; -#define PRVM_GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (prvm_eval_t *)((qbyte *)ed->v + fieldoffset) : NULL) +#define PRVM_GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (prvm_eval_t *)((unsigned char *)ed->v + fieldoffset) : NULL) extern mfunction_t *SV_PlayerPhysicsQC; diff --git a/progsvm.h b/progsvm.h index aae25ce9..daa1b5b3 100644 --- a/progsvm.h +++ b/progsvm.h @@ -207,7 +207,7 @@ typedef struct prvm_edict_s } fields; } prvm_edict_t; -#define PRVM_GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (prvm_eval_t *)((qbyte *)ed->fields.vp + fieldoffset) : NULL) +#define PRVM_GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (prvm_eval_t *)((unsigned char *)ed->fields.vp + fieldoffset) : NULL) /*// this struct is the basic requirement for a qc prog typedef struct prvm_pr_globalvars_s @@ -274,7 +274,7 @@ typedef struct prvm_prog_s // (simple optimization of the free string search) int firstfreeknownstring; const char **knownstrings; - qbyte *knownstrings_freeable; + unsigned char *knownstrings_freeable; const char ***stringshash; // all memory allocations related to this vm_prog (code, edicts, strings) diff --git a/protocol.c b/protocol.c index 69a94f2b..611c0f7e 100644 --- a/protocol.c +++ b/protocol.c @@ -102,7 +102,7 @@ void Protocol_Names(char *buffer, size_t buffersize) // keep track of quake entities because they need to be killed if they get stale int cl_lastquakeentity = 0; -qbyte cl_isquakeentity[MAX_EDICTS]; +unsigned char cl_isquakeentity[MAX_EDICTS]; void EntityFrameQuake_ReadEntity(int bits) { @@ -172,7 +172,7 @@ void EntityFrameQuake_ReadEntity(int bits) if (bits & U_EFFECTS2) s.effects = (s.effects & 0x00FF) | (MSG_ReadByte() << 8); if (bits & U_GLOWSIZE) s.glowsize = MSG_ReadByte(); if (bits & U_GLOWCOLOR) s.glowcolor = MSG_ReadByte(); - if (bits & U_COLORMOD) {int c = MSG_ReadByte();s.colormod[0] = (qbyte)(((c >> 5) & 7) * (32.0f / 7.0f));s.colormod[1] = (qbyte)(((c >> 2) & 7) * (32.0f / 7.0f));s.colormod[2] = (qbyte)((c & 3) * (32.0f / 3.0f));} + if (bits & U_COLORMOD) {int c = MSG_ReadByte();s.colormod[0] = (unsigned char)(((c >> 5) & 7) * (32.0f / 7.0f));s.colormod[1] = (unsigned char)(((c >> 2) & 7) * (32.0f / 7.0f));s.colormod[2] = (unsigned char)((c & 3) * (32.0f / 3.0f));} if (bits & U_GLOWTRAIL) s.flags |= RENDER_GLOWTRAIL; if (bits & U_FRAME2) s.frame = (s.frame & 0x00FF) | (MSG_ReadByte() << 8); if (bits & U_MODEL2) s.modelindex = (s.modelindex & 0x00FF) | (MSG_ReadByte() << 8); @@ -244,7 +244,7 @@ void EntityFrameQuake_WriteFrame(sizebuf_t *msg, int numstates, const entity_sta entity_state_t baseline; int i, bits; sizebuf_t buf; - qbyte data[128]; + unsigned char data[128]; // prepare the buffer memset(&buf, 0, sizeof(buf)); @@ -397,11 +397,11 @@ int EntityState_DeltaBits(const entity_state_t *o, const entity_state_t *n) bits |= E_ORIGIN2; if (fabs(n->origin[2] - o->origin[2]) > (1.0f / 256.0f)) bits |= E_ORIGIN3; - if ((qbyte) (n->angles[0] * (256.0f / 360.0f)) != (qbyte) (o->angles[0] * (256.0f / 360.0f))) + if ((unsigned char) (n->angles[0] * (256.0f / 360.0f)) != (unsigned char) (o->angles[0] * (256.0f / 360.0f))) bits |= E_ANGLE1; - if ((qbyte) (n->angles[1] * (256.0f / 360.0f)) != (qbyte) (o->angles[1] * (256.0f / 360.0f))) + if ((unsigned char) (n->angles[1] * (256.0f / 360.0f)) != (unsigned char) (o->angles[1] * (256.0f / 360.0f))) bits |= E_ANGLE2; - if ((qbyte) (n->angles[2] * (256.0f / 360.0f)) != (qbyte) (o->angles[2] * (256.0f / 360.0f))) + if ((unsigned char) (n->angles[2] * (256.0f / 360.0f)) != (unsigned char) (o->angles[2] * (256.0f / 360.0f))) bits |= E_ANGLE3; if ((n->modelindex ^ o->modelindex) & 0x00FF) bits |= E_MODEL1; @@ -1026,7 +1026,7 @@ void EntityFrame_CL_ReadFrame(void) } EntityFrame_AddFrame(d, f->eye, f->framenum, f->numentities, f->entitydata); - memset(cl_entities_active, 0, cl_num_entities * sizeof(qbyte)); + memset(cl_entities_active, 0, cl_num_entities * sizeof(unsigned char)); number = 1; for (i = 0;i < f->numentities;i++) { @@ -1346,7 +1346,7 @@ void EntityFrame4_WriteFrame(sizebuf_t *msg, entityframe4_database_t *d, int num entity_state_t inactiveentitystate; int i, n, startnumber; sizebuf_t buf; - qbyte data[128]; + unsigned char data[128]; // if there isn't enough space to accomplish anything, skip it if (msg->cursize + 24 > msg->maxsize) @@ -1475,27 +1475,27 @@ void EntityFrame5_ExpandEdicts(entityframe5_database_t *d, int newmax) { if (d->maxedicts < newmax) { - qbyte *data; + unsigned char *data; int oldmaxedicts = d->maxedicts; int *olddeltabits = d->deltabits; - qbyte *oldpriorities = d->priorities; + unsigned char *oldpriorities = d->priorities; int *oldupdateframenum = d->updateframenum; entity_state_t *oldstates = d->states; - qbyte *oldvisiblebits = d->visiblebits; + unsigned char *oldvisiblebits = d->visiblebits; d->maxedicts = newmax; - data = (qbyte *)Mem_Alloc(sv_mempool, d->maxedicts * sizeof(int) + d->maxedicts * sizeof(qbyte) + d->maxedicts * sizeof(int) + d->maxedicts * sizeof(entity_state_t) + (d->maxedicts+7)/8 * sizeof(qbyte)); + data = (unsigned char *)Mem_Alloc(sv_mempool, d->maxedicts * sizeof(int) + d->maxedicts * sizeof(unsigned char) + d->maxedicts * sizeof(int) + d->maxedicts * sizeof(entity_state_t) + (d->maxedicts+7)/8 * sizeof(unsigned char)); d->deltabits = (int *)data;data += d->maxedicts * sizeof(int); - d->priorities = (qbyte *)data;data += d->maxedicts * sizeof(qbyte); + d->priorities = (unsigned char *)data;data += d->maxedicts * sizeof(unsigned char); d->updateframenum = (int *)data;data += d->maxedicts * sizeof(int); d->states = (entity_state_t *)data;data += d->maxedicts * sizeof(entity_state_t); - d->visiblebits = (qbyte *)data;data += (d->maxedicts+7)/8 * sizeof(qbyte); + d->visiblebits = (unsigned char *)data;data += (d->maxedicts+7)/8 * sizeof(unsigned char); if (oldmaxedicts) { memcpy(d->deltabits, olddeltabits, oldmaxedicts * sizeof(int)); - memcpy(d->priorities, oldpriorities, oldmaxedicts * sizeof(qbyte)); + memcpy(d->priorities, oldpriorities, oldmaxedicts * sizeof(unsigned char)); memcpy(d->updateframenum, oldupdateframenum, oldmaxedicts * sizeof(int)); memcpy(d->states, oldstates, oldmaxedicts * sizeof(entity_state_t)); - memcpy(d->visiblebits, oldvisiblebits, (oldmaxedicts+7)/8 * sizeof(qbyte)); + memcpy(d->visiblebits, oldvisiblebits, (oldmaxedicts+7)/8 * sizeof(unsigned char)); // the previous buffers were a single allocation, so just one free Mem_Free(olddeltabits); } @@ -1953,7 +1953,7 @@ void EntityFrame5_LostFrame(entityframe5_database_t *d, int framenum) int i, j, k, l, bits; entityframe5_changestate_t *s, *s2; entityframe5_packetlog_t *p, *p2; - qbyte statsdeltabits[(MAX_CL_STATS+7)/8]; + unsigned char statsdeltabits[(MAX_CL_STATS+7)/8]; // scan for packets that were lost for (i = 0, p = d->packetlog;i < ENTITYFRAME5_MAXPACKETLOGS;i++, p++) { @@ -2022,7 +2022,7 @@ void EntityFrame5_WriteFrame(sizebuf_t *msg, entityframe5_database_t *d, int num const entity_state_t *n; int i, num, l, framenum, packetlognumber, priority; sizebuf_t buf; - qbyte data[128]; + unsigned char data[128]; entityframe5_packetlog_t *packetlog; if (prog->max_edicts > d->maxedicts) diff --git a/protocol.h b/protocol.h index 211043b4..27fbf6e2 100644 --- a/protocol.h +++ b/protocol.h @@ -694,7 +694,7 @@ typedef struct entityframe5_packetlog_s int packetnumber; int numstates; entityframe5_changestate_t states[ENTITYFRAME5_MAXSTATES]; - qbyte statsdeltabits[(MAX_CL_STATS+7)/8]; + unsigned char statsdeltabits[(MAX_CL_STATS+7)/8]; } entityframe5_packetlog_t; @@ -715,7 +715,7 @@ typedef struct entityframe5_database_s int *deltabits; // [maxedicts] // priorities of entities (updated whenever deltabits change) // (derived from deltabits) - qbyte *priorities; // [maxedicts] + unsigned char *priorities; // [maxedicts] // last frame this entity was sent on, for prioritzation int *updateframenum; // [maxedicts] @@ -724,10 +724,10 @@ typedef struct entityframe5_database_s // which entities are currently active // (duplicate of the active bit of every state in states[]) // (derived from states) - qbyte *visiblebits; // [(maxedicts+7)/8] + unsigned char *visiblebits; // [(maxedicts+7)/8] // delta compression of stats - qbyte statsdeltabits[(MAX_CL_STATS+7)/8]; + unsigned char statsdeltabits[(MAX_CL_STATS+7)/8]; int stats[MAX_CL_STATS]; // old notes diff --git a/prvm_edict.c b/prvm_edict.c index 7c87aa3e..5847f53e 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -68,8 +68,8 @@ void PRVM_MEM_Alloc(void) // set edict pointers for(i = 0; i < prog->max_edicts; i++) { - prog->edicts[i].priv.required = (prvm_edict_private_t *)((qbyte *)prog->edictprivate + i * prog->edictprivate_size); - prog->edicts[i].fields.vp = (void*)((qbyte *)prog->edictsfields + i * prog->edict_size); + prog->edicts[i].priv.required = (prvm_edict_private_t *)((unsigned char *)prog->edictprivate + i * prog->edictprivate_size); + prog->edicts[i].fields.vp = (void*)((unsigned char *)prog->edictsfields + i * prog->edict_size); } } @@ -102,8 +102,8 @@ void PRVM_MEM_IncreaseEdicts(void) //set e and v pointers for(i = 0; i < prog->max_edicts; i++) { - prog->edicts[i].priv.required = (prvm_edict_private_t *)((qbyte *)prog->edictprivate + i * prog->edictprivate_size); - prog->edicts[i].fields.vp = (void*)((qbyte *)prog->edictsfields + i * prog->edict_size); + prog->edicts[i].priv.required = (prvm_edict_private_t *)((unsigned char *)prog->edictprivate + i * prog->edictprivate_size); + prog->edicts[i].fields.vp = (void*)((unsigned char *)prog->edictsfields + i * prog->edict_size); } PRVM_GCALL(end_increase_edicts)(); @@ -1160,7 +1160,7 @@ void PRVM_ED_LoadFromFile (const char *data) // if(prog->self && prog->flag & PRVM_FE_CLASSNAME) { - string_t handle = *(string_t*)&((qbyte*)ent->fields.vp)[PRVM_ED_FindFieldOffset("classname")]; + string_t handle = *(string_t*)&((unsigned char*)ent->fields.vp)[PRVM_ED_FindFieldOffset("classname")]; if (!handle) { Con_Print("No classname for:\n"); @@ -1231,7 +1231,7 @@ PRVM_LoadLNO =============== */ void PRVM_LoadLNO( const char *progname ) { - qbyte *lno; + unsigned char *lno; unsigned int *header; char filename[512]; @@ -1292,7 +1292,7 @@ void PRVM_LoadProgs (const char * filename, int numrequiredfunc, char **required Con_DPrintf("%s programs occupy %iK.\n", PRVM_NAME, fs_filesize/1024); - prog->filecrc = CRC_Block((qbyte *)prog->progs, fs_filesize); + prog->filecrc = CRC_Block((unsigned char *)prog->progs, fs_filesize); // byte swap the header for (i = 0;i < (int) sizeof(*prog->progs) / 4;i++) @@ -1303,8 +1303,8 @@ void PRVM_LoadProgs (const char * filename, int numrequiredfunc, char **required if (prog->progs->crc != prog->headercrc) PRVM_ERROR ("%s: %s system vars have been modified, progdefs.h is out of date", PRVM_NAME, filename); - //prog->functions = (dfunction_t *)((qbyte *)progs + progs->ofs_functions); - dfunctions = (dfunction_t *)((qbyte *)prog->progs + prog->progs->ofs_functions); + //prog->functions = (dfunction_t *)((unsigned char *)progs + progs->ofs_functions); + dfunctions = (dfunction_t *)((unsigned char *)prog->progs + prog->progs->ofs_functions); prog->strings = (char *)prog->progs + prog->progs->ofs_strings; prog->stringssize = 0; @@ -1319,20 +1319,20 @@ void PRVM_LoadProgs (const char * filename, int numrequiredfunc, char **required prog->knownstrings = NULL; prog->knownstrings_freeable = NULL; - prog->globaldefs = (ddef_t *)((qbyte *)prog->progs + prog->progs->ofs_globaldefs); + prog->globaldefs = (ddef_t *)((unsigned char *)prog->progs + prog->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 *)((qbyte *)prog->progs + prog->progs->ofs_fielddefs); + infielddefs = (ddef_t *)((unsigned char *)prog->progs + prog->progs->ofs_fielddefs); // ( + DPFIELDS ) prog->fielddefs = (ddef_t *)Mem_Alloc(prog->progs_mempool, (prog->progs->numfielddefs + numrequiredfields) * sizeof(ddef_t)); - prog->statements = (dstatement_t *)((qbyte *)prog->progs + prog->progs->ofs_statements); + prog->statements = (dstatement_t *)((unsigned char *)prog->progs + prog->progs->ofs_statements); // moved edict_size calculation down below field adding code - //pr_global_struct = (globalvars_t *)((qbyte *)progs + progs->ofs_globals); - prog->globals.generic = (float *)((qbyte *)prog->progs + prog->progs->ofs_globals); + //pr_global_struct = (globalvars_t *)((unsigned char *)progs + progs->ofs_globals); + prog->globals.generic = (float *)((unsigned char *)prog->progs + prog->progs->ofs_globals); // byte swap the lumps for (i=0 ; iprogs->numstatements ; i++) @@ -1825,7 +1825,7 @@ int PRVM_NUM_FOR_EDICT(prvm_edict_t *e) // return e - prog->edicts; //} -//#define PRVM_EDICT_TO_PROG(e) ((qbyte *)(((prvm_edict_t *)e)->v) - (qbyte *)(prog->edictsfields)) +//#define PRVM_EDICT_TO_PROG(e) ((unsigned char *)(((prvm_edict_t *)e)->v) - (unsigned char *)(prog->edictsfields)) //#define PRVM_PROG_TO_EDICT(e) (prog->edicts + ((e) / (progs->entityfields * 4))) int PRVM_EDICT_TO_PROG(prvm_edict_t *e) { @@ -1834,7 +1834,7 @@ int PRVM_EDICT_TO_PROG(prvm_edict_t *e) if ((unsigned int)n >= (unsigned int)prog->max_edicts) Host_Error("PRVM_EDICT_TO_PROG: invalid edict %8p (number %i compared to world at %8p)\n", e, n, prog->edicts); return n;// EXPERIMENTAL - //return (qbyte *)e->v - (qbyte *)prog->edictsfields; + //return (unsigned char *)e->v - (unsigned char *)prog->edictsfields; } prvm_edict_t *PRVM_PROG_TO_EDICT(int n) { @@ -1885,14 +1885,14 @@ int PRVM_SetEngineString(const char *s) if (i >= prog->maxknownstrings) { const char **oldstrings = prog->knownstrings; - const qbyte *oldstrings_freeable = prog->knownstrings_freeable; + const unsigned char *oldstrings_freeable = prog->knownstrings_freeable; prog->maxknownstrings += 128; prog->knownstrings = (const char **)PRVM_Alloc(prog->maxknownstrings * sizeof(char *)); - prog->knownstrings_freeable = (qbyte *)PRVM_Alloc(prog->maxknownstrings * sizeof(qbyte)); + prog->knownstrings_freeable = (unsigned char *)PRVM_Alloc(prog->maxknownstrings * sizeof(unsigned char)); if (prog->numknownstrings) { memcpy((char **)prog->knownstrings, oldstrings, prog->numknownstrings * sizeof(char *)); - memcpy((char **)prog->knownstrings_freeable, oldstrings_freeable, prog->numknownstrings * sizeof(qbyte)); + memcpy((char **)prog->knownstrings_freeable, oldstrings_freeable, prog->numknownstrings * sizeof(unsigned char)); } } prog->numknownstrings++; @@ -1915,14 +1915,14 @@ int PRVM_AllocString(size_t bufferlength, char **pointer) if (i >= prog->maxknownstrings) { const char **oldstrings = prog->knownstrings; - const qbyte *oldstrings_freeable = prog->knownstrings_freeable; + const unsigned char *oldstrings_freeable = prog->knownstrings_freeable; prog->maxknownstrings += 128; prog->knownstrings = (const char **)PRVM_Alloc(prog->maxknownstrings * sizeof(char *)); - prog->knownstrings_freeable = (qbyte *)PRVM_Alloc(prog->maxknownstrings * sizeof(qbyte)); + prog->knownstrings_freeable = (unsigned char *)PRVM_Alloc(prog->maxknownstrings * sizeof(unsigned char)); if (prog->numknownstrings) { memcpy((char **)prog->knownstrings, oldstrings, prog->numknownstrings * sizeof(char *)); - memcpy((char **)prog->knownstrings_freeable, oldstrings_freeable, prog->numknownstrings * sizeof(qbyte)); + memcpy((char **)prog->knownstrings_freeable, oldstrings_freeable, prog->numknownstrings * sizeof(unsigned char)); } } prog->numknownstrings++; diff --git a/prvm_execprogram.h b/prvm_execprogram.h index d125cd7e..5018b79d 100644 --- a/prvm_execprogram.h +++ b/prvm_execprogram.h @@ -158,7 +158,7 @@ return; } #endif - ptr = (prvm_eval_t *)((qbyte *)prog->edictsfields + OPB->_int); + ptr = (prvm_eval_t *)((unsigned char *)prog->edictsfields + OPB->_int); ptr->_int = OPA->_int; break; case OP_STOREP_V: @@ -172,7 +172,7 @@ return; } #endif - ptr = (prvm_eval_t *)((qbyte *)prog->edictsfields + OPB->_int); + ptr = (prvm_eval_t *)((unsigned char *)prog->edictsfields + OPB->_int); ptr->vector[0] = OPA->vector[0]; ptr->vector[1] = OPA->vector[1]; ptr->vector[2] = OPA->vector[2]; @@ -198,7 +198,7 @@ return; } ed = PRVM_PROG_TO_EDICT(OPA->edict); - OPC->_int = (qbyte *)((int *)ed->fields.vp + OPB->_int) - (qbyte *)prog->edictsfields; + OPC->_int = (unsigned char *)((int *)ed->fields.vp + OPB->_int) - (unsigned char *)prog->edictsfields; break; case OP_LOAD_F: @@ -482,7 +482,7 @@ return; } #endif - ptr = (prvm_eval_t *)((qbyte *)prog->edictsfields + OPB->_int); + ptr = (prvm_eval_t *)((unsigned char *)prog->edictsfields + OPB->_int); ptr->_int = OPA->_int; break; case OP_LOAD_I: diff --git a/qtypes.h b/qtypes.h index 0919bd7a..7c525a69 100644 --- a/qtypes.h +++ b/qtypes.h @@ -2,8 +2,6 @@ #ifndef QTYPES_H #define QTYPES_H -typedef unsigned char qbyte; - #undef true #undef false diff --git a/r_crosshairs.c b/r_crosshairs.c index 413ee14e..113ed591 100644 --- a/r_crosshairs.c +++ b/r_crosshairs.c @@ -25,7 +25,7 @@ void R_Crosshairs_Init(void) void R_GetCrosshairColor(float *out) { int i; - qbyte *color; + unsigned char *color; float scale, base; if (cl.viewentity >= 1 && cl.viewentity <= cl.maxclients) { @@ -37,7 +37,7 @@ void R_GetCrosshairColor(float *out) } else i = 15; - color = (qbyte *) &palette_complete[i]; + color = (unsigned char *) &palette_complete[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 4ce210da..7bf4e183 100644 --- a/r_explosion.c +++ b/r_explosion.c @@ -58,7 +58,7 @@ static cvar_t r_drawexplosions = {0, "r_drawexplosions", "1"}; static void r_explosion_start(void) { int x, y; - qbyte noise1[128][128], noise2[128][128], noise3[128][128], data[128][128][4]; + unsigned char 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); @@ -147,7 +147,7 @@ void R_NewExplosion(vec3_t org) float dist, n; explosion_t *e; trace_t trace; - qbyte noise[EXPLOSIONGRID*EXPLOSIONGRID]; + unsigned char noise[EXPLOSIONGRID*EXPLOSIONGRID]; fractalnoisequick(noise, EXPLOSIONGRID, 4); // adjust noise grid size according to explosion for (i = 0, e = explosion;i < MAX_EXPLOSIONS;i++, e++) { diff --git a/r_light.c b/r_light.c index 4b25a3ba..f8b99601 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; - qbyte pixels[32][32][4]; + unsigned char pixels[32][32][4]; lighttexturepool = R_AllocTexturePool(); for (y = 0;y < 32;y++) { diff --git a/r_lightning.c b/r_lightning.c index 7dc0adbf..c11ad9fd 100644 --- a/r_lightning.c +++ b/r_lightning.c @@ -38,7 +38,7 @@ void r_lightningbeams_setuptexture(void) #define PATHPOINTS 8 int i, j, px, py, nearestpathindex, imagenumber; float particlex, particley, particlexv, particleyv, dx, dy, s, maxpathstrength; - qbyte *pixels; + unsigned char *pixels; int *image; struct lightningpathnode_s { @@ -47,7 +47,7 @@ void r_lightningbeams_setuptexture(void) path[PATHPOINTS], temppath; image = Mem_Alloc(tempmempool, BEAMWIDTH * BEAMHEIGHT * sizeof(int)); - pixels = Mem_Alloc(tempmempool, BEAMWIDTH * BEAMHEIGHT * sizeof(qbyte[4])); + pixels = Mem_Alloc(tempmempool, BEAMWIDTH * BEAMHEIGHT * sizeof(unsigned char[4])); for (imagenumber = 0, maxpathstrength = 0.0339476;maxpathstrength < 0.5;imagenumber++, maxpathstrength += 0.01) { @@ -116,11 +116,11 @@ void r_lightningbeams_setuptexture(void) #define BEAMHEIGHT 128 float r, g, b, intensity, fx, width, center; int x, y; - qbyte *data, *noise1, *noise2; + unsigned char *data, *noise1, *noise2; - data = (qbyte *)Mem_Alloc(tempmempool, BEAMWIDTH * BEAMHEIGHT * 4); - noise1 = (qbyte *)Mem_Alloc(tempmempool, BEAMHEIGHT * BEAMHEIGHT); - noise2 = (qbyte *)Mem_Alloc(tempmempool, BEAMHEIGHT * BEAMHEIGHT); + data = (unsigned char *)Mem_Alloc(tempmempool, BEAMWIDTH * BEAMHEIGHT * 4); + noise1 = (unsigned char *)Mem_Alloc(tempmempool, BEAMHEIGHT * BEAMHEIGHT); + noise2 = (unsigned char *)Mem_Alloc(tempmempool, BEAMHEIGHT * BEAMHEIGHT); fractalnoise(noise1, BEAMHEIGHT, BEAMHEIGHT / 8); fractalnoise(noise2, BEAMHEIGHT, BEAMHEIGHT / 16); @@ -138,10 +138,10 @@ void r_lightningbeams_setuptexture(void) r = intensity * 1.0f; g = intensity * 1.0f; b = intensity * 1.0f; - data[(y * BEAMWIDTH + x) * 4 + 0] = (qbyte)(bound(0, r, 1) * 255.0f); - data[(y * BEAMWIDTH + x) * 4 + 1] = (qbyte)(bound(0, g, 1) * 255.0f); - data[(y * BEAMWIDTH + x) * 4 + 2] = (qbyte)(bound(0, b, 1) * 255.0f); - data[(y * BEAMWIDTH + x) * 4 + 3] = (qbyte)255; + data[(y * BEAMWIDTH + x) * 4 + 0] = (unsigned char)(bound(0, r, 1) * 255.0f); + data[(y * BEAMWIDTH + x) * 4 + 1] = (unsigned char)(bound(0, g, 1) * 255.0f); + data[(y * BEAMWIDTH + x) * 4 + 2] = (unsigned char)(bound(0, b, 1) * 255.0f); + data[(y * BEAMWIDTH + x) * 4 + 3] = (unsigned char)255; } } diff --git a/r_shadow.c b/r_shadow.c index ade98536..680295a4 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -174,11 +174,11 @@ int *vertexremap; int vertexupdatenum; int r_shadow_buffer_numleafpvsbytes; -qbyte *r_shadow_buffer_leafpvs; +unsigned char *r_shadow_buffer_leafpvs; int *r_shadow_buffer_leaflist; int r_shadow_buffer_numsurfacepvsbytes; -qbyte *r_shadow_buffer_surfacepvs; +unsigned char *r_shadow_buffer_surfacepvs; int *r_shadow_buffer_surfacelist; rtexturepool_t *r_shadow_texturepool; @@ -762,7 +762,7 @@ static void R_Shadow_EnlargeLeafSurfaceBuffer(int numleafs, int numsurfaces) if (r_shadow_buffer_leaflist) Mem_Free(r_shadow_buffer_leaflist); r_shadow_buffer_numleafpvsbytes = numleafpvsbytes; - r_shadow_buffer_leafpvs = (qbyte *)Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numleafpvsbytes); + r_shadow_buffer_leafpvs = (unsigned char *)Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numleafpvsbytes); r_shadow_buffer_leaflist = (int *)Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numleafpvsbytes * 8 * sizeof(*r_shadow_buffer_leaflist)); } if (r_shadow_buffer_numsurfacepvsbytes < numsurfacepvsbytes) @@ -772,7 +772,7 @@ static void R_Shadow_EnlargeLeafSurfaceBuffer(int numleafs, int numsurfaces) if (r_shadow_buffer_surfacelist) Mem_Free(r_shadow_buffer_surfacelist); r_shadow_buffer_numsurfacepvsbytes = numsurfacepvsbytes; - r_shadow_buffer_surfacepvs = (qbyte *)Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numsurfacepvsbytes); + r_shadow_buffer_surfacepvs = (unsigned char *)Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numsurfacepvsbytes); r_shadow_buffer_surfacelist = (int *)Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numsurfacepvsbytes * 8 * sizeof(*r_shadow_buffer_surfacelist)); } } @@ -1009,14 +1009,14 @@ static void R_Shadow_MakeTextures(void) { int x, y, z, d; float v[3], intensity; - qbyte *data; + unsigned char *data; R_FreeTexturePool(&r_shadow_texturepool); r_shadow_texturepool = R_AllocTexturePool(); r_shadow_attenpower = r_shadow_lightattenuationpower.value; r_shadow_attenscale = r_shadow_lightattenuationscale.value; #define ATTEN2DSIZE 64 #define ATTEN3DSIZE 32 - data = (qbyte *)Mem_Alloc(tempmempool, max(ATTEN3DSIZE*ATTEN3DSIZE*ATTEN3DSIZE*4, ATTEN2DSIZE*ATTEN2DSIZE*4)); + data = (unsigned char *)Mem_Alloc(tempmempool, max(ATTEN3DSIZE*ATTEN3DSIZE*ATTEN3DSIZE*4, ATTEN2DSIZE*ATTEN2DSIZE*4)); for (y = 0;y < ATTEN2DSIZE;y++) { for (x = 0;x < ATTEN2DSIZE;x++) @@ -2591,7 +2591,7 @@ void R_RTLight_Compile(rtlight_t *rtlight) int shadowmeshes, shadowtris, numleafs, numleafpvsbytes, numsurfaces; entity_render_t *ent = r_refdef.worldentity; model_t *model = r_refdef.worldmodel; - qbyte *data; + unsigned char *data; // compile the light rtlight->compiled = true; @@ -2615,11 +2615,11 @@ void R_RTLight_Compile(rtlight_t *rtlight) R_Shadow_EnlargeLeafSurfaceBuffer(model->brush.num_leafs, model->num_surfaces); model->GetLightInfo(ent, rtlight->shadoworigin, rtlight->radius, rtlight->cullmins, rtlight->cullmaxs, r_shadow_buffer_leaflist, r_shadow_buffer_leafpvs, &numleafs, r_shadow_buffer_surfacelist, r_shadow_buffer_surfacepvs, &numsurfaces); numleafpvsbytes = (model->brush.num_leafs + 7) >> 3; - data = (qbyte *)Mem_Alloc(r_shadow_mempool, sizeof(int) * numleafs + numleafpvsbytes + sizeof(int) * numsurfaces); + data = (unsigned char *)Mem_Alloc(r_shadow_mempool, sizeof(int) * numleafs + numleafpvsbytes + sizeof(int) * numsurfaces); rtlight->static_numleafs = numleafs; rtlight->static_numleafpvsbytes = numleafpvsbytes; rtlight->static_leaflist = (int *)data;data += sizeof(int) * numleafs; - rtlight->static_leafpvs = (qbyte *)data;data += numleafpvsbytes; + rtlight->static_leafpvs = (unsigned char *)data;data += numleafpvsbytes; rtlight->static_numsurfaces = numsurfaces; rtlight->static_surfacelist = (int *)data;data += sizeof(int) * numsurfaces; if (numleafs) @@ -2772,7 +2772,7 @@ void R_DrawRTLight(rtlight_t *rtlight, qboolean visible) vec3_t lightcolor; int numleafs, numsurfaces; int *leaflist, *surfacelist; - qbyte *leafpvs; + unsigned char *leafpvs; int numlightentities; int numshadowentities; entity_render_t *lightentities[MAX_EDICTS]; @@ -2983,7 +2983,7 @@ static int componentorder[4] = {0, 1, 2, 3}; rtexture_t *R_Shadow_LoadCubemap(const char *basename) { int i, j, cubemapsize; - qbyte *cubemappixels, *image_rgba; + unsigned char *cubemappixels, *image_rgba; rtexture_t *cubemaptexture; char name[256]; // must start 0 so the first loadimagepixels has no requested width/height @@ -3009,7 +3009,7 @@ rtexture_t *R_Shadow_LoadCubemap(const char *basename) { cubemapsize = image_width; // note this clears to black, so unavailable sides are black - cubemappixels = (qbyte *)Mem_Alloc(tempmempool, 6*cubemapsize*cubemapsize*4); + cubemappixels = (unsigned char *)Mem_Alloc(tempmempool, 6*cubemapsize*cubemapsize*4); } // copy the image with any flipping needed by the suffix (px and posx types don't need flipping) if (cubemappixels) diff --git a/r_sky.c b/r_sky.c index dfb3af5d..9f5e311f 100644 --- a/r_sky.c +++ b/r_sky.c @@ -89,8 +89,8 @@ int R_LoadSkyBox(void) int i, j, success; int indices[4] = {0,1,2,3}; char name[1024]; - qbyte *image_rgba; - qbyte *temp; + unsigned char *image_rgba; + unsigned char *temp; R_UnloadSkyBox(); @@ -113,7 +113,7 @@ int R_LoadSkyBox(void) } } } - temp = (qbyte *)Mem_Alloc(tempmempool, image_width*image_height*4); + temp = (unsigned char *)Mem_Alloc(tempmempool, image_width*image_height*4); Image_CopyMux (temp, image_rgba, image_width, image_height, suffix[j][i].flipx, suffix[j][i].flipy, suffix[j][i].flipdiagonal, 4, 4, indices); skyboxside[i] = R_LoadTexture2D(skytexturepool, va("skyboxside%d", i), image_width, image_height, temp, TEXTYPE_RGBA, TEXF_CLAMP | TEXF_PRECACHE, NULL); Mem_Free(image_rgba); diff --git a/r_textures.h b/r_textures.h index 0fe506be..44d574ea 100644 --- a/r_textures.h +++ b/r_textures.h @@ -61,17 +61,17 @@ int R_CompatibleFragmentWidth(int width, int textype, int flags); // add a texture to a pool and optionally precache (upload) it // (note: data == NULL is perfectly acceptable) // (note: palette must not be NULL if using TEXTYPE_PALETTE) -rtexture_t *R_LoadTexture1D(rtexturepool_t *rtexturepool, const char *identifier, int width, const qbyte *data, int textype, int flags, const unsigned int *palette); -rtexture_t *R_LoadTexture2D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, const qbyte *data, int textype, int flags, const unsigned int *palette); -rtexture_t *R_LoadTexture3D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, int depth, const qbyte *data, int textype, int flags, const unsigned int *palette); -rtexture_t *R_LoadTextureCubeMap(rtexturepool_t *rtexturepool, const char *identifier, int width, const qbyte *data, int textype, int flags, const unsigned int *palette); +rtexture_t *R_LoadTexture1D(rtexturepool_t *rtexturepool, const char *identifier, int width, const unsigned char *data, int textype, int flags, const unsigned int *palette); +rtexture_t *R_LoadTexture2D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, const unsigned char *data, int textype, int flags, const unsigned int *palette); +rtexture_t *R_LoadTexture3D(rtexturepool_t *rtexturepool, const char *identifier, int width, int height, int depth, const unsigned char *data, int textype, int flags, const unsigned int *palette); +rtexture_t *R_LoadTextureCubeMap(rtexturepool_t *rtexturepool, const char *identifier, int width, const unsigned char *data, int textype, int flags, const unsigned int *palette); // free a texture void R_FreeTexture(rtexture_t *rt); // update the image data of a texture, used by lightmap updates and // procedural textures. -void R_UpdateTexture(rtexture_t *rt, qbyte *data); +void R_UpdateTexture(rtexture_t *rt, unsigned char *data); // location of the fragment in the texture (note: any parameter except rt can // be NULL) diff --git a/render.h b/render.h index 9595272a..e6ff9e79 100644 --- a/render.h +++ b/render.h @@ -24,11 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // flag arrays used for visibility checking on world model // (all other entities have no per-surface/per-leaf visibility checks) // TODO: dynamic resize according to r_refdef.worldmodel->brush.num_clusters -extern qbyte r_pvsbits[(32768+7)>>3]; +extern unsigned char r_pvsbits[(32768+7)>>3]; // TODO: dynamic resize according to r_refdef.worldmodel->brush.num_leafs -extern qbyte r_worldleafvisible[32768]; +extern unsigned char r_worldleafvisible[32768]; // TODO: dynamic resize according to r_refdef.worldmodel->num_surfaces -extern qbyte r_worldsurfacevisible[262144]; +extern unsigned char r_worldsurfacevisible[262144]; extern matrix4x4_t r_identitymatrix; @@ -183,7 +183,7 @@ void R_UpdateWorld(void); // needs no r_refdef void R_RenderView(void); // must call R_UpdateWorld and set r_refdef first -void R_InitSky (qbyte *src, int bytesperpixel); // called at level load +void R_InitSky (unsigned char *src, int bytesperpixel); // called at level load void R_WorldVisibility(); void R_DrawParticles(void); diff --git a/sbar.c b/sbar.c index 59941a5f..677a156b 100644 --- a/sbar.c +++ b/sbar.c @@ -724,7 +724,7 @@ void Sbar_DrawFrags (void) int i, k, l, x, f; char num[12]; scoreboard_t *s; - qbyte *c; + unsigned char *c; Sbar_SortFrags (); @@ -739,9 +739,9 @@ void Sbar_DrawFrags (void) s = &cl.scores[k]; // draw background - c = (qbyte *)&palette_complete[(s->colors & 0xf0) + 8]; + c = (unsigned char *)&palette_complete[(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) * sbar_alpha_fg.value, 0); - c = (qbyte *)&palette_complete[((s->colors & 15)<<4) + 8]; + c = (unsigned char *)&palette_complete[((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) * sbar_alpha_fg.value, 0); // draw number @@ -778,14 +778,14 @@ void Sbar_DrawFace (void) { char num[12]; scoreboard_t *s; - qbyte *c; + unsigned char *c; s = &cl.scores[cl.viewentity - 1]; // draw background Sbar_DrawPic (112, 0, rsb_teambord); - c = (qbyte *)&palette_complete[(s->colors & 0xf0) + 8]; + c = (unsigned char *)&palette_complete[(s->colors & 0xf0) + 8]; DrawQ_Fill (sbar_x + 113, vid_conheight.integer-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) * sbar_alpha_fg.value, 0); - c = (qbyte *)&palette_complete[((s->colors & 15)<<4) + 8]; + c = (unsigned char *)&palette_complete[((s->colors & 15)<<4) + 8]; DrawQ_Fill (sbar_x + 113, vid_conheight.integer-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) * sbar_alpha_fg.value, 0); // draw number @@ -1289,11 +1289,11 @@ Sbar_DeathmatchOverlay */ float Sbar_PrintScoreboardItem(scoreboard_t *s, float x, float y) { - qbyte *c; + unsigned char *c; // draw colors behind score - c = (qbyte *)&palette_complete[(s->colors & 0xf0) + 8]; + c = (unsigned char *)&palette_complete[(s->colors & 0xf0) + 8]; DrawQ_Fill(x + 8, y+1, 32, 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) * sbar_alpha_fg.value, 0); - c = (qbyte *)&palette_complete[((s->colors & 15)<<4) + 8]; + c = (unsigned char *)&palette_complete[((s->colors & 15)<<4) + 8]; DrawQ_Fill(x + 8, y+4, 32, 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) * sbar_alpha_fg.value, 0); // print the text //DrawQ_String(x, y, va("%c%4i %s", (s - cl.scores) == cl.playerentity - 1 ? 13 : ' ', (int) s->frags, s->name), 0, 8, 8, 1, 1, 1, 1 * sbar_alpha_fg.value, 0); diff --git a/server.h b/server.h index f71a1f14..f76e0f8a 100644 --- a/server.h +++ b/server.h @@ -83,15 +83,15 @@ typedef struct server_s server_state_t state; sizebuf_t datagram; - qbyte datagram_buf[NET_MAXMESSAGE]; + unsigned char datagram_buf[NET_MAXMESSAGE]; // copied to all clients at end of frame sizebuf_t reliable_datagram; - qbyte reliable_datagram_buf[NET_MAXMESSAGE]; + unsigned char reliable_datagram_buf[NET_MAXMESSAGE]; sizebuf_t signon; // LordHavoc: increased signon message buffer from 8192 - qbyte signon_buf[NET_MAXMESSAGE]; + unsigned char signon_buf[NET_MAXMESSAGE]; } server_t; // if defined this does ping smoothing, otherwise it does not @@ -132,7 +132,7 @@ typedef struct client_s // can be added to at any time, copied and clear once per frame sizebuf_t message; - qbyte msgbuf[NET_MAXMESSAGE]; + unsigned char msgbuf[NET_MAXMESSAGE]; // PRVM_EDICT_NUM(clientnum+1) prvm_edict_t *edict; diff --git a/snd_alsa.c b/snd_alsa.c index 30237fc3..95310d84 100644 --- a/snd_alsa.c +++ b/snd_alsa.c @@ -282,7 +282,7 @@ int SNDDMA_GetDMAPos (void) offset *= shm->format.channels; nframes *= shm->format.channels; shm->samplepos = offset; - shm->buffer = (qbyte *)areas->addr; + shm->buffer = (unsigned char *)areas->addr; return shm->samplepos; } diff --git a/snd_bsd.c b/snd_bsd.c index 6c1bd6ee..caa7ee0c 100644 --- a/snd_bsd.c +++ b/snd_bsd.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -43,8 +43,8 @@ static qboolean snd_inited = false; // TODO: allocate them in SNDDMA_Init, with a size depending on // the sound format (enough for 0.5 sec of sound for instance) #define SND_BUFF_SIZE 65536 -static qbyte dma_buffer [SND_BUFF_SIZE]; -static qbyte writebuf [SND_BUFF_SIZE]; +static unsigned char dma_buffer [SND_BUFF_SIZE]; +static unsigned char writebuf [SND_BUFF_SIZE]; qboolean SNDDMA_Init (void) diff --git a/snd_coreaudio.c b/snd_coreaudio.c index b98534f8..10214b90 100644 --- a/snd_coreaudio.c +++ b/snd_coreaudio.c @@ -184,7 +184,7 @@ qboolean SNDDMA_Init(void) shm->format.channels = outputStreamBasicDescription.mChannelsPerFrame; shm->format.width = 2; shm->samples = maxMixedSamples; - shm->buffer = (qbyte *)s_mixedSamples; + shm->buffer = (unsigned char *)s_mixedSamples; shm->samplepos = 0; // We haven't enqueued anything yet diff --git a/snd_main.c b/snd_main.c index 11a24406..778e68d7 100644 --- a/snd_main.c +++ b/snd_main.c @@ -124,7 +124,7 @@ void S_Startup(void) shm->format.channels = 2; shm->samples = 32768; shm->samplepos = 0; - shm->buffer = (qbyte *)Mem_Alloc(snd_mempool, shm->format.channels * shm->samples * shm->format.width); + shm->buffer = (unsigned char *)Mem_Alloc(snd_mempool, shm->format.channels * shm->samples * shm->format.width); } else { @@ -780,7 +780,7 @@ void S_UpdateAmbientSounds (void) float vol; int ambient_channel; channel_t *chan; - qbyte ambientlevels[NUM_AMBIENTS]; + unsigned char ambientlevels[NUM_AMBIENTS]; if (ambient_level.value <= 0 || !cl.worldmodel || !cl.worldmodel->brush.AmbientSoundLevelsForPoint) return; diff --git a/snd_main.h b/snd_main.h index 4c674daa..fbf2f3e4 100644 --- a/snd_main.h +++ b/snd_main.h @@ -28,7 +28,7 @@ typedef struct sfxbuffer_s { unsigned int length; unsigned int offset; - qbyte data[4]; // variable sized + unsigned char data[4]; // variable sized } sfxbuffer_t; typedef struct snd_format_s @@ -121,7 +121,7 @@ void S_UnlockSfx (sfx_t *sfx); void *S_LockBuffer(void); void S_UnlockBuffer(void); -extern size_t ResampleSfx (const qbyte *in_data, size_t in_length, const snd_format_t* in_format, qbyte *out_data, const char* sfxname); +extern size_t ResampleSfx (const unsigned char *in_data, size_t in_length, const snd_format_t* in_format, unsigned char *out_data, const char* sfxname); // ==================================================================== diff --git a/snd_mem.c b/snd_mem.c index 1e94c270..e7423817 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ResampleSfx ================ */ -size_t ResampleSfx (const qbyte *in_data, size_t in_length, const snd_format_t* in_format, qbyte *out_data, const char* sfxname) +size_t ResampleSfx (const unsigned char *in_data, size_t in_length, const snd_format_t* in_format, unsigned char *out_data, const char* sfxname) { size_t srclength, outcount, i; @@ -64,8 +64,8 @@ size_t ResampleSfx (const qbyte *in_data, size_t in_length, const snd_format_t* const unsigned int fracstep = (double)in_format->speed / shm->format.speed * (1 << FRACTIONAL_BITS); size_t remain_in = srclength, total_out = 0; unsigned int samplefrac; - const qbyte *in_ptr = in_data; - qbyte *out_ptr = out_data; + const unsigned char *in_ptr = in_data; + unsigned char *out_ptr = out_data; // Check that we can handle one second of that sound if (in_format->speed * in_format->channels > (1 << INTEGER_BITS)) @@ -123,12 +123,12 @@ size_t ResampleSfx (const qbyte *in_data, size_t in_length, const snd_format_t* // No more value to interpolate with? if (srcsample + in_format->channels < remain_in) { - a = ((const qbyte*)in_ptr)[srcsample] - 128; - b = ((const qbyte*)in_ptr)[srcsample + in_format->channels] - 128; + a = ((const unsigned char*)in_ptr)[srcsample] - 128; + b = ((const unsigned char*)in_ptr)[srcsample + in_format->channels] - 128; *((signed char*)out_ptr) = (((b - a) * (samplefrac & FRACTIONAL_MASK)) >> FRACTIONAL_BITS) + a; } else - *((signed char*)out_ptr) = ((const qbyte*)in_ptr)[srcsample] - 128; + *((signed char*)out_ptr) = ((const unsigned char*)in_ptr)[srcsample] - 128; out_ptr += sizeof (signed char); } diff --git a/snd_mix.c b/snd_mix.c index e7396cb8..d2329f40 100644 --- a/snd_mix.c +++ b/snd_mix.c @@ -34,12 +34,12 @@ portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE]; // FIXME: this desyncs with the video too easily extern qboolean cl_capturevideo_active; -extern void SCR_CaptureVideo_SoundFrame(qbyte *bufstereo16le, size_t length, int rate); +extern void SCR_CaptureVideo_SoundFrame(unsigned char *bufstereo16le, size_t length, int rate); void S_CaptureAVISound(portable_samplepair_t *buf, size_t length) { int n; size_t i; - qbyte out[PAINTBUFFER_SIZE * 4]; + unsigned char out[PAINTBUFFER_SIZE * 4]; if (!cl_capturevideo_active) return; // write the sound buffer as little endian 16bit interleaved stereo diff --git a/snd_ogg.c b/snd_ogg.c index 7e37fe7e..79b53409 100644 --- a/snd_ogg.c +++ b/snd_ogg.c @@ -221,7 +221,7 @@ static dllhandle_t vf_dll = NULL; typedef struct { - qbyte *buffer; + unsigned char *buffer; ogg_int64_t ind, buffsize; } ov_decode_t; @@ -374,13 +374,13 @@ void OGG_CloseLibrary (void) // We work with 1 sec sequences, so this buffer must be able to contain // 1 sec of sound of the highest quality (48 KHz, 16 bit samples, stereo) -static qbyte resampling_buffer [48000 * 2 * 2]; +static unsigned char resampling_buffer [48000 * 2 * 2]; // Per-sfx data structure typedef struct { - qbyte *file; + unsigned char *file; size_t filesize; snd_format_t format; } ogg_stream_persfx_t; @@ -570,7 +570,7 @@ Load an Ogg Vorbis file into memory */ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s) { - qbyte *data; + unsigned char *data; ov_decode_t ov_decode; OggVorbis_File vf; vorbis_info *vi; @@ -678,7 +678,7 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s) s->loopstart = -1; s->flags &= ~SFXFLAG_STREAMED; - sb->length = (unsigned int)ResampleSfx ((qbyte *)buff, (size_t)done / (vi->channels * 2), &s->format, sb->data, s->name); + sb->length = (unsigned int)ResampleSfx ((unsigned char *)buff, (size_t)done / (vi->channels * 2), &s->format, sb->data, s->name); s->format.speed = shm->format.speed; s->total_length = sb->length; sb->offset = 0; diff --git a/snd_sdl.c b/snd_sdl.c index 83964094..dbeb3ced 100644 --- a/snd_sdl.c +++ b/snd_sdl.c @@ -106,7 +106,7 @@ qboolean SNDDMA_Init(void) shm->samplepos = 0; shm->samples = AUDIO_SDL_SAMPLES * AUDIO_LOCALFACTOR; shm->bufferlength = shm->samples * shm->format.width; - shm->buffer = (qbyte *)Mem_Alloc( snd_mempool, shm->bufferlength ); + shm->buffer = (unsigned char *)Mem_Alloc( snd_mempool, shm->bufferlength ); // Init the as structure as.buffer = shm->buffer; diff --git a/snd_wav.c b/snd_wav.c index 59b2d49b..4be917db 100644 --- a/snd_wav.c +++ b/snd_wav.c @@ -38,10 +38,10 @@ typedef struct wavinfo_s } wavinfo_t; -static qbyte *data_p; -static qbyte *iff_end; -static qbyte *last_chunk; -static qbyte *iff_data; +static unsigned char *data_p; +static unsigned char *iff_end; +static unsigned char *last_chunk; +static unsigned char *iff_data; static int iff_chunk_len; @@ -122,7 +122,7 @@ static void DumpChunks(void) GetWavinfo ============ */ -static wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength) +static wavinfo_t GetWavinfo (char *name, unsigned char *wav, int wavlength) { wavinfo_t info; int i; @@ -255,7 +255,7 @@ S_LoadWavFile */ qboolean S_LoadWavFile (const char *filename, sfx_t *s) { - qbyte *data; + unsigned char *data; wavinfo_t info; int len; size_t memsize; diff --git a/sv_main.c b/sv_main.c index 99ece146..dc6ea218 100644 --- a/sv_main.c +++ b/sv_main.c @@ -463,7 +463,7 @@ crosses a waterline. */ int sv_writeentitiestoclient_pvsbytes; -qbyte sv_writeentitiestoclient_pvs[MAX_MAP_LEAFS/8]; +unsigned char sv_writeentitiestoclient_pvs[MAX_MAP_LEAFS/8]; static int numsendentities; static entity_state_t sendentities[MAX_EDICTS]; @@ -507,7 +507,7 @@ void SV_PrepareEntitiesForSending(void) flags = 0; i = (int)(PRVM_GETEDICTFIELDVALUE(ent, eval_glow_size)->_float * 0.25f); - glowsize = (qbyte)bound(0, i, 255); + glowsize = (unsigned char)bound(0, i, 255); if (PRVM_GETEDICTFIELDVALUE(ent, eval_glow_trail)->_float) flags |= RENDER_GLOWTRAIL; @@ -519,8 +519,8 @@ void SV_PrepareEntitiesForSending(void) light[2] = (unsigned short)bound(0, f, 65535); f = PRVM_GETEDICTFIELDVALUE(ent, eval_light_lev)->_float; light[3] = (unsigned short)bound(0, f, 65535); - lightstyle = (qbyte)PRVM_GETEDICTFIELDVALUE(ent, eval_style)->_float; - lightpflags = (qbyte)PRVM_GETEDICTFIELDVALUE(ent, eval_pflags)->_float; + lightstyle = (unsigned char)PRVM_GETEDICTFIELDVALUE(ent, eval_style)->_float; + lightpflags = (unsigned char)PRVM_GETEDICTFIELDVALUE(ent, eval_pflags)->_float; if (gamemode == GAME_TENEBRAE) { @@ -587,7 +587,7 @@ void SV_PrepareEntitiesForSending(void) cs.nodrawtoclient = PRVM_GETEDICTFIELDVALUE(ent, eval_nodrawtoclient)->edict; cs.drawonlytoclient = PRVM_GETEDICTFIELDVALUE(ent, eval_drawonlytoclient)->edict; cs.tagentity = PRVM_GETEDICTFIELDVALUE(ent, eval_tag_entity)->edict; - cs.tagindex = (qbyte)PRVM_GETEDICTFIELDVALUE(ent, eval_tag_index)->_float; + cs.tagindex = (unsigned char)PRVM_GETEDICTFIELDVALUE(ent, eval_tag_index)->_float; cs.glowsize = glowsize; // don't need to init cs.colormod because the defaultstate did that for us @@ -607,14 +607,14 @@ void SV_PrepareEntitiesForSending(void) if (f) { i = (int)f; - cs.alpha = (qbyte)bound(0, i, 255); + cs.alpha = (unsigned char)bound(0, i, 255); } // halflife f = (PRVM_GETEDICTFIELDVALUE(ent, eval_renderamt)->_float); if (f) { i = (int)f; - cs.alpha = (qbyte)bound(0, i, 255); + cs.alpha = (unsigned char)bound(0, i, 255); } cs.scale = 16; @@ -622,7 +622,7 @@ void SV_PrepareEntitiesForSending(void) if (f) { i = (int)f; - cs.scale = (qbyte)bound(0, i, 255); + cs.scale = (unsigned char)bound(0, i, 255); } cs.glowcolor = 254; @@ -927,7 +927,7 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t int items; prvm_eval_t *val; vec3_t punchvector; - qbyte viewzoom; + unsigned char viewzoom; const char *s; // @@ -1144,7 +1144,7 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t SV_SendClientDatagram ======================= */ -static qbyte sv_sendclientdatagram_buf[NET_MAXMESSAGE]; // FIXME? +static unsigned char sv_sendclientdatagram_buf[NET_MAXMESSAGE]; // FIXME? qboolean SV_SendClientDatagram (client_t *client) { int rate, maxrate, maxsize, maxsize2; @@ -1310,7 +1310,7 @@ message buffer void SV_SendNop (client_t *client) { sizebuf_t msg; - qbyte buf[4]; + unsigned char buf[4]; msg.data = buf; msg.maxsize = sizeof(buf); @@ -1592,7 +1592,7 @@ void SV_SendReconnect (void) MSG_WriteByte(&sv.reliable_datagram, svc_stufftext); MSG_WriteString(&sv.reliable_datagram, "reconnect\n"); #else - qbyte data[128]; + unsigned char data[128]; sizebuf_t msg; msg.data = data; @@ -1667,8 +1667,8 @@ void SV_IncreaseEdicts(void) for (i = 0, ent = prog->edicts;i < prog->max_edicts;i++, ent++) { - ent->priv.vp = (qbyte*) prog->edictprivate + i * prog->edictprivate_size; - ent->fields.server = (void *)((qbyte *)prog->edictsfields + i * prog->edict_size); + ent->priv.vp = (unsigned char*) prog->edictprivate + i * prog->edictprivate_size; + ent->fields.server = (void *)((unsigned char *)prog->edictsfields + i * prog->edict_size); // link every entity except world if (!ent->priv.server->free) SV_LinkEdict(ent, false); @@ -1784,8 +1784,8 @@ void SV_SpawnServer (const char *server) /*for (i = 0;i < prog->max_edicts;i++) { ent = prog->edicts + i; - ent->priv.vp = (qbyte*) prog->edictprivate + i * prog->edictprivate_size; - ent->fields.server = (void *)((qbyte *)prog->edictsfields + i * prog->edict_size); + ent->priv.vp = (unsigned char*) prog->edictprivate + i * prog->edictprivate_size; + ent->fields.server = (void *)((unsigned char *)prog->edictsfields + i * prog->edict_size); }*/ // fix up client->edict pointers for returning clients right away... diff --git a/sv_phys.c b/sv_phys.c index 922dda3e..3db1887d 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -1498,7 +1498,7 @@ void SV_Physics (void) { int i, newnum_edicts; prvm_edict_t *ent; - qbyte runmove[MAX_EDICTS]; + unsigned char runmove[MAX_EDICTS]; // let the progs know that a new frame has started prog->globals.server->self = PRVM_EDICT_TO_PROG(prog->edicts); diff --git a/svvm_cmds.c b/svvm_cmds.c index 2bb027e5..502c8449 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -552,7 +552,7 @@ void PF_checkpos (void) //============================================================================ int checkpvsbytes; -qbyte checkpvs[MAX_MAP_LEAFS/8]; +unsigned char checkpvs[MAX_MAP_LEAFS/8]; int PF_newcheckclient (int check) { diff --git a/vid_agl.c b/vid_agl.c index e5b92069..f5db4805 100644 --- a/vid_agl.c +++ b/vid_agl.c @@ -454,7 +454,7 @@ static void Handle_KeyMod(UInt32 keymod) prev_keymod = keymod; } -static void Handle_Key(qbyte charcode, qboolean keypressed) +static void Handle_Key(unsigned char charcode, qboolean keypressed) { unsigned int keycode = 0; char ascii = '\0'; diff --git a/vid_wgl.c b/vid_wgl.c index afb773f5..56f730f6 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -294,7 +294,7 @@ void VID_Finish (void) -static qbyte scantokey[128] = +static unsigned char 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 diff --git a/wad.c b/wad.c index 38b0e79f..027dec1a 100644 --- a/wad.c +++ b/wad.c @@ -69,7 +69,7 @@ void *W_GetLumpName(const char *name) static int wad_loaded = false; static int wad_numlumps = 0; static lumpinfo_t *wad_lumps = NULL; - static qbyte *wad_base = NULL; + static unsigned char *wad_base = NULL; W_CleanupName (name, clean); @@ -82,7 +82,7 @@ void *W_GetLumpName(const char *name) Con_Print("gfx.wad doesn't have WAD2 id\n"); else { - wad_base = (qbyte *)Mem_Alloc(cl_mempool, fs_filesize); + wad_base = (unsigned char *)Mem_Alloc(cl_mempool, fs_filesize); memcpy(wad_base, temp, fs_filesize); Mem_Free(temp); @@ -206,13 +206,13 @@ void W_LoadTextureWadFile (char *filename, int complain) } -qbyte *W_ConvertWAD3Texture(miptex_t *tex) +unsigned char *W_ConvertWAD3Texture(miptex_t *tex) { - qbyte *in, *data, *out, *pal; + unsigned char *in, *data, *out, *pal; int d, p; - in = (qbyte *)tex + tex->offsets[0]; - data = out = (qbyte *)Mem_Alloc(tempmempool, tex->width * tex->height * 4); + in = (unsigned char *)tex + tex->offsets[0]; + data = out = (unsigned char *)Mem_Alloc(tempmempool, tex->width * tex->height * 4); if (!data) return NULL; image_width = tex->width; @@ -237,13 +237,13 @@ qbyte *W_ConvertWAD3Texture(miptex_t *tex) return data; } -qbyte *W_GetTexture(char *name) +unsigned char *W_GetTexture(char *name) { char texname[17]; int i, j; qfile_t *file; miptex_t *tex; - qbyte *data; + unsigned char *data; texname[16] = 0; W_CleanupName (name, texname); diff --git a/wad.h b/wad.h index 3c3fc511..39dd7df6 100644 --- a/wad.h +++ b/wad.h @@ -42,7 +42,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct qpic_s { int width, height; - qbyte data[4]; // variably sized + unsigned char data[4]; // variably sized } qpic_t; @@ -67,15 +67,15 @@ typedef struct lumpinfo_s extern int wad_numlumps; extern lumpinfo_t *wad_lumps; -extern qbyte *wad_base; +extern unsigned char *wad_base; void *W_GetLumpName (const char *name); // LordHavoc: added alternate texture WAD2/WAD3 system for easier loading of HalfLife texture wads void W_LoadTextureWadFile (char *filename, int complain); -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 +unsigned char *W_GetTexture (char *name); // returns tempmempool allocated image data, width and height are in image_width and image_height +unsigned char *W_ConvertWAD3Texture(miptex_t *tex); // returns tempmempool allocated image data, width and height are in image_width and image_height #endif diff --git a/zone.c b/zone.c index 590dd839..02e5fa70 100644 --- a/zone.c +++ b/zone.c @@ -90,7 +90,7 @@ void *_Mem_Alloc(mempool_t *pool, size_t size, const char *filename, int filelin clump->largestavailable = MEMBITS - needed; j = 0; choseclump: - mem = (memheader_t *)((qbyte *) clump->block + j * MEMUNIT); + mem = (memheader_t *)((unsigned char *) clump->block + j * MEMUNIT); mem->clump = clump; clump->blocksinuse += needed; for (i = j + needed;j < i;j++) @@ -114,15 +114,15 @@ choseclump: mem->pool = pool; mem->sentinel1 = MEMHEADER_SENTINEL1; // we have to use only a single byte for this sentinel, because it may not be aligned, and some platforms can't use unaligned accesses - *((qbyte *) mem + sizeof(memheader_t) + mem->size) = MEMHEADER_SENTINEL2; + *((unsigned char *) mem + sizeof(memheader_t) + mem->size) = MEMHEADER_SENTINEL2; // append to head of list mem->next = pool->chain; mem->prev = NULL; pool->chain = mem; if (mem->next) mem->next->prev = mem; - memset((void *)((qbyte *) mem + sizeof(memheader_t)), 0, mem->size); - return (void *)((qbyte *) mem + sizeof(memheader_t)); + memset((void *)((unsigned char *) mem + sizeof(memheader_t)), 0, mem->size); + return (void *)((unsigned char *) mem + sizeof(memheader_t)); } void _Mem_Free(void *data, const char *filename, int fileline) @@ -142,10 +142,10 @@ void _Mem_Free(void *data, const char *filename, int fileline) Sys_Error("Mem_Free: data is not allocated (called at %s:%i)", filename, fileline); } - mem = (memheader_t *)((qbyte *) data - sizeof(memheader_t)); + mem = (memheader_t *)((unsigned char *) data - sizeof(memheader_t)); if (mem->sentinel1 != MEMHEADER_SENTINEL1) Sys_Error("Mem_Free: trashed header sentinel 1 (alloc at %s:%i, free at %s:%i)", mem->filename, mem->fileline, filename, fileline); - if (*((qbyte *) mem + sizeof(memheader_t) + mem->size) != MEMHEADER_SENTINEL2) + if (*((unsigned char *) mem + sizeof(memheader_t) + mem->size) != MEMHEADER_SENTINEL2) Sys_Error("Mem_Free: trashed header sentinel 2 (alloc at %s:%i, free at %s:%i)", mem->filename, mem->fileline, filename, fileline); pool = mem->pool; if (developer.integer && developer_memory.integer) @@ -168,7 +168,7 @@ void _Mem_Free(void *data, const char *filename, int fileline) Sys_Error("Mem_Free: trashed clump sentinel 1 (free at %s:%i)", filename, fileline); if (clump->sentinel2 != MEMCLUMP_SENTINEL) Sys_Error("Mem_Free: trashed clump sentinel 2 (free at %s:%i)", filename, fileline); - firstblock = ((qbyte *) mem - (qbyte *) clump->block); + firstblock = ((unsigned char *) mem - (unsigned char *) clump->block); if (firstblock & (MEMUNIT - 1)) Sys_Error("Mem_Free: address not valid in clump (free at %s:%i)", filename, fileline); firstblock /= MEMUNIT; @@ -255,7 +255,7 @@ void _Mem_FreePool(mempool_t **pool, const char *filename, int fileline) // free memory owned by the pool while ((*pool)->chain) - _Mem_Free((void *)((qbyte *) (*pool)->chain + sizeof(memheader_t)), filename, fileline); + _Mem_Free((void *)((unsigned char *) (*pool)->chain + sizeof(memheader_t)), filename, fileline); // free child pools, too for(iter = poolchain; iter; temp = iter = iter->next) @@ -292,7 +292,7 @@ void _Mem_EmptyPool(mempool_t *pool, const char *filename, int fileline) // free memory owned by the pool while (pool->chain) - _Mem_Free((void *)((qbyte *) pool->chain + sizeof(memheader_t)), filename, fileline); + _Mem_Free((void *)((unsigned char *) pool->chain + sizeof(memheader_t)), filename, fileline); // empty child pools, too for(chainaddress = poolchain; chainaddress; chainaddress = chainaddress->next) @@ -308,10 +308,10 @@ void _Mem_CheckSentinels(void *data, const char *filename, int fileline) if (data == NULL) Sys_Error("Mem_CheckSentinels: data == NULL (sentinel check at %s:%i)", filename, fileline); - mem = (memheader_t *)((qbyte *) data - sizeof(memheader_t)); + mem = (memheader_t *)((unsigned char *) data - sizeof(memheader_t)); if (mem->sentinel1 != MEMHEADER_SENTINEL1) Sys_Error("Mem_CheckSentinels: trashed header sentinel 1 (block allocated at %s:%i, sentinel check at %s:%i)", mem->filename, mem->fileline, filename, fileline); - if (*((qbyte *) mem + sizeof(memheader_t) + mem->size) != MEMHEADER_SENTINEL2) + if (*((unsigned char *) mem + sizeof(memheader_t) + mem->size) != MEMHEADER_SENTINEL2) Sys_Error("Mem_CheckSentinels: trashed header sentinel 2 (block allocated at %s:%i, sentinel check at %s:%i)", mem->filename, mem->fileline, filename, fileline); } @@ -342,7 +342,7 @@ void _Mem_CheckSentinelsGlobal(const char *filename, int fileline) } for (pool = poolchain;pool;pool = pool->next) for (mem = pool->chain;mem;mem = mem->next) - _Mem_CheckSentinels((void *)((qbyte *) mem + sizeof(memheader_t)), filename, fileline); + _Mem_CheckSentinels((void *)((unsigned char *) mem + sizeof(memheader_t)), filename, fileline); #if MEMCLUMPING for (pool = poolchain;pool;pool = pool->next) for (clump = pool->clumpchain;clump;clump = clump->chain) @@ -358,7 +358,7 @@ qboolean Mem_IsAllocated(mempool_t *pool, void *data) if (pool) { // search only one pool - target = (memheader_t *)((qbyte *) data - sizeof(memheader_t)); + target = (memheader_t *)((unsigned char *) data - sizeof(memheader_t)); for( header = pool->chain ; header ; header = header->next ) if( header == target ) return true; diff --git a/zone.h b/zone.h index 2d672dbb..12809647 100644 --- a/zone.h +++ b/zone.h @@ -66,7 +66,7 @@ memheader_t; typedef struct memclump_s { // contents of the clump - qbyte block[MEMCLUMPSIZE]; + unsigned char block[MEMCLUMPSIZE]; // should always be MEMCLUMP_SENTINEL unsigned int sentinel1; // if a bit is on, it means that the MEMUNIT bytes it represents are