Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiangreffrath committed Mar 19, 2021
2 parents ef3754a + 86c6148 commit 68b800e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
15 changes: 14 additions & 1 deletion src/doom/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
Expand Down Expand Up @@ -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
{
Expand Down
1 change: 1 addition & 0 deletions src/i_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/i_musicpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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("");
}
Expand Down
10 changes: 10 additions & 0 deletions src/m_argv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
3 changes: 3 additions & 0 deletions src/m_argv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 6 additions & 10 deletions src/m_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2751,16 +2751,16 @@ 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
// determined by SDL. On typical Unix systems, this might be
// ~/.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)
{
Expand All @@ -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);
}

//
Expand All @@ -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);
}
Expand Down Expand Up @@ -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("");
}
Expand Down

0 comments on commit 68b800e

Please sign in to comment.