From 11e679845d49f5a13e7311b6e5bebc7827a26878 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Sat, 24 Feb 2007 18:39:08 +0000 Subject: some fixes and additions for FOTAQ amiga versions svn-id: r25825 --- engines/queen/command.cpp | 12 +- engines/queen/command.h | 6 +- engines/queen/cutaway.cpp | 12 +- engines/queen/defs.h | 21 ++-- engines/queen/display.cpp | 181 +++++++++++++++++++++--------- engines/queen/display.h | 10 +- engines/queen/graphics.cpp | 10 +- engines/queen/grid.cpp | 2 + engines/queen/journal.cpp | 4 +- engines/queen/logic.cpp | 266 ++++++++++++++++++++++++--------------------- engines/queen/logic.h | 12 +- engines/queen/queen.cpp | 11 +- engines/queen/resource.cpp | 4 + engines/queen/talk.cpp | 8 +- sound/mods/rjp1.cpp | 4 +- 15 files changed, 344 insertions(+), 219 deletions(-) diff --git a/engines/queen/command.cpp b/engines/queen/command.cpp index 8366eb2b72..50982420ce 100644 --- a/engines/queen/command.cpp +++ b/engines/queen/command.cpp @@ -46,12 +46,12 @@ void CmdText::clear() { memset(_command, 0, sizeof(_command)); } -void CmdText::display(uint8 color) { - _vm->display()->textCurrentColor(color); +void CmdText::display(InkColor color) { + _vm->display()->textCurrentColor(_vm->display()->getInkColor(color)); _vm->display()->setTextCentered(_y, _command, false); } -void CmdText::displayTemp(uint8 color, Verb v, const char *name, bool outlined) { +void CmdText::displayTemp(InkColor color, Verb v, const char *name, bool outlined) { char temp[MAX_COMMAND_LEN] = ""; if (_isReversed) { if (name != NULL) @@ -64,17 +64,17 @@ void CmdText::displayTemp(uint8 color, Verb v, const char *name, bool outlined) strcat(temp, name); } } - _vm->display()->textCurrentColor(color); + _vm->display()->textCurrentColor(_vm->display()->getInkColor(color)); _vm->display()->setTextCentered(_y, temp, outlined); } -void CmdText::displayTemp(uint8 color, const char *name, bool outlined) { +void CmdText::displayTemp(InkColor color, const char *name, bool outlined) { char temp[MAX_COMMAND_LEN]; if (_isReversed) sprintf(temp, "%s %s", name, _command); else sprintf(temp, "%s %s", _command, name); - _vm->display()->textCurrentColor(color); + _vm->display()->textCurrentColor(_vm->display()->getInkColor(color)); _vm->display()->setTextCentered(_y, temp, outlined); } diff --git a/engines/queen/command.h b/engines/queen/command.h index daec799b90..98218ee1b3 100644 --- a/engines/queen/command.h +++ b/engines/queen/command.h @@ -38,13 +38,13 @@ struct CmdText { void clear(); //! display the command sentence using the specified color - void display(uint8 color); + void display(InkColor color); //! display a temporary command sentence using the specified parameters - void displayTemp(uint8 color, Verb v, const char *name = NULL, bool outlined = false); + void displayTemp(InkColor color, Verb v, const char *name = NULL, bool outlined = false); //! display a temporary command sentence using the specified parameters - void displayTemp(uint8 color, const char *name, bool outlined = false); + void displayTemp(InkColor color, const char *name, bool outlined = false); //! set the verb for the command sentence void setVerb(Verb v); diff --git a/engines/queen/cutaway.cpp b/engines/queen/cutaway.cpp index 4acf25cf46..d92ccd6c21 100644 --- a/engines/queen/cutaway.cpp +++ b/engines/queen/cutaway.cpp @@ -41,11 +41,9 @@ void Cutaway::run( const char *filename, char *nextFilename, QueenEngine *vm) { - if (vm->resource()->fileExists(filename)) { - Cutaway *cutaway = new Cutaway(filename, vm); - cutaway->run(nextFilename); - delete cutaway; - } + Cutaway *cutaway = new Cutaway(filename, vm); + cutaway->run(nextFilename); + delete cutaway; } Cutaway::Cutaway( @@ -495,6 +493,7 @@ const byte *Cutaway::getCutawayAnim(const byte *ptr, int header, CutawayAnim &an anim.bank = 15; } else { if (anim.bank != 13) { + assert(anim.bank - 1 < MAX_BANK_NAME_COUNT); _vm->bankMan()->load(_bankNames[anim.bank-1], CUTAWAY_BANK); anim.bank = 8; } else { @@ -518,7 +517,8 @@ const byte *Cutaway::getCutawayAnim(const byte *ptr, int header, CutawayAnim &an anim.scale = (int16)READ_BE_INT16(ptr); ptr += 2; - if (_vm->resource()->isDemo()) { + if ((_vm->resource()->isDemo() && _vm->resource()->getPlatform() == Common::kPlatformPC) || + (_vm->resource()->isInterview() && _vm->resource()->getPlatform() == Common::kPlatformAmiga)) { anim.song = 0; } else { anim.song = (int16)READ_BE_INT16(ptr); diff --git a/engines/queen/defs.h b/engines/queen/defs.h index 4c465eae4f..b6c21b38f9 100644 --- a/engines/queen/defs.h +++ b/engines/queen/defs.h @@ -53,16 +53,17 @@ enum Direction { DIR_BACK = 4 }; -enum { - INK_BG_PANEL = 226, - INK_JOURNAL = 248, - INK_PINNACLE_ROOM = 243, - INK_CMD_SELECT = 255, - INK_CMD_NORMAL = 225, - INK_CMD_LOCK = 234, - INK_TALK_NORMAL = 7, - INK_JOE = 14, - INK_OUTLINED_TEXT = 16 +enum InkColor { + INK_BG_PANEL = 0, + INK_JOURNAL, + INK_PINNACLE_ROOM, + INK_CMD_SELECT, + INK_CMD_NORMAL, + INK_TALK_NORMAL, + INK_JOE, + INK_OUTLINED_TEXT, + + INK_COUNT }; enum { diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp index 7d74c994b8..35282440e1 100644 --- a/engines/queen/display.cpp +++ b/engines/queen/display.cpp @@ -76,6 +76,8 @@ Display::Display(QueenEngine *vm, OSystem *system) memset(_texts, 0, sizeof(_texts)); memset(&_dynalum, 0, sizeof(_dynalum)); + + setupInkColors(); } Display::~Display() { @@ -174,15 +176,19 @@ void Display::palSet(const uint8 *pal, int start, int end, bool updateScreen) { } void Display::palSetJoeDress() { - memcpy(_pal.room + 144 * 3, _palJoeDress, 16 * 3); - memcpy(_pal.screen + 144 * 3, _palJoeDress, 16 * 3); - palSet(_pal.screen, 144, 159, true); + if (_vm->resource()->getPlatform() == Common::kPlatformPC) { + memcpy(_pal.room + 144 * 3, _palJoeDress, 16 * 3); + memcpy(_pal.screen + 144 * 3, _palJoeDress, 16 * 3); + palSet(_pal.screen, 144, 159, true); + } } void Display::palSetJoeNormal() { - memcpy(_pal.room + 144 * 3, _palJoeClothes, 16 * 3); - memcpy(_pal.screen + 144 * 3, _palJoeClothes, 16 * 3); - palSet(_pal.screen, 144, 159, true); + if (_vm->resource()->getPlatform() == Common::kPlatformPC) { + memcpy(_pal.room + 144 * 3, _palJoeClothes, 16 * 3); + memcpy(_pal.screen + 144 * 3, _palJoeClothes, 16 * 3); + palSet(_pal.screen, 144, 159, true); + } } void Display::palSetPanel() { @@ -260,30 +266,71 @@ void Display::palScroll(int start, int end) { *palStart = b; } +void Display::palSetAmigaColor(uint8 color, uint16 rgb) { + uint8 b = rgb & 0xF; rgb >>= 4; + uint8 g = rgb & 0xF; rgb >>= 4; + uint8 r = rgb & 0xF; + _pal.room[color * 3] = (r << 4) | r; + _pal.room[color * 3 + 1] = (g << 4) | g; + _pal.room[color * 3 + 2] = (b << 4) | b; +} + void Display::palCustomColors(uint16 roomNum) { debug(9, "Display::palCustomColors(%d)", roomNum); - int i; + if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { + switch (roomNum) { + case 28: + palSetAmigaColor(27, 0xC60); + palSetAmigaColor(28, 0xA30); + palSetAmigaColor(29, 0x810); + palSetAmigaColor(30, 0x600); + break; + case 29: + palSetAmigaColor(27, 0X58B); + palSetAmigaColor(28, 0x369); + palSetAmigaColor(29, 0x158); + palSetAmigaColor(30, 0x046); + break; + case 30: + palSetAmigaColor(27, 0x5A4); + palSetAmigaColor(28, 0x384); + palSetAmigaColor(29, 0x171); + palSetAmigaColor(30, 0x056); + break; + case 31: + palSetAmigaColor(27, 0xDA4); + palSetAmigaColor(28, 0xB83); + palSetAmigaColor(29, 0x873); + palSetAmigaColor(30, 0x652); + break; + case 45: + palSetAmigaColor(20, 0xA58); + palSetAmigaColor(21, 0x845); + break; + } + return; + } switch (roomNum) { case 31: - for (i = 72; i < 84; i++) { + for (int i = 72; i < 84; i++) { _pal.room[i * 3 + 1] = _pal.room[i * 3 + 1] * 90 / 100; _pal.room[i * 3 + 2] = _pal.room[i * 3 + 2] * 70 / 100; } break; case 29: - for (i = 72; i < 84; i++) { + for (int i = 72; i < 84; i++) { _pal.room[i * 3 + 1] = _pal.room[i * 3 + 1] * 60 / 100; _pal.room[i * 3 + 2] = _pal.room[i * 3 + 2] * 60 / 100; } break; case 30: - for (i = 72; i < 84; i++) { + for (int i = 72; i < 84; i++) { _pal.room[i * 3 + 0] = _pal.room[i * 3 + 0] * 60 / 100; _pal.room[i * 3 + 1] = _pal.room[i * 3 + 1] * 80 / 100; } break; case 28: - for (i = 72; i < 84; i++) { + for (int i = 72; i < 84; i++) { _pal.room[i * 3 + 0] = _pal.room[i * 3 + 0] * 80 / 100; _pal.room[i * 3 + 2] = _pal.room[i * 3 + 1] * 60 / 100; } @@ -304,6 +351,25 @@ void Display::palCustomScroll(uint16 roomNum) { int i; ++scrollx; + + if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { + switch (roomNum) { + case 4: + if ((scrollx & 1) == 0) { + palScroll(24, 64); + loPal = 24; + hiPal = 64; + } + break; + case 74: + palScroll(28, 31); + loPal = 28; + hiPal = 31; + break; + } + return; + } + switch (roomNum) { case 123: { static int16 j = 0, jdir = 2; @@ -511,36 +577,38 @@ void Display::palCustomFlash() { } void Display::palCustomLightsOff(uint16 roomNum) { - int end = 223; - int start = (roomNum == ROOM_FLODA_FRONTDESK) ? 32 : 16; - int n = end - start + 1; - - memset(_pal.screen + start * 3, 0, n * 3); - palSet(_pal.screen, start, end, true); - + if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { + memset(_pal.screen, 0, 31 * 3); + _pal.screen[31 * 3] = 15; + _pal.screen[31 * 3 + 1] = 15; + _pal.screen[31 * 3 + 2] = 0; + palSet(_pal.screen, 0, 31, true); + } else { + const int end = 223; + const int start = (roomNum == ROOM_FLODA_FRONTDESK) ? 32 : 16; + const int n = end - start + 1; + memset(_pal.screen + start * 3, 0, n * 3); + palSet(_pal.screen, start, end, true); + } _pal.scrollable = false; } void Display::palCustomLightsOn(uint16 roomNum) { - int end = 223; - int start = (roomNum == ROOM_FLODA_FRONTDESK) ? 32 : 0; - int n = end - start + 1; - - memcpy(_pal.screen + start * 3, _pal.room + start * 3, n * 3); - palSet(_pal.screen, start, end, true); - + if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { + memcpy(_pal.screen, _pal.room, 32 * 3); + palSet(_pal.screen, 0, 31, true); + } else { + const int end = 223; + const int start = (roomNum == ROOM_FLODA_FRONTDESK) ? 32 : 0; + const int n = end - start + 1; + memcpy(_pal.screen + start * 3, _pal.room + start * 3, n * 3); + palSet(_pal.screen, start, end, true); + } _pal.dirtyMin = 0; _pal.dirtyMax = 223; _pal.scrollable = true; } -void Display::palSetPanelColor(uint8 color, uint8 r, uint8 g, uint8 b) { - color -= 144; - _pal.panel[color * 3] = r; - _pal.panel[color * 3 + 1] = g; - _pal.panel[color * 3 + 2] = b; -} - int Display::getNumColorsForRoom(uint16 room) const { int n = 224; if (room >= 114 && room <= 125) { @@ -599,7 +667,7 @@ void Display::update(bool dynalum, int16 dynaX, int16 dynaY) { if (_fullRefresh) { memset(_dirtyBlocks, 0, _dirtyBlocksWidth * _dirtyBlocksHeight); } - debug(7, "Display::update() - Full blit (%d)", _fullRefresh); + debug(9, "Display::update() - Full blit (%d)", _fullRefresh); } else { uint16 count = 0; uint8 *scrBuf = _screenBuf; @@ -628,7 +696,7 @@ void Display::update(bool dynalum, int16 dynaX, int16 dynaY) { if (count != 0) { _system->updateScreen(); } - debug(7, "Display::update() - Dirtyblocks blit (%d)", count); + debug(9, "Display::update() - Dirtyblocks blit (%d)", count); } } @@ -642,14 +710,6 @@ void Display::setupPanel() { if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { decodeLBM(data, dataSize, _panelBuf, PANEL_W, &panelWidth, &panelHeight, _pal.panel, 0, 32, 144); - // setup special colors - // XXX set correct color values - palSetPanelColor(INK_BG_PANEL, 255, 255, 255); - palSetPanelColor(INK_JOURNAL, 255, 255, 255); - palSetPanelColor(INK_PINNACLE_ROOM, 255, 255, 255); - palSetPanelColor(INK_CMD_SELECT, 255, 255, 255); - palSetPanelColor(INK_CMD_NORMAL, 255, 255, 255); - palSetPanelColor(INK_CMD_LOCK, 255, 255, 255); } else { WRITE_LE_UINT16(data + 14, PANEL_H - 10); decodePCX(data, dataSize, _panelBuf + PANEL_W * 10, PANEL_W, &panelWidth, &panelHeight, _pal.panel, 144, 256); @@ -692,8 +752,8 @@ void Display::drawBobPasteDown(const uint8 *data, uint16 x, uint16 y, uint16 w, } void Display::drawInventoryItem(const uint8 *data, uint16 x, uint16 y, uint16 w, uint16 h) { - if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { - if (data != NULL) { + if (data != NULL) { + if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { uint8 *dst = _panelBuf + y * PANEL_W + x; while (h--) { for (int i = 0; i < w; ++i) { @@ -702,14 +762,10 @@ void Display::drawInventoryItem(const uint8 *data, uint16 x, uint16 y, uint16 w, dst += PANEL_W; } } else { - fill(_panelBuf, PANEL_W, x, y, w, h, 144 + 2); - } - } else { - if (data != NULL) { blit(_panelBuf, PANEL_W, x, y, data, w, w, h, false, false); - } else { - fill(_panelBuf, PANEL_W, x, y, w, h, INK_BG_PANEL); } + } else { + fill(_panelBuf, PANEL_W, x, y, w, h, getInkColor(INK_BG_PANEL)); } setDirtyBlock(x, 150 + y, w, h); } @@ -975,6 +1031,29 @@ void Display::clearTexts(uint16 y1, uint16 y2) { } } +void Display::setupInkColors() { + memset(_inkColors, 0, sizeof(_inkColors)); + if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { + _inkColors[INK_BG_PANEL] = 144 + 2; + _inkColors[INK_JOURNAL] = 144 + 16; + _inkColors[INK_PINNACLE_ROOM] = 144 + 14; + _inkColors[INK_CMD_SELECT] = 144 + 17; + _inkColors[INK_CMD_NORMAL] = 144 + 1; + _inkColors[INK_TALK_NORMAL] = 144 + 1; + _inkColors[INK_JOE] = 144 + 17; + _inkColors[INK_OUTLINED_TEXT] = 0; + } else { + _inkColors[INK_BG_PANEL] = 226; + _inkColors[INK_JOURNAL] = 248; + _inkColors[INK_PINNACLE_ROOM] = 243; + _inkColors[INK_CMD_SELECT] = 255; + _inkColors[INK_CMD_NORMAL] = 225; + _inkColors[INK_TALK_NORMAL] = 7; + _inkColors[INK_JOE] = 14; + _inkColors[INK_OUTLINED_TEXT] = 16; + } +} + void Display::setFocusRect(const Common::Rect& rect) { _system->setFocusRectangle(rect); } @@ -1024,7 +1103,7 @@ void Display::drawText(uint16 x, uint16 y, uint8 color, const char *text, bool o const uint8 *ftch = _font + ch * 8; if (outlined) { for (int i = 0; i < 8; ++i) { - drawChar(x + dx[i], y + dy[i], INK_OUTLINED_TEXT, ftch); + drawChar(x + dx[i], y + dy[i], getInkColor(INK_OUTLINED_TEXT), ftch); } } drawChar(x, y, color, ftch); diff --git a/engines/queen/display.h b/engines/queen/display.h index 1cba119630..a23716f873 100644 --- a/engines/queen/display.h +++ b/engines/queen/display.h @@ -72,6 +72,8 @@ public: //! scroll some palette colors void palScroll(int start, int end); + void palSetAmigaColor(uint8 color, uint16 rgb); + //! custom palette effect for the specified room void palCustomColors(uint16 roomNum); @@ -84,8 +86,6 @@ public: void palCustomLightsOff(uint16 roomNum); void palCustomLightsOn(uint16 roomNum); - void palSetPanelColor(uint8 color, uint8 r, uint8 g, uint8 b); - //! mark all palette entries as dirty void palSetAllDirty() { _pal.dirtyMin = 0; _pal.dirtyMax = 255; } @@ -151,6 +151,10 @@ public: //! remove entries from the texts list void clearTexts(uint16 y1, uint16 y2); + void setupInkColors(); + + uint8 getInkColor(InkColor color) const { return _inkColors[color]; } + //! change the current text color void textCurrentColor(uint8 color) { _curTextColor = color; } @@ -239,6 +243,8 @@ private: //! font justification sizes uint8 _charWidth[256]; + uint8 _inkColors[INK_COUNT]; + Common::RandomSource _rnd; Dynalum _dynalum; OSystem *_system; diff --git a/engines/queen/graphics.cpp b/engines/queen/graphics.cpp index 6d79a71197..1993ec47e4 100644 --- a/engines/queen/graphics.cpp +++ b/engines/queen/graphics.cpp @@ -295,17 +295,21 @@ void Graphics::setupMouseCursor() { 0x00, 0x00, 0x00, 0x20 }; uint8 cursorData[16 * 15]; + memset(cursorData, 0, sizeof(cursorData)); const uint8 *src = defaultAmigaCursor; int i = 0; for (int h = 0; h < 15; ++h) { for (int b = 0; b < 16; ++b) { const uint16 mask = (1 << (15 - b)); - cursorData[i] = 0; + uint8 color = 0; if (READ_BE_UINT16(src + 0) & mask) { - cursorData[i] |= 4; + color |= 1; } if (READ_BE_UINT16(src + 2) & mask) { - cursorData[i] |= 8; + color |= 2; + } + if (color != 0) { + cursorData[i] = 0x90 + color; } ++i; } diff --git a/engines/queen/grid.cpp b/engines/queen/grid.cpp index 0dc7d045df..e23ec6c59f 100644 --- a/engines/queen/grid.cpp +++ b/engines/queen/grid.cpp @@ -72,6 +72,7 @@ void Grid::readDataFrom(uint16 numObjects, uint16 numRooms, byte *&ptr) { void Grid::setZone(GridScreen screen, uint16 zoneNum, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { debug(9, "Grid::setZone(%d, %d, (%d,%d), (%d,%d))", screen, zoneNum, x1, y1, x2, y2); + assert(zoneNum < MAX_ZONES_NUMBER); ZoneSlot *pzs = &_zones[screen][zoneNum]; pzs->valid = true; pzs->box.x1 = x1; @@ -82,6 +83,7 @@ void Grid::setZone(GridScreen screen, uint16 zoneNum, uint16 x1, uint16 y1, uint void Grid::setZone(GridScreen screen, uint16 zoneNum, const Box &box) { debug(9, "Grid::setZone(%d, %d, (%d,%d), (%d,%d))", screen, zoneNum, box.x1, box.y1, box.x2, box.y2); + assert(zoneNum < MAX_ZONES_NUMBER); ZoneSlot *pzs = &_zones[screen][zoneNum]; pzs->valid = true; pzs->box = box; diff --git a/engines/queen/journal.cpp b/engines/queen/journal.cpp index 5e722ef111..11213e9714 100644 --- a/engines/queen/journal.cpp +++ b/engines/queen/journal.cpp @@ -117,7 +117,7 @@ void Journal::setup() { _vm->graphics()->clearBobs(); _vm->display()->clearTexts(0, GAME_SCREEN_HEIGHT - 1); _vm->bankMan()->eraseFrames(false); - _vm->display()->textCurrentColor(INK_JOURNAL); + _vm->display()->textCurrentColor(_vm->display()->getInkColor(INK_JOURNAL)); _vm->grid()->clear(GS_ROOM); for (int i = 0; i < MAX_ZONES; ++i) { @@ -159,7 +159,7 @@ void Journal::update() { if (_textField.enabled) { int16 x = _textField.x + _textField.posCursor; int16 y = _textField.y + _currentSaveSlot * _textField.h + 8; - _vm->display()->drawBox(x, y, x + 6, y, INK_JOURNAL); + _vm->display()->drawBox(x, y, x + 6, y, _vm->display()->getInkColor(INK_JOURNAL)); } _vm->display()->forceFullRefresh(); _vm->display()->update(); diff --git a/engines/queen/logic.cpp b/engines/queen/logic.cpp index 848efb68b4..3b95e788fc 100644 --- a/engines/queen/logic.cpp +++ b/engines/queen/logic.cpp @@ -57,6 +57,7 @@ Logic::Logic(QueenEngine *vm) _journal = new Journal(vm); _scene = 0; readQueenJas(); + setupSpecialMoveTable(); } Logic::~Logic() { @@ -1451,10 +1452,76 @@ void Logic::changeRoom() { _vm->display()->showMouseCursor(true); } +void Logic::setupSpecialMoveTable() { + memset(_specialMoves, 0, sizeof(_specialMoves)); + if (_vm->resource()->isDemo()) { + _specialMoves[4] = &Logic::asmMakeJoeUseUnderwear; + _specialMoves[5] = &Logic::asmSwitchToDressPalette; + _specialMoves[14] = &Logic::asmEndDemo; + } else if (_vm->resource()->isInterview()) { + _specialMoves[1] = &Logic::asmInterviewIntro; + _specialMoves[2] = &Logic::asmEndInterview; + } else { + _specialMoves[2] = &Logic::asmMakeJoeUseDress; + _specialMoves[3] = &Logic::asmMakeJoeUseNormalClothes; + _specialMoves[4] = &Logic::asmMakeJoeUseUnderwear; + _specialMoves[5] = &Logic::asmSwitchToDressPalette; + _specialMoves[6] = &Logic::asmSwitchToNormalPalette; + _specialMoves[7] = &Logic::asmStartCarAnimation; // room 74 + _specialMoves[8] = &Logic::asmStopCarAnimation; // room 74 + _specialMoves[9] = &Logic::asmStartFightAnimation; // room 69 + _specialMoves[10] = &Logic::asmWaitForFrankPosition; // c69e.cut + _specialMoves[11] = &Logic::asmMakeFrankGrowing; // c69z.cut + _specialMoves[12] = &Logic::asmMakeRobotGrowing; // c69z.cut + _specialMoves[13] = &Logic::asmShrinkRobot; + _specialMoves[14] = &Logic::asmEndGame; + _specialMoves[15] = &Logic::asmPutCameraOnDino; + _specialMoves[16] = &Logic::asmPutCameraOnJoe; + _specialMoves[17] = &Logic::asmAltIntroPanRight; // cintr.cut + _specialMoves[18] = &Logic::asmAltIntroPanLeft; // cintr.cut + _specialMoves[19] = &Logic::asmSetAzuraInLove; + _specialMoves[20] = &Logic::asmPanRightFromJoe; + _specialMoves[21] = &Logic::asmSetLightsOff; + _specialMoves[22] = &Logic::asmSetLightsOn; + _specialMoves[23] = &Logic::asmSetManequinAreaOn; + _specialMoves[24] = &Logic::asmPanToJoe; + _specialMoves[25] = &Logic::asmTurnGuardOn; + _specialMoves[26] = &Logic::asmPanLeft320To144; + _specialMoves[27] = &Logic::asmSmooch; + _specialMoves[28] = &Logic::asmMakeLightningHitPlane; + _specialMoves[29] = &Logic::asmScaleBlimp; + _specialMoves[30] = &Logic::asmScaleEnding; + _specialMoves[31] = &Logic::asmWaitForCarPosition; + _specialMoves[32] = &Logic::asmShakeScreen; + _specialMoves[33] = &Logic::asmAttemptPuzzle; + _specialMoves[34] = &Logic::asmScaleTitle; + _specialMoves[36] = &Logic::asmPanRightToHugh; + _specialMoves[37] = &Logic::asmMakeWhiteFlash; + _specialMoves[38] = &Logic::asmPanRightToJoeAndRita; + _specialMoves[39] = &Logic::asmPanLeftToBomb; // cdint.cut + if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { + _specialMoves[5] = 0; + _specialMoves[6] = 0; + _specialMoves[13] = 0; + _specialMoves[17] = 0; + _specialMoves[18] = 0; + _specialMoves[27] = &Logic::asmSmoochNoScroll; + _specialMoves[32] = 0; + _specialMoves[34] = &Logic::asmScrollTitle; + _specialMoves[35] = 0; + _specialMoves[36] = 0; + _specialMoves[37] = 0; + _specialMoves[38] = 0; + _specialMoves[39] = 0; + } + } +} + void Logic::executeSpecialMove(uint16 sm) { debug(6, "Special move: %d", sm); - if (!handleSpecialMove(sm)) - warning("unhandled / invalid special move : %d", sm); + if (sm < ARRAYSIZE(_specialMoves) && _specialMoves[sm] != 0) { + (this->*_specialMoves[sm])(); + } } void Logic::asmMakeJoeUseDress() { @@ -1505,14 +1572,21 @@ void Logic::asmMakeFrankGrowing() { _vm->bankMan()->unpack(1, 38, 15); BobSlot *bobFrank = _vm->graphics()->bob(5); bobFrank->frameNum = 38; - bobFrank->curPos(160, 200); - - int i; - for (i = 10; i <= 100; i += 4) { - bobFrank->scale = i; - _vm->update(); + if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { + bobFrank->x = 160; + bobFrank->scale = 100; + for (int i = 300; i >= 200; i -= 5) { + bobFrank->y = i; + _vm->update(); + } + } else { + bobFrank->curPos(160, 200); + for (int i = 10; i <= 100; i += 4) { + bobFrank->scale = i; + _vm->update(); + } } - for (i = 0; i <= 20; ++i) { + for (int i = 0; i <= 20; ++i) { _vm->update(); } @@ -1528,14 +1602,21 @@ void Logic::asmMakeRobotGrowing() { _vm->bankMan()->unpack(1, 38, 15); BobSlot *bobRobot = _vm->graphics()->bob(5); bobRobot->frameNum = 38; - bobRobot->curPos(160, 200); - - int i; - for (i = 10; i <= 100; i += 4) { - bobRobot->scale = i; - _vm->update(); + if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { + bobRobot->x = 160; + bobRobot->scale = 100; + for (int i = 350; i >= 200; i -= 5) { + bobRobot->y = i; + _vm->update(); + } + } else { + bobRobot->curPos(160, 200); + for (int i = 10; i <= 100; i += 4) { + bobRobot->scale = i; + _vm->update(); + } } - for (i = 0; i <= 20; ++i) { + for (int i = 0; i <= 20; ++i) { _vm->update(); } @@ -1708,6 +1789,19 @@ void Logic::asmSmooch() { } } +void Logic::asmSmoochNoScroll() { + _vm->graphics()->putCameraOnBob(-1); + BobSlot *bobAzura = _vm->graphics()->bob(5); + BobSlot *bobJoe = _vm->graphics()->bob(6); + for (int i = 0; i < 320; i += 8) { + if (bobJoe->x - bobAzura->x > 128) { + bobAzura->x += 2; + bobJoe->x -= 2; + } + _vm->update(); + } +} + void Logic::asmMakeLightningHitPlane() { _vm->graphics()->putCameraOnBob(-1); short iy = 0, x, ydir = -1, j, k; @@ -1717,7 +1811,11 @@ void Logic::asmMakeLightningHitPlane() { planeBob->y = 135; - planeBob->scale = 20; + if (_vm->resource()->getPlatform() == Common::kPlatformAmiga) { + planeBob->scale = 100; + } else { + planeBob->scale = 20; + } for (x = 660; x > 163; x -= 6) { planeBob->x = x; @@ -1791,11 +1889,13 @@ void Logic::asmScaleBlimp() { BobSlot *bob = _vm->graphics()->bob(7); int16 x = bob->x; int16 y = bob->y; + bob->scale = 100; while (bob->x > 150) { bob->x = x * 256 / z + 150; bob->y = y * 256 / z + 112; - bob->scale = 100 * 256 / z; - + if (_vm->resource()->getPlatform() != Common::kPlatformAmiga) { + bob->scale = 100 * 256 / z; + } ++z; if (z % 6 == 0) { --x; @@ -1808,14 +1908,14 @@ void Logic::asmScaleBlimp() { void Logic::asmScaleEnding() { _vm->graphics()->bob(7)->active = false; // Turn off blimp BobSlot *b = _vm->graphics()->bob(20); - b->x = 160; - b->y = 100; - int i; - for (i = 5; i <= 100; i += 5) { - b->scale = i; - _vm->update(); + b->curPos(160, 100); + if (_vm->resource()->getPlatform() != Common::kPlatformAmiga) { + for (int i = 5; i <= 100; i += 5) { + b->scale = i; + _vm->update(); + } } - for (i = 0; i < 50; ++i) { + for (int i = 0; i < 50; ++i) { _vm->update(); } _vm->display()->palFadeOut(_currentRoom); @@ -1858,6 +1958,18 @@ void Logic::asmScaleTitle() { } } +void Logic::asmScrollTitle() { + BobSlot *bob = _vm->graphics()->bob(5); + bob->animating = false; + bob->x = 161; + bob->y = 300; + bob->scale = 100; + while (bob->y >= 120) { + bob->y -= 4; + _vm->update(); + } +} + void Logic::asmPanRightToHugh() { BobSlot *bob_thugA1 = _vm->graphics()->bob(20); BobSlot *bob_thugA2 = _vm->graphics()->bob(21); @@ -2063,23 +2175,6 @@ bool LogicDemo::preChangeRoom() { return false; } -bool LogicDemo::handleSpecialMove(uint16 sm) { - switch (sm) { - case 4: - asmMakeJoeUseUnderwear(); - break; - case 5: - asmSwitchToDressPalette(); - break; - case 14: - asmEndDemo(); - break; - default: - return false; - } - return true; -} - void LogicInterview::useJournal() { // no-op } @@ -2096,19 +2191,6 @@ bool LogicInterview::preChangeRoom() { return false; } -bool LogicInterview::handleSpecialMove(uint16 sm) { - switch (sm) { - case 1: - asmInterviewIntro(); - break; - case 2: - asmEndInterview(); - break; - default: - return false; - } - return true; -} void LogicGame::useJournal() { _vm->command()->clear(false); @@ -2124,13 +2206,13 @@ bool LogicGame::preChangeRoom() { displayRoom(currentRoom(), RDM_FADE_NOJOE, 100, 2, true); playCutaway("copy.cut"); playCutaway("clogo.cut"); - - if (ConfMan.getBool("alt_intro") && _vm->resource()->isCD()) { - playCutaway("cintr.cut"); - } else { - playCutaway("cdint.cut"); + if (_vm->resource()->getPlatform() != Common::kPlatformAmiga) { + if (ConfMan.getBool("alt_intro") && _vm->resource()->isCD()) { + playCutaway("cintr.cut"); + } else { + playCutaway("cdint.cut"); + } } - playCutaway("cred.cut"); _vm->display()->palSetPanel(); sceneReset(); @@ -2145,64 +2227,4 @@ bool LogicGame::preChangeRoom() { return false; } -bool LogicGame::handleSpecialMove(uint16 sm) { - typedef void (LogicGame::*SpecialMoveProc)(); - static const SpecialMoveProc asmTable[] = { - /* 00 */ - 0, - 0, - &LogicGame::asmMakeJoeUseDress, - &LogicGame::asmMakeJoeUseNormalClothes, - /* 04 */ - &LogicGame::asmMakeJoeUseUnderwear, - &LogicGame::asmSwitchToDressPalette, - &LogicGame::asmSwitchToNormalPalette, - &LogicGame::asmStartCarAnimation, // room 74 - /* 08 */ - &LogicGame::asmStopCarAnimation, // room 74 - &LogicGame::asmStartFightAnimation, // room 69 - &LogicGame::asmWaitForFrankPosition, // c69e.cut - &LogicGame::asmMakeFrankGrowing, // c69z.cut - /* 12 */ - &LogicGame::asmMakeRobotGrowing, // c69z.cut - &LogicGame::asmShrinkRobot, - &LogicGame::asmEndGame, - &LogicGame::asmPutCameraOnDino, - /* 16 */ - &LogicGame::asmPutCameraOnJoe, - &LogicGame::asmAltIntroPanRight, // cintr.cut - &LogicGame::asmAltIntroPanLeft, // cintr.cut - &LogicGame::asmSetAzuraInLove, - /* 20 */ - &LogicGame::asmPanRightFromJoe, - &LogicGame::asmSetLightsOff, - &LogicGame::asmSetLightsOn, - &LogicGame::asmSetManequinAreaOn, - /* 24 */ - &LogicGame::asmPanToJoe, - &LogicGame::asmTurnGuardOn, - &LogicGame::asmPanLeft320To144, - &LogicGame::asmSmooch, - /* 28 */ - &LogicGame::asmMakeLightningHitPlane, - &LogicGame::asmScaleBlimp, - &LogicGame::asmScaleEnding, - &LogicGame::asmWaitForCarPosition, - /* 32 */ - &LogicGame::asmShakeScreen, - &LogicGame::asmAttemptPuzzle, - &LogicGame::asmScaleTitle, - 0, - /* 36 */ - &LogicGame::asmPanRightToHugh, - &LogicGame::asmMakeWhiteFlash, - &LogicGame::asmPanRightToJoeAndRita, - &LogicGame::asmPanLeftToBomb // cdint.cut - }; - if (sm >= ARRAYSIZE(asmTable) || asmTable[sm] == 0) - return false; - (this->*asmTable[sm])(); - return true; -} - } // End of namespace Queen diff --git a/engines/queen/logic.h b/engines/queen/logic.h index 2721951f4e..1c0868babc 100644 --- a/engines/queen/logic.h +++ b/engines/queen/logic.h @@ -207,6 +207,8 @@ public: //! enter the Journal (save/load, configuration) virtual void useJournal() = 0; + void setupSpecialMoveTable(); + //! execute a special move void executeSpecialMove(uint16 sm); @@ -222,6 +224,8 @@ public: TALK_SELECTED_COUNT = 86 }; + typedef void (Logic::*SpecialMoveProc)(); + protected: void readQueenJas(); @@ -252,6 +256,7 @@ protected: void asmTurnGuardOn(); void asmPanLeft320To144(); void asmSmooch(); + void asmSmoochNoScroll(); void asmMakeLightningHitPlane(); void asmScaleBlimp(); void asmScaleEnding(); @@ -259,6 +264,7 @@ protected: void asmShakeScreen(); void asmAttemptPuzzle(); void asmScaleTitle(); + void asmScrollTitle(); void asmPanRightToHugh(); void asmMakeWhiteFlash(); void asmPanRightToJoeAndRita(); @@ -268,7 +274,6 @@ protected: void asmEndInterview(); virtual bool preChangeRoom() = 0; - virtual bool handleSpecialMove(uint16 sm) = 0; uint16 _currentRoom; @@ -361,6 +366,8 @@ protected: //! cutscene counter int _scene; + + SpecialMoveProc _specialMoves[40]; Credits *_credits; Journal *_journal; @@ -377,7 +384,6 @@ public: protected: bool preChangeRoom(); - bool handleSpecialMove(uint16 sm); }; class LogicInterview : public Logic { @@ -389,7 +395,6 @@ public: protected: bool preChangeRoom(); - bool handleSpecialMove(uint16 sm); }; class LogicGame : public Logic { @@ -401,7 +406,6 @@ public: protected: bool preChangeRoom(); - bool handleSpecialMove(uint16 sm); }; diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index 87f7030b71..a5b40ec3f9 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -127,6 +127,7 @@ QueenEngine::~QueenEngine() { void QueenEngine::registerDefaultSettings() { ConfMan.registerDefault("talkspeed", Logic::DEFAULT_TALK_SPEED); ConfMan.registerDefault("subtitles", true); + _subtitles = true; } void QueenEngine::checkOptionSettings() { @@ -137,15 +138,15 @@ void QueenEngine::checkOptionSettings() { _talkSpeed = MAX_TEXT_SPEED; } - // ensure text is always on when voice is off - if (!_sound->speechOn()) { - _subtitles = true; - } - // demo and interview versions don't have speech at all if (_sound->speechOn() && (_resource->isDemo() || _resource->isInterview())) { _sound->speechToggle(false); } + + // ensure text is always on when voice is off + if (!_sound->speechOn()) { + _subtitles = true; + } } void QueenEngine::readOptionSettings() { diff --git a/engines/queen/resource.cpp b/engines/queen/resource.cpp index 9724963884..c7eabebc95 100644 --- a/engines/queen/resource.cpp +++ b/engines/queen/resource.cpp @@ -90,6 +90,10 @@ Resource::~Resource() { } ResourceEntry *Resource::resourceEntry(const char *filename) const { + if (filename[0] == 0 || strlen(filename) >= 14) { + uint8 *p = 0; + *p = 0x1234; + } assert(filename[0] && strlen(filename) < 14); Common::String entryName(filename); diff --git a/engines/queen/talk.cpp b/engines/queen/talk.cpp index 17cf56d60b..37bb10ff86 100644 --- a/engines/queen/talk.cpp +++ b/engines/queen/talk.cpp @@ -1178,7 +1178,7 @@ int16 Talk::selectSentence() { int talkZone[5]; int i; - _vm->display()->textCurrentColor(INK_TALK_NORMAL); + _vm->display()->textCurrentColor(_vm->display()->getInkColor(INK_TALK_NORMAL)); _vm->graphics()->setupArrows(); BobSlot *arrowBobUp = _vm->graphics()->bob(Graphics::ARROW_BOB_UP); @@ -1269,7 +1269,7 @@ int16 Talk::selectSentence() { int16 y; const Box *b = _vm->grid()->zone(GS_PANEL, oldZone); for (y = b->y1; y < b->y2; y += 10) - _vm->display()->textColor(150 + y, INK_TALK_NORMAL); + _vm->display()->textColor(150 + y, _vm->display()->getInkColor(INK_TALK_NORMAL)); oldZone = 0; } if (mouseButton != 0) { @@ -1292,13 +1292,13 @@ int16 Talk::selectSentence() { if (zone > 0) { const Box *b = _vm->grid()->zone(GS_PANEL, zone); for (y = b->y1; y < b->y2; y += 10) - _vm->display()->textColor(150 + y, INK_JOE); + _vm->display()->textColor(150 + y, _vm->display()->getInkColor(INK_JOE)); } if (oldZone > 0) { const Box *b = _vm->grid()->zone(GS_PANEL, oldZone); for (y = b->y1; y < b->y2; y += 10) - _vm->display()->textColor(150 + y, INK_TALK_NORMAL); + _vm->display()->textColor(150 + y, _vm->display()->getInkColor(INK_TALK_NORMAL)); } oldZone = zone; diff --git a/sound/mods/rjp1.cpp b/sound/mods/rjp1.cpp index f2967181cb..8366137b0d 100644 --- a/sound/mods/rjp1.cpp +++ b/sound/mods/rjp1.cpp @@ -227,7 +227,9 @@ void Rjp1::turnOffChannel(Rjp1Channel *channel) { void Rjp1::playChannel(Rjp1Channel *channel) { if (channel->active) { turnOnChannel(channel); - playSongSequence(channel); + if (channel->sequenceData) { + playSongSequence(channel); + } modulateVolume(channel); modulatePeriod(channel); } -- cgit v1.2.3