From b1ece32aaba8bf6b7f233de77b6843af179631b0 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 25 Jul 2008 19:56:39 +0000 Subject: Initial chex.exe emulation. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1155 --- src/d_iwad.c | 87 ++++++++++++++++++++++++++++++++++++++++------------------ src/d_main.c | 7 ++++- src/doomdef.h | 1 + src/f_finale.c | 7 +++++ src/g_game.c | 39 ++++++++++++++++++-------- src/m_menu.c | 5 +++- 6 files changed, 106 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/d_iwad.c b/src/d_iwad.c index d54ad915..032679e6 100644 --- a/src/d_iwad.c +++ b/src/d_iwad.c @@ -325,7 +325,18 @@ static struct {"tnt.wad", pack_tnt}, {"doom.wad", doom}, {"doom1.wad", doom}, + {"chex.wad", doom}, }; + +// Hack for chex quest mode + +static void CheckChex(char *iwad_name) +{ + if (!strcmp(iwad_name, "chex.wad")) + { + gameversion = exe_chex; + } +} // Search a directory to try to find an IWAD // Returns the location of the IWAD if found, otherwise NULL. @@ -354,7 +365,9 @@ static char *SearchDirectoryForIWAD(char *dir) if (M_FileExists(filename)) { + CheckChex(iwads[i].name); gamemission = iwads[i].mission; + return filename; } @@ -387,6 +400,7 @@ static void IdentifyIWADByName(char *name) if (!strcasecmp(name + strlen(name) - strlen(iwadname), iwadname)) { + CheckChex(iwads[i].name); gamemission = iwads[i].mission; break; } @@ -618,6 +632,43 @@ char *D_FindIWAD(void) return result; } +// +// Get the IWAD name used for savegames. +// + +static char *SaveGameIWADName(void) +{ + size_t i; + + // Chex quest hack + + if (gameversion == exe_chex) + { + return "chex.wad"; + } + + // Find what subdirectory to use for savegames + // + // They should be stored in something like + // ~/.chocolate-doom/savegames/doom.wad/ + // + // The directory depends on the IWAD, so that savegames for + // different IWADs are kept separate. + // + // Note that we match on gamemission rather than on IWAD name. + // This ensures that doom1.wad and doom.wad saves are stored + // in the same place. + + for (i=0; imission == doom) + { + screen->level = 5; + } + if (gamemission == screen->mission && (gamemission != doom || gameepisode == screen->episode) && gamemap == screen->level) diff --git a/src/g_game.c b/src/g_game.c index fc644778..44e77a74 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1258,18 +1258,33 @@ void G_DoCompleted (void) if (automapactive) AM_Stop (); - if ( gamemode != commercial) - switch(gamemap) - { - case 8: - gameaction = ga_victory; - return; - case 9: - for (i=0 ; i