X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=114b177fb1578c19f30248069d85bf6a23acb350;hb=5bed0c59a91d32e2e82def3a95625b26bb8610a4;hp=0a44e0e5436906ad45913498a50d3a487f3545b5;hpb=3f1b421dc4b252437e0c7e8636d63772950460cc;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 0a44e0e5..114b177f 100644 --- a/src/init.c +++ b/src/init.c @@ -5069,6 +5069,7 @@ static void Execute_Command(char *command) strPrefix(command, "autowarp ") || strPrefix(command, "autotest ") || strPrefix(command, "autosave ") || + strPrefix(command, "autoupload ") || strPrefix(command, "autofix ")) { char *arg_ptr = strchr(command, ' '); @@ -5080,6 +5081,7 @@ static void Execute_Command(char *command) strPrefix(command, "autowarp") ? AUTOPLAY_MODE_WARP : strPrefix(command, "autotest") ? AUTOPLAY_MODE_TEST : strPrefix(command, "autosave") ? AUTOPLAY_MODE_SAVE : + strPrefix(command, "autoupload") ? AUTOPLAY_MODE_UPLOAD : strPrefix(command, "autofix") ? AUTOPLAY_MODE_FIX : AUTOPLAY_MODE_NONE); @@ -5230,7 +5232,6 @@ static void InitSetup(void) LoadUserSetup(); // global user number LoadSetup(); // global setup info - LoadSetup_AutoSetup(); // global auto setup info // set some options from setup file @@ -5528,7 +5529,7 @@ static void InitGfx(void) DrawProgramInfo(); - DrawInitText("Loading graphics", 120, FC_GREEN); + DrawInitTextHead("Loading graphics"); // initialize settings for busy animation with default values int parameter[NUM_GFX_ARGS]; @@ -6194,6 +6195,10 @@ void OpenAll(void) InitGlobal(); // initialize some global variables + InitRND(NEW_RANDOMIZE); + InitSimpleRandom(NEW_RANDOMIZE); + InitBetterRandom(NEW_RANDOMIZE); + print_timestamp_time("[init global stuff]"); InitSetup(); @@ -6229,9 +6234,6 @@ void OpenAll(void) InitMixer(); print_timestamp_time("[init setup/config stuff (6)]"); - InitRND(NEW_RANDOMIZE); - InitSimpleRandom(NEW_RANDOMIZE); - InitJoysticks(); print_timestamp_time("[init setup/config stuff]"); @@ -6329,6 +6331,9 @@ void OpenAll(void) print_timestamp_done("OpenAll"); + if (setup.ask_for_remaining_tapes) + setup.ask_for_uploading_tapes = TRUE; + DrawMainMenu(); #if 0 @@ -6350,8 +6355,44 @@ void OpenAll(void) #endif } +static boolean WaitForApiThreads(void) +{ + unsigned int thread_delay = 0; + unsigned int thread_delay_value = 10000; + + if (program.api_thread_count == 0) + return TRUE; + + // deactivate global animations (not accessible in game state "loading") + setup.toons = FALSE; + + // set game state to "loading" to be able to show busy animation + SetGameStatus(GAME_MODE_LOADING); + + ResetDelayCounter(&thread_delay); + + // wait for threads to finish (and fail on timeout) + while (program.api_thread_count > 0) + { + if (DelayReached(&thread_delay, thread_delay_value)) + { + Error("failed waiting for threads - TIMEOUT"); + + return FALSE; + } + + UPDATE_BUSY_STATE(); + + Delay(20); + } + + return TRUE; +} + void CloseAllAndExit(int exit_value) { + WaitForApiThreads(); + StopSounds(); FreeAllSounds(); FreeAllMusic();