X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=114b177fb1578c19f30248069d85bf6a23acb350;hb=5bed0c59a91d32e2e82def3a95625b26bb8610a4;hp=6adf67db99c57c5a005bbe4185c52b1bfe68714c;hpb=ec32314a7ce9f3ac478d7fdecf85ed949816bdc1;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 6adf67db..114b177f 100644 --- a/src/init.c +++ b/src/init.c @@ -5232,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 @@ -6198,6 +6197,7 @@ void OpenAll(void) InitRND(NEW_RANDOMIZE); InitSimpleRandom(NEW_RANDOMIZE); + InitBetterRandom(NEW_RANDOMIZE); print_timestamp_time("[init global stuff]"); @@ -6331,9 +6331,10 @@ void OpenAll(void) print_timestamp_done("OpenAll"); - DrawMainMenu(); + if (setup.ask_for_remaining_tapes) + setup.ask_for_uploading_tapes = TRUE; - CheckUploadTapes(); + DrawMainMenu(); #if 0 Debug("internal:path", "SDL_GetBasePath() == '%s'", @@ -6354,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();