relinked. Other attributes can change without relinking.
==================
*/
-//int bitcounts[16];
-
void CL_ParseUpdate (int bits)
{
- int i, modnum, num, skin, alpha, scale, glowsize, glowcolor, colormod;
+ int i, modnum, num, alpha, scale, glowsize, glowcolor, colormod;
model_t *model;
qboolean forcelink;
entity_t *ent;
}
if (bits & U_MOREBITS)
- {
- i = MSG_ReadByte ();
- bits |= (i<<8);
- }
+ bits |= (MSG_ReadByte()<<8);
if (bits & U_EXTEND1 && !Nehahrademcompatibility)
{
bits |= MSG_ReadByte() << 16;
ent = CL_EntityNum (num);
-//for (i=0 ; i<16 ; i++)
-//if (bits&(1<<i))
-// bitcounts[i]++;
-
forcelink = ent->msgtime != cl.mtime[1]; // no previous frame to lerp from
ent->msgtime = cl.mtime[0];
if (bits & U_DELTA)
baseline = &ent->deltabaseline;
+ if (forcelink)
+ {
+ ent->deltabaseline.origin[0] = ent->deltabaseline.origin[1] = ent->deltabaseline.origin[2] = 0;
+ ent->deltabaseline.angles[0] = ent->deltabaseline.angles[1] = ent->deltabaseline.angles[2] = 0;
+ ent->deltabaseline.effects = 0;
+ ent->deltabaseline.modelindex = 0;
+ ent->deltabaseline.frame = 0;
+ ent->deltabaseline.colormap = 0;
+ ent->deltabaseline.skin = 0;
+ ent->deltabaseline.alpha = 255;
+ ent->deltabaseline.scale = 16;
+ ent->deltabaseline.glowsize = 0;
+ ent->deltabaseline.glowcolor = 254;
+ ent->deltabaseline.colormod = 255;
+ }
+
modnum = bits & U_MODEL ? MSG_ReadByte() : baseline->modelindex;
if (modnum >= MAX_MODELS)
Host_Error ("CL_ParseModel: bad modnum");
ent->colormap = cl.scores[i-1].colors; // color it
}
- skin = bits & U_SKIN ? MSG_ReadByte() : baseline->skin;
- if (skin != ent->skinnum)
- {
- ent->skinnum = skin;
- }
- ent->deltabaseline.skin = skin;
+ ent->deltabaseline.skin = ent->skinnum = bits & U_SKIN ? MSG_ReadByte() : baseline->skin;
ent->effects = ((bits & U_EFFECTS) ? MSG_ReadByte() : (baseline->effects & 0xFF));
cl.mvelocity[0][i] = 0;
}
-// [always sent] if (bits & SU_ITEMS)
- i = MSG_ReadLong ();
-
+ i = MSG_ReadLong ();
if (cl.items != i)
{ // set flash times
-// Sbar_Changed ();
for (j=0 ; j<32 ; j++)
if ( (i & (1<<j)) && !(cl.items & (1<<j)))
cl.item_gettime[j] = cl.time;
cl.onground = (bits & SU_ONGROUND) != 0;
cl.inwater = (bits & SU_INWATER) != 0;
- if (bits & SU_WEAPONFRAME)
- cl.stats[STAT_WEAPONFRAME] = MSG_ReadByte ();
- else
- cl.stats[STAT_WEAPONFRAME] = 0;
+ cl.stats[STAT_WEAPONFRAME] = (bits & SU_WEAPONFRAME) ? MSG_ReadByte() : 0;
+ cl.stats[STAT_ARMOR] = (bits & SU_ARMOR) ? MSG_ReadByte() : 0;
+ cl.stats[STAT_WEAPON] = (bits & SU_WEAPON) ? MSG_ReadByte() : 0;
+ cl.stats[STAT_HEALTH] = MSG_ReadShort();
+ cl.stats[STAT_AMMO] = MSG_ReadByte();
- if (bits & SU_ARMOR)
- i = MSG_ReadByte ();
- else
- i = 0;
- if (cl.stats[STAT_ARMOR] != i)
- {
- cl.stats[STAT_ARMOR] = i;
-// Sbar_Changed ();
- }
-
- if (bits & SU_WEAPON)
- i = MSG_ReadByte ();
- else
- i = 0;
- if (cl.stats[STAT_WEAPON] != i)
- {
- cl.stats[STAT_WEAPON] = i;
-// Sbar_Changed ();
- }
-
- i = MSG_ReadShort ();
- if (cl.stats[STAT_HEALTH] != i)
- {
- cl.stats[STAT_HEALTH] = i;
-// Sbar_Changed ();
- }
-
- i = MSG_ReadByte ();
- if (cl.stats[STAT_AMMO] != i)
- {
- cl.stats[STAT_AMMO] = i;
-// Sbar_Changed ();
- }
-
- for (i=0 ; i<4 ; i++)
- {
- j = MSG_ReadByte ();
- if (cl.stats[STAT_SHELLS+i] != j)
- {
- cl.stats[STAT_SHELLS+i] = j;
-// Sbar_Changed ();
- }
- }
+ cl.stats[STAT_SHELLS] = MSG_ReadByte();
+ cl.stats[STAT_NAILS] = MSG_ReadByte();
+ cl.stats[STAT_ROCKETS] = MSG_ReadByte();
+ cl.stats[STAT_CELLS] = MSG_ReadByte();
i = MSG_ReadByte ();
if (standard_quake)
- {
- if (cl.stats[STAT_ACTIVEWEAPON] != i)
- {
- cl.stats[STAT_ACTIVEWEAPON] = i;
-// Sbar_Changed ();
- }
- }
+ cl.stats[STAT_ACTIVEWEAPON] = i;
else
- {
- if (cl.stats[STAT_ACTIVEWEAPON] != (1<<i))
- {
- cl.stats[STAT_ACTIVEWEAPON] = (1<<i);
-// Sbar_Changed ();
- }
- }
+ cl.stats[STAT_ACTIVEWEAPON] = (1<<i);
}
/*
break;
case svc_updatename:
-// Sbar_Changed ();
i = MSG_ReadByte ();
if (i >= cl.maxclients)
Host_Error ("CL_ParseServerMessage: svc_updatename > MAX_SCOREBOARD");
break;
case svc_updatefrags:
-// Sbar_Changed ();
i = MSG_ReadByte ();
if (i >= cl.maxclients)
Host_Error ("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD");
break;
case svc_updatecolors:
-// Sbar_Changed ();
i = MSG_ReadByte ();
if (i >= cl.maxclients)
Host_Error ("CL_ParseServerMessage: svc_updatecolors > MAX_SCOREBOARD");
pic->pic.height = dat->height;
gl = (glpic_t *)pic->pic.data;
- gl->texnum = GL_LoadPicTexture (dat);
+ gl->texnum = loadtextureimage(path, 0, 0, false, false);
+ if (!gl->texnum)
+ gl->texnum = GL_LoadPicTexture (dat);
gl->sl = 0;
gl->sh = 1;
gl->tl = 0;
scr_fullupdate = 0; // force a background redraw
vid.recalc_refdef = 0;
-// force the status bar to redraw
-// Sbar_Changed ();
-
//========================================
// bound viewsize
==============================================================================
*/
-typedef struct _TargaHeader {
- unsigned char id_length, colormap_type, image_type;
- unsigned short colormap_index, colormap_length;
- unsigned char colormap_size;
- unsigned short x_origin, y_origin, width, height;
- unsigned char pixel_size, attributes;
-} TargaHeader;
-
-
/*
==================
SCR_ScreenShot_f
void SCR_ScreenShot_f (void)
{
byte *buffer;
- char pcxname[80];
+ char filename[80];
char checkname[MAX_OSPATH];
- int i, c, temp;
+ int i;
//
// find a file name to save it to
//
- strcpy(pcxname,"dp0000.tga");
+ strcpy(filename,"dp0000.tga");
for (i=0 ; i<=9999 ; i++)
{
- pcxname[2] = (i/1000)%10 + '0';
- pcxname[3] = (i/ 100)%10 + '0';
- pcxname[4] = (i/ 10)%10 + '0';
- pcxname[5] = (i/ 1)%10 + '0';
- sprintf (checkname, "%s/%s", com_gamedir, pcxname);
+ filename[2] = (i/1000)%10 + '0';
+ filename[3] = (i/ 100)%10 + '0';
+ filename[4] = (i/ 10)%10 + '0';
+ filename[5] = (i/ 1)%10 + '0';
+ sprintf (checkname, "%s/%s", com_gamedir, filename);
if (Sys_FileTime(checkname) == -1)
break; // file doesn't exist
}
return;
}
-
- buffer = malloc(glwidth*glheight*3 + 18);
- memset (buffer, 0, 18);
- buffer[2] = 2; // uncompressed type
- buffer[12] = glwidth&255;
- buffer[13] = glwidth>>8;
- buffer[14] = glheight&255;
- buffer[15] = glheight>>8;
- buffer[16] = 24; // pixel size
-
- if (r_render.value)
- glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, buffer+18 );
-
- // swap rgb to bgr
- c = 18+glwidth*glheight*3;
- for (i=18 ; i<c ; i+=3)
- {
- temp = buffer[i];
- buffer[i] = buffer[i+2];
- buffer[i+2] = temp;
- }
- COM_WriteFile (pcxname, buffer, glwidth*glheight*3 + 18 );
+ buffer = malloc(glwidth*glheight*3);
+ glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, buffer);
+ Image_WriteTGARGB(filename, glwidth, glheight, buffer);
free (buffer);
- Con_Printf ("Wrote %s\n", pcxname);
+ Con_Printf ("Wrote %s\n", filename);
}
scr_drawloading = true;
scr_fullupdate = 0;
-// Sbar_Changed ();
SCR_UpdateScreen ();
scr_drawloading = false;
extern cvar_t r_render;
extern cvar_t r_upload;
+#include "image.h"
free(data);
return texnum;
}
+
+void Image_WriteTGARGB (char *filename, int width, int height, byte *data)
+{
+ byte *buffer, *in, *out, *end;
+
+ buffer = malloc(width*height*3 + 18);
+
+ memset (buffer, 0, 18);
+ buffer[2] = 2; // uncompressed type
+ buffer[12] = (width >> 0) & 0xFF;
+ buffer[13] = (width >> 8) & 0xFF;
+ buffer[14] = (height >> 0) & 0xFF;
+ buffer[15] = (height >> 8) & 0xFF;
+ buffer[16] = 24; // pixel size
+
+ // swap rgb to bgr
+ in = data;
+ end = in + width*height*3;
+ out = buffer + 18;
+ for (;in < end;in += 3)
+ {
+ *out++ = in[2];
+ *out++ = in[1];
+ *out++ = in[0];
+ }
+ COM_WriteFile (filename, buffer, glwidth*glheight*3 + 18 );
+
+ free(buffer);
+}
extern void Image_Copy8bitRGBA(byte *in, byte *out, int pixels, int *pal);
extern void Image_CopyRGBAGamma(byte *in, byte *out, int pixels);
extern int image_makemask (byte *in, byte *out, int size);
+extern byte* loadimagepixels (char* filename, qboolean complain, int matchwidth, int matchheight);
+extern int loadtextureimage (char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap);
extern byte* loadimagepixelsmask (char* filename, qboolean complain, int matchwidth, int matchheight);
extern int loadtextureimagemask (char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap);
extern int image_masktexnum;
extern int loadtextureimagewithmask (char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap);
+extern void Image_WriteTGARGB (char *filename, int width, int height, byte *data);
vec3_t stepoldorigin;
vec3_t stepoldangles;
float steplerptime;
- // LordHavoc: delta compression
- float nextfullupdate; // every second a full update is forced
entvars_t v; // C exported fields from progs
// other fields from progs come immediately after
} edict_t;
extern struct texture_s *r_notexture_mip;
-// LordHavoc: generic image loader
-byte* loadimagepixels (char* filename, qboolean complain, int matchwidth, int matchheight);
-int loadtextureimage (char* filename, int matchwidth, int matchheight, qboolean complain, qboolean mipmap);
-
void R_Init (void);
void R_InitTextures (void);
void R_InitEfrags (void);
void Sbar_Init (void);
-void Sbar_Changed (void);
-// call whenever any of the client stats represented on the sbar changes
-
void Sbar_Draw (void);
// called every frame by screen
// client known data for deltas
int old_frags;
int pmodel;
+
+ // delta compression state
+ float nextfullupdate[MAX_EDICTS];
} client_t;
=============
*/
-void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
+void SV_WriteEntitiesToClient (client_t *client, edict_t *clent, sizebuf_t *msg)
{
int e, i, clentnum, bits, alpha, glowcolor, glowsize, scale, colormod, modred, modgreen, modblue, dodelta, effects;
byte *pvs;
dodelta = FALSE;
if ((int)ent->v.effects & EF_DELTA)
- dodelta = cl.time < ent->nextfullupdate; // every half second a full update is forced
+ dodelta = cl.time < client->nextfullupdate[e]; // every half second a full update is forced
if (dodelta)
{
}
else
{
- ent->nextfullupdate = cl.time + 0.5;
+ client->nextfullupdate[e] = cl.time + 0.5;
baseline = &ent->baseline;
}
// add the client specific data to the datagram
SV_WriteClientdataToMessage (client->edict, &msg);
- SV_WriteEntitiesToClient (client->edict, &msg);
+ SV_WriteEntitiesToClient (client, client->edict, &msg);
// copy the server datagram if there is space
if (msg.cursize + sv.datagram.cursize < msg.maxsize)