Removed Endy's broken protocol enhancements.

This commit is contained in:
Forest Hale 2000-06-30 05:54:28 +00:00
parent 7ee4edd961
commit 2028766d1f
4 changed files with 22 additions and 115 deletions

View file

@ -520,28 +520,11 @@ void CL_LinkPacketEntities (void)
ent->scoreboard = NULL;
}
// 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;
if (ent->alpha != 1)
ent->alpha = s1->alpha / 255;
else
ent->alpha = 1;
if (s1->colormod) {
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);
Con_DPrintf("Colormod: %f %f %f\n", ent->colormod[0], ent->colormod[1], ent->colormod[2]);
} else {
ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 0;
}
//
// Ender: Extend (Colormod) [QSG - End]
// 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;
// set skin
ent->skinnum = s1->skinnum;

View file

@ -878,7 +878,8 @@ char *ED_ParseEdict (char *data, edict_t *ent)
// If skyname is set, we want to allow skyboxes and set what
// the skybox name should be. "qlsky" is supported since
// at least one other map uses it already. --KB
if (stricmp (keyname, "skyname") == 0 ||
if (stricmp (keyname, "sky") == 0 || // LordHavoc: added "sky" key (Quake2 and DarkPlaces use this)
stricmp (keyname, "skyname") == 0 ||
stricmp (keyname, "qlsky") == 0)
{
Info_SetValueForKey (svs.info, "skybox",
@ -1089,7 +1090,8 @@ void PR_LoadProgs (void)
if ((f = ED_FindFunction ("SpectatorDisconnect")) != NULL)
SpectatorDisconnect = (func_t)(f - pr_functions);
FindEdictFieldOffsets();
// LordHavoc: Ender added this
FindEdictFieldOffsets();
}

View file

@ -44,13 +44,14 @@
#include <string.h>
int eval_alpha, eval_fullbright, eval_colormod, eval_glowsize, eval_glowcolor;
// LordHavoc: disabled (needs new protocol)
//int eval_alpha, eval_fullbright, eval_colormod, eval_glowsize, eval_glowcolor;
int FindFieldOffset(char *field)
{
ddef_t *d;
d = ED_FindField(field);
if (!d)
if (!d)
return 0;
return d->ofs*4;
@ -59,17 +60,20 @@ int FindFieldOffset(char *field)
eval_t *GETEDICTFIELDVALUE(edict_t *ed, int fieldoffset)
{
if (!fieldoffset)
return NULL;
if (!fieldoffset)
return NULL;
return (eval_t*)((char*)&ed->v + fieldoffset);
}
void FindEdictFieldOffsets()
{
// LordHavoc: disabled (needs new protocol)
/*
eval_alpha = FindFieldOffset("alpha");
eval_fullbright = FindFieldOffset("fullbright");
eval_colormod = FindFieldOffset("colormod");
eval_glowsize = FindFieldOffset("glow_size");
eval_glowcolor = FindFieldOffset("glow_color");
eval_fullbright = FindFieldOffset("fullbright");
eval_colormod = FindFieldOffset("colormod");
eval_glowsize = FindFieldOffset("glow_size");
eval_glowcolor = FindFieldOffset("glow_color");
*/
};

View file

@ -41,11 +41,7 @@
#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);
extern eval_t *GETEDICTFIELDVALUE(edict_t *ed, int fieldoffset);
/*
=============================================================================
@ -219,20 +215,6 @@ 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 (to->alpha != from->alpha) bits |= U_ALPHA;
}
if (bits >= 16777216)
bits |= U_EXTEND2;
if (bits >= 65536)
bits |= U_EXTEND1;
// Ender (QSG - End)
if (bits & 511)
bits |= U_MOREBITS;
@ -257,13 +239,6 @@ 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)
@ -286,17 +261,6 @@ 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);
if (bits & U_ALPHA)
MSG_WriteByte(msg, to->colormod);
// Ender (QSG - End)
}
/*
@ -565,52 +529,6 @@ 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)
{
int tmp;
eval_t *val;
state->glowsize = 0;
state->glowcolor = 254;
state->colormod = 0;
state->alpha = 1;
if ((val = GETEDICTFIELDVALUE(ent, eval_glowsize))) {
tmp = (int)val->_float >> 3;
state->glowsize = bound(-128, tmp, 127);
}
if ((val = GETEDICTFIELDVALUE(ent, eval_glowcolor))) {
if (val->_float != 0)
state->glowcolor = (int) val->_float;
}
if ((val = GETEDICTFIELDVALUE(ent, eval_alpha))) {
if (val->_float != 0)
state->alpha = (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;
// Con_Printf("Colormod: %d %d %d\n", modred, modgreen, modblue);
state->colormod = (modred << 5) | (modgreen << 2) | modblue;
}
}
}
// Ender: EXTEND (QSG - End)
}
// encode the packet entities as a delta from the