diff options
-rw-r--r-- | sword2/build_display.cpp | 59 | ||||
-rw-r--r-- | sword2/debug.cpp | 9 | ||||
-rw-r--r-- | sword2/driver/driver96.h | 1 | ||||
-rw-r--r-- | sword2/driver/palette.cpp | 7 | ||||
-rw-r--r-- | sword2/layers.cpp | 7 | ||||
-rw-r--r-- | sword2/resman.cpp | 61 |
6 files changed, 25 insertions, 119 deletions
diff --git a/sword2/build_display.cpp b/sword2/build_display.cpp index 6a262c127a..c71deb0829 100644 --- a/sword2/build_display.cpp +++ b/sword2/build_display.cpp @@ -349,22 +349,7 @@ void DisplayMsg(uint8 *text, int time) { // Chris 15May97 if (GetFadeStatus() != RDFADE_BLACK) { FadeDown((float) 0.75); - - do { - //-------------------------------------------------- - // Service windows - while (!gotTheFocus) - if (ServiceWindows() == RDERR_APPCLOSED) - break; - - // if we pressed Ctrl-Q - if (ServiceWindows() == RDERR_APPCLOSED) { - Close_game(); //close engine systems down - CloseAppWindow(); - exit(0); //quit the game - } - //-------------------------------------------------- - } while (GetFadeStatus() == RDFADE_DOWN); + WaitForFade(); } Set_mouse(0); @@ -416,21 +401,7 @@ void DisplayMsg(uint8 *text, int time) { // Chris 15May97 Free_mem(text_spr); - do { - //-------------------------------------------------- - // Service windows - while (!gotTheFocus) - if (ServiceWindows() == RDERR_APPCLOSED) - break; - - // if we pressed Ctrl-Q - if (ServiceWindows() == RDERR_APPCLOSED) { - Close_game(); //close engine systems down - CloseAppWindow(); - exit(0); //quit the game - } - //-------------------------------------------------- - } while (GetFadeStatus() == RDFADE_UP); + WaitForFade(); uint32 targetTime = SVM_timeGetTime() + (time * 1000); @@ -473,22 +444,7 @@ void DisplayMsg(uint8 *text, int time) { // Chris 15May97 void RemoveMsg(void) { // Chris 15May97 FadeDown((float) 0.75); - do { - //-------------------------------------------------- - // Service windows - while (!gotTheFocus) - if (ServiceWindows() == RDERR_APPCLOSED) - break; - - // if we pressed Ctrl-Q - if (ServiceWindows() == RDERR_APPCLOSED) - { - Close_game(); //close engine systems down - CloseAppWindow(); - exit(0); //quit the game - } - //-------------------------------------------------- - } while (GetFadeStatus() == RDFADE_DOWN); + WaitForFade(); EraseBackBuffer(); // for hardware rendering EraseSoftwareScreenBuffer(); // for software rendering @@ -1054,10 +1010,7 @@ void Start_new_palette(void) { //Tony25Sept96 // if the screen is still fading down then wait for black - could // happen when everythings cached into a large memory model - - do { - ServiceWindows(); - } while (GetFadeStatus() == RDFADE_DOWN); + WaitForFade(); // open the screen file screenFile = res_man.Res_open(this_screen.background_layer_id); @@ -1111,9 +1064,7 @@ int32 FN_fade_down(int32 *params) { //Tony5Dec96 } int32 FN_fade_up(int32 *params) { //Chris 15May97 - do { - ServiceWindows(); - } while (GetFadeStatus() == RDFADE_DOWN); + WaitForFade(); if (GetFadeStatus() == RDFADE_BLACK) FadeUp((float) 0.75); diff --git a/sword2/debug.cpp b/sword2/debug.cpp index 6f2cb6891e..8e4f370ab8 100644 --- a/sword2/debug.cpp +++ b/sword2/debug.cpp @@ -102,13 +102,14 @@ void ExitWithReport(const char *format,...) // (6dec96 JEL) vsprintf(buf, format, arg_ptr); Zdebug("%s",buf); // send output to 'debug.txt' as well, just for the record - while (GetFadeStatus()) // wait for fade to finish before calling RestoreDisplay() - ServiceWindows(); + // wait for fade to finish before calling RestoreDisplay() + WaitForFade(); ReportFatalError((const uint8 *)buf); // display message box CloseAppWindow(); - while (ServiceWindows() != RDERR_APPCLOSED); - + // This looks like a bad idea, since our ServiceWindows() never + // returns RDERR_APPCLOSED. + // while (ServiceWindows() != RDERR_APPCLOSED); exit(0); } diff --git a/sword2/driver/driver96.h b/sword2/driver/driver96.h index 9543e9e58e..8abc5a3946 100644 --- a/sword2/driver/driver96.h +++ b/sword2/driver/driver96.h @@ -1421,6 +1421,7 @@ extern int32 FadeUp(float time); extern int32 FadeDown(float time); extern uint8 GetFadeStatus(void); extern int32 DimPalette(void); +extern void WaitForFade(void); //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- diff --git a/sword2/driver/palette.cpp b/sword2/driver/palette.cpp index ac3b480871..96a73da58d 100644 --- a/sword2/driver/palette.cpp +++ b/sword2/driver/palette.cpp @@ -312,6 +312,13 @@ uint8 GetFadeStatus(void) { return fadeStatus; } +void WaitForFade(void) { + while (GetFadeStatus() != RDFADE_NONE && GetFadeStatus() != RDFADE_BLACK) { + ServiceWindows(); + g_system->delay_msecs(20); + } +} + void FadeServer() { static int32 previousTime = 0; const byte *newPalette = (const byte *) fadePalette; diff --git a/sword2/layers.cpp b/sword2/layers.cpp index 7930a7acb9..9dfa9ad121 100644 --- a/sword2/layers.cpp +++ b/sword2/layers.cpp @@ -92,11 +92,8 @@ int32 FN_init_background(int32 *params) //Tony11Sept96 //------------------------------------------------------- // if the screen is still fading down then wait for black - do - { - ServiceWindows(); - } - while(GetFadeStatus()==RDFADE_DOWN); + WaitForFade(); + //------------------------------------------------------- if (this_screen.mask_flag) // if last screen was using a shading mask (see below) (James 08apr97) diff --git a/sword2/resman.cpp b/sword2/resman.cpp index 5349dca4f2..c1a064d3e7 100644 --- a/sword2/resman.cpp +++ b/sword2/resman.cpp @@ -955,38 +955,11 @@ void resMan::CacheNewCluster(uint32 newCluster) { char buf[1024]; sprintf(buf, "%sClusters\\%s", cdPath, resource_files[newCluster]); - uint8 fadeStat; - - do { - fadeStat = GetFadeStatus(); - - //-------------------------------------------------- - // Service windows - - // if we pressed Ctrl-Q - if (ServiceWindows() == RDERR_APPCLOSED) { - Close_game(); //close engine systems down - CloseAppWindow(); - exit(0); //quit the game - } - //-------------------------------------------------- - } while (fadeStat == RDFADE_UP || fadeStat == RDFADE_DOWN); + WaitForFade(); if (GetFadeStatus() != RDFADE_BLACK) { FadeDown((float) 0.75); - - do { - //-------------------------------------------------- - // Service windows - - // if we pressed Ctrl-Q - if (ServiceWindows() == RDERR_APPCLOSED) { - Close_game(); //close engine systems down - CloseAppWindow(); - exit(0); //quit the game - } - //-------------------------------------------------- - } while (GetFadeStatus() != RDFADE_BLACK); + WaitForFade(); } EraseBackBuffer(); @@ -1083,18 +1056,7 @@ void resMan::CacheNewCluster(uint32 newCluster) { CopyScreenBuffer(); FadeUp((float) 0.75); - do { - //-------------------------------------------------- - // Service windows - - // if we pressed Ctrl-Q - if (ServiceWindows() == RDERR_APPCLOSED) { - Close_game(); //close engine systems down - CloseAppWindow(); - exit(0); //quit the game - } - //-------------------------------------------------- - } while (GetFadeStatus() == RDFADE_UP); + WaitForFade(); fseek(inFile, 0, SEEK_END); uint32 size = ftell(inFile); @@ -1167,22 +1129,9 @@ void resMan::CacheNewCluster(uint32 newCluster) { EraseSoftwareScreenBuffer(); // for software rendering FadeDown((float) 0.75); - - do { - //-------------------------------------------------- - // Service windows - - // if we pressed Ctrl-Q - if (ServiceWindows() == RDERR_APPCLOSED) { - Close_game(); //close engine systems down - CloseAppWindow(); - exit(0); //quit the game - } - //-------------------------------------------------- - } while (GetFadeStatus() == RDFADE_DOWN); - + WaitForFade(); CopyScreenBuffer(); - FadeUp((float)0.75); + FadeUp((float) 0.75); // Git rid of read-only status. SVM_SetFileAttributes(resource_files[newCluster], FILE_ATTRIBUTE_NORMAL); |