diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index c70504c0..66330bd7 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -235,7 +235,7 @@ void otherplayers() { loopv(players) if(players[i] && players[i]->type==ENT_PLAYER) { - const int lagtime = players[i]->lastupdate ? lastmillis-players[i]->lastupdate : 0; + const int lagtime = lastmillis-players[i]->lastupdate; if(lagtime>1000 && players[i]->state==CS_ALIVE) { players[i]->state = CS_LAGGED; diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 173de0c0..b489ede6 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -53,7 +53,7 @@ void updatelagtime(playerent *d) int lagtime = lastmillis-d->lastupdate; if(lagtime) { - if(d->lastupdate) d->plag = (d->plag*5+lagtime)/6; + if(d->state!=CS_SPAWNING) d->plag = (d->plag*5+lagtime)/6; d->lastupdate = lastmillis; } } @@ -96,7 +96,7 @@ void parsepositions(ucharbuf &p) d->onladder = f&1; updatepos(d); updatelagtime(d); - if(d->state==CS_LAGGED) d->state = CS_ALIVE; + if(d->state==CS_LAGGED || d->state==CS_SPAWNING) d->state = CS_ALIVE; break; } @@ -251,8 +251,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) if(!d) break; d->lifesequence = ls; d->gunselect = gunselect; - d->state = CS_ALIVE; - d->lastupdate = 0; + d->state = CS_SPAWNING; break; } diff --git a/source/src/entity.h b/source/src/entity.h index 68c048ee..eb8abd43 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -81,7 +81,7 @@ static inline int kick_back(int gun) { return guns[gun].mdl_kick_back; } #define team_opposite(o) ((o) == TEAM_CLA ? TEAM_RVSF : TEAM_CLA) enum { ENT_PLAYER = 0, ENT_BOT, ENT_CAMERA, ENT_BOUNCE }; -enum { CS_ALIVE = 0, CS_DEAD, CS_LAGGED, CS_EDITING }; +enum { CS_ALIVE = 0, CS_DEAD, CS_SPAWNING, CS_LAGGED, CS_EDITING }; enum { CR_DEFAULT, CR_MASTER, CR_ADMIN }; struct physent diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index 250be489..5b22b6c9 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -391,7 +391,7 @@ void renderclient(playerent *d) void renderclients() { playerent *d; - loopv(players) if((d = players[i]) && (d->type!=ENT_PLAYER || d->state!=CS_ALIVE || d->lastupdate)) renderclient(d); + loopv(players) if((d = players[i]) && d->state!=CS_SPAWNING) renderclient(d); if(player1->state==CS_DEAD || (reflecting && !refracting)) renderclient(player1); } diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index bdd29451..7033ce05 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -199,7 +199,7 @@ playerent *intersectclosest(vec &from, vec &to, playerent *at) loopv(players) { playerent *o = players[i]; - if(!o || o==at || o->state!=CS_ALIVE || (o->type==ENT_PLAYER && !o->lastupdate)) continue; + if(!o || o==at || o->state!=CS_ALIVE) continue; if(!intersect(o, from, to)) continue; float dist = at->o.dist(o->o); if(diststate!=CS_ALIVE || (o!=player1 && o->type==ENT_PLAYER && !o->lastupdate)) return; + if(o->state!=CS_ALIVE) return; vec dir; float dist = expdist(o, dir, v); if(diststate!=CS_ALIVE || (o!=player1 && o->type==ENT_PLAYER && !o->lastupdate) || !intersect(o, p.o, v)) return false; + if(o->state!=CS_ALIVE || !intersect(o, p.o, v)) return false; splash(p, v, p.o, o, qdam); vec dir; expdist(o, dir, v);