diff options
author | Simon Howard | 2008-07-25 19:56:39 +0000 |
---|---|---|
committer | Simon Howard | 2008-07-25 19:56:39 +0000 |
commit | b1ece32aaba8bf6b7f233de77b6843af179631b0 (patch) | |
tree | 629c0ab92c12efbc6cf983a6301ba478ab5f96ea | |
parent | 82b4201f850208da35c31b1260841ecd293d31cb (diff) | |
download | chocolate-doom-b1ece32aaba8bf6b7f233de77b6843af179631b0.tar.gz chocolate-doom-b1ece32aaba8bf6b7f233de77b6843af179631b0.tar.bz2 chocolate-doom-b1ece32aaba8bf6b7f233de77b6843af179631b0.zip |
Initial chex.exe emulation.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1155
-rw-r--r-- | src/d_iwad.c | 87 | ||||
-rw-r--r-- | src/d_main.c | 7 | ||||
-rw-r--r-- | src/doomdef.h | 1 | ||||
-rw-r--r-- | src/f_finale.c | 7 | ||||
-rw-r--r-- | src/g_game.c | 39 | ||||
-rw-r--r-- | src/m_menu.c | 5 |
6 files changed, 106 insertions, 40 deletions
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; } @@ -619,6 +633,43 @@ char *D_FindIWAD(void) } // +// 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; i<arrlen(iwads); ++i) + { + if (gamemission == iwads[i].mission) + { + return iwads[i].name; + } + } + + return NULL; +} +// // SetSaveGameDir // // Chooses the directory used to store saved games. @@ -626,7 +677,7 @@ char *D_FindIWAD(void) void D_SetSaveGameDir(void) { - size_t i; + char *iwad_name; if (!strcmp(configdir, "")) { @@ -638,34 +689,18 @@ void D_SetSaveGameDir(void) { // Directory for savegames - savegamedir = Z_Malloc(strlen(configdir) + 30, PU_STATIC, 0); - sprintf(savegamedir, "%ssavegames", configdir); - - M_MakeDirectory(savegamedir); + iwad_name = SaveGameIWADName(); - // 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; i<arrlen(iwads); ++i) + if (iwad_name == NULL) { - if (gamemission == iwads[i].mission) - { - sprintf(savegamedir + strlen(savegamedir), - "%c%s%c", - DIR_SEPARATOR, iwads[i].name, DIR_SEPARATOR); - M_MakeDirectory(savegamedir); - break; - } + iwad_name = "unknown.wad"; } + + savegamedir = Z_Malloc(strlen(configdir) + 30, PU_STATIC, 0); + sprintf(savegamedir, "%ssavegames%c%s%c", configdir, + DIR_SEPARATOR, iwad_name, DIR_SEPARATOR); + + M_MakeDirectory(savegamedir); } } diff --git a/src/d_main.c b/src/d_main.c index 5e9d3f5b..6b90d57e 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -662,6 +662,7 @@ static struct {"Doom 1.9", "1.9", exe_doom_1_9}, {"Ultimate Doom", "ultimate", exe_ultimate}, {"Final Doom", "final", exe_final}, + {"Chex Quest", "chex", exe_chex}, { NULL, NULL, 0}, }; @@ -710,7 +711,11 @@ static void InitGameVersion(void) { // Determine automatically - if (gamemode == shareware || gamemode == registered) + if (gameversion == exe_chex) + { + // Already determined + } + else if (gamemode == shareware || gamemode == registered) { // original diff --git a/src/doomdef.h b/src/doomdef.h index acd2a5d6..87021ae2 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -105,6 +105,7 @@ typedef enum { exe_doom_1_9, // Doom 1.9: used for shareware, registered and commercial exe_ultimate, // Ultimate Doom (retail) + exe_chex, // Chex Quest executable (based on Ultimate Doom) exe_final, // Final Doom } GameVersion_t; diff --git a/src/f_finale.c b/src/f_finale.c index 7674f09f..1a3a85ca 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -136,6 +136,13 @@ void F_StartFinale (void) { textscreen_t *screen = &textscreens[i]; + // Hack for Chex Quest + + if (gameversion == exe_chex && screen->mission == 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<MAXPLAYERS ; i++) - players[i].didsecret = true; - break; - } - + if (gamemode != commercial) + { + // Chex Quest ends after 5 levels, rather than 8. + + if (gameversion == exe_chex) + { + if (gamemap == 5) + { + gameaction = ga_victory; + return; + } + } + else + { + switch(gamemap) + { + case 8: + gameaction = ga_victory; + return; + case 9: + for (i=0 ; i<MAXPLAYERS ; i++) + players[i].didsecret = true; + break; + } + } + } + //#if 0 Hmmm - why? if ( (gamemap == 8) && (gamemode != commercial) ) diff --git a/src/m_menu.c b/src/m_menu.c index 1426faa9..85d09a48 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -777,6 +777,7 @@ void M_DrawReadThis1(void) break; case exe_ultimate: + case exe_chex: // Ultimate Doom always displays "HELP1". @@ -901,7 +902,9 @@ void M_NewGame(int choice) return; } - if ( gamemode == commercial ) + // Chex Quest disabled the episode select screen, as did Doom II. + + if (gamemode == commercial || gameversion == exe_chex) M_SetupNextMenu(&NewDef); else M_SetupNextMenu(&EpiDef); |