Skip to content

Commit

Permalink
Changed Hexen: It is now possible to -warp using the console if a gam…
Browse files Browse the repository at this point in the history
…e has not yet been started. In this instance a new game is initiated using the default skill and player class.
  • Loading branch information
danij-deng committed Mar 20, 2010
1 parent 7c3df87 commit 93e9749
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
5 changes: 3 additions & 2 deletions doomsday/plugins/common/src/g_game.c
Expand Up @@ -162,6 +162,8 @@ game_config_t cfg; // The global cfg.

int debugSound; // Debug flag for displaying sound info.

skillmode_t dSkill;

skillmode_t gameSkill;
uint gameEpisode;
uint gameMap;
Expand Down Expand Up @@ -397,7 +399,6 @@ ccmd_t gameCmds[] = {

// PRIVATE DATA DEFINITIONS ------------------------------------------------

static skillmode_t dSkill;
static uint dEpisode;
static uint dMap;

Expand Down Expand Up @@ -1685,7 +1686,7 @@ void G_StartNewInit(void)
void G_StartNewGame(skillmode_t skill)
{
G_StartNewInit();
G_InitNew(dSkill, 0, P_TranslateMap(0));
G_InitNew(skill, 0, P_TranslateMap(0));
}
#endif

Expand Down
2 changes: 2 additions & 0 deletions doomsday/plugins/jhexen/include/g_game.h
Expand Up @@ -42,6 +42,8 @@ extern skillmode_t gameSkill;
extern boolean deathmatch;
extern boolean userGame;

extern skillmode_t dSkill;

extern uint rebornPosition;
extern uint nextMap;
extern uint nextMapEntryPoint;
Expand Down
19 changes: 14 additions & 5 deletions doomsday/plugins/jhexen/src/m_cheat.c
Expand Up @@ -381,7 +381,7 @@ int Cht_WarpFunc(const int* args, int player)
}

map = P_TranslateMap((tens * 10 + ones) - 1);
if(map == gameMap)
if(userGame && map == gameMap)
{ // Don't try to teleport to the current map.
P_SetMessage(plr, TXT_CHEATBADINPUT, false);
return false;
Expand All @@ -407,10 +407,19 @@ int Cht_WarpFunc(const int* args, int player)
AM_Open(AM_MapForPlayer(i), false, true);

// So be it.
nextMap = map;
nextMapEntryPoint = 0;
briefDisabled = true;
G_SetGameAction(GA_LEAVEMAP);
if(userGame)
{
nextMap = map;
nextMapEntryPoint = 0;
briefDisabled = true;
G_SetGameAction(GA_LEAVEMAP);
}
else
{
briefDisabled = true;
G_StartNewInit();
G_InitNew(dSkill, 0, map);
}

return true;
}
Expand Down

0 comments on commit 93e9749

Please sign in to comment.