short texinfo;
// lighting info
- byte styles[MAXLIGHTMAPS];
+ qbyte styles[MAXLIGHTMAPS];
int lightofs; // start of [numstyles*surfsize] samples
} dface_t;
unsigned short firstmarksurface;
unsigned short nummarksurfaces;
- byte ambient_level[NUM_AMBIENTS];
+ qbyte ambient_level[NUM_AMBIENTS];
} dleaf_t;
extern dmodel_t dmodels[MAX_MAP_MODELS];
extern int visdatasize;
-extern byte dvisdata[MAX_MAP_VISIBILITY];
+extern qbyte dvisdata[MAX_MAP_VISIBILITY];
extern int lightdatasize;
-extern byte dlightdata[MAX_MAP_LIGHTING];
+extern qbyte dlightdata[MAX_MAP_LIGHTING];
extern int texdatasize;
-extern byte dtexdata[MAX_MAP_MIPTEX]; // (dmiptexlump_t)
+extern qbyte dtexdata[MAX_MAP_MIPTEX]; // (dmiptexlump_t)
extern int entdatasize;
extern char dentdata[MAX_MAP_ENTSTRING];
extern int dsurfedges[MAX_MAP_SURFEDGES];
-void DecompressVis (byte *in, byte *decompressed);
-int CompressVis (byte *vis, byte *dest);
+void DecompressVis (qbyte *in, qbyte *decompressed);
+int CompressVis (qbyte *vis, qbyte *dest);
void LoadBSPFile (char *filename);
void WriteBSPFile (char *filename);
// used by menu to ghost CD audio slider
qboolean cdaudioinitialized = false;
static qboolean cdValid = false;
-static qboolean playing = false;
-static qboolean wasPlaying = false;
-static qboolean initialized = false;
-static qboolean enabled = true;
+static qboolean playing = false;
+static qboolean wasPlaying = false;
+static qboolean initialized = false;
+static qboolean enabled = true;
static qboolean playLooping = false;
-static float cdvolume;
-static byte remap[100];
-static byte playTrack;
-static byte maxTrack;
+static float cdvolume;
+static qbyte remap[100];
+static qbyte playTrack;
+static qbyte maxTrack;
static int cdfile = -1;
static char cd_dev[64] = "/dev/cdrom";
}
-void CDAudio_Play(byte track, qboolean looping)
+void CDAudio_Play(qbyte track, qboolean looping)
{
struct cdrom_tocentry entry;
struct cdrom_ti ti;
if (Q_strcasecmp(command, "play") == 0)
{
- CDAudio_Play((byte)atoi(Cmd_Argv (2)), false);
+ CDAudio_Play((qbyte)atoi(Cmd_Argv (2)), false);
return;
}
if (Q_strcasecmp(command, "loop") == 0)
{
- CDAudio_Play((byte)atoi(Cmd_Argv (2)), true);
+ CDAudio_Play((qbyte)atoi(Cmd_Argv (2)), true);
return;
}
qboolean cdaudioinitialized = false;
static qboolean cdValid = false;
-static qboolean playing = false;
-static qboolean wasPlaying = false;
-static qboolean initialized = false;
-static qboolean enabled = false;
+static qboolean playing = false;
+static qboolean wasPlaying = false;
+static qboolean initialized = false;
+static qboolean enabled = false;
static qboolean playLooping = false;
-static float cdvolume;
-static byte remap[100];
-static byte cdrom;
-static byte playTrack;
-static byte maxTrack;
+static float cdvolume;
+static qbyte remap[100];
+static qbyte cdrom;
+static qbyte playTrack;
+static qbyte maxTrack;
UINT wDeviceID;
}
-void CDAudio_Play(byte track, qboolean looping)
+void CDAudio_Play(qbyte track, qboolean looping)
{
DWORD dwReturn;
MCI_PLAY_PARMS mciPlayParms;
if (Q_strcasecmp(command, "play") == 0)
{
- CDAudio_Play((byte)atoi(Cmd_Argv (2)), false);
+ CDAudio_Play((qbyte)atoi(Cmd_Argv (2)), false);
return;
}
if (Q_strcasecmp(command, "loop") == 0)
{
- CDAudio_Play((byte)atoi(Cmd_Argv (2)), true);
+ CDAudio_Play((qbyte)atoi(Cmd_Argv (2)), true);
return;
}
*/
int CDAudio_Init(void);
-void CDAudio_Play(byte track, qboolean looping);
+void CDAudio_Play(qbyte track, qboolean looping);
void CDAudio_Stop(void);
void CDAudio_Pause(void);
void CDAudio_Resume(void);
static void (*cgvm_networkcode[256])(unsigned char num);
-static byte *cgvm_netbuffer;
+static qbyte *cgvm_netbuffer;
static int cgvm_netbufferlength;
static int cgvm_netbufferpos;
CG_Init(); // API call
}
-void CL_CGVM_ParseNetwork(byte *netbuffer, int length)
+void CL_CGVM_ParseNetwork(qbyte *netbuffer, int length)
{
int num;
cgvm_netbuffer = netbuffer;
{
num = CGVM_MSG_ReadByte();
if (cgvm_networkcode[num])
- cgvm_networkcode[num]((byte)num);
+ cgvm_networkcode[num]((qbyte)num);
else
Host_Error("CL_CGVM_ParseNetwork: unregistered network code %i", num);
}
void CL_CGVM_Clear(void);
void CL_CGVM_Frame(void);
void CL_CGVM_Start(void);
-void CL_CGVM_ParseNetwork(byte *netbuffer, int length);
+void CL_CGVM_ParseNetwork(qbyte *netbuffer, int length);
#endif
int i;
int bits;
sizebuf_t buf;
- byte data[128];
+ qbyte data[128];
static double lastmovetime;
static float forwardmove, sidemove, upmove, total; // accumulation
void CL_EstablishConnection (char *host)
{
sizebuf_t buf;
- byte data[128];
+ qbyte data[128];
buf.maxsize = 128;
buf.cursize = 0;
glowcolor = ent->state_current.glowcolor;
if (glowsize)
{
- byte *tempcolor = (byte *)&d_8to24table[glowcolor];
+ qbyte *tempcolor = (qbyte *)&d_8to24table[glowcolor];
dlightcolor[0] += glowsize * tempcolor[0] * (1.0f / 255.0f);
dlightcolor[1] += glowsize * tempcolor[1] * (1.0f / 255.0f);
dlightcolor[2] += glowsize * tempcolor[2] * (1.0f / 255.0f);
static float lastmsg;
int ret;
sizebuf_t old;
- byte olddata[8192];
+ qbyte olddata[8192];
if (sv.active)
return; // no need if server is local
relinked. Other attributes can change without relinking.
==================
*/
-byte entkill[MAX_EDICTS];
+qbyte entkill[MAX_EDICTS];
int bitprofile[32], bitprofilecount = 0;
void CL_ParseUpdate (int bits)
{
#define SHOWNET(x) if(cl_shownet.integer==2)Con_Printf ("%3i:%s\n", msg_readcount-1, x);
-static byte cgamenetbuffer[65536];
+static qbyte cgamenetbuffer[65536];
/*
=====================
{
int cmd;
int i, entitiesupdated;
- byte cmdlog[32];
+ qbyte cmdlog[32];
char *cmdlogname[32], *temp;
int cmdindex, cmdcount = 0;
cl.cdtrack = MSG_ReadByte ();
cl.looptrack = MSG_ReadByte ();
if ( (cls.demoplayback || cls.demorecording) && (cls.forcetrack != -1) )
- CDAudio_Play ((byte)cls.forcetrack, true);
+ CDAudio_Play ((qbyte)cls.forcetrack, true);
else
- CDAudio_Play ((byte)cl.cdtrack, true);
+ CDAudio_Play ((qbyte)cl.cdtrack, true);
break;
case svc_intermission:
float friction; // how much air friction affects this object (objects with a low mass/size ratio tend to get more air friction)
float pressure; // if non-zero, apply pressure to other particles
int dynlight; // if set the particle will be dynamically lit (if cl_dynamicparticles is on), used for smoke and blood
- byte color[4];
+ qbyte color[4];
}
particle_t;
int i, j;
float f;
vec3_t v, end, ang;
- byte noise1[32*32], noise2[32*32];
+ qbyte noise1[32*32], noise2[32*32];
VectorClear(end); // hush MSVC
i = Mod_PointInLeaf(org, cl.worldmodel)->contents;
//qboolean scr_drawloading;
//float scr_disabled_time;
-static byte menuplyr_pixels[4096];
+static qbyte menuplyr_pixels[4096];
/*
===============================================================================
}
//only used for the player color selection menu
-void DrawQ_PicTranslate (int x, int y, char *picname, byte *translation)
+void DrawQ_PicTranslate (int x, int y, char *picname, qbyte *translation)
{
int i, c;
unsigned int trans[4096];
trans[i] = d_8to24table[translation[menuplyr_pixels[i]]];
// FIXME: this is renderer stuff?
- R_UpdateTexture (pic->tex, (byte *)trans);
+ R_UpdateTexture (pic->tex, (qbyte *)trans);
DrawQ_Pic(x, y, picname, 0, 0, 1, 1, 1, 1, 0);
}
void SHOWLMP_decodehide(void)
{
int i;
- byte *lmplabel;
+ qbyte *lmplabel;
lmplabel = MSG_ReadString();
for (i = 0;i < SHOWLMP_MAXLABELS;i++)
if (showlmp[i].isactive && strcmp(showlmp[i].label, lmplabel) == 0)
void SHOWLMP_decodeshow(void)
{
int i, k;
- byte lmplabel[256], picname[256];
+ qbyte lmplabel[256], picname[256];
float x, y;
strcpy(lmplabel,MSG_ReadString());
strcpy(picname, MSG_ReadString());
typedef struct drawqueue_s
{
unsigned short size;
- byte command, flags;
+ qbyte command, flags;
unsigned int color;
float x, y, scalex, scaley;
}
void DrawQ_String(float x, float y, char *string, int maxlen, float scalex, float scaley, float red, float green, float blue, float alpha, int flags);
void DrawQ_Fill (float x, float y, float w, float h, float red, float green, float blue, float alpha, int flags);
// only used for player config menu
-void DrawQ_PicTranslate (int x, int y, char *picname, byte *translation);
+void DrawQ_PicTranslate (int x, int y, char *picname, qbyte *translation);
void SHOWLMP_decodehide(void);
void SHOWLMP_decodeshow(void);
int rnd;
int colorStart, colorLength, count;
float velspeed, radius;
- byte *tempcolor;
+ qbyte *tempcolor;
type = MSG_ReadByte ();
switch (type)
colorLength = MSG_ReadByte ();
CL_ParticleExplosion2 (pos, colorStart, colorLength);
// CL_BlastParticles (pos, 80, 80);
- tempcolor = (byte *)&d_8to24table[(rand()%colorLength) + colorStart];
+ tempcolor = (qbyte *)&d_8to24table[(rand()%colorLength) + colorStart];
CL_AllocDlight (NULL, pos, 350, tempcolor[0] * (1.0f / 255.0f), tempcolor[1] * (1.0f / 255.0f), tempcolor[2] * (1.0f / 255.0f), 700, 0.5);
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
int numparticles;
struct renderparticle_s *particles;
- byte drawqueue[MAX_DRAWQUEUE];
+ qbyte drawqueue[MAX_DRAWQUEUE];
int drawqueuesize;
}
refdef_t;
}
else
for (i=0 ; i<count ; i++)
- ((byte *)dest)[i] = fill;
+ ((qbyte *)dest)[i] = fill;
}
void Q_memcpy (void *dest, void *src, int count)
}
else
for (i=0 ; i<count ; i++)
- ((byte *)dest)[i] = ((byte *)src)[i];
+ ((qbyte *)dest)[i] = ((qbyte *)src)[i];
}
int Q_memcmp (void *m1, void *m2, int count)
while(count)
{
count--;
- if (((byte *)m1)[count] != ((byte *)m2)[count])
+ if (((qbyte *)m1)[count] != ((qbyte *)m2)[count])
return -1;
}
return 0;
short ShortSwap (short l)
{
- byte b1,b2;
+ qbyte b1,b2;
b1 = l&255;
b2 = (l>>8)&255;
int LongSwap (int l)
{
- byte b1,b2,b3,b4;
+ qbyte b1,b2,b3,b4;
b1 = l&255;
b2 = (l>>8)&255;
union
{
float f;
- byte b[4];
+ qbyte b[4];
} dat1, dat2;
void MSG_WriteChar (sizebuf_t *sb, int c)
{
- byte *buf;
+ qbyte *buf;
//#ifdef PARANOID
// if (c < -128 || c > 127)
void MSG_WriteByte (sizebuf_t *sb, int c)
{
- byte *buf;
+ qbyte *buf;
//#ifdef PARANOID
// if (c < 0 || c > 255)
void MSG_WriteShort (sizebuf_t *sb, int c)
{
- byte *buf;
+ qbyte *buf;
//#ifdef PARANOID
// if (c < ((short)0x8000) || c > (short)0x7fff)
void MSG_WriteLong (sizebuf_t *sb, int c)
{
- byte *buf;
+ qbyte *buf;
buf = SZ_GetSpace (sb, 4);
buf[0] = c&0xff;
{
union
{
- byte b[4];
+ qbyte b[4];
float f;
int l;
} dat;
// byte * cast to keep VC++ happy
if (buf->data[buf->cursize-1])
- memcpy ((byte *)SZ_GetSpace(buf, len),data,len); // no trailing 0
+ memcpy ((qbyte *)SZ_GetSpace(buf, len),data,len); // no trailing 0
else
- memcpy ((byte *)SZ_GetSpace(buf, len-1)-1,data,len); // write over trailing 0
+ memcpy ((qbyte *)SZ_GetSpace(buf, len-1)-1,data,len); // write over trailing 0
}
void COM_Init (void)
{
#if !defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG)
- byte swaptest[2] = {1,0};
+ qbyte swaptest[2] = {1,0};
// set the byte swapping variables in a portable manner
if ( *(short *)swaptest == 1)
/// just for debugging
-int memsearch (byte *start, int count, int search)
+int memsearch (qbyte *start, int count, int search)
{
int i;
Always appends a 0 byte.
============
*/
-byte *loadbuf;
-int loadsize;
-byte *COM_LoadFile (char *path, qboolean quiet)
+qbyte *loadbuf;
+int loadsize;
+qbyte *COM_LoadFile (char *path, qboolean quiet)
{
- QFile *h;
- byte *buf;
- char base[1024];
- int len;
+ QFile *h;
+ qbyte *buf;
+ char base[1024];
+ int len;
buf = NULL; // quiet compiler warning
loadsize = 0;
if (!buf)
Sys_Error ("COM_LoadFile: not enough available memory for %s (size %i)", path, len);
- ((byte *)buf)[len] = 0;
+ ((qbyte *)buf)[len] = 0;
Qread (h, buf, len);
Qclose (h);
{
qboolean allowoverflow; // if false, do a Sys_Error
qboolean overflowed; // set to true if the buffer size failed
- byte *data;
+ qbyte *data;
mempool_t *mempool;
int maxsize;
int cursize;
// set by COM_LoadFile functions
extern int loadsize;
-byte *COM_LoadFile (char *path, qboolean quiet);
+qbyte *COM_LoadFile (char *path, qboolean quiet);
int COM_FileExists(char *filename);
//
extern int con_totallines;
extern int con_backscroll;
-extern qboolean con_forcedup; // because no entities to refresh
+extern qboolean con_forcedup; // because no entities to refresh
extern qboolean con_initialized;
-extern byte *con_chars;
-extern int con_notifylines; // scan lines to clear for notify lines
+extern qbyte *con_chars;
+extern int con_notifylines; // scan lines to clear for notify lines
void Con_DrawCharacter (int cx, int line, int num);
*crcvalue = CRC_INIT_VALUE;
}
-void CRC_ProcessByte(unsigned short *crcvalue, byte data)
+void CRC_ProcessByte(unsigned short *crcvalue, qbyte data)
{
*crcvalue = (*crcvalue << 8) ^ crctable[(*crcvalue >> 8) ^ data];
}
// LordHavoc: added for speed reasons
-void CRC_ProcessBytes(unsigned short *crcvalue, byte *data, int size)
+void CRC_ProcessBytes(unsigned short *crcvalue, qbyte *data, int size)
{
unsigned short crc;
crc = *crcvalue;
}
// LordHavoc: further speed and usability improvement
-unsigned short CRC_Block(byte *data, int size)
+unsigned short CRC_Block(qbyte *data, int size)
{
unsigned short crc = CRC_INIT_VALUE;
while (size--)
/* crc.h */
void CRC_Init(unsigned short *crcvalue);
-void CRC_ProcessByte(unsigned short *crcvalue, byte data);
+void CRC_ProcessByte(unsigned short *crcvalue, qbyte data);
// LordHavoc: added this for speed reasons
-void CRC_ProcessBytes(unsigned short *crcvalue, byte *data, int size);
+void CRC_ProcessBytes(unsigned short *crcvalue, qbyte *data, int size);
unsigned short CRC_Value(unsigned short crcvalue);
// LordHavoc: further speed and usability improvement
-unsigned short CRC_Block(byte *data, int size);
+unsigned short CRC_Block(qbyte *data, int size);
#include "quakedef.h"
-void fractalnoise(byte *noise, int size, int startgrid)
+void fractalnoise(qbyte *noise, int size, int startgrid)
{
int x, y, g, g2, amplitude, min, max, size1 = size - 1, sizepower, gridpower;
int *noisebuf;
// normalize noise and copy to output
for (y = 0;y < size;y++)
for (x = 0;x < size;x++)
- *noise++ = (byte) (((n(x,y) - min) * 256) / max);
+ *noise++ = (qbyte) (((n(x,y) - min) * 256) / max);
Mem_Free(noisebuf);
#undef n
}
// unnormalized, used for explosions mainly, does not allocate/free memory (hence the name quick)
-void fractalnoisequick(byte *noise, int size, int startgrid)
+void fractalnoisequick(qbyte *noise, int size, int startgrid)
{
int x, y, g, g2, amplitude, size1 = size - 1, sizepower, gridpower;
#define n(x,y) noise[((y)&size1)*size+((x)&size1)]
// diamond
for (y = 0;y < size;y += g2)
for (x = 0;x < size;x += g2)
- n(x+g,y+g) = (byte) (((int) n(x,y) + (int) n(x+g2,y) + (int) n(x,y+g2) + (int) n(x+g2,y+g2)) >> 2);
+ n(x+g,y+g) = (qbyte) (((int) n(x,y) + (int) n(x+g2,y) + (int) n(x,y+g2) + (int) n(x+g2,y+g2)) >> 2);
// square
for (y = 0;y < size;y += g2)
for (x = 0;x < size;x += g2)
{
- n(x+g,y) = (byte) (((int) n(x,y) + (int) n(x+g2,y) + (int) n(x+g,y-g) + (int) n(x+g,y+g)) >> 2);
- n(x,y+g) = (byte) (((int) n(x,y) + (int) n(x,y+g2) + (int) n(x-g,y+g) + (int) n(x+g,y+g)) >> 2);
+ n(x+g,y) = (qbyte) (((int) n(x,y) + (int) n(x+g2,y) + (int) n(x+g,y-g) + (int) n(x+g,y+g)) >> 2);
+ n(x,y+g) = (qbyte) (((int) n(x,y) + (int) n(x,y+g2) + (int) n(x-g,y+g) + (int) n(x+g,y+g)) >> 2);
}
}
}
typedef struct
{
- byte c[4];
+ qbyte c[4];
}
buf_bcolor_t;
// float to byte color conversion
int *icolor;
float *fcolor;
- byte *bcolor;
+ qbyte *bcolor;
if (!backendactive)
Sys_Error("R_Mesh_Render: called when backend is not active\n");
if (!currentmesh)
void SCR_ScreenShot(char *filename, int x, int y, int width, int height)
{
int i;
- byte *buffer;
+ qbyte *buffer;
buffer = Mem_Alloc(tempmempool, width*height*3);
glReadPixels (x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer);
static rtexturepool_t *drawtexturepool;
-static byte pointerimage[256] =
+static qbyte pointerimage[256] =
{
"333333332......."
"26777761........"
static rtexture_t *draw_generatemousepointer(void)
{
int i;
- byte buffer[256][4];
+ qbyte buffer[256][4];
for (i = 0;i < 256;i++)
{
if (pointerimage[i] == '.')
// must match NUMCROSSHAIRS in r_crosshairs.c
#define NUMCROSSHAIRS 5
-static byte *crosshairtexdata[NUMCROSSHAIRS] =
+static qbyte *crosshairtexdata[NUMCROSSHAIRS] =
{
"................"
"................"
{
int i;
char *in;
- byte data[16*16][4];
+ qbyte 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] = (byte) ((int) (in[i] - '0') * 255 / 7);
+ data[i][3] = (qbyte) ((int) (in[i] - '0') * 255 / 7);
}
}
return R_LoadTexture(drawtexturepool, va("crosshair%i", num), 16, 16, &data[0][0], TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE);
{
if (!strcmp(path, "conchars"))
{
- byte *pix;
+ qbyte *pix;
// conchars is a raw image and with the wrong transparent color
- pix = (byte *)p;
+ pix = (qbyte *)p;
for (i = 0;i < 128 * 128;i++)
if (pix[i] == 0)
pix[i] = 255;
if (color != dq->color)
{
color = dq->color;
- glColor4ub((byte)(((color >> 24) & 0xFF) >> overbright), (byte)(((color >> 16) & 0xFF) >> overbright), (byte)(((color >> 8) & 0xFF) >> overbright), (byte)(color & 0xFF));
+ glColor4ub((qbyte)(((color >> 24) & 0xFF) >> overbright), (qbyte)(((color >> 16) & 0xFF) >> overbright), (qbyte)(((color >> 8) & 0xFF) >> overbright), (qbyte)(color & 0xFF));
}
x = dq->x;
y = dq->y;
void makechrometexture(void)
{
int i;
- byte noise[64*64];
- byte data[64*64][4];
+ qbyte noise[64*64];
+ qbyte data[64*64][4];
fractalnoise(noise, 64, 8);
if (currentrenderentity->colormap >= 0 && (skinframe->base || skinframe->pants || skinframe->shirt))
{
int c;
- byte *color;
+ qbyte *color;
if (skinframe->base)
R_DrawModelMesh(skinframe->base, aliasvertcolor, 0, 0, 0);
if (skinframe->pants)
{
c = (currentrenderentity->colormap & 0xF) << 4;c += (c >= 128 && c < 224) ? 4 : 12; // 128-224 are backwards ranges
- color = (byte *) (&d_8to24table[c]);
+ color = (qbyte *) (&d_8to24table[c]);
if (c >= 224) // fullbright ranges
R_DrawModelMesh(skinframe->pants, NULL, color[0] * (1.0f / 255.0f), color[1] * (1.0f / 255.0f), color[2] * (1.0f / 255.0f));
else
if (skinframe->shirt)
{
c = currentrenderentity->colormap & 0xF0 ;c += (c >= 128 && c < 224) ? 4 : 12; // 128-224 are backwards ranges
- color = (byte *) (&d_8to24table[c]);
+ color = (qbyte *) (&d_8to24table[c]);
if (c >= 224) // fullbright ranges
R_DrawModelMesh(skinframe->shirt, NULL, color[0] * (1.0f / 255.0f), color[1] * (1.0f / 255.0f), color[2] * (1.0f / 255.0f));
else
static signed int blocklights[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*3]; // LordHavoc: *3 for colored lighting
-static byte templight[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*4];
+static qbyte templight[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*4];
cvar_t r_ambient = {0, "r_ambient", "0"};
cvar_t r_vertexsurfaces = {0, "r_vertexsurfaces", "0"};
float ndist;
msurface_t *surf, *endsurf;
int sdtable[256], td, maxdist, maxdist2, maxdist3, i, s, t, smax, tmax, smax3, dist2, impacts, impactt, subtract, a, stained, cr, cg, cb, ca, ratio;
- byte *bl;
+ qbyte *bl;
vec3_t impact;
// LordHavoc: use 64bit integer... shame it's not very standardized...
#if _MSC_VER || __BORLANDC__
cr = (((icolor[4] - icolor[0]) * ratio) >> 8) + icolor[0];
cg = (((icolor[5] - icolor[1]) * ratio) >> 8) + icolor[1];
cb = (((icolor[6] - icolor[2]) * ratio) >> 8) + icolor[2];
- bl[0] = (byte) ((((cr - (int) bl[0]) * a) >> 8) + (int) bl[0]);
- bl[1] = (byte) ((((cg - (int) bl[1]) * a) >> 8) + (int) bl[1]);
- bl[2] = (byte) ((((cb - (int) bl[2]) * a) >> 8) + (int) bl[2]);
+ bl[0] = (qbyte) ((((cr - (int) bl[0]) * a) >> 8) + (int) bl[0]);
+ bl[1] = (qbyte) ((((cg - (int) bl[1]) * a) >> 8) + (int) bl[1]);
+ bl[2] = (qbyte) ((((cb - (int) bl[2]) * a) >> 8) + (int) bl[2]);
stained = true;
}
}
*/
static void R_BuildLightMap (msurface_t *surf, int dlightchanged)
{
- int smax, tmax, i, j, size, size3, shift, scale, maps, *bl, stride, l;
- byte *lightmap, *out, *stain;
+ int smax, tmax, i, j, size, size3, shift, scale, maps, *bl, stride, l;
+ qbyte *lightmap, *out, *stain;
// update cached lighting info
surf->cached_dlight = 0;
static void RSurfShader_Wall_Pass_BaseVertex(msurface_t *s)
{
- int i, size3;
- float c[3], base[3], scale, diff[3], ifog;
- surfvertex_t *v;
- surfvert_t *sv;
- rmeshinfo_t m;
- byte *lm;
+ int i, size3;
+ float c[3], base[3], scale, diff[3], ifog;
+ surfvertex_t *v;
+ surfvert_t *sv;
+ rmeshinfo_t m;
+ qbyte *lm;
size3 = ((s->extents[0]>>4)+1)*((s->extents[1]>>4)+1)*3;
msurface_t *surf, **mark, **endmark;
mleaf_t *leaf;
tinyplane_t plane;
- byte *worldvis;
+ qbyte *worldvis;
worldvis = Mod_LeafPVS (r_viewleaf, cl.worldmodel);
// since there is only one set of GL texture numbers, we have to track them
// globally, everything else is per texture pool
-static byte *gltexnuminuse;
+static qbyte *gltexnuminuse;
typedef struct
{
// location in the image, and size
int x, y, width, height;
// copy of the original texture supplied to the upload function, for re-uploading or deferred uploads (non-precached)
- byte *inputtexels;
+ qbyte *inputtexels;
// to identify cache mismatchs (this might be removed someday)
int crc;
// flags supplied to the LoadTexture/ProceduralTexture functions
// (might be altered to remove TEXF_ALPHA), and GLTEXF_ private flags
int flags;
// procedural texture generation function, called once per frame if the texture is used
- int (*generate)(byte *buffer, int width, int height, void *parameterdata, int parameterdatasize);
+ int (*generate)(qbyte *buffer, int width, int height, void *parameterdata, int parameterdatasize);
// data provided to generate, persistent from call to call
- byte *proceduraldata;
+ qbyte *proceduraldata;
// size of data
int proceduraldatasize;
// used only to avoid updating the texture more than once per frame
static gltexturepool_t *gltexturepoolchain = NULL;
-static byte *resamplerow1 = NULL, *resamplerow2 = NULL;
+static qbyte *resamplerow1 = NULL, *resamplerow2 = NULL;
static int resamplerowsize = 0;
-static byte *resizebuffer = NULL, *colorconvertbuffer;
+static qbyte *resizebuffer = NULL, *colorconvertbuffer;
static int resizebuffersize = 0;
-static byte *texturebuffer;
+static qbyte *texturebuffer;
static int texturebuffersize = 0;
static int realmaxsize = 0;
R_RegisterModule("R_Textures", r_textures_start, r_textures_shutdown, r_textures_newmap);
}
-static void R_ResampleTextureLerpLine (byte *in, byte *out, int inwidth, int outwidth, int bytesperpixel)
+static void R_ResampleTextureLerpLine (qbyte *in, qbyte *out, int inwidth, int outwidth, int bytesperpixel)
{
int j, xi, oldx = 0, f, fstep, endx, lerp;
fstep = (int) (inwidth*65536.0f/outwidth);
if (xi < endx)
{
lerp = f & 0xFFFF;
- *out++ = (byte) ((((in[4] - in[0]) * lerp) >> 16) + in[0]);
- *out++ = (byte) ((((in[5] - in[1]) * lerp) >> 16) + in[1]);
- *out++ = (byte) ((((in[6] - in[2]) * lerp) >> 16) + in[2]);
- *out++ = (byte) ((((in[7] - in[3]) * lerp) >> 16) + in[3]);
+ *out++ = (qbyte) ((((in[4] - in[0]) * lerp) >> 16) + in[0]);
+ *out++ = (qbyte) ((((in[5] - in[1]) * lerp) >> 16) + in[1]);
+ *out++ = (qbyte) ((((in[6] - in[2]) * lerp) >> 16) + in[2]);
+ *out++ = (qbyte) ((((in[7] - in[3]) * lerp) >> 16) + in[3]);
}
else // last pixel of the line has no pixel to lerp to
{
if (xi < endx)
{
lerp = f & 0xFFFF;
- *out++ = (byte) ((((in[3] - in[0]) * lerp) >> 16) + in[0]);
- *out++ = (byte) ((((in[4] - in[1]) * lerp) >> 16) + in[1]);
- *out++ = (byte) ((((in[5] - in[2]) * lerp) >> 16) + in[2]);
+ *out++ = (qbyte) ((((in[3] - in[0]) * lerp) >> 16) + in[0]);
+ *out++ = (qbyte) ((((in[4] - in[1]) * lerp) >> 16) + in[1]);
+ *out++ = (qbyte) ((((in[5] - in[2]) * lerp) >> 16) + in[2]);
}
else // last pixel of the line has no pixel to lerp to
{
{
if (r_lerpimages.integer)
{
- int i, j, yi, oldy, f, fstep, lerp, endy = (inheight-1), inwidth4 = inwidth*4, outwidth4 = outwidth*4;
- byte *inrow, *out;
+ int i, j, yi, oldy, f, fstep, lerp, endy = (inheight-1), inwidth4 = inwidth*4, outwidth4 = outwidth*4;
+ qbyte *inrow, *out;
out = outdata;
fstep = (int) (inheight*65536.0f/outheight);
lerp = f & 0xFFFF;
if (yi != oldy)
{
- inrow = (byte *)indata + inwidth4*yi;
+ inrow = (qbyte *)indata + inwidth4*yi;
if (yi == oldy+1)
memcpy(row1, row2, outwidth4);
else
j = outwidth - 4;
while(j >= 0)
{
-#define LERPBYTE(i) out[i] = (byte) ((((row2[i] - row1[i]) * lerp) >> 16) + row1[i])
+#define LERPBYTE(i) out[i] = (qbyte) ((((row2[i] - row1[i]) * lerp) >> 16) + row1[i])
LERPBYTE( 0);
LERPBYTE( 1);
LERPBYTE( 2);
{
if (yi != oldy)
{
- inrow = (byte *)indata + inwidth4*yi;
+ inrow = (qbyte *)indata + inwidth4*yi;
if (yi == oldy+1)
memcpy(row1, row2, outwidth4);
else
{
if (r_lerpimages.integer)
{
- int i, j, yi, oldy, f, fstep, lerp, endy = (inheight-1), inwidth3 = inwidth * 3, outwidth3 = outwidth * 3;
- byte *inrow, *out;
+ int i, j, yi, oldy, f, fstep, lerp, endy = (inheight-1), inwidth3 = inwidth * 3, outwidth3 = outwidth * 3;
+ qbyte *inrow, *out;
out = outdata;
fstep = (int) (inheight*65536.0f/outheight);
lerp = f & 0xFFFF;
if (yi != oldy)
{
- inrow = (byte *)indata + inwidth3*yi;
+ inrow = (qbyte *)indata + inwidth3*yi;
if (yi == oldy+1)
memcpy(row1, row2, outwidth3);
else
j = outwidth - 4;
while(j >= 0)
{
-#define LERPBYTE(i) out[i] = (byte) ((((row2[i] - row1[i]) * lerp) >> 16) + row1[i])
+#define LERPBYTE(i) out[i] = (qbyte) ((((row2[i] - row1[i]) * lerp) >> 16) + row1[i])
LERPBYTE( 0);
LERPBYTE( 1);
LERPBYTE( 2);
{
if (yi != oldy)
{
- inrow = (byte *)indata + inwidth3*yi;
+ inrow = (qbyte *)indata + inwidth3*yi;
if (yi == oldy+1)
memcpy(row1, row2, outwidth3);
else
{
int i, j, f, inwidth3 = inwidth * 3;
unsigned frac, fracstep;
- byte *inrow, *out;
+ qbyte *inrow, *out;
out = outdata;
fracstep = inwidth*0x10000/outwidth;
for (i = 0;i < outheight;i++)
{
- inrow = (byte *)indata + inwidth3*(i*inheight/outheight);
+ inrow = (qbyte *)indata + inwidth3*(i*inheight/outheight);
frac = fracstep >> 1;
j = outwidth - 4;
while (j >= 0)
}
// in can be the same as out
-static void R_MipReduce(byte *in, byte *out, int *width, int *height, int destwidth, int destheight, int bytesperpixel)
+static void R_MipReduce(qbyte *in, qbyte *out, int *width, int *height, int destwidth, int destheight, int bytesperpixel)
{
int x, y, nextrow;
nextrow = *width * bytesperpixel;
{
for (x = 0;x < *width;x++)
{
- out[0] = (byte) ((in[0] + in[4] + in[nextrow ] + in[nextrow+4]) >> 2);
- out[1] = (byte) ((in[1] + in[5] + in[nextrow+1] + in[nextrow+5]) >> 2);
- out[2] = (byte) ((in[2] + in[6] + in[nextrow+2] + in[nextrow+6]) >> 2);
- out[3] = (byte) ((in[3] + in[7] + in[nextrow+3] + in[nextrow+7]) >> 2);
+ out[0] = (qbyte) ((in[0] + in[4] + in[nextrow ] + in[nextrow+4]) >> 2);
+ out[1] = (qbyte) ((in[1] + in[5] + in[nextrow+1] + in[nextrow+5]) >> 2);
+ out[2] = (qbyte) ((in[2] + in[6] + in[nextrow+2] + in[nextrow+6]) >> 2);
+ out[3] = (qbyte) ((in[3] + in[7] + in[nextrow+3] + in[nextrow+7]) >> 2);
out += 4;
in += 8;
}
{
for (x = 0;x < *width;x++)
{
- out[0] = (byte) ((in[0] + in[3] + in[nextrow ] + in[nextrow+3]) >> 2);
- out[1] = (byte) ((in[1] + in[4] + in[nextrow+1] + in[nextrow+4]) >> 2);
- out[2] = (byte) ((in[2] + in[5] + in[nextrow+2] + in[nextrow+5]) >> 2);
+ out[0] = (qbyte) ((in[0] + in[3] + in[nextrow ] + in[nextrow+3]) >> 2);
+ out[1] = (qbyte) ((in[1] + in[4] + in[nextrow+1] + in[nextrow+4]) >> 2);
+ out[2] = (qbyte) ((in[2] + in[5] + in[nextrow+2] + in[nextrow+5]) >> 2);
out += 3;
in += 6;
}
{
for (x = 0;x < *width;x++)
{
- out[0] = (byte) ((in[0] + in[4]) >> 1);
- out[1] = (byte) ((in[1] + in[5]) >> 1);
- out[2] = (byte) ((in[2] + in[6]) >> 1);
- out[3] = (byte) ((in[3] + in[7]) >> 1);
+ out[0] = (qbyte) ((in[0] + in[4]) >> 1);
+ out[1] = (qbyte) ((in[1] + in[5]) >> 1);
+ out[2] = (qbyte) ((in[2] + in[6]) >> 1);
+ out[3] = (qbyte) ((in[3] + in[7]) >> 1);
out += 4;
in += 8;
}
{
for (x = 0;x < *width;x++)
{
- out[0] = (byte) ((in[0] + in[3]) >> 1);
- out[1] = (byte) ((in[1] + in[4]) >> 1);
- out[2] = (byte) ((in[2] + in[5]) >> 1);
+ out[0] = (qbyte) ((in[0] + in[3]) >> 1);
+ out[1] = (qbyte) ((in[1] + in[4]) >> 1);
+ out[2] = (qbyte) ((in[2] + in[5]) >> 1);
out += 3;
in += 6;
}
{
for (x = 0;x < *width;x++)
{
- out[0] = (byte) ((in[0] + in[nextrow ]) >> 1);
- out[1] = (byte) ((in[1] + in[nextrow+1]) >> 1);
- out[2] = (byte) ((in[2] + in[nextrow+2]) >> 1);
- out[3] = (byte) ((in[3] + in[nextrow+3]) >> 1);
+ out[0] = (qbyte) ((in[0] + in[nextrow ]) >> 1);
+ out[1] = (qbyte) ((in[1] + in[nextrow+1]) >> 1);
+ out[2] = (qbyte) ((in[2] + in[nextrow+2]) >> 1);
+ out[3] = (qbyte) ((in[3] + in[nextrow+3]) >> 1);
out += 4;
in += 4;
}
{
for (x = 0;x < *width;x++)
{
- out[0] = (byte) ((in[0] + in[nextrow ]) >> 1);
- out[1] = (byte) ((in[1] + in[nextrow+1]) >> 1);
- out[2] = (byte) ((in[2] + in[nextrow+2]) >> 1);
+ out[0] = (qbyte) ((in[0] + in[nextrow ]) >> 1);
+ out[1] = (qbyte) ((in[1] + in[nextrow+1]) >> 1);
+ out[2] = (qbyte) ((in[2] + in[nextrow+2]) >> 1);
out += 3;
in += 3;
}
}
}
-static void R_Upload(gltexture_t *glt, byte *data)
+static void R_Upload(gltexture_t *glt, qbyte *data)
{
int mip, width, height, internalformat;
- byte *prevbuffer;
+ qbyte *prevbuffer;
prevbuffer = data;
glBindTexture(GL_TEXTURE_2D, glt->image->texnum);
}
}
-static gltexture_t *R_SetupTexture(gltexturepool_t *pool, char *identifier, int crc, int width, int height, int flags, textypeinfo_t *texinfo, byte *data, int (*generate)(byte *buffer, int width, int height, void *proceduraldata, int proceduraldatasize), void *proceduraldata, int proceduraldatasize)
+static gltexture_t *R_SetupTexture(gltexturepool_t *pool, char *identifier, int crc, int width, int height, int flags, textypeinfo_t *texinfo, qbyte *data, int (*generate)(qbyte *buffer, int width, int height, void *proceduraldata, int proceduraldatasize), void *proceduraldata, int proceduraldatasize)
{
gltexture_t *glt;
glt = Mem_Alloc(texturemempool, sizeof(gltexture_t));
R_LoadTexture
================
*/
-rtexture_t *R_LoadTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, byte *data, int textype, int flags)
+rtexture_t *R_LoadTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, qbyte *data, int textype, int flags)
{
int i;
gltexture_t *glt;
return (rtexture_t *)R_SetupTexture(pool, identifier, crc, width, height, flags | GLTEXF_UPLOAD, texinfo, data, NULL, NULL, 0);
}
-rtexture_t *R_ProceduralTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, int textype, int flags, int (*generate)(byte *buffer, int width, int height, void *proceduraldata, int proceduraldatasize), void *proceduraldata, int proceduraldatasize)
+rtexture_t *R_ProceduralTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, int textype, int flags, int (*generate)(qbyte *buffer, int width, int height, void *proceduraldata, int proceduraldatasize), void *proceduraldata, int proceduraldatasize)
{
gltexture_t *glt;
gltexturepool_t *pool = (gltexturepool_t *)rtexturepool;
return width;
}
-void R_UpdateTexture(rtexture_t *rt, byte *data)
+void R_UpdateTexture(rtexture_t *rt, qbyte *data)
{
gltexture_t *glt;
if (rt == NULL)
int image_width;
int image_height;
-void Image_GammaRemapRGB(byte *in, byte *out, int pixels, byte *gammar, byte *gammag, byte *gammab)
+void Image_GammaRemapRGB(qbyte *in, qbyte *out, int pixels, qbyte *gammar, qbyte *gammag, qbyte *gammab)
{
while (pixels--)
{
}
// note: pal must be 32bit color
-void Image_Copy8bitRGBA(byte *in, byte *out, int pixels, int *pal)
+void Image_Copy8bitRGBA(qbyte *in, qbyte *out, int pixels, int *pal)
{
int *iout = (void *)out;
while (pixels >= 8)
LoadPCX
============
*/
-byte* LoadPCX (byte *f, int matchwidth, int matchheight)
+qbyte* LoadPCX (qbyte *f, int matchwidth, int matchheight)
{
- pcx_t pcx;
- byte *palette, *a, *b, *image_rgba, *fin, *pbuf, *enddata;
- int x, y, x2, dataByte;
+ pcx_t pcx;
+ qbyte *palette, *a, *b, *image_rgba, *fin, *pbuf, *enddata;
+ int x, y, x2, dataByte;
if (loadsize < sizeof(pcx) + 768)
{
LoadTGA
=============
*/
-byte* LoadTGA (byte *f, int matchwidth, int matchheight)
+qbyte *LoadTGA (qbyte *f, int matchwidth, int matchheight)
{
int columns, rows, row, column;
- byte *pixbuf, *image_rgba, *fin, *enddata;
+ qbyte *pixbuf, *image_rgba, *fin, *enddata;
if (loadsize < 18+3)
return NULL;
LoadLMP
============
*/
-byte* LoadLMP (byte *f, int matchwidth, int matchheight)
+qbyte *LoadLMP (qbyte *f, int matchwidth, int matchheight)
{
- byte *image_rgba;
- int width, height;
+ qbyte *image_rgba;
+ int width, height;
if (loadsize < 9)
{
strcpy(out, in);
}
-byte* loadimagepixels (char* filename, qboolean complain, int matchwidth, int matchheight)
+qbyte *loadimagepixels (char *filename, qboolean complain, int matchwidth, int matchheight)
{
- byte *f, *data;
- char basename[256], name[256], *c;
+ qbyte *f, *data;
+ char basename[256], name[256], *c;
Image_StripImageExtension(filename, basename); // strip .tga, .pcx and .lmp extensions to allow replacement by other types
// replace *'s with #, so commandline utils don't get confused when dealing with the external files
for (c = basename;*c;c++)
return NULL;
}
-int image_makemask (byte *in, byte *out, int size)
+int image_makemask (qbyte *in, qbyte *out, int size)
{
int i, count;
count = 0;
return count;
}
-byte* loadimagepixelsmask (char* filename, qboolean complain, int matchwidth, int matchheight)
+qbyte* loadimagepixelsmask (char* filename, qboolean complain, int matchwidth, int matchheight)
{
- byte *in, *data;
+ qbyte *in, *data;
in = data = loadimagepixels(filename, complain, matchwidth, matchheight);
if (!data)
return NULL;
rtexture_t *loadtextureimage (rtexturepool_t *pool, char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap, qboolean precache)
{
- byte *data;
+ qbyte *data;
rtexture_t *rt;
if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight)))
return 0;
rtexture_t *loadtextureimagemask (rtexturepool_t *pool, char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap, qboolean precache)
{
- byte *data;
+ qbyte *data;
rtexture_t *rt;
if (!(data = loadimagepixelsmask (filename, complain, matchwidth, matchheight)))
return 0;
rtexture_t *loadtextureimagewithmask (rtexturepool_t *pool, char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap, qboolean precache)
{
int count;
- byte *data;
+ qbyte *data;
char *filename2;
rtexture_t *rt;
image_masktex = NULL;
return rt;
}
-void Image_WriteTGARGB_preflipped (char *filename, int width, int height, byte *data)
+void Image_WriteTGARGB_preflipped (char *filename, int width, int height, qbyte *data)
{
- byte *buffer, *in, *out, *end;
+ qbyte *buffer, *in, *out, *end;
buffer = Mem_Alloc(tempmempool, width*height*3 + 18);
Mem_Free(buffer);
}
-void Image_WriteTGARGB (char *filename, int width, int height, byte *data)
+void Image_WriteTGARGB (char *filename, int width, int height, qbyte *data)
{
int y;
- byte *buffer, *in, *out, *end;
+ qbyte *buffer, *in, *out, *end;
buffer = Mem_Alloc(tempmempool, width*height*3 + 18);
Mem_Free(buffer);
}
-void Image_WriteTGARGBA (char *filename, int width, int height, byte *data)
+void Image_WriteTGARGBA (char *filename, int width, int height, qbyte *data)
{
int y;
- byte *buffer, *in, *out, *end;
+ qbyte *buffer, *in, *out, *end;
buffer = Mem_Alloc(tempmempool, width*height*4 + 18);
Mem_Free(buffer);
}
-qboolean Image_CheckAlpha(byte *data, int size, qboolean rgba)
+qboolean Image_CheckAlpha(qbyte *data, int size, qboolean rgba)
{
- byte *end;
+ qbyte *end;
if (rgba)
{
// check alpha bytes
-void Image_GammaRemapRGB(byte *in, byte *out, int pixels, byte *gammar, byte *gammag, byte *gammab);
-void Image_Copy8bitRGBA(byte *in, byte *out, int pixels, int *pal);
-int image_makemask (byte *in, byte *out, int size);
-byte* loadimagepixels (char* filename, qboolean complain, int matchwidth, int matchheight);
+void Image_GammaRemapRGB(qbyte *in, qbyte *out, int pixels, qbyte *gammar, qbyte *gammag, qbyte *gammab);
+void Image_Copy8bitRGBA(qbyte *in, qbyte *out, int pixels, int *pal);
+int image_makemask (qbyte *in, qbyte *out, int size);
+qbyte *loadimagepixels (char* filename, qboolean complain, int matchwidth, int matchheight);
rtexture_t *loadtextureimage (rtexturepool_t *pool, char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap, qboolean precache);
-byte* loadimagepixelsmask (char* filename, qboolean complain, int matchwidth, int matchheight);
+qbyte *loadimagepixelsmask (char* filename, qboolean complain, int matchwidth, int matchheight);
rtexture_t *loadtextureimagemask (rtexturepool_t *pool, char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap, qboolean precache);
rtexture_t *image_masktex;
rtexture_t *loadtextureimagewithmask (rtexturepool_t *pool, char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap, qboolean precache);
-void Image_WriteTGARGB_preflipped (char *filename, int width, int height, byte *data);
-void Image_WriteTGARGB (char *filename, int width, int height, byte *data);
-void Image_WriteTGARGBA (char *filename, int width, int height, byte *data);
-qboolean Image_CheckAlpha(byte *data, int size, qboolean rgba);
+void Image_WriteTGARGB_preflipped (char *filename, int width, int height, qbyte *data);
+void Image_WriteTGARGB (char *filename, int width, int height, qbyte *data);
+void Image_WriteTGARGBA (char *filename, int width, int height, qbyte *data);
+qboolean Image_CheckAlpha(qbyte *data, int size, qboolean rgba);
{-0.587785, -0.425325, -0.688191}, {-0.688191, -0.587785, -0.425325},
};
-byte NormalToByte(vec3_t n)
+qbyte NormalToByte(vec3_t n)
{
int i, best;
float bestdistance, distance;
}
// note: uses byte partly to force unsigned for the validity check
-void ByteToNormal(byte num, vec3_t n)
+void ByteToNormal(qbyte num, vec3_t n)
{
if (num < NUMVERTEXNORMALS)
VectorCopy(m_bytenormals[num], n);
#define NUMVERTEXNORMALS 162
extern float m_bytenormals[NUMVERTEXNORMALS][3];
-byte NormalToByte(vec3_t n);
-void ByteToNormal(byte num, vec3_t n);
+qbyte NormalToByte(vec3_t n);
+void ByteToNormal(qbyte num, vec3_t n);
void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]);
void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]);
DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0);
}
-byte identityTable[256];
-byte translationTable[256];
+qbyte identityTable[256];
+qbyte translationTable[256];
void M_BuildTranslationTable(int top, int bottom)
{
- int j;
- byte *dest, *source;
+ int j;
+ qbyte *dest, *source;
for (j = 0; j < 256; j++)
identityTable[j] = j;
}
}
-static rtexture_t *GL_SkinSplitShirt(byte *in, byte *out, int width, int height, int bits, char *name, int precache)
+static rtexture_t *GL_SkinSplitShirt(qbyte *in, qbyte *out, int width, int height, int bits, char *name, int precache)
{
int i, pixels, passed;
- byte pixeltest[16];
+ qbyte pixeltest[16];
for (i = 0;i < 16;i++)
pixeltest[i] = (bits & (1 << i)) != 0;
pixels = width*height;
return NULL;
}
-static rtexture_t *GL_SkinSplit(byte *in, byte *out, int width, int height, int bits, char *name, int precache)
+static rtexture_t *GL_SkinSplit(qbyte *in, qbyte *out, int width, int height, int bits, char *name, int precache)
{
int i, pixels, passed;
- byte pixeltest[16];
+ qbyte pixeltest[16];
for (i = 0;i < 16;i++)
pixeltest[i] = (bits & (1 << i)) != 0;
pixels = width*height;
return NULL;
}
-static void Mod_LoadSkin (char *basename, byte *skindata, byte *skintemp, int width, int height, skinframe_t *skinframe, int precache)
+static void Mod_LoadSkin (char *basename, qbyte *skindata, qbyte *skintemp, int width, int height, skinframe_t *skinframe, int precache)
{
skinframe->base = loadtextureimagewithmask(loadmodel->texturepool, va("%s_normal", basename), 0, 0, false, r_mipskins.integer, precache);
skinframe->fog = image_masktex;
float scales, scalet, scale[3], translate[3], interval;
long datapointer, startframes, startskins;
char name[MAX_QPATH];
- byte *skintemp = NULL;
+ qbyte *skintemp = NULL;
modelyawradius = 0;
modelradius = 0;
sprintf (name, "%s_%i_%i", loadmodel->name, i, j);
else
sprintf (name, "%s_%i", loadmodel->name, i);
- Mod_LoadSkin(name, (byte *)datapointer, skintemp, skinwidth, skinheight, loadmodel->skinframes + totalskins, i == 0);
+ Mod_LoadSkin(name, (qbyte *)datapointer, skintemp, skinwidth, skinheight, loadmodel->skinframes + totalskins, i == 0);
datapointer += skinwidth * skinheight;
totalskins++;
}
zymswapintblock((void *) (pheader->lump_render.start + pbase), pheader->lump_render.length);
// validate renderlist and swap winding order of tris
renderlist = (void *) (pheader->lump_render.start + pbase);
- renderlistend = (void *) ((byte *) renderlist + pheader->lump_render.length);
+ renderlistend = (void *) ((qbyte *) renderlist + pheader->lump_render.length);
i = pheader->numshaders * sizeof(int) + pheader->numtris * sizeof(int[3]);
if (pheader->lump_render.length != i)
Host_Error("Mod_LoadZymoticModel: renderlist is wrong size in %s (is %i bytes, should be %i bytes)\n", loadmodel->name, pheader->lump_render.length, i);
#include "quakedef.h"
-byte mod_novis[(MAX_MAP_LEAFS + 7)/ 8];
+qbyte mod_novis[(MAX_MAP_LEAFS + 7)/ 8];
cvar_t r_subdivide_size = {CVAR_SAVE, "r_subdivide_size", "128"};
cvar_t halflifebsp = {0, "halflifebsp", "0"};
Mod_DecompressVis
===================
*/
-static byte *Mod_DecompressVis (byte *in, model_t *model)
+static qbyte *Mod_DecompressVis (qbyte *in, model_t *model)
{
- static byte decompressed[MAX_MAP_LEAFS/8];
- int c;
- byte *out;
- int row;
+ static qbyte decompressed[MAX_MAP_LEAFS/8];
+ int c;
+ qbyte *out;
+ int row;
row = (model->numleafs+7)>>3;
out = decompressed;
return decompressed;
}
-byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model)
+qbyte *Mod_LeafPVS (mleaf_t *leaf, model_t *model)
{
if (r_novis.integer || leaf == model->leafs || leaf->compressed_vis == NULL)
return mod_novis;
void Mod_SetupNoTexture(void)
{
- int x, y;
- byte pix[16][16][4];
+ int x, y;
+ qbyte pix[16][16][4];
for (y = 0;y < 16;y++)
{
miptex_t *dmiptex;
texture_t *tx, *tx2, *anims[10], *altanims[10];
dmiptexlump_t *m;
- byte *data, *mtdata, *data2;
+ qbyte *data, *mtdata, *data2;
char name[256];
Mod_SetupNoTexture();
dofs[i] = LittleLong(dofs[i]);
if (dofs[i] == -1)
continue;
- dmiptex = (miptex_t *)((byte *)m + dofs[i]);
+ dmiptex = (miptex_t *)((qbyte *)m + dofs[i]);
mtwidth = LittleLong (dmiptex->width);
mtheight = LittleLong (dmiptex->height);
mtdata = NULL;
// texture included
if (j < 40 || j + mtwidth * mtheight > l->filelen)
Host_Error ("Texture %s is corrupt or incomplete\n", dmiptex->name);
- mtdata = (byte *)dmiptex + j;
+ mtdata = (qbyte *)dmiptex + j;
}
if ((mtwidth & 15) || (mtheight & 15))
static void Mod_LoadLighting (lump_t *l)
{
int i;
- byte *in, *out, *data;
- byte d;
+ qbyte *in, *out, *data, d;
char litfilename[1024];
loadmodel->lightdata = NULL;
if (loadmodel->ishlbsp) // LordHavoc: load the colored lighting data straight
strcpy(litfilename, loadmodel->name);
COM_StripExtension(litfilename, litfilename);
strcat(litfilename, ".lit");
- data = (byte*) COM_LoadFile (litfilename, false);
+ data = (qbyte*) COM_LoadFile (litfilename, false);
if (data)
{
if (loadsize > 8 && data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T')
Cvar_SetValue("halflifebsp", mod->ishlbsp);
// swap all the lumps
- mod_base = (byte *)header;
+ mod_base = (qbyte *)header;
for (i=0 ; i<sizeof(dheader_t)/4 ; i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]);
texture_t *currenttexture; // updated (animated) during early surface processing each frame
// index into d_lightstylevalue array, 255 means not used (black)
- byte styles[MAXLIGHTMAPS];
+ qbyte styles[MAXLIGHTMAPS];
// RGB lighting data [numstyles][height][width][3]
- byte *samples;
+ qbyte *samples;
// stain to apply on lightmap (soot/dirt/blood/whatever)
- byte *stainsamples;
+ qbyte *stainsamples;
// these fields are generated during model loading
// the lightmap texture fragment to use on the surface
int dlightbits[8];
int dlightframe;
- byte *compressed_vis;
+ qbyte *compressed_vis;
msurface_t **firstmarksurface;
int nummarksurfaces;
- byte ambient_sound_level[NUM_AMBIENTS];
+ qbyte ambient_sound_level[NUM_AMBIENTS];
}
mleaf_t;
return Mod_LoadModel (Mod_FindName (name), crash, checkdisk, isworldmodel);
}
-byte *mod_base;
+qbyte *mod_base;
/*
=================
int numtextures;
texture_t **textures;
- byte *visdata;
- byte *lightdata;
+ qbyte *visdata;
+ qbyte *lightdata;
char *entities;
int numportals;
// model loading
extern model_t *loadmodel;
-extern byte *mod_base;
+extern qbyte *mod_base;
// sky/water subdivision
extern cvar_t gl_subdivide_size;
// texture fullbrights
void Mod_UnloadModel (model_t *mod);
mleaf_t *Mod_PointInLeaf (float *p, model_t *model);
-byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
+qbyte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
void Mod_ClearUsed(void);
void Mod_PurgeUnused(void);
dspriteinterval_t *pinintervals;
float modelradius, interval;
char tempname[MAX_QPATH], name[MAX_QPATH];
- byte *pixbuf;
+ qbyte *pixbuf;
long startframes;
modelradius = 0;
{
pixbuf = Mem_Alloc(tempmempool, width*height*4);
if (version == SPRITE32_VERSION)
- memcpy(pixbuf, (byte *)datapointer, width*height*4);
+ memcpy(pixbuf, (qbyte *)datapointer, width*height*4);
else //if (version == SPRITE_VERSION || version == SPRITEHL_VERSION)
- Image_Copy8bitRGBA((byte *)datapointer, pixbuf, width*height, palette);
+ Image_Copy8bitRGBA((qbyte *)datapointer, pixbuf, width*height, palette);
loadmodel->sprdata_frames[realframes].texture = R_LoadTexture (loadmodel->texturepool, name, width, height, pixbuf, TEXTYPE_RGBA, TEXF_ALPHA | (r_mipsprites.integer ? TEXF_MIPMAP : 0) | TEXF_PRECACHE);
else if (version == SPRITEHL_VERSION)
{
int i, rendermode;
- byte palette[256][4], *in;
+ qbyte palette[256][4], *in;
dspritehl_t *pinsprite;
long datapointer;
loadmodel->synctype = LittleLong (pinsprite->synctype);
rendermode = pinsprite->rendermode;
- in = (byte *)datapointer;
+ in = (qbyte *)datapointer;
datapointer += 2;
i = in[0] + in[1] * 256;
if (i != 256)
Host_Error ("Mod_LoadHLSprite: unexpected number of palette colors %i (should be 256)", i);
- in = (byte *)datapointer;
+ in = (qbyte *)datapointer;
datapointer += 768;
switch(rendermode)
{
// load this data
typedef struct {
- byte v[3];
- byte lightnormalindex;
+ qbyte v[3];
+ qbyte lightnormalindex;
} trivertx_t;
typedef struct {
unsigned int sendSequence;
unsigned int unreliableSendSequence;
int sendMessageLength;
- byte sendMessage [NET_MAXMESSAGE];
+ qbyte sendMessage [NET_MAXMESSAGE];
unsigned int receiveSequence;
unsigned int unreliableReceiveSequence;
int receiveMessageLength;
- byte receiveMessage [NET_MAXMESSAGE];
+ qbyte receiveMessage [NET_MAXMESSAGE];
struct qsockaddr addr;
char address[NET_NAMELEN];
int (*CloseSocket) (int socket);
int (*Connect) (int socket, struct qsockaddr *addr);
int (*CheckNewConnections) (void);
- int (*Read) (int socket, byte *buf, int len, struct qsockaddr *addr);
- int (*Write) (int socket, byte *buf, int len, struct qsockaddr *addr);
- int (*Broadcast) (int socket, byte *buf, int len);
+ int (*Read) (int socket, qbyte *buf, int len, struct qsockaddr *addr);
+ int (*Write) (int socket, qbyte *buf, int len, struct qsockaddr *addr);
+ int (*Broadcast) (int socket, qbyte *buf, int len);
char * (*AddrToString) (struct qsockaddr *addr);
int (*StringToAddr) (char *string, struct qsockaddr *addr);
int (*GetSocketAddr) (int socket, struct qsockaddr *addr);
{
unsigned int length;
unsigned int sequence;
- byte data[MAX_DATAGRAM];
+ qbyte data[MAX_DATAGRAM];
} packetBuffer;
char *StrAddr (struct qsockaddr *addr)
{
static char buf[34];
- byte *p = (byte *)addr;
+ qbyte *p = (qbyte *)addr;
int n;
for (n = 0; n < 16; n++)
sock->canSend = false;
- if (sfunc.Write (sock->socket, (byte *)&packetBuffer, packetLen, &sock->addr) == -1)
+ if (sfunc.Write (sock->socket, (qbyte *)&packetBuffer, packetLen, &sock->addr) == -1)
return -1;
sock->lastSendTime = net_time;
sock->sendNext = false;
- if (sfunc.Write (sock->socket, (byte *)&packetBuffer, packetLen, &sock->addr) == -1)
+ if (sfunc.Write (sock->socket, (qbyte *)&packetBuffer, packetLen, &sock->addr) == -1)
return -1;
sock->lastSendTime = net_time;
sock->sendNext = false;
- if (sfunc.Write (sock->socket, (byte *)&packetBuffer, packetLen, &sock->addr) == -1)
+ if (sfunc.Write (sock->socket, (qbyte *)&packetBuffer, packetLen, &sock->addr) == -1)
return -1;
sock->lastSendTime = net_time;
packetBuffer.sequence = BigLong(sock->unreliableSendSequence++);
memcpy (packetBuffer.data, data->data, data->cursize);
- if (sfunc.Write (sock->socket, (byte *)&packetBuffer, packetLen, &sock->addr) == -1)
+ if (sfunc.Write (sock->socket, (qbyte *)&packetBuffer, packetLen, &sock->addr) == -1)
return -1;
packetsSent++;
while(1)
{
- length = sfunc.Read (sock->socket, (byte *)&packetBuffer, NET_DATAGRAMSIZE, &readaddr);
+ length = sfunc.Read (sock->socket, (qbyte *)&packetBuffer, NET_DATAGRAMSIZE, &readaddr);
// if ((rand() & 255) > 220)
// continue;
{
packetBuffer.length = BigLong(NET_HEADERSIZE | NETFLAG_ACK);
packetBuffer.sequence = BigLong(sequence);
- sfunc.Write (sock->socket, (byte *)&packetBuffer, NET_HEADERSIZE, &readaddr);
+ sfunc.Write (sock->socket, (qbyte *)&packetBuffer, NET_HEADERSIZE, &readaddr);
if (sequence != sock->receiveSequence)
{
int colors;
int frags;
int connectTime;
- byte playerNumber;
+ qbyte playerNumber;
net_landriverlevel = testDriver;
int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data)
{
- byte *buffer;
- int *bufferLength;
+ qbyte *buffer;
+ int *bufferLength;
if (!sock->driverdata)
return -1;
int Loop_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
{
- byte *buffer;
- int *bufferLength;
+ qbyte *buffer;
+ int *bufferLength;
if (!sock->driverdata)
return -1;
bufferLength = &((qsocket_t *)sock->driverdata)->receiveMessageLength;
- // LordHavoc: added an extra sizeof(byte) to account for alignment
- if ((*bufferLength + data->cursize + sizeof(byte) + sizeof(short) + sizeof(byte)) > NET_MAXMESSAGE)
+ // LordHavoc: added an extra sizeof(qbyte) to account for alignment
+ if ((*bufferLength + data->cursize + sizeof(qbyte) + sizeof(short) + sizeof(qbyte)) > NET_MAXMESSAGE)
return 0;
buffer = ((qsocket_t *)sock->driverdata)->receiveMessage + *bufferLength;
//=============================================================================
-int UDP_Read (int socket, byte *buf, int len, struct qsockaddr *addr)
+int UDP_Read (int socket, qbyte *buf, int len, struct qsockaddr *addr)
{
int addrlen = sizeof (struct qsockaddr);
int ret;
//=============================================================================
-int UDP_Broadcast (int socket, byte *buf, int len)
+int UDP_Broadcast (int socket, qbyte *buf, int len)
{
int ret;
//=============================================================================
-int UDP_Write (int socket, byte *buf, int len, struct qsockaddr *addr)
+int UDP_Write (int socket, qbyte *buf, int len, struct qsockaddr *addr)
{
int ret;
int UDP_CloseSocket (int socket);
int UDP_Connect (int socket, struct qsockaddr *addr);
int UDP_CheckNewConnections (void);
-int UDP_Read (int socket, byte *buf, int len, struct qsockaddr *addr);
-int UDP_Write (int socket, byte *buf, int len, struct qsockaddr *addr);
-int UDP_Broadcast (int socket, byte *buf, int len);
+int UDP_Read (int socket, qbyte *buf, int len, struct qsockaddr *addr);
+int UDP_Write (int socket, qbyte *buf, int len, struct qsockaddr *addr);
+int UDP_Broadcast (int socket, qbyte *buf, int len);
char *UDP_AddrToString (struct qsockaddr *addr);
int UDP_StringToAddr (char *string, struct qsockaddr *addr);
int UDP_GetSocketAddr (int socket, struct qsockaddr *addr);
myAddr = *(int *)local->h_addr_list[0];
addr = ntohl(myAddr);
- sprintf(my_tcpip_address, "%d.%d.%d.%d", (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff);
+ sprintf(my_tcpip_address, "%d.%d.%d.%d", (int) ((addr >> 24) & 0xff), (int) ((addr >> 16) & 0xff), (int) ((addr >> 8) & 0xff), (int) (addr & 0xff));
}
//=============================================================================
-int WINS_Read (int socket, byte *buf, int len, struct qsockaddr *addr)
+int WINS_Read (int socket, qbyte *buf, int len, struct qsockaddr *addr)
{
int addrlen = sizeof (struct qsockaddr);
int ret;
//=============================================================================
-int WINS_Broadcast (int socket, byte *buf, int len)
+int WINS_Broadcast (int socket, qbyte *buf, int len)
{
int ret;
//=============================================================================
-int WINS_Write (int socket, byte *buf, int len, struct qsockaddr *addr)
+int WINS_Write (int socket, qbyte *buf, int len, struct qsockaddr *addr)
{
int ret;
int WINS_CloseSocket (int socket);
int WINS_Connect (int socket, struct qsockaddr *addr);
int WINS_CheckNewConnections (void);
-int WINS_Read (int socket, byte *buf, int len, struct qsockaddr *addr);
-int WINS_Write (int socket, byte *buf, int len, struct qsockaddr *addr);
-int WINS_Broadcast (int socket, byte *buf, int len);
+int WINS_Read (int socket, qbyte *buf, int len, struct qsockaddr *addr);
+int WINS_Write (int socket, qbyte *buf, int len, struct qsockaddr *addr);
+int WINS_Broadcast (int socket, qbyte *buf, int len);
char *WINS_AddrToString (struct qsockaddr *addr);
int WINS_StringToAddr (char *string, struct qsockaddr *addr);
int WINS_GetSocketAddr (int socket, struct qsockaddr *addr);
//=============================================================================
-static byte packetBuffer[NET_DATAGRAMSIZE + 4];
+static qbyte packetBuffer[NET_DATAGRAMSIZE + 4];
-int WIPX_Read (int handle, byte *buf, int len, struct qsockaddr *addr)
+int WIPX_Read (int handle, qbyte *buf, int len, struct qsockaddr *addr)
{
int addrlen = sizeof (struct qsockaddr);
int socket = ipxsocket[handle];
//=============================================================================
-int WIPX_Broadcast (int handle, byte *buf, int len)
+int WIPX_Broadcast (int handle, qbyte *buf, int len)
{
return WIPX_Write (handle, buf, len, &broadcastaddr);
}
//=============================================================================
-int WIPX_Write (int handle, byte *buf, int len, struct qsockaddr *addr)
+int WIPX_Write (int handle, qbyte *buf, int len, struct qsockaddr *addr)
{
int socket = ipxsocket[handle];
int ret;
int WIPX_CloseSocket (int socket);
int WIPX_Connect (int socket, struct qsockaddr *addr);
int WIPX_CheckNewConnections (void);
-int WIPX_Read (int socket, byte *buf, int len, struct qsockaddr *addr);
-int WIPX_Write (int socket, byte *buf, int len, struct qsockaddr *addr);
-int WIPX_Broadcast (int socket, byte *buf, int len);
+int WIPX_Read (int socket, qbyte *buf, int len, struct qsockaddr *addr);
+int WIPX_Write (int socket, qbyte *buf, int len, struct qsockaddr *addr);
+int WIPX_Broadcast (int socket, qbyte *buf, int len);
char *WIPX_AddrToString (struct qsockaddr *addr);
int WIPX_StringToAddr (char *string, struct qsockaddr *addr);
int WIPX_GetSocketAddr (int socket, struct qsockaddr *addr);
#include "quakedef.h"
unsigned int d_8to24table[256];
-//byte d_15to8table[32768];
-byte host_basepal[768];
-byte texgamma[256];
+//qbyte d_15to8table[32768];
+qbyte host_basepal[768];
+qbyte texgamma[256];
cvar_t v_gamma = {CVAR_SAVE, "v_gamma", "1"};
cvar_t v_contrast = {CVAR_SAVE, "v_contrast", "1"};
void Palette_Setup8to24(void)
{
- byte *in, *out;
+ qbyte *in, *out;
unsigned short i;
in = host_basepal;
- out = (byte *) d_8to24table; // d_8to24table is accessed as 32bit for speed reasons, but is created as 8bit bytes
+ out = (qbyte *) d_8to24table; // d_8to24table is accessed as 32bit for speed reasons, but is created as 8bit bytes
for (i=0 ; i<255 ; i++)
{
*out++ = *in++;
/*
void Palette_Setup15to8(void)
{
- byte *pal;
+ qbyte *pal;
unsigned r,g,b;
unsigned v;
int r1,g1,b1;
}
*/
-void BuildGammaTable8(float prescale, float gamma, float scale, float base, byte *out)
+void BuildGammaTable8(float prescale, float gamma, float scale, float base, qbyte *out)
{
int i, adjusted;
double invgamma, d;
void Palette_Init(void)
{
- byte *pal;
- pal = (byte *)COM_LoadFile ("gfx/palette.lmp", false);
+ qbyte *pal;
+ pal = (qbyte *)COM_LoadFile ("gfx/palette.lmp", false);
if (!pal)
Sys_Error ("Couldn't load gfx/palette.lmp");
memcpy(host_basepal, pal, 765);
extern cvar_t v_hwgamma;
extern unsigned int d_8to24table[256];
-//extern byte d_15to8table[32768];
+//extern qbyte d_15to8table[32768];
extern qboolean hardwaregammasupported;
void VID_UpdateGamma(qboolean force);
// used by hardware gamma functions in vid_* files
-void BuildGammaTable8(float prescale, float gamma, float scale, float base, byte *out);
+void BuildGammaTable8(float prescale, float gamma, float scale, float base, qbyte *out);
void BuildGammaTable16(float prescale, float gamma, float scale, float base, unsigned short *out);
void Gamma_Init(void);
//============================================================================
-byte checkpvs[MAX_MAP_LEAFS/8];
+qbyte checkpvs[MAX_MAP_LEAFS/8];
int PF_newcheckclient (int check)
{
int i;
- byte *pvs;
+ qbyte *pvs;
edict_t *ent;
mleaf_t *leaf;
vec3_t org;
int s_file; // source file defined in
int numparms;
- byte parm_size[MAX_PARMS];
+ qbyte parm_size[MAX_PARMS];
} dfunction_t;
Con_DPrintf ("Programs occupy %iK.\n", com_filesize/1024);
- pr_crc = CRC_Block((byte *)progs, com_filesize);
+ pr_crc = CRC_Block((qbyte *)progs, com_filesize);
// byte swap the header
for (i=0 ; i<sizeof(*progs)/4 ; i++)
if (progs->crc != PROGHEADER_CRC)
Host_Error ("progs.dat system vars have been modified, progdefs.h is out of date");
- pr_functions = (dfunction_t *)((byte *)progs + progs->ofs_functions);
+ pr_functions = (dfunction_t *)((qbyte *)progs + progs->ofs_functions);
pr_strings = (char *)progs + progs->ofs_strings;
- pr_globaldefs = (ddef_t *)((byte *)progs + progs->ofs_globaldefs);
+ pr_globaldefs = (ddef_t *)((qbyte *)progs + progs->ofs_globaldefs);
// we need to expand the fielddefs list to include all the engine fields,
// so allocate a new place for it
- infielddefs = (ddef_t *)((byte *)progs + progs->ofs_fielddefs);
+ infielddefs = (ddef_t *)((qbyte *)progs + progs->ofs_fielddefs);
pr_fielddefs = Mem_Alloc(progs_mempool, (progs->numfielddefs + DPFIELDS) * sizeof(ddef_t));
- pr_statements = (dstatement_t *)((byte *)progs + progs->ofs_statements);
+ pr_statements = (dstatement_t *)((qbyte *)progs + progs->ofs_statements);
// moved edict_size calculation down below field adding code
- pr_global_struct = (globalvars_t *)((byte *)progs + progs->ofs_globals);
+ pr_global_struct = (globalvars_t *)((qbyte *)progs + progs->ofs_globals);
pr_globals = (float *)pr_global_struct;
// byte swap the lumps
{
if (n < 0 || n >= sv.max_edicts)
Sys_Error ("EDICT_NUM: bad number %i", n);
- return (edict_t *)((byte *)sv.edicts+ (n)*pr_edict_size);
+ return (edict_t *)((qbyte *)sv.edicts+ (n)*pr_edict_size);
}
*/
{
int b;
- b = (byte *)e - (byte *)sv.edicts;
+ b = (qbyte *)e - (qbyte *)sv.edicts;
b = b / pr_edict_size;
if (b < 0 || b >= sv.num_edicts)
{
int b;
- b = (byte *)e - (byte *)sv.edicts;
+ b = (qbyte *)e - (qbyte *)sv.edicts;
b = b / pr_edict_size;
return b;
}
PR_RunError("Progs attempted to write to an out of bounds edict\n");
return;
}
- if (OPB->_int % pr_edict_size < ((byte *)&sv.edicts->v - (byte *)sv.edicts))
+ if (OPB->_int % pr_edict_size < ((qbyte *)&sv.edicts->v - (qbyte *)sv.edicts))
{
pr_xstatement = st - pr_statements;
PR_RunError("Progs attempted to write to an engine edict field\n");
return;
}
#endif
- ptr = (eval_t *)((byte *)sv.edicts + OPB->_int);
+ ptr = (eval_t *)((qbyte *)sv.edicts + OPB->_int);
ptr->_int = OPA->_int;
break;
case OP_STOREP_V:
return;
}
#endif
- ptr = (eval_t *)((byte *)sv.edicts + OPB->_int);
+ ptr = (eval_t *)((qbyte *)sv.edicts + OPB->_int);
ptr->vector[0] = OPA->vector[0];
ptr->vector[1] = OPA->vector[1];
ptr->vector[2] = OPA->vector[2];
}
#endif
ed = PROG_TO_EDICT(OPA->edict);
- OPC->_int = (byte *)((int *)&ed->v + OPB->_int) - (byte *)sv.edicts;
+ OPC->_int = (qbyte *)((int *)&ed->v + OPB->_int) - (qbyte *)sv.edicts;
break;
case OP_LOAD_F:
PR_RunError("Progs attempted to write to an out of bounds edict\n");
return;
}
- if (OPB->_int % pr_edict_size < ((byte *)&sv.edicts->v - (byte *)sv.edicts))
+ if (OPB->_int % pr_edict_size < ((qbyte *)&sv.edicts->v - (qbyte *)sv.edicts))
{
pr_xstatement = st - pr_statements;
PR_RunError("Progs attempted to write to an engine edict field\n");
return;
}
#endif
- ptr = (eval_t *)((byte *)sv.edicts + OPB->_int);
+ ptr = (eval_t *)((qbyte *)sv.edicts + OPB->_int);
ptr->_int = OPA->_int;
break;
case OP_LOAD_I:
entvars_t v; // C exported fields from progs
// other fields from progs come immediately after
} edict_t;
-//#define EDICT_FROM_AREA(l) ((edict_t *)((byte *)l - (int)&(((edict_t *)0)->area)))
+//#define EDICT_FROM_AREA(l) ((edict_t *)((qbyte *)l - (int)&(((edict_t *)0)->area)))
//#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
// LordHavoc: in an effort to eliminate time wasted on GetEdictFieldValue... see pr_edict.c for the functions which use these.
void ED_LoadFromFile (char *data);
edict_t *EDICT_NUM_ERROR(int n);
-#define EDICT_NUM(n) (n >= 0 ? (n < sv.max_edicts ? (edict_t *)((byte *)sv.edicts + (n) * pr_edict_size) : EDICT_NUM_ERROR(n)) : EDICT_NUM_ERROR(n))
+#define EDICT_NUM(n) (n >= 0 ? (n < sv.max_edicts ? (edict_t *)((qbyte *)sv.edicts + (n) * pr_edict_size) : EDICT_NUM_ERROR(n)) : EDICT_NUM_ERROR(n))
//define EDICT_NUM(n) ((edict_t *)(sv.edicts+ (n)*pr_edict_size))
-//define NUM_FOR_EDICT(e) (((byte *)(e) - sv.edicts)/pr_edict_size)
+//define NUM_FOR_EDICT(e) (((qbyte *)(e) - sv.edicts)/pr_edict_size)
//edict_t *EDICT_NUM(int n);
int NUM_FOR_EDICT(edict_t *e);
-#define NEXT_EDICT(e) ((edict_t *)( (byte *)e + pr_edict_size))
+#define NEXT_EDICT(e) ((edict_t *)( (qbyte *)e + pr_edict_size))
-#define EDICT_TO_PROG(e) ((byte *)e - (byte *)sv.edicts)
-#define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e))
+#define EDICT_TO_PROG(e) ((qbyte *)e - (qbyte *)sv.edicts)
+#define PROG_TO_EDICT(e) ((edict_t *)((qbyte *)sv.edicts + e))
//============================================================================
#define G_FLOAT(o) (pr_globals[o])
#define G_INT(o) (*(int *)&pr_globals[o])
-#define G_EDICT(o) ((edict_t *)((byte *)sv.edicts+ *(int *)&pr_globals[o]))
+#define G_EDICT(o) ((edict_t *)((qbyte *)sv.edicts+ *(int *)&pr_globals[o]))
#define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o))
#define G_VECTOR(o) (&pr_globals[o])
#define G_STRING(o) (pr_strings + *(string_t *)&pr_globals[o])
bits |= E_ORIGIN2;
if ((int) ent->origin[2] != (int) delta->origin[2])
bits |= E_ORIGIN3;
- if ((byte) (ent->angles[0] * (256.0f / 360.0f)) != (byte) (delta->angles[0] * (256.0f / 360.0f)))
+ if ((qbyte) (ent->angles[0] * (256.0f / 360.0f)) != (qbyte) (delta->angles[0] * (256.0f / 360.0f)))
bits |= E_ANGLE1;
- if ((byte) (ent->angles[1] * (256.0f / 360.0f)) != (byte) (delta->angles[1] * (256.0f / 360.0f)))
+ if ((qbyte) (ent->angles[1] * (256.0f / 360.0f)) != (qbyte) (delta->angles[1] * (256.0f / 360.0f)))
bits |= E_ANGLE2;
- if ((byte) (ent->angles[2] * (256.0f / 360.0f)) != (byte) (delta->angles[2] * (256.0f / 360.0f)))
+ if ((qbyte) (ent->angles[2] * (256.0f / 360.0f)) != (qbyte) (delta->angles[2] * (256.0f / 360.0f)))
bits |= E_ANGLE3;
if ((ent->modelindex ^ delta->modelindex) & 0x00FF)
bits |= E_MODEL1;
typedef struct
{
- double time; // time this state was built
- vec3_t origin;
- vec3_t angles;
+ double time; // time this state was built
+ vec3_t origin;
+ vec3_t angles;
int number; // entity number this state is for
unsigned short active; // true if a valid state
unsigned short modelindex;
unsigned short frame;
unsigned short effects;
- byte colormap;
- byte skin;
- byte alpha;
- byte scale;
- byte glowsize;
- byte glowcolor;
- byte flags;
+ qbyte colormap;
+ qbyte skin;
+ qbyte alpha;
+ qbyte scale;
+ qbyte glowsize;
+ qbyte glowcolor;
+ qbyte flags;
}
entity_state_t;
#define QUAKE_GAME // as opposed to utilities
+#include <math.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <setjmp.h>
+
extern char *buildstring;
-#if !defined BYTE_DEFINED
-typedef unsigned char byte;
-#define BYTE_DEFINED 1
-#endif
+typedef unsigned char qbyte;
#undef true
#undef false
#define GAMENAME "id1"
-#include <math.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <setjmp.h>
-
#define MAX_NUM_ARGVS 50
// up / down
void Chase_Update (void);
void fractalnoise(unsigned char *noise, int size, int startgrid);
-void fractalnoisequick(byte *noise, int size, int startgrid);
+void fractalnoisequick(unsigned char *noise, int size, int startgrid);
#include "palette.h"
#include "image.h"
float *prevpoint, prevdist, dist, dot;
// begin with the last point, then enter the loop with the first point as current
- prevpoint = (float *) ((byte *)in + stride * (inpoints - 1));
+ prevpoint = (float *) ((qbyte *)in + stride * (inpoints - 1));
prevdist = DotProduct(prevpoint, plane->normal) - plane->dist;
prevside = prevdist >= 0 ? SIDE_FRONT : SIDE_BACK;
i = 0;
prevpoint = in;
prevdist = dist;
prevside = side;
- (byte *)in += stride;
+ (qbyte *)in += stride;
begin:
dist = DotProduct(in, plane->normal) - plane->dist;
{
polyplane = &localplane;
// calculate the plane for the polygon
- if (!R_Clip_TriangleToPlane((float *) points, (float *) ((byte *)points + stride), (float *) ((byte *)points + 2 * stride), polyplane))
+ if (!R_Clip_TriangleToPlane((float *) points, (float *) ((qbyte *)points + stride), (float *) ((qbyte *)points + 2 * stride), polyplane))
{
for (i = 0;i < numverts;i++)
for (j = i + 1;j < numverts;j++)
for (k = j + 1;k < numverts;k++)
- if (R_Clip_TriangleToPlane((float *) ((byte *)points + i * stride), (float *) ((byte *)points + j * stride), (float *) ((byte *)points + k * stride), polyplane))
+ if (R_Clip_TriangleToPlane((float *) ((qbyte *)points + i * stride), (float *) ((qbyte *)points + j * stride), (float *) ((qbyte *)points + k * stride), polyplane))
goto valid1;
return; // gave up
valid1:;
else
{
// calculate the plane for the polygon
- if (!R_Clip_TriangleToPlane((float *) points, (float *) ((byte *)points + stride), (float *) ((byte *)points + 2 * stride), &localplane))
+ if (!R_Clip_TriangleToPlane((float *) points, (float *) ((qbyte *)points + stride), (float *) ((qbyte *)points + 2 * stride), &localplane))
{
for (i = 0;i < numverts;i++)
for (j = i + 1;j < numverts;j++)
for (k = j + 1;k < numverts;k++)
- if (R_Clip_TriangleToPlane((float *) ((byte *)points + i * stride), (float *) ((byte *)points + j * stride), (float *) ((byte *)points + k * stride), &localplane))
+ if (R_Clip_TriangleToPlane((float *) ((qbyte *)points + i * stride), (float *) ((qbyte *)points + j * stride), (float *) ((qbyte *)points + k * stride), &localplane))
goto valid4;
return; // gave up
valid4:;
#if CLIPTEST
int i;
static int firstupload = true;
- byte clipbuffertex[256*256], *b;
+ qbyte clipbuffertex[256*256], *b;
if (!r_render.integer)
return;
if (clipwidth > 256 || clipheight > 256)
void DrawCrosshair(int num)
{
int i;
- byte *color;
+ qbyte *color;
float scale, base;
char *picname;
cachepic_t *pic;
}
else
i = 15;
- color = (byte *) &d_8to24table[i];
+ color = (qbyte *) &d_8to24table[i];
if (crosshair_flashspeed.value >= 0.01f)
base = (sin(realtime * crosshair_flashspeed.value * (M_PI*2.0f)) * crosshair_flashrange.value);
else
void r_explosion_start(void)
{
int x, y;
- byte noise1[128][128], noise2[128][128], noise3[128][128], data[128][128][4];
+ qbyte noise1[128][128], noise2[128][128], noise3[128][128], data[128][128][4];
explosiontexturepool = R_AllocTexturePool();
fractalnoise(&noise1[0][0], 128, 32);
fractalnoise(&noise2[0][0], 128, 4);
{
int i, j;
float dist;
- byte noise[EXPLOSIONGRID*EXPLOSIONGRID];
+ qbyte noise[EXPLOSIONGRID*EXPLOSIONGRID];
fractalnoisequick(noise, EXPLOSIONGRID, 4);
for (i = 0;i < MAX_EXPLOSIONS;i++)
{
{
float dx, dy;
int x, y, a;
- byte pixels[32][32][4];
+ qbyte pixels[32][32][4];
lighttexturepool = R_AllocTexturePool();
for (y = 0;y < 32;y++)
{
int i, k, m, c, leafnum;
msurface_t *surf, **mark;
mleaf_t *leaf;
- byte *in;
+ qbyte *in;
int row;
float low[3], high[3], dist, maxdist;
if (surf->samples)
{
- byte *lightmap;
+ qbyte *lightmap;
int maps, line3, size3, dsfrac = ds & 15, dtfrac = dt & 15, scale = 0, r00 = 0, g00 = 0, b00 = 0, r01 = 0, g01 = 0, b01 = 0, r10 = 0, g10 = 0, b10 = 0, r11 = 0, g11 = 0, b11 = 0;
line3 = ((surf->extents[0]>>4)+1)*3;
size3 = ((surf->extents[0]>>4)+1) * ((surf->extents[1]>>4)+1)*3; // LordHavoc: *3 for colored lighting
static cvar_t r_drawparticles = {0, "r_drawparticles", "1"};
static cvar_t r_particles_lighting = {0, "r_particles_lighting", "1"};
-static byte shadebubble(float dx, float dy, vec3_t light)
+static qbyte shadebubble(float dx, float dy, vec3_t light)
{
float dz, f, dot;
vec3_t normal;
f *= 128;
f += 16; // just to give it a haze so you can see the outline
f = bound(0, f, 255);
- return (byte) f;
+ return (qbyte) f;
}
else
return 0;
}
-static void setuptex(int cltexnum, int fog, int rtexnum, byte *data, byte *particletexturedata)
+static void setuptex(int cltexnum, int fog, int rtexnum, qbyte *data, qbyte *particletexturedata)
{
int basex, basey, y;
basex = ((rtexnum >> 0) & 7) * 32;
{
int x,y,d,i,m;
float dx, dy, radius, f, f2;
- byte data[32][32][4], noise1[64][64], noise2[64][64];
+ qbyte data[32][32][4], noise1[64][64], noise2[64][64];
vec3_t light;
- byte particletexturedata[256*256*4];
+ qbyte particletexturedata[256*256*4];
memset(particletexturedata, 255, sizeof(particletexturedata));
if (d > 0)
d = (d * (256 - (int) (dx*dx+dy*dy))) >> 8;
d = bound(0, d, 255);
- data[y][x][3] = (byte) d;
+ data[y][x][3] = (qbyte) d;
if (m < d)
m = d;
}
dx = x - 16;
d = (256 - (dx*dx+dy*dy));
d = bound(0, d, 255);
- data[y][x][3] = (byte) d;
+ data[y][x][3] = (qbyte) d;
}
}
setuptex(24, 0, 32, &data[0][0][0], particletexturedata);
static rtexture_t *skyboxside[6];
int R_SetSkyBox(char *sky)
{
- int i;
- char name[1024];
- byte* image_rgba;
+ int i;
+ char name[1024];
+ qbyte *image_rgba;
if (strcmp(sky, skyname) == 0) // no change
return true;
//===============================================================
-static byte skyupperlayerpixels[128*128*4];
-static byte skylowerlayerpixels[128*128*4];
-
/*
=============
R_InitSky
A sky texture is 256*128, with the right side being a masked overlay
==============
*/
-void R_InitSky (byte *src, int bytesperpixel)
+void R_InitSky (qbyte *src, int bytesperpixel)
{
- int i, j, p;
- unsigned trans[128*128];
- unsigned transpix;
- int r, g, b;
- unsigned *rgba;
+ int i, j, p, r, g, b;
+ qbyte skyupperlayerpixels[128*128*4], skylowerlayerpixels[128*128*4];
+ unsigned trans[128*128], transpix, *rgba;
strcpy(skyworldname, loadmodel->name);
p = src[i*256 + j + 128];
rgba = &d_8to24table[p];
trans[(i*128) + j] = *rgba;
- r += ((byte *)rgba)[0];
- g += ((byte *)rgba)[1];
- b += ((byte *)rgba)[2];
+ r += ((qbyte *)rgba)[0];
+ g += ((qbyte *)rgba)[1];
+ b += ((qbyte *)rgba)[2];
}
}
- ((byte *)&transpix)[0] = r/(128*128);
- ((byte *)&transpix)[1] = g/(128*128);
- ((byte *)&transpix)[2] = b/(128*128);
- ((byte *)&transpix)[3] = 0;
+ ((qbyte *)&transpix)[0] = r/(128*128);
+ ((qbyte *)&transpix)[1] = g/(128*128);
+ ((qbyte *)&transpix)[2] = b/(128*128);
+ ((qbyte *)&transpix)[3] = 0;
}
memcpy(skyupperlayerpixels, trans, 128*128*4);
- solidskytexture = R_LoadTexture (skytexturepool, "sky_solidtexture", 128, 128, (byte *) trans, TEXTYPE_RGBA, TEXF_PRECACHE);
+ solidskytexture = R_LoadTexture (skytexturepool, "sky_solidtexture", 128, 128, (qbyte *) trans, TEXTYPE_RGBA, TEXF_PRECACHE);
/*
for (i = 0;i < 128*128;i++)
{
- ((byte *)&trans[i])[0] >>= 1;
- ((byte *)&trans[i])[1] >>= 1;
- ((byte *)&trans[i])[2] >>= 1;
+ ((qbyte *)&trans[i])[0] >>= 1;
+ ((qbyte *)&trans[i])[1] >>= 1;
+ ((qbyte *)&trans[i])[2] >>= 1;
}
- solidskytexture_half = R_LoadTexture (skytexturepool, "sky_solidtexture_half", 128, 128, (byte *) trans, TEXTYPE_RGBA, TEXF_PRECACHE);
+ solidskytexture_half = R_LoadTexture (skytexturepool, "sky_solidtexture_half", 128, 128, (qbyte *) trans, TEXTYPE_RGBA, TEXF_PRECACHE);
*/
if (bytesperpixel == 4)
memcpy(skylowerlayerpixels, trans, 128*128*4);
- alphaskytexture = R_LoadTexture (skytexturepool, "sky_alphatexture", 128, 128, (byte *) trans, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE);
+ alphaskytexture = R_LoadTexture (skytexturepool, "sky_alphatexture", 128, 128, (qbyte *) trans, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE);
/*
for (i = 0;i < 128*128;i++)
{
- ((byte *)&trans[i])[0] >>= 1;
- ((byte *)&trans[i])[1] >>= 1;
- ((byte *)&trans[i])[2] >>= 1;
+ ((qbyte *)&trans[i])[0] >>= 1;
+ ((qbyte *)&trans[i])[1] >>= 1;
+ ((qbyte *)&trans[i])[2] >>= 1;
}
- alphaskytexture_half = R_LoadTexture (skytexturepool, "sky_alphatexture_half", 128, 128, (byte *) trans, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE);
+ alphaskytexture_half = R_LoadTexture (skytexturepool, "sky_alphatexture_half", 128, 128, (qbyte *) trans, TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE);
*/
}
// these two functions add a texture to a pool, and may precache (upload) it
// a normal static texture
-rtexture_t *R_LoadTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, byte *data, int textype, int flags);
+rtexture_t *R_LoadTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, qbyte *data, int textype, int flags);
// a procedurally generated texture, often animated over time, note: generate can be NULL (for odd uses)
-rtexture_t *R_ProceduralTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, int textype, int flags, int (*generate)(byte *buffer, int width, int height, void *parameterdata, int parameterdatasize), void *parameterdata, int parameterdatasize);
+rtexture_t *R_ProceduralTexture (rtexturepool_t *rtexturepool, char *identifier, int width, int height, int textype, int flags, int (*generate)(qbyte *buffer, int width, int height, void *parameterdata, int parameterdatasize), void *parameterdata, int parameterdatasize);
// update the image data of a texture, used by lightmap updates and procedural
// textures.
-void R_UpdateTexture(rtexture_t *rt, byte *data);
+void R_UpdateTexture(rtexture_t *rt, qbyte *data);
// location of the fragment in the texture (note: any parameter except rt can be NULL)
void R_FragmentLocation(rtexture_t *rt, int *x, int *y, float *fx1, float *fy1, float *fx2, float *fy2);
void R_RenderView (void); // must set r_refdef first
-void R_InitSky (byte *src, int bytesperpixel); // called at level load
+void R_InitSky (qbyte *src, int bytesperpixel); // called at level load
//int R_VisibleCullBox (vec3_t mins, vec3_t maxs);
extern vec_t fogdensity;
//#define calcfog(v) (exp(-(fogdensity*fogdensity*(((v)[0] - r_origin[0]) * vpn[0] + ((v)[1] - r_origin[1]) * vpn[1] + ((v)[2] - r_origin[2]) * vpn[2])*(((v)[0] - r_origin[0]) * vpn[0] + ((v)[1] - r_origin[1]) * vpn[1] + ((v)[2] - r_origin[2]) * vpn[2]))))
#define calcfog(v) (exp(-(fogdensity*fogdensity*(((v)[0] - r_origin[0])*((v)[0] - r_origin[0])+((v)[1] - r_origin[1])*((v)[1] - r_origin[1])+((v)[2] - r_origin[2])*((v)[2] - r_origin[2])))))
-#define calcfogbyte(v) ((byte) (bound(0, ((int) ((float) (calcfog((v)) * 255.0f))), 255)))
+#define calcfogbyte(v) ((qbyte) (bound(0, ((int) ((float) (calcfog((v)) * 255.0f))), 255)))
#include "r_modules.h"
int i, k, l, x, f;
char num[12];
scoreboard_t *s;
- byte *c;
+ qbyte *c;
Sbar_SortFrags ();
continue;
// draw background
- c = (byte *)&d_8to24table[(s->colors & 0xf0) + 8];
+ c = (qbyte *)&d_8to24table[(s->colors & 0xf0) + 8];
DrawQ_Fill (sbar_x + x + 10, sbar_y - 23, 28, 4, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0);
- c = (byte *)&d_8to24table[((s->colors & 15)<<4) + 8];
+ c = (qbyte *)&d_8to24table[((s->colors & 15)<<4) + 8];
DrawQ_Fill (sbar_x + x + 10, sbar_y + 4 - 23, 28, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0);
// draw number
{
char num[12];
scoreboard_t *s;
- byte *c;
+ qbyte *c;
s = &cl.scores[cl.viewentity - 1];
// draw background
Sbar_DrawPic (112, 0, rsb_teambord);
- c = (byte *)&d_8to24table[(s->colors & 0xf0) + 8];
+ c = (qbyte *)&d_8to24table[(s->colors & 0xf0) + 8];
DrawQ_Fill (sbar_x + 113, vid.conheight-SBAR_HEIGHT+3, 22, 9, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0);
- c = (byte *)&d_8to24table[((s->colors & 15)<<4) + 8];
+ c = (qbyte *)&d_8to24table[((s->colors & 15)<<4) + 8];
DrawQ_Fill (sbar_x + 113, vid.conheight-SBAR_HEIGHT+12, 22, 9, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0);
// draw number
int i, k, l, x, y, total, n, minutes, tens, units, fph;
char num[128];
scoreboard_t *s;
- byte *c;
+ qbyte *c;
pic = Draw_CachePic ("gfx/ranking.lmp");
DrawQ_Pic ((vid.conwidth - pic->width)/2, 8, "gfx/ranking.lmp", 0, 0, 1, 1, 1, 1, 0);
continue;
// draw background
- c = (byte *)&d_8to24table[(s->colors & 0xf0) + 8];
+ c = (qbyte *)&d_8to24table[(s->colors & 0xf0) + 8];
DrawQ_Fill ( x, y+1, 88, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0);
- c = (byte *)&d_8to24table[((s->colors & 15)<<4) + 8];
+ c = (qbyte *)&d_8to24table[((s->colors & 15)<<4) + 8];
DrawQ_Fill ( x, y+4, 88, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0);
total = cl.time - s->entertime;
int i, l, k, x, y, fph, numlines;
char num[128];
scoreboard_t *s;
- byte *c;
+ qbyte *c;
if (vid.conwidth < 512 || !sb_lines)
return;
continue;
// draw background
- c = (byte *)&d_8to24table[(s->colors & 0xf0) + 8];
+ c = (qbyte *)&d_8to24table[(s->colors & 0xf0) + 8];
DrawQ_Fill ( x, y+1, 72, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0);
- c = (byte *)&d_8to24table[((s->colors & 15)<<4) + 8];
+ c = (qbyte *)&d_8to24table[((s->colors & 15)<<4) + 8];
DrawQ_Fill ( x, y+4, 72, 3, c[0] * (1.0f / 255.0f), c[1] * (1.0f / 255.0f), c[2] * (1.0f / 255.0f), c[3] * (1.0f / 255.0f), 0);
fph = (cl.time - s->entertime) ? (int) ((float) s->frags * 3600.0 / (cl.time - s->entertime)) : 0;
server_state_t state; // some actions are only valid during load
sizebuf_t datagram;
- byte datagram_buf[MAX_DATAGRAM];
+ qbyte datagram_buf[MAX_DATAGRAM];
sizebuf_t reliable_datagram; // copied to all clients at end of frame
- byte reliable_datagram_buf[MAX_DATAGRAM];
+ qbyte reliable_datagram_buf[MAX_DATAGRAM];
sizebuf_t signon;
- byte signon_buf[32768]; // LordHavoc: increased signon message buffer from 8192 to 32768
+ qbyte signon_buf[32768]; // LordHavoc: increased signon message buffer from 8192 to 32768
} server_t;
sizebuf_t message; // can be added to at any time,
// copied and clear once per frame
- byte msgbuf[MAX_MSGLEN];
+ qbyte msgbuf[MAX_MSGLEN];
edict_t *edict; // EDICT_NUM(clientnum+1)
char name[32]; // for printing to other people
int colors;
#include "quakedef.h"
-byte *S_Alloc (int size);
+qbyte *S_Alloc (int size);
/*
================
ResampleSfx
================
*/
-void ResampleSfx (sfx_t *sfx, int inrate, byte *data, char *name)
+void ResampleSfx (sfx_t *sfx, int inrate, qbyte *data, char *name)
{
int outcount;
int srcsample, srclength;
sfxcache_t *S_LoadSound (sfx_t *s)
{
char namebuffer[256];
- byte *data;
+ qbyte *data;
wavinfo_t info;
int len;
float stepscale;
*/
-byte *data_p;
-byte *iff_end;
-byte *last_chunk;
-byte *iff_data;
+qbyte *data_p;
+qbyte *iff_end;
+qbyte *last_chunk;
+qbyte *iff_data;
int iff_chunk_len;
GetWavinfo
============
*/
-wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength)
+wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength)
{
wavinfo_t info;
int i;
int speed;
int width;
int stereo;
- byte data[1]; // variable sized
+ qbyte data[1]; // variable sized
} sfxcache_t;
typedef struct sfx_s
void S_LocalSound (char *s);
sfxcache_t *S_LoadSound (sfx_t *s);
-wavinfo_t GetWavinfo (char *name, byte *wav, int wavlength);
+wavinfo_t GetWavinfo (char *name, qbyte *wav, int wavlength);
void SND_InitScaletable (void);
void SNDDMA_Submit(void);
if (surf->samples)
{
- byte *lightmap;
+ qbyte *lightmap;
int maps, line3, size3, dsfrac = ds & 15, dtfrac = dt & 15, scale = 0, r00 = 0, g00 = 0, b00 = 0, r01 = 0, g01 = 0, b01 = 0, r10 = 0, g10 = 0, b10 = 0, r11 = 0, g11 = 0, b11 = 0;
line3 = ((surf->extents[0]>>4)+1)*3;
size3 = ((surf->extents[0]>>4)+1) * ((surf->extents[1]>>4)+1)*3; // LordHavoc: *3 for colored lighting
*/
int fatbytes;
-byte fatpvs[MAX_MAP_LEAFS/8];
+qbyte fatpvs[MAX_MAP_LEAFS/8];
void SV_AddToFatPVS (vec3_t org, mnode_t *node)
{
int i;
- byte *pvs;
+ qbyte *pvs;
mplane_t *plane;
float d;
given point.
=============
*/
-byte *SV_FatPVS (vec3_t org)
+qbyte *SV_FatPVS (vec3_t org)
{
fatbytes = (sv.worldmodel->numleafs+31)>>3;
memset (fatpvs, 0, fatbytes);
//=============================================================================
-int SV_BoxTouchingPVS (byte *pvs, vec3_t mins, vec3_t maxs, mnode_t *node)
+int SV_BoxTouchingPVS (qbyte *pvs, vec3_t mins, vec3_t maxs, mnode_t *node)
{
int leafnum;
loc0:
{
int e, clentnum, bits, alpha, glowcolor, glowsize, scale, effects;
int culled_pvs, culled_portal, culled_trace, visibleentities, totalentities;
- byte *pvs;
+ qbyte *pvs;
vec3_t org, origin, angles, entmins, entmaxs;
float nextfullupdate;
edict_t *ent;
if (((int)(angles[0]*(256.0/360.0)) & 255) != ((int)(baseline->angles[0]*(256.0/360.0)) & 255)) bits |= U_ANGLE1;
if (((int)(angles[1]*(256.0/360.0)) & 255) != ((int)(baseline->angles[1]*(256.0/360.0)) & 255)) bits |= U_ANGLE2;
if (((int)(angles[2]*(256.0/360.0)) & 255) != ((int)(baseline->angles[2]*(256.0/360.0)) & 255)) bits |= U_ANGLE3;
- if (baseline->colormap != (byte) ent->v.colormap) bits |= U_COLORMAP;
- if (baseline->skin != (byte) ent->v.skin) bits |= U_SKIN;
+ if (baseline->colormap != (qbyte) ent->v.colormap) bits |= U_COLORMAP;
+ if (baseline->skin != (qbyte) ent->v.skin) bits |= U_SKIN;
if ((baseline->frame & 0x00FF) != ((int) ent->v.frame & 0x00FF)) bits |= U_FRAME;
if ((baseline->effects & 0x00FF) != ((int) ent->v.effects & 0x00FF)) bits |= U_EFFECTS;
if ((baseline->modelindex & 0x00FF) != ((int) ent->v.modelindex & 0x00FF)) bits |= U_MODEL;
{
int e, clentnum, flags, alpha, glowcolor, glowsize, scale, effects;
int culled_pvs, culled_portal, culled_trace, visibleentities, totalentities;
- byte *pvs;
+ qbyte *pvs;
vec3_t org, origin, angles, entmins, entmaxs;
edict_t *ent;
eval_t *val;
int items;
eval_t *val;
vec3_t punchvector;
- byte viewzoom;
+ qbyte viewzoom;
//
// send a damage message
*/
qboolean SV_SendClientDatagram (client_t *client)
{
- byte buf[MAX_DATAGRAM];
+ qbyte buf[MAX_DATAGRAM];
sizebuf_t msg;
msg.data = buf;
void SV_SendNop (client_t *client)
{
sizebuf_t msg;
- byte buf[4];
+ qbyte buf[4];
msg.data = buf;
msg.maxsize = sizeof(buf);
static qboolean sc_return_on_enter = false;
HANDLE hinput, houtput;
-static char *tracking_tag = "Clams & Mooses";
+//static char *tracking_tag = "Clams & Mooses";
static HANDLE tevent;
static HANDLE hFile;
/*
================
-filelength
+Sys_FileLength
================
*/
-int filelength (QFile *f)
+int Sys_FileLength (QFile *f)
{
int pos;
int end;
{
sys_handles[i] = f;
*hndl = i;
- retval = filelength(f);
+ retval = Sys_FileLength(f);
}
return retval;
char *Sys_ConsoleInput (void)
{
- static char text[256];
- static int len;
- INPUT_RECORD recs[1024];
- int dummy;
- int ch, numread, numevents;
+ static char text[256];
+ static int len;
+ INPUT_RECORD recs[1024];
+ int ch;
+ DWORD numread, numevents, dummy;
if (cls.state != ca_dedicated)
return NULL;
}
#define UI_QUEUE_SIZE 256
-static byte ui_keyqueue[UI_QUEUE_SIZE];
+static qbyte ui_keyqueue[UI_QUEUE_SIZE];
static int ui_keyqueuepos = 0;
void ui_leftkeyupdate(int pressed)
const char *gl_extensions;
/*-----------------------------------------------------------------------*/
-void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height)
+void D_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height)
{
}
#include <dlfcn.h>
#endif
+#ifndef WIN32
static void *prjobj = NULL;
+#endif
static void gl_getfuncs_begin(void)
{
static vmode_t modelist[MAX_MODE_LIST];
static int nummodes;
-static vmode_t *pcurrentmode;
+//static vmode_t *pcurrentmode;
static vmode_t badmode;
static DEVMODE gdevmode;
int VID_SetMode (int modenum)
{
int original_mode, temp;
- qboolean stat;
+ qboolean stat = 0;
MSG msg;
if ((windowed && (modenum != 0)) || (!windowed && (modenum < 1)) || (!windowed && (modenum >= nummodes)))
-byte scantokey[128] =
+qbyte scantokey[128] =
{
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 ,27 ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' ,'0' ,'-' ,'=' ,K_BACKSPACE,9 , // 0
};
/*
-byte shiftscantokey[128] =
+qbyte shiftscantokey[128] =
{
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 ,27 ,'!' ,'@' ,'#' ,'$' ,'%' ,'^' ,'&' ,'*' ,'(' ,')' ,'_' ,'+' ,K_BACKSPACE,9 , // 0
Con_SafePrintf ("No fullscreen DIB modes found\n");
}
-static int grabsysgamma = true;
+//static int grabsysgamma = true;
WORD systemgammaramps[3][256], currentgammaramps[3][256];
int VID_SetGamma(float prescale, float gamma, float scale, float base)
{
int i;
// int existingmode;
- int basenummodes, width, height, bpp, findbpp, done;
+ int basenummodes, width, height = 0, bpp, findbpp, done;
HDC hdc;
DEVMODE devmode;
extern void M_DrawCharacter (int cx, int line, int num);
extern void M_DrawPic (int x, int y, char *picname);
-static int vid_line, vid_wmodes;
+static int vid_wmodes;
typedef struct
{
static int wad_numlumps;
static lumpinfo_t *wad_lumps;
-static byte *wad_base = NULL;
+static qbyte *wad_base = NULL;
static mempool_t *wad_mempool = NULL;
void SwapPic (qpic_t *pic);
}
/*
-byte hlpalette[768] =
+qbyte hlpalette[768] =
{
0x00,0x00,0x00,0x0F,0x0F,0x0F,0x1F,0x1F,0x1F,0x2F,0x2F,0x2F,0x3F,0x3F,0x3F,0x4B,
0x4B,0x4B,0x5B,0x5B,0x5B,0x6B,0x6B,0x6B,0x7B,0x7B,0x7B,0x8B,0x8B,0x8B,0x9B,0x9B,
};
*/
-byte *W_ConvertWAD3Texture(miptex_t *tex)
+qbyte *W_ConvertWAD3Texture(miptex_t *tex)
{
- byte *in, *data, *out, *pal;
+ qbyte *in, *data, *out, *pal;
// int palsize;
int d, p;
- in = (byte *)((int) tex + tex->offsets[0]);
+ in = (qbyte *)((int) tex + tex->offsets[0]);
data = out = Mem_Alloc(tempmempool, tex->width * tex->height * 4);
if (!data)
return NULL;
return data;
}
-byte *W_GetTexture(char *name)
+qbyte *W_GetTexture(char *name)
{
// int i, c, datasize;
// short colorcount;
-// byte pal[256][3], *indata, *outdata, *data;
+// qbyte pal[256][3], *indata, *outdata, *data;
char texname[17];
int i, j;
QFile *file;
miptex_t *tex;
- byte *data;
+ qbyte *data;
texname[16] = 0;
W_CleanupName (name, texname);
for (i = 0;i < TEXWAD_MAXIMAGES;i++)
typedef struct
{
int width, height;
- byte data[4]; // variably sized
+ qbyte data[4]; // variably sized
} qpic_t;
extern int wad_numlumps;
extern lumpinfo_t *wad_lumps;
-extern byte *wad_base;
+extern qbyte *wad_base;
void W_LoadWadFile (char *filename);
void *W_GetLumpName (char *name);
// LordHavoc: added alternate texture WAD2/WAD3 system for easier loading of HalfLife texture wads
extern int image_width, image_height;
void W_LoadTextureWadFile (char *filename, int complain);
-byte *W_GetTexture (char *name); // returns tempmempool allocated image data, width and height are in image_width and image_height
-byte *W_ConvertWAD3Texture(miptex_t *tex); // returns tempmempool allocated image data, width and height are in image_width and image_height
+qbyte *W_GetTexture (char *name); // returns tempmempool allocated image data, width and height are in image_width and image_height
+qbyte *W_ConvertWAD3Texture(miptex_t *tex); // returns tempmempool allocated image data, width and height are in image_width and image_height
#pragma warning( disable : 4229 ) // mgraph gets this
#include <windows.h>
-#define WM_MOUSEWHEEL 0x020A
#ifndef SERVERONLY
#include <ddraw.h>
#include <dsound.h>
#endif
+#ifndef WM_MOUSEWHEEL
+#define WM_MOUSEWHEEL 0x020A
+#endif
+
extern HINSTANCE global_hInstance;
extern int global_nCmdShow;
// (type *)STRUCT_FROM_LINK(link_t *link, type, member)
// ent = STRUCT_FROM_LINK(link,entity_t,order)
// FIXME: remove this mess!
-//#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m)))
+//#define STRUCT_FROM_LINK(l,t,m) ((t *)((qbyte *)l - (int)&(((t *)0)->m)))
-#define EDICT_FROM_AREA(l) ((edict_t *)((byte *)l - (int)&(((edict_t *)0)->area)))
+#define EDICT_FROM_AREA(l) ((edict_t *)((qbyte *)l - (int)&(((edict_t *)0)->area)))
//============================================================================
typedef struct memclump_s
{
// contents of the clump
- byte block[MEMCLUMPSIZE];
+ qbyte block[MEMCLUMPSIZE];
// should always be MEMCLUMP_SENTINEL
int sentinel1;
// if a bit is on, it means that the MEMUNIT bytes it represents are