mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-13 00:34:11 +00:00
Implement exteriormodeltoclient
This commit is contained in:
parent
8a7609f3fe
commit
4d5fd6c688
9 changed files with 22 additions and 6 deletions
|
@ -514,6 +514,10 @@ static qboolean CL_AttachEntity(entity_t *ent, float frac)
|
||||||
if (runaway++==10 || tagent >= (unsigned int)cl.num_entities)
|
if (runaway++==10 || tagent >= (unsigned int)cl.num_entities)
|
||||||
return false; //parent isn't valid
|
return false; //parent isn't valid
|
||||||
parent = &cl.entities[tagent];
|
parent = &cl.entities[tagent];
|
||||||
|
|
||||||
|
if (tagent == cl.viewentity)
|
||||||
|
ent->eflags |= EFLAGS_EXTERIORMODEL;
|
||||||
|
|
||||||
if (!parent->model)
|
if (!parent->model)
|
||||||
return false;
|
return false;
|
||||||
if (0)//tagent < ent-cl_entities)
|
if (0)//tagent < ent-cl_entities)
|
||||||
|
@ -562,6 +566,8 @@ static qboolean CL_AttachEntity(entity_t *ent, float frac)
|
||||||
VectorAngles(fwd, up, ent->angles);
|
VectorAngles(fwd, up, ent->angles);
|
||||||
if (ent->model && ent->model->type == mod_alias)
|
if (ent->model && ent->model->type == mod_alias)
|
||||||
ent->angles[0] *= -1;
|
ent->angles[0] *= -1;
|
||||||
|
|
||||||
|
ent->eflags |= parent->netstate.eflags & (EFLAGS_VIEWMODEL|EFLAGS_EXTERIORMODEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,6 +638,7 @@ void CL_RelinkEntities (void)
|
||||||
// R_RemoveEfrags (ent); // just became empty
|
// R_RemoveEfrags (ent); // just became empty
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
ent->eflags = ent->netstate.eflags;
|
||||||
|
|
||||||
// if the object wasn't included in the last packet, remove it
|
// if the object wasn't included in the last packet, remove it
|
||||||
if (ent->msgtime != cl.mtime[0])
|
if (ent->msgtime != cl.mtime[0])
|
||||||
|
|
|
@ -1946,6 +1946,7 @@ static void CL_ParseStatic (int version) //johnfitz -- added a parameter
|
||||||
// copy it to the current state
|
// copy it to the current state
|
||||||
|
|
||||||
ent->netstate = ent->baseline;
|
ent->netstate = ent->baseline;
|
||||||
|
ent->eflags = ent->netstate.eflags; //spike -- annoying and probably not used anyway, but w/e
|
||||||
|
|
||||||
ent->trailstate = NULL;
|
ent->trailstate = NULL;
|
||||||
ent->emitstate = NULL;
|
ent->emitstate = NULL;
|
||||||
|
|
|
@ -643,6 +643,10 @@ void R_DrawEntitiesOnList (qboolean alphapass) //johnfitz -- added parameter
|
||||||
currententity->angles[0] *= 0.3;
|
currententity->angles[0] *= 0.3;
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
|
||||||
|
//spike -- this would be more efficient elsewhere, but its more correct here.
|
||||||
|
if (currententity->eflags & EFLAGS_EXTERIORMODEL)
|
||||||
|
continue;
|
||||||
|
|
||||||
switch (currententity->model->type)
|
switch (currententity->model->type)
|
||||||
{
|
{
|
||||||
case mod_alias:
|
case mod_alias:
|
||||||
|
|
|
@ -1233,6 +1233,7 @@ qboolean PR_LoadProgs (const char *filename, qboolean fatal, builtin_t *builtins
|
||||||
qcvm->extfields.traileffectnum = ED_FindFieldOffset("traileffectnum");
|
qcvm->extfields.traileffectnum = ED_FindFieldOffset("traileffectnum");
|
||||||
qcvm->extfields.emiteffectnum = ED_FindFieldOffset("emiteffectnum");
|
qcvm->extfields.emiteffectnum = ED_FindFieldOffset("emiteffectnum");
|
||||||
qcvm->extfields.viewmodelforclient = ED_FindFieldOffset("viewmodelforclient");
|
qcvm->extfields.viewmodelforclient = ED_FindFieldOffset("viewmodelforclient");
|
||||||
|
qcvm->extfields.exteriormodeltoclient = ED_FindFieldOffset("exteriormodeltoclient");
|
||||||
qcvm->extfields.scale = ED_FindFieldOffset("scale");
|
qcvm->extfields.scale = ED_FindFieldOffset("scale");
|
||||||
qcvm->extfields.colormod = ED_FindFieldOffset("colormod");
|
qcvm->extfields.colormod = ED_FindFieldOffset("colormod");
|
||||||
qcvm->extfields.tag_entity = ED_FindFieldOffset("tag_entity");
|
qcvm->extfields.tag_entity = ED_FindFieldOffset("tag_entity");
|
||||||
|
|
|
@ -6230,6 +6230,7 @@ void PR_DumpPlatform_f(void)
|
||||||
fprintf(f, ".float emiteffectnum; /*can also be set with 'traileffect' from a map editor*/\n");
|
fprintf(f, ".float emiteffectnum; /*can also be set with 'traileffect' from a map editor*/\n");
|
||||||
fprintf(f, ".vector movement; /*describes which forward/right/up keys the player is holidng*/\n");
|
fprintf(f, ".vector movement; /*describes which forward/right/up keys the player is holidng*/\n");
|
||||||
fprintf(f, ".entity viewmodelforclient; /*attaches this entity to the specified player's view. invisible to other players*/\n");
|
fprintf(f, ".entity viewmodelforclient; /*attaches this entity to the specified player's view. invisible to other players*/\n");
|
||||||
|
fprintf(f, ".entity exteriormodeltoclient;/*hides the entity in the specified player's main view. it will remain visible in mirrors etc.*/\n");
|
||||||
fprintf(f, ".float scale; /*rescales the etntiy*/\n");
|
fprintf(f, ".float scale; /*rescales the etntiy*/\n");
|
||||||
fprintf(f, ".float alpha; /*entity opacity*/\n"); //entity alpha. woot.
|
fprintf(f, ".float alpha; /*entity opacity*/\n"); //entity alpha. woot.
|
||||||
fprintf(f, ".vector colormod; /*tints the entity's colours*/\n");
|
fprintf(f, ".vector colormod; /*tints the entity's colours*/\n");
|
||||||
|
|
|
@ -202,6 +202,7 @@ struct pr_extfields_s
|
||||||
int alpha; //float
|
int alpha; //float
|
||||||
int movement; //vector
|
int movement; //vector
|
||||||
int viewmodelforclient; //entity
|
int viewmodelforclient; //entity
|
||||||
|
int exteriormodeltoclient; //entity
|
||||||
int traileffectnum; //float
|
int traileffectnum; //float
|
||||||
int emiteffectnum; //float
|
int emiteffectnum; //float
|
||||||
int scale; //float
|
int scale; //float
|
||||||
|
|
|
@ -673,7 +673,7 @@ void R_SetupAliasLighting (entity_t *e)
|
||||||
float radiansangle;
|
float radiansangle;
|
||||||
float *origin = e->origin;
|
float *origin = e->origin;
|
||||||
|
|
||||||
if (e->netstate.eflags & EFLAGS_VIEWMODEL)
|
if (e->eflags & EFLAGS_VIEWMODEL)
|
||||||
origin = r_refdef.vieworg;
|
origin = r_refdef.vieworg;
|
||||||
R_LightPoint (origin);
|
R_LightPoint (origin);
|
||||||
|
|
||||||
|
@ -770,7 +770,7 @@ void R_DrawAliasModel (entity_t *e)
|
||||||
R_SetupAliasFrame (paliashdr, e->frame, &lerpdata);
|
R_SetupAliasFrame (paliashdr, e->frame, &lerpdata);
|
||||||
R_SetupEntityTransform (e, &lerpdata);
|
R_SetupEntityTransform (e, &lerpdata);
|
||||||
|
|
||||||
if (e->netstate.eflags & EFLAGS_VIEWMODEL)
|
if (e->eflags & EFLAGS_VIEWMODEL)
|
||||||
{
|
{
|
||||||
//transform it relative to the view, by rebuilding the modelview matrix without the view position.
|
//transform it relative to the view, by rebuilding the modelview matrix without the view position.
|
||||||
glPushMatrix ();
|
glPushMatrix ();
|
||||||
|
@ -1052,7 +1052,7 @@ cleanup:
|
||||||
if (alphatest)
|
if (alphatest)
|
||||||
glDisable (GL_ALPHA_TEST);
|
glDisable (GL_ALPHA_TEST);
|
||||||
glColor3f(1,1,1);
|
glColor3f(1,1,1);
|
||||||
if (e->netstate.eflags & EFLAGS_VIEWMODEL)
|
if (e->eflags & EFLAGS_VIEWMODEL)
|
||||||
glDepthRange (0, 1);
|
glDepthRange (0, 1);
|
||||||
glPopMatrix ();
|
glPopMatrix ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@ typedef struct entity_s
|
||||||
// that splits bmodel, or NULL if
|
// that splits bmodel, or NULL if
|
||||||
// not split
|
// not split
|
||||||
|
|
||||||
|
byte eflags; //spike -- mostly a mirror of netstate, but handles tag inheritance (eww!)
|
||||||
byte alpha; //johnfitz -- alpha
|
byte alpha; //johnfitz -- alpha
|
||||||
byte lerpflags; //johnfitz -- lerping
|
byte lerpflags; //johnfitz -- lerping
|
||||||
float lerpstart; //johnfitz -- animation lerping
|
float lerpstart; //johnfitz -- animation lerping
|
||||||
|
|
|
@ -1062,9 +1062,9 @@ static void SVFTE_BuildSnapshotForClient (client_t *client)
|
||||||
}
|
}
|
||||||
else if (ent->alpha == ENTALPHA_ZERO && !ent->v.effects) //don't send invisible entities unless they have effects
|
else if (ent->alpha == ENTALPHA_ZERO && !ent->v.effects) //don't send invisible entities unless they have effects
|
||||||
continue;
|
continue;
|
||||||
// val = GetEdictFieldValue(ent, pr_extfields.exteriormodelforclient);
|
val = GetEdictFieldValue(ent, qcvm->extfields.exteriormodeltoclient);
|
||||||
// if (val && val->edict == proged)
|
if (val && val->edict == proged)
|
||||||
// eflags |= EFLAGS_EXTERIORMODEL;
|
eflags |= EFLAGS_EXTERIORMODEL;
|
||||||
//EFLAGS_VIEWMODEL was handled above
|
//EFLAGS_VIEWMODEL was handled above
|
||||||
ents[numents].state.eflags |= eflags;
|
ents[numents].state.eflags |= eflags;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue