int i;
float d;
- if (cl.entitydatabase.numframes)
+ if (cl.entitydatabase.numframes && cl.viewentity == cl.playerentity)
{
cl.viewentorigin[0] = cl.viewentoriginold[0] + frac * (cl.viewentoriginnew[0] - cl.viewentoriginold[0]);
cl.viewentorigin[1] = cl.viewentoriginold[1] + frac * (cl.viewentoriginnew[1] - cl.viewentoriginold[1]);
// local state
ent = &cl_entities[0];
// entire entity array was cleared, so just fill in a few fields
+ ent->state_current.active = true;
ent->render.model = cl.worldmodel = cl.model_precache[1];
ent->render.scale = 1;
ent->render.alpha = 1;
case svc_setview:
cl.viewentity = MSG_ReadShort ();
+ // LordHavoc: assume first setview recieved is the real player entity
+ if (!cl.playerentity)
+ cl.playerentity = cl.viewentity;
break;
case svc_lightstyle:
char levelname[40];
// cl_entitites[cl.viewentity] = player
int viewentity;
+ // the real player entity (normally same as viewentity,
+ // different than viewentity if mod uses chasecam or other tricks)
+ int playerentity;
+ // max players that can be in this game
int maxclients;
+ // type of game (deathmatch, coop, singleplayer)
int gametype;
// refresh related state
Mod_CheckLoaded(sv.worldmodel);
// find the client's PVS
+ // the real place being tested from
VectorAdd (clent->v.origin, clent->v.view_ofs, testeye);
pvs = SV_FatPVS (testeye);
- EntityFrame_Clear(&entityframe, testeye);
+
+ // the place being reported (to consider the fact the client still
+ // applies the view_ofs[2], so we have to only send the fractional part
+ // of view_ofs[2], undoing what the client will redo)
+ VectorCopy (testeye, testorigin);
+ testorigin[2] -= (float) ((int)(clent->v.view_ofs[2]) & 255);
+ EntityFrame_Clear(&entityframe, testorigin);
culled_pvs = 0;
culled_portal = 0;
bits = 0;
- bits |= SU_VIEWHEIGHT;
+ if (ent->v.view_ofs[2] != DEFAULT_VIEWHEIGHT)
+ bits |= SU_VIEWHEIGHT;
if (ent->v.idealpitch)
bits |= SU_IDEALPITCH;
MSG_WriteByte(msg, bits >> 24);
if (bits & SU_VIEWHEIGHT)
- //MSG_WriteChar (msg, ent->v.view_ofs[2]);
- MSG_WriteChar (msg, 0);
+ MSG_WriteChar (msg, ent->v.view_ofs[2]);
if (bits & SU_IDEALPITCH)
MSG_WriteChar (msg, ent->v.idealpitch);