mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +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)
|
||||
return false; //parent isn't valid
|
||||
parent = &cl.entities[tagent];
|
||||
|
||||
if (tagent == cl.viewentity)
|
||||
ent->eflags |= EFLAGS_EXTERIORMODEL;
|
||||
|
||||
if (!parent->model)
|
||||
return false;
|
||||
if (0)//tagent < ent-cl_entities)
|
||||
|
@ -562,6 +566,8 @@ static qboolean CL_AttachEntity(entity_t *ent, float frac)
|
|||
VectorAngles(fwd, up, ent->angles);
|
||||
if (ent->model && ent->model->type == mod_alias)
|
||||
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
|
||||
continue;
|
||||
}
|
||||
ent->eflags = ent->netstate.eflags;
|
||||
|
||||
// if the object wasn't included in the last packet, remove it
|
||||
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
|
||||
|
||||
ent->netstate = ent->baseline;
|
||||
ent->eflags = ent->netstate.eflags; //spike -- annoying and probably not used anyway, but w/e
|
||||
|
||||
ent->trailstate = NULL;
|
||||
ent->emitstate = NULL;
|
||||
|
|
|
@ -643,6 +643,10 @@ void R_DrawEntitiesOnList (qboolean alphapass) //johnfitz -- added parameter
|
|||
currententity->angles[0] *= 0.3;
|
||||
//johnfitz
|
||||
|
||||
//spike -- this would be more efficient elsewhere, but its more correct here.
|
||||
if (currententity->eflags & EFLAGS_EXTERIORMODEL)
|
||||
continue;
|
||||
|
||||
switch (currententity->model->type)
|
||||
{
|
||||
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.emiteffectnum = ED_FindFieldOffset("emiteffectnum");
|
||||
qcvm->extfields.viewmodelforclient = ED_FindFieldOffset("viewmodelforclient");
|
||||
qcvm->extfields.exteriormodeltoclient = ED_FindFieldOffset("exteriormodeltoclient");
|
||||
qcvm->extfields.scale = ED_FindFieldOffset("scale");
|
||||
qcvm->extfields.colormod = ED_FindFieldOffset("colormod");
|
||||
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, ".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 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 alpha; /*entity opacity*/\n"); //entity alpha. woot.
|
||||
fprintf(f, ".vector colormod; /*tints the entity's colours*/\n");
|
||||
|
|
|
@ -202,6 +202,7 @@ struct pr_extfields_s
|
|||
int alpha; //float
|
||||
int movement; //vector
|
||||
int viewmodelforclient; //entity
|
||||
int exteriormodeltoclient; //entity
|
||||
int traileffectnum; //float
|
||||
int emiteffectnum; //float
|
||||
int scale; //float
|
||||
|
|
|
@ -673,7 +673,7 @@ void R_SetupAliasLighting (entity_t *e)
|
|||
float radiansangle;
|
||||
float *origin = e->origin;
|
||||
|
||||
if (e->netstate.eflags & EFLAGS_VIEWMODEL)
|
||||
if (e->eflags & EFLAGS_VIEWMODEL)
|
||||
origin = r_refdef.vieworg;
|
||||
R_LightPoint (origin);
|
||||
|
||||
|
@ -770,7 +770,7 @@ void R_DrawAliasModel (entity_t *e)
|
|||
R_SetupAliasFrame (paliashdr, e->frame, &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.
|
||||
glPushMatrix ();
|
||||
|
@ -1052,7 +1052,7 @@ cleanup:
|
|||
if (alphatest)
|
||||
glDisable (GL_ALPHA_TEST);
|
||||
glColor3f(1,1,1);
|
||||
if (e->netstate.eflags & EFLAGS_VIEWMODEL)
|
||||
if (e->eflags & EFLAGS_VIEWMODEL)
|
||||
glDepthRange (0, 1);
|
||||
glPopMatrix ();
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ typedef struct entity_s
|
|||
// that splits bmodel, or NULL if
|
||||
// not split
|
||||
|
||||
byte eflags; //spike -- mostly a mirror of netstate, but handles tag inheritance (eww!)
|
||||
byte alpha; //johnfitz -- alpha
|
||||
byte lerpflags; //johnfitz -- 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
|
||||
continue;
|
||||
// val = GetEdictFieldValue(ent, pr_extfields.exteriormodelforclient);
|
||||
// if (val && val->edict == proged)
|
||||
// eflags |= EFLAGS_EXTERIORMODEL;
|
||||
val = GetEdictFieldValue(ent, qcvm->extfields.exteriormodeltoclient);
|
||||
if (val && val->edict == proged)
|
||||
eflags |= EFLAGS_EXTERIORMODEL;
|
||||
//EFLAGS_VIEWMODEL was handled above
|
||||
ents[numents].state.eflags |= eflags;
|
||||
|
||||
|
|
Loading…
Reference in a new issue