Link Here
|
14 |
#endif |
14 |
#endif |
15 |
|
15 |
|
16 |
#include "wl_def.h" |
16 |
#include "wl_def.h" |
|
|
17 |
#include <string> |
18 |
#include <errno.h> |
17 |
#pragma hdrstop |
19 |
#pragma hdrstop |
18 |
|
20 |
|
19 |
extern int lastgamemusicoffset; |
21 |
extern int lastgamemusicoffset; |
Link Here
|
3982 |
SD_PlaySound (SHOOTSND); |
3984 |
SD_PlaySound (SHOOTSND); |
3983 |
} |
3985 |
} |
3984 |
|
3986 |
|
|
|
3987 |
static void InitConfigname() |
3988 |
{ |
3989 |
if (configname[0]) |
3990 |
/* already initialized */ |
3991 |
return; |
3992 |
const char *home = getenv("HOME"); |
3993 |
if (!home) |
3994 |
{ |
3995 |
Quit("You must set $HOME."); |
3996 |
return; |
3997 |
} |
3998 |
std::string s = home; |
3999 |
#define DOT_WOLF_DIR "/.wolf4sdl" |
4000 |
#ifdef SPEAR |
4001 |
#define CONFIG_BASENAME "/spear." |
4002 |
#else |
4003 |
#define CONFIG_BASENAME "/wolf3d." |
4004 |
#endif |
4005 |
if (s.length() > sizeof(configname) - sizeof(DOT_WOLF_DIR) - sizeof(CONFIG_BASENAME)) |
4006 |
{ |
4007 |
Quit("Your $HOME is too long."); |
4008 |
return; |
4009 |
} |
4010 |
s += DOT_WOLF_DIR; |
4011 |
errno = 0; |
4012 |
int r = mkdir(s.c_str(), 0755); |
4013 |
if (r != 0 && errno != EEXIST) |
4014 |
{ |
4015 |
int e = errno; |
4016 |
Quit("Failed to mkdir %s: %s", s.c_str(), strerror(e)); |
4017 |
return; |
4018 |
} |
4019 |
s += CONFIG_BASENAME; |
4020 |
SDL_strlcpy(configname, s.c_str(), sizeof(configname)); |
4021 |
} |
3985 |
|
4022 |
|
3986 |
/////////////////////////////////////////////////////////////////////////// |
4023 |
/////////////////////////////////////////////////////////////////////////// |
3987 |
// |
4024 |
// |
Link Here
|
3992 |
CheckForEpisodes (void) |
4029 |
CheckForEpisodes (void) |
3993 |
{ |
4030 |
{ |
3994 |
struct stat statbuf; |
4031 |
struct stat statbuf; |
|
|
4032 |
InitConfigname(); |
3995 |
|
4033 |
|
3996 |
// |
4034 |
// |
3997 |
// JAPANESE VERSION |
4035 |
// JAPANESE VERSION |