mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-04-04 22:10:47 +00:00
Fixed up Endy's EXTEND support - everything should work now.
This commit is contained in:
parent
99836b2862
commit
968efda8ed
7 changed files with 181 additions and 63 deletions
|
@ -277,10 +277,12 @@ typedef struct
|
|||
int skinnum;
|
||||
int effects;
|
||||
|
||||
byte glowsize;
|
||||
byte glowcolor;
|
||||
byte colormod;
|
||||
byte alpha;
|
||||
// LordHavoc: Endy neglected to mark this as a QSG version 2 thingy...
|
||||
byte alpha;
|
||||
byte scale;
|
||||
byte glowsize;
|
||||
byte glowcolor;
|
||||
byte colormod;
|
||||
} entity_state_t;
|
||||
|
||||
|
||||
|
|
|
@ -49,39 +49,36 @@ typedef struct efrag_s
|
|||
struct efrag_s *entnext;
|
||||
} efrag_t;
|
||||
|
||||
// LordHavoc: reindented this after 'Endy was here', also added scale.
|
||||
typedef struct entity_s
|
||||
{
|
||||
int keynum; // for matching entities in different frames
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
struct model_s *model; // NULL = no model
|
||||
int frame;
|
||||
byte *colormap;
|
||||
int skinnum; // for Alias models
|
||||
int keynum; // for matching entities in different frames
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
struct model_s *model; // NULL = no model
|
||||
int frame;
|
||||
byte *colormap;
|
||||
int skinnum; // for Alias models
|
||||
|
||||
struct player_info_s *scoreboard; // identify player
|
||||
struct player_info_s *scoreboard; // identify player
|
||||
|
||||
float syncbase;
|
||||
float syncbase;
|
||||
|
||||
struct efrag_s *efrag; // linked list of efrags (FIXME)
|
||||
int visframe; // last frame this entity was
|
||||
// found in an active leaf
|
||||
// only used for static objects
|
||||
|
||||
int dlightframe; // dynamic lighting
|
||||
int dlightbits;
|
||||
struct efrag_s *efrag; // linked list of efrags (FIXME)
|
||||
int visframe; // last frame this entity was found in an active leaf, only used for static objects
|
||||
|
||||
float colormod[3]; // color tint for model
|
||||
float alpha; // opacity (alpha) of the model
|
||||
float glowsize; // how big the glow is
|
||||
byte glowcolor; // color of glow and particle trail (paletted)
|
||||
byte glowtrail; // leaves a trail of particles
|
||||
int dlightframe; // dynamic lighting
|
||||
int dlightbits;
|
||||
|
||||
// FIXME: could turn these into a union
|
||||
int trivial_accept;
|
||||
struct mnode_s *topnode; // for bmodels, first world node
|
||||
// that splits bmodel, or NULL if
|
||||
// not split
|
||||
float colormod[3]; // color tint for model
|
||||
float alpha; // opacity (alpha) of the model
|
||||
float scale; // size scaler of the model
|
||||
float glowsize; // how big the glow is (can be negative)
|
||||
byte glowcolor; // color of glow (paletted)
|
||||
|
||||
// FIXME: could turn these into a union
|
||||
int trivial_accept;
|
||||
struct mnode_s *topnode; // for bmodels, first world node that splits bmodel, or NULL if not split
|
||||
} entity_t;
|
||||
|
||||
// !!! if this is changed, it must be changed in asm_draw.h too !!!
|
||||
|
|
|
@ -209,13 +209,13 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits)
|
|||
// if (bits&(1<<i))
|
||||
// bitcounts[i]++;
|
||||
|
||||
if (bits & U_EXTEND1)
|
||||
{
|
||||
bits |= MSG_ReadByte() << 16;
|
||||
if (bits & U_EXTEND2)
|
||||
bits |= MSG_ReadByte() << 24;
|
||||
}
|
||||
|
||||
// LordHavoc: Endy neglected to mark this as being part of the QSG version 2 stuff...
|
||||
if (bits & U_EXTEND1)
|
||||
{
|
||||
bits |= MSG_ReadByte() << 16;
|
||||
if (bits & U_EXTEND2)
|
||||
bits |= MSG_ReadByte() << 24;
|
||||
}
|
||||
|
||||
to->flags = bits;
|
||||
|
||||
|
@ -252,18 +252,24 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits)
|
|||
if (bits & U_ANGLE3)
|
||||
to->angles[2] = MSG_ReadAngle();
|
||||
|
||||
if (bits & U_GLOWSIZE)
|
||||
to->glowsize = MSG_ReadByte();
|
||||
|
||||
if (bits & U_GLOWCOLOR)
|
||||
to->glowcolor = MSG_ReadByte();
|
||||
|
||||
if (bits & U_COLORMOD)
|
||||
to->colormod = MSG_ReadByte();
|
||||
|
||||
if (bits & U_ALPHA)
|
||||
to->alpha = MSG_ReadByte();
|
||||
|
||||
// LordHavoc: Endy neglected to mark this as being part of the QSG version 2 stuff...
|
||||
// rearranged it and implemented missing effects
|
||||
// Ender (QSG - Begin)
|
||||
if (bits & U_ALPHA)
|
||||
to->alpha = MSG_ReadByte();
|
||||
if (bits & U_SCALE)
|
||||
to->scale = MSG_ReadByte();
|
||||
if (bits & U_EFFECTS2)
|
||||
to->effects = (to->effects & 0xFF) | (MSG_ReadByte() << 8);
|
||||
if (bits & U_GLOWSIZE)
|
||||
to->glowsize = MSG_ReadByte();
|
||||
if (bits & U_GLOWCOLOR)
|
||||
to->glowcolor = MSG_ReadByte();
|
||||
if (bits & U_COLORMOD)
|
||||
to->colormod = MSG_ReadByte();
|
||||
if (bits & U_FRAME2)
|
||||
to->frame = (to->frame & 0xFF) | (MSG_ReadByte() << 8);
|
||||
// Ender (QSG - End)
|
||||
|
||||
if (bits & U_SOLID)
|
||||
{
|
||||
|
@ -520,11 +526,26 @@ void CL_LinkPacketEntities (void)
|
|||
ent->scoreboard = NULL;
|
||||
}
|
||||
|
||||
// LordHavoc: until a new protocol is written, there's no room for alpha and such
|
||||
ent->glowsize = 0;
|
||||
ent->glowcolor = 254;
|
||||
ent->alpha = 1;
|
||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;
|
||||
|
||||
// LordHavoc: cleaned up Endy's coding style, and fixed Endy's bugs
|
||||
// Ender: Extend (Colormod) [QSG - Begin]
|
||||
// N.B: All messy code below is the sole fault of LordHavoc and
|
||||
// his futile attempts to save bandwidth. :)
|
||||
//
|
||||
ent->glowsize = s1->glowsize < 128 ? s1->glowsize * 8.0 : (s1->glowsize - 256) * 8.0;
|
||||
ent->glowcolor = s1->glowcolor;
|
||||
ent->alpha = s1->alpha / 255.0;
|
||||
|
||||
if (s1->colormod == 255)
|
||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;
|
||||
else
|
||||
{
|
||||
ent->colormod[0] = (float) ((s1->colormod >> 5) & 7) * (1.0 / 7.0);
|
||||
ent->colormod[1] = (float) ((s1->colormod >> 2) & 7) * (1.0 / 7.0);
|
||||
ent->colormod[2] = (float) (s1->colormod & 3) * (1.0 / 3.0);
|
||||
}
|
||||
//
|
||||
// Ender: Extend (Colormod) [QSG - End]
|
||||
|
||||
// set skin
|
||||
ent->skinnum = s1->skinnum;
|
||||
|
|
|
@ -755,6 +755,12 @@ void CL_ParseBaseline (entity_state_t *es)
|
|||
es->origin[i] = MSG_ReadCoord ();
|
||||
es->angles[i] = MSG_ReadAngle ();
|
||||
}
|
||||
// LordHavoc: set up the baseline to account for new effects (alpha, colormod, etc)
|
||||
es->alpha = 255;
|
||||
es->scale = 16;
|
||||
es->glowcolor = 254;
|
||||
es->glowsize = 0;
|
||||
es->colormod = 255;
|
||||
}
|
||||
|
||||
|
||||
|
@ -789,6 +795,13 @@ void CL_ParseStatic (void)
|
|||
|
||||
VectorCopy (es.origin, ent->origin);
|
||||
VectorCopy (es.angles, ent->angles);
|
||||
|
||||
// LordHavoc: make static entities visible
|
||||
ent->alpha = 1;
|
||||
ent->scale = 16;
|
||||
ent->glowsize = 0;
|
||||
ent->glowcolor = 254;
|
||||
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1;
|
||||
|
||||
R_AddEfrags (ent);
|
||||
}
|
||||
|
|
|
@ -43,9 +43,7 @@
|
|||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
// LordHavoc: disabled (needs new protocol)
|
||||
//int eval_alpha, eval_fullbright, eval_colormod, eval_glowsize, eval_glowcolor;
|
||||
int eval_alpha, eval_scale, eval_glowsize, eval_glowcolor, eval_colormod;
|
||||
|
||||
int FindFieldOffset(char *field)
|
||||
{
|
||||
|
@ -68,12 +66,9 @@ eval_t *GETEDICTFIELDVALUE(edict_t *ed, int fieldoffset)
|
|||
|
||||
void FindEdictFieldOffsets()
|
||||
{
|
||||
// LordHavoc: disabled (needs new protocol)
|
||||
/*
|
||||
eval_alpha = FindFieldOffset("alpha");
|
||||
eval_fullbright = FindFieldOffset("fullbright");
|
||||
eval_colormod = FindFieldOffset("colormod");
|
||||
eval_scale = FindFieldOffset("scale");
|
||||
eval_glowsize = FindFieldOffset("glow_size");
|
||||
eval_glowcolor = FindFieldOffset("glow_color");
|
||||
*/
|
||||
eval_colormod = FindFieldOffset("colormod");
|
||||
};
|
||||
|
|
|
@ -41,6 +41,10 @@
|
|||
#include "sys.h"
|
||||
#include "pmove.h"
|
||||
|
||||
// LordHavoc: added and removed certain eval_ items
|
||||
// Ender Extends (QSG - Begin)
|
||||
extern int eval_alpha, eval_scale, eval_glowsize, eval_glowcolor, eval_colormod;
|
||||
// Ender Extends (QSG - End)
|
||||
extern eval_t *GETEDICTFIELDVALUE(edict_t *ed, int fieldoffset);
|
||||
|
||||
/*
|
||||
|
@ -215,6 +219,32 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
|
|||
if ( to->modelindex != from->modelindex )
|
||||
bits |= U_MODEL;
|
||||
|
||||
// LordHavoc: cleaned up Endy's coding style, and added missing effects
|
||||
// Ender (QSG - Begin)
|
||||
if (stdver > 1)
|
||||
{
|
||||
if (to->alpha != from->alpha)
|
||||
bits |= U_ALPHA;
|
||||
|
||||
if (to->scale != from->scale)
|
||||
bits |= U_SCALE;
|
||||
|
||||
if (to->glowsize != from->glowsize)
|
||||
bits |= U_GLOWSIZE;
|
||||
|
||||
if (to->glowcolor != from->glowcolor)
|
||||
bits |= U_GLOWCOLOR;
|
||||
|
||||
if (to->colormod != from->colormod)
|
||||
bits |= U_COLORMOD;
|
||||
}
|
||||
|
||||
if (bits >= 16777216)
|
||||
bits |= U_EXTEND2;
|
||||
|
||||
if (bits >= 65536)
|
||||
bits |= U_EXTEND1;
|
||||
// Ender (QSG - End)
|
||||
if (bits & 511)
|
||||
bits |= U_MOREBITS;
|
||||
|
||||
|
@ -239,6 +269,14 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
|
|||
if (bits & U_MOREBITS)
|
||||
MSG_WriteByte (msg, bits&255);
|
||||
|
||||
// LordHavoc: cleaned up Endy's tabs
|
||||
// Ender (QSG - Begin)
|
||||
if (bits & U_EXTEND1)
|
||||
MSG_WriteByte (msg, bits>>16);
|
||||
if (bits & U_EXTEND2)
|
||||
MSG_WriteByte (msg, bits>>24);
|
||||
// Ender (QSG - End)
|
||||
|
||||
if (bits & U_MODEL)
|
||||
MSG_WriteByte (msg, to->modelindex);
|
||||
if (bits & U_FRAME)
|
||||
|
@ -261,6 +299,24 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
|
|||
MSG_WriteCoord (msg, to->origin[2]);
|
||||
if (bits & U_ANGLE3)
|
||||
MSG_WriteAngle(msg, to->angles[2]);
|
||||
|
||||
// LordHavoc: cleaned up Endy's tabs, rearranged bytes, and implemented missing effects
|
||||
// Ender (QSG - Begin)
|
||||
if (bits & U_ALPHA)
|
||||
MSG_WriteByte(msg, to->alpha);
|
||||
if (bits & U_SCALE)
|
||||
MSG_WriteByte(msg, to->scale);
|
||||
if (bits & U_EFFECTS2)
|
||||
MSG_WriteByte(msg, (to->effects >> 8));
|
||||
if (bits & U_GLOWSIZE)
|
||||
MSG_WriteByte(msg, to->glowsize);
|
||||
if (bits & U_GLOWCOLOR)
|
||||
MSG_WriteByte(msg, to->glowcolor);
|
||||
if (bits & U_COLORMOD)
|
||||
MSG_WriteByte(msg, to->colormod);
|
||||
if (bits & U_FRAME2)
|
||||
MSG_WriteByte(msg, (to->frame >> 8));
|
||||
// Ender (QSG - End)
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -529,7 +585,35 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
|
|||
state->colormap = ent->v.colormap;
|
||||
state->skinnum = ent->v.skin;
|
||||
state->effects = ent->v.effects;
|
||||
}
|
||||
|
||||
// LordHavoc: cleaned up Endy's coding style, shortened the code,
|
||||
// and implemented missing effects
|
||||
// Ender: EXTEND (QSG - Begin)
|
||||
{
|
||||
eval_t *val;
|
||||
state->glowsize = 0;
|
||||
state->glowcolor = 254;
|
||||
state->colormod = 255;
|
||||
state->alpha = 255;
|
||||
state->scale = 16;
|
||||
|
||||
if ((val = GETEDICTFIELDVALUE(ent, eval_alpha)) && val->_float != 0)
|
||||
state->alpha = bound(0, val->_float, 1) * 255.0;
|
||||
|
||||
if ((val = GETEDICTFIELDVALUE(ent, eval_scale)) && val->_float != 0)
|
||||
state->scale = bound(0, val->_float, 15.9375) * 16.0;
|
||||
|
||||
if ((val = GETEDICTFIELDVALUE(ent, eval_glowsize)) && val->_float != 0)
|
||||
state->glowsize = bound(-1024, (int)val->_float, 1016) >> 3;
|
||||
|
||||
if ((val = GETEDICTFIELDVALUE(ent, eval_glowcolor)) && val->_float != 0)
|
||||
state->glowcolor = (int) val->_float;
|
||||
|
||||
if ((val = GETEDICTFIELDVALUE(ent, eval_colormod)) && (val->vector[0] != 0 || val->vector[1] != 0 || val->vector[2] != 0))
|
||||
state->colormod = ((int) (bound(0, val->vector[0], 1) * 7.0) << 5) | ((int) (bound(0, val->vector[1], 1) * 7.0) << 2) | (int) (bound(0, val->vector[2], 1) * 3.0);
|
||||
}
|
||||
// Ender: EXTEND (QSG - End)
|
||||
}
|
||||
|
||||
// encode the packet entities as a delta from the
|
||||
// last packetentities acknowledged by the client
|
||||
|
|
|
@ -129,6 +129,12 @@ void SV_CreateBaseline (void)
|
|||
svent->baseline.modelindex =
|
||||
SV_ModelIndex(PR_GetString(svent->v.model));
|
||||
}
|
||||
// LordHavoc: setup baseline to include new effects
|
||||
svent->baseline.alpha = 255;
|
||||
svent->baseline.scale = 16;
|
||||
svent->baseline.glowsize = 0;
|
||||
svent->baseline.glowcolor = 254;
|
||||
svent->baseline.colormap = 255;
|
||||
|
||||
//
|
||||
// flush the signon message out to a seperate buffer if
|
||||
|
|
Loading…
Reference in a new issue