i = MSG_ReadByte();
// cl.qw_spectator is an unneeded flag, cl.scores[cl.playerentity].qw_spectator works better (it can be updated by the server during the game)
//cl.qw_spectator = (i & 128) != 0;
- cl.playerentity = cl.viewentity = (i & 127) + 1;
+ cl.realplayerentity = cl.playerentity = cl.viewentity = (i & 127) + 1;
cl.scores = (scoreboard_t *)Mem_Alloc(cls.levelmempool, cl.maxclients*sizeof(*cl.scores));
// get the full level name
if (cl.viewentity >= cl.max_entities)
CL_ExpandEntities(cl.viewentity);
// LordHavoc: assume first setview recieved is the real player entity
- if (!cl.playerentity)
+ if (!cl.realplayerentity)
+ cl.realplayerentity = cl.viewentity;
+ // update cl.playerentity to this one if it is a valid player
+ if (cl.viewentity >= 1 && cl.viewentity <= cl.maxclients)
cl.playerentity = cl.viewentity;
break;
int viewentity;
// the real player entity (normally same as viewentity,
// different than viewentity if mod uses chasecam or other tricks)
+ int realplayerentity;
+ // this is updated to match cl.viewentity whenever it is in the clients
+ // range, basically this is used in preference to cl.realplayerentity for
+ // most purposes because when spectating another player it should show
+ // their information rather than yours
int playerentity;
// max players that can be in this game
int maxclients;
int qw_teamplay;
// unused: indicates whether the player is spectating
- // use cl.scores[cl.playerentity].qw_spectator instead
+ // use cl.scores[cl.playerentity-1].qw_spectator instead
//qboolean qw_spectator;
// movement parameters for client prediction