UDC_EXTEFFECT sucks

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1427 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2005-10-05 02:15:33 +00:00
parent dcabb778f6
commit 25a65bbf8e
4 changed files with 1 additions and 242 deletions

View file

@ -90,10 +90,6 @@ typedef struct {
builtin_t pr_builtin[1024];
extern BuiltinList_t BuiltinList[];
qboolean pr_udc_exteffect_enabled;
func_t SpectatorConnect;
func_t SpectatorThink;
func_t SpectatorDisconnect;
@ -6247,7 +6243,7 @@ lh_extension_t FTE_Protocol_Extensions[] =
{"FTE_PEXT_VWEAP"},
{"FTE_PEXT_Q2BSP"}, //supports q2 maps. No bugs are apparent.
{"FTE_PEXT_Q3BSP"}, //quake3 bsp support. dp probably has an equivelent, but this is queryable per client.
{"UDC_EXTEFFECT", 0, &pr_udc_exteffect_enabled}, //hmm. crap.
{NULL}, //UDC_EXTEFFECT, no longer supported
{NULL}, //splitscreen - not queryable.
{"FTE_HEXEN2"}, //client can use hexen2 maps. server can use hexen2 progs
{"FTE_PEXT_SPAWNSTATIC"}, //means that static entities can have alpha/scale and anything else the engine supports on normal ents. (Added for >256 models, while still being compatable - previous system failed with -1 skins)
@ -9727,13 +9723,6 @@ void PR_RegisterFields(void) //it's just easier to do it this way.
fieldfloat(clientcolors);
//UDC_EXTEFFECT... yuckie
PR_RegisterFieldVar(svprogfuncs, ev_float, "fieldcolor", (int)&((entvars_t*)0)->seefcolour, -1);
PR_RegisterFieldVar(svprogfuncs, ev_float, "fieldsizex", (int)&((entvars_t*)0)->seefsizex, -1);
PR_RegisterFieldVar(svprogfuncs, ev_float, "fieldsizey", (int)&((entvars_t*)0)->seefsizey, -1);
PR_RegisterFieldVar(svprogfuncs, ev_float, "fieldsizez", (int)&((entvars_t*)0)->seefsizez, -1);
PR_RegisterFieldVar(svprogfuncs, ev_float, "fieldoffset", (int)&((entvars_t*)0)->seefoffset, -1);
//hexen 2 stuff
fieldfloat(playerclass);
fieldfloat(hull);

View file

@ -210,13 +210,6 @@ typedef struct entvars_s
float dimension_solid;
float dimension_hit;
//udc_exeffect support. hacky I know.
float seefcolour;
float seefsizex;
float seefsizey;
float seefsizez;
float seefoffset;
//hexen2 stuff
float playerclass; //hexen2 requirements
float hull;

View file

@ -332,26 +332,6 @@ typedef struct {
#define MAX_BACK_BUFFERS 16
enum seef_e{
SEEF_BRIGHTFIELD,
SEEF_DARKLIGHT,
SEEF_DARKFIELD,
SEEF_LIGHT
};
typedef struct specialenteffects_s {
enum seef_e efnum;
int entnum;
vec3_t size;
char offset;
qbyte colour; //matches q1 palette
float die;
struct specialenteffects_s *next;
} specialenteffects_t;
typedef struct client_s
{
client_conn_state_t state;
@ -526,8 +506,6 @@ typedef struct client_s
qbyte vweap;
} otherclientsknown[MAX_CLIENTS]; //updated as needed. Flag at a time, or all flags.
specialenteffects_t *enteffects;
struct client_s *controller;
struct client_s *controlled;

View file

@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void SV_CleanupEnts(void);
extern qboolean pr_udc_exteffect_enabled;
extern cvar_t sv_nailhack;
/*
@ -1336,193 +1334,6 @@ void SV_WritePlayerToClient(sizebuf_t *msg, clstate_t *ent)
}
#endif
#ifdef PEXT_SEEF1
#define EFNQ_DARKLIGHT 16
#define EFNQ_DARKFIELD 32
#define EFNQ_LIGHT 64
#define EFQW_DARKLIGHT 256
#define EFQW_DARKFIELD 512
#define EFQW_LIGHT 1024
void SV_RemoveEffect(client_t *to, edict_t *ent, int seefmask)
{
specialenteffects_t *prev = NULL;
specialenteffects_t *ef;
int en = NUM_FOR_EDICT(svprogfuncs, ent);
for (ef = to->enteffects; ef; ef = ef->next)
{
if (ef->entnum == en && ef->efnum & seefmask)
{
if (prev)
prev->next = ef->next;
else
to->enteffects = ef->next;
Z_Free(ef);
if (ef->efnum & seefmask & 1>>SEEF_BRIGHTFIELD)
{
ClientReliableWrite_Begin(to, svc_temp_entity, 4);
ClientReliableWrite_Byte(to, TE_SEEF_BRIGHTFIELD);
ClientReliableWrite_Short(to, en|0x8000);
}
if (ef->efnum & seefmask & 1>>SEEF_DARKLIGHT)
{
ClientReliableWrite_Begin(to, svc_temp_entity, 4);
ClientReliableWrite_Byte(to, SEEF_DARKLIGHT);
ClientReliableWrite_Short(to, en|0x8000);
}
if (ef->efnum & seefmask & 1>>SEEF_DARKFIELD)
{
ClientReliableWrite_Begin(to, svc_temp_entity, 4);
ClientReliableWrite_Byte(to, SEEF_DARKFIELD);
ClientReliableWrite_Short(to, en|0x8000);
}
if (ef->efnum & seefmask & 1>>SEEF_LIGHT)
{
ClientReliableWrite_Begin(to, svc_temp_entity, 4);
ClientReliableWrite_Byte(to, SEEF_LIGHT);
ClientReliableWrite_Short(to, en|0x8000);
}
return;
}
prev = ef;
}
}
void SV_AddEffect(client_t *to, edict_t *ent, int seefno)
{
specialenteffects_t *prev = NULL;
specialenteffects_t *ef;
int en = NUM_FOR_EDICT(svprogfuncs, ent);
for (ef = to->enteffects; ef; ef = ef->next)
{
if (ef->entnum == en && ef->efnum == 1<<seefno)
{
if (ef->colour != ent->v->seefcolour || ef->offset != ent->v->seefoffset || ef->size[0] != ent->v->seefsizex || ef->size[1] != ent->v->seefsizey || ef->size[2] != ent->v->seefsizez || ef->die < sv.time)
{
if (prev)
prev->next = ef->next;
else
to->enteffects = ef->next;
Z_Free(ef);
ef = NULL;
break;
}
return; //still the same state.
}
prev = ef;
}
ef = Z_Malloc(sizeof(specialenteffects_t));
ef->die = sv.time + 10;
ef->next = to->enteffects;
to->enteffects = ef;
ef->efnum = 1<<seefno;
ef->entnum = en;
ef->colour = ent->v->seefcolour;
if (!ef->colour)
ef->colour = 111;
ef->offset = ent->v->seefoffset;
ef->size[0] = ent->v->seefsizex;
if (!ef->size[0])
ef->offset = 64;
ef->size[1] = ent->v->seefsizey;
if (!ef->size[1])
ef->offset = 64;
ef->size[2] = ent->v->seefsizez;
if (!ef->size[2])
ef->offset = 64;
ClientReliableWrite_Begin(to, svc_temp_entity, 20);
ClientReliableWrite_Byte(to, TE_SEEF_BRIGHTFIELD+seefno);
ClientReliableWrite_Short(to, en);
switch(seefno)
{
case SEEF_BRIGHTFIELD:
ClientReliableWrite_Coord(to, ef->size[0]);
ClientReliableWrite_Coord(to, ef->size[1]);
ClientReliableWrite_Coord(to, ef->size[2]);
ClientReliableWrite_Char (to, ef->offset);
ClientReliableWrite_Byte (to, ef->colour);
break;
case SEEF_DARKFIELD:
ClientReliableWrite_Byte (to, ef->colour);
break;
case SEEF_DARKLIGHT:
case SEEF_LIGHT:
ClientReliableWrite_Coord(to, ef->size[0]);
ClientReliableWrite_Coord(to, ef->size[1]);
break;
}
}
#endif
void SV_SendExtraEntEffects(client_t *to, edict_t *ent)
{
#ifdef PEXT_SEEF1
int removeeffects = 0;
if (pr_udc_exteffect_enabled)
{
if (to->fteprotocolextensions & PEXT_SEEF1)
{
if (progstype != PROG_QW)
{
if ((int)ent->v->effects & (EF_BRIGHTFIELD|EFNQ_DARKLIGHT|EFNQ_DARKFIELD|EFNQ_LIGHT) || to->enteffects)
{
if ((int)ent->v->effects & EF_BRIGHTFIELD)
SV_AddEffect(to, ent, SEEF_BRIGHTFIELD);
else
removeeffects |= 1<<SEEF_BRIGHTFIELD;
if ((int)ent->v->effects & EFNQ_DARKLIGHT)
SV_AddEffect(to, ent, SEEF_DARKLIGHT);
else
removeeffects |= 1<<SEEF_DARKLIGHT;
if ((int)ent->v->effects & EFNQ_DARKFIELD)
SV_AddEffect(to, ent, SEEF_DARKFIELD);
else
removeeffects |= 1<<SEEF_DARKFIELD;
if ((int)ent->v->effects & EFNQ_LIGHT)
SV_AddEffect(to, ent, SEEF_LIGHT);
else
removeeffects |= 1<<SEEF_LIGHT;
}
}
else
{
if ((int)ent->v->effects & (EF_BRIGHTFIELD|EFQW_DARKLIGHT|EFQW_DARKFIELD|EFQW_LIGHT) || to->enteffects)
{
if ((int)ent->v->effects & EF_BRIGHTFIELD)
SV_AddEffect(to, ent, SEEF_BRIGHTFIELD);
else
removeeffects |= 1<<SEEF_BRIGHTFIELD;
if ((int)ent->v->effects & EFQW_DARKLIGHT)
SV_AddEffect(to, ent, SEEF_DARKLIGHT);
else
removeeffects |= 1<<SEEF_DARKLIGHT;
if ((int)ent->v->effects & EFQW_DARKFIELD)
SV_AddEffect(to, ent, SEEF_DARKFIELD);
else
removeeffects |= 1<<SEEF_DARKFIELD;
if ((int)ent->v->effects & EFQW_LIGHT)
SV_AddEffect(to, ent, SEEF_LIGHT);
else
removeeffects |= 1<<SEEF_LIGHT;
}
}
if (to->enteffects)
SV_RemoveEffect(to, ent, removeeffects);
}
}
#endif
}
/*
=============
SV_WritePlayersToClient
@ -1920,10 +1731,6 @@ void SV_WritePlayersToClient (client_t *client, edict_t *clent, qbyte *pvs, size
ClientReliableWrite_Short(client, client->otherclientsknown[j].vweap);
ClientReliable_FinishWrite(client);
}
if (!sv.demostatevalid)
{
SV_SendExtraEntEffects(client, cl->edict);
}
}
}
@ -2746,14 +2553,6 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
}
#endif
if (!sv.demostatevalid)
{
for (i = 0; i < pack->num_entities; i++)
{
SV_SendExtraEntEffects(client, EDICT_NUM(svprogfuncs, pack->entities[i].number));
}
}
// encode the packet entities as a delta from the
// last packetentities acknowledged by the client