short texinfo;
// lighting info
- qbyte styles[MAXLIGHTMAPS];
+ unsigned char styles[MAXLIGHTMAPS];
int lightofs; // start of [numstyles*surfsize] samples
} dface_t;
unsigned short firstmarksurface;
unsigned short nummarksurfaces;
- qbyte ambient_level[NUM_AMBIENTS];
+ unsigned char ambient_level[NUM_AMBIENTS];
} dleaf_t;
}
-int CDAudio_SysPlay (qbyte track)
+int CDAudio_SysPlay (unsigned char track)
{
struct ioc_read_toc_entry rte;
struct cd_toc_entry entry;
}
-int CDAudio_SysPlay (qbyte track)
+int CDAudio_SysPlay (unsigned char track)
{
struct cdrom_tocentry entry;
struct cdrom_ti ti;
}
-int CDAudio_SysPlay (qbyte track)
+int CDAudio_SysPlay (unsigned char track)
{
return -1;
}
#include "cdaudio.h"
#include <SDL.h>
-/*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.
}
-int CDAudio_SysPlay (qbyte track)
+int CDAudio_SysPlay (unsigned char track)
{
SDL_CDStop( cd );
endtime = realtime + (float) cd->track[ track - 1 ].length / CD_FPS;
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 );
{
int i;
int numdrives;
-
+
numdrives = SDL_CDNumDrives();
if( numdrives == -1 ) // was the CDROM system initialized correctly?
return -1;
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() )
-
+
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);
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;
qboolean cdValid = false;
qboolean cdPlaying = false;
qboolean cdPlayLooping = false;
-qbyte cdPlayTrack;
+unsigned char cdPlayTrack;
static void CDAudio_Eject (void)
}
-void CDAudio_Play (qbyte track, qboolean looping)
+void CDAudio_Play (unsigned char track, qboolean looping)
{
sfx_t* sfx;
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;
}
}
-int CDAudio_SysPlay (qbyte track)
+int CDAudio_SysPlay (unsigned char track)
{
DWORD dwReturn;
MCI_PLAY_PARMS mciPlayParms;
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)
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);
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;
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;
{
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);
}
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
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
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;
// 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];
/*
=====================
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));
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];
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];
// * 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))
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);
==================
*/
-static qbyte olddata[NET_MAXMESSAGE];
+static unsigned char olddata[NET_MAXMESSAGE];
void CL_KeepaliveMessage (void)
{
float time;
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!
int rnd;
int colorStart, colorLength, count;
float velspeed, radius;
- qbyte *tempcolor;
+ unsigned char *tempcolor;
matrix4x4_t tempmatrix;
type = MSG_ReadByte();
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);
#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];
/*
=====================
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;
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:
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)
{
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;
// 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
}
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
#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;
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;
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;
}
}
-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)
}
}
-void particletextureinvert(qbyte *data)
+void particletextureinvert(unsigned char *data)
{
int i;
for (i = 0;i < PARTICLETEXTURESIZE*PARTICLETEXTURESIZE;i++, data += 4)
}
// 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++)
{
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,
// 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
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);
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;
}
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);
{
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;
}
}
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;
}
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);
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);
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];
{
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
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;
/*
void SCR_CaptureVideo_EndVideo(void)
{
int i, n;
- qbyte out[44];
+ unsigned char out[44];
if (!cl_capturevideo_active)
return;
cl_capturevideo_active = false;
}
}
-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;
{
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)
{
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++)
{
typedef struct drawqueue_s
{
unsigned short size;
- qbyte command, flags;
+ unsigned char command, flags;
unsigned int color;
float x, y, scalex, scaley;
}
return;
}
} while( video->framenum < destframe );
- R_UpdateTexture( video->cpif.tex, (qbyte *)video->imagedata );
+ R_UpdateTexture( video->cpif.tex, (unsigned char *)video->imagedata );
}
}
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;
netconn_t *netcon;
// writing buffer to send to server
sizebuf_t message;
- qbyte message_buf[1024];
+ unsigned char message_buf[1024];
}
client_static_t;
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;
// 2D art drawing queue
// TODO: get rid of this
- qbyte *drawqueue;
+ unsigned char *drawqueue;
int drawqueuesize;
int maxdrawqueuesize;
}
// 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];
/*
============
return;
}
- SZ_Write (&cmd_text, (const qbyte *)text, (int)strlen (text));
+ SZ_Write (&cmd_text, (const unsigned char *)text, (int)strlen (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);
}
}
// 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);
}
/*
short ShortSwap (short l)
{
- qbyte b1,b2;
+ unsigned char b1,b2;
b1 = l&255;
b2 = (l>>8)&255;
int LongSwap (int l)
{
- qbyte b1,b2,b3,b4;
+ unsigned char b1,b2,b3,b4;
b1 = l&255;
b2 = (l>>8)&255;
union
{
float f;
- qbyte b[4];
+ unsigned char b[4];
} dat1, dat2;
// 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];
}
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--)
void MSG_WriteChar (sizebuf_t *sb, int c)
{
- qbyte *buf;
+ unsigned char *buf;
buf = SZ_GetSpace (sb, 1);
buf[0] = c;
void MSG_WriteByte (sizebuf_t *sb, int c)
{
- qbyte *buf;
+ unsigned char *buf;
buf = SZ_GetSpace (sb, 1);
buf[0] = c;
void MSG_WriteShort (sizebuf_t *sb, int c)
{
- qbyte *buf;
+ unsigned char *buf;
buf = SZ_GetSpace (sb, 2);
buf[0] = c&0xff;
void MSG_WriteLong (sizebuf_t *sb, int c)
{
- qbyte *buf;
+ unsigned char *buf;
buf = SZ_GetSpace (sb, 4);
buf[0] = c&0xff;
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)
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)
{
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);
}
// 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;)
{
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);
//============================================================================
#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);
//============================================================================
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;
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;
// 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);
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);
#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;
// 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)]
// 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);
}
}
}
// 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
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
// 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;
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
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)
{
*/
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);
*/
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?
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;
// 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;
}
// 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)
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
// 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)
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);
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);
==============================================================================
*/
-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;
// 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;
//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)
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
static rtexturepool_t *drawtexturepool;
-static qbyte concharimage[FONT_FILESIZE] =
+static unsigned char concharimage[FONT_FILESIZE] =
{
#include "lhfont.h"
};
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;
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];
}
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] == '.')
{
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++)
{
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);
{
#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++)
}
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);
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))
{
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;
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))
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)
{
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
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++)
{
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;
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++)
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++)
{
{
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);
// 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];
/*
===============
{
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;
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;
{
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;
}
}
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;
}
}
-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);
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
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;
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");
}
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
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;
{
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;
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
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);
}
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)
{
int i, count;
sizebuf_t buf;
- qbyte message[4];
+ unsigned char message[4];
Con_DPrintf("Host_ShutdownServer\n");
#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);
}
#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++)
}
#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--)
{
}
// 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)
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)
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);
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];
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);
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)
{
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);
}
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))
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);
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[] =
{
{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();
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;
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;
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;
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;
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;
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);
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);
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
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
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
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
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);
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
{
}
}
-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);
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
{
}
}
-#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);
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
{
if (yi != oldy)
{
- inrow = (qbyte *)indata + inwidth4*yi;
+ inrow = (unsigned char *)indata + inwidth4*yi;
if (yi == oldy+1)
memcpy(resamplerow1, resamplerow2, outwidth4);
else
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);
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
{
if (yi != oldy)
{
- inrow = (qbyte *)indata + inwidth3*yi;
+ inrow = (unsigned char *)indata + inwidth3*yi;
if (yi == oldy+1)
memcpy(resamplerow1, resamplerow2, outwidth3);
else
{
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)
}
// 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)
{
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;
}
{
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;
}
{
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;
}
{
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;
}
{
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;
}
{
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;
}
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));
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);
{
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);
{
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);
// (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);
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;
=================================================================
*/
-// 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
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);
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;
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;
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;
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);
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[] =
{
// 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
struct jpeg_destination_mgr pub;
qfile_t* outfile;
- qbyte* buffer;
+ unsigned char* buffer;
} my_destination_mgr;
typedef my_destination_mgr* my_dest_ptr;
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));
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
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)
line = 0;
while (cinfo.output_scanline < cinfo.output_height)
{
- qbyte *buffer_ptr;
+ unsigned char *buffer_ptr;
int ind;
qjpeg_read_scanlines (&cinfo, &scanline, 1);
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;
}
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;
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
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
{
};
#if 0
-qbyte NormalToByte(const vec3_t n)
+unsigned char NormalToByte(const vec3_t n)
{
int i, best;
float bestdistance, distance;
}
// 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);
#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]);
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;
}
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
// LordHavoc: rewrote this code greatly
if (menuplyr_load)
{
- qbyte *data, *f;
+ unsigned char *data, *f;
menuplyr_load = false;
menuplyr_top = -1;
menuplyr_bottom = -1;
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);
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");
}
}
-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;
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;
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;
int *vertonseam, *vertremap;
skinfile_t *skinfiles;
- datapointer = (qbyte *)buffer;
+ datapointer = (unsigned char *)buffer;
pinmodel = (mdl_t *)datapointer;
datapointer += sizeof(mdl_t);
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 *);
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++;
{
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;
skinfile_t *skinfiles;
pinmodel = (md2_t *)buffer;
- base = (qbyte *)buffer;
+ base = (unsigned char *)buffer;
version = LittleLong (pinmodel->version);
if (version != MD2ALIAS_VERSION)
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 *);
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;
// 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;
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);
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 *);
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");
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__);
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);
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;
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)
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 *);
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)
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)
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 *);
// 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);
// 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);
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;
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];
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];
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];
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);
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)
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];
}
}
- 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)
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;
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++)
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))
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);
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;
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; i<l->filelen; 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)
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')
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;
// 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);
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);
}
// 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]);
}
// REMOVEME
-float SB_ReadFloat (qbyte **buffer)
+float SB_ReadFloat (unsigned char **buffer)
{
union
{
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);
// 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);
}
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);
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;
}
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++)
}
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 *));
//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;
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)
{
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];
}
//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);
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;
}
// 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);
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++)
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)
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);
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
}
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;
}
return model;
}
-qbyte *mod_base;
+unsigned char *mod_base;
//=============================================================================
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;
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;
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]);
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;
}
}
-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;
}
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);
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;
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];
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;
// 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
// 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];
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;
// 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
// 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
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;
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);
}
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;
dspriteinterval_t *pinintervals;
float modelradius, interval;
char name[MAX_QPATH], fogname[MAX_QPATH];
- qbyte *pixbuf;
+ unsigned char *pixbuf;
const void *startframes;
modelradius = 0;
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++)
{
{
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);
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;
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;
typedef struct trivertx_s
{
- qbyte v[3];
- qbyte lightnormalindex;
+ unsigned char v[3];
+ unsigned char lightnormalindex;
}
trivertx_t;
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"};
// 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];
{
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);
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;
}
}
}
-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;
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;
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;
}
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;
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));
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;
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);
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,
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)
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;
{
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;
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
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++];
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);
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;
}
}
-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;
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
//============================================================================
int checkpvsbytes;
-qbyte checkpvs[MAX_MAP_LEAFS/8];
+unsigned char checkpvs[MAX_MAP_LEAFS/8];
int PF_newcheckclient (int check)
{
int s_file; // source file defined in
int numparms;
- qbyte parm_size[MAX_PARMS];
+ unsigned char parm_size[MAX_PARMS];
}
dfunction_t;
int s_file; // source file defined in
int numparms;
- qbyte parm_size[MAX_PARMS];
+ unsigned char parm_size[MAX_PARMS];
}
mfunction_t;
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++)
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;
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
// 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)
{
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)
{
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:
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];
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:
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:
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;
} 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
// (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)
// 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)
{
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);
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));
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;
}
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++)
{
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)
{
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);
}
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++)
{
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)
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;
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]
// 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
// 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);
}
}
//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)();
//
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");
===============
*/
void PRVM_LoadLNO( const char *progname ) {
- qbyte *lno;
+ unsigned char *lno;
unsigned int *header;
char filename[512];
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++)
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;
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 ; i<prog->progs->numstatements ; i++)
// 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)
{
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)
{
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++;
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++;
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:
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];
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:
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:
#ifndef QTYPES_H
#define QTYPES_H
-typedef unsigned char qbyte;
-
#undef true
#undef false
void R_GetCrosshairColor(float *out)
{
int i;
- qbyte *color;
+ unsigned char *color;
float scale, base;
if (cl.viewentity >= 1 && cl.viewentity <= cl.maxclients)
{
}
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
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);
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++)
{
{
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++)
{
#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
{
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)
{
#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);
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;
}
}
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;
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)
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));
}
}
{
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++)
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;
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)
vec3_t lightcolor;
int numleafs, numsurfaces;
int *leaflist, *surfacelist;
- qbyte *leafpvs;
+ unsigned char *leafpvs;
int numlightentities;
int numshadowentities;
entity_render_t *lightentities[MAX_EDICTS];
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
{
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)
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();
}
}
}
- 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);
// 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)
// 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;
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);
int i, k, l, x, f;
char num[12];
scoreboard_t *s;
- qbyte *c;
+ unsigned char *c;
Sbar_SortFrags ();
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
{
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
*/
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);
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
// 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;
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;
}
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.
// 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)
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
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
{
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;
{
unsigned int length;
unsigned int offset;
- qbyte data[4]; // variable sized
+ unsigned char data[4]; // variable sized
} sfxbuffer_t;
typedef struct snd_format_s
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);
// ====================================================================
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;
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))
// 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);
}
// 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
typedef struct
{
- qbyte *buffer;
+ unsigned char *buffer;
ogg_int64_t ind, buffsize;
} ov_decode_t;
// 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;
*/
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;
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;
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;
} 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;
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;
*/
qboolean S_LoadWavFile (const char *filename, sfx_t *s)
{
- qbyte *data;
+ unsigned char *data;
wavinfo_t info;
int len;
size_t memsize;
*/
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];
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;
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)
{
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
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;
if (f)
{
i = (int)f;
- cs.scale = (qbyte)bound(0, i, 255);
+ cs.scale = (unsigned char)bound(0, i, 255);
}
cs.glowcolor = 254;
int items;
prvm_eval_t *val;
vec3_t punchvector;
- qbyte viewzoom;
+ unsigned char viewzoom;
const char *s;
//
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;
void SV_SendNop (client_t *client)
{
sizebuf_t msg;
- qbyte buf[4];
+ unsigned char buf[4];
msg.data = buf;
msg.maxsize = sizeof(buf);
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;
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);
/*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...
{
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);
//============================================================================
int checkpvsbytes;
-qbyte checkpvs[MAX_MAP_LEAFS/8];
+unsigned char checkpvs[MAX_MAP_LEAFS/8];
int PF_newcheckclient (int check)
{
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';
-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
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);
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);
}
-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;
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);
typedef struct qpic_s
{
int width, height;
- qbyte data[4]; // variably sized
+ unsigned char data[4]; // variably sized
} qpic_t;
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
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++)
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)
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)
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;
// 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)
// 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)
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);
}
}
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)
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;
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