aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/inter.h3
-rw-r--r--engines/gob/inter_geisha.cpp57
2 files changed, 60 insertions, 0 deletions
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index 764c7bf246..c84cc384ce 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -345,6 +345,7 @@ protected:
virtual void setupOpcodesGob();
void oGeisha_loadCursor(OpFuncParams &params);
+ void oGeisha_loadTot(OpFuncParams &params);
void oGeisha_goblinFunc(OpFuncParams &params);
void oGeisha_loadSound(OpFuncParams &params);
void oGeisha_checkData(OpFuncParams &params);
@@ -361,6 +362,8 @@ protected:
void oGeisha_caress2(OpGobParams &params);
int16 loadSound(int16 slot);
+
+ bool keyPressed();
};
class Inter_v2 : public Inter_v1 {
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);
}