diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/advancedDetector.cpp | 13 | ||||
-rw-r--r-- | engines/cine/script_fw.cpp | 32 | ||||
-rw-r--r-- | engines/kyra/screen_lol.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/screen_lol.h | 1 | ||||
-rw-r--r-- | engines/kyra/staticres.cpp | 36 | ||||
-rw-r--r-- | engines/scumm/detection.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/he/intern_he.h | 3 | ||||
-rw-r--r-- | engines/scumm/input.cpp | 272 | ||||
-rw-r--r-- | engines/scumm/script_v5.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 5 | ||||
-rw-r--r-- | engines/sword1/sound.cpp | 4 | ||||
-rw-r--r-- | engines/tucker/locations.cpp | 32 | ||||
-rw-r--r-- | engines/tucker/resource.cpp | 2 | ||||
-rw-r--r-- | engines/tucker/sequences.cpp | 17 | ||||
-rw-r--r-- | engines/tucker/tucker.cpp | 117 | ||||
-rw-r--r-- | engines/tucker/tucker.h | 4 |
17 files changed, 303 insertions, 247 deletions
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp index c127faec28..7d86f3ef32 100644 --- a/engines/advancedDetector.cpp +++ b/engines/advancedDetector.cpp @@ -291,15 +291,18 @@ Common::Error AdvancedMetaEngine::createInstance(OSystem *syst, Engine **engine) } } - if (agdDesc == 0) { + if (agdDesc == 0) return Common::kNoGameDataFoundError; - } + + // If the GUI options were updated, we catch this here and update them in the users config + // file transparently. + Common::updateGameGUIOptions(agdDesc->guioptions | params.guioptions); debug(2, "Running %s", toGameDescriptor(*agdDesc, params.list).description().c_str()); - if (!createInstance(syst, engine, agdDesc)) { + if (!createInstance(syst, engine, agdDesc)) return Common::kNoGameDataFoundError; - } - return Common::kNoError; + else + return Common::kNoError; } struct SizeMD5 { diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp index 0c92beb650..a9824674e6 100644 --- a/engines/cine/script_fw.cpp +++ b/engines/cine/script_fw.cpp @@ -1443,6 +1443,38 @@ int FWScript::o1_palRotate() { int FWScript::o1_break() { debugC(5, kCineDebugScript, "Line: %d: break", _line); + // WORKAROUND for bug #2669415 ("FW: half walking speed in a screen"). + // The problem was that in Amiga/Atari ST versions of Future Wars the + // walking speed has halved in a forest scene where a monk's robe hangs + // on a tree branch (Up and to the left from the medieval castle's front). + // + // Initialization script for the scene is PART02.PRC's 26th script (011_INIT) + // and the background used in the scene is L11.PI1. The difference between + // the PC version and the Amiga/Atari ST version of the script is that the + // PC version calls scripts 37 and 36 for handling movement of the character + // when Amiga/Atari ST version calls scripts 22 and 21 for the same purpose + // (Scripts 37 and 22 handle vertical movement, 36 and 21 the horizontal). + // + // The called scripts only differ functionally so that all BREAK opcodes have been + // doubled in the Amiga/Atari ST versions (i.e. one BREAK has become two BREAKs) + // and in script 21 after LABEL_25 there's an extra opcode that isn't in script 36: + // SET globalvars[251], 0. + // + // As a BREAK opcode stops the execution of a script it causes a pause and + // with the BREAKs doubled the pause is twice as long in the Amiga/Atari ST versions. + // Thus the longer pause is eliminated by running only one BREAK when several + // are designated (i.e. ignoring a BREAK if there's another BREAK after it). + // + // TODO: Check whether the speed is halved in any other scenes in Amiga/Atari ST versions under ScummVM + // TODO: Check whether the speed is halved when running the original executable under an emulator + if (g_cine->getGameType() == Cine::GType_FW && + (g_cine->getPlatform() == Common::kPlatformAmiga || g_cine->getPlatform() == Common::kPlatformAtariST) && + _pos < _script._size && _script.getByte(_pos) == (0x4F + 1) && // Is the next opcode a BREAK too? + scumm_stricmp(currentPrcName, "PART02.PRC") == 0 && + scumm_stricmp(renderer->getBgName(), "L11.PI1") == 0) { + return 0; + } + return 1; } diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index 46b243a4cf..ce8a1bdaa4 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -912,7 +912,7 @@ void Screen_LoL::mergeOverlay(int x, int y, int w, int h) { void Screen_LoL::convertPC98Gfx(uint8 *data, int w, int h, int pitch) { while (h--) { for (int i = 0; i < w; ++i) { - *data = _paletteConvTable[*data]; + *data = (*data >> 4) & (*data & 0x0F); ++data; } @@ -927,7 +927,7 @@ void Screen_LoL::postProcessCursor(uint8 *data, int w, int h, int pitch) { while (h--) { for (int i = 0; i < w; ++i) { if (*data != _cursorColorKey) - *data = _paletteConvTable[*data]; + *data = (*data >> 4) & (*data & 0x0F); ++data; } diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index f9cd7133de..4980a89694 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -109,7 +109,6 @@ private: uint8 *_levelOverlays[8]; - static const uint8 _paletteConvTable[256]; void mergeOverlay(int x, int y, int w, int h); void postProcessCursor(uint8 *data, int width, int height, int pitch); }; diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp index e8597c8326..86680a7b76 100644 --- a/engines/kyra/staticres.cpp +++ b/engines/kyra/staticres.cpp @@ -3159,42 +3159,6 @@ const ScreenDim Screen_LoL::_screenDimTable16C[] = { const int Screen_LoL::_screenDimTableCount = ARRAYSIZE(Screen_LoL::_screenDimTable256C); -// 256 -> 16 color conversion table -const uint8 Screen_LoL::_paletteConvTable[256] = { - 0x0, 0x1, 0x0, 0x3, 0x0, 0x5, 0x0, 0x7, - 0x0, 0x9, 0x0, 0xB, 0x0, 0xD, 0x0, 0xF, - 0x1, 0x1, 0x1, 0x3, 0x1, 0x5, 0x1, 0x7, - 0x1, 0x9, 0x1, 0xB, 0x1, 0xD, 0x1, 0xF, - 0x2, 0x1, 0x2, 0x3, 0x2, 0x5, 0x2, 0x7, - 0x2, 0x9, 0x2, 0xB, 0x2, 0xD, 0x2, 0xF, - 0x3, 0x1, 0x3, 0x3, 0x3, 0x5, 0x3, 0x7, - 0x3, 0x9, 0x3, 0xB, 0x3, 0xD, 0x3, 0xF, - 0x4, 0x1, 0x4, 0x3, 0x4, 0x5, 0x4, 0x7, - 0x4, 0x9, 0x4, 0xB, 0x4, 0xD, 0x4, 0xF, - 0x5, 0x1, 0x5, 0x3, 0x5, 0x5, 0x5, 0x7, - 0x5, 0x9, 0x5, 0xB, 0x5, 0xD, 0x5, 0xF, - 0x6, 0x1, 0x6, 0x3, 0x6, 0x5, 0x6, 0x7, - 0x6, 0x9, 0x6, 0xB, 0x6, 0xD, 0x6, 0xF, - 0x7, 0x1, 0x7, 0x3, 0x7, 0x5, 0x7, 0x7, - 0x7, 0x9, 0x7, 0xB, 0x7, 0xD, 0x7, 0xF, - 0x8, 0x1, 0x8, 0x3, 0x8, 0x5, 0x8, 0x7, - 0x8, 0x9, 0x8, 0xB, 0x8, 0xD, 0x8, 0xF, - 0x9, 0x1, 0x9, 0x3, 0x9, 0x5, 0x9, 0x7, - 0x9, 0x9, 0x9, 0xB, 0x9, 0xD, 0x9, 0xF, - 0xA, 0x1, 0xA, 0x3, 0xA, 0x5, 0xA, 0x7, - 0xA, 0x9, 0xA, 0xB, 0xA, 0xD, 0xA, 0xF, - 0xB, 0x1, 0xB, 0x3, 0xB, 0x5, 0xB, 0x7, - 0xB, 0x9, 0xB, 0xB, 0xB, 0xD, 0xB, 0xF, - 0xC, 0x1, 0xC, 0x3, 0xC, 0x5, 0xC, 0x7, - 0xC, 0x9, 0xC, 0xB, 0xC, 0xD, 0xC, 0xF, - 0xD, 0x1, 0xD, 0x3, 0xD, 0x5, 0xD, 0x7, - 0xD, 0x9, 0xD, 0xB, 0xD, 0xD, 0xD, 0xF, - 0xE, 0x1, 0xE, 0x3, 0xE, 0x5, 0xE, 0x7, - 0xE, 0x9, 0xE, 0xB, 0xE, 0xD, 0xE, 0xF, - 0xF, 0x1, 0xF, 0x3, 0xF, 0x5, 0xF, 0x7, - 0xF, 0x9, 0xF, 0xB, 0xF, 0xD, 0xF, 0xF -}; - const char * const LoLEngine::_languageExt[] = { "ENG", "FRE", diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index cf88ded3b8..5fa74d22c3 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -882,6 +882,10 @@ Common::Error ScummMetaEngine::createInstance(OSystem *syst, Engine **engine) co if (res.game.platform == Common::kPlatformFMTowns && res.game.version == 3) res.game.midi = MDT_TOWNS; + // If the GUI options were updated, we catch this here and update them in the users config + // file transparently. + Common::updateGameGUIOptions(res.game.guioptions); + // Finally, we have massaged the GameDescriptor to our satisfaction, and can // instantiate the appropriate game engine. Hooray! switch (res.game.version) { diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h index 949113aeeb..8aa8a8d3f5 100644 --- a/engines/scumm/he/intern_he.h +++ b/engines/scumm/he/intern_he.h @@ -359,6 +359,8 @@ protected: virtual void setupScummVars(); virtual void resetScummVars(); + virtual void parseEvent(Common::Event event); + virtual void initCharset(int charset); virtual void clearDrawQueues(); @@ -386,6 +388,7 @@ protected: byte VAR_PLATFORM; byte VAR_PLATFORM_VERSION; byte VAR_CURRENT_CHARSET; + byte VAR_KEY_STATE; byte VAR_COLOR_DEPTH; }; diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index f378f2225e..42b48a3f3d 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -55,145 +55,173 @@ enum MouseButtonStatus { msClicked = 2 }; -void ScummEngine::parseEvents() { - Common::Event event; - - while (_eventMan->pollEvent(event)) { - - switch (event.type) { - case Common::EVENT_KEYDOWN: - if (event.kbd.keycode >= '0' && event.kbd.keycode <= '9' - && (event.kbd.flags == Common::KBD_ALT || - event.kbd.flags == Common::KBD_CTRL)) { - _saveLoadSlot = event.kbd.keycode - '0'; - - // don't overwrite autosave (slot 0) - if (_saveLoadSlot == 0) - _saveLoadSlot = 10; - - sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot); - _saveLoadFlag = (event.kbd.flags == Common::KBD_ALT) ? 1 : 2; - _saveTemporaryState = false; - } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'f') { - _fastMode ^= 1; - } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'g') { - _fastMode ^= 2; - } else if ((event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'd') || - event.kbd.ascii == '~' || event.kbd.ascii == '#') { - _debugger->attach(); - } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 's') { - _res->resourceStats(); - } else { - // Normal key press, pass on to the game. - _keyPressed = event.kbd; - } +#ifdef ENABLE_HE +void ScummEngine_v80he::parseEvent(Common::Event event) { + ScummEngine::parseEvent(event); - if (_game.heversion >= 80) { - // FIXME: Move this code & VAR_KEY_STATE to class ScummEngine_v80he + // Keyboard is controlled via variable + switch (event.type) { + case Common::EVENT_KEYDOWN: + if (event.kbd.keycode == Common::KEYCODE_LEFT) + VAR(VAR_KEY_STATE) |= 1; - // Keyboard is controlled via variable - int keyState = 0; + if (event.kbd.keycode == Common::KEYCODE_RIGHT) + VAR(VAR_KEY_STATE) |= 2; - if (event.kbd.keycode == Common::KEYCODE_LEFT) // Left - keyState = 1; + if (event.kbd.keycode == Common::KEYCODE_UP) + VAR(VAR_KEY_STATE) |= 4; - if (event.kbd.keycode == Common::KEYCODE_RIGHT) // Right - keyState |= 2; + if (event.kbd.keycode == Common::KEYCODE_DOWN) + VAR(VAR_KEY_STATE) |= 8; - if (event.kbd.keycode == Common::KEYCODE_UP) // Up - keyState |= 4; + if (event.kbd.keycode == Common::KEYCODE_LSHIFT || event.kbd.keycode == Common::KEYCODE_RSHIFT) + VAR(VAR_KEY_STATE) |= 16; - if (event.kbd.keycode == Common::KEYCODE_DOWN) // Down - keyState |= 8; + if (event.kbd.keycode == Common::KEYCODE_LCTRL || event.kbd.keycode == Common::KEYCODE_RCTRL) + VAR(VAR_KEY_STATE) |= 32; + break; - if (event.kbd.flags == Common::KBD_SHIFT) - keyState |= 16; + case Common::EVENT_KEYUP: + if (event.kbd.keycode == Common::KEYCODE_LEFT) + VAR(VAR_KEY_STATE) &= ~1; - if (event.kbd.flags == Common::KBD_CTRL) - keyState |= 32; + if (event.kbd.keycode == Common::KEYCODE_RIGHT) + VAR(VAR_KEY_STATE) &= ~2; - VAR(VAR_KEY_STATE) = keyState; - } + if (event.kbd.keycode == Common::KEYCODE_UP) + VAR(VAR_KEY_STATE) &= ~4; - // FIXME: We are using ASCII values to index the _keyDownMap here, - // yet later one code which checks _keyDownMap will use KEYCODEs - // to do so. That is, we are mixing ascii and keycode values here, - // which is bad. We probably should be only using keycodes, but at - // least INSANE checks for "Shift-V" by looking for the 'V' key - // being pressed. It would be easy to solve that by also storing - // the modifier flags. However, since getKeyState() is also called - // by scripts, we have to be careful with semantic changes. - if (_keyPressed.ascii >= 512) - debugC(DEBUG_GENERAL, "_keyPressed > 512 (%d)", _keyPressed.ascii); - else - _keyDownMap[_keyPressed.ascii] = true; - break; + if (event.kbd.keycode == Common::KEYCODE_DOWN) + VAR(VAR_KEY_STATE) &= ~8; - case Common::EVENT_KEYUP: - if (event.kbd.ascii >= 512) { - debugC(DEBUG_GENERAL, "keyPressed > 512 (%d)", event.kbd.ascii); - } else { - _keyDownMap[event.kbd.ascii] = false; - - // Due to some weird bug with capslock key pressed - // generated keydown event is for lower letter but - // keyup is for upper letter - // On most (all?) keyboards it is safe to assume that - // both upper and lower letters are unpressed on keyup event - // - // Fixes bug #1709430: "FT: CAPSLOCK + V enables cheating for all fights" - // - // Fingolfin remarks: This wouldn't be a problem if we used keycodes. - _keyDownMap[toupper(event.kbd.ascii)] = false; - } - break; + if (event.kbd.keycode == Common::KEYCODE_LSHIFT || event.kbd.keycode == Common::KEYCODE_RSHIFT) + VAR(VAR_KEY_STATE) &= ~16; + if (event.kbd.keycode == Common::KEYCODE_LCTRL || event.kbd.keycode == Common::KEYCODE_RCTRL) + VAR(VAR_KEY_STATE) &= ~32; + break; - // We update the mouse position whenever the mouse moves or a click occurs. - // The latter is done to accomodate systems with a touchpad / pen controller. - case Common::EVENT_LBUTTONDOWN: - case Common::EVENT_RBUTTONDOWN: - case Common::EVENT_MOUSEMOVE: - if (event.type == Common::EVENT_LBUTTONDOWN) - _leftBtnPressed |= msClicked|msDown; - else if (event.type == Common::EVENT_RBUTTONDOWN) - _rightBtnPressed |= msClicked|msDown; - _mouse.x = event.mouse.x; - _mouse.y = event.mouse.y; - - if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) { - _mouse.x -= (Common::kHercW - _screenWidth * 2) / 2; - _mouse.x >>= 1; - _mouse.y = _mouse.y * 4 / 7; - } else if (_useCJKMode && _textSurfaceMultiplier == 2) { - _mouse.x >>= 1; - _mouse.y >>= 1; - } - break; - case Common::EVENT_LBUTTONUP: - _leftBtnPressed &= ~msDown; - break; + default: + break; + } +} +#endif - case Common::EVENT_RBUTTONUP: - _rightBtnPressed &= ~msDown; - break; +void ScummEngine::parseEvent(Common::Event event) { + switch (event.type) { + case Common::EVENT_KEYDOWN: + if (event.kbd.keycode >= '0' && event.kbd.keycode <= '9' + && (event.kbd.flags == Common::KBD_ALT || + event.kbd.flags == Common::KBD_CTRL)) { + _saveLoadSlot = event.kbd.keycode - '0'; + + // don't overwrite autosave (slot 0) + if (_saveLoadSlot == 0) + _saveLoadSlot = 10; + + sprintf(_saveLoadName, "Quicksave %d", _saveLoadSlot); + _saveLoadFlag = (event.kbd.flags == Common::KBD_ALT) ? 1 : 2; + _saveTemporaryState = false; + } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'f') { + _fastMode ^= 1; + } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'g') { + _fastMode ^= 2; + } else if ((event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'd') || + event.kbd.ascii == '~' || event.kbd.ascii == '#') { + _debugger->attach(); + } else if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 's') { + _res->resourceStats(); + } else { + // Normal key press, pass on to the game. + _keyPressed = event.kbd; + } - // The following two cases enable dialog choices to be scrolled - // through in the SegaCD version of MI. Values are taken from script-14. - // See bug report #1193185 for details. - case Common::EVENT_WHEELDOWN: - if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD) - _keyPressed = Common::KeyState(Common::KEYCODE_7, 55); // '7' - break; + // FIXME: We are using ASCII values to index the _keyDownMap here, + // yet later one code which checks _keyDownMap will use KEYCODEs + // to do so. That is, we are mixing ascii and keycode values here, + // which is bad. We probably should be only using keycodes, but at + // least INSANE checks for "Shift-V" by looking for the 'V' key + // being pressed. It would be easy to solve that by also storing + // the modifier flags. However, since getKeyState() is also called + // by scripts, we have to be careful with semantic changes. + if (_keyPressed.ascii >= 512) + debugC(DEBUG_GENERAL, "_keyPressed > 512 (%d)", _keyPressed.ascii); + else + _keyDownMap[_keyPressed.ascii] = true; + break; + + case Common::EVENT_KEYUP: + if (event.kbd.ascii >= 512) { + debugC(DEBUG_GENERAL, "keyPressed > 512 (%d)", event.kbd.ascii); + } else { + _keyDownMap[event.kbd.ascii] = false; + + // Due to some weird bug with capslock key pressed + // generated keydown event is for lower letter but + // keyup is for upper letter + // On most (all?) keyboards it is safe to assume that + // both upper and lower letters are unpressed on keyup event + // + // Fixes bug #1709430: "FT: CAPSLOCK + V enables cheating for all fights" + // + // Fingolfin remarks: This wouldn't be a problem if we used keycodes. + _keyDownMap[toupper(event.kbd.ascii)] = false; + } + break; + + + // We update the mouse position whenever the mouse moves or a click occurs. + // The latter is done to accomodate systems with a touchpad / pen controller. + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_RBUTTONDOWN: + case Common::EVENT_MOUSEMOVE: + if (event.type == Common::EVENT_LBUTTONDOWN) + _leftBtnPressed |= msClicked|msDown; + else if (event.type == Common::EVENT_RBUTTONDOWN) + _rightBtnPressed |= msClicked|msDown; + _mouse.x = event.mouse.x; + _mouse.y = event.mouse.y; + + if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) { + _mouse.x -= (Common::kHercW - _screenWidth * 2) / 2; + _mouse.x >>= 1; + _mouse.y = _mouse.y * 4 / 7; + } else if (_useCJKMode && _textSurfaceMultiplier == 2) { + _mouse.x >>= 1; + _mouse.y >>= 1; + } + break; + case Common::EVENT_LBUTTONUP: + _leftBtnPressed &= ~msDown; + break; + + case Common::EVENT_RBUTTONUP: + _rightBtnPressed &= ~msDown; + break; + + // The following two cases enable dialog choices to be scrolled + // through in the SegaCD version of MI. Values are taken from script-14. + // See bug report #1193185 for details. + case Common::EVENT_WHEELDOWN: + if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD) + _keyPressed = Common::KeyState(Common::KEYCODE_7, 55); // '7' + break; + + case Common::EVENT_WHEELUP: + if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD) + _keyPressed = Common::KeyState(Common::KEYCODE_6, 54); // '6' + break; + + default: + break; + } +} - case Common::EVENT_WHEELUP: - if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD) - _keyPressed = Common::KeyState(Common::KEYCODE_6, 54); // '6' - break; +void ScummEngine::parseEvents() { + Common::Event event; - default: - break; - } + while (_eventMan->pollEvent(event)) { + parseEvent(event); } } diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index 00d01143d6..1ce38fd800 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -1750,7 +1750,7 @@ void ScummEngine_v5::o5_roomOps() { while ((chr = fetchScriptByte())) filename += chr; - if (filename.hasPrefix("iq-") || filename.hasPrefix("IQ-") || filename.hasSuffix("-iq")) { + if (filename.hasPrefix("iq-") || filename.hasPrefix("IQ-") || filename.hasSuffix("-iq") || filename.hasSuffix("-IQ")) { filename = _targetName + ".iq"; } else { error("SO_SAVE_STRING: Unsupported filename %s", filename.c_str()); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 57283c1fbe..8d078f12d4 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -445,7 +445,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) VAR_SCRIPT_CYCLE = 0xFF; VAR_NUM_GLOBAL_OBJS = 0xFF; - VAR_KEY_STATE = 0xFF; // Use g_scumm from error() ONLY g_scumm = this; @@ -789,6 +788,7 @@ ScummEngine_v80he::ScummEngine_v80he(OSystem *syst, const DetectorResult &dr) VAR_PLATFORM = 0xFF; VAR_PLATFORM_VERSION = 0xFF; VAR_CURRENT_CHARSET = 0xFF; + VAR_KEY_STATE = 0xFF; VAR_COLOR_DEPTH = 0xFF; } diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index badbb8ba9d..6491f8a171 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -28,6 +28,7 @@ #include "engines/engine.h" #include "common/endian.h" +#include "common/events.h" #include "common/file.h" #include "common/savefile.h" #include "common/keyboard.h" @@ -498,6 +499,8 @@ protected: public: void parseEvents(); // Used by IMuseDigital::startSound protected: + virtual void parseEvent(Common::Event event); + void waitForTimer(int msec_delay); virtual void processInput(); virtual void processKeyboard(Common::KeyState lastKeyHit); @@ -1379,8 +1382,6 @@ public: byte VAR_SCRIPT_CYCLE; // Used in runScript()/runObjectScript() byte VAR_NUM_SCRIPT_CYCLES; // Used in runAllScripts() - byte VAR_KEY_STATE; // Used in parseEvents() - // Exists both in V7 and in V72HE: byte VAR_NUM_GLOBAL_OBJS; }; diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp index 3e920c5018..b3fa1aa0fd 100644 --- a/engines/sword1/sound.cpp +++ b/engines/sword1/sound.cpp @@ -127,9 +127,9 @@ void Sound::checkSpeechFileEndianness() { size /= 2; int16 prev_be_value = (int16)SWAP_BYTES_16(*((uint16*)(data))); for (uint32 i = 1 ; i < size ; ++i) { - le_diff_sum += fabs(data[i] - data[i-1]); + le_diff_sum += fabs((double)(data[i] - data[i-1])); int16 be_value = (int16)SWAP_BYTES_16(*((uint16*)(data + i))); - be_diff_sum += fabs(be_value - prev_be_value); + be_diff_sum += fabs((double)(be_value - prev_be_value)); prev_be_value = be_value; } delete [] data; diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp index 9faa2024a6..4117391cdf 100644 --- a/engines/tucker/locations.cpp +++ b/engines/tucker/locations.cpp @@ -195,8 +195,8 @@ void TuckerEngine::execData3PreUpdate_locationNum2() { for (int j = 0; j < 2; ++j) { const int offset = (_updateLocationYPosTable2[i] + j) * 640 + _updateLocationXPosTable2[i]; _locationBackgroundGfxBuf[offset] = 142 + j * 2; - addDirtyRect(offset % 640, offset / 640, 1, 1); } + addDirtyRect(_updateLocationXPosTable2[i], _updateLocationYPosTable2[i], 1, 2); _updateLocationYPosTable2[i] += 2; if (_updateLocationYPosTable2[i] > _updateLocationYMaxTable[i]) { _updateLocationYPosTable2[i] = 0; @@ -540,13 +540,14 @@ void TuckerEngine::execData3PreUpdate_locationNum6Helper1() { x2 = 15 - _flagsTable[27]; } for (int i = 0; i < x1; ++i) { - execData3PreUpdate_locationNum6Helper2(13125 + i * 8, _data3GfxBuf + _dataTable[238].sourceOffset); - execData3PreUpdate_locationNum6Helper2(13245 - i * 8, _data3GfxBuf + _dataTable[238].sourceOffset); + execData3PreUpdate_locationNum6Helper2(20 * 640 + 325 + i * 8, _data3GfxBuf + _dataTable[238].sourceOffset); + execData3PreUpdate_locationNum6Helper2(20 * 640 + 445 - i * 8, _data3GfxBuf + _dataTable[238].sourceOffset); } for (int i = 0; i < x2; ++i) { - execData3PreUpdate_locationNum6Helper3(13125 + x1 * 8 + i * 4, _data3GfxBuf + _dataTable[238].sourceOffset); - execData3PreUpdate_locationNum6Helper3(13249 - x1 * 8 - i * 4, _data3GfxBuf + _dataTable[238].sourceOffset); + execData3PreUpdate_locationNum6Helper3(20 * 640 + 325 + x1 * 8 + i * 4, _data3GfxBuf + _dataTable[238].sourceOffset); + execData3PreUpdate_locationNum6Helper3(20 * 640 + 449 - x1 * 8 - i * 4, _data3GfxBuf + _dataTable[238].sourceOffset); } + addDirtyRect(0, 20, 640, 51); } void TuckerEngine::execData3PreUpdate_locationNum6Helper2(int dstOffset, const uint8 *src) { @@ -562,7 +563,6 @@ void TuckerEngine::execData3PreUpdate_locationNum6Helper2(int dstOffset, const u } } } - addDirtyRect(dstOffset % 640, dstOffset / 640, 8, 51); } void TuckerEngine::execData3PreUpdate_locationNum6Helper3(int dstOffset, const uint8 *src) { @@ -575,7 +575,6 @@ void TuckerEngine::execData3PreUpdate_locationNum6Helper3(int dstOffset, const u } } } - addDirtyRect(dstOffset % 640, dstOffset / 640, 4, 51); } void TuckerEngine::execData3PostUpdate_locationNum6() { @@ -661,7 +660,7 @@ void TuckerEngine::execData3PostUpdate_locationNum8() { _locationBackgroundGfxBuf[offset + 640 * j + i] = colorsTable[(j - 1) * 3 + i + 1]; } } - addDirtyRect(_updateLocationXPosTable2[0] - 1, _updateLocationYPosTable2[0], 3, 4); + addDirtyRect(_updateLocationXPosTable2[0] - 1, _updateLocationYPosTable2[0] + 1, 3, 4); _updateLocationYPosTable2[0] += 2; if (_updateLocationYPosTable2[0] > 120) { _updateLocationYPosTable2[0] = 0; @@ -1013,9 +1012,10 @@ void TuckerEngine::execData3PreUpdate_locationNum14() { if (num > 0) { const int w = _dataTable[num].xSize; const int h = _dataTable[num].ySize; - const int dstOffset = (_updateLocationYPosTable2[i] / 16 - h / 2) * 640 + (_updateLocationXPosTable2[i] - w / 2); - Graphics::decodeRLE_248(_locationBackgroundGfxBuf + dstOffset, _data3GfxBuf + _dataTable[num].sourceOffset, w, h, 0, 0, false); - addDirtyRect(dstOffset % 640, dstOffset / 640, w, h); + const int x = _updateLocationXPosTable2[i] - w / 2; + const int y = _updateLocationYPosTable2[i] / 16 - h / 2; + Graphics::decodeRLE_248(_locationBackgroundGfxBuf + y * 640 + x, _data3GfxBuf + _dataTable[num].sourceOffset, w, h, 0, 0, false); + addDirtyRect(x, y, w, h); } } } @@ -3033,17 +3033,17 @@ void TuckerEngine::execData3PreUpdate_locationNum70() { _panelState = 1; setCursorType(2); int pos = getPositionForLine(22, _infoBarBuf); - int offset = (_flagsTable[143] == 0) ? 57688 : 46168; + int offset = (_flagsTable[143] == 0) ? 90 * 640 + 88 : 72 * 640 + 88; drawStringAlt(offset, color, &_infoBarBuf[pos]); - Graphics::drawStringChar(_locationBackgroundGfxBuf + offset + 5760, 62, 640, color, _charsetGfxBuf); + Graphics::drawStringChar(_locationBackgroundGfxBuf + offset + 9 * 640, 62, 640, color, _charsetGfxBuf); if (_flagsTable[143] != 0) { pos = getPositionForLine(_flagsTable[143] * 2 + 23, _infoBarBuf); - drawStringAlt(offset + 11520, color, &_infoBarBuf[pos]); + drawStringAlt(offset + 18 * 640, color, &_infoBarBuf[pos]); pos = getPositionForLine(_flagsTable[143] * 2 + 24, _infoBarBuf); - drawStringAlt(offset + 17280, color, &_infoBarBuf[pos]); + drawStringAlt(offset + 27 * 640, color, &_infoBarBuf[pos]); } execData3PreUpdate_locationNum70Helper(); - drawStringAlt(offset + 5768, color, _updateLocation70String, _updateLocation70StringLen); + drawStringAlt(offset + 9 * 640 + 8, color, _updateLocation70String, _updateLocation70StringLen); } void TuckerEngine::execData3PreUpdate_locationNum70Helper() { diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index 11c1c78133..9b8304e9fd 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -467,7 +467,7 @@ void TuckerEngine::loadLoc() { copyLocBitmap(filename, 0, false); Graphics::copyRect(_quadBackgroundGfxBuf + 134400, 320, _locationBackgroundGfxBuf + 320, 640, 320, 140); } - _fullRedrawCounter = 2; + _fullRedraw = true; } void TuckerEngine::loadObj() { diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp index 11a535e54a..8041b95414 100644 --- a/engines/tucker/sequences.cpp +++ b/engines/tucker/sequences.cpp @@ -102,7 +102,7 @@ void TuckerEngine::handleCreditsSequence() { counter2 = 0; } } - _fullRedrawCounter = 2; + _fullRedraw = true; ++counter3; if (counter3 == 2) { counter3 = 0; @@ -172,7 +172,7 @@ void TuckerEngine::handleCongratulationsSequence() { stopSounds(); loadImage("congrat.pcx", _loadTempBuf, 1); Graphics::copyRect(_locationBackgroundGfxBuf, 640, _loadTempBuf, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; redrawScreen(0); while (!_quitGame && _timerCounter2 < 450) { while (_fadePaletteCounter < 14) { @@ -242,7 +242,7 @@ void TuckerEngine::handleNewPartSequence() { ++_fadePaletteCounter; } Graphics::copyRect(_locationBackgroundGfxBuf, 640, _quadBackgroundGfxBuf, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; updateSprites(); drawSprite(0); redrawScreen(0); @@ -259,7 +259,7 @@ void TuckerEngine::handleNewPartSequence() { --_fadePaletteCounter; } Graphics::copyRect(_locationBackgroundGfxBuf, 640, _quadBackgroundGfxBuf, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; updateSprites(); drawSprite(0); redrawScreen(0); @@ -294,7 +294,7 @@ void TuckerEngine::handleMeanwhileSequence() { ++_fadePaletteCounter; } Graphics::copyRect(_locationBackgroundGfxBuf, 640, _quadBackgroundGfxBuf + 89600, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; redrawScreen(0); waitForTimer(3); ++i; @@ -305,11 +305,12 @@ void TuckerEngine::handleMeanwhileSequence() { --_fadePaletteCounter; } Graphics::copyRect(_locationBackgroundGfxBuf, 640, _quadBackgroundGfxBuf + 89600, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; redrawScreen(0); waitForTimer(3); } while (_fadePaletteCounter > 0); memcpy(_currentPalette, backupPalette, 256 * 3); + _fullRedraw = true; } void TuckerEngine::handleMapSequence() { @@ -337,7 +338,7 @@ void TuckerEngine::handleMapSequence() { waitForTimer(2); updateMouseState(); Graphics::copyRect(_locationBackgroundGfxBuf + _scrollOffset, 640, _quadBackgroundGfxBuf + 89600, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; if (_flagsTable[7] > 0 && _mousePosX > 30 && _mousePosX < 86 && _mousePosY > 36 && _mousePosY < 86) { textNum = 13; _nextLocationNum = (_partNum == 1) ? 3 : 65; @@ -459,7 +460,7 @@ int TuckerEngine::handleSpecialObjectSelectionSequence() { waitForTimer(2); updateMouseState(); Graphics::copyRect(_locationBackgroundGfxBuf + _scrollOffset, 640, _quadBackgroundGfxBuf, 320, 320, 200); - _fullRedrawCounter = 2; + _fullRedraw = true; if (_fadePaletteCounter < 14) { fadeOutPalette(); ++_fadePaletteCounter; diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index 692335d5ef..09e9a0d38a 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -305,7 +305,7 @@ void TuckerEngine::restart() { _currentGfxBackground = 0; _fadePaletteCounter = 0; memset(_currentPalette, 0, sizeof(_currentPalette)); - _fullRedrawCounter = 0; + _fullRedraw = false; _dirtyRectsPrevCount = _dirtyRectsCount = 0; _updateLocationFadePaletteCounter = 0; @@ -469,7 +469,7 @@ void TuckerEngine::mainLoop() { _mainSpritesBaseOffset = 1; } } - _fullRedrawCounter = 2; + _fullRedraw = true; } else { _currentGfxBackground = _quadBackgroundGfxBuf; } @@ -1460,7 +1460,7 @@ void TuckerEngine::updateScreenScrolling() { } } if (scrollPrevOffset != _scrollOffset) { - _fullRedrawCounter = 2; + _fullRedraw = true; } } @@ -1733,34 +1733,40 @@ void TuckerEngine::drawBackgroundSprites() { } else if (_xPosCurrent > 320 && _xPosCurrent < 640) { srcX += 320; } - int offset = _backgroundSprOffset + srcY * 640 + srcX; - Graphics::decodeRLE_248(_locationBackgroundGfxBuf + offset, _backgroundSpriteDataPtr + frameOffset + 12, srcW, srcH, 0, _locationHeightTable[_locationNum], false); - addDirtyRect(offset % 640, offset / 640, srcW, srcH); + srcX += _backgroundSprOffset; + Graphics::decodeRLE_248(_locationBackgroundGfxBuf + srcY * 640 + srcX, _backgroundSpriteDataPtr + frameOffset + 12, srcW, srcH, 0, _locationHeightTable[_locationNum], false); + addDirtyRect(srcX, srcY, srcW, srcH); } } void TuckerEngine::drawCurrentSprite() { + // Workaround original game glitch: skip first bud frame drawing when entering location (tracker item #2597763) + if ((_locationNum == 17 || _locationNum == 18) && _currentSpriteAnimationFrame == 16) { + return; + } SpriteFrame *chr = &_spriteFramesTable[_currentSpriteAnimationFrame]; - int offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr->yOffset) * 640 + _xPosCurrent; + int yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr->yOffset; + int xPos = _xPosCurrent; if (_mirroredDrawing == 0) { - offset += chr->xOffset - 14; + xPos += chr->xOffset - 14; } else { - offset -= chr->xSize + chr->xOffset - 14; + xPos -= chr->xSize + chr->xOffset - 14; } - Graphics::decodeRLE_248(_locationBackgroundGfxBuf + offset, _spritesGfxBuf + chr->sourceOffset, chr->xSize, chr->ySize, + Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr->sourceOffset, chr->xSize, chr->ySize, chr->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0); - addDirtyRect(offset % 640, offset / 640, chr->xSize, chr->ySize); + addDirtyRect(xPos, yPos, chr->xSize, chr->ySize); if (_currentSpriteAnimationLength > 1) { SpriteFrame *chr2 = &_spriteFramesTable[_currentSpriteAnimationFrame2]; - offset = (_yPosCurrent + _mainSpritesBaseOffset - 54 + chr2->yOffset) * 640 + _xPosCurrent; + yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr2->yOffset; + xPos = _xPosCurrent; if (_mirroredDrawing == 0) { - offset += chr2->xOffset - 14; + xPos += chr2->xOffset - 14; } else { - offset -= chr2->xSize + chr2->xOffset - 14; + xPos -= chr2->xSize + chr2->xOffset - 14; } - Graphics::decodeRLE_248(_locationBackgroundGfxBuf + offset, _spritesGfxBuf + chr2->sourceOffset, chr2->xSize, chr2->ySize, + Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr2->sourceOffset, chr2->xSize, chr2->ySize, chr2->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0); - addDirtyRect(offset % 640, offset / 640, chr2->xSize, chr2->ySize); + addDirtyRect(xPos, yPos, chr2->xSize, chr2->ySize); } } @@ -1891,13 +1897,13 @@ void TuckerEngine::drawSprite(int num) { int srcH = READ_LE_UINT16(p + frameOffset + 2); int srcX = READ_LE_UINT16(p + frameOffset + 8); int srcY = READ_LE_UINT16(p + frameOffset + 10); - int dstOffset = s->gfxBackgroundOffset + srcX; - if (dstOffset < 600 && (_scrollOffset + 320 < dstOffset || _scrollOffset - srcW > dstOffset)) { + int xPos = s->gfxBackgroundOffset + srcX; + if (xPos < 600 && (_scrollOffset + 320 < xPos || _scrollOffset - srcW > xPos)) { return; } s->xSource = srcX; s->gfxBackgroundOffset += s->backgroundOffset; - uint8 *dstPtr = _locationBackgroundGfxBuf + srcY * 640 + dstOffset; + uint8 *dstPtr = _locationBackgroundGfxBuf + srcY * 640 + xPos; const uint8 *srcPtr = p + frameOffset + 12; switch (s->colorType) { case 0: @@ -1910,7 +1916,7 @@ void TuckerEngine::drawSprite(int num) { Graphics::decodeRLE_248(dstPtr, srcPtr, srcW, srcH, 0, s->yMaxBackground, s->flipX != 0); break; } - addDirtyRect(dstOffset % 640, dstOffset / 640 + srcY, srcW, srcH); + addDirtyRect(xPos, srcY, srcW, srcH); } } @@ -2826,7 +2832,7 @@ void TuckerEngine::drawStringInteger(int num, int x, int y, int digits) { Graphics::drawStringChar(_locationBackgroundGfxBuf + offset, numStr[i], 640, 102, _charsetGfxBuf); offset += 8; } - addDirtyRect(x, y, Graphics::_charset.charW * 3, Graphics::_charset.charH); + addDirtyRect(_scrollOffset + x, y, Graphics::_charset.charW * 3, Graphics::_charset.charH); } void TuckerEngine::drawStringAlt(int offset, int color, const uint8 *str, int strLen) { @@ -3740,20 +3746,20 @@ void TuckerEngine::drawSpeechText(int xStart, int y, const uint8 *dataPtr, int n y = count * 10; } for (int i = 0; i < count; ++i) { - int dstOffset = xStart - lines[i].w / 2; - if (dstOffset < _scrollOffset) { - dstOffset = _scrollOffset; - } else if (dstOffset > _scrollOffset + 320 - lines[i].w) { - dstOffset = _scrollOffset + 320 - lines[i].w; + int yPos, xPos = xStart - lines[i].w / 2; + if (xPos < _scrollOffset) { + xPos = _scrollOffset; + } else if (xPos > _scrollOffset + 320 - lines[i].w) { + xPos = _scrollOffset + 320 - lines[i].w; } if (_conversationOptionsCount != 0) { - dstOffset = xStart + _scrollOffset; - dstOffset += (i * 10 + y) * 640; + xPos = xStart + _scrollOffset; + yPos = i * 10 + y; _panelItemWidth = count; } else { - dstOffset += (y - (count - i) * 10) * 640; + yPos = y - (count - i) * 10; } - drawSpeechTextLine(dataPtr, lines[i].offset, lines[i].count, dstOffset, color); + drawSpeechTextLine(dataPtr, lines[i].offset, lines[i].count, xPos, yPos, color); } } @@ -3780,23 +3786,24 @@ int TuckerEngine::splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int return ret; } -void TuckerEngine::drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int dstOffset, uint8 color) { - int startOffset = dstOffset; +void TuckerEngine::drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int x, int y, uint8 color) { + int xStart = x; int i = 0; for (; i < count && dataPtr[pos] != '\n'; ++i) { - Graphics::drawStringChar(_locationBackgroundGfxBuf + dstOffset, dataPtr[pos], 640, color, _charsetGfxBuf); - dstOffset += _charWidthTable[dataPtr[pos]]; + Graphics::drawStringChar(_locationBackgroundGfxBuf + y * 640 + x, dataPtr[pos], 640, color, _charsetGfxBuf); + x += _charWidthTable[dataPtr[pos]]; ++pos; } - addDirtyRect(startOffset % 640, startOffset / 640, Graphics::_charset.charW * i, Graphics::_charset.charH); + addDirtyRect(xStart, y, Graphics::_charset.charW * i, Graphics::_charset.charH); } void TuckerEngine::redrawScreen(int offset) { - debug(9, "redrawScreen() _fullRedrawCounter %d offset %d _dirtyRectsCount %d", _fullRedrawCounter, offset, _dirtyRectsCount); + debug(9, "redrawScreen() _fullRedraw %d offset %d _dirtyRectsCount %d", _fullRedraw, offset, _dirtyRectsCount); assert(offset <= kScreenWidth); - if (_fullRedrawCounter > 0) { - --_fullRedrawCounter; + if (_fullRedraw) { + _fullRedraw = false; _system->copyRectToScreen(_locationBackgroundGfxBuf + offset, kScreenPitch, 0, 0, kScreenWidth, kScreenHeight); + _dirtyRectsPrevCount = _dirtyRectsCount = 0; } else { const int xClip = offset % kScreenPitch; const int yClip = offset / kScreenPitch; @@ -3806,13 +3813,11 @@ void TuckerEngine::redrawScreen(int offset) { } for (int i = 0; i < _dirtyRectsCount; ++i) { redrawScreenRect(clipRect, _dirtyRectsTable[0][i]); - } - _dirtyRectsPrevCount = _dirtyRectsCount; - for (int i = 0; i < _dirtyRectsCount; ++i) { _dirtyRectsTable[1][i] = _dirtyRectsTable[0][i]; } + _dirtyRectsPrevCount = _dirtyRectsCount; + _dirtyRectsCount = 0; } - _dirtyRectsCount = 0; _system->updateScreen(); } @@ -3827,17 +3832,33 @@ void TuckerEngine::redrawScreenRect(const Common::Rect &clip, const Common::Rect if (w <= 0 || h <= 0) { return; } +#if 0 + static const uint8 outlineColor = 0; + memset(_locationBackgroundGfxBuf + r.top * 640 + r.left, outlineColor, w); + memset(_locationBackgroundGfxBuf + (r.top + h - 1) * 640 + r.left, outlineColor, w); + for (int y = r.top; y < r.top + h; ++y) { + _locationBackgroundGfxBuf[y * 640 + r.left] = outlineColor; + _locationBackgroundGfxBuf[y * 640 + r.left + w - 1] = outlineColor; + } +#endif _system->copyRectToScreen(src, 640, r.left, r.top, w, h); } } void TuckerEngine::addDirtyRect(int x, int y, int w, int h) { - if (_dirtyRectsCount >= kMaxDirtyRects) { - _fullRedrawCounter = 2; - _dirtyRectsCount = 0; - } else { - _dirtyRectsTable[0][_dirtyRectsCount] = Common::Rect(x, y, x + w, y + h); - ++_dirtyRectsCount; + if (!_fullRedraw) { + Common::Rect r(x, y, x + w, y + h); + for (int i = 0; i < _dirtyRectsCount; ++i) { + if (_dirtyRectsTable[0][i].contains(r)) { + return; + } + } + if (_dirtyRectsCount < kMaxDirtyRects) { + _dirtyRectsTable[0][_dirtyRectsCount] = r; + ++_dirtyRectsCount; + } else { + _fullRedraw = true; + } } } diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h index 6afccdc4da..21d2e2d49c 100644 --- a/engines/tucker/tucker.h +++ b/engines/tucker/tucker.h @@ -342,7 +342,7 @@ protected: void playSpeechForAction(int i); void drawSpeechText(int xStart, int y, const uint8 *dataPtr, int num, int color); int splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int &lineCharsCount, int &lineWidth); - void drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int dstOffset, uint8 color); + void drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int x, int y, uint8 color); void redrawScreen(int offset); void redrawScreenRect(const Common::Rect &clip, const Common::Rect &dirty); void addDirtyRect(int x, int y, int w, int h); @@ -801,7 +801,7 @@ protected: uint8 *_currentGfxBackground; int _fadePaletteCounter; uint8 _currentPalette[768]; - int _fullRedrawCounter; + bool _fullRedraw; int _dirtyRectsPrevCount, _dirtyRectsCount; Common::Rect _dirtyRectsTable[2][kMaxDirtyRects]; |