mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-02 14:01:26 +00:00
Add drawonlytoclient, nodrawtoclient, and customizeentityforclient extensions.
This commit is contained in:
parent
8b08262ffb
commit
7435cdd414
2 changed files with 46 additions and 0 deletions
|
@ -303,6 +303,9 @@ struct pr_extfields_s
|
|||
QCEXTFIELD(movement, ".vector") /*vector*/ \
|
||||
QCEXTFIELD(viewmodelforclient, ".entity") /*entity*/ \
|
||||
QCEXTFIELD(exteriormodeltoclient, ".entity") /*entity*/ \
|
||||
QCEXTFIELD(nodrawtoclient, ".entity") \
|
||||
QCEXTFIELD(drawonlytoclient, ".entity") \
|
||||
QCEXTFIELD(customizeentityforclient,".float()") \
|
||||
QCEXTFIELD(traileffectnum, ".float") /*float*/ \
|
||||
QCEXTFIELD(emiteffectnum, ".float") /*float*/ \
|
||||
QCEXTFIELD(button3, ".float") /*float*/ \
|
||||
|
|
|
@ -1207,6 +1207,18 @@ static void SVFTE_BuildSnapshotForClient (client_t *client)
|
|||
ent = NEXT_EDICT(qcvm->edicts);
|
||||
for (e=1 ; e<maxentities ; e++, ent = NEXT_EDICT(ent))
|
||||
{
|
||||
if (ent->free)
|
||||
goto invisible;
|
||||
val = GetEdictFieldValue(ent, qcvm->extfields.customizeentityforclient);
|
||||
if (val && val->function)
|
||||
{
|
||||
pr_global_struct->self = EDICT_TO_PROG(ent); //ent being customised
|
||||
pr_global_struct->other = proged; //player they're being customised for
|
||||
PR_ExecuteProgram(val->function);
|
||||
if (!G_FLOAT(OFS_RETURN))
|
||||
goto invisible;
|
||||
}
|
||||
|
||||
eflags = 0;
|
||||
emiteffect = GetEdictFieldValue(ent, qcvm->extfields.emiteffectnum)->_float;
|
||||
iscsqc = cancsqc && GetEdictFieldEval(ent, SendEntity)->function;
|
||||
|
@ -1251,6 +1263,13 @@ invisible:
|
|||
}
|
||||
}
|
||||
|
||||
val = GetEdictFieldValue(ent, qcvm->extfields.nodrawtoclient);
|
||||
if (val && val->edict == proged)
|
||||
goto invisible;
|
||||
val = GetEdictFieldValue(ent, qcvm->extfields.drawonlytoclient);
|
||||
if (val && val->edict && val->edict != proged)
|
||||
goto invisible;
|
||||
|
||||
//okay, we care about this entity.
|
||||
|
||||
if (iscsqc)
|
||||
|
@ -2437,6 +2456,17 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
|
|||
ent = NEXT_EDICT(qcvm->edicts);
|
||||
for (e=1 ; e<maxedict ; e++, ent = NEXT_EDICT(ent))
|
||||
{
|
||||
if (ent->free)
|
||||
continue;
|
||||
val = GetEdictFieldValue(ent, qcvm->extfields.customizeentityforclient);
|
||||
if (val && val->function)
|
||||
{
|
||||
pr_global_struct->self = EDICT_TO_PROG(ent); //ent being customised
|
||||
pr_global_struct->other = EDICT_TO_PROG(client);//player they're being customised for
|
||||
PR_ExecuteProgram(val->function);
|
||||
if (!G_FLOAT(OFS_RETURN))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ent != clent) // clent is ALLWAYS sent
|
||||
{
|
||||
|
@ -2463,6 +2493,19 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
|
|||
continue; // not visible
|
||||
}
|
||||
|
||||
val = GetEdictFieldValue(ent, qcvm->extfields.nodrawtoclient);
|
||||
if (val && val->edict == EDICT_TO_PROG(client))
|
||||
continue;
|
||||
val = GetEdictFieldValue(ent, qcvm->extfields.drawonlytoclient);
|
||||
if (val && val->edict && val->edict != EDICT_TO_PROG(client))
|
||||
continue;
|
||||
val = GetEdictFieldValue(ent, qcvm->extfields.viewmodelforclient);
|
||||
if (val && val->edict) //can't handle this this for this player. can't cleanly attach it to their view so don't even treat it like drawonlytoclient.
|
||||
continue;
|
||||
val = GetEdictFieldValue(ent, qcvm->extfields.exteriormodeltoclient);
|
||||
if (val && val->edict == EDICT_TO_PROG(client)) //can't handle this for this player. pretend its nodrawtoclient.
|
||||
continue;
|
||||
|
||||
// johnfitz -- max size for protocol 15 is 18 bytes, not 16 as originally
|
||||
// assumed here. And, for protocol 85 the max size is actually 24 bytes.
|
||||
// For float coords and angles the limit is 40.
|
||||
|
|
Loading…
Reference in a new issue