From bd50e67f654ffb4b92f10dbeebfe468d3559127c Mon Sep 17 00:00:00 2001 From: aurhat Date: Tue, 2 Dec 2014 21:05:47 +0100 Subject: [PATCH] Allow persistent spectating concrete player in multiplayer For spectatepersistent = 1 that is always enabled (that means, that spectated player isn't changed after his death), for 0 - only in non-arena modes, except of demos. "if(!available.length()) return f;" is introduced, in order to, in arena modes, doesn't happen switching to SM_FLY, when last alive players dies in the same moment and there is no winner of the round. --- source/src/clientgame.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index b17d94ba..9c4fef9b 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -1653,14 +1653,15 @@ void refreshsopmenu(void *menu, bool init) } extern bool watchingdemo; +VARP(spectatepersistent,0,1,1); // rotate through all spec-able players playerent *updatefollowplayer(int shiftdirection) { + playerent *f = players.inrange(player1->followplayercn) ? players[player1->followplayercn] : NULL; if(!shiftdirection) { - playerent *f = players.inrange(player1->followplayercn) ? players[player1->followplayercn] : NULL; - if(f && (watchingdemo || !f->isspectating())) return f; + if(f && (watchingdemo || !f->isspectating() || spectatepersistent || (!spectatepersistent && !m_arena) )) return f; } // collect spec-able players @@ -1671,7 +1672,7 @@ playerent *updatefollowplayer(int shiftdirection) if(players[i]->state==CS_DEAD || players[i]->isspectating()) continue; available.add(players[i]); } - if(!available.length()) return NULL; + if(!available.length()) return f; // rotate int oldidx = -1;