|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
#include "diablo.h" |
|
|
|
|
#include "../3rdParty/Storm/Source/storm.h" |
|
|
|
|
#include "../DiabloUI/diabloui.h" |
|
|
|
|
#include <config.h> |
|
|
|
|
|
|
|
|
|
DEVILUTION_BEGIN_NAMESPACE |
|
|
|
|
|
|
|
|
|
@ -38,8 +39,8 @@ int color_cycle_timer;
|
|
|
|
|
/* rdata */ |
|
|
|
|
|
|
|
|
|
BOOL fullscreen = TRUE; |
|
|
|
|
#ifdef _DEBUG |
|
|
|
|
int showintrodebug = 1; |
|
|
|
|
#ifdef _DEBUG |
|
|
|
|
int questdebug = -1; |
|
|
|
|
int debug_mode_key_s; |
|
|
|
|
int debug_mode_key_w; |
|
|
|
|
@ -249,9 +250,8 @@ void free_game()
|
|
|
|
|
FreeGameMem(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void diablo_init(const char *lpCmdLine) |
|
|
|
|
void diablo_init() |
|
|
|
|
{ |
|
|
|
|
diablo_parse_flags(lpCmdLine); |
|
|
|
|
init_create_window(); |
|
|
|
|
|
|
|
|
|
SFileEnableDirectAccess(TRUE); |
|
|
|
|
@ -292,155 +292,112 @@ void diablo_splash()
|
|
|
|
|
UiTitleDialog(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int DiabloMain(const char *lpCmdLine) |
|
|
|
|
int DiabloMain(int argc, char **argv) |
|
|
|
|
{ |
|
|
|
|
diablo_init(lpCmdLine); |
|
|
|
|
diablo_parse_flags(argc, argv); |
|
|
|
|
diablo_init(); |
|
|
|
|
diablo_splash(); |
|
|
|
|
mainmenu_loop(); |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void diablo_parse_flags(const char *args) |
|
|
|
|
static void print_help_and_exit() |
|
|
|
|
{ |
|
|
|
|
char c; |
|
|
|
|
printf("Options:\n"); |
|
|
|
|
printf(" %-20s %-30s\n", "-h, --help", "Print this message and exit"); |
|
|
|
|
printf(" %-20s %-30s\n", "--version", "Print the version and exit"); |
|
|
|
|
printf(" %-20s %-30s\n", "--data-dir", "Specify the folder of diabdat.mpq"); |
|
|
|
|
printf(" %-20s %-30s\n", "-n", "Skip startup videos"); |
|
|
|
|
printf(" %-20s %-30s\n", "-f", "Display frames per second"); |
|
|
|
|
printf(" %-20s %-30s\n", "-x", "Run in windowed mode"); |
|
|
|
|
#ifdef _DEBUG |
|
|
|
|
int i; |
|
|
|
|
printf("\nDebug options:\n"); |
|
|
|
|
printf(" %-20s %-30s\n", "-d", "Increaased item drops"); |
|
|
|
|
printf(" %-20s %-30s\n", "-w", "Enable cheats"); |
|
|
|
|
printf(" %-20s %-30s\n", "-$", "Enable god mode"); |
|
|
|
|
printf(" %-20s %-30s\n", "-^", "Enable god mode and debug tools"); |
|
|
|
|
//printf(" %-20s %-30s\n", "-b", "Enable item drop log");
|
|
|
|
|
printf(" %-20s %-30s\n", "-v", "Highlight visibility"); |
|
|
|
|
printf(" %-20s %-30s\n", "-i", "Ignore network timeout"); |
|
|
|
|
//printf(" %-20s %-30s\n", "-j <##>", "Init trigger at level");
|
|
|
|
|
printf(" %-20s %-30s\n", "-l <##> <##>", "Start in level as type"); |
|
|
|
|
printf(" %-20s %-30s\n", "-m <##>", "Add debug monster, up to 10 allowed"); |
|
|
|
|
printf(" %-20s %-30s\n", "-q <#>", "Force a certain quest"); |
|
|
|
|
printf(" %-20s %-30s\n", "-r <##########>", "Set map seed"); |
|
|
|
|
printf(" %-20s %-30s\n", "-t <##>", "Set current quest level"); |
|
|
|
|
#endif |
|
|
|
|
printf("\nReport bugs at https://github.com/diasurgical/devilutionX/\n"); |
|
|
|
|
exit(0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
while (*args != '\0') { |
|
|
|
|
while (isspace(*args)) { |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
{ |
|
|
|
|
c = tolower(*args); |
|
|
|
|
args++; |
|
|
|
|
switch (c) { |
|
|
|
|
#ifdef _DEBUG |
|
|
|
|
case '^': |
|
|
|
|
debug_mode_key_inverted_v = 1; |
|
|
|
|
break; |
|
|
|
|
case '$': |
|
|
|
|
debug_mode_dollar_sign = 1; |
|
|
|
|
break; |
|
|
|
|
case 'b': |
|
|
|
|
/*
|
|
|
|
|
debug_mode_key_b = 1; |
|
|
|
|
*/ |
|
|
|
|
break; |
|
|
|
|
case 'd': |
|
|
|
|
debug_mode_key_d = 1; |
|
|
|
|
break; |
|
|
|
|
#endif |
|
|
|
|
case 'f': |
|
|
|
|
EnableFrameCount(); |
|
|
|
|
break; |
|
|
|
|
#ifdef _DEBUG |
|
|
|
|
case 'i': |
|
|
|
|
debug_mode_key_i = 1; |
|
|
|
|
break; |
|
|
|
|
case 'j': |
|
|
|
|
/*
|
|
|
|
|
while(isspace(*args)) { |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
i = 0; |
|
|
|
|
while(isdigit(*args)) { |
|
|
|
|
i = *args + 10 * i - '0'; |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
debug_mode_key_J_trigger = i; |
|
|
|
|
*/ |
|
|
|
|
break; |
|
|
|
|
case 'l': |
|
|
|
|
setlevel = FALSE; |
|
|
|
|
leveldebug = TRUE; |
|
|
|
|
while (isspace(*args)) { |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
i = 0; |
|
|
|
|
while (isdigit(*args)) { |
|
|
|
|
i = *args + 10 * i - '0'; |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
leveltype = i; |
|
|
|
|
while (isspace(*args)) { |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
i = 0; |
|
|
|
|
while (isdigit(*args)) { |
|
|
|
|
i = *args + 10 * i - '0'; |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
currlevel = i; |
|
|
|
|
plr[0].plrlevel = i; |
|
|
|
|
break; |
|
|
|
|
case 'm': |
|
|
|
|
monstdebug = TRUE; |
|
|
|
|
while (isspace(*args)) { |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
i = 0; |
|
|
|
|
while (isdigit(*args)) { |
|
|
|
|
i = *args + 10 * i - '0'; |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
DebugMonsters[debugmonsttypes++] = i; |
|
|
|
|
break; |
|
|
|
|
void diablo_parse_flags(int argc, char **argv) |
|
|
|
|
{ |
|
|
|
|
for (int i = 1; i < argc; i++) { |
|
|
|
|
if (strcasecmp("-h", argv[i]) == 0 || strcasecmp("--help", argv[i]) == 0) { |
|
|
|
|
print_help_and_exit(); |
|
|
|
|
} else if (strcasecmp("--version", argv[i]) == 0) { |
|
|
|
|
printf("%s v%s\n", PROJECT_NAME, PROJECT_VERSION); |
|
|
|
|
exit(0); |
|
|
|
|
} else if (strcasecmp("--data-dir", argv[i]) == 0) { |
|
|
|
|
basePath = argv[++i]; |
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
if (basePath.back() != '\\') |
|
|
|
|
basePath += '\\'; |
|
|
|
|
#else |
|
|
|
|
if (basePath.back() != '/') |
|
|
|
|
basePath += '/'; |
|
|
|
|
#endif |
|
|
|
|
case 'n': |
|
|
|
|
showintrodebug = 0; |
|
|
|
|
break; |
|
|
|
|
} else if (strcasecmp("-n", argv[i]) == 0) { |
|
|
|
|
showintrodebug = 0; |
|
|
|
|
} else if (strcasecmp("-f", argv[i]) == 0) { |
|
|
|
|
EnableFrameCount(); |
|
|
|
|
} else if (strcasecmp("-x", argv[i]) == 0) { |
|
|
|
|
fullscreen = FALSE; |
|
|
|
|
#ifdef _DEBUG |
|
|
|
|
case 'q': |
|
|
|
|
while (isspace(*args)) { |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
i = 0; |
|
|
|
|
while (isdigit(*args)) { |
|
|
|
|
i = *args + 10 * i - '0'; |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
questdebug = i; |
|
|
|
|
break; |
|
|
|
|
case 'r': |
|
|
|
|
while (isspace(*args)) { |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
i = 0; |
|
|
|
|
while (isdigit(*args)) { |
|
|
|
|
i = *args + 10 * i - '0'; |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
setseed = i; |
|
|
|
|
break; |
|
|
|
|
case 's': |
|
|
|
|
debug_mode_key_s = 1; |
|
|
|
|
break; |
|
|
|
|
case 't': |
|
|
|
|
leveldebug = TRUE; |
|
|
|
|
setlevel = TRUE; |
|
|
|
|
while (isspace(*args)) { |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
i = 0; |
|
|
|
|
while (isdigit(*args)) { |
|
|
|
|
i = *args + 10 * i - '0'; |
|
|
|
|
args++; |
|
|
|
|
} |
|
|
|
|
setlvlnum = i; |
|
|
|
|
break; |
|
|
|
|
case 'v': |
|
|
|
|
visiondebug = TRUE; |
|
|
|
|
break; |
|
|
|
|
case 'w': |
|
|
|
|
debug_mode_key_w = 1; |
|
|
|
|
break; |
|
|
|
|
} else if (strcasecmp("-^", argv[i]) == 0) { |
|
|
|
|
debug_mode_key_inverted_v = 1; |
|
|
|
|
} else if (strcasecmp("-$", argv[i]) == 0) { |
|
|
|
|
debug_mode_dollar_sign = 1; |
|
|
|
|
/*
|
|
|
|
|
} else if (strcasecmp("-b", argv[i]) == 0) { |
|
|
|
|
debug_mode_key_b = 1; |
|
|
|
|
*/ |
|
|
|
|
} else if (strcasecmp("-d", argv[i]) == 0) { |
|
|
|
|
debug_mode_key_d = 1; |
|
|
|
|
} else if (strcasecmp("-i", argv[i]) == 0) { |
|
|
|
|
debug_mode_key_i = 1; |
|
|
|
|
/*
|
|
|
|
|
} else if (strcasecmp("-j", argv[i]) == 0) { |
|
|
|
|
debug_mode_key_J_trigger = argv[++i]; |
|
|
|
|
*/ |
|
|
|
|
} else if (strcasecmp("-l", argv[i]) == 0) { |
|
|
|
|
setlevel = FALSE; |
|
|
|
|
leveldebug = TRUE; |
|
|
|
|
leveltype = SDL_atoi(argv[++i]); |
|
|
|
|
currlevel = SDL_atoi(argv[++i]); |
|
|
|
|
plr[0].plrlevel = currlevel; |
|
|
|
|
} else if (strcasecmp("-m", argv[i]) == 0) { |
|
|
|
|
monstdebug = TRUE; |
|
|
|
|
DebugMonsters[debugmonsttypes++] = SDL_atoi(argv[++i]); |
|
|
|
|
} else if (strcasecmp("-q", argv[i]) == 0) { |
|
|
|
|
questdebug = SDL_atoi(argv[++i]); |
|
|
|
|
} else if (strcasecmp("-r", argv[i]) == 0) { |
|
|
|
|
setseed = SDL_atoi(argv[++i]); |
|
|
|
|
} else if (strcasecmp("-s", argv[i]) == 0) { |
|
|
|
|
debug_mode_key_s = 1; |
|
|
|
|
} else if (strcasecmp("-t", argv[i]) == 0) { |
|
|
|
|
leveldebug = TRUE; |
|
|
|
|
setlevel = TRUE; |
|
|
|
|
setlvlnum = SDL_atoi(argv[++i]); |
|
|
|
|
} else if (strcasecmp("-v", argv[i]) == 0) { |
|
|
|
|
visiondebug = TRUE; |
|
|
|
|
} else if (strcasecmp("-w", argv[i]) == 0) { |
|
|
|
|
debug_mode_key_w = 1; |
|
|
|
|
#endif |
|
|
|
|
case 'x': |
|
|
|
|
fullscreen = FALSE; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
printf("unrecognized option '%s'\n", argv[i]); |
|
|
|
|
print_help_and_exit(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|