aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/agi.h4
-rw-r--r--engines/agi/detection.cpp4
-rw-r--r--engines/agi/saveload.cpp4
-rw-r--r--engines/agi/text.cpp27
4 files changed, 19 insertions, 20 deletions
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 4f57f6c9fb..e4461904ed 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -331,7 +331,8 @@ enum {
fStatusSelectsItems,
fMenusWork,
fOutputMode, /* 15 */
- fAutoRestart
+ fAutoRestart,
+ fNoSaveLoadAllowed
};
struct AgiEvent {
@@ -968,7 +969,6 @@ public:
int messageBox(const char *);
int selectionBox(const char *, const char **);
void closeWindow(void);
- void forgetWindow(void);
void drawWindow(int, int, int, int);
void printText(const char *, int, int, int, int, int, int, bool checkerboard = false);
void printTextConsole(const char *, int, int, int, int, int);
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index afd5c13ec1..b99c24043a 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -1174,11 +1174,11 @@ Common::Error AgiBase::saveGameState(int slot, const char *desc) {
}
bool AgiBase::canLoadGameStateCurrently() {
- return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork));
+ return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork) && !getflag(fNoSaveLoadAllowed));
}
bool AgiBase::canSaveGameStateCurrently() {
- return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork));
+ return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork) && !getflag(fNoSaveLoadAllowed));
}
} // End of namespace Agi
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index bd0a0a5112..2130473810 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -552,6 +552,8 @@ int AgiEngine::selectSlot() {
int textCentre, buttonLength, buttonX[2], buttonY;
const char *buttonText[] = { " OK ", "Cancel", NULL };
+ setflag(fNoSaveLoadAllowed, true);
+
for (i = 0; i < NUM_VISIBLE_SLOTS; i++) {
getSavegameDescription(_firstSlot + i, desc[i]);
}
@@ -735,6 +737,8 @@ press:
getout:
closeWindow();
+ setflag(fNoSaveLoadAllowed, false);
+
return rc;
}
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index 189a48c804..da7f34fc19 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -300,10 +300,6 @@ char *AgiEngine::wordWrapString(const char *s, int *len) {
void AgiEngine::closeWindow() {
debugC(4, kDebugLevelText, "closeWindow()");
- if (getflag(fRestoreJustRan)) {
- forgetWindow();
- }
-
_sprites->eraseBoth();
eraseTextbox(); /* remove window, if any */
_sprites->blitBoth();
@@ -312,18 +308,6 @@ void AgiEngine::closeWindow() {
}
/**
- * Remove existing window without restoring anything
- */
-void AgiEngine::forgetWindow() {
- debugC(4, kDebugLevelText, "forgetWindow()");
-
- free(_game.window.buffer);
- _game.window.buffer = 0;
- _game.window.active = false;
- _game.hasWindow = false;
-}
-
-/**
* Display a message box.
* This function displays the specified message in a text box
* centered in the screen and waits until a key is pressed.
@@ -356,6 +340,8 @@ int AgiEngine::selectionBox(const char *m, const char **b) {
int rc = -1;
int bx[5], by[5];
+ setflag(fNoSaveLoadAllowed, true);
+
_sprites->eraseBoth();
blitTextbox(m, -1, -1, -1);
@@ -440,6 +426,8 @@ getout:
closeWindow();
debugC(2, kDebugLevelText, "selectionBox(): Result = %d", rc);
+ setflag(fNoSaveLoadAllowed, false);
+
return rc;
}
@@ -468,11 +456,16 @@ int AgiEngine::print(const char *p, int lin, int col, int len) {
/* blocking */
+ setflag(fNoSaveLoadAllowed, true);
+
if (_game.vars[vWindowReset] == 0) {
int k;
setvar(vKey, 0);
k = waitKey();
closeWindow();
+
+ setflag(fNoSaveLoadAllowed, false);
+
return k;
}
@@ -499,6 +492,8 @@ int AgiEngine::print(const char *p, int lin, int col, int len) {
closeWindow();
+ setflag(fNoSaveLoadAllowed, false);
+
return 0;
}