aboutsummaryrefslogtreecommitdiff
path: root/sword2/resman.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2003-09-09 12:14:08 +0000
committerTorbjörn Andersson2003-09-09 12:14:08 +0000
commitbb5f479a8c11d1189b004f20009508777060e56f (patch)
treec6946ec295a5803c621cf8e162bf9943e9e654fc /sword2/resman.cpp
parent29607a17efcfcd88c76b69c0295e10dc152b0ee1 (diff)
downloadscummvm-rg350-bb5f479a8c11d1189b004f20009508777060e56f.tar.gz
scummvm-rg350-bb5f479a8c11d1189b004f20009508777060e56f.tar.bz2
scummvm-rg350-bb5f479a8c11d1189b004f20009508777060e56f.zip
Added a WaitForFade() function, to replace numerous while-loops scattered
througout the code. svn-id: r10127
Diffstat (limited to 'sword2/resman.cpp')
-rw-r--r--sword2/resman.cpp61
1 files changed, 5 insertions, 56 deletions
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);