aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/text.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2009-05-19 21:09:43 +0000
committerEugene Sandulenko2009-05-19 21:09:43 +0000
commit40dd214789ec627624a7703798907b7afbf50b8e (patch)
tree1c65aababcb8bb0c811c649e1a037c8f788624cb /engines/agi/text.cpp
parenta1364e37f7182d3a88aea659e07fc9e9f196719b (diff)
downloadscummvm-rg350-40dd214789ec627624a7703798907b7afbf50b8e.tar.gz
scummvm-rg350-40dd214789ec627624a7703798907b7afbf50b8e.tar.bz2
scummvm-rg350-40dd214789ec627624a7703798907b7afbf50b8e.zip
Start of fixing bug #2537054: "AGI: Using GMM to load causes graphics glitches"
The engine still crashes when load from GMM occured with a text box on screen. svn-id: r40733
Diffstat (limited to 'engines/agi/text.cpp')
-rw-r--r--engines/agi/text.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index bf16f926b2..189a48c804 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -299,6 +299,11 @@ 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();
@@ -307,6 +312,18 @@ 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.
@@ -466,6 +483,9 @@ int AgiEngine::print(const char *p, int lin, int col, int len) {
setvar(vKey, 0);
do {
+ if (getflag(fRestoreJustRan))
+ break;
+
mainCycle();
if (_game.keypress == KEY_ENTER) {
debugC(4, kDebugLevelText, "KEY_ENTER");