This commit is contained in:
Christoph Oelckers 2013-06-23 20:06:48 +02:00
commit 0da957a605

View file

@ -824,9 +824,16 @@ void G_AddViewAngle (int yaw)
CVAR (Bool, bot_allowspy, false, 0) CVAR (Bool, bot_allowspy, false, 0)
enum {
SPY_CANCEL = 0,
SPY_NEXT,
SPY_PREV,
};
// [RH] Spy mode has been separated into two console commands. // [RH] Spy mode has been separated into two console commands.
// One goes forward; the other goes backward. // One goes forward; the other goes backward.
static void ChangeSpy (bool forward) static void ChangeSpy (int changespy)
{ {
// If you're not in a level, then you can't spy. // If you're not in a level, then you can't spy.
if (gamestate != GS_LEVEL) if (gamestate != GS_LEVEL)
@ -853,7 +860,10 @@ static void ChangeSpy (bool forward)
// Otherwise, cycle to the next player. // Otherwise, cycle to the next player.
bool checkTeam = !demoplayback && deathmatch; bool checkTeam = !demoplayback && deathmatch;
int pnum = int(players[consoleplayer].camera->player - players); int pnum = int(players[consoleplayer].camera->player - players);
int step = forward ? 1 : -1; if (changespy == SPY_CANCEL) {
pnum = consoleplayer;
} else {
int step = (changespy == SPY_NEXT) ? 1 : -1;
do do
{ {
@ -866,6 +876,7 @@ static void ChangeSpy (bool forward)
break; break;
} }
} while (pnum != consoleplayer); } while (pnum != consoleplayer);
}
players[consoleplayer].camera = players[pnum].mo; players[consoleplayer].camera = players[pnum].mo;
S_UpdateSounds(players[consoleplayer].camera); S_UpdateSounds(players[consoleplayer].camera);
@ -879,15 +890,20 @@ static void ChangeSpy (bool forward)
CCMD (spynext) CCMD (spynext)
{ {
// allow spy mode changes even during the demo // allow spy mode changes even during the demo
ChangeSpy (true); ChangeSpy (SPY_NEXT);
} }
CCMD (spyprev) CCMD (spyprev)
{ {
// allow spy mode changes even during the demo // allow spy mode changes even during the demo
ChangeSpy (false); ChangeSpy (SPY_PREV);
} }
CCMD (spycancel)
{
// allow spy mode changes even during the demo
ChangeSpy (SPY_CANCEL);
}
// //
// G_Responder // G_Responder