diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index f80edf43..d1374573 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -6,6 +6,7 @@ int nextmode = 0; // nextmode becomes gamemode after next map load VAR(gamemode, 1, 0, 0); +VAR(followmode, 0, 1, 1); // follow(0) or embody(1) flaginfo flaginfos[2]; @@ -820,13 +821,21 @@ void refreshsopmenu(void *menu, bool init) } } -void followplayer(int i) +void followplayer(int j) { if(player1->state==CS_ALIVE) return; showscores(false); - player1->spectating = SM_FOLLOWPLAYER; + player1->spectating = (followmode==1) ? SM_EMBODYPLAYER : SM_FOLLOWPLAYER; if(players.length()) { + if(j!=-1) + { + if(players.inrange(j) && players[j] && players[j]->state == CS_ALIVE) + { + player1->followplayercn = j; + return; + } + } loopv(players) { player1->followplayercn = (player1->followplayercn+1+i) % players.length(); diff --git a/source/src/protos.h b/source/src/protos.h index 4fefb369..96cda6a8 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -289,7 +289,7 @@ extern void refreshsopmenu(void *menu, bool init); extern char *colorname(playerent *d, int num = 0, char *name = NULL, const char *prefix = ""); extern char *colorping(int ping); extern void toggledeathcam(); -extern void followplayer(int i = 1); +extern void followplayer(int j = -1); struct votedisplayinfo {