mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-05-30 08:40:39 +00:00
Patched for QSG Standard 2 (Extend Protocol).
Unfinished, renderer effects are only half implimented at this point.
This commit is contained in:
parent
f6ec000127
commit
089a0a35d0
16 changed files with 273 additions and 64 deletions
|
@ -41,6 +41,12 @@
|
|||
#include "sys.h"
|
||||
#include "pmove.h"
|
||||
|
||||
// Ender Extends (QSG - Begin)
|
||||
// HACK HACK HACK
|
||||
extern int eval_alpha, eval_fullbright, eval_colormod, eval_glowsize, eval_glowcolor;
|
||||
// Ender Extends (QSG - End)
|
||||
eval_t *GETEDICTFIELDVALUE(edict_t *ed, int fieldoffset);
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
||||
|
@ -173,7 +179,7 @@ Writes part of a packetentities message.
|
|||
Can delta from either a baseline or a previous packet_entity
|
||||
==================
|
||||
*/
|
||||
void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean force)
|
||||
void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean force, int stdver)
|
||||
{
|
||||
int bits;
|
||||
int i;
|
||||
|
@ -213,6 +219,19 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
|
|||
if ( to->modelindex != from->modelindex )
|
||||
bits |= U_MODEL;
|
||||
|
||||
// Ender (QSG - Begin)
|
||||
if (stdver > 1) {
|
||||
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;
|
||||
|
||||
|
@ -236,6 +255,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);
|
||||
|
||||
// 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)
|
||||
|
@ -258,6 +285,15 @@ 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]);
|
||||
|
||||
// Ender (QSG - Begin)
|
||||
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);
|
||||
// Ender (QSG - End)
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -307,7 +343,7 @@ void SV_EmitPacketEntities (client_t *client, packet_entities_t *to, sizebuf_t *
|
|||
if (newnum == oldnum)
|
||||
{ // delta update from old position
|
||||
//Con_Printf ("delta %i\n", newnum);
|
||||
SV_WriteDelta (&from->entities[oldindex], &to->entities[newindex], msg, false);
|
||||
SV_WriteDelta (&from->entities[oldindex], &to->entities[newindex], msg, false, client->stdver);
|
||||
oldindex++;
|
||||
newindex++;
|
||||
continue;
|
||||
|
@ -317,7 +353,7 @@ void SV_EmitPacketEntities (client_t *client, packet_entities_t *to, sizebuf_t *
|
|||
{ // this is a new entity, send it from the baseline
|
||||
ent = EDICT_NUM(newnum);
|
||||
//Con_Printf ("baseline %i\n", newnum);
|
||||
SV_WriteDelta (&ent->baseline, &to->entities[newindex], msg, true);
|
||||
SV_WriteDelta (&ent->baseline, &to->entities[newindex], msg, true, client->stdver);
|
||||
newindex++;
|
||||
continue;
|
||||
}
|
||||
|
@ -526,7 +562,49 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
|
|||
state->colormap = ent->v.colormap;
|
||||
state->skinnum = ent->v.skin;
|
||||
state->effects = ent->v.effects;
|
||||
}
|
||||
|
||||
// Ender: EXTEND (QSG - Begin)
|
||||
{
|
||||
eval_t *val;
|
||||
state->glowsize = 0;
|
||||
state->glowcolor = 254;
|
||||
state->colormod = 255;
|
||||
|
||||
if (val = GETEDICTFIELDVALUE(ent, eval_glowsize)) {
|
||||
state->glowsize = (int) val->_float >> 3;
|
||||
if (state->glowsize > 127)
|
||||
state->glowsize = 127;
|
||||
if (state->glowsize < -128)
|
||||
state->glowsize = -128;
|
||||
}
|
||||
|
||||
if (val = GETEDICTFIELDVALUE(ent, eval_glowcolor)) {
|
||||
if (val->_float != 0)
|
||||
state->glowcolor = (int) val->_float;
|
||||
}
|
||||
|
||||
if (val = GETEDICTFIELDVALUE(ent, eval_colormod)) {
|
||||
if (val->vector[0] != 0 || val->vector[1] != 0 || val->vector[2] != 0) {
|
||||
int modred, modgreen, modblue;
|
||||
|
||||
modred = val->vector[0] * 8.0;
|
||||
if (modred < 0) modred = 0;
|
||||
if (modred > 7) modred = 7;
|
||||
|
||||
modgreen = val->vector[1] * 8.0;
|
||||
if (modgreen < 0) modgreen = 0;
|
||||
if (modgreen > 7) modgreen = 7;
|
||||
|
||||
modblue = val->vector[2] * 4.0;
|
||||
if (modblue < 0) modblue = 0;
|
||||
if (modblue > 3) modblue = 3;
|
||||
|
||||
state->colormod = (modred << 5) | (modgreen << 2) | modblue;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Ender: EXTEND (QSG - End)
|
||||
}
|
||||
|
||||
// encode the packet entities as a delta from the
|
||||
// last packetentities acknowledged by the client
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue