From b8b0eb96bd4f229c57a30f4811dc5f4285951f99 Mon Sep 17 00:00:00 2001 From: aurhat Date: Sun, 5 Jul 2020 23:32:02 +0200 Subject: [PATCH] Hide spectator reflection and fix moving in 3rd person perspective Earlier in third person perspective: 1. reflection of the spectator (player1) was visible on the water (at least after full cycle of spectate mode switching); 2. it was possible to move position of the invisible spectator's (player1) ghost, although he should be attached to spectated player. Bug was visible on the water (the reflection moved) and in some cases on minimap - when player executed "spectate" and later "spectatemode 1", then camera stayed in the same position, but player position changed. Thanks BrutalSystem --- source/src/clientgame.cpp | 3 ++- source/src/entity.h | 2 +- source/src/rendermodel.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 97198667..95d4407b 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -517,7 +517,7 @@ void zapplayer(playerent *&d) void movelocalplayer() { - if(player1->state==CS_DEAD && !player1->allowmove()) + if(!player1->allowmove()) { if(lastmillis-player1->lastpain<2000) { @@ -1716,6 +1716,7 @@ void spectatemode(int mode) showscores(false); switch(mode) { + case SM_DEATHCAM: case SM_FOLLOW1ST: case SM_FOLLOW3RD: case SM_FOLLOW3RD_TRANSPARENT: diff --git a/source/src/entity.h b/source/src/entity.h index 3a16b994..2cf71c2a 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -429,7 +429,7 @@ public: int eardamagemillis; float maxroll, maxrolleffect, movroll, effroll; // roll added by movement and damage int ffov, scopefov; - bool allowmove() { return state!=CS_DEAD || spectatemode==SM_FLY; } + bool allowmove() { return (state!=CS_DEAD && state!=CS_SPECTATE) || spectatemode==SM_FLY; } weapon *weapons[NUMGUNS]; weapon *prevweaponsel, *weaponsel, *nextweaponsel, *primweap, *nextprimweap, *lastattackweapon; diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index aea3c3ee..2e3d44e9 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -1089,7 +1089,7 @@ void renderclients() { playerent *d; loopv(players) if((d = players[i]) && d->state!=CS_SPAWNING && d->state!=CS_SPECTATE && (!player1->isspectating() || player1->spectatemode != SM_FOLLOW1ST || player1->followplayercn != i)) renderclientp(d); - if(player1->state==CS_DEAD || (reflecting && !refracting)) renderclientp(player1); + if(player1->state==CS_DEAD || ((reflecting && !refracting) && (player1->state!=CS_SPECTATE || player1->spectatemode==SM_FLY))) renderclientp(player1); } void loadallmapmodels() // try to find all mapmodels in packages/models/mapmodels