Skip to content

Commit

Permalink
Adjust map/episode ids when specified on the command line for autostart.
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Mar 24, 2010
1 parent 533460d commit 17b6349
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 56 deletions.
26 changes: 13 additions & 13 deletions doomsday/plugins/jdoom/src/d_main.c
Expand Up @@ -562,8 +562,8 @@ void G_PostInit(void)

// Get skill / episode / map from parms.
gameSkill = startSkill = SM_NOITEMS;
startEpisode = 1;
startMap = 1;
startEpisode = 0;
startMap = 0;
autoStart = false;

// Game mode specific settings.
Expand Down Expand Up @@ -595,8 +595,8 @@ void G_PostInit(void)
p = ArgCheck("-episode");
if(p && p < myargc - 1)
{
startEpisode = Argv(p + 1)[0] - '0';
startMap = 1;
startEpisode = Argv(p + 1)[0] - '1';
startMap = 0;
autoStart = true;
}

Expand All @@ -617,13 +617,13 @@ void G_PostInit(void)
{
if(gameMode == commercial)
{
startMap = atoi(Argv(p + 1));
startMap = atoi(Argv(p + 1)) - 1;
autoStart = true;
}
else if(p < myargc - 2)
{
startEpisode = Argv(p + 1)[0] - '0';
startMap = Argv(p + 2)[0] - '0';
startEpisode = Argv(p + 1)[0] - '1';
startMap = Argv(p + 2)[0] - '1';
autoStart = true;
}
}
Expand Down Expand Up @@ -651,11 +651,11 @@ void G_PostInit(void)
if(autoStart)
{
if(gameMode == commercial)
Con_Message("Warp to Map %d, Skill %d\n", startMap,
Con_Message("Warp to Map %d, Skill %d\n", startMap+1,
startSkill + 1);
else
Con_Message("Warp to Episode %d, Map %d, Skill %d\n",
startEpisode, startMap, startSkill + 1);
startEpisode+1, startMap+1, startSkill + 1);
}

// Load a saved game?
Expand All @@ -671,14 +671,14 @@ void G_PostInit(void)
if(autoStart || IS_NETGAME)
{
if(gameMode == commercial)
sprintf(mapStr, "MAP%2.2d", startMap);
sprintf(mapStr, "MAP%2.2d", startMap+1);
else
sprintf(mapStr, "E%d%d", startEpisode, startMap);
sprintf(mapStr, "E%d%d", startEpisode+1, startMap+1);

if(!W_CheckNumForName(mapStr))
{
startEpisode = 1;
startMap = 1;
startEpisode = 0;
startMap = 0;
}
}

Expand Down
16 changes: 8 additions & 8 deletions doomsday/plugins/jdoom64/src/d_main.c
Expand Up @@ -424,8 +424,8 @@ void G_PostInit(void)

// Get skill / episode / map from parms.
gameSkill = startSkill = SM_NOITEMS;
startEpisode = 1;
startMap = 1;
startEpisode = 0;
startMap = 0;
autoStart = false;

// Game mode specific settings
Expand Down Expand Up @@ -464,7 +464,7 @@ void G_PostInit(void)
p = ArgCheck("-warp");
if(p && p < myargc - 1)
{
startMap = atoi(Argv(p + 1));
startMap = atoi(Argv(p + 1)) - '1';
autoStart = true;
}

Expand All @@ -490,8 +490,8 @@ void G_PostInit(void)
// Are we autostarting?
if(autoStart)
{
Con_Message("Warp to Episode %d, Map %d, Skill %d\n", startEpisode,
startMap, startSkill + 1);
Con_Message("Warp to Episode %d, Map %d, Skill %d\n", startEpisode+1,
startMap+1, startSkill + 1);
}

// Load a saved game?
Expand All @@ -506,12 +506,12 @@ void G_PostInit(void)
// Check valid episode and map.
if((autoStart || IS_NETGAME))
{
sprintf(mapStr, "MAP%2.2d", startMap);
sprintf(mapStr, "MAP%2.2d", startMap+1);

if(!W_CheckNumForName(mapStr))
{
startEpisode = 1;
startMap = 1;
startEpisode = 0;
startMap = 0;
}
}

Expand Down
35 changes: 18 additions & 17 deletions doomsday/plugins/jheretic/src/h_main.c
Expand Up @@ -330,6 +330,7 @@ void G_PreInit(void)
cfg.moveBlock = false;
cfg.fallOff = true;
cfg.fixFloorFire = false;
cfg.fixPlaneScrollMaterialsEastOnly = true;

cfg.statusbarOpacity = 1;
cfg.statusbarCounterAlpha = 1;
Expand Down Expand Up @@ -461,8 +462,8 @@ void G_PostInit(void)

// Defaults for skill, episode and map.
startSkill = SM_MEDIUM;
startEpisode = 1;
startMap = 1;
startEpisode = 0;
startMap = 0;
autoStart = false;

// Game mode specific settings.
Expand All @@ -488,16 +489,16 @@ void G_PostInit(void)
p = ArgCheck("-episode");
if(p && p < myargc - 1)
{
startEpisode = Argv(p + 1)[0] - '0';
startMap = 1;
startEpisode = Argv(p + 1)[0] - '1';
startMap = 0;
autoStart = true;
}

p = ArgCheck("-warp");
if(p && p < myargc - 2)
{
startEpisode = Argv(p + 1)[0] - '0';
startMap = Argv(p + 2)[0] - '0';
startEpisode = Argv(p + 1)[0] - '1';
startMap = Argv(p + 2)[0] - '1';
autoStart = true;
}

Expand Down Expand Up @@ -527,22 +528,22 @@ void G_PostInit(void)
p = ArgCheck("-devmap");
if(p && p < myargc - 2)
{
e = Argv(p + 1)[0];
m = Argv(p + 2)[0];
sprintf(file, MAPDIR "E%cM%c.wad", e, m);
e = Argv(p + 1)[0] - 1;
m = Argv(p + 2)[0] - 1;
sprintf(file, MAPDIR "E%cM%c.wad", e+1, m+1);
addFile(file);
printf("DEVMAP: Episode %c, Map %c.\n", e, m);
startEpisode = e - '0';
startMap = m - '0';
printf("DEVMAP: Episode %c, Map %c.\n", e+1, m+1);
startEpisode = e;
startMap = m;
autoStart = true;
devMap = true;
}

// Are we autostarting?
if(autoStart)
{
Con_Message("Warp to Episode %d, Map %d, Skill %d\n", startEpisode,
startMap, startSkill + 1);
Con_Message("Warp to Episode %d, Map %d, Skill %d\n", startEpisode+1,
startMap+1, startSkill + 1);
}

// Load a saved game?
Expand All @@ -557,12 +558,12 @@ void G_PostInit(void)
// Check valid episode and map
if(autoStart || IS_NETGAME && !devMap)
{
sprintf(mapStr, "E%d%d", startEpisode, startMap);
sprintf(mapStr, "E%d%d", startEpisode+1, startMap+1);

if(!W_CheckNumForName(mapStr))
{
startEpisode = 1;
startMap = 1;
startEpisode = 0;
startMap = 0;
}
}

Expand Down
24 changes: 6 additions & 18 deletions doomsday/plugins/jhexen/src/h2_main.c
Expand Up @@ -404,9 +404,9 @@ void G_PostInit(void)
/* None */

// Get skill / episode / map from parms.
startEpisode = 1;
startEpisode = 0;
startSkill = SM_MEDIUM;
startMap = 1;
startMap = 0;

// Game mode specific settings.
/* None */
Expand Down Expand Up @@ -450,20 +450,9 @@ void G_PostInit(void)
p = ArgCheck("-warp");
if(p && p < Argc() - 1)
{
int map;

warpMap = atoi(Argv(p + 1)) - 1;
map = P_TranslateMap(warpMap);
if(map == -1)
{ // Couldn't find real map number.
startMap = 1;
Con_Message("-WARP: Invalid map number.\n");
}
else
{ // Found a valid startmap.
startMap = map;
autoStart = true;
}
startMap = P_TranslateMap(warpMap);
autoStart = true;
}
else
{
Expand All @@ -487,12 +476,11 @@ void G_PostInit(void)
// Check valid episode and map.
if(autoStart || IS_NETGAME)
{
sprintf(mapStr,"MAP%2.2d", startMap);
sprintf(mapStr,"MAP%2.2d", startMap+1);

if(!W_CheckNumForName(mapStr))
{
startEpisode = 1;
startMap = 1;
startMap = 0;
}
}

Expand Down

0 comments on commit 17b6349

Please sign in to comment.