diff --git a/src/doom/g_game.c b/src/doom/g_game.c index 7d6df7a3cb..175a054789 100644 --- a/src/doom/g_game.c +++ b/src/doom/g_game.c @@ -1640,6 +1640,12 @@ int cpars[32] = 240,150,180,150,150,300,330,420,300,180, // 21-30 120,30 // 31-32 }; + +// Chex Quest Par Times +int chexpars[6] = +{ + 0,120,360,480,200,360 +}; // [crispy] No Rest For The Living par times from the BFG Edition static int npars[9] = @@ -1962,7 +1968,14 @@ void G_DoCompleted (void) wminfo.partime = TICRATE*bex_pars[gameepisode][gamemap]; } else - wminfo.partime = TICRATE*pars[gameepisode][gamemap]; + if (gameversion == exe_chex && gameepisode == 1 && gamemap < 6) + { + wminfo.partime = TICRATE*chexpars[gamemap]; + } + else + { + wminfo.partime = TICRATE*pars[gameepisode][gamemap]; + } } else { diff --git a/src/i_main.c b/src/i_main.c index 0805784417..fdb387b521 100644 --- a/src/i_main.c +++ b/src/i_main.c @@ -68,6 +68,7 @@ int main(int argc, char **argv) #endif M_FindResponseFile(); + M_SetExeDir(); #ifdef SDL_HINT_NO_SIGNAL_HANDLERS SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "1"); diff --git a/src/i_musicpack.c b/src/i_musicpack.c index 1c3ed6f571..dada1b39c8 100644 --- a/src/i_musicpack.c +++ b/src/i_musicpack.c @@ -933,7 +933,7 @@ static void LoadSubstituteConfigs(void) { musicdir = M_StringJoin(music_pack_path, DIR_SEPARATOR_S, NULL); } - else if (!strcmp(configdir, "")) + else if (!strcmp(configdir, exedir)) { musicdir = M_StringDuplicate(""); } diff --git a/src/m_argv.c b/src/m_argv.c index cac54acea2..16e8a94c81 100644 --- a/src/m_argv.c +++ b/src/m_argv.c @@ -417,3 +417,13 @@ const char *M_GetExecutableName(void) return M_BaseName(myargv[0]); } +char *exedir = NULL; + +void M_SetExeDir(void) +{ + char *dirname; + + dirname = M_DirName(myargv[0]); + exedir = M_StringJoin(dirname, DIR_SEPARATOR_S, NULL); + free(dirname); +} diff --git a/src/m_argv.h b/src/m_argv.h index 482f29a26b..b42f11cd47 100644 --- a/src/m_argv.h +++ b/src/m_argv.h @@ -28,6 +28,9 @@ extern int myargc; extern char** myargv; +extern char *exedir; +void M_SetExeDir(void); + // Returns the position of the given parameter // in the arg list (0 if not found). int M_CheckParm (const char* check); diff --git a/src/m_config.c b/src/m_config.c index f01ebce2a2..6488c65f2f 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -2751,9 +2751,6 @@ float M_GetFloatVariable(const char *name) static char *GetDefaultConfigDir(void) { - char *result; - char *copy; - #if !defined(_WIN32) || defined(_WIN32_WCE) // Configuration settings are stored in an OS-appropriate path @@ -2761,6 +2758,9 @@ static char *GetDefaultConfigDir(void) // ~/.local/share/chocolate-doom. On Windows, we behave like // Vanilla Doom and save in the current directory. + char *result; + char *copy; + result = SDL_GetPrefPath("", PACKAGE_TARNAME); if (result != NULL) { @@ -2769,11 +2769,7 @@ static char *GetDefaultConfigDir(void) return copy; } #endif /* #ifndef _WIN32 */ - - result = M_DirName(myargv[0]); - copy = M_StringJoin(result, DIR_SEPARATOR_S, NULL); - free(result); - return copy; + return M_StringDuplicate(exedir); } // @@ -2796,7 +2792,7 @@ void M_SetConfigDir(const char *dir) configdir = GetDefaultConfigDir(); } - if (strcmp(configdir, "") != 0) + if (strcmp(configdir, exedir) != 0) { printf("Using %s for configuration and saves\n", configdir); } @@ -2888,7 +2884,7 @@ char *M_GetSaveGameDir(const char *iwadname) #endif // If not "doing" a configuration directory (Windows), don't "do" // a savegame directory, either. - else if (!strcmp(configdir, "")) + else if (!strcmp(configdir, exedir)) { savegamedir = M_StringDuplicate(""); }