aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/inter_geisha.cpp
diff options
context:
space:
mode:
authorSven Hesse2011-08-29 14:09:00 +0200
committerSven Hesse2011-08-29 14:10:10 +0200
commitb516e4f440fa853f129c2802733deebfd22566d1 (patch)
tree17b8ed6d8bd3f92c40b25da87b7ff56cc3371220 /engines/gob/inter_geisha.cpp
parenta28bffec1cf37517f3dd9d7fda7ad511c921a7db (diff)
downloadscummvm-rg350-b516e4f440fa853f129c2802733deebfd22566d1.tar.gz
scummvm-rg350-b516e4f440fa853f129c2802733deebfd22566d1.tar.bz2
scummvm-rg350-b516e4f440fa853f129c2802733deebfd22566d1.zip
GOB: Add a workaround for some of Geisha's textboxes
Geisha often displays text while it loads a new TOT. Back in the days, this took long enough so that the text could be read. Since this isn't the case anymore, we'll wait for the user to press a key or click the mouse.
Diffstat (limited to 'engines/gob/inter_geisha.cpp')
-rw-r--r--engines/gob/inter_geisha.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/engines/gob/inter_geisha.cpp b/engines/gob/inter_geisha.cpp
index e547285f86..6c3e97c2a7 100644
--- a/engines/gob/inter_geisha.cpp
+++ b/engines/gob/inter_geisha.cpp
@@ -56,6 +56,7 @@ void Inter_Geisha::setupOpcodesFunc() {
Inter_v1::setupOpcodesFunc();
OPCODEFUNC(0x03, oGeisha_loadCursor);
+ OPCODEFUNC(0x12, oGeisha_loadTot);
OPCODEFUNC(0x25, oGeisha_goblinFunc);
OPCODEFUNC(0x3A, oGeisha_loadSound);
OPCODEFUNC(0x3F, oGeisha_checkData);
@@ -81,6 +82,62 @@ void Inter_Geisha::oGeisha_loadCursor(OpFuncParams &params) {
o1_loadCursor(params);
}
+bool Inter_Geisha::keyPressed() {
+ int16 key = _vm->_util->checkKey();
+ if (key)
+ return true;
+
+ int16 x, y;
+ MouseButtons buttons;
+
+ _vm->_util->getMouseState(&x, &y, &buttons);
+ return buttons != kMouseButtonsNone;
+}
+
+struct TOTTransition {
+ const char *to;
+ const char *from;
+ int32 offset;
+};
+
+static const TOTTransition kTOTTransitions[] = {
+ {"chambre.tot", "photo.tot" , 1801},
+ {"mo.tot" , "chambre.tot", 13580},
+ {"chambre.tot", "mo.tot" , 564},
+ {"hard.tot" , "chambre.tot", 13917},
+ {"carte.tot" , "hard.tot" , 17926},
+ {"chambre.tot", "carte.tot" , 14609},
+ {"chambre.tot", "mo.tot" , 3658},
+ {"streap.tot" , "chambre.tot", 14652},
+ {"bonsai.tot" , "porte.tot" , 2858},
+ {"lit.tot" , "napa.tot" , 3380},
+ {"oko.tot" , "chambre.tot", 14146},
+ {"chambre.tot", "oko.tot" , 2334}
+};
+
+void Inter_Geisha::oGeisha_loadTot(OpFuncParams &params) {
+ o1_loadTot(params);
+
+ // WORKAROUND: Geisha often displays text while it loads a new TOT.
+ // Back in the days, this took long enough so that the text
+ // could be read. Since this isn't the case anymore, we'll
+ // wait for the user to press a key or click the mouse.
+ bool needWait = false;
+
+ for (int i = 0; i < ARRAYSIZE(kTOTTransitions); i++)
+ if ((_vm->_game->_script->pos() == kTOTTransitions[i].offset) &&
+ (_vm->_game->_totToLoad == kTOTTransitions[i].to) &&
+ (_vm->_game->_curTotFile == kTOTTransitions[i].from)) {
+
+ needWait = true;
+ break;
+ }
+
+ if (needWait)
+ while (!keyPressed())
+ _vm->_util->longDelay(1);
+}
+
void Inter_Geisha::oGeisha_loadSound(OpFuncParams &params) {
loadSound(-1);
}