Merge branch 'master' into scripting

Conflicts:
	src/actor.h
	src/g_doom/a_doomweaps.cpp
	src/p_local.h
	src/p_map.cpp
	src/sdl/i_main.cpp
	src/thingdef/thingdef_codeptr.cpp
This commit is contained in:
Randy Heit 2013-06-25 19:23:01 -05:00
commit 4deeb8d8ae
50 changed files with 825 additions and 576 deletions

View file

@ -827,9 +827,16 @@ void G_AddViewAngle (int yaw)
CVAR (Bool, bot_allowspy, false, 0)
enum {
SPY_CANCEL = 0,
SPY_NEXT,
SPY_PREV,
};
// [RH] Spy mode has been separated into two console commands.
// 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 (gamestate != GS_LEVEL)
@ -855,20 +862,24 @@ static void ChangeSpy (bool forward)
// Otherwise, cycle to the next player.
bool checkTeam = !demoplayback && deathmatch;
int pnum = int(players[consoleplayer].camera->player - players);
int step = forward ? 1 : -1;
do
int pnum = consoleplayer;
if (changespy != SPY_CANCEL)
{
pnum += step;
pnum &= MAXPLAYERS-1;
if (playeringame[pnum] &&
(!checkTeam || players[pnum].mo->IsTeammate (players[consoleplayer].mo) ||
(bot_allowspy && players[pnum].isbot)))
pnum = int(players[consoleplayer].camera->player - players);
int step = (changespy == SPY_NEXT) ? 1 : -1;
do
{
break;
}
} while (pnum != consoleplayer);
pnum += step;
pnum &= MAXPLAYERS-1;
if (playeringame[pnum] &&
(!checkTeam || players[pnum].mo->IsTeammate (players[consoleplayer].mo) ||
(bot_allowspy && players[pnum].isbot)))
{
break;
}
} while (pnum != consoleplayer);
}
players[consoleplayer].camera = players[pnum].mo;
S_UpdateSounds(players[consoleplayer].camera);
@ -882,15 +893,20 @@ static void ChangeSpy (bool forward)
CCMD (spynext)
{
// allow spy mode changes even during the demo
ChangeSpy (true);
ChangeSpy (SPY_NEXT);
}
CCMD (spyprev)
{
// 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
@ -2061,6 +2077,8 @@ static void PutSavePic (FILE *file, int width, int height)
void G_DoSaveGame (bool okForQuicksave, FString filename, const char *description)
{
char buf[100];
// Do not even try, if we're not in a level. (Can happen after
// a demo finishes playback.)
if (lines == NULL || sectors == NULL)
@ -2087,7 +2105,8 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio
SaveVersion = SAVEVER;
PutSavePic (stdfile, SAVEPICWIDTH, SAVEPICHEIGHT);
M_AppendPNGText (stdfile, "Software", "ZDoom " DOTVERSIONSTR);
mysnprintf(buf, countof(buf), GAMENAME " %s", GetVersionString());
M_AppendPNGText (stdfile, "Software", buf);
M_AppendPNGText (stdfile, "Engine", GAMESIG);
M_AppendPNGText (stdfile, "ZDoom Save Version", SAVESIG);
M_AppendPNGText (stdfile, "Title", description);