diff options
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/draw_v2.cpp | 2 | ||||
-rw-r--r-- | engines/gob/game.cpp | 39 | ||||
-rw-r--r-- | engines/gob/game.h | 10 | ||||
-rw-r--r-- | engines/gob/hotspots.cpp | 5 | ||||
-rw-r--r-- | engines/gob/inter_v2.cpp | 15 | ||||
-rw-r--r-- | engines/gob/inter_v4.cpp | 5 | ||||
-rw-r--r-- | engines/gob/inter_v6.cpp | 5 | ||||
-rw-r--r-- | engines/gob/mult_v2.cpp | 11 | ||||
-rw-r--r-- | engines/gob/save/saveload_playtoons.cpp | 2 | ||||
-rw-r--r-- | engines/gob/util.cpp | 3 |
10 files changed, 51 insertions, 46 deletions
diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index a1074d7ecb..486b12b022 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -46,6 +46,8 @@ Draw_v2::Draw_v2(GobEngine *vm) : Draw_v1(vm) { } void Draw_v2::initScreen() { + _vm->_game->_preventScroll = false; + _scrollOffsetX = 0; _scrollOffsetY = 0; diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 4e2bd223b7..af9f03ecbf 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -181,10 +181,12 @@ Game::Game(GobEngine *vm) : _vm(vm) { _handleMouse = 0; _forceHandleMouse = 0; - _menuLevel = 0; _noScroll = true; _preventScroll = false; - _scrollHandleMouse = false; + + _wantScroll = false; + _wantScrollX = 0; + _wantScrollY = 0; _tempStr[0] = 0; @@ -360,9 +362,7 @@ void Game::playTot(int16 skipPlay) { _vm->_scenery->_pCaptureCounter = oldCaptureCounter; _script->seek(_script->getFunctionOffset(skipPlay + 1)); - _menuLevel++; _vm->_inter->callSub(2); - _menuLevel--; if (_vm->_inter->_terminate != 0) _vm->_inter->_terminate = 2; @@ -439,22 +439,27 @@ void Game::freeSoundSlot(int16 slot) { _vm->_sound->sampleFree(_vm->_sound->sampleGetBySlot(slot)); } -void Game::evaluateScroll(int16 x, int16 y) { - if (_preventScroll || !_scrollHandleMouse || (_menuLevel > 0)) +void Game::wantScroll(int16 x, int16 y) { + _wantScroll = true; + _wantScrollX = x; + _wantScrollY = y; +} + +void Game::evaluateScroll() { + if (_noScroll || _preventScroll || !_wantScroll) return; - if (_noScroll || - ((_vm->_global->_videoMode != 0x14) && (_vm->_global->_videoMode != 0x18))) + if ((_vm->_global->_videoMode != 0x14) && (_vm->_global->_videoMode != 0x18)) return; - if ((x == 0) && (_vm->_draw->_scrollOffsetX > 0)) { + if ((_wantScrollX == 0) && (_vm->_draw->_scrollOffsetX > 0)) { uint16 off; off = MIN(_vm->_draw->_cursorWidth, _vm->_draw->_scrollOffsetX); off = MAX(off / 2, 1); _vm->_draw->_scrollOffsetX -= off; _vm->_video->dirtyRectsAll(); - } else if ((y == 0) && (_vm->_draw->_scrollOffsetY > 0)) { + } else if ((_wantScrollY == 0) && (_vm->_draw->_scrollOffsetY > 0)) { uint16 off; off = MIN(_vm->_draw->_cursorHeight, _vm->_draw->_scrollOffsetY); @@ -463,9 +468,9 @@ void Game::evaluateScroll(int16 x, int16 y) { _vm->_video->dirtyRectsAll(); } - int16 cursorRight = x + _vm->_draw->_cursorWidth; - int16 screenRight = _vm->_draw->_scrollOffsetX + _vm->_width; - int16 cursorBottom = y + _vm->_draw->_cursorHeight; + int16 cursorRight = _wantScrollX + _vm->_draw->_cursorWidth; + int16 screenRight = _vm->_draw->_scrollOffsetX + _vm->_width; + int16 cursorBottom = _wantScrollY + _vm->_draw->_cursorHeight; int16 screenBottom = _vm->_draw->_scrollOffsetY + _vm->_height; if ((cursorRight >= _vm->_width) && @@ -479,7 +484,7 @@ void Game::evaluateScroll(int16 x, int16 y) { _vm->_draw->_scrollOffsetX += off; _vm->_video->dirtyRectsAll(); - _vm->_util->setMousePos(_vm->_width - _vm->_draw->_cursorWidth, y); + _vm->_util->setMousePos(_vm->_width - _vm->_draw->_cursorWidth, _wantScrollY); } else if ((cursorBottom >= (_vm->_height - _vm->_video->_splitHeight2)) && (screenBottom < _vm->_video->_surfHeight)) { uint16 off; @@ -491,11 +496,13 @@ void Game::evaluateScroll(int16 x, int16 y) { _vm->_draw->_scrollOffsetY += off; _vm->_video->dirtyRectsAll(); - _vm->_util->setMousePos(x, _vm->_height - _vm->_video->_splitHeight2 - - _vm->_draw->_cursorHeight); + _vm->_util->setMousePos(_wantScrollX, + _vm->_height - _vm->_video->_splitHeight2 - _vm->_draw->_cursorHeight); } _vm->_util->setScrollOffset(); + + _wantScroll = false; } int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY, diff --git a/engines/gob/game.h b/engines/gob/game.h index d3a758f014..8b8be90ef4 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -82,7 +82,10 @@ public: bool _noScroll; bool _preventScroll; - bool _scrollHandleMouse; + + bool _wantScroll; + int16 _wantScrollX; + int16 _wantScrollY; byte _handleMouse; char _forceHandleMouse; @@ -99,7 +102,8 @@ public: void freeSoundSlot(int16 slot); - void evaluateScroll(int16 x, int16 y); + void wantScroll(int16 x, int16 y); + void evaluateScroll(); int16 checkKeys(int16 *pMousex = 0, int16 *pMouseY = 0, MouseButtons *pButtons = 0, char handleMouse = 0); @@ -109,8 +113,6 @@ public: void switchTotSub(int16 index, int16 skipPlay); protected: - uint32 _menuLevel; - char _tempStr[256]; // Capture diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index b218634d4e..d21eb906ee 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -628,8 +628,6 @@ bool Hotspots::checkHotspotChanged() { } uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index) { - _vm->_game->_scrollHandleMouse = handleMouse != 0; - if (delay >= -1) { _currentKey = 0; _currentId = 0; @@ -679,6 +677,9 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index _vm->_video->waitRetrace(); } + if (handleMouse) + _vm->_game->evaluateScroll(); + // Update keyboard and mouse state key = _vm->_game->checkKeys(&_vm->_global->_inter_mouseX, &_vm->_global->_inter_mouseY, &_vm->_game->_mouseButtons, handleMouse); diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 19cac86465..b4e5bf7623 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -935,6 +935,8 @@ void Inter_v2::o2_setScrollOffset() { offsetY = _vm->_game->_script->readValExpr(); if (offsetX == -1) { + _vm->_game->_preventScroll = !_vm->_game->_preventScroll; + WRITE_VAR(2, _vm->_draw->_scrollOffsetX); WRITE_VAR(3, _vm->_draw->_scrollOffsetY); } else { @@ -996,11 +998,8 @@ void Inter_v2::o2_playImd() { close = false; } - if (startFrame >= 0) { - _vm->_game->_preventScroll = true; + if (startFrame >= 0) _vm->_vidPlayer->primaryPlay(startFrame, lastFrame, breakKey, palCmd, palStart, palEnd, 0); - _vm->_game->_preventScroll = false; - } if (close) _vm->_vidPlayer->primaryClose(); @@ -1306,8 +1305,14 @@ bool Inter_v2::o2_checkData(OpFuncParams ¶ms) { char *file = _vm->_game->_script->getResultStr(); + // WORKAROUND: In some games (at least all the Playtoons), some files are + // read on CD (and only on CD). "@:\" is replaced by the CD drive letter. + // As the files are copied on the HDD, those characters are skipped. + if (strncmp(file, "@:\\", 3) ==0 ) + file += 3; + // WORKAROUND: For some reason, the variable indicating which TOT to load next - // is overwritten in the guard house card game in Woodruff + // is overwritten in the guard house card game in Woodruff. if ((_vm->getGameType() == kGameTypeWoodruff) && !scumm_stricmp(file, "6.TOT")) strcpy(file, "EMAP2011.TOT"); diff --git a/engines/gob/inter_v4.cpp b/engines/gob/inter_v4.cpp index 48378a5987..1f6899d85c 100644 --- a/engines/gob/inter_v4.cpp +++ b/engines/gob/inter_v4.cpp @@ -233,11 +233,8 @@ void Inter_v4::o4_playVmdOrMusic() { return; } - if (startFrame >= 0) { - _vm->_game->_preventScroll = true; + if (startFrame >= 0) _vm->_vidPlayer->primaryPlay(startFrame, lastFrame, breakKey, palCmd, palStart, palEnd, 0); - _vm->_game->_preventScroll = false; - } if (close) _vm->_vidPlayer->primaryClose(); diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index aa4721ff0a..4e2ec69cf2 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -164,12 +164,9 @@ void Inter_v6::o6_playVmdOrMusic() { return; } - if (startFrame >= 0) { - _vm->_game->_preventScroll = true; + if (startFrame >= 0) _vm->_vidPlayer->primaryPlay(startFrame, lastFrame, breakKey, palCmd, palStart, palEnd, 0, -1, false, -1, true); - _vm->_game->_preventScroll = false; - } if (close) _vm->_vidPlayer->primaryClose(); diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp index 135c50c92c..bad4723159 100644 --- a/engines/gob/mult_v2.cpp +++ b/engines/gob/mult_v2.cpp @@ -1105,8 +1105,6 @@ void Mult_v2::playImd(const char *imdFile, Mult::Mult_ImdKey &key, int16 dir, int16 baseFrame, palFrame, lastFrame; uint16 flags; - _vm->_game->_preventScroll = true; - if (_vm->_draw->_renderFlags & 0x100) { x = VAR(55); y = VAR(56); @@ -1115,7 +1113,6 @@ void Mult_v2::playImd(const char *imdFile, Mult::Mult_ImdKey &key, int16 dir, if (key.imdFile == -1) { _vm->_vidPlayer->primaryClose(); - _vm->_game->_preventScroll = false; return; } @@ -1131,15 +1128,12 @@ void Mult_v2::playImd(const char *imdFile, Mult::Mult_ImdKey &key, int16 dir, if ((palFrame != -1) && (lastFrame != -1)) if ((lastFrame - palFrame) < startFrame) if (!(key.flags & 0x4000)) { - _vm->_game->_preventScroll = false; _vm->_vidPlayer->primaryClose(); return; } - if (!_vm->_vidPlayer->primaryOpen(imdFile, x, y, flags)) { - _vm->_game->_preventScroll = false; + if (!_vm->_vidPlayer->primaryOpen(imdFile, x, y, flags)) return; - } if (palFrame == -1) palFrame = 0; @@ -1265,9 +1259,6 @@ void Mult_v2::advanceObjects(int16 index) { } } - if (!hasImds && (_vm->_draw->_showCursor == 3)) - _vm->_game->_preventScroll = false; - doSoundAnim(stop, frame); WRITE_VAR(22, frame); diff --git a/engines/gob/save/saveload_playtoons.cpp b/engines/gob/save/saveload_playtoons.cpp index 97da909e7c..3014e3f2bf 100644 --- a/engines/gob/save/saveload_playtoons.cpp +++ b/engines/gob/save/saveload_playtoons.cpp @@ -47,6 +47,8 @@ SaveLoad_Playtoons::SaveFile SaveLoad_Playtoons::_saveFiles[] = { { "titre.007", kSaveModeExists, 0, 0}, // Playtoons CK 2 empty title (???) { "titre.008", kSaveModeExists, 0, 0}, // Playtoons CK 3 empty title (???) { "mdo.def", kSaveModeExists, 0, 0}, + { "dan.itk", kSaveModeNone, 0, 0}, + { "did.inf", kSaveModeSave, 0, 0}, }; SaveLoad::SaveMode SaveLoad_Playtoons::getSaveMode(const char *fileName) const { diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index 1a8668b1c2..d51cbad6b3 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -141,7 +141,8 @@ void Util::processInput(bool scroll) { y -= _vm->_video->_screenDeltaY; _vm->_util->setMousePos(x, y); - _vm->_game->evaluateScroll(x, y); + + _vm->_game->wantScroll(x, y); } } |