diff options
76 files changed, 5680 insertions, 781 deletions
@@ -232,7 +232,8 @@ ScummVM Team Lubomyr Lisen Maemo: - Frantisek Dufka + Frantisek Dufka - (retired) + Tarek Soliman Nintendo 64: Fabio Battaglia @@ -6,6 +6,7 @@ For a more comprehensive changelog of the latest experimental code, see: - Added support for Lands of Lore: The Throne of Chaos. - Added support for Blue's Birthday Adventure. - Added support for Ringworld: Revenge Of The Patriarch. + - Added support for the Amiga version of Conquests of the Longbow. New Ports: - Added PlayStation 3 port. @@ -26,6 +27,12 @@ For a more comprehensive changelog of the latest experimental code, see: Lure: - Fixed crash when trying to talk and ask something at the same time. + SCI: + - Added better handling of digital vs. synthesized sound effects. If the + "Mixed Adlib / MIDI mode" checkbox is checked, the engine will prefer + digital sound effects, otherwise their synthesized counterparts will be + preferred instead, if both versions of the same effect exist. + SCUMM: - Implemented PC Speaker support for SCUMM v5 games. - Fixed priority bug in iMuse. As a result the AdLib music should sound @@ -884,7 +884,7 @@ Supported platforms include (but are not limited to): Dreamcast GP2x iPhone (also includes iPod Touch and iPad) - Maemo (Nokia Internet tablets 770, N800, N810, N900) + Maemo (Nokia Internet tablet N810) Nintendo 64 Nintendo DS Nintendo GameCube @@ -2127,12 +2127,11 @@ debug messages (see http://www.sysinternals.com/ntw2k/freeware/debugview.shtml). http://wiki.scummvm.org/index.php/Compiling_ScummVM/iPhone Maemo: - * Get Scratchbox environment with Maemo 2.2 rootstrap (2.2 is for 770 and up) + * Install Maemo SDK with 4.1.2 rootstrap * Install libmad, Tremor, FLAC from source - * patch scummvm source (some stuff is currently too dirty to be in git directly): - patch -p1 < backends/platform/maemo/scummvm-[currentversion]-maemo.patch + * run 'ln -s backends/platform/maemo/debian' * update debian/changelog - * run 'fakeroot dpkg-buildpackage -b -d' + * run 'sb2 dpkg-buildpackage -b' ------------------------------------------------------------------------ Good Luck and Happy Adventuring! diff --git a/devtools/credits.pl b/devtools/credits.pl index 6199252a79..77f63bf774 100755 --- a/devtools/credits.pl +++ b/devtools/credits.pl @@ -725,7 +725,8 @@ begin_credits("Credits"); end_section(); begin_section("Maemo"); - add_person("Frantisek Dufka", "fanoush", ""); + add_person("Frantisek Dufka", "fanoush", "(retired)"); + add_person("Tarek Soliman", "tsoliman", ""); end_section(); begin_section("Nintendo 64"); diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 4bebf97e95..4ed606c3ba 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -362,9 +362,15 @@ int AgiEngine::agiInit() { initPriTable(); - // clear string buffer - for (i = 0; i < MAX_STRINGS; i++) - _game.strings[i][0] = 0; + // Clear the string buffer on startup, but not when the game restarts, as + // some scripts expect that the game strings remain unaffected after a + // restart. An example is script 98 in SQ2, which is not invoked on restart + // to ask Ego's name again. The name is supposed to be maintained in string 1. + // Fixes bug #3292784. + if (!_restartGame) { + for (i = 0; i < MAX_STRINGS; i++) + _game.strings[i][0] = 0; + } // setup emulation @@ -519,6 +525,21 @@ AgiBase::~AgiBase() { } } +void AgiBase::initRenderMode() { + _renderMode = Common::kRenderEGA; + + if (ConfMan.hasKey("platform")) { + Common::Platform platform = Common::parsePlatform(ConfMan.get("platform")); + _renderMode = (platform == Common::kPlatformAmiga) ? Common::kRenderAmiga : Common::kRenderEGA; + } + + if (ConfMan.hasKey("render_mode")) { + Common::RenderMode tmpMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str()); + if (tmpMode != Common::kRenderDefault) + _renderMode = tmpMode; + } +} + AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBase(syst, gameDesc) { // Setup mixer @@ -572,11 +593,7 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas _predictiveDictLineCount = 0; _firstSlot = 0; - // NOTE: On game reload the keys do not get set again, - // thus it is incorrect to reset it in agiInit(). Fixes bug #2823762 - _game.lastController = 0; - for (int i = 0; i < MAX_DIRS; i++) - _game.controllerOccured[i] = false; + resetControllers(); setupOpcodes(); _game._curLogic = NULL; @@ -618,23 +635,7 @@ void AgiEngine::initialize() { } } - if (ConfMan.hasKey("render_mode")) { - _renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str()); - } else if (ConfMan.hasKey("platform")) { - switch (Common::parsePlatform(ConfMan.get("platform"))) { - case Common::kPlatformAmiga: - _renderMode = Common::kRenderAmiga; - break; - case Common::kPlatformPC: - _renderMode = Common::kRenderEGA; - break; - default: - _renderMode = Common::kRenderEGA; - break; - } - } else { - _renderMode = Common::kRenderDefault; - } + initRenderMode(); _buttonStyle = AgiButtonStyle(_renderMode); _defaultButtonStyle = AgiButtonStyle(); diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 080373d27b..6bb3beec78 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -124,7 +124,6 @@ enum AgiGameID { GID_XMASCARD, GID_FANMADE, GID_GETOUTTASQ, // Fanmade - GID_SQ0, // Fanmade GID_MICKEY, // PreAGI GID_WINNIE, // PreAGI GID_TROLL // PreAGI @@ -614,7 +613,6 @@ struct AgiGame { bool controllerOccured[MAX_DIRS]; /**< keyboard keypress events */ AgiController controllers[MAX_CONTROLLERS]; - int lastController; char strings[MAX_STRINGS + 1][MAX_STRINGLEN]; /**< strings */ @@ -778,6 +776,8 @@ protected: virtual void initialize() = 0; + void initRenderMode(); + public: GfxMgr *_gfx; @@ -809,8 +809,8 @@ public: virtual void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, int16 p4, int16 p5, int16 p6, int16 p7) = 0; virtual void releaseImageStack() = 0; - virtual int saveGame(const char *fileName, const char *saveName) = 0; - virtual int loadGame(const char *fileName, bool checkId = true) = 0; + virtual int saveGame(const Common::String &fileName, const Common::String &saveName) = 0; + virtual int loadGame(const Common::String &fileName, bool checkId = true) = 0; int _soundemu; @@ -881,13 +881,13 @@ public: StringData _stringdata; - const char *getSavegameFilename(int num); + Common::String getSavegameFilename(int num) const; void getSavegameDescription(int num, char *buf, bool showEmpty = true); int selectSlot(); - int saveGame(const char *fileName, const char *saveName); + int saveGame(const Common::String &fileName, const Common::String &saveName); + int loadGame(const Common::String &fileName, bool checkId = true); int saveGameDialog(); int saveGameSimple(); - int loadGame(const char *fileName, bool checkId = true); int loadGameDialog(); int loadGameSimple(); @@ -1076,7 +1076,7 @@ public: char *agiSprintf(const char *); void writeStatus(); void writePrompt(); - void clearPrompt(); + void clearPrompt(bool useBlackBg = false); void clearLines(int, int, int); void flushLines(int, int); bool predictiveDialog(); diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp index e6f122f9f6..9cbab1f3c4 100644 --- a/engines/agi/cycle.cpp +++ b/engines/agi/cycle.cpp @@ -384,7 +384,6 @@ int AgiEngine::runGame() { if (_restartGame) { setflag(fRestartGame, true); - _game.lastController = 0; setvar(vTimeDelay, 2); // "normal" speed _restartGame = false; } diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index 5141ab761f..21b1831261 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -276,6 +276,8 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl SaveStateDescriptor desc(slot, name); + // Do not allow save slot 0 (used for auto-saving) to be deleted or + // overwritten. desc.setDeletableFlag(slot != 0); desc.setWriteProtectedFlag(slot == 0); @@ -306,9 +308,12 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl delete in; return desc; + } else { + SaveStateDescriptor emptySave; + // Do not allow save slot 0 (used for auto-saving) to be overwritten. + emptySave.setWriteProtectedFlag(slot == 0); + return emptySave; } - - return SaveStateDescriptor(); } const ADGameDescription *AgiMetaEngine::fallbackDetect(const FileMap &allFilesXXX, const Common::FSList &fslist) const { diff --git a/engines/agi/detection_tables.h b/engines/agi/detection_tables.h index 28e94075a6..f0cd422ed6 100644 --- a/engines/agi/detection_tables.h +++ b/engines/agi/detection_tables.h @@ -299,8 +299,8 @@ static const AGIGameDescription gameDescriptions[] = { // King's Quest 2 (IIgs) 2.0A 6/16/88 (CE) GAME_P("kq2", "2.0A 1988-06-16 (CE)", "5203c8b95250a2ecfee93ddb99414753", 0x2917, GID_KQ2, Common::kPlatformApple2GS), - // King's Quest 2 (Amiga) 2.0J (Broken) - GAME_P("kq2", "2.0J 1987-01-29 [OBJECT decrypted]", "b866f0fab2fad91433a637a828cfa410", 0x2440, GID_KQ2, Common::kPlatformAmiga), + // King's Quest 2 (Amiga) 2.0J + GAME_P("kq2", "2.0J 1987-01-29", "b866f0fab2fad91433a637a828cfa410", 0x2440, GID_KQ2, Common::kPlatformAmiga), // King's Quest 2 (Mac) 2.0R GAME_P("kq2", "2.0R 1988-03-23", "cbdb0083317c8e7cfb7ac35da4bc7fdc", 0x2440, GID_KQ2, Common::kPlatformMacintosh), @@ -708,39 +708,11 @@ static const AGIGameDescription gameDescriptions[] = { FANMADE("Go West, Young Hippie", "ff31484ea465441cb5f3a0f8e956b716"), FANMADE("Good Man (demo v3.41)", "3facd8a8f856b7b6e0f6c3200274d88c"), - { - // Groza - { - "agi-fanmade", - "Groza (russian) [AGDS sample]", - AD_ENTRY1("logdir", "421da3a18004122a966d64ab6bd86d2e"), - Common::RU_RUS, - Common::kPlatformPC, - ADGF_USEEXTRAASTITLE, - GUIO_NONE - }, - GID_FANMADE, - GType_V2, - GF_AGDS, - 0x2440 - }, + GAME_LVFPNF("agi-fanmade", "Groza (russian) [AGDS sample]", "logdir", "421da3a18004122a966d64ab6bd86d2e", -1, + Common::RU_RUS, 0x2440, GF_AGDS, GID_FANMADE, Common::kPlatformPC,GType_V2), - { - // Get Outta SQ - { - "agi-fanmade", - "Get Outta Space Quest", - AD_ENTRY1("logdir", "aaea5b4a348acb669d13b0e6f22d4dc9"), - Common::EN_ANY, - Common::kPlatformPC, - ADGF_USEEXTRAASTITLE, - GUIO_NONE - }, - GID_GETOUTTASQ, - GType_V2, - 0, - 0x2440 - }, + GAME_LVFPNF("agi-fanmade", "Get Outta Space Quest", "logdir", "aaea5b4a348acb669d13b0e6f22d4dc9", -1, + Common::EN_ANY, 0x2440, GF_FANMADE, GID_GETOUTTASQ, Common::kPlatformPC,GType_V2), FANMADE_F("Half-Death - Terror At White-Mesa", "b62c05d0ace878261392073f57ae788c", GF_AGIMOUSE), FANMADE("Hank's Quest (v1.0 English) - Victim of Society", "64c15b3d0483d17888129100dc5af213"), diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp index eb162e4ab0..074e5570d5 100644 --- a/engines/agi/graphics.cpp +++ b/engines/agi/graphics.cpp @@ -1192,7 +1192,6 @@ void GfxMgr::flushScreen() { flushBlock(0, 0, GFX_WIDTH - 1, GFX_HEIGHT - 1); doUpdate(); - g_system->updateScreen(); } /** diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp index d899a6e202..a7f15c16fb 100644 --- a/engines/agi/keyboard.cpp +++ b/engines/agi/keyboard.cpp @@ -114,7 +114,7 @@ int AgiEngine::handleController(int key) { debugC(3, kDebugLevelInput, "key = %04x", key); - for (i = 0; i < _game.lastController; i++) { + for (i = 0; i < MAX_CONTROLLERS; i++) { if (_game.controllers[i].keycode == key) { debugC(3, kDebugLevelInput, "event %d: key press", _game.controllers[i].controller); _game.controllerOccured[_game.controllers[i].controller] = true; @@ -180,10 +180,17 @@ int AgiEngine::handleController(int key) { if (!(getFeatures() & GF_AGIMOUSE)) { // Handle mouse button events if (key == BUTTON_LEFT) { - v->flags |= fAdjEgoXY; - v->parm1 = WIN_TO_PIC_X(_mouse.x); - v->parm2 = WIN_TO_PIC_Y(_mouse.y); - return true; + if (getGameID() == GID_PQ1 && _game.vars[vCurRoom] == 116) { + // WORKAROUND: Special handling for mouse clicks in the newspaper + // screen of PQ1. Fixes bug #3018770. + d = 3; // fake a right arrow key (next page) + } else { + // Click-to-walk mouse interface + v->flags |= fAdjEgoXY; + v->parm1 = WIN_TO_PIC_X(_mouse.x); + v->parm2 = WIN_TO_PIC_Y(_mouse.y); + return true; + } } } diff --git a/engines/agi/objects.cpp b/engines/agi/objects.cpp index efc8645287..94eef92579 100644 --- a/engines/agi/objects.cpp +++ b/engines/agi/objects.cpp @@ -68,15 +68,20 @@ int AgiEngine::decodeObjects(uint8 *mem, uint32 flen) { for (i = 0, so = spos; i < _game.numObjects; i++, so += padsize) { int offset; - (_objects + i)->location = *(mem + so + 2); + _objects[i].location = *(mem + so + 2); offset = READ_LE_UINT16(mem + so) + spos; if ((uint) offset < flen) { - (_objects + i)->name = (char *)strdup((const char *)mem + offset); + _objects[i].name = (char *)strdup((const char *)mem + offset); } else { warning("object %i name beyond object filesize (%04x > %04x)", i, offset, flen); - (_objects + i)->name = strdup(""); + _objects[i].name = strdup(""); } + + // Don't show the invalid "?" object in ego's inventory in the fanmade + // game Beyond the Titanic 2 (bug #3116541). + if (!strcmp(_objects[i].name, "?") && _objects[i].location == EGO_OWNED) + _objects[i].location = 0; } debug(0, "Reading objects: %d objects read.", _game.numObjects); diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp index 17addc0c05..72f60e2516 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -73,9 +73,9 @@ void cmdDecrement(AgiGame *state, uint8 *p) { void cmdAssignN(AgiGame *state, uint8 *p) { _v[p0] = p1; - // WORKAROUND for a bug in fan _game "Get outta SQ" + // WORKAROUND for a bug in fan game "Get outta SQ" // Total number of points is stored in variable 7, which - // is then incorrectly assigned to 0. Thus, when the _game + // is then incorrectly assigned to 0. Thus, when the game // is restarted, "Points 0 of 0" is shown. We set the // variable to the correct value here // Fixes bug #1942476 - "AGI: Fan(Get Outta SQ) - Score @@ -184,10 +184,10 @@ void cmdNewRoom(AgiGame *state, uint8 *p) { // of the copy protection string (Copy protection is in logic.128) was // left over to the intro scene (Starts with room 73 i.e. logic.073). // The intro scene checks for any keys pressed and if it finds any it - // jumps to the _game's start (Room 1 i.e. logic.001). We clear the + // jumps to the game's start (Room 1 i.e. logic.001). We clear the // keyboard buffer when the intro sequence's first room (Room 73) is // loaded so that no keys from the copy protection scene can be left - // over to cause the intro to skip to the _game's start. + // over to cause the intro to skip to the game's start. if (getGameID() == GID_GOLDRUSH && p0 == 73) state->keypress = 0; } @@ -275,9 +275,9 @@ void cmdSetPriority(AgiGame *state, uint8 *p) { // It seems that in this scene, ego's priority is set to 8, but the priority of // the last dwarf with the soup bowls (view 152) is also set to 8, which causes // the dwarf to be drawn behind ego - // With this workaround, when the _game scripts set the priority of view 152 + // With this workaround, when the game scripts set the priority of view 152 // (seventh dwarf with soup bowls), ego's priority is set to 7 - // The _game script itself sets priotity 8 for ego before she starts walking, + // The game script itself sets priotity 8 for ego before she starts walking, // and then releases the fixed priority set on ego after ego is seated // Therefore, this workaround only affects that specific part of this scene // Ego is set to object 19 by script 54 @@ -902,7 +902,7 @@ void cmdDraw(AgiGame *state, uint8 *p) { state->_vm->_sprites->eraseUpdSprites(); vt.flags |= fDrawn; - // WORKAROUND: This fixes a bug with AGI Fanmade _game Space Trek. + // WORKAROUND: This fixes a bug with AGI Fanmade game Space Trek. // The original workaround checked if AGI version was <= 2.440, which could // cause regressions with some AGI games. The original workaround no longer // works for Space Trek in ScummVM, as all fanmade games are set to use @@ -1259,7 +1259,6 @@ void cmdSetMenuItem(AgiGame *state, uint8 *p) { } void cmdVersion(AgiGame *state, uint8 *p) { - char verMsg[64]; char ver2Msg[] = "\n" " \n\n" @@ -1269,33 +1268,17 @@ void cmdVersion(AgiGame *state, uint8 *p) { " \n\n" " Emulating AGI v%x.002.%03x\n"; // no Sierra as it wraps textbox - char *r, *q; - int ver, maj, min; - char msg[256]; - int gap; - int len; - sprintf(verMsg, TITLE " v%s", gScummVMVersion); - - ver = getVersion(); - maj = (ver >> 12) & 0xf; - min = ver & 0xfff; - - q = maj == 2 ? ver2Msg : ver3Msg; - r = strchr(q + 1, '\n'); + Common::String verMsg = TITLE " v%s"; + + int ver = getVersion(); + int maj = (ver >> 12) & 0xf; + int min = ver & 0xfff; - // insert our version into the other version - len = strlen(verMsg); - gap = r - q; + verMsg += (maj == 2 ? ver2Msg : ver3Msg); + verMsg = Common::String::format(verMsg.c_str(), gScummVMVersion, maj, min); - if (gap < 0) - gap = 0; - else - gap = (gap - len) / 2; - - strncpy(q + 1 + gap, verMsg, strlen(verMsg)); - sprintf(msg, q, maj, min); - state->_vm->messageBox(msg); + state->_vm->messageBox(verMsg.c_str()); } void cmdConfigureScreen(AgiGame *state, uint8 *p) { @@ -1368,7 +1351,7 @@ void cmdRestartGame(AgiGame *state, uint8 *p) { state->_vm->_sound->stopSound(); sel = getflag(fAutoRestart) ? 0 : - state->_vm->selectionBox(" Restart _game, or continue? \n\n\n", buttons); + state->_vm->selectionBox(" Restart game, or continue? \n\n\n", buttons); if (sel == 0) { state->_vm->_restartGame = true; @@ -1442,7 +1425,8 @@ void cmdPreventInput(AgiGame *state, uint8 *p) { state->_vm->newInputMode(INPUT_NONE); state->inputEnabled = false; - state->_vm->clearPrompt(); + // Always clear with black background. Fixes bug #3080041. + state->_vm->clearPrompt(true); } void cmdGetString(AgiGame *state, uint8 *p) { @@ -1515,20 +1499,25 @@ void cmdSetCursorChar(AgiGame *state, uint8 *p) { } void cmdSetKey(AgiGame *state, uint8 *p) { - int key; + int key = 256 * p1 + p0; + int slot = -1; - if (state->lastController >= MAX_CONTROLLERS) { + for (int i = 0; i < MAX_CONTROLLERS; i++) { + if (slot == -1 && !state->controllers[i].keycode) + slot = i; + + if (state->controllers[i].keycode == key && state->controllers[i].controller == p2) + return; + } + + if (slot == -1) { warning("Number of set.keys exceeded %d", MAX_CONTROLLERS); return; } - debugC(4, kDebugLevelScripts, "%d %d %d", p0, p1, p2); - - key = 256 * p1 + p0; - - state->controllers[state->lastController].keycode = key; - state->controllers[state->lastController].controller = p2; - state->lastController++; + debugC(4, kDebugLevelScripts, "cmdSetKey: %d %d %d", p0, p1, p2); + state->controllers[slot].keycode = key; + state->controllers[slot].controller = p2; state->controllerOccured[p2] = false; } diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp index 34180b543f..0b5afc7f8c 100644 --- a/engines/agi/preagi.cpp +++ b/engines/agi/preagi.cpp @@ -54,21 +54,7 @@ PreAgiEngine::PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : } void PreAgiEngine::initialize() { - if (ConfMan.hasKey("render_mode")) { - _renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str()); - } else if (ConfMan.hasKey("platform")) { - switch (Common::parsePlatform(ConfMan.get("platform"))) { - case Common::kPlatformAmiga: - _renderMode = Common::kRenderAmiga; - break; - case Common::kPlatformPC: - _renderMode = Common::kRenderEGA; - break; - default: - _renderMode = Common::kRenderEGA; - break; - } - } + initRenderMode(); _gfx = new GfxMgr(this); _picture = new PictureMgr(this, _gfx); @@ -185,7 +171,6 @@ void PreAgiEngine::printStr(const char* szMsg) { clearTextArea(); drawStr(21, 0, IDA_DEFAULT, szMsg); _gfx->doUpdate(); - _system->updateScreen(); } void PreAgiEngine::XOR80(char *buffer) { @@ -284,7 +269,6 @@ void PreAgiEngine::waitForTimer(int msec_delay) { while (_system->getMillis() < start_time + msec_delay) { _gfx->doUpdate(); - _system->updateScreen(); _system->delayMillis(10); } } diff --git a/engines/agi/preagi.h b/engines/agi/preagi.h index 14ff483d9f..5d50fb5af8 100644 --- a/engines/agi/preagi.h +++ b/engines/agi/preagi.h @@ -73,8 +73,8 @@ protected: void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, int16 p4, int16 p5, int16 p6, int16 p7) {} void releaseImageStack() {} - int saveGame(const char *fileName, const char *saveName) { return -1; } - int loadGame(const char *fileName, bool checkId = true) { return -1; } + int saveGame(const Common::String &fileName, const Common::String &saveName) { return -1; } + int loadGame(const Common::String &fileName, bool checkId = true) { return -1; } // Game Common::String getTargetName() { return _targetName; } diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index 6d1eb445a2..ed4882fcab 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -150,7 +150,6 @@ void MickeyEngine::printStr(char *buffer) { // Show the string on screen _gfx->doUpdate(); - _system->updateScreen(); } void MickeyEngine::printLine(const char *buffer) { @@ -160,7 +159,6 @@ void MickeyEngine::printLine(const char *buffer) { // Show the string on screen _gfx->doUpdate(); - _system->updateScreen(); waitAnyKey(true); } @@ -284,7 +282,6 @@ void MickeyEngine::drawMenu(MSA_MENU menu, int sel0, int sel1) { // Menu created, show it on screen _gfx->doUpdate(); - _system->updateScreen(); } void MickeyEngine::getMouseMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow, int x, int y) { @@ -1364,7 +1361,6 @@ void MickeyEngine::flipSwitch() { strcpy(_gameStateMickey.szAddr, (char *)IDS_MSA_ADDR_PLANET[_gameStateMickey.iPlanetXtal[_gameStateMickey.nXtals]]); _gameStateMickey.nButtons = strlen(_gameStateMickey.szAddr); _gfx->doUpdate(); - _system->updateScreen(); // TODO: this should go in the game's main loop #endif waitAnyKey(true); @@ -1452,14 +1448,12 @@ void MickeyEngine::intro() { //Set screen to white _gfx->clearScreen(15); _gfx->doUpdate(); - _system->updateScreen(); _system->delayMillis(IDI_MSA_ANIM_DELAY); //Set back to black _gfx->clearScreen(0); _gfx->doUpdate(); - _system->updateScreen(); drawRoom(); printDesc(_gameStateMickey.iRoom); diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp index c2e2bef66e..50b2945383 100644 --- a/engines/agi/preagi_troll.cpp +++ b/engines/agi/preagi_troll.cpp @@ -362,7 +362,6 @@ void TrollEngine::intro() { drawStr(9, 10, kColorDefault, IDS_TRO_INTRO_0); drawStr(14, 15, kColorDefault, IDS_TRO_INTRO_1); _gfx->doUpdate(); - _system->updateScreen(); _system->delayMillis(3200); CursorMan.showMouse(true); diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index fee8fde2b3..cc5c2470ae 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -193,7 +193,6 @@ void WinnieEngine::intro() { drawPic(IDS_WTP_FILE_LOGO); printStr(IDS_WTP_INTRO_0); _gfx->doUpdate(); - _system->updateScreen(); _system->delayMillis(0x640); if (getPlatform() == Common::kPlatformAmiga) @@ -203,7 +202,6 @@ void WinnieEngine::intro() { printStr(IDS_WTP_INTRO_1); _gfx->doUpdate(); - _system->updateScreen(); _system->delayMillis(0x640); if (!playSound(IDI_WTP_SND_POOH_0)) @@ -455,7 +453,6 @@ int WinnieEngine::parser(int pc, int index, uint8 *buffer) { if (iBlock == 1) return IDI_WTP_PAR_OK; _gfx->doUpdate(); - _system->updateScreen(); } return IDI_WTP_PAR_OK; @@ -481,7 +478,6 @@ void WinnieEngine::inventory() { drawStr(IDI_WTP_ROW_OPTION_4, IDI_WTP_COL_MENU, IDA_DEFAULT, missing.c_str()); _gfx->doUpdate(); - _system->updateScreen(); //TODO: Move to game's main loop getSelection(kSelAnyKey); } @@ -760,7 +756,6 @@ void WinnieEngine::drawMenu(char *szMenu, int iSel, int fCanSel[]) { } drawStr(iRow, iCol - 1, IDA_DEFAULT, ">"); _gfx->doUpdate(); - _system->updateScreen(); //TODO: Move to game's main loop } void WinnieEngine::incMenuSel(int *iSel, int fCanSel[]) { @@ -1019,7 +1014,6 @@ phase0: readRoom(_room, roomdata, hdr); drawRoomPic(); _gfx->doUpdate(); - _system->updateScreen(); phase1: if (getObjInRoom(_room)) { diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index 28dd0a53dd..3cebbf50c8 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -53,22 +53,22 @@ namespace Agi { static const uint32 AGIflag = MKTAG('A','G','I',':'); -int AgiEngine::saveGame(const char *fileName, const char *description) { +int AgiEngine::saveGame(const Common::String &fileName, const Common::String &description) { char gameIDstring[8] = "gameIDX"; int i; Common::OutSaveFile *out; int result = errOK; - debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::saveGame(%s, %s)", fileName, description); + debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::saveGame(%s, %s)", fileName.c_str(), description.c_str()); if (!(out = _saveFileMan->openForSaving(fileName))) { - warning("Can't create file '%s', game not saved", fileName); + warning("Can't create file '%s', game not saved", fileName.c_str()); return errBadFileOpen; } else { - debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for writing", fileName); + debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for writing", fileName.c_str()); } out->writeUint32BE(AGIflag); - out->write(description, 31); + out->write(description.c_str(), 31); out->writeByte(SAVEGAME_VERSION); debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing save game version (%d)", SAVEGAME_VERSION); @@ -239,33 +239,33 @@ int AgiEngine::saveGame(const char *fileName, const char *description) { out->finalize(); if (out->err()) { - warning("Can't write file '%s'. (Disk full?)", fileName); + warning("Can't write file '%s'. (Disk full?)", fileName.c_str()); result = errIOError; } else - debugC(1, kDebugLevelMain | kDebugLevelSavegame, "Saved game %s in file %s", description, fileName); + debugC(1, kDebugLevelMain | kDebugLevelSavegame, "Saved game %s in file %s", description.c_str(), fileName.c_str()); delete out; - debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName); + debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName.c_str()); _lastSaveTime = _system->getMillis(); return result; } -int AgiEngine::loadGame(const char *fileName, bool checkId) { +int AgiEngine::loadGame(const Common::String &fileName, bool checkId) { char description[31], saveVersion, loadId[8]; int i, vtEntries = MAX_VIEWTABLE; uint8 t; int16 parm[7]; Common::InSaveFile *in; - debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::loadGame(%s)", fileName); + debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::loadGame(%s)", fileName.c_str()); if (!(in = _saveFileMan->openForLoading(fileName))) { - warning("Can't open file '%s', game not loaded", fileName); + warning("Can't open file '%s', game not loaded", fileName.c_str()); return errBadFileOpen; } else { - debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName); + debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName.c_str()); } uint32 typea = in->readUint32BE(); @@ -527,7 +527,7 @@ int AgiEngine::loadGame(const char *fileName, bool checkId) { _gfx->setAGIPal(in->readSint16BE()); delete in; - debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName); + debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName.c_str()); setflag(fRestoreJustRan, true); @@ -546,27 +546,27 @@ int AgiEngine::loadGame(const char *fileName, bool checkId) { #define NUM_SLOTS 100 #define NUM_VISIBLE_SLOTS 12 -const char *AgiEngine::getSavegameFilename(int num) { +Common::String AgiEngine::getSavegameFilename(int num) const { Common::String saveLoadSlot = _targetName; saveLoadSlot += Common::String::format(".%.3d", num); - return saveLoadSlot.c_str(); + return saveLoadSlot; } void AgiEngine::getSavegameDescription(int num, char *buf, bool showEmpty) { - char fileName[MAXPATHLEN]; Common::InSaveFile *in; + Common::String fileName = getSavegameFilename(num); debugC(4, kDebugLevelMain | kDebugLevelSavegame, "Current game id is %s", _targetName.c_str()); - sprintf(fileName, "%s", getSavegameFilename(num)); + if (!(in = _saveFileMan->openForLoading(fileName))) { - debugC(4, kDebugLevelMain | kDebugLevelSavegame, "File %s does not exist", fileName); + debugC(4, kDebugLevelMain | kDebugLevelSavegame, "File %s does not exist", fileName.c_str()); if (showEmpty) strcpy(buf, " (empty slot)"); else *buf = 0; } else { - debugC(4, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName); + debugC(4, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName.c_str()); uint32 type = in->readUint32BE(); @@ -782,7 +782,6 @@ getout: } int AgiEngine::saveGameDialog() { - char fileName[MAXPATHLEN]; char *desc; const char *buttons[] = { "Do as I say!", "I regret", NULL }; char dstr[200]; @@ -852,8 +851,8 @@ int AgiEngine::saveGameDialog() { return errOK; } - sprintf(fileName, "%s", getSavegameFilename(_firstSlot + slot)); - debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName); + Common::String fileName = getSavegameFilename(_firstSlot + slot); + debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName.c_str()); // Make sure all graphics was blitted to screen. This fixes bug // #2960567: "AGI: Ego partly erased in Load/Save thumbnails" @@ -870,14 +869,15 @@ int AgiEngine::saveGameDialog() { } int AgiEngine::saveGameSimple() { - int result = saveGame(getSavegameFilename(0), "Default savegame"); + Common::String fileName = getSavegameFilename(0); + + int result = saveGame(fileName, "Default savegame"); if (result != errOK) messageBox("Error saving game."); return result; } int AgiEngine::loadGameDialog() { - char fileName[MAXPATHLEN]; int rc, slot = 0; int hm, vm, hp, vp; // box margins int w; @@ -904,7 +904,7 @@ int AgiEngine::loadGameDialog() { return errOK; } - sprintf(fileName, "%s", getSavegameFilename(_firstSlot + slot)); + Common::String fileName = getSavegameFilename(_firstSlot + slot); if ((rc = loadGame(fileName)) == errOK) { messageBox("Game restored."); @@ -918,10 +918,9 @@ int AgiEngine::loadGameDialog() { } int AgiEngine::loadGameSimple() { - char fileName[MAXPATHLEN]; int rc = 0; - sprintf(fileName, "%s", getSavegameFilename(0)); + Common::String fileName = getSavegameFilename(0); _sprites->eraseBoth(); _sound->stopSound(); @@ -980,12 +979,12 @@ void AgiEngine::releaseImageStack() { void AgiEngine::checkQuickLoad() { if (ConfMan.hasKey("save_slot")) { - Common::String saveNameBuffer = Common::String::format("%s.%03d", _targetName.c_str(), ConfMan.getInt("save_slot")); + Common::String saveNameBuffer = getSavegameFilename(ConfMan.getInt("save_slot")); _sprites->eraseBoth(); _sound->stopSound(); - if (loadGame(saveNameBuffer.c_str(), false) == errOK) { // Do not check game id + if (loadGame(saveNameBuffer, false) == errOK) { // Do not check game id _game.exitAllLogics = 1; _menu->enableAll(); } @@ -993,8 +992,7 @@ void AgiEngine::checkQuickLoad() { } Common::Error AgiEngine::loadGameState(int slot) { - char saveLoadSlot[12]; - sprintf(saveLoadSlot, "%s.%.3d", _targetName.c_str(), slot); + Common::String saveLoadSlot = getSavegameFilename(slot); _sprites->eraseBoth(); _sound->stopSound(); @@ -1009,9 +1007,8 @@ Common::Error AgiEngine::loadGameState(int slot) { } Common::Error AgiEngine::saveGameState(int slot, const Common::String &desc) { - char saveLoadSlot[12]; - sprintf(saveLoadSlot, "%s.%.3d", _targetName.c_str(), slot); - if (saveGame(saveLoadSlot, desc.c_str()) == errOK) + Common::String saveLoadSlot = getSavegameFilename(slot); + if (saveGame(saveLoadSlot, desc) == errOK) return Common::kNoError; else return Common::kUnknownError; diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp index cec0895073..8d13be3f68 100644 --- a/engines/agi/sprite.cpp +++ b/engines/agi/sprite.cpp @@ -702,6 +702,21 @@ void SpritesMgr::commitBlock(int x1, int y1, int x2, int y2, bool immediate) { y1 = CLIP(y1, 0, _HEIGHT - 1); y2 = CLIP(y2, 0, _HEIGHT - 1); + // Check if a window is active, and clip the block commited to exclude the + // window's contents. Fixes bug #3295652, and partially fixes bug #3080415. + AgiBlock &window = _vm->_game.window; + if (window.active) { + if (y1 < window.y2 && y2 > window.y2 && (x1 < window.x2 || x2 > window.x1)) { + // The top of the block covers the bottom of the window + y1 = window.y2; + } + + if (y1 < window.y1 && y2 > window.y1 && (x1 < window.x2 || x2 > window.x1)) { + // The bottom of the block covers the top of the window + y2 = window.y1; + } + } + debugC(7, kDebugLevelSprites, "commitBlock(%d, %d, %d, %d)", x1, y1, x2, y2); w = x2 - x1 + 1; diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp index 82a2340ad6..502db4bdba 100644 --- a/engines/agi/text.cpp +++ b/engines/agi/text.cpp @@ -62,22 +62,18 @@ void AgiEngine::printText2(int l, const char *msg, int foff, int xoff, int yoff, for (m = (const unsigned char *)msg, x1 = y1 = 0; *m; m++) { - if (*m >= 0x20 || *m == 1 || *m == 2 || *m == 3) { - // FIXME: Fingolfin asks: why is there a FIXME here? Please either clarify what - // needs fixing, or remove it! - // FIXME - int ypos; - - ypos = (y1 * CHAR_LINES) + yoff; + // Note: there were extra checks for *m being a cursor character + // here (1, 2 or 3), which have been removed, as the cursor + // character is no longer printed via this function. + if (*m >= 0x20) { + int ypos = (y1 * CHAR_LINES) + yoff; if ((x1 != (len - 1) || x1 == 39) && (ypos <= (GFX_HEIGHT - CHAR_LINES))) { - int xpos; - - xpos = (x1 * CHAR_COLS) + xoff + foff; + int xpos = (x1 * CHAR_COLS) + xoff + foff; if (xpos >= GFX_WIDTH) continue; - + _gfx->putTextCharacter(l, xpos, ypos, *m, fg, bg, checkerboard); if (x1 > maxx) @@ -88,15 +84,17 @@ void AgiEngine::printText2(int l, const char *msg, int foff, int xoff, int yoff, x1++; - // DF: changed the len-1 to len... - // FIXME: m[len] doesn't make sense and may read out of bounds? - if (x1 == len && m[len] != '\n') { + // Change line if we've reached the end of this one, unless the next + // character is a new line itself, or the end of the string + if (x1 == len && m[1] != '\n' && m[1] != 0) { y1++; x1 = foff = 0; } } else { - y1++; - x1 = foff = 0; + if (m[1] != 0) { + y1++; + x1 = foff = 0; + } } } } @@ -223,14 +221,17 @@ void AgiEngine::printTextConsole(const char *msg, int x, int y, int len, int fg, * @param str String to wrap. * @param len Length of line. * - * Based on GBAGI implementaiton with permission from the author + * Based on GBAGI implementation with permission from the author */ char *AgiEngine::wordWrapString(const char *s, int *len) { char *outStr, *msgBuf, maxWidth = *len; const char *pWord; int lnLen, wLen; - msgBuf = outStr = strdup(s); + // Allocate some extra space for the final buffer, as + // outStr may end up being longer than s + // 26 = 200 (screen height) / 8 (font height) + 1 + msgBuf = outStr = (char *)malloc(strlen(s) + 26); int msgWidth = 0; @@ -249,6 +250,8 @@ char *AgiEngine::wordWrapString(const char *s, int *len) { wLen--; if (wLen + lnLen >= maxWidth) { + // Check if outStr isn't msgBuf. If this is the case, outStr hasn't advanced + // yet, so no output has been written yet if (outStr != msgBuf) { if (outStr[-1] == ' ') outStr[-1] = '\n'; @@ -438,12 +441,6 @@ int AgiEngine::print(const char *p, int lin, int col, int len) { debugC(4, kDebugLevelText, "print(): lin = %d, col = %d, len = %d", lin, col, len); - if (col == 0 && lin == 0 && len == 0) - lin = col = -1; - - if (len == 0) - len = 30; - blitTextbox(p, lin, col, len); if (getflag(fOutputMode)) { @@ -675,11 +672,11 @@ void AgiEngine::writePrompt() { _gfx->doUpdate(); } -void AgiEngine::clearPrompt() { +void AgiEngine::clearPrompt(bool useBlackBg) { int l; l = _game.lineUserInput; - clearLines(l, l, _game.colorBg); + clearLines(l, l, useBlackBg ? 0 : _game.colorBg); flushLines(l, l); _gfx->doUpdate(); diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index 0baae11e89..69447f4b83 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -799,7 +799,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { uint32 offs, size; if (getFeatures() & GF_OLD_BUNDLE) { - Common::File in; + Common::SeekableReadStream *in; char filename[15]; if (id == 23) id = 112; @@ -815,22 +815,22 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { sprintf(filename, "0%d.VGA", id); } - in.open(filename); - if (in.isOpen() == false) + in = _archives.open(filename); + if (!in) error("loadSimonVGAFile: Can't load %s", filename); - size = in.size(); + size = in->size(); if (getFeatures() & GF_CRUNCHED) { byte *srcBuffer = (byte *)malloc(size); - if (in.read(srcBuffer, size) != size) + if (in->read(srcBuffer, size) != size) error("loadSimonVGAFile: Read failed"); decrunchFile(srcBuffer, _vgaBufferPointers[11].vgaFile2, size); free(srcBuffer); } else { - if (in.read(_vgaBufferPointers[11].vgaFile2, size) != size) + if (in->read(_vgaBufferPointers[11].vgaFile2, size) != size) error("loadSimonVGAFile: Read failed"); } - in.close(); + delete in; } else { offs = _gameOffsetsPtr[id]; @@ -840,7 +840,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) { } void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { - Common::File in; + Common::SeekableReadStream *in; char filename[15]; byte *dst; uint32 file, offs, srcSize, dstSize; @@ -893,8 +893,8 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { } } - in.open(filename); - if (in.isOpen() == false) { + in = _archives.open(filename); + if (!in) { if (useError) error("loadVGAVideoFile: Can't load %s", filename); @@ -902,11 +902,11 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { return; } - dstSize = srcSize = in.size(); + dstSize = srcSize = in->size(); if (getGameType() == GType_PN && getPlatform() == Common::kPlatformPC && id == 17 && type == 2) { // The A2.out file isn't compressed in PC version of Personal Nightmare dst = allocBlock(dstSize + extraBuffer); - if (in.read(dst, dstSize) != dstSize) + if (in->read(dst, dstSize) != dstSize) error("loadVGAVideoFile: Read failed"); } else if (getGameType() == GType_PN && (getFeatures() & GF_CRUNCHED)) { Common::Stack<uint32> data; @@ -914,7 +914,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { int dataOutSize = 0; for (uint i = 0; i < srcSize / 4; ++i) { - uint32 dataVal = in.readUint32BE(); + uint32 dataVal = in->readUint32BE(); // Correct incorrect byte, in corrupt 72.out file, included in some PC versions. if (dataVal == 168042714) data.push(168050906); @@ -928,7 +928,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { delete[] dataOut; } else if (getFeatures() & GF_CRUNCHED) { byte *srcBuffer = (byte *)malloc(srcSize); - if (in.read(srcBuffer, srcSize) != srcSize) + if (in->read(srcBuffer, srcSize) != srcSize) error("loadVGAVideoFile: Read failed"); dstSize = READ_BE_UINT32(srcBuffer + srcSize - 4); @@ -937,10 +937,10 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) { free(srcBuffer); } else { dst = allocBlock(dstSize + extraBuffer); - if (in.read(dst, dstSize) != dstSize) + if (in->read(dst, dstSize) != dstSize) error("loadVGAVideoFile: Read failed"); } - in.close(); + delete in; } else { id = id * 2 + (type - 1); offs = _gameOffsetsPtr[id]; diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp index 9cb741454c..646689e99e 100644 --- a/engines/cge/sound.cpp +++ b/engines/cge/sound.cpp @@ -260,6 +260,8 @@ void MusicPlayer::sndMidiStart() { syncVolume(); + // Al the tracks are supposed to loop + _isLooping = true; _isPlaying = true; } } diff --git a/engines/made/screenfx.cpp b/engines/made/screenfx.cpp index bdc36c87d7..77220a0ff5 100644 --- a/engines/made/screenfx.cpp +++ b/engines/made/screenfx.cpp @@ -58,11 +58,6 @@ ScreenEffects::~ScreenEffects() { } void ScreenEffects::run(int16 effectNum, Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { - // Workaround: we set up the final palette beforehand, to reduce CPU usage during the screen effect. - // The visual difference is not noticeable, but CPU load is much much less (as palette updates are very expensive). - // The palette changes in the effects have been removed, where applicable, to reduce CPU load - setPalette(palette); - // TODO: Put effect functions into an array switch (effectNum) { @@ -188,6 +183,28 @@ void ScreenEffects::setBlendedPalette(byte *palette, byte *newPalette, int color } } +void ScreenEffects::startBlendedPalette(byte *palette, byte *newPalette, int colorCount, int16 maxValue) { + _blendedPaletteStatus._palette = palette; + _blendedPaletteStatus._newPalette = newPalette; + _blendedPaletteStatus._colorCount = colorCount; + _blendedPaletteStatus._maxValue = maxValue; + _blendedPaletteStatus._incr = maxValue / 10; // ~10 palette updates + _blendedPaletteStatus._value = 0; + // Don't do anything if the two palettes are identical + _blendedPaletteStatus._active = memcmp(palette, newPalette, colorCount * 3) != 0; +} + +void ScreenEffects::stepBlendedPalette() { + if (_blendedPaletteStatus._active && _blendedPaletteStatus._value < _blendedPaletteStatus._maxValue) { + setBlendedPalette(_blendedPaletteStatus._palette, _blendedPaletteStatus._newPalette, + _blendedPaletteStatus._colorCount, _blendedPaletteStatus._value, _blendedPaletteStatus._maxValue); + if (_blendedPaletteStatus._value == _blendedPaletteStatus._maxValue) + _blendedPaletteStatus._value++; + else + _blendedPaletteStatus._value = MIN<int16>(_blendedPaletteStatus._value + _blendedPaletteStatus._incr, _blendedPaletteStatus._maxValue); + } +} + void ScreenEffects::copyFxRect(Graphics::Surface *surface, int16 x1, int16 y1, int16 x2, int16 y2) { // TODO: Clean up @@ -273,71 +290,78 @@ void ScreenEffects::vfx00(Graphics::Surface *surface, byte *palette, byte *newPa } void ScreenEffects::vfx01(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + startBlendedPalette(palette, newPalette, colorCount, 312); for (int x = 0; x < 320; x += 8) { _screen->copyRectToScreen((const byte*)surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200); - //setBlendedPalette(palette, newPalette, colorCount, x, 312); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } void ScreenEffects::vfx02(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + startBlendedPalette(palette, newPalette, colorCount, 312); for (int x = 312; x >= 0; x -= 8) { _screen->copyRectToScreen((const byte*)surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200); - //setBlendedPalette(palette, newPalette, colorCount, 312 - x, 312); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } void ScreenEffects::vfx03(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + startBlendedPalette(palette, newPalette, colorCount, 190); for (int y = 0; y < 200; y += 10) { _screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10); - //setBlendedPalette(palette, newPalette, colorCount, y, 190); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } void ScreenEffects::vfx04(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + startBlendedPalette(palette, newPalette, colorCount, 190); for (int y = 190; y >= 0; y -= 10) { _screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10); - //setBlendedPalette(palette, newPalette, colorCount, 190 - y, 190); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } void ScreenEffects::vfx05(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + startBlendedPalette(palette, newPalette, colorCount, 90); for (int y = 0; y < 100; y += 10) { _screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y + 100), surface->pitch, 0, y + 100, 320, 10); _screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 90 - y), surface->pitch, 0, 90 - y, 320, 10); - //setBlendedPalette(palette, newPalette, colorCount, y, 90); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } // "Curtain open" effect void ScreenEffects::vfx06(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + startBlendedPalette(palette, newPalette, colorCount, 152); for (int x = 0; x < 160; x += 8) { _screen->copyRectToScreen((const byte*)surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200); _screen->copyRectToScreen((const byte*)surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200); - //setBlendedPalette(palette, newPalette, colorCount, x, 152); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } // "Curtain close" effect void ScreenEffects::vfx07(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + startBlendedPalette(palette, newPalette, colorCount, 152); for (int x = 152; x >= 0; x -= 8) { _screen->copyRectToScreen((const byte*)surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200); _screen->copyRectToScreen((const byte*)surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200); - //setBlendedPalette(palette, newPalette, colorCount, 152 - x, 152); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } // "Screen slide in" right to left @@ -346,7 +370,7 @@ void ScreenEffects::vfx08(Graphics::Surface *surface, byte *palette, byte *newPa _screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 0), surface->pitch, 320 - x, 0, x, 200); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } // "Checkerboard" effect @@ -365,77 +389,84 @@ void ScreenEffects::vfx09(Graphics::Surface *surface, byte *palette, byte *newPa // "Screen wipe in", left to right void ScreenEffects::vfx10(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + startBlendedPalette(palette, newPalette, colorCount, 368); for (int x = -56; x < 312; x += 8) { copyFxRect(surface, x, 0, x + 64, 200); - //setBlendedPalette(palette, newPalette, colorCount, x + 56, 368); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } // "Screen wipe in", right to left void ScreenEffects::vfx11(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + startBlendedPalette(palette, newPalette, colorCount, 368); for (int x = 312; x > -56; x -= 8) { copyFxRect(surface, x, 0, x + 64, 200); - //setBlendedPalette(palette, newPalette, colorCount, x + 56, 368); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } // "Screen wipe in", top to bottom void ScreenEffects::vfx12(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + startBlendedPalette(palette, newPalette, colorCount, 260); for (int y = -70; y < 312; y += 10) { copyFxRect(surface, 0, y, 320, y + 80); - //setBlendedPalette(palette, newPalette, colorCount, y + 70, 260); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } // "Screen wipe in", bottom to top void ScreenEffects::vfx13(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { + startBlendedPalette(palette, newPalette, colorCount, 260); for (int y = 312; y > -70; y -= 10) { copyFxRect(surface, 0, y, 320, y + 80); - //setBlendedPalette(palette, newPalette, colorCount, y + 70, 260); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } // "Screen open" effect void ScreenEffects::vfx14(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { int16 x = 8, y = 5; + startBlendedPalette(palette, newPalette, colorCount, 27); for (int i = 0; i < 27; i++) { copyFxRect(surface, 160 - x, 100 - y, 160 + x, 100 + y); x += 8; y += 5; - //setBlendedPalette(palette, newPalette, colorCount, i, 27); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } void ScreenEffects::vfx15(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { int16 x = 8; + startBlendedPalette(palette, newPalette, colorCount, 27); for (int i = 0; i < 27; i++) { copyFxRect(surface, 160 - x, 0, 160 + x, 200); x += 8; - //setBlendedPalette(palette, newPalette, colorCount, i, 27); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } void ScreenEffects::vfx16(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) { int16 y = 8; + startBlendedPalette(palette, newPalette, colorCount, 27); for (int i = 0; i < 27; i++) { copyFxRect(surface, 0, 100 - y, 320, 100 + y); y += 5; - //setBlendedPalette(palette, newPalette, colorCount, i, 27); // original behavior + stepBlendedPalette(); _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } // Palette fadeout/fadein @@ -448,16 +479,12 @@ void ScreenEffects::vfx17(Graphics::Surface *surface, byte *palette, byte *newPa memcpy(tempPalette, palette, 768); - // We reduce the number of palette updates by the following factor (e.g. a factor of 5 would mean 5 - // times less updates). This is done to reduce CPU load while performing the very expensive full - // screen palette changes. The original behavior is to set factor to 1. - int factor = 5; - // Fade out to black memset(palette, 0, 768); - for (int i = 0; i < 50 / factor; i++) { - setBlendedPalette(palette, newPalette, colorCount, i * factor, 50); - _screen->updateScreenAndWait(25 * factor); + startBlendedPalette(palette, newPalette, colorCount, 50); + for (int i = 0; i < 50; i++) { + stepBlendedPalette(); + _screen->updateScreenAndWait(25); } _screen->setRGBPalette(palette, 0, colorCount); @@ -467,9 +494,10 @@ void ScreenEffects::vfx17(Graphics::Surface *surface, byte *palette, byte *newPa // Fade from black to palette memset(newPalette, 0, 768); - for (int i = 0; i < 50 / factor; i++) { - setBlendedPalette(palette, newPalette, colorCount, i * factor, 50); - _screen->updateScreenAndWait(25 * factor); + startBlendedPalette(palette, newPalette, colorCount, 50); + for (int i = 0; i < 50; i++) { + stepBlendedPalette(); + _screen->updateScreenAndWait(25); } _screen->setRGBPalette(palette, 0, colorCount); @@ -484,7 +512,7 @@ void ScreenEffects::vfx18(Graphics::Surface *surface, byte *palette, byte *newPa _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } // "Screen slide in" top to bottom @@ -494,7 +522,7 @@ void ScreenEffects::vfx19(Graphics::Surface *surface, byte *palette, byte *newPa _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } // "Screen slide in" bottom to top @@ -504,7 +532,7 @@ void ScreenEffects::vfx20(Graphics::Surface *surface, byte *palette, byte *newPa _screen->updateScreenAndWait(25); } - //setPalette(palette); // original behavior + setPalette(palette); } } // End of namespace Made diff --git a/engines/made/screenfx.h b/engines/made/screenfx.h index 793fcba2d6..6011da7d6f 100644 --- a/engines/made/screenfx.h +++ b/engines/made/screenfx.h @@ -34,6 +34,14 @@ namespace Made { +struct BlendedPaletteStatus { + bool _active; + byte *_palette, *_newPalette; + int _colorCount; + int16 _value, _maxValue, _incr; + int cnt; +}; + class ScreenEffects { public: ScreenEffects(Screen *screen); @@ -47,8 +55,12 @@ private: static const byte vfxOffsIndexTable[8]; const byte *vfxOffsTablePtr; int16 vfxX1, vfxY1, vfxWidth, vfxHeight; + BlendedPaletteStatus _blendedPaletteStatus; + void setPalette(byte *palette); void setBlendedPalette(byte *palette, byte *newPalette, int colorCount, int16 value, int16 maxValue); + void startBlendedPalette(byte *palette, byte *newPalette, int colorCount, int16 maxValue); + void stepBlendedPalette(); void copyFxRect(Graphics::Surface *surface, int16 x1, int16 y1, int16 x2, int16 y2); void vfx00(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount); diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h index b2c15cc4ed..25ca9cd916 100644 --- a/engines/mohawk/detection_tables.h +++ b/engines/mohawk/detection_tables.h @@ -700,6 +700,22 @@ static const MohawkGameDescription gameDescriptions[] = { 0 }, + // From afholman in bug #3309306 + { + { + "lbsampler", + "v3", + AD_ENTRY1("outline", "8397cea6bed1ff90029f7602ef37684d"), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + Common::GUIO_NONE + }, + GType_LIVINGBOOKSV3, + 0, + "Living Books Sampler" + }, + { { "maggiesfa", @@ -1221,7 +1237,7 @@ static const MohawkGameDescription gameDescriptions[] = { AD_ENTRY1("OUTLINE", "159c18b663c58d1aa17ad5e1ab1f0e12"), Common::EN_ANY, Common::kPlatformWindows, - ADGF_NO_FLAGS, + ADGF_UNSTABLE, Common::GUIO_NONE }, GType_LIVINGBOOKSV3, @@ -1605,6 +1621,23 @@ static const MohawkGameDescription gameDescriptions[] = { "Living Books Player" }, + // Arthur Birthday (English) Version 2.0 Windows(R) August 8, 1997 + // From jacecen in bug #3413119 + { + { + "arthurbday", + "", + AD_ENTRY1("Outline", "3b793adf2b303722e0fb6c632f94e1fb"), + Common::EN_ANY, + Common::kPlatformWindows, + ADGF_UNSTABLE, + Common::GUIO_NONE + }, + GType_LIVINGBOOKSV3, + 0, + 0 + }, + { { "arthurbday", diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index a37c4439a1..2fffc9071c 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -899,22 +899,23 @@ void CharacterName::bind(const char *name) { _dummy = IS_DUMMY_CHARACTER(name); if (!_dummy) { - if (!strstr(name, "donna")) { + if (!strcmp(name, "donna")) { _engineFlags &= ~kEngineTransformedDonna; - } else - if (_engineFlags & kEngineTransformedDonna) { - _suffix = _suffixTras; } else { - const char *s = strstr(name, "tras"); - if (s) { - _engineFlags |= kEngineTransformedDonna; + if (_engineFlags & kEngineTransformedDonna) { _suffix = _suffixTras; - end = s; + } else { + const char *s = strstr(name, "tras"); + if (s) { + _engineFlags |= kEngineTransformedDonna; + _suffix = _suffixTras; + end = s; + } + } + if (IS_MINI_CHARACTER(name)) { + _prefix = _prefixMini; + begin = name + 4; } - } - if (IS_MINI_CHARACTER(name)) { - _prefix = _prefixMini; - begin = name+4; } } diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp index 100b608172..a73f1558e8 100644 --- a/engines/parallaction/parser_ns.cpp +++ b/engines/parallaction/parser_ns.cpp @@ -1334,6 +1334,21 @@ void LocationParser_ns::parseGetData(ZonePtr z) { obj->x = z->getX(); obj->y = z->getY(); obj->_prog = _zoneProg; + + // WORKAROUND for script bug #2969913 + // The katana object has the same default z index (kGfxObjGetZ or -100) + // as the cripta object (the safe) - a script bug. + // Game scripts do not set an explicit z for the katana (as it isn't an + // animation), but rather rely on the draw order to draw it over the + // safe. In this particular case, the safe is added to the scene after + // the katana, thus it is drawn over the katana. We explicitly set the + // z index of the katana to be higher than the safe, so that the katana + // is drawn correctly over it. + // This is a regression from the graphics rewrite (commits be2c5d3, + // 3c2c16c and 44906f5). + if (!scumm_stricmp(obj->getName(), "katana")) + obj->z = 0; + bool visible = (z->_flags & kFlagsRemove) == 0; _vm->_gfx->showGfxObj(obj, visible); data->_gfxobj = obj; diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index 783845bb76..1a9359bb26 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -201,8 +201,8 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { char xfer; int i; int startarg; - int str_leng = 0; /* Used for stuff like "%13s" */ - int unsigned_var = 0; + int strLength = 0; /* Used for stuff like "%13s" */ + bool unsignedVar = false; if (position.segment) startarg = 2; @@ -236,7 +236,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { mode = 0; } else { mode = 1; - str_leng = 0; + strLength = 0; } } else if (mode == 1) { /* xfer != '%' */ char fillchar = ' '; @@ -256,22 +256,22 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { else if (isdigit(static_cast<unsigned char>(xfer)) || (xfer == '-')) source--; // Go to start of length argument - str_leng = strtol(source, &destp, 10); + strLength = strtol(source, &destp, 10); if (destp > source) source = destp; - if (str_leng < 0) { + if (strLength < 0) { align = ALIGN_LEFT; - str_leng = -str_leng; + strLength = -strLength; } else if (align != ALIGN_CENTER) align = ALIGN_RIGHT; xfer = *source++; } else - str_leng = 0; + strLength = 0; - assert((target - targetbuf) + str_leng + 1 <= maxsize); + assert((target - targetbuf) + strLength + 1 <= maxsize); switch (xfer) { case 's': { /* Copy string */ @@ -286,7 +286,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { Common::String tempsource = g_sci->getKernel()->lookupText(reg, arguments[paramindex + 1]); int slen = strlen(tempsource.c_str()); - int extralen = str_leng - slen; + int extralen = strLength - slen; assert((target - targetbuf) + extralen <= maxsize); if (extralen < 0) extralen = 0; @@ -342,7 +342,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { case 'c': { /* insert character */ assert((target - targetbuf) + 2 <= maxsize); if (align >= 0) - while (str_leng-- > 1) + while (strLength-- > 1) *target++ = ' '; /* Format into the text */ char argchar = arguments[paramindex++]; if (argchar) @@ -353,8 +353,14 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { case 'x': case 'u': - unsigned_var = 1; + unsignedVar = true; case 'd': { /* Copy decimal */ + // In the new SCI2 kString function, %d is used for unsigned + // integers. An example is script 962 in Shivers - it uses %d + // to create file names. + if (getSciVersion() >= SCI_VERSION_2) + unsignedVar = true; + /* int templen; -- unused atm */ const char *format_string = "%d"; @@ -362,14 +368,14 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { format_string = "%x"; int val = arguments[paramindex]; - if (!unsigned_var) + if (!unsignedVar) val = (int16)arguments[paramindex]; target += sprintf(target, format_string, val); paramindex++; assert((target - targetbuf) <= maxsize); - unsigned_var = 0; + unsignedVar = false; mode = 0; } @@ -384,7 +390,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { if (align) { int written = target - writestart; - int padding = str_leng - written; + int padding = strLength - written; if (padding > 0) { if (align > 0) { diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index e43c7097ed..c30518ab42 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -626,12 +626,8 @@ void SoundCommandParser::reconstructPlayList() { const MusicList::iterator end = _music->getPlayListEnd(); for (MusicList::iterator i = _music->getPlayListStart(); i != end; ++i) { - if ((*i)->resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, (*i)->resourceId))) { - (*i)->soundRes = new SoundResource((*i)->resourceId, _resMan, _soundVersion); - _music->soundInitSnd(*i); - } else { - (*i)->soundRes = 0; - } + initSoundResource(*i); + if ((*i)->status == kSoundPlaying) { // Sync the sound object's selectors related to playing with the stored // ones in the playlist, as they may have been invalidated when loading. diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp index 38919593b4..5f703b90e3 100644 --- a/engines/sci/graphics/palette.cpp +++ b/engines/sci/graphics/palette.cpp @@ -114,7 +114,7 @@ bool GfxPalette::isMerging() { void GfxPalette::setDefault() { if (_resMan->getViewType() == kViewEga) setEGA(); - else if (_resMan->getViewType() == kViewAmiga) + else if (_resMan->getViewType() == kViewAmiga || _resMan->getViewType() == kViewAmiga64) setAmiga(); else kernelSetFromResource(999, true); @@ -206,6 +206,14 @@ bool GfxPalette::setAmiga() { _sysPalette.colors[curColor].r = (byte1 & 0x0F) * 0x11; _sysPalette.colors[curColor].g = ((byte2 & 0xF0) >> 4) * 0x11; _sysPalette.colors[curColor].b = (byte2 & 0x0F) * 0x11; + + if (_totalScreenColors == 64) { + // Set the associated color from the Amiga halfbrite colors + _sysPalette.colors[curColor + 32].used = 1; + _sysPalette.colors[curColor + 32].r = _sysPalette.colors[curColor].r >> 1; + _sysPalette.colors[curColor + 32].g = _sysPalette.colors[curColor].g >> 1; + _sysPalette.colors[curColor + 32].b = _sysPalette.colors[curColor].b >> 1; + } } // Directly set the palette, because setOnScreen() wont do a thing for amiga @@ -226,6 +234,13 @@ void GfxPalette::modifyAmigaPalette(byte *data) { _sysPalette.colors[curColor].r = (byte1 & 0x0F) * 0x11; _sysPalette.colors[curColor].g = ((byte2 & 0xF0) >> 4) * 0x11; _sysPalette.colors[curColor].b = (byte2 & 0x0F) * 0x11; + + if (_totalScreenColors == 64) { + // Set the associated color from the Amiga halfbrite colors + _sysPalette.colors[curColor + 32].r = _sysPalette.colors[curColor].r >> 1; + _sysPalette.colors[curColor + 32].g = _sysPalette.colors[curColor].g >> 1; + _sysPalette.colors[curColor + 32].b = _sysPalette.colors[curColor].b >> 1; + } } copySysPaletteToScreen(); diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp index ecb54e89e8..dad2b77036 100644 --- a/engines/sci/graphics/picture.cpp +++ b/engines/sci/graphics/picture.cpp @@ -740,7 +740,7 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) { // Left-Over VGA palette, we simply ignore it curPos += 256 + 4 + 1024; } else { - // Setting half of the amiga palette + // Setting half of the Amiga palette _palette->modifyAmigaPalette(&data[curPos]); curPos += 32; } diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp index 6ca4903e17..a0d5b51a2b 100644 --- a/engines/sci/graphics/view.cpp +++ b/engines/sci/graphics/view.cpp @@ -471,7 +471,8 @@ void unpackCelData(byte *inBuffer, byte *celBitmap, byte clearColor, int pixelCo curByte = *rlePtr++; if (curByte & 0xC0) { // fill with color runLength = curByte >> 6; - memset(outPtr + pixelNr, curByte & 0x3F, MIN<uint16>(runLength, pixelCount - pixelNr)); + curByte = curByte & 0x3F; + memset(outPtr + pixelNr, curByte, MIN<uint16>(runLength, pixelCount - pixelNr)); } else { // skip the next pixels (transparency) runLength = curByte & 0x3F; } diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp index e73df69375..a91b103214 100644 --- a/engines/sci/sound/soundcmd.cpp +++ b/engines/sci/sound/soundcmd.cpp @@ -37,6 +37,7 @@ SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segM _music = new SciMusic(_soundVersion); _music->init(); + _bMultiMidi = ConfMan.getBool("multi_midi"); } SoundCommandParser::~SoundCommandParser() { @@ -63,6 +64,35 @@ int SoundCommandParser::getSoundResourceId(reg_t obj) { return resourceId; } +void SoundCommandParser::initSoundResource(MusicEntry *newSound) { + if (newSound->resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, newSound->resourceId))) + newSound->soundRes = new SoundResource(newSound->resourceId, _resMan, _soundVersion); + else + newSound->soundRes = 0; + + // In SCI1.1 games, sound effects are started from here. If we can find + // a relevant audio resource, play it, otherwise switch to synthesized + // effects. If the resource exists, play it using map 65535 (sound + // effects map) + bool checkAudioResource = getSciVersion() >= SCI_VERSION_1_1; + if (g_sci->getGameId() == GID_HOYLE4) + checkAudioResource = false; // hoyle 4 has garbled audio resources in place of the sound resources + // if we play those, we will only make the user deaf and break speakers. Sierra SCI doesn't play anything + // on soundblaster. FIXME: check, why this is + + if (checkAudioResource && _resMan->testResource(ResourceId(kResourceTypeAudio, newSound->resourceId))) { + // Found a relevant audio resource, create an audio stream + if (_bMultiMidi || !newSound->soundRes) { + int sampleLen; + newSound->pStreamAud = _audio->getAudioStream(newSound->resourceId, 65535, &sampleLen); + newSound->soundType = Audio::Mixer::kSpeechSoundType; + } + } + + if (!newSound->pStreamAud && newSound->soundRes) + _music->soundInitSnd(newSound); +} + void SoundCommandParser::processInitSound(reg_t obj) { int resourceId = getSoundResourceId(obj); @@ -73,11 +103,6 @@ void SoundCommandParser::processInitSound(reg_t obj) { MusicEntry *newSound = new MusicEntry(); newSound->resourceId = resourceId; - if (resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, resourceId))) - newSound->soundRes = new SoundResource(resourceId, _resMan, _soundVersion); - else - newSound->soundRes = 0; - newSound->soundObj = obj; newSound->loop = readSelectorValue(_segMan, obj, SELECTOR(loop)); newSound->priority = readSelectorValue(_segMan, obj, SELECTOR(pri)) & 0xFF; @@ -88,25 +113,7 @@ void SoundCommandParser::processInitSound(reg_t obj) { debugC(kDebugLevelSound, "kDoSound(init): %04x:%04x number %d, loop %d, prio %d, vol %d", PRINT_REG(obj), resourceId, newSound->loop, newSound->priority, newSound->volume); - // In SCI1.1 games, sound effects are started from here. If we can find - // a relevant audio resource, play it, otherwise switch to synthesized - // effects. If the resource exists, play it using map 65535 (sound - // effects map) - bool checkAudioResource = getSciVersion() >= SCI_VERSION_1_1; - if (g_sci->getGameId() == GID_HOYLE4) - checkAudioResource = false; // hoyle 4 has garbled audio resources in place of the sound resources - // if we play those, we will only make the user deaf and break speakers. Sierra SCI doesn't play anything - // on soundblaster. FIXME: check, why this is - - if (checkAudioResource && _resMan->testResource(ResourceId(kResourceTypeAudio, resourceId))) { - // Found a relevant audio resource, play it - int sampleLen; - newSound->pStreamAud = _audio->getAudioStream(resourceId, 65535, &sampleLen); - newSound->soundType = Audio::Mixer::kSpeechSoundType; - } else { - if (newSound->soundRes) - _music->soundInitSnd(newSound); - } + initSoundResource(newSound); _music->pushBackSlot(newSound); @@ -163,6 +170,9 @@ void SoundCommandParser::processPlaySound(reg_t obj) { musicSlot->loop = readSelectorValue(_segMan, obj, SELECTOR(loop)); musicSlot->priority = readSelectorValue(_segMan, obj, SELECTOR(priority)); + // Reset hold when starting a new song. kDoSoundSetHold is always called after + // kDoSoundPlay to set it properly, if needed. Fixes bug #3413589. + musicSlot->hold = -1; if (_soundVersion >= SCI_VERSION_1_EARLY) musicSlot->volume = readSelectorValue(_segMan, obj, SELECTOR(vol)); diff --git a/engines/sci/sound/soundcmd.h b/engines/sci/sound/soundcmd.h index 7f6e2a0fe8..c1dce014d2 100644 --- a/engines/sci/sound/soundcmd.h +++ b/engines/sci/sound/soundcmd.h @@ -32,6 +32,7 @@ namespace Sci { class Console; class SciMusic; class SoundCommandParser; +class MusicEntry; //typedef void (SoundCommandParser::*SoundCommand)(reg_t obj, int16 value); //struct MusicEntryCommand { @@ -64,6 +65,7 @@ public: void processPlaySound(reg_t obj); void processStopSound(reg_t obj, bool sampleFinishedPlaying); + void initSoundResource(MusicEntry *newSound); MusicType getMusicType() const; @@ -109,6 +111,7 @@ private: SciMusic *_music; AudioPlayer *_audio; SciVersion _soundVersion; + bool _bMultiMidi; void processInitSound(reg_t obj); void processDisposeSound(reg_t obj); diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp index 1ef223ab9e..2d4f6adcf0 100644 --- a/engines/tsage/blue_force/blueforce_dialogs.cpp +++ b/engines/tsage/blue_force/blueforce_dialogs.cpp @@ -315,7 +315,7 @@ bool AmmoBeltDialog::process(Event &event) { return false; } - + void AmmoBeltDialog::draw() { Rect bounds = _bounds; @@ -344,7 +344,7 @@ void AmmoBeltDialog::draw() { if (clip1) { GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip1Bullets); _clip1Rect.resize(clipSurface, _clip1Rect.left, _clip1Rect.top, 100); - _globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip1Rect.left, + _globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip1Rect.left, bounds.top + _clip1Rect.top); } @@ -352,7 +352,7 @@ void AmmoBeltDialog::draw() { if (clip2) { GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip2Bullets); _clip2Rect.resize(clipSurface, _clip2Rect.left, _clip2Rect.top, 100); - _globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip2Rect.left, + _globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip2Rect.left, bounds.top + _clip2Rect.top); } @@ -360,7 +360,7 @@ void AmmoBeltDialog::draw() { if (gunLoaded) { GfxSurface loadedSurface = surfaceFromRes(9, 7, 1); _loadedRect.resize(loadedSurface, _loadedRect.left, _loadedRect.top, 100); - _globals->gfxManager().copyFrom(loadedSurface, bounds.left + _loadedRect.left, + _globals->gfxManager().copyFrom(loadedSurface, bounds.left + _loadedRect.left, bounds.top + _loadedRect.top); } } diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 3e15617146..2e520e2bbc 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -25,7 +25,10 @@ #include "tsage/blue_force/blueforce_scenes0.h" #include "tsage/blue_force/blueforce_scenes1.h" #include "tsage/blue_force/blueforce_scenes3.h" +#include "tsage/blue_force/blueforce_scenes4.h" +#include "tsage/blue_force/blueforce_scenes5.h" #include "tsage/blue_force/blueforce_scenes6.h" +#include "tsage/blue_force/blueforce_scenes7.h" #include "tsage/blue_force/blueforce_scenes8.h" #include "tsage/blue_force/blueforce_scenes9.h" #include "tsage/scenes.h" @@ -64,7 +67,6 @@ Scene *BlueForceGame::createScene(int sceneNumber) { // Introduction Bar Room return new Scene109(); case 110: - case 114: case 115: case 125: @@ -125,31 +127,48 @@ Scene *BlueForceGame::createScene(int sceneNumber) { // City Jail return new Scene390(); case 410: + // Traffic Stop Gang Members + return new Scene410(); case 415: + // Searching Truck + return new Scene415(); case 440: + // Outside Alleycat Bowl + return new Scene440(); case 450: - error("Scene group 4 not implemented"); + // Inside Alleycat Bowl + return new Scene450(); case 550: + // Outside Bikini Hut + return new Scene550(); case 551: + // Outside Bikini Hut (Drunk Stop) + return new Scene551(); case 560: case 570: case 580: case 590: error("Scene group 5 not implemented"); case 600: + // Crash cut-scene + return new Scene600(); case 620: + // Hospital cut-scene + return new Scene620(); case 666: // Death scene return new Scene666(); case 690: - error("Scene group 6 not implemented"); + // Decking + return new Scene690(); case 710: - error("Scene group 7 not implemented"); + return new Scene710(); case 800: // Jamison & Ryan return new Scene800(); case 810: case 820: + error("Scene group 8 not implemented"); case 830: // Outside Boat Rentals return new Scene830(); @@ -165,11 +184,16 @@ Scene *BlueForceGame::createScene(int sceneNumber) { // Outside Warehouse return new Scene900(); case 910: + error("Scene group 9 not implemented"); case 920: + // Inside Warehouse: Secret room + return new Scene920(); case 930: + error("Scene group 9 not implemented"); case 935: + return new Scene935(); case 940: - error("Scene group 9 not implemented"); + return new Scene940(); default: error("Unknown scene number - %d", sceneNumber); break; @@ -241,7 +265,7 @@ void AObjectArray::clear() { void AObjectArray::synchronize(Serializer &s) { EventHandler::synchronize(s); for (int i = 0; i < OBJ_ARRAY_SIZE; ++i) - SYNC_POINTER(_objList[i]); + SYNC_POINTER(_objList[i]); } void AObjectArray::process(Event &event) { @@ -552,7 +576,7 @@ void FocusObject::postInit(SceneObjectList *OwnerList) { _v92 = 1; SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; - scene->_eventHandler = this; + scene->_focusObject = this; BF_GLOBALS._sceneItems.push_front(this); } @@ -566,8 +590,8 @@ void FocusObject::remove() { BF_GLOBALS._sceneItems.remove(this); SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; - if (scene->_eventHandler == this) - scene->_eventHandler = NULL; + if (scene->_focusObject == this) + scene->_focusObject = NULL; BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor()); NamedObject::remove(); @@ -576,20 +600,27 @@ void FocusObject::remove() { void FocusObject::process(Event &event) { if (BF_GLOBALS._player._enabled) { if (_bounds.contains(event.mousePos)) { + // Reset the cursor back to normal BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor()); + if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == CURSOR_WALK) && (event.btnState == 3)) { BF_GLOBALS._events.setCursor(CURSOR_USE); event.handled = true; } } else if (event.mousePos.y < 168) { + // Change the cursor to an 'Exit' image BF_GLOBALS._events.setCursor(_img); if (event.eventType == EVENT_BUTTON_DOWN) { + // Remove the object from display event.handled = true; remove(); } } } + + if (_action) + _action->process(event); } /*--------------------------------------------------------------------------*/ @@ -602,7 +633,7 @@ SceneExt::SceneExt(): Scene() { _savedPlayerEnabled = false; _savedUiEnabled = false; _savedCanWalk = false; - _eventHandler = NULL; + _focusObject = NULL; _cursorVisage.setVisage(1, 8); } @@ -631,7 +662,7 @@ void SceneExt::dispatch() { if (BF_GLOBALS._uiElements._active && BF_GLOBALS._player._enabled) { BF_GLOBALS._uiElements.show(); } - + _field37A = 0; } } @@ -641,7 +672,7 @@ void SceneExt::dispatch() { void SceneExt::loadScene(int sceneNum) { Scene::loadScene(sceneNum); - + _v51C34.top = 0; _v51C34.bottom = 300; } @@ -712,7 +743,7 @@ void SceneExt::startStrip() { SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; scene->_field372 = 1; scene->_savedPlayerEnabled = BF_GLOBALS._player._enabled; - + if (scene->_savedPlayerEnabled) { scene->_savedUiEnabled = BF_GLOBALS._player._uiEnabled; scene->_savedCanWalk = BF_GLOBALS._player._canWalk; @@ -760,7 +791,7 @@ void PalettedScene::remove() { for (SynchronizedList<SceneObject *>::iterator i = BF_GLOBALS._sceneObjects->begin(); i != BF_GLOBALS._sceneObjects->end(); ++i) (*i)->remove(); - + BF_GLOBALS._sceneObjects->draw(); BF_GLOBALS._scenePalette.loadPalette(2); BF_GLOBALS._v51C44 = 1; @@ -775,6 +806,42 @@ PaletteFader *PalettedScene::addFader(const byte *arrBufferRGB, int step, Action return BF_GLOBALS._scenePalette.addFader(arrBufferRGB, 1, step, action); } +void PalettedScene::sub15DD6(const byte *arrBufferRGB, int step, int paletteNum, Action *action) { + BF_GLOBALS._scenePalette.addFader(arrBufferRGB, 1, 100, NULL); + _palette.loadPalette(paletteNum); + _palette.loadPalette(2); + BF_GLOBALS._scenePalette.addFader(_palette._palette, 256, step, action); +} + +void PalettedScene::sub15E4F(const byte *arrBufferRGB, int arg8, int paletteNum, Action *action, int fromColor1, int fromColor2, int toColor1, int toColor2, bool flag) { + byte tmpPalette[768]; + + _palette.loadPalette(paletteNum); + _palette.loadPalette(2); + if (!flag) { + for (int i = fromColor1; i <= fromColor2; i++) { + tmpPalette[(3 * i)] = BF_GLOBALS._scenePalette._palette[(3 * i)]; + tmpPalette[(3 * i) + 1] = BF_GLOBALS._scenePalette._palette[(3 * i) + 1]; + tmpPalette[(3 * i) + 2] = BF_GLOBALS._scenePalette._palette[(3 * i) + 2]; + } + } else { + for (int i = fromColor1; i <= fromColor2; i++) { + tmpPalette[(3 * i)] = _palette._palette[(3 * i)]; + tmpPalette[(3 * i) + 1] = _palette._palette[(3 * i) + 1]; + tmpPalette[(3 * i) + 2] = _palette._palette[(3 * i) + 2]; + } + } + + for (int i = toColor1; i <= toColor2; i++) { + tmpPalette[i] = _palette._palette[i] - ((_palette._palette[i] - arrBufferRGB[0]) * (100 - arg8)) / 100; + tmpPalette[i + 1] = _palette._palette[i + 1] - ((_palette._palette[i + 1] - arrBufferRGB[1]) * (100 - arg8)) / 100; + tmpPalette[i + 2] = _palette._palette[i + 2] - ((_palette._palette[i + 2] - arrBufferRGB[2]) * (100 - arg8)) / 100; + } + + BF_GLOBALS._scenePalette.addFader((const byte *)tmpPalette, 256, 100, action); +} + + /*--------------------------------------------------------------------------*/ void SceneHandlerExt::postInit(SceneObjectList *OwnerList) { @@ -786,13 +853,17 @@ void SceneHandlerExt::postInit(SceneObjectList *OwnerList) { } void SceneHandlerExt::process(Event &event) { + SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; + if (scene && scene->_focusObject) + scene->_focusObject->process(event); + if (BF_GLOBALS._uiElements._active) { BF_GLOBALS._uiElements.process(event); if (event.handled) return; } - // If the strip proxy is currently being controlled by the strip manager, + // If the strip proxy is currently being controlled by the strip manager, // then pass all events to it first if (BF_GLOBALS._stripProxy._action) { BF_GLOBALS._stripProxy._action->process(event); @@ -1032,10 +1103,10 @@ void BlueForceInvObjectList::reset() { void BlueForceInvObjectList::setObjectScene(int objectNum, int sceneNumber) { // Find the appropriate object int num = objectNum; - SynchronizedList<InvObject *>::iterator i = _itemList.begin(); + SynchronizedList<InvObject *>::iterator i = _itemList.begin(); while (num-- > 0) ++i; (*i)->_sceneNumber = sceneNumber; - + // If the item is the currently active one, default back to the use cursor if (BF_GLOBALS._events.getCursor() == objectNum) BF_GLOBALS._events.setCursor(CURSOR_USE); diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index aa90ef834d..0184c6503b 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -83,7 +83,7 @@ public: class TimerExt: public Timer { public: Action *_newAction; -public: +public: TimerExt(); void set(uint32 delay, EventHandler *endHandler, Action *action); @@ -91,7 +91,7 @@ public: virtual void synchronize(Serializer &s); virtual void remove(); virtual void signal(); -}; +}; class SceneHotspotExt: public SceneHotspot { @@ -181,13 +181,13 @@ public: GfxSurface _img; FocusObject(); - virtual void postInit(SceneObjectList *OwnerList); + virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void synchronize(Serializer &s); virtual void remove(); virtual void process(Event &event); }; -enum ExitFrame { EXITFRAME_N = 1, EXITFRAME_NE = 2, EXITFRAME_E = 3, EXITFRAME_SE = 4, +enum ExitFrame { EXITFRAME_N = 1, EXITFRAME_NE = 2, EXITFRAME_E = 3, EXITFRAME_SE = 4, EXITFRAME_S = 5, EXITFRAME_SW = 6, EXITFRAME_W = 7, EXITFRAME_NW = 8 }; class SceneExt: public Scene { @@ -202,7 +202,7 @@ public: bool _savedCanWalk; int _field37A; - EventHandler *_eventHandler; + FocusObject *_focusObject; Visage _cursorVisage; Rect _v51C34; @@ -234,6 +234,8 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); PaletteFader *addFader(const byte *arrBufferRGB, int step, Action *action); + void sub15DD6(const byte *arrBufferRGB, int step, int paletteNum, Action *action); + void sub15E4F(const byte *arrBufferRGB, int arg8, int paletteNum, Action *action, int fromColor1, int fromColor2, int toColor1, int toColor2, bool flag); }; class SceneHandlerExt: public SceneHandler { diff --git a/engines/tsage/blue_force/blueforce_scenes0.cpp b/engines/tsage/blue_force/blueforce_scenes0.cpp index 40557d74de..8d58d554e8 100644 --- a/engines/tsage/blue_force/blueforce_scenes0.cpp +++ b/engines/tsage/blue_force/blueforce_scenes0.cpp @@ -312,11 +312,11 @@ void Scene50::Tooltip::highlight(bool btnDown) { scene->_sceneNumber = _newSceneNumber; break; } - - // Signal the scene to change to the new scene - scene->_sceneMode = 1; - scene->signal(); } + + // Signal the scene to change to the new scene + scene->_sceneMode = 1; + scene->signal(); } } @@ -357,7 +357,7 @@ void Scene50::postInit(SceneObjectList *OwnerList) { _location6.set(Rect(242, 131, 264, 144), 440, ALLEY_CAT, 64); _location5.set(Rect(383, 57, 402, 70), 380, CITY_HALL_JAIL, 32); _location7.set(Rect(128, 32, 143, 42), 800, JAMISON_RYAN, 128); - _location9.set(Rect(349, 125, 359, 132), + _location9.set(Rect(349, 125, 359, 132), (BF_GLOBALS._bookmark == bInspectionDone) || (BF_GLOBALS._bookmark == bCalledToDrunkStop) ? 551 : 550, BIKINI_HUT, 16); @@ -522,7 +522,7 @@ bool Scene60::Ignition::startAction(CursorType action, Event &event) { if (BF_GLOBALS.getFlag(onDuty) && check2()) return true; } - + BF_GLOBALS._sound1.play(BF_GLOBALS.getFlag(fWithLyle) ? 80 : 31); BF_GLOBALS._sound1.holdAt(1); scene->fadeOut(); @@ -597,7 +597,7 @@ bool Scene60::Ignition::check2() { default: break; } - + BF_GLOBALS._v5098C |= 0x80; return false; } @@ -638,7 +638,7 @@ bool Scene60::Compartment::startAction(CursorType action, Event &event) { SceneItem::display2(60, 8); break; case CURSOR_USE: - if ((BF_INVENTORY.getObjectScene(INV_TICKET_BOOK) == 1) && + if ((BF_INVENTORY.getObjectScene(INV_TICKET_BOOK) == 1) && (BF_INVENTORY.getObjectScene(INV_MIRANDA_CARD) == 1)) { SceneItem::display2(60, 9); } @@ -998,8 +998,8 @@ void Scene60::postInit(SceneObjectList *OwnerList) { loadScene(_sceneNumber); - if ((_sceneNumber == 1810) && (BF_GLOBALS._dayNumber > 1) && - (BF_GLOBALS._dayNumber < 5) && !BF_GLOBALS.getFlag(fWithLyle) && + if ((_sceneNumber == 1810) && (BF_GLOBALS._dayNumber > 1) && + (BF_GLOBALS._dayNumber < 5) && !BF_GLOBALS.getFlag(fWithLyle) && ((BF_GLOBALS._dayNumber != 4) && (BF_GLOBALS._bookmark >= bEndDayThree))) { _car.setup(1810, 1, 1, 164, 131, 1); } @@ -1024,7 +1024,7 @@ void Scene60::postInit(SceneObjectList *OwnerList) { } _dashboard.setup(_visage, 1, 1, 160, 168, 100); _cursorId = CURSOR_USE; - + if (_visage == 63) { _compartmentDoor.postInit(); _compartmentDoor.setVisage(60); diff --git a/engines/tsage/blue_force/blueforce_scenes0.h b/engines/tsage/blue_force/blueforce_scenes0.h index f3fcbb9eea..103e5f0a4c 100644 --- a/engines/tsage/blue_force/blueforce_scenes0.h +++ b/engines/tsage/blue_force/blueforce_scenes0.h @@ -91,7 +91,7 @@ public: public: Scene50(); virtual Common::String getClassName() { return "Scene50"; } - virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); virtual void signal(); virtual void process(Event &event); @@ -105,19 +105,19 @@ class Scene60 : public SceneExt { bool check2(); public: virtual bool startAction(CursorType action, Event &event); - }; + }; class Item3: public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); - }; + }; class Radio: public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); - }; + }; class Compartment: public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); - }; + }; /* Objects */ class MirandaCard: public NamedObject { @@ -133,7 +133,7 @@ class Scene60 : public SceneExt { bool _flag; virtual bool startAction(CursorType action, Event &event); }; - + /* Actions */ class Action1: public ActionExt { private: @@ -159,7 +159,7 @@ public: TicketBook _ticketBook; CompartmentDoor _compartmentDoor; SceneObject _dashboard; - AltSceneObject _car; + BackgroundSceneObject _car; NamedHotspot _item1; Ignition _ignition; Item3 _item3; diff --git a/engines/tsage/blue_force/blueforce_scenes1.cpp b/engines/tsage/blue_force/blueforce_scenes1.cpp index 5ad8fc385e..0d47cb1c5d 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.cpp +++ b/engines/tsage/blue_force/blueforce_scenes1.cpp @@ -42,7 +42,7 @@ void Scene100::Text::dispatch() { // Keep the second text string below the first one Scene100 *scene = (Scene100 *)BF_GLOBALS._sceneManager._scene; Common::Point &pt = scene->_action1._sceneText1._position; - scene->_action1._sceneText2.setPosition(Common::Point(pt.x, + scene->_action1._sceneText2.setPosition(Common::Point(pt.x, pt.y + scene->_action1._textHeight)); } @@ -63,7 +63,7 @@ void Scene100::Action1::signal() { --_actionIndex; } else { setTextStrings(BF_NAME, BF_ALL_RIGHTS_RESERVED, this); - + Common::Point pt(_sceneText1._position.x, 80); NpcMover *mover = new NpcMover(); _sceneText1.addMover(mover, &pt, this); @@ -111,13 +111,13 @@ void Scene100::Action1::setTextStrings(const Common::String &msg1, const Common: _sceneText2.setPosition(Common::Point((SCREEN_WIDTH - textSurface.getBounds().width()) / 2, 202)); _sceneText2._moveRate = 30; _sceneText2._moveDiff.y = 1; - + _textHeight = textSurface.getBounds().height(); int yp = -(_textHeight * 2); - Common::Point pt(_sceneText1._position.x, yp); + Common::Point pt(_sceneText1._position.x, yp); NpcMover *mover = new NpcMover(); - _sceneText1.addMover(mover, &pt, action); + _sceneText1.addMover(mover, &pt, action); } void Scene100::Action2::signal() { @@ -166,24 +166,29 @@ Scene100::Scene100(): SceneExt() { } void Scene100::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + if (BF_GLOBALS._dayNumber < 6) { + // Title + loadScene(100); + } else { + // Credits + loadScene(101); + } BF_GLOBALS._scenePalette.loadPalette(2); BF_GLOBALS._v51C44 = 1; - Scene::postInit(); BF_GLOBALS._interfaceY = SCREEN_HEIGHT; - _globals->_player.enableControl(); + _globals->_player.postInit(); _globals->_player.hide(); _globals->_player.disableControl(); _index = 109; if (BF_GLOBALS._dayNumber < 6) { // Title - loadScene(100); BF_GLOBALS._sound1.play(2); setAction(&_action2, this); } else { // Credits - loadScene(101); BF_GLOBALS._sound1.play(118); setAction(&_action1, this); } @@ -566,7 +571,7 @@ void Scene190::postInit(SceneObjectList *OwnerList) { _object4.setFrame(2); _object4.setPosition(Common::Point(54, 114)); _object4.setDetails(190, -1, -1, -1, 1, NULL); - + switch (BF_GLOBALS._sceneManager._previousScene) { case 300: { _sceneMode = 12; @@ -675,7 +680,7 @@ void Scene190::signal() { void Scene190::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_exit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(3); @@ -691,7 +696,7 @@ void Scene190::process(Event &event) { void Scene190::dispatch() { SceneExt::dispatch(); - if (!_action && !_fieldB52 && (BF_GLOBALS._player._position.x >= 310) + if (!_action && !_fieldB52 && (BF_GLOBALS._player._position.x >= 310) && !BF_GLOBALS.getFlag(onBike)) { // Handle walking off to the right side of the screen BF_GLOBALS._player.disableControl(); diff --git a/engines/tsage/blue_force/blueforce_scenes1.h b/engines/tsage/blue_force/blueforce_scenes1.h index 2df49f4822..3fd38e35ca 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.h +++ b/engines/tsage/blue_force/blueforce_scenes1.h @@ -174,7 +174,7 @@ public: SceneExt::synchronize(s); s.syncAsSint16LE(_fieldB52); } -}; +}; } // End of namespace BlueForce diff --git a/engines/tsage/blue_force/blueforce_scenes3.cpp b/engines/tsage/blue_force/blueforce_scenes3.cpp index e7d89f61bf..6edd6d1aaa 100644 --- a/engines/tsage/blue_force/blueforce_scenes3.cpp +++ b/engines/tsage/blue_force/blueforce_scenes3.cpp @@ -108,7 +108,7 @@ void Scene300::Action1::signal() { setDelay(1); break; case 2: { - ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, BF_GLOBALS._player._position.x - 8, + ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, BF_GLOBALS._player._position.x - 8, BF_GLOBALS._player._position.y); break; } @@ -139,7 +139,7 @@ void Scene300::Action2::signal() { case 3: BF_GLOBALS._player.enableControl(); remove(); - break; + break; default: break; } @@ -164,7 +164,7 @@ void Scene300::Action3::signal() { case 3: BF_GLOBALS._player.enableControl(); remove(); - break; + break; default: break; } @@ -190,7 +190,7 @@ void Scene300::Action4::signal() { case 4: BF_GLOBALS.setFlag(2); BF_GLOBALS._sceneManager.changeScene(190); - break; + break; default: break; } @@ -217,7 +217,7 @@ void Scene300::Action5::signal() { } case 4: remove(); - break; + break; default: break; } @@ -266,7 +266,7 @@ void Scene300::postInit(SceneObjectList *OwnerList) { _object17.setStrip(1); _object17.setPosition(Common::Point(87, 88)); _object17.setDetails(300, 11, 13, 2, 1, NULL); - + _object18.postInit(); _object18.setVisage(301); _object18.setStrip(1); @@ -473,7 +473,7 @@ void Scene300::signal() { _object9.hide(); _object10.postInit(); _object10.hide(); - + if (BF_GLOBALS.getFlag(1)) { BF_GLOBALS._player.disableControl(); _sceneMode = 4308; @@ -523,7 +523,7 @@ void Scene300::signal() { void Scene300::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_item14.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_NE); @@ -555,7 +555,7 @@ void Scene300::dispatch() { BF_GLOBALS._v4CEA4 = 3; _sceneMode = 6308; BF_GLOBALS._player.disableControl(); - ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x + 20, + ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x + 20, BF_GLOBALS._player._position.y - 5); } @@ -632,7 +632,7 @@ void Scene300::setup() { * *--------------------------------------------------------------------------*/ -bool Scene315::Item1::startAction(CursorType action, Event &event) { +bool Scene315::Barry::startAction(CursorType action, Event &event) { Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; scene->_currentCursor = action; @@ -663,15 +663,15 @@ bool Scene315::Item1::startAction(CursorType action, Event &event) { case INV_GREENS_GUN: case INV_GREENS_KNIFE: BF_GLOBALS._player.disableControl(); - if (BF_INVENTORY._bookingGreen._sceneNumber != 390) { + if (BF_INVENTORY._bookingGreen._sceneNumber == 390) { scene->_stripNumber = 3174; scene->setAction(&scene->_action1); } else { ++scene->_field1B62; scene->_stripNumber = (action == INV_GREENS_GUN) ? 3168 : 0; - scene->_sceneMode = 3152; - scene->setAction(&scene->_sequenceManager, scene, 3153, 1888, NULL); - } + scene->_sceneMode = 3153; + scene->setAction(&scene->_sequenceManager, scene, 3153, &BF_GLOBALS._player, NULL); + } break; case INV_FOREST_RAP: BF_GLOBALS._player.disableControl(); @@ -735,7 +735,7 @@ bool Scene315::Item1::startAction(CursorType action, Event &event) { return true; } -bool Scene315::Item2::startAction(CursorType action, Event &event) { +bool Scene315::SutterSlot::startAction(CursorType action, Event &event) { Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; switch (action) { @@ -772,7 +772,7 @@ bool Scene315::Item2::startAction(CursorType action, Event &event) { return true; } -bool Scene315::Item4::startAction(CursorType action, Event &event) { +bool Scene315::Sign::startAction(CursorType action, Event &event) { Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; if (action == CURSOR_LOOK) { @@ -788,7 +788,7 @@ bool Scene315::Item4::startAction(CursorType action, Event &event) { } } -bool Scene315::Item5::startAction(CursorType action, Event &event) { +bool Scene315::BulletinBoard::startAction(CursorType action, Event &event) { Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; if (action == CURSOR_LOOK) { @@ -800,7 +800,7 @@ bool Scene315::Item5::startAction(CursorType action, Event &event) { } } -bool Scene315::Item14::startAction(CursorType action, Event &event) { +bool Scene315::CleaningKit::startAction(CursorType action, Event &event) { Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; if ((action == INV_COLT45) && BF_GLOBALS.getFlag(onDuty)) { @@ -823,7 +823,7 @@ bool Scene315::Item14::startAction(CursorType action, Event &event) { } } -bool Scene315::Item15::startAction(CursorType action, Event &event) { +bool Scene315::BriefingMaterial::startAction(CursorType action, Event &event) { Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; if (action != CURSOR_USE) @@ -839,19 +839,19 @@ bool Scene315::Item15::startAction(CursorType action, Event &event) { } } -bool Scene315::Item16::startAction(CursorType action, Event &event) { +bool Scene315::WestExit::startAction(CursorType action, Event &event) { ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 190, 75); return true; } -bool Scene315::Item17::startAction(CursorType action, Event &event) { +bool Scene315::SouthWestExit::startAction(CursorType action, Event &event) { ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, event.mousePos.x, event.mousePos.y); return true; } /*--------------------------------------------------------------------------*/ -bool Scene315::Object1::startAction(CursorType action, Event &event) { +bool Scene315::BulletinMemo::startAction(CursorType action, Event &event) { Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; switch (action) { @@ -894,7 +894,7 @@ bool Scene315::Object2::startAction(CursorType action, Event &event) { } } -bool Scene315::Object3::startAction(CursorType action, Event &event) { +bool Scene315::ATFMemo::startAction(CursorType action, Event &event) { Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; switch (action) { @@ -979,7 +979,7 @@ void Scene315::synchronize(Serializer &s) { void Scene315::postInit(SceneObjectList *OwnerList) { loadScene(315); - + if (BF_GLOBALS._sceneManager._previousScene != 325) BF_GLOBALS._sound1.fadeSound(11); @@ -997,24 +997,24 @@ void Scene315::postInit(SceneObjectList *OwnerList) { _object8.setPosition(Common::Point(272, 69)); if (BF_GLOBALS._bookmark >= bLauraToParamedics) { - _object3.postInit(); - _object3.setVisage(315); - _object3.setPosition(Common::Point(167, 53)); - _object3.setStrip(4); - _object3.setFrame(4); - _object3.fixPriority(82); - _object3.setDetails(315, -1, -1, -1, 1, NULL); + _atfMemo.postInit(); + _atfMemo.setVisage(315); + _atfMemo.setPosition(Common::Point(167, 53)); + _atfMemo.setStrip(4); + _atfMemo.setFrame(4); + _atfMemo.fixPriority(82); + _atfMemo.setDetails(315, -1, -1, -1, 1, NULL); } if (BF_GLOBALS._dayNumber == 1) { if (BF_GLOBALS._bookmark >= bLauraToParamedics) { - _object1.postInit(); - _object1.setVisage(315); - _object1.setPosition(Common::Point(156, 51)); - _object1.setStrip(4); - _object1.setFrame(2); - _object1.fixPriority(82); - _object1.setDetails(315, -1, -1, -1, 1, NULL); + _bulletinMemo.postInit(); + _bulletinMemo.setVisage(315); + _bulletinMemo.setPosition(Common::Point(156, 51)); + _bulletinMemo.setStrip(4); + _bulletinMemo.setFrame(2); + _bulletinMemo.fixPriority(82); + _bulletinMemo.setDetails(315, -1, -1, -1, 1, NULL); } } else if ((BF_INVENTORY._daNote._sceneNumber != 1) && (BF_GLOBALS._dayNumber < 3)) { _object2.postInit(); @@ -1026,21 +1026,21 @@ void Scene315::postInit(SceneObjectList *OwnerList) { _object2.setDetails(315, 3, 4, -1, 1, NULL); } - _item2.setDetails(12, 315, 35, -1, 36, 1); - _item5.setDetails(3, 315, -1, -1, -1, 1); - _item1.setDetails(4, 315, 10, 11, 12, 1); + _sutterSlot.setDetails(12, 315, 35, -1, 36, 1); + _bulletinBoard.setDetails(3, 315, -1, -1, -1, 1); + _barry.setDetails(4, 315, 10, 11, 12, 1); _item3.setDetails(2, 315, 0, 1, 2, 1); - _item4.setDetails(Rect(190, 17, 208, 30), 315, -1, -1, -1, 1, NULL); - _item16.setDetails(Rect(184, 31, 211, 80), 315, -1, -1, -1, 1, NULL); - _item17.setDetails(Rect(0, 157, 190, 167), 315, -1, -1, -1, 1, NULL); - + _sign.setDetails(Rect(190, 17, 208, 30), 315, -1, -1, -1, 1, NULL); + _westExit.setDetails(Rect(184, 31, 211, 80), 315, -1, -1, -1, 1, NULL); + _swExit.setDetails(Rect(0, 157, 190, 167), 315, -1, -1, -1, 1, NULL); + if (!BF_GLOBALS.getFlag(onDuty) && ((BF_GLOBALS._bookmark == bNone) || (BF_GLOBALS._bookmark == bLyleStoppedBy))) { _field1398 = 1; BF_GLOBALS.setFlag(onDuty); } else { _field1398 = 0; } - + BF_GLOBALS._player.postInit(); BF_GLOBALS._player.changeZoom(-1); BF_GLOBALS._player.disableControl(); @@ -1091,7 +1091,7 @@ void Scene315::postInit(SceneObjectList *OwnerList) { _object7.postInit(); _object8.setFrame(8); _sceneMode = (BF_GLOBALS._dayNumber == 1) ? 3152 : 3155; - setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, &_object6, + setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, &_object6, &_object7, &_object8, NULL); break; case 300: @@ -1115,8 +1115,8 @@ void Scene315::postInit(SceneObjectList *OwnerList) { BF_GLOBALS._walkRegions.proc1(4); } - _item15.setDetails(24, 315, 38, 39, 40, 1); - _item14.setDetails(14, 315, 24, 25, 26, 1); + _briefingMaterial.setDetails(24, 315, 38, 39, 40, 1); + _cleaningKit.setDetails(14, 315, 24, 25, 26, 1); _item7.setDetails(5, 315, 8, 9, -1, 1); _item6.setDetails(6, 315, 5, 6, 7, 1); _item10.setDetails(8, 315, 13, -1, -1, 1); @@ -1224,7 +1224,7 @@ void Scene315::signal() { case 3153: BF_GLOBALS._uiElements.addScore(30); BF_INVENTORY.setObjectScene((int)_currentCursor, 315); - + if (_stripNumber != 0) setAction(&_action1); else if (!_field1B64 || (_field1B66 != _field1B64)) @@ -1293,12 +1293,12 @@ void Scene315::signal() { void Scene315::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit - if (_item17.contains(event.mousePos)) { + if (_swExit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW); BF_GLOBALS._events.setCursor(surface); - } else if ((BF_GLOBALS._bookmark != bBookedFrankie) && _item16.contains(event.mousePos)) { + } else if ((BF_GLOBALS._bookmark != bBookedFrankie) && _westExit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_W); BF_GLOBALS._events.setCursor(surface); } else { @@ -1314,7 +1314,7 @@ void Scene315::dispatch() { if (_field1B68) return; - + if (_field1B6A) { if (BF_GLOBALS._player._position.y < 69) { BF_GLOBALS._player.disableControl(); @@ -1326,7 +1326,7 @@ void Scene315::dispatch() { _field1B68 = true; SceneItem::display2(315, 28); _sceneMode = 3150; - ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x + 30, + ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x + 30, BF_GLOBALS._player._position.y + 15); } else if (BF_GLOBALS._player._position.y > 156) { BF_GLOBALS._player.disableControl(); @@ -1335,7 +1335,7 @@ void Scene315::dispatch() { _sceneMode = 3150; ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x + 30, BF_GLOBALS._player._position.y - 24); - } + } } else if (BF_GLOBALS._player.getRegionIndex() == 1) { BF_GLOBALS._player.disableControl(); _field1B68 = true; @@ -1403,7 +1403,7 @@ void Scene325::postInit(SceneObjectList *OwnerList) { _object1.setStrip(8); _object1.setFrame(2); _object1.setPosition(Common::Point(132, 28)); - + _object2.postInit(); _object2.setVisage(325); _object2.setStrip(8); @@ -1700,7 +1700,7 @@ void Scene340::Action1::signal() { if (!BF_GLOBALS._marinaWomanCtr) { setAction(&scene->_action8, this); } else if (!_action) { - BF_GLOBALS._player.setAction(&scene->_sequenceManager1, this, + BF_GLOBALS._player.setAction(&scene->_sequenceManager1, this, MIN(BF_GLOBALS._marinaWomanCtr, 3) + 2340, &scene->_woman, &scene->_child, &scene->_object4, NULL); } @@ -1958,7 +1958,7 @@ void Scene340::Action8::process(Event &event) { void Scene340::Timer2::signal() { PaletteRotation *item; - + item = BF_GLOBALS._scenePalette.addRotation(235, 239, 1); item->setDelay(30); item = BF_GLOBALS._scenePalette.addRotation(247, 249, 1); @@ -1989,14 +1989,14 @@ void Scene340::postInit(SceneObjectList *OwnerList) { PalettedScene::postInit(); loadScene(340); setZoomPercents(126, 70, 162, 100); - + BF_GLOBALS._walkRegions.proc1(13); BF_GLOBALS._walkRegions.proc1(15); _timer2.set(2, NULL); _stripManager.addSpeaker(&_gameTextSpeaker); _stripManager.addSpeaker(&_jakeUniformSpeaker); - + _field2652 = 0; BF_GLOBALS._player.postInit(); BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); @@ -2049,7 +2049,7 @@ void Scene340::postInit(SceneObjectList *OwnerList) { _harrison.setVisage(326); _harrison.setObjectWrapper(new SceneObjectWrapper()); _harrison.animate(ANIM_MODE_1, NULL); - _harrison.setPosition(Common::Point(-40, 219)); + _harrison.setPosition(Common::Point(-60, 219)); BF_GLOBALS._sceneItems.push_back(&_harrison); _stripManager.addSpeaker(&_harrisonSpeaker); @@ -2068,7 +2068,7 @@ void Scene340::postInit(SceneObjectList *OwnerList) { BF_GLOBALS._walkRegions.proc1(19); } else if (BF_GLOBALS.getFlag(fCalledBackup) && (BF_GLOBALS._marinaWomanCtr > 0)) { _timer1.set(900, &_harrison, &_action4); - } + } } switch (BF_GLOBALS._sceneManager._previousScene) { @@ -2084,7 +2084,7 @@ void Scene340::postInit(SceneObjectList *OwnerList) { break; default: _sound1.fadeSound(35); - BF_GLOBALS._sound1.fadeSound((BF_GLOBALS._bookmark < bStartOfGame) || + BF_GLOBALS._sound1.fadeSound((BF_GLOBALS._bookmark < bStartOfGame) || (BF_GLOBALS._bookmark > bCalledToDomesticViolence) ? 10 : 19); _seqNumber1 = 342; break; @@ -2129,7 +2129,7 @@ void Scene340::process(Event &event) { BF_GLOBALS._player.disableControl(); _sceneMode = 0; SceneItem::display2(350, 26); - + signal(); event.handled = true; } @@ -2137,7 +2137,7 @@ void Scene340::process(Event &event) { if (!event.handled) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_westExit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_W); @@ -2172,7 +2172,7 @@ void Scene340::dispatch() { BF_GLOBALS._player.changeZoom(-1); BF_GLOBALS._player.fixPriority(-1); } - + if (BF_GLOBALS._player._regionIndex == 16) { BF_GLOBALS._player._regionBitList &= ~0x10000; @@ -2258,7 +2258,7 @@ bool Scene342::NorthExit::startAction(CursorType action, Event &event) { void Scene342::Timer1::signal() { PaletteRotation *item; - + item = BF_GLOBALS._scenePalette.addRotation(235, 239, 1); item->setDelay(30); item = BF_GLOBALS._scenePalette.addRotation(247, 249, 1); @@ -2290,7 +2290,7 @@ void Scene342::postInit(SceneObjectList *OwnerList) { BF_GLOBALS._walkRegions.proc1(13); BF_GLOBALS._walkRegions.proc1(15); - + _field1A1A = 0; _timer1.set(2, NULL); @@ -2352,7 +2352,7 @@ void Scene342::postInit(SceneObjectList *OwnerList) { case 330: if (BF_GLOBALS._sceneManager._previousScene != 60) { _sound1.fadeSound(35); - BF_GLOBALS._sound1.fadeSound((BF_GLOBALS._bookmark < bStartOfGame) || + BF_GLOBALS._sound1.fadeSound((BF_GLOBALS._bookmark < bStartOfGame) || (BF_GLOBALS._bookmark > bCalledToDomesticViolence) ? 10 : 19); } @@ -2388,7 +2388,7 @@ void Scene342::postInit(SceneObjectList *OwnerList) { _lyle.setAction(&_sequenceManager2, NULL, 347, &_lyle, NULL); BF_GLOBALS._sceneItems.push_back(&_lyle); } - break; + break; } _item3.setDetails(7, 340, 3, 9, 12, 1); @@ -2426,7 +2426,7 @@ void Scene342::process(Event &event) { BF_GLOBALS._player.disableControl(); _sceneMode = 0; SceneItem::display2(350, 26); - + signal(); event.handled = true; } @@ -2434,7 +2434,7 @@ void Scene342::process(Event &event) { if (!event.handled) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_westExit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_W); @@ -2469,7 +2469,7 @@ void Scene342::dispatch() { BF_GLOBALS._player.changeZoom(-1); BF_GLOBALS._player.fixPriority(-1); } - + if (idx == 16) { BF_GLOBALS._player.enableControl(); ADD_PLAYER_MOVER(254, 110); @@ -2491,7 +2491,7 @@ bool Scene350::Item5::startAction(CursorType action, Event &event) { case CURSOR_USE: { BF_GLOBALS._player.disableControl(); scene->_sceneMode = 3; - + Common::Point pt(76, 154); PlayerMover *mover = new PlayerMover(); BF_GLOBALS._player.addMover(mover, &pt, scene); @@ -2516,15 +2516,15 @@ bool Scene350::Yacht::startAction(CursorType action, Event &event) { if ((BF_GLOBALS._dayNumber == 1) || (BF_GLOBALS._dayNumber == 4)) { BF_GLOBALS._player.disableControl(); scene->_sceneMode = 1; - scene->setAction(&scene->_sequenceManager1, scene, 3512, &BF_GLOBALS._player, &scene->_boat, NULL); + scene->setAction(&scene->_sequenceManager1, scene, 3512, &BF_GLOBALS._player, &scene->_yachtDoor, NULL); return true; } } else { _flag = true; scene->_sceneMode = 1; BF_GLOBALS._player.disableControl(); - scene->setAction(&scene->_sequenceManager1, scene, BF_GLOBALS.getFlag(gunDrawn) ? 3504 : 3505, - &BF_GLOBALS._player, &scene->_boat, NULL); + scene->setAction(&scene->_sequenceManager1, scene, BF_GLOBALS.getFlag(gunDrawn) ? 3504 : 3505, + &BF_GLOBALS._player, &scene->_yachtDoor, NULL); return true; } break; @@ -2605,7 +2605,7 @@ void Scene350::Timer1::signal() { rot->setDelay(20); rot = BF_GLOBALS._scenePalette.addRotation(242, 244, 1); rot->setDelay(12); - + remove(); } @@ -2624,7 +2624,7 @@ void Scene350::postInit(SceneObjectList *OwnerList) { _stripManager.addSpeaker(&_gameTextSpeaker); _stripManager.addSpeaker(&_jakeUniformSpeaker); - + BF_GLOBALS._player.postInit(); BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 352 : 1358); BF_GLOBALS._player.setFrame(1); @@ -2640,14 +2640,14 @@ void Scene350::postInit(SceneObjectList *OwnerList) { if ((BF_GLOBALS._dayNumber != 1) && (BF_GLOBALS._dayNumber != 4)) { _yacht.setDetails(28, 350, 15, 16, 17, 1); } else { - _boat.postInit(); - _boat.setVisage(350); - _boat.setStrip(3); - _boat.setFrame(1); - _boat.fixPriority(72); - _boat.setPosition(Common::Point(40, 74)); - - _yachtBody.setup(350, 1, 1, 129, 142, -1); + _yachtDoor.postInit(); + _yachtDoor.setVisage(350); + _yachtDoor.setStrip(3); + _yachtDoor.setFrame(1); + _yachtDoor.fixPriority(72); + _yachtDoor.setPosition(Common::Point(40, 74)); + + _yachtBody.setup(350, 1, 1, 129, 142, 255); if (BF_GLOBALS.getFlag(fBackupIn350)) { _harrison.postInit(); @@ -2657,7 +2657,7 @@ void Scene350::postInit(SceneObjectList *OwnerList) { _harrison.changeZoom(-1); _harrison.setDetails(350, 12, 13, 14, 1, NULL); _harrison._moveDiff = Common::Point(2, 1); - + _stripManager.addSpeaker(&_harrisonSpeaker); } @@ -2677,7 +2677,7 @@ void Scene350::postInit(SceneObjectList *OwnerList) { _item3.setDetails(7, 350, 23, 24, 25, 1); _item2.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, 31), 350, 3, 4, 5, 1, NULL); _item1.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, BF_INTERFACE_Y), 350, 0, 1, 2, 1, NULL); - + switch (BF_GLOBALS._sceneManager._previousScene) { case 370: BF_GLOBALS._player.enableControl(); @@ -2694,7 +2694,7 @@ void Scene350::postInit(SceneObjectList *OwnerList) { default: BF_GLOBALS.clearFlag(gunDrawn); - if ((BF_GLOBALS._dayNumber == 1) && (BF_GLOBALS._bookmark < bCalledToDomesticViolence) && + if ((BF_GLOBALS._dayNumber == 1) && (BF_GLOBALS._bookmark < bCalledToDomesticViolence) && BF_GLOBALS.getFlag(fBackupIn350)) { BF_GLOBALS._player.disableControl(); _sceneMode = 0; @@ -2720,19 +2720,19 @@ void Scene350::signal() { BF_GLOBALS._sceneManager.changeScene(355); break; case 2: - BF_GLOBALS._sceneManager.changeScene((BF_GLOBALS._dayNumber != 1) || + BF_GLOBALS._sceneManager.changeScene((BF_GLOBALS._dayNumber != 1) || (BF_GLOBALS._bookmark < bStartOfGame) || (BF_GLOBALS._bookmark >= bCalledToDomesticViolence) ? 342 : 340); break; case 3: BF_GLOBALS._player.setStrip(8); - + _object5.postInit(); _object5.setVisage(350); _object5.setStrip(4); _object5.fixPriority(200); _object5.setPosition(Common::Point(85, 166)); BF_GLOBALS._sceneItems.push_front(&_object5); - + if (BF_INVENTORY.getObjectScene(INV_HOOK) == 350) { _hook.postInit(); _hook.setVisage(350); @@ -2741,7 +2741,7 @@ void Scene350::signal() { _hook.setPosition(Common::Point(106, 146)); BF_GLOBALS._sceneItems.push_front(&_hook); } - + BF_GLOBALS._player.enableControl(); _sound2.play(97); break; @@ -2792,7 +2792,7 @@ void Scene350::process(Event &event) { if (!event.handled) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_swExit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW); @@ -2827,14 +2827,14 @@ void Scene350::checkGun() { * *--------------------------------------------------------------------------*/ -void Scene355::Object2::synchronize(Serializer &s) { +void Scene355::Doorway::synchronize(Serializer &s) { NamedObject::synchronize(s); s.syncAsSint16LE(_v1); s.syncAsSint16LE(_v2); s.syncAsSint16LE(_v3); } -bool Scene355::Object2::startAction(CursorType action, Event &event) { +bool Scene355::Doorway::startAction(CursorType action, Event &event) { Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene; switch (action) { @@ -2842,11 +2842,11 @@ bool Scene355::Object2::startAction(CursorType action, Event &event) { SceneItem::display2(355, 9); return true; case CURSOR_USE: - if (scene->_gameTextSpeaker._sceneText._frame == 0) { + if (!scene->_modeFlag) { scene->_sceneMode = 9984; scene->signal(); } else { - scene->proc1(1, 9984); + scene->setMode(true, 9984); } return true; case CURSOR_TALK: @@ -2886,11 +2886,11 @@ bool Scene355::Object2::startAction(CursorType action, Event &event) { default: break; } - + return NamedObject::startAction(action, event); } -bool Scene355::Object3::startAction(CursorType action, Event &event) { +bool Scene355::Locker::startAction(CursorType action, Event &event) { Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene; switch (action) { @@ -2902,14 +2902,14 @@ bool Scene355::Object3::startAction(CursorType action, Event &event) { SceneItem::display2(355, 46); else if (BF_INVENTORY.getObjectScene(INV_FLARE) != 355) SceneItem::display2(355, 45); - else if (scene->_fieldB10) - scene->proc1(1, 9996); + else if (scene->_modeFlag) + scene->setMode(true, 9996); else { BF_GLOBALS._player.disableControl(); scene->_sceneMode = 9996; - if (scene->_fieldB0E) { - scene->_fieldB0E = 0; + if (scene->_nextSceneMode) { + scene->_nextSceneMode = 0; scene->setAction(&scene->_sequenceManager, scene, 3555, &BF_GLOBALS._player, NULL); } else { scene->signal(); @@ -2917,15 +2917,15 @@ bool Scene355::Object3::startAction(CursorType action, Event &event) { } return true; case INV_SCREWDRIVER: - if (scene->_fieldB10) - scene->proc1(1, 9996); + if (scene->_modeFlag) + scene->setMode(true, 9996); else { BF_GLOBALS._player.disableControl(); scene->_sceneMode = 9996; - if (!scene->_fieldB0E) + if (!scene->_nextSceneMode) scene->signal(); else { - scene->_fieldB0E = 0; + scene->_nextSceneMode = 0; scene->setAction(&scene->_sequenceManager, scene, 3555, &BF_GLOBALS._player, NULL); } } @@ -2935,7 +2935,7 @@ bool Scene355::Object3::startAction(CursorType action, Event &event) { } } -bool Scene355::Object4::startAction(CursorType action, Event &event) { +bool Scene355::LockerDoor::startAction(CursorType action, Event &event) { Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene; switch (action) { @@ -2969,7 +2969,7 @@ bool Scene355::Object4::startAction(CursorType action, Event &event) { BF_GLOBALS._sceneItems.push_front(&scene->_object5); SceneItem::display2(355, 27); - scene->_object3.setFrame(2); + scene->_locker.setFrame(2); return true; default: return NamedObject::startAction(action, event); @@ -3003,7 +3003,7 @@ bool Scene355::Object6::startAction(CursorType action, Event &event) { SceneItem::display2(355, 34); return true; case CURSOR_USE: - if (scene->_fieldB10) + if (scene->_modeFlag) SceneItem::display2(355, 35); else if (!_flag) SceneItem::display2(355, 38); @@ -3038,7 +3038,7 @@ bool Scene355::Object6::startAction(CursorType action, Event &event) { return true; default: - if ((action < BF_LAST_INVENT) && scene->_fieldB10) { + if ((action < BF_LAST_INVENT) && scene->_modeFlag) { SceneItem::display2(355, 35); return true; } @@ -3090,7 +3090,7 @@ bool Scene355::Object7::startAction(CursorType action, Event &event) { case CURSOR_TALK: BF_GLOBALS._player.disableControl(); scene->_sceneMode = 0; - + if (BF_GLOBALS._sceneObjects->contains(&scene->_object6)) { scene->_stripManager.start((BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 355) ? 3578 : 3577, scene); } else { @@ -3130,7 +3130,7 @@ bool Scene355::Object8::startAction(CursorType action, Event &event) { } else if (BF_GLOBALS._dayNumber < 5) { SceneItem::display2(355, 52); return true; - } + } break; case INV_COLT45: if (BF_GLOBALS.getFlag(fBackupIn350)) { @@ -3155,18 +3155,18 @@ bool Scene355::Item1::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_LOOK: SceneItem::display2(355, 28); - return true; + return true; case CURSOR_USE: SceneItem::display2(355, 37); - return true; + return true; case INV_RENTAL_KEYS: - if (scene->_fieldB10) { + if (scene->_modeFlag) { scene->_sceneMode = 9980; scene->signal(); - } else if (!scene->_fieldB0E) + } else if (!scene->_nextSceneMode) SceneItem::display2(355, 36); else - scene->proc1(0, 9980); + scene->setMode(false, 9980); return true; default: return SceneHotspot::startAction(action, event); @@ -3197,12 +3197,12 @@ bool Scene355::Item3::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_LOOK: SceneItem::display2(355, 33); - return true; + return true; case CURSOR_USE: if (BF_GLOBALS._dayNumber < 5) SceneItem::display2(355, 21); - else if (scene->_fieldB10) - scene->proc1(1, 9987); + else if (scene->_modeFlag) + scene->setMode(true, 9987); else { scene->_sceneMode = 9987; scene->signal(); @@ -3224,14 +3224,14 @@ bool Scene355::Item3::startAction(CursorType action, Event &event) { // Handling for inventory objects BF_INVENTORY.setObjectScene(action, 0); - if (scene->_fieldB10) - scene->proc1(1, 9986); + if (scene->_modeFlag) + scene->setMode(true, 9986); else { scene->_sceneMode = 9986; scene->signal(); } - scene->_fieldB0E = 0; + scene->_nextSceneMode = 0; return true; } @@ -3245,8 +3245,8 @@ bool Scene355::Item4::startAction(CursorType action, Event &event) { case CURSOR_USE: if ((BF_GLOBALS._dayNumber < 5) || (BF_INVENTORY.getObjectScene(INV_GRENADES) != 355)) SceneItem::display2(355, 21); - else if (scene->_fieldB10) - scene->proc1(1, 9987); + else if (scene->_modeFlag) + scene->setMode(true, 9987); else { scene->_sceneMode = 9987; scene->signal(); @@ -3264,14 +3264,14 @@ bool Scene355::Item5::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_USE: if (BF_INVENTORY.getObjectScene(INV_SCREWDRIVER) == 355) { - if (scene->_fieldB10) { + if (scene->_modeFlag) { scene->_sceneMode = 9992; scene->signal(); - } else if (!scene->_fieldB0E) { - scene->proc1(0, 9992); + } else if (!scene->_nextSceneMode) { + scene->setMode(false, 9992); } else { scene->_sceneMode = 9977; - scene->_fieldB0E = 0; + scene->_nextSceneMode = 0; scene->setAction(&scene->_sequenceManager, scene, 3555, &BF_GLOBALS._player, NULL); } } else { @@ -3279,11 +3279,11 @@ bool Scene355::Item5::startAction(CursorType action, Event &event) { } return true; case INV_RENTAL_KEYS: - if (scene->_fieldB10) { + if (scene->_modeFlag) { scene->_sceneMode = 9980; scene->signal(); - } else if (!scene->_fieldB0E) { - scene->proc1(0, 9980); + } else if (!scene->_nextSceneMode) { + scene->setMode(false, 9980); } else { SceneItem::display2(355, 36); } @@ -3308,14 +3308,14 @@ bool Scene355::Item11::startAction(CursorType action, Event &event) { return true; case CURSOR_TALK: if (BF_GLOBALS._dayNumber == 5) { - switch (scene->_object2._v2) { + switch (scene->_doorway._v2) { case 0: BF_GLOBALS._player.disableControl(); scene->_sceneMode = 0; BF_GLOBALS.setFlag(fTookTrailerAmmo); scene->_stripManager.start(3575, scene); scene->_object7._flag = 1; - scene->_object2._v2 = 1; + scene->_doorway._v2 = 1; break; case 1: BF_GLOBALS._player.disableControl(); @@ -3345,7 +3345,7 @@ bool Scene355::Item11::startAction(CursorType action, Event &event) { default: break; } - + return NamedHotspot::startAction(action, event); } @@ -3353,12 +3353,12 @@ bool Scene355::Item12::startAction(CursorType action, Event &event) { Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene; if (!BF_GLOBALS.getFlag(gunDrawn)) { - if (scene->_fieldB10) - scene->proc1(1, 0); - else if (!scene->_fieldB0E) - scene->proc1(0, 0); + if (scene->_modeFlag) + scene->setMode(true, 0); + else if (!scene->_nextSceneMode) + scene->setMode(false, 0); else { - scene->_fieldB0E = 0; + scene->_nextSceneMode = 0; BF_GLOBALS._player.disableControl(); scene->setAction(&scene->_sequenceManager, scene, 3555, &BF_GLOBALS._player, NULL); } @@ -3406,13 +3406,14 @@ void Scene355::Action2::signal() { /*--------------------------------------------------------------------------*/ Scene355::Scene355(): PalettedScene() { - _fieldB0E = _fieldB10 = 0; + _nextSceneMode = 0; + _modeFlag = false; } void Scene355::synchronize(Serializer &s) { SceneExt::synchronize(s); - s.syncAsSint16LE(_fieldB0E); - s.syncAsSint16LE(_fieldB10); + s.syncAsSint16LE(_nextSceneMode); + s.syncAsSint16LE(_modeFlag); } void Scene355::postInit(SceneObjectList *OwnerList) { @@ -3464,13 +3465,13 @@ void Scene355::postInit(SceneObjectList *OwnerList) { _item4._sceneRegionId = 17; BF_GLOBALS._sceneItems.push_back(&_item4); - - _object3.postInit(); - _object3.setVisage(2356); - _object3.setPosition(Common::Point(88, 99)); + + _locker.postInit(); + _locker.setVisage(2356); + _locker.setPosition(Common::Point(88, 99)); if (BF_INVENTORY.getObjectScene(INV_SCREWDRIVER) == 999) { - _object3.setFrame(2); + _locker.setFrame(2); if (BF_INVENTORY.getObjectScene(INV_FLARE) == 355) { _object9.postInit(); @@ -3479,34 +3480,34 @@ void Scene355::postInit(SceneObjectList *OwnerList) { _object9.fixPriority(100); } } - BF_GLOBALS._sceneItems.push_back(&_object3); + BF_GLOBALS._sceneItems.push_back(&_locker); - _object2.postInit(); - _object2.setVisage(355); - _object2.setPosition(Common::Point(193, 105)); - _object2.fixPriority(18); - _object2._v1 = 0; - _object2._v3 = 0; - BF_GLOBALS._sceneItems.push_back(&_object2); + _doorway.postInit(); + _doorway.setVisage(355); + _doorway.setPosition(Common::Point(193, 105)); + _doorway.fixPriority(18); + _doorway._v1 = 0; + _doorway._v3 = 0; + BF_GLOBALS._sceneItems.push_back(&_doorway); switch (BF_GLOBALS._dayNumber) { case 1: if (!BF_GLOBALS.getFlag(onDuty)) - _object2._v3 = 1; + _doorway._v3 = 1; else if (BF_INVENTORY.getObjectScene(INV_GREENS_GUN) == 320) - _object2._v3 = 1; + _doorway._v3 = 1; break; case 2: case 3: case 4: - _object2._v3 = 1; + _doorway._v3 = 1; break; default: break; } if (BF_GLOBALS._dayNumber == 5) - _object2._v2 = BF_GLOBALS.getFlag(fTookTrailerAmmo) ? 1 : 0; + _doorway._v2 = BF_GLOBALS.getFlag(fTookTrailerAmmo) ? 1 : 0; _object8.postInit(); _object8.setVisage(355); @@ -3527,16 +3528,16 @@ void Scene355::postInit(SceneObjectList *OwnerList) { break; case 5: BF_GLOBALS._player.disableControl(); - _fieldB10 = 1; + _modeFlag = true; BF_GLOBALS._player.setPosition(Common::Point(133, 173)); BF_GLOBALS._player.fixPriority(249); BF_GLOBALS._player.setStrip(7); - + if (BF_GLOBALS._bookmark == bDoneAtLyles) BF_GLOBALS._bookmark = bEndDayFour; - + _item5.setDetails(Rect(22, 136, 46, 146), 355, 43, -1, -1, 1, NULL); - _fieldB0E = 0; + _nextSceneMode = 0; if (!BF_GLOBALS.getFlag(fLyleOnIsland)) { _object7.postInit(); @@ -3564,9 +3565,9 @@ void Scene355::postInit(SceneObjectList *OwnerList) { _object11.setPosition(Common::Point(183, 39)); _object11.animate(ANIM_MODE_2); - _object2.setPosition(Common::Point(146, 107)); - _object2._v3 = 0; - _object2._v2 = 2; + _doorway.setPosition(Common::Point(146, 107)); + _doorway._v3 = 0; + _doorway._v2 = 2; _object7._flag = 2; _object6.postInit(); @@ -3604,23 +3605,23 @@ void Scene355::postInit(SceneObjectList *OwnerList) { break; default: if (!BF_GLOBALS.getFlag(greenTaken)) { - _object1.postInit(); - _object1.setPosition(Common::Point(152, 131)); - _object1.animate(ANIM_MODE_1, NULL); - _object1.setObjectWrapper(new SceneObjectWrapper()); - + _harrison.postInit(); + _harrison.setPosition(Common::Point(152, 131)); + _harrison.animate(ANIM_MODE_1, NULL); + _harrison.setObjectWrapper(new SceneObjectWrapper()); + if (BF_GLOBALS.getFlag(gunDrawn)) { - _object1.setVisage(357); - _object1.setStrip(2); + _harrison.setVisage(357); + _harrison.setStrip(2); } else { - _object1.setVisage(1363); - _object1.setStrip(3); + _harrison.setVisage(1363); + _harrison.setStrip(3); } - _object1.hide(); + _harrison.hide(); if (BF_GLOBALS.getFlag(fBackupIn350)) { - _object1.show(); - BF_GLOBALS._sceneItems.push_back(&_object1); + _harrison.show(); + BF_GLOBALS._sceneItems.push_back(&_harrison); } _sceneMode = 1355; @@ -3629,7 +3630,7 @@ void Scene355::postInit(SceneObjectList *OwnerList) { break; } - _object1.setDetails(355, 18, 20, 19, 1, NULL); + _harrison.setDetails(355, 18, 20, 19, 1, NULL); _item6.setDetails(10, 355, 2, -1, 14, 1); _item7.setDetails(11, 355, 3, -1, 15, 1); _item8.setDetails(12, 355, 4, -1, 8, 1); @@ -3663,21 +3664,23 @@ void Scene355::signal() { _stripManager.start(BF_GLOBALS.getFlag(fBackupIn350) ? 3559 : 3554, this); break; case 1356: - switch (_object2._v1) { + switch (_doorway._v1) { case 0: + ++_doorway._v1; _sceneMode = 9999; _stripManager.start(3550, this); break; case 1: _sceneMode = 9999; _stripManager.start(3551, this); + ++_doorway._v1; break; default: break; } break; case 2357: - _object1.animate(ANIM_MODE_1, NULL); + _harrison.animate(ANIM_MODE_1, NULL); // Deliberate fall-through case 1357: BF_GLOBALS._player.enableControl(); @@ -3692,7 +3695,7 @@ void Scene355::signal() { BF_GLOBALS._sceneManager.changeScene(360); else { _sceneMode = 1359; - setAction(&_sequenceManager, this, BF_GLOBALS.getFlag(gunDrawn) ? 1359 : 3550, NULL); + setAction(&_sequenceManager, this, BF_GLOBALS.getFlag(gunDrawn) ? 1359 : 3550, &_harrison, NULL); } break; case 3553: @@ -3734,8 +3737,8 @@ void Scene355::signal() { BF_GLOBALS.setFlag(unlockBoat); BF_GLOBALS._uiElements.addScore(10); } - - SceneItem::display(355, !_object2._v3 ? 24 : 25); + + SceneItem::display(355, !_doorway._v3 ? 24 : 25); BF_GLOBALS._player.enableControl(); break; case 4550: @@ -3744,8 +3747,8 @@ void Scene355::signal() { BF_GLOBALS._sound1.play(90); BF_GLOBALS._player._regionBitList |= 0x10; - _object2._v3 = 0; - _object2._v2 = 2; + _doorway._v3 = 0; + _doorway._v2 = 2; _object7._flag = 2; BF_GLOBALS._player.enableControl(); break; @@ -3754,7 +3757,7 @@ void Scene355::signal() { break; case 4554: BF_GLOBALS._player.disableControl(); - switch (_fieldB0E) { + switch (_nextSceneMode) { case 9980: _sceneMode = 9980; break; @@ -3766,11 +3769,11 @@ void Scene355::signal() { break; } setAction(&_sequenceManager, this, 4554, &BF_GLOBALS._player, NULL); - _fieldB0E = 0; - _fieldB10 = 1; + _nextSceneMode = 0; + _modeFlag = true; break; case 9977: - proc1(0, 9992); + setMode(false, 9992); break; case 9979: _sceneMode = 0; @@ -3815,13 +3818,13 @@ void Scene355::signal() { case 9984: if (BF_GLOBALS._dayNumber == 5) { _sceneMode = 0; - switch (_object2._v2) { + switch (_doorway._v2) { case 0: BF_GLOBALS._sound1.play(109); BF_GLOBALS.setFlag(fTookTrailerAmmo); _stripManager.start(3575, this); _object7._flag = 1; - _object2._v2 = 0; + ++_doorway._v2; break; case 1: _stripManager.start(3573, this); @@ -3832,13 +3835,14 @@ void Scene355::signal() { break; } } else if (BF_GLOBALS.getFlag(greenTaken) || (BF_GLOBALS._dayNumber > 1)) { - if (_object2._v3) { + if (_doorway._v3) { SceneItem::display2(355, 23); + _sceneMode = 0; signal(); } else { BF_GLOBALS._player.disableControl(); _sceneMode = 2358; - setAction(&_sequenceManager, this, 3551, &BF_GLOBALS._player, &_object2, NULL); + setAction(&_sequenceManager, this, 3551, &BF_GLOBALS._player, &_doorway, NULL); } } else if (BF_GLOBALS.getFlag(gunDrawn)) { BF_GLOBALS._player.disableControl(); @@ -3858,7 +3862,7 @@ void Scene355::signal() { BF_GLOBALS._player._regionBitList |= 0x10; break; case 9986: - if (_fieldB0E) { + if (_nextSceneMode) { _sceneMode = _item3._state; signal(); } else { @@ -3868,13 +3872,13 @@ void Scene355::signal() { } break; case 9987: - if (_fieldB0E) { - _fieldB0E = 0; + if (_nextSceneMode) { + _nextSceneMode = 0; BF_GLOBALS._player.disableControl(); _sceneMode = 3555; setAction(&_sequenceManager, this, 3555, &BF_GLOBALS._player, NULL); } else { - _fieldB0E = 1; + _nextSceneMode = 1; BF_GLOBALS._player.disableControl(); _sceneMode = 3553; setAction(&_sequenceManager, this, 3553, &BF_GLOBALS._player, NULL); @@ -3901,19 +3905,19 @@ void Scene355::signal() { BF_GLOBALS._sound1.fade(0, 5, 60, true, NULL); _sceneMode = 4550; - setAction(&_sequenceManager, this, 4550, &_object2, &_object6, &_object9, &_object10, &_object11, NULL); + setAction(&_sequenceManager, this, 4550, &_doorway, &_object6, &_object9, &_object10, &_object11, NULL); } else { BF_GLOBALS._player.enableControl(); } break; case 9989: - _object4.postInit(); - _object4.setVisage(2356); - _object4.setStrip(2); - BF_GLOBALS._sceneItems.push_front(&_object4); + _lockerDoor.postInit(); + _lockerDoor.setVisage(2356); + _lockerDoor.setStrip(2); + BF_GLOBALS._sceneItems.push_front(&_lockerDoor); if (BF_INVENTORY.getObjectScene(INV_SCREWDRIVER) == 999) { - _object4.setFrame(2); + _lockerDoor.setFrame(2); if (BF_INVENTORY.getObjectScene(INV_FLARE) == 355) { _object5.postInit(); _object5.setVisage(2356); @@ -3923,11 +3927,11 @@ void Scene355::signal() { BF_GLOBALS._sceneItems.push_front(&_object5); } } else { - _object4.setFrame(1); + _lockerDoor.setFrame(1); } - _object4.setPosition(Common::Point(82, 115)); - _object4.fixPriority(254); + _lockerDoor.setPosition(Common::Point(82, 115)); + _lockerDoor.fixPriority(254); BF_GLOBALS._player.enableControl(); break; case 9990: @@ -3936,7 +3940,7 @@ void Scene355::signal() { ADD_PLAYER_MOVER(145, 145); break; case 9991: - proc1(0, 0); + setMode(false, 0); break; case 9992: _sceneMode = 9993; @@ -3956,22 +3960,22 @@ void Scene355::signal() { } case 9997: _sceneMode = 9999; - _object2._v1 = 2; + _doorway._v1 = 2; _stripManager.start(3562, this); break; case 9998: error("Talkdoor state"); break; case 9999: - if (_object2._v2 != 2) { + if (_doorway._v1 != 2) { BF_GLOBALS._player.enableControl(); BF_GLOBALS._player._canWalk = false; } else if (BF_GLOBALS.getFlag(gunDrawn)) { _sceneMode = 2358; - setAction(&_sequenceManager, this, 2359, &BF_GLOBALS._player, &_object2, &_object1, NULL); + setAction(&_sequenceManager, this, 2359, &BF_GLOBALS._player, &_doorway, &_harrison, NULL); } else { _sceneMode = 2358; - setAction(&_sequenceManager, this, 2358, &BF_GLOBALS._player, &_object2, &_object1, NULL); + setAction(&_sequenceManager, this, 2358, &BF_GLOBALS._player, &_doorway, &_harrison, NULL); } break; case 0: @@ -3985,7 +3989,7 @@ void Scene355::signal() { void Scene355::process(Event &event) { if (BF_GLOBALS._dayNumber == 5) { // Handling for day 5 - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_item12.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_NW); @@ -4011,8 +4015,8 @@ void Scene355::process(Event &event) { setAction(&_sequenceManager, this, 3560, &BF_GLOBALS._player, NULL); } else { BF_GLOBALS.setFlag(gunDrawn); - if (_fieldB10) { - proc1(1, 3561); + if (_modeFlag) { + setMode(true, 3561); } else { _sceneMode = 3561; signal(); @@ -4043,10 +4047,10 @@ void Scene355::process(Event &event) { } } else { // All other days - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_item2.contains(event.mousePos)) { - GfxSurface surface = _cursorVisage.getFrame(!_fieldB10 ? EXITFRAME_SW : EXITFRAME_NE); + GfxSurface surface = _cursorVisage.getFrame(!_modeFlag ? EXITFRAME_SW : EXITFRAME_NE); BF_GLOBALS._events.setCursor(surface); } else { // In case an exit cursor was being shown, restore the previously selected cursor @@ -4062,11 +4066,11 @@ void Scene355::process(Event &event) { if (BF_GLOBALS.getFlag(gunDrawn)) { BF_GLOBALS.clearFlag(gunDrawn); _sceneMode = 2357; - setAction(&_sequenceManager, this, 2357, &BF_GLOBALS._player, &_object1, NULL); + setAction(&_sequenceManager, this, 2357, &BF_GLOBALS._player, &_harrison, NULL); } else { BF_GLOBALS._player.disableControl(); _sceneMode = 1357; - setAction(&_sequenceManager, this, 1357, &BF_GLOBALS._player, &_object1, NULL); + setAction(&_sequenceManager, this, 1357, &BF_GLOBALS._player, &_harrison, NULL); BF_GLOBALS.setFlag(gunDrawn); } } else { @@ -4090,17 +4094,17 @@ void Scene355::dispatch() { } } -void Scene355::proc1(int v1, int v2) { +void Scene355::setMode(bool mode, int sceneMode) { Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene; - if (v1) { + if (mode) { BF_GLOBALS._player.disableControl(); - _sceneMode = v2; + _sceneMode = sceneMode; setAction(&scene->_sequenceManager, this, 4553, &BF_GLOBALS._player, NULL); - _fieldB10 = 0; + _modeFlag = false; } else { _sceneMode = 9990; - _fieldB0E = v2; + _nextSceneMode = sceneMode; signal(); } } @@ -4334,6 +4338,7 @@ void Scene360::postInit(SceneObjectList *OwnerList) { _window.postInit(); _window.setVisage(760); + _window.setStrip(4); _window.setPosition(Common::Point(176, 43)); _window.fixPriority(10); _window._numFrames = 2; @@ -4409,7 +4414,7 @@ void Scene360::postInit(SceneObjectList *OwnerList) { _object2.postInit(); _object2.setPosition(Common::Point(-40, -40)); - + _slidingDoor.setPosition(Common::Point(6, 130)); _slidingDoor.setAction(&_sequenceManager1, this, 3606, &_slidingDoor, &_object7, NULL); } @@ -4489,24 +4494,41 @@ void Scene360::process(Event &event) { if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == INV_COLT45) && BF_GLOBALS._player.contains(event.mousePos) && !BF_GLOBALS.getFlag(greenTaken)) { + // Player clicked gun on themselves if (BF_GLOBALS.getFlag(gunDrawn)) { + // Handle holstering gun if (BF_GLOBALS._player._position.x <= 160) SceneItem::display2(360, 18); else { - if (BF_GLOBALS.getFlag(fBackupIn350)) + if (BF_GLOBALS.getFlag(fBackupIn350)) SceneItem::display2(360, 19); - + BF_GLOBALS.clearFlag(gunDrawn); _sceneMode = 9999; BF_GLOBALS._player.setVisage(1361); BF_GLOBALS._player.addMover(NULL); BF_GLOBALS._player.setFrame(BF_GLOBALS._player.getFrameCount()); BF_GLOBALS._player.animate(ANIM_MODE_6, this); - + _object6.setVisage(1363); } + } else { + // Handle drawing gun + if (BF_GLOBALS.getFlag(fBackupIn350)) + SceneItem::display2(360, 19); + BF_GLOBALS._player.disableControl(); + BF_GLOBALS._player.addMover(NULL); + BF_GLOBALS._player.setVisage(1361); + BF_GLOBALS._player.setFrame(1); + BF_GLOBALS._player.animate(ANIM_MODE_5, this); + + BF_GLOBALS.setFlag(gunDrawn); + _sceneMode = 9998; + _object6.setVisage(363); } + + event.handled = true; } } @@ -4526,7 +4548,7 @@ void Scene360::dispatch() { } } - if ((BF_GLOBALS._player._position.x <= 168) && !BF_GLOBALS.getFlag(greenTaken) && + if ((BF_GLOBALS._player._position.x <= 168) && !BF_GLOBALS.getFlag(greenTaken) && !BF_GLOBALS.getFlag(gunDrawn)) { // Moving to doorway without drawn gun before Green is captured BF_GLOBALS._player.disableControl(); @@ -4572,7 +4594,7 @@ bool Scene370::Green::startAction(CursorType action, Event &event) { SceneItem::display2(370, (_v2 < 3) ? 10 : 0); return true; case CURSOR_USE: - if (_v2 != 3) + if (_v2 != 3) SceneItem::display2(370, 1); else if (BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 1) SceneItem::display2(370, 26); @@ -4609,7 +4631,7 @@ bool Scene370::Green::startAction(CursorType action, Event &event) { case 2: ++_v2; scene->_sceneMode = 3708; - scene->setAction(&scene->_sequenceManager, scene, 3708, this, &scene->_laura, &scene->_harrison, + scene->setAction(&scene->_sequenceManager, scene, 3708, this, &scene->_laura, &scene->_harrison, &scene->_object5, &scene->_greensGun, NULL); break; case 3: @@ -4807,7 +4829,7 @@ void Scene370::postInit(SceneObjectList *OwnerList) { _green.setStrip(2); _green._numFrames = 5; _green.setPosition(Common::Point(164, 137)); - _green.animate(ANIM_MODE_7, NULL); + _green.animate(ANIM_MODE_7, 0, NULL); _green.fixPriority(125); BF_GLOBALS._sceneItems.push_back(&_green); @@ -4987,7 +5009,7 @@ void Scene370::signal() { void Scene370::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_exit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_E); @@ -5073,7 +5095,7 @@ void Scene380::postInit(SceneObjectList *OwnerList) { _vechile.postInit(); _vechile.setVisage(380); _vechile.fixPriority(109); - + if (BF_GLOBALS.getFlag(fWithLyle)) { // Show vechile as car _vechile.setStrip(3); @@ -5274,7 +5296,7 @@ bool Scene385::Jim::startAction(CursorType action, Event &event) { scene->_talkAction = 3868; break; } - + scene->_jimFlag = 1; scene->setAction(&scene->_action1); } @@ -5337,7 +5359,7 @@ bool Scene385::Dezi::startAction(CursorType action, Event &event) { default: BF_GLOBALS._deziTopic = 3; scene->_talkAction = 3868; - break; + break; } } @@ -5399,7 +5421,7 @@ void Scene385::postInit(SceneObjectList *OwnerList) { _item2.setDetails(2, 385, 7, -1, -1, 1); _item1.setDetails(3, 385, 6, -1, 6, 1); _item5.setDetails(4, 385, 14, -1, -1, 1); - + _jim.postInit(); _jim.setVisage(385); _jim.setStrip(3); @@ -5449,7 +5471,7 @@ void Scene385::signal() { void Scene385::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { // Check if the cursor is on an exit if (_exit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW); @@ -5628,11 +5650,11 @@ bool Scene390::Object2::startAction(CursorType action, Event &event) { BF_GLOBALS._player.disableControl(); BF_GLOBALS._bookmark = bLauraToParamedics; scene->_sceneMode = 3905; - + BF_INVENTORY.setObjectScene(INV_GREEN_ID, 390); if (BF_GLOBALS.getFlag(fLeftTraceIn910)) BF_GLOBALS.clearFlag(fLeftTraceIn910); - + scene->setAction(&scene->_sequenceManager, scene, 3905, &BF_GLOBALS._player, this, NULL); BF_GLOBALS.clearFlag(f1015Marina); BF_GLOBALS.clearFlag(f1027Marina); @@ -5705,7 +5727,7 @@ bool Scene390::GangMember1::startAction(CursorType action, Event &event) { BF_GLOBALS.setFlag(readFrankRights); BF_GLOBALS._uiElements.addScore(30); BF_GLOBALS._player.disableControl(); - + scene->_sceneMode = 3904; scene->setAction(&scene->_sequenceManager, scene, 3907, &BF_GLOBALS._player, NULL); } @@ -5730,7 +5752,7 @@ bool Scene390::GangMember2::startAction(CursorType action, Event &event) { BF_GLOBALS._uiElements.addScore(30); BF_GLOBALS.setFlag(readFrankRights); BF_GLOBALS._player.disableControl(); - + scene->_sceneMode = 3904; scene->setAction(&scene->_sequenceManager, scene, 3907, &BF_GLOBALS._player, NULL); } @@ -5769,7 +5791,7 @@ void Scene390::postInit(TsAGE::SceneObjectList *OwnerList) { SceneExt::postInit(); setZoomPercents(105, 85, 130, 100); loadScene(390); - + _stripManager.addSpeaker(&_gameTextSpeaker); _stripManager.addSpeaker(&_jakeUniformSpeaker); _stripManager.addSpeaker(&_jakeJacketSpeaker); @@ -5870,14 +5892,18 @@ void Scene390::signal() { _object3.setPosition(Common::Point(250, 60)); _object3.fixPriority(255); _object3.setDetails(390, 8, -1, 9, 2, NULL); + + BF_GLOBALS._player.enableControl(); break; case 3903: SceneItem::display2(390, 18); + BF_GLOBALS._player.enableControl(); break; case 3905: BF_GLOBALS._uiElements.addScore(30); _object2.remove(); BF_INVENTORY.setObjectScene(INV_HANDCUFFS, 1); + BF_GLOBALS._player.enableControl(); break; case 3906: BF_GLOBALS._deathReason = 18; diff --git a/engines/tsage/blue_force/blueforce_scenes3.h b/engines/tsage/blue_force/blueforce_scenes3.h index 2d3cc7a14f..86150433fd 100644 --- a/engines/tsage/blue_force/blueforce_scenes3.h +++ b/engines/tsage/blue_force/blueforce_scenes3.h @@ -133,7 +133,7 @@ public: class Scene315: public SceneExt { /* Objects */ - class Object1: public NamedObject { + class BulletinMemo: public NamedObject { public: virtual bool startAction(CursorType action, Event &event); }; @@ -141,41 +141,41 @@ class Scene315: public SceneExt { public: virtual bool startAction(CursorType action, Event &event); }; - class Object3: public NamedObject { + class ATFMemo: public NamedObject { public: virtual bool startAction(CursorType action, Event &event); }; /* Items */ - class Item1: public NamedHotspot { + class Barry: public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; - class Item2: public NamedHotspot { + class SutterSlot: public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; - class Item4: public NamedHotspot { + class Sign: public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; - class Item5: public NamedHotspot { + class BulletinBoard: public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; - class Item14: public NamedHotspot { + class CleaningKit: public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; - class Item15: public NamedHotspot { + class BriefingMaterial: public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; - class Item16: public NamedHotspot { + class WestExit: public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; - class Item17: public NamedHotspot { + class SouthWestExit: public NamedHotspot { public: virtual bool startAction(CursorType action, Event &event); }; @@ -193,22 +193,22 @@ public: SpeakerJakeJacket _jakeJacketSpeaker; SpeakerJakeUniform _jakeUniformSpeaker; SpeakerJailer _jailerSpeaker; - Item1 _item1; - Item2 _item2; + Barry _barry; + SutterSlot _sutterSlot; NamedHotspot _item3; - Item4 _item4; - Item5 _item5; - Object1 _object1; + Sign _sign; + BulletinBoard _bulletinBoard; + BulletinMemo _bulletinMemo; Object2 _object2; - Object3 _object3; + ATFMemo _atfMemo; SceneObject _object4, _object5, _object6; SceneObject _object7, _object8, _object9; NamedHotspot _item6, _item7, _item8, _item9; NamedHotspot _item10, _item11, _item12, _item13; - Item14 _item14; - Item15 _item15; - Item16 _item16; - Item17 _item17; + CleaningKit _cleaningKit; + BriefingMaterial _briefingMaterial; + WestExit _westExit; + SouthWestExit _swExit; Action1 _action1; int _field1390; int _stripNumber; @@ -245,7 +245,7 @@ public: class Scene330: public SceneExt { class Timer1: public Timer { - public: + public: virtual void signal(); }; public: @@ -333,7 +333,7 @@ class Scene340: public PalettedScene { /* Timers */ class Timer2: public Timer { - public: + public: virtual void signal(); }; public: @@ -401,7 +401,7 @@ class Scene342: public PalettedScene { /* Timers */ class Timer1: public Timer { - public: + public: virtual void signal(); }; public: @@ -461,14 +461,14 @@ class Scene350: public SceneExt { /* Timers */ class Timer1: public Timer { - public: + public: virtual void signal(); }; public: SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3; NamedObject _harrison; - SceneObject _boat; - SceneObject _yachtBody; + SceneObject _yachtDoor; + BackgroundSceneObject _yachtBody; Hook _hook; Object5 _object5; NamedHotspot _item1, _item2, _item3, _item4; @@ -492,20 +492,20 @@ public: class Scene355: public PalettedScene { /* Objects */ - class Object2: public NamedObject { + class Doorway: public NamedObject { public: int _v1, _v2, _v3; - Object2() { _v1 = _v2 = _v3 = 0; } - virtual Common::String getClassName() { return "Scene355_Object2"; } + Doorway() { _v1 = _v2 = _v3 = 0; } + virtual Common::String getClassName() { return "Scene355_Doorway"; } virtual void synchronize(Serializer &s); virtual bool startAction(CursorType action, Event &event); }; - class Object3: public NamedObject { + class Locker: public NamedObject { public: virtual bool startAction(CursorType action, Event &event); }; - class Object4: public NamedObject { + class LockerDoor: public NamedObject { public: virtual bool startAction(CursorType action, Event &event); }; @@ -573,10 +573,10 @@ public: SpeakerHarrison _harrisonSpeaker; SpeakerLyleHat _lyleHatSpeaker; SpeakerGreen _greenSpeaker; - NamedObject _object1; - Object2 _object2; - Object3 _object3; - Object4 _object4; + NamedObject _harrison; + Doorway _doorway; + Locker _locker; + LockerDoor _lockerDoor; Object5 _object5; Object6 _object6; Object7 _object7; @@ -594,7 +594,8 @@ public: ASoundExt _sound1, _sound2, _sound3; Action1 _action1; Action2 _action2; - int _fieldB0E, _fieldB10; + int _nextSceneMode; + bool _modeFlag; Scene355(); virtual void synchronize(Serializer &s); @@ -603,7 +604,7 @@ public: virtual void process(Event &event); virtual void dispatch(); - void proc1(int v1, int v2); + void setMode(bool mode, int sceneMode); }; class Scene360: public SceneExt { diff --git a/engines/tsage/blue_force/blueforce_scenes4.cpp b/engines/tsage/blue_force/blueforce_scenes4.cpp new file mode 100644 index 0000000000..9e8b0d586d --- /dev/null +++ b/engines/tsage/blue_force/blueforce_scenes4.cpp @@ -0,0 +1,1659 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "tsage/blue_force/blueforce_scenes4.h" +#include "tsage/blue_force/blueforce_dialogs.h" +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/staticres.h" + +namespace TsAGE { + +namespace BlueForce { + +/*-------------------------------------------------------------------------- + * Scene 410 - Traffic Stop Gang Members + * + *--------------------------------------------------------------------------*/ + +void Scene410::Action1::signal() { + Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene; + + switch (scene->_field1FB6++) { + case 0: + if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) { + setDelay(3); + } else { + scene->_sceneMode = 4101; + scene->_stripManager.start(4103, scene); + } + break; + case 1: + scene->_sceneMode = 0; + scene->_stripManager.start(4104, scene); + break; + case 2: + scene->_sceneMode = 0; + scene->_stripManager.start(4105, scene); + break; + default: + scene->_sceneMode = 0; + scene->_stripManager.start(4106, scene); + break; + } +} + +void Scene410::Action2::signal() { + Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene; + BF_GLOBALS._player.disableControl(); + + switch (scene->_field1FB8++) { + case 0: + scene->_sceneMode = 4105; + scene->_stripManager.start(BF_GLOBALS.getFlag(fTalkedShooterNoBkup) ? 4123 : 4107, scene); + break; + case 1: + scene->_sceneMode = 4110; + scene->_stripManager.start(4102, scene); + break; + case 2: + scene->_sceneMode = 0; + scene->_stripManager.start(4108, scene); + break; + case 3: + scene->_sceneMode = 0; + scene->_stripManager.start(4109, scene); + break; + case 4: + scene->_sceneMode = 0; + scene->_stripManager.start(4110, scene); + break; + default: + SceneItem::display(410, 11, SET_WIDTH, 300, + SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 10, + SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + BF_INTERFACE_Y + 2, + SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 13, SET_EXT_BGCOLOR, 82, + SET_EXT_FGCOLOR, 13, LIST_END); + BF_GLOBALS._player.enableControl(); + break; + } +} + +void Scene410::Action3::signal() { + Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene; + if (BF_GLOBALS.getFlag(fTalkedShooterNoBkup)) { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 2; + scene->setAction(&scene->_sequenceManager1, scene, 4102, &scene->_object2, &BF_GLOBALS._player, NULL); + } else { + BF_GLOBALS.setFlag(fTalkedShooterNoBkup); + scene->_sceneMode = 0; + scene->_stripManager.start(4107, scene); + } +} + +void Scene410::Action4::signal() { + Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + if (scene->_field1FC4 == 0) { + ADD_PLAYER_MOVER(114, 133); + } else { + ADD_PLAYER_MOVER(195, 139); + } + break; + case 1: + BF_GLOBALS._player.updateAngle(scene->_object2._position); + setDelay(3); + break; + case 2: + setDelay(3); + break; + case 3: + if (BF_GLOBALS.getFlag(fCalledBackup)) + scene->setAction(&scene->_action2); + else + scene->setAction(&scene->_action3); + remove(); + break; + default: + break; + } +} + +void Scene410::Action5::signal() { + Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + if (scene->_field1FC4 == 0) { + ADD_PLAYER_MOVER(114, 133); + } else { + ADD_PLAYER_MOVER(195, 139); + } + break; + case 1: + BF_GLOBALS._player.updateAngle(scene->_object2._position); + setDelay(3); + break; + case 2: + setDelay(3); + break; + case 3: + if (BF_GLOBALS.getFlag(fCalledBackup)) + scene->setAction(&scene->_action2); + else + scene->setAction(&scene->_action3); + remove(); + break; + default: + break; + } +} + +void Scene410::Action6::signal() { + Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + if (scene->_field1FC4 == 0) { + ADD_PLAYER_MOVER(114, 133); + } else { + ADD_PLAYER_MOVER(126, 99); + } + break; + case 1: + BF_GLOBALS._player.updateAngle(scene->_object1._position); + setDelay(3); + break; + case 2: + setDelay(3); + break; + case 3: + if (BF_GLOBALS.getFlag(fCalledBackup)) + scene->setAction(&scene->_action1); + else + scene->setAction(&scene->_action4); + remove(); + break; + default: + break; + } +} + +void Scene410::Action7::signal() { + Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.disableControl(); + setDelay(2); + break; + case 1: + BF_GLOBALS._bookmark = bStoppedFrankie; + BF_GLOBALS.set2Flags(f1098Frankie); + BF_GLOBALS.clearFlag(f1098Marina); + scene->_stripManager.start(4113, this); + break; + case 2: + case 4: + setDelay(2); + break; + case 3: + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + BF_GLOBALS._player.updateAngle(Common::Point(100, 170)); + scene->setAction(&scene->_sequenceManager1, this, 4112, &scene->_object1, &scene->_object2, + &scene->_object3, NULL); + break; + case 5: + BF_GLOBALS._uiElements.addScore(30); + setAction(&scene->_sequenceManager1, this, 4118, &BF_GLOBALS._player, NULL); + BF_GLOBALS._player.disableControl(); + break; + case 6: + scene->_sceneMode = 3; + scene->signal(); + break; + default: + break; + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene410::Item2::startAction(CursorType action, Event &event) { + Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (!BF_GLOBALS.getFlag(fCalledBackup)) { + scene->_sceneMode = 4103; + scene->signal(); + } else if (BF_GLOBALS.getFlag(fSearchedTruck) && !BF_GLOBALS._sceneObjects->contains(&scene->_object3)) { + scene->_sceneMode = 4103; + scene->signal(); + } else if (scene->_field1FBC != 0) { + SceneItem::display2(410, 12); + } else { + scene->_sceneMode = 4103; + scene->signal(); + } + return true; + default: + return NamedHotspot::startAction(action, event); + } +} + +bool Scene410::Item4::startAction(CursorType action, Event &event) { + Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if ((BF_GLOBALS._bookmark < bStoppedFrankie) && (!scene->_field1FBC || !scene->_field1FBA)) + break; + else if (BF_GLOBALS.getFlag(fSearchedTruck)) + SceneItem::display2(410, 13); + else if (BF_GLOBALS.getFlag(fGangInCar)) { + BF_GLOBALS._uiElements.addScore(30); + scene->_sceneMode = 4118; + scene->signal(); + } else { + scene->setAction(&scene->_action7); + } + return true; + default: + break; + } + + return NamedHotspot::startAction(action, event); +} + + +/*--------------------------------------------------------------------------*/ + +bool Scene410::Object1::startAction(CursorType action, Event &event) { + Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (!BF_GLOBALS.getFlag(fCalledBackup)) { + if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) { + scene->setAction(&scene->_action4); + } else { + SceneItem::display2(410, 7); + } + } else if (!scene->_field1FBC) { + SceneItem::display2(410, 7); + } else if (!scene->_field1FC0) { + scene->_sceneMode = 4124; + scene->_field1FC0 = 1; + BF_GLOBALS._uiElements.addScore(30); + scene->signal(); + } else { + break; + } + return true; + case CURSOR_TALK: + BF_GLOBALS._player.setAction(&scene->_action6); + return true; + case INV_HANDCUFFS: + if (BF_GLOBALS.getFlag(fCalledBackup)) { + if ((scene->_field1FB8 < 5) || (scene->_field1FB6 < 1) || (scene->_field1FBC != 0)) + break; + + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 4123; + scene->_stripManager.start(4125, scene); + scene->_field1FBC = 1; + BF_GLOBALS._uiElements.addScore(30); + } else { + if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) { + scene->setAction(&scene->_action4); + } else { + break; + } + } + return true; + case INV_TICKET_BOOK: + if (!BF_GLOBALS.getFlag(fDriverOutOfTruck)) { + return startAction(CURSOR_TALK, event); + } else if (!scene->_field1FC4) { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 2; + scene->setAction(&scene->_sequenceManager1, scene, 4120, &scene->_object2, &BF_GLOBALS._player, NULL); + } else if ((scene->_field1FBC != 0) || (scene->_field1FC2 != 0)) { + break; + } else { + scene->_field1FC2 = 1; + BF_GLOBALS._uiElements.addScore(30); + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 4127; + scene->setAction(&scene->_sequenceManager1, scene, 4127, &scene->_object1, NULL); + } + return true; + case INV_MIRANDA_CARD: + if (scene->_field1FBC == 0) + return false; + + if (BF_GLOBALS.getFlag(readFrankRights)) { + SceneItem::display2(390, 15); + } else { + BF_GLOBALS.setFlag(readFrankRights); + BF_GLOBALS._uiElements.addScore(30); + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 0; + + // TODO: Original code pushes a copy of the entirety of object1 onto stack + scene->setAction(&scene->_sequenceManager1, scene, 4126, &BF_GLOBALS._player, &scene->_object1, NULL); + } + return true; + default: + break; + } + + return NamedObject::startAction(action, event); +} + +bool Scene410::Object2::startAction(CursorType action, Event &event) { + Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (!BF_GLOBALS.getFlag(fCalledBackup)) { + if (BF_GLOBALS.getFlag(fTalkedShooterNoBkup)) { + scene->setAction(&scene->_action3); + } else { + SceneItem::display2(410, 5); + } + } else if (!scene->_field1FBA) { + SceneItem::display2(410, 5); + } else if (!scene->_field1FBE) { + scene->_sceneMode = 4121; + scene->_field1FBE = 1; + BF_GLOBALS._uiElements.addScore(50); + scene->signal(); + } else { + break; + } + return true; + case CURSOR_TALK: + scene->setAction(&scene->_action5); + return true; + case INV_HANDCUFFS: + if (BF_GLOBALS.getFlag(fCalledBackup)) { + if ((scene->_field1FB8 < 5) || (scene->_field1FBA != 0)) + break; + + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 9; + ADD_PLAYER_MOVER(195, 139); + } else if (BF_GLOBALS.getFlag(fTalkedShooterNoBkup)) { + scene->setAction(&scene->_action3); + } else { + break; + } + return true; + case INV_MIRANDA_CARD: + if (!scene->_field1FBA) + break; + + if (BF_GLOBALS.getFlag(readFrankRights)) { + SceneItem::display2(390, 15); + } else { + BF_GLOBALS.setFlag(readFrankRights); + BF_GLOBALS._uiElements.addScore(30); + BF_GLOBALS._player.disableControl(); + + scene->_sceneMode = 0; + scene->setAction(&scene->_sequenceManager1, scene, 4125, &BF_GLOBALS._player, + &scene->_object2, NULL); + } + return true; + default: + break; + } + + return NamedObject::startAction(action, event); +} + +bool Scene410::Object3::startAction(CursorType action, Event &event) { + Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_TALK: + if (BF_GLOBALS._bookmark == bStoppedFrankie) { + if (BF_GLOBALS.getFlag(fSearchedTruck)) { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 8; + ADD_PLAYER_MOVER(147, 143); + } else { + SceneItem::display2(350, 13); + } + } else if ((scene->_field1FBA != 0) && (scene->_field1FBC != 0)) { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 4112; + scene->_stripManager.start(4113, scene); + BF_GLOBALS._bookmark = bStoppedFrankie; + BF_GLOBALS.set2Flags(f1098Frankie); + BF_GLOBALS.clearFlag(f1098Marina); + } else if ((BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 1) || + (!scene->_field1FBA && (scene->_field1FB8 < 5))) { + SceneItem::display2(350, 13); + } else if (!scene->_field1FBA) { + if (scene->_field1FBA) + error("Error - want to cuff shooter, but he's cuffed already"); + + BF_GLOBALS._player.disableControl(); + scene->_field1FBA = 1; + scene->_field1FBE = 1; + BF_GLOBALS._walkRegions.proc2(22); + scene->_sceneMode = 4122; + scene->_stripManager.start(4112, scene); + } else if (scene->_field1FB6 < 1) { + break; + } else if (scene->_field1FBC != 0) { + error("Error - want to cuff driver, but he's cuffed already"); + } else { + BF_GLOBALS._player.disableControl(); + scene->_field1FBC = 1; + scene->_field1FC0 = 1; + BF_GLOBALS._walkRegions.proc2(22); + scene->_sceneMode = 4109; + scene->_stripManager.start(4112, scene); + } + return true; + default: + break; + } + + return NamedObject::startAction(action, event); +} + + +/*--------------------------------------------------------------------------*/ + +Scene410::Scene410(): SceneExt() { + _field1FB6 = _field1FB8 = _field1FBA = _field1FBC = 0; + _field1FBE = _field1FC0 = _field1FC2 = _field1FC4 = 0; +} + +void Scene410::synchronize(Serializer &s) { + SceneExt::synchronize(s); + s.syncAsSint16LE(_field1FB6); + s.syncAsSint16LE(_field1FB8); + s.syncAsSint16LE(_field1FBA); + s.syncAsSint16LE(_field1FBC); + s.syncAsSint16LE(_field1FBE); + s.syncAsSint16LE(_field1FC0); + s.syncAsSint16LE(_field1FC2); + s.syncAsSint16LE(_field1FC4); +} + +void Scene410::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(410); + setZoomPercents(74, 75, 120, 100); + + if (BF_GLOBALS._sceneManager._previousScene != 60) + _sound1.fadeSound(11); + BF_GLOBALS._driveToScene = 64; + BF_GLOBALS._mapLocationId = 64; + BF_GLOBALS.setFlag(fArrivedAtGangStop); + + _stripManager.addSpeaker(&_gameTextSpeaker); + _stripManager.addSpeaker(&_jakeUniformSpeaker); + _stripManager.addSpeaker(&_harrisonSpeaker); + _stripManager.addSpeaker(&_shooterSpeaker); + + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.setVisage(1341); + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + BF_GLOBALS._player.changeAngle(90); + BF_GLOBALS._player.animate(ANIM_MODE_1, NULL); + BF_GLOBALS._player.setPosition(Common::Point(114, 133)); + BF_GLOBALS._player.changeZoom(-1); + + _item2.setDetails(8, 410, 15, -1, -1, 1); + + _object2.postInit(); + _object2.setVisage(415); + _object2.setStrip(1); + _object2.setPosition(Common::Point(278, 92)); + _object2.setDetails(410, 4, -1, 5, 1, NULL); + + _object1.postInit(); + _object1.setVisage(416); + _object1.setStrip(2); + _object1.setPosition(Common::Point(244, 85)); + _object1.setDetails(410, 6, -1, 7, 1, NULL); + _object1.changeZoom(-1); + + _object5.postInit(); + _object5.setVisage(410); + _object5.setStrip(2); + _object5.setPosition(Common::Point(282, 96)); + + _object6.postInit(); + _object6.setVisage(410); + _object6.setStrip(4); + _object6.setPosition(Common::Point(240, 43)); + + _item4.setDetails(6, 410, 3, -1, -1, 1); + _item3.setDetails(7, 410, 3, -1, -1, 1); + + switch (BF_GLOBALS._sceneManager._previousScene) { + case 415: + BF_GLOBALS.setFlag(fSearchedTruck); + BF_GLOBALS._player.setPosition(Common::Point(210, 90)); + + _object2.remove(); + _object1.remove(); + BF_GLOBALS._walkRegions.proc1(21); + BF_GLOBALS._walkRegions.proc1(22); + + _object3.postInit(); + _object3.setVisage(343); + _object3.setObjectWrapper(new SceneObjectWrapper()); + _object3.animate(ANIM_MODE_1, NULL); + _object3.setDetails(350, 12, 13, 14, 1, NULL); + _object3.setPosition(Common::Point(97, 185)); + _object3.changeZoom(-1); + + _object4.postInit(); + _object4.setVisage(410); + _object4.setDetails(410, 8, 9, 10, 1, NULL); + _object4.fixPriority(148); + _object4.setPosition(Common::Point(39, 168)); + + _field1FC4 = 1; + _sceneMode = 0; + signal(); + break; + case 60: + if (BF_GLOBALS.getFlag(fSearchedTruck)) { + _object2.remove(); + _object1.remove(); + _sceneMode = 0; + } else { + _field1FC4 = BF_GLOBALS._v50CC8; + _field1FBA = BF_GLOBALS._v50CC2; + _field1FB8 = BF_GLOBALS._v50CC6; + _field1FB6 = BF_GLOBALS._v50CC4; + + _object2.setVisage(418); + _object2.setStrip(6); + _object2.setPosition(Common::Point(227, 137)); + + if (_field1FB8 > 0) { + _object2.setVisage(415); + _object2.setStrip(2); + _object2.setFrame(5); + } + if (_field1FBA) { + _object2.setVisage(415); + _object2.setStrip(6); + _object2.setFrame(8); + } + + BF_GLOBALS._walkRegions.proc1(16); + if (BF_GLOBALS.getFlag(fDriverOutOfTruck)) { + _object1.setVisage(417); + _object1.setStrip(1); + _object1.setPosition(Common::Point(152, 97)); + + BF_GLOBALS._walkRegions.proc1(7); + } + + if (BF_GLOBALS.getFlag(fCalledBackup)) { + BF_GLOBALS._walkRegions.proc1(21); + BF_GLOBALS._walkRegions.proc1(22); + + _object3.postInit(); + _object3.setVisage(343); + _object3.setObjectWrapper(new SceneObjectWrapper()); + _object3.animate(ANIM_MODE_1, NULL); + _object3.setDetails(350, 12, 13, 14, 1, NULL); + BF_GLOBALS._sceneItems.addBefore(&_object1, &_object3); + + _object3.setPosition(Common::Point(-10, 124)); + _object3.changeZoom(-1); + + _object4.postInit(); + _object4.setVisage(410); + _object4.setDetails(410, 8, 9, 10, 1, NULL); + _object4.fixPriority(148); + + if (_field1FC4) { + _object3.setPosition(Common::Point(108, 112)); + _object4.fixPriority(148); + _object4.setPosition(Common::Point(39, 168)); + + _sceneMode = 0; + } else { + _sceneMode = 4104; + } + } else { + _sceneMode = 0; + } + + _field1FC4 = 1; + } + break; + case 50: + default: + BF_GLOBALS.setFlag(onDuty); + _sound1.play(21); + _sceneMode = 4100; + break; + } + + signal(); + + _item1.setDetails(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y), 410, 0, 1, 2, 1, NULL); +} + +void Scene410::signal() { + switch (_sceneMode) { + case 1: + BF_GLOBALS.set2Flags(f1097Frankie); + BF_GLOBALS.clearFlag(f1097Marina); + + BF_GLOBALS._v50CC8 = _field1FC4; + BF_GLOBALS._v50CC2 = _field1FBA; + BF_GLOBALS._v50CC6 = _field1FB8; + BF_GLOBALS._v50CC4 = _field1FB6; + BF_GLOBALS._sceneManager.changeScene(60); + break; + case 2: + BF_GLOBALS._deathReason = 3; + BF_GLOBALS._sound1.fadeOut2(NULL); + BF_GLOBALS._sceneManager.changeScene(666); + break; + case 3: + BF_GLOBALS._sceneManager.changeScene(415); + break; + case 5: + BF_INVENTORY.setObjectScene(INV_HANDCUFFS, 315); + _sceneMode = 0; + BF_GLOBALS.set2Flags(f1015Frankie); + BF_GLOBALS.clearFlag(f1015Marina); + signal(); + break; + case 6: + BF_INVENTORY.setObjectScene(INV_22_SNUB, 1); + BF_INVENTORY.setObjectScene(INV_FRANKIE_ID, 1); + BF_GLOBALS.set2Flags(f1027Frankie); + BF_GLOBALS.clearFlag(f1027Marina); + _sceneMode = 0; + signal(); + break; + case 7: + BF_INVENTORY.setObjectScene(INV_TYRONE_ID, 1); + signal(); + break; + case 8: + BF_GLOBALS._walkRegions.proc2(22); + BF_GLOBALS._player.changeAngle(225); + _object3.changeAngle(45); + _sceneMode = 4114; + _stripManager.start(4120, this); + break; + case 9: + _sceneMode = 4106; + _stripManager.start(4111, this); + _field1FBA = 1; + BF_GLOBALS.setFlag(fCuffedFrankie); + BF_GLOBALS._uiElements.addScore(30); + break; + case 10: + BF_GLOBALS._player.updateAngle(_object3._position); + _sceneMode = 0; + break; + case 4100: + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager1, this, 4100, &_object2, &_object5, NULL); + BF_GLOBALS._walkRegions.proc1(16); + break; + case 4101: + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager1, this, 4100, &_object1, &_object6, NULL); + BF_GLOBALS.setFlag(fDriverOutOfTruck); + BF_GLOBALS._walkRegions.proc1(7); + break; + case 4103: + BF_GLOBALS._player.disableControl(); + _sceneMode = 1; + setAction(&_sequenceManager1, this, 4103, &BF_GLOBALS._player, NULL); + break; + case 4104: + _field1FC4 = 1; + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager1, this, 4104, &_object4, &_object3, NULL); + break; + case 4105: + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager1, this, 4105, &_object2, NULL); + case 4106: + BF_GLOBALS._player.disableControl(); + _sceneMode = 4119; + setAction(&_sequenceManager1, this, 4106, &_object2, NULL); + break; + case 4107: + BF_GLOBALS._player.disableControl(); + _sceneMode = 5; + setAction(&_sequenceManager1, this, 4107, &_object2, NULL); + break; + case 4108: + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + BF_GLOBALS._player.updateAngle(Common::Point(100, 170)); + BF_GLOBALS._walkRegions.proc2(22); + BF_GLOBALS._walkRegions.proc2(16); + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager1, this, 4108, &_object3, NULL); + break; + case 4109: + if ((BF_GLOBALS._player._position.x > 116) && (BF_GLOBALS._player._position.x != 195) && + (BF_GLOBALS._player._position.y != 139)) { + ADD_PLAYER_MOVER(195, 139); + } + + BF_GLOBALS._walkRegions.proc2(22); + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager1, this, 4109, &_object1, &_object3, NULL); + break; + case 4110: + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager1, this, 4110, &_object3, &_object1, NULL); + break; + case 4112: + BF_GLOBALS.setFlag(fGangInCar); + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + BF_GLOBALS._player.updateAngle(Common::Point(100, 170)); + BF_GLOBALS._player.disableControl(); + _sceneMode = 4108; + setAction(&_sequenceManager1, this, 4112, &_object1, &_object2, &_object3, NULL); + break; + case 4114: + BF_GLOBALS._walkRegions.proc2(22); + BF_GLOBALS._player.disableControl(); + _sceneMode = 4116; + setAction(&_sequenceManager1, this, 4114, &_object3, &_object4, NULL); + break; + case 4116: + BF_GLOBALS._walkRegions.proc2(21); + BF_GLOBALS._walkRegions.proc2(22); + _object3.remove(); + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager1, this, 4116, &_object4, NULL); + break; + case 4118: + BF_GLOBALS._player.disableControl(); + _sceneMode = 3; + setAction(&_sequenceManager1, this, 4118, &BF_GLOBALS._player, NULL); + break; + case 4119: + BF_GLOBALS._player.disableControl(); + _sceneMode = 4107; + setAction(&_sequenceManager1, this, 4119, &_object2, NULL); + break; + case 4121: + BF_GLOBALS._player.disableControl(); + _sceneMode = 6; + setAction(&_sequenceManager1, this, 4121, &BF_GLOBALS._player, &_object2, NULL); + break; + case 4122: + BF_GLOBALS._walkRegions.proc2(22); + BF_INVENTORY.setObjectScene(INV_22_SNUB, 0); + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager1, this, 4122, &_object2, &_object3, NULL); + break; + case 4123: + BF_INVENTORY.setObjectScene(INV_TYRONE_ID, 0); + BF_GLOBALS._player.disableControl(); + _sceneMode = 5; + setAction(&_sequenceManager1, this, 4123, &_object1, &BF_GLOBALS._player, NULL); + break; + case 4124: + BF_GLOBALS._player.disableControl(); + _sceneMode = 7; + setAction(&_sequenceManager1, this, 4124, &_object1, &BF_GLOBALS._player, NULL); + break; + case 4127: + SceneItem::display2(410, 16); + BF_GLOBALS._player.enableControl(); + break; + case 0: + default: + BF_GLOBALS._player.enableControl(); + break; + } +} + +void Scene410::process(Event &event) { + // Check for gun being clicked on player + if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == INV_COLT45) && + BF_GLOBALS._player.contains(event.mousePos) && !BF_GLOBALS.getFlag(fCalledBackup)) { + if (BF_GLOBALS.getFlag(fTalkedShooterNoBkup)) { + if (!_action) { + event.handled = true; + BF_GLOBALS._player.disableControl(); + _sceneMode = 2; + setAction(&_sequenceManager1, this, 4102, &_object2, &BF_GLOBALS._player, NULL); + } + } else if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) { + if (!_action) { + _sceneMode = 1; + BF_GLOBALS._player.disableControl(); + _sceneMode = 2; + setAction(&_sequenceManager1, this, 4120, &_object2, &BF_GLOBALS._player, NULL); + } + } + } + + if (!event.handled) + SceneExt::process(event); +} + +void Scene410::dispatch() { + SceneExt::dispatch(); + if ((_sceneMode == 4112) || (_sceneMode == 4101)) { + _object3.updateAngle(_object1._position); + } +} + +/*-------------------------------------------------------------------------- + * Scene 415 - Searching Truck + * + *--------------------------------------------------------------------------*/ + +bool Scene415::GunInset::startAction(CursorType action, Event &event) { + Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + if (BF_GLOBALS.getFlag(fGotAutoWeapon)) { + FocusObject::startAction(action, event); + } else { + remove(); + scene->_gunAndWig.remove(); + } + return true; + } else { + return FocusObject::startAction(action, event); + } +} + +bool Scene415::GunAndWig::startAction(CursorType action, Event &event) { + Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + NamedObject::startAction(action, event); + BF_INVENTORY.setObjectScene(INV_AUTO_RIFLE, 1); + BF_INVENTORY.setObjectScene(INV_WIG, 1); + BF_GLOBALS.setFlag(fGotAutoWeapon); + BF_GLOBALS._uiElements.addScore(30); + + remove(); + return true; + case INV_FOREST_RAP: + if (scene->_fieldE14) + break; + + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 0; + scene->_stripManager.start(4126, scene); + BF_GLOBALS._uiElements.addScore(50); + scene->_fieldE14 = true; + return true; + default: + break; + } + + return NamedObject::startAction(action, event); +} + +bool Scene415::BulletsInset::startAction(CursorType action, Event &event) { + Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene; + + if (action == CURSOR_USE) { + if (BF_GLOBALS.getFlag(fGotAutoWeapon)) { + FocusObject::startAction(action, event); + } else { + remove(); + scene->_theBullets.remove(); + } + return true; + } else { + return FocusObject::startAction(action, event); + } +} + +bool Scene415::DashDrawer::startAction(CursorType action, Event &event) { + Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene; + + if ((action == CURSOR_LOOK) || (action == CURSOR_USE)) { + scene->showBullets(); + return true; + } else { + return NamedObject::startAction(action, event); + } +} + +bool Scene415::TheBullets::startAction(CursorType action, Event &event) { + Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + NamedObject::startAction(action, event); + BF_INVENTORY.setObjectScene(INV_22_BULLET, 1); + BF_GLOBALS.setFlag(fGotBulletsFromDash); + BF_GLOBALS._uiElements.addScore(30); + + remove(); + scene->_dashDrawer.remove(); + return true; + case INV_FOREST_RAP: + if (scene->_fieldE16) { + SceneItem::display2(415, 35); + return true; + } else { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 0; + scene->_stripManager.start(4122, scene); + BF_GLOBALS._uiElements.addScore(50); + scene->_fieldE16 = true; + } + break; + default: + break; + } + + return NamedObject::startAction(action, event); +} + +/*--------------------------------------------------------------------------*/ + +bool Scene415::Lever::startAction(CursorType action, Event &event) { + Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (BF_GLOBALS.getFlag(fGotAutoWeapon)) { + SceneItem::display2(415, 20); + } else { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 2; + scene->setAction(&scene->_sequenceManager, scene, 4150, &scene->_object6, NULL); + } + return true; + default: + return NamedHotspot::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +Scene415::Scene415(): SceneExt() { + _fieldE14 = _fieldE16 = false; +} + +void Scene415::synchronize(Serializer &s) { + SceneExt::synchronize(s); + s.syncAsSint16LE(_fieldE14); + s.syncAsSint16LE(_fieldE16); +} + +void Scene415::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(415); + + _stripManager.addSpeaker(&_jakeRadioSpeaker); + + _dashDrawer.postInit(); + _dashDrawer.setVisage(411); + _dashDrawer.setStrip(3); + _dashDrawer.setPosition(Common::Point(151, 97)); + _dashDrawer.setDetails(415, 22, -1, -1, 1, NULL); + + _object6.postInit(); + _object6.setVisage(419); + _object6.setStrip(1); + _object6.setPosition(Common::Point(306, 116)); + _object6.fixPriority(80); + + _windowLever.setDetails(16, 415, 25, -1, 26, 1); + _item7.setDetails(17, 415, 32, -1, 33, 1); + _seatBelt.setDetails(14, 415, 29, -1, 30, 1); + _lever.setDetails(19, 415, 23, 24, -1, 1); + _seat.setDetails(18, 415, 3, 4, 2, 1); + _dashboard.setDetails(20, 415, 11, 12, 19, 1); + _steeringWheel.setDetails(15, 415, 5, 6, 7, 1); + _horn.setDetails(31, 415, 8, 9, 10, 1); + _item1.setDetails(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y), 415, 0, 1, 2, 1, NULL); + + BF_GLOBALS._player.enableControl(); + BF_GLOBALS._player._canWalk = false; + BF_GLOBALS._events.setCursor(CURSOR_WALK); + + signal(); +} + +void Scene415::signal() { + switch (_sceneMode) { + case 1: + BF_GLOBALS._sceneManager.changeScene(410); + break; + case 2: + showGunAndWig(); + _sceneMode = 0; + signal(); + break; + case 0: + default: + BF_GLOBALS._player.enableControl(); + BF_GLOBALS._player._canWalk = false; + break; + } +} + +void Scene415::dispatch() { + SceneExt::dispatch(); + if (BF_GLOBALS.getFlag(fGotAutoWeapon) && BF_GLOBALS.getFlag(fGotBulletsFromDash)) { + _sceneMode = 1; + signal(); + } +} + +void Scene415::showBullets() { + _bulletsInset.postInit(); + _bulletsInset.setVisage(411); + _bulletsInset.setStrip(1); + _bulletsInset.setPosition(Common::Point(158, 100)); + _bulletsInset.setDetails(415, -1, -1, -1); + + _theBullets.postInit(); + _theBullets.setVisage(411); + _theBullets.setStrip(1); + _theBullets.setFrame(2); + _theBullets.setPosition(Common::Point(184, 86)); + _theBullets.fixPriority(105); + _theBullets.setDetails(415, 16, 17, 18, 1, NULL); + BF_GLOBALS._sceneItems.remove(&_theBullets); + BF_GLOBALS._sceneItems.push_front(&_theBullets); +} + +void Scene415::showGunAndWig() { + _gunInset.postInit(); + _gunInset.setVisage(411); + _gunInset.setStrip(2); + _gunInset.setPosition(Common::Point(158, 100)); + _gunInset.setDetails(415, -1, -1, -1); + + _gunAndWig.postInit(); + _gunAndWig.setVisage(411); + _gunAndWig.setStrip(2); + _gunAndWig.setFrame(2); + _gunAndWig.setPosition(Common::Point(159, 88)); + _gunAndWig.fixPriority(105); + _gunAndWig.setDetails(415, 13, 14, 15, 1, NULL); + + BF_GLOBALS._sceneItems.remove(&_gunAndWig); + BF_GLOBALS._sceneItems.push_front(&_gunAndWig); +} + +/*-------------------------------------------------------------------------- + * Scene 440 - Outside Alleycat Bowl + * + *--------------------------------------------------------------------------*/ + +bool Scene440::Doorway::startAction(CursorType action, Event &event) { + Scene440 *scene = (Scene440 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(440, 1); + return true; + case CURSOR_USE: + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 4400; + scene->setAction(&scene->_sequenceManager, scene, 4400, &BF_GLOBALS._player, this, &scene->_lyle, NULL); + return true; + default: + return NamedObject::startAction(action, event); + } +} + +bool Scene440::Vechile::startAction(CursorType action, Event &event) { + Scene440 *scene = (Scene440 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + if (BF_GLOBALS.getFlag(fWithLyle)) { + SceneItem::display2(440, 3); + } else { + SceneItem::display2(440, 2); + } + return true; + case CURSOR_USE: + if (BF_GLOBALS.getFlag(fWithLyle)) { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 4403; + scene->setAction(&scene->_sequenceManager, scene, 4403, &BF_GLOBALS._player, &scene->_lyle, NULL); + } else { + BF_GLOBALS._sceneManager.changeScene(60); + } + return true; + default: + return NamedObject::startAction(action, event); + } +} + +bool Scene440::Lyle::startAction(CursorType action, Event &event) { + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(440, 4); + return true; + case CURSOR_TALK: + SceneItem::display2(440, 5); + return true; + default: + return NamedObject::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene440::Item1::startAction(CursorType action, Event &event) { + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(440, 0); + return true; + default: + return NamedHotspot::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene440::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(440); + setZoomPercents(75, 60, 120, 100); + BF_GLOBALS._sound1.fadeSound(33); + + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.setVisage(303); + BF_GLOBALS._player.animate(ANIM_MODE_1, NULL); + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + BF_GLOBALS._player.changeZoom(-1); + BF_GLOBALS._player.disableControl(); + BF_GLOBALS._player.setPosition(Common::Point(203, 113)); + + _vechile.postInit(); + + _lyle.postInit(); + _lyle.setVisage(835); + _lyle.animate(ANIM_MODE_1, NULL); + _lyle.setObjectWrapper(new SceneObjectWrapper()); + _lyle.setPosition(Common::Point(-40, -10)); + _lyle.changeZoom(-1); + _lyle.hide(); + BF_GLOBALS._sceneItems.push_back(&_lyle); + + if (BF_GLOBALS.getFlag(fWithLyle)) { + _vechile.setVisage(444); + _vechile.setFrame(2); + _vechile.setPosition(Common::Point(147, 128)); + _vechile.fixPriority(114); + + BF_GLOBALS._player.setVisage(303); + BF_GLOBALS._player.setPosition(Common::Point(187, 104)); + + _lyle.setPosition(Common::Point(135, 128)); + _lyle.show(); + + BF_GLOBALS._walkRegions.proc1(12); + BF_GLOBALS._walkRegions.proc1(13); + } else { + _vechile.setPosition(Common::Point(169, 121)); + _vechile.fixPriority(117); + + if (BF_GLOBALS.getFlag(onDuty)) { + _vechile.setVisage(440); + _vechile.setStrip(1); + + BF_GLOBALS._player.setVisage(304); + BF_GLOBALS._player.setStrip(3); + } else { + _vechile.setVisage(580); + _vechile.setStrip(2); + _vechile.setFrame(3); + + BF_GLOBALS._player.setVisage(303); + } + } + + BF_GLOBALS._sceneItems.push_back(&_vechile); + BF_GLOBALS._walkRegions.proc1(11); + + _doorway.postInit(); + _doorway.setVisage(440); + _doorway.setStrip(5); + _doorway.setPosition(Common::Point(198, 91)); + _doorway.fixPriority(80); + BF_GLOBALS._sceneItems.push_back(&_doorway); + + if (BF_GLOBALS._sceneManager._previousScene == 450) { + _lyle.setPosition(Common::Point(143, 93)); + _lyle.setStrip(5); + _lyle.fixPriority(90); + + _doorway.setFrame(_doorway.getFrameCount()); + _sceneMode = 4401; + setAction(&_sequenceManager, this, 4401, &BF_GLOBALS._player, &_doorway, NULL); + } else if (BF_GLOBALS.getFlag(fWithLyle)) { + _sceneMode = 4402; + setAction(&_sequenceManager, this, 4402, &_lyle, NULL); + } else { + BF_GLOBALS._player.enableControl(); + } + + _item1.setBounds(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y - 1)); + BF_GLOBALS._sceneItems.push_back(&_item1); +} + +void Scene440::signal() { + switch (_sceneMode) { + case 4400: + BF_GLOBALS._sceneManager.changeScene(450); + break; + case 4401: + BF_GLOBALS._player.fixPriority(-1); + BF_GLOBALS._player.enableControl(); + break; + case 4402: + BF_GLOBALS._player.enableControl(); + break; + case 4403: + BF_GLOBALS._sceneManager.changeScene(60); + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 450 - Inside Alleycat Bowl + * + *--------------------------------------------------------------------------*/ + +bool Scene450::Object1::startAction(CursorType action, Event &event) { + Scene450 *scene = (Scene450 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(450, 0); + return true; + case CURSOR_USE: + SceneItem::display2(450, 1); + return true; + case CURSOR_TALK: + case INV_ID: + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 4504; + if (_flag) { + scene->setAction(&scene->_sequenceManager, scene, 4515, &BF_GLOBALS._player, this, NULL); + } else { + ++_flag; + scene->setAction(&scene->_sequenceManager, scene, 4504, &BF_GLOBALS._player, this, NULL); + } + return true; + case INV_FOREST_RAP: + BF_INVENTORY.setObjectScene(INV_FOREST_RAP, 450); + BF_GLOBALS._player.disableControl(); + BF_GLOBALS._uiElements.addScore(30); + + scene->_sceneMode = 4505; + scene->setAction(&scene->_sequenceManager, scene, 4505, &BF_GLOBALS._player, this, + &scene->_counterDoor, &scene->_object2, NULL); + return true; + default: + return NamedObjectExt::startAction(action, event); + } +} + +bool Scene450::Object3::startAction(CursorType action, Event &event) { + Scene450 *scene = (Scene450 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(450, 4); + return true; + case CURSOR_USE: + SceneItem::display2(450, 5); + return true; + case CURSOR_TALK: + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 4502; + if (BF_GLOBALS.getFlag(onDuty)) { + scene->setAction(&scene->_sequenceManager, scene, 4516, &BF_GLOBALS._player, this, NULL); + } else { + scene->setAction(&scene->_sequenceManager, scene, 4502, &BF_GLOBALS._player, this, NULL); + } + return true; + case INV_NAPKIN: + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 4509; + scene->setAction(&scene->_sequenceManager, scene, 4509, &BF_GLOBALS._player, this, NULL); + return true; + default: + return NamedObject::startAction(action, event); + } +} + +bool Scene450::Object4::startAction(CursorType action, Event &event) { + Scene450 *scene = (Scene450 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(450, 6); + return true; + case CURSOR_USE: + SceneItem::display2(450, 7); + return true; + case CURSOR_TALK: + BF_GLOBALS._player.disableControl(); + if (BF_GLOBALS.getFlag(takenWeasel) && !BF_GLOBALS.getFlag(gotTrailer450)) { + BF_GLOBALS.setFlag(gotTrailer450); + scene->_sceneMode = 4517; + scene->setAction(&scene->_sequenceManager, scene, 4517, &BF_GLOBALS._player, this, + &scene->_door, NULL); + } else { + animate(ANIM_MODE_8, 1, NULL); + + if (scene->_field19AC) { + scene->_sceneMode = 2; + if (scene->_field19AE) { + scene->_stripManager.start(4521, scene); + } else { + scene->_field19AE = 1; + scene->_stripManager.start(4512, scene); + } + } else { + scene->_sceneMode = 4506; + if (scene->_field19AE) { + scene->setAction(&scene->_sequenceManager, scene, 4518, &BF_GLOBALS._player, this, NULL); + } else { + scene->_sceneMode = 4506; + scene->_field19AE = 1; + scene->setAction(&scene->_sequenceManager, scene, 4506, &BF_GLOBALS._player, this, NULL); + } + } + } + return true; + case INV_FOREST_RAP: + SceneItem::display2(450, 19); + return true; + case INV_NAPKIN: + animate(ANIM_MODE_8, 1, NULL); + BF_GLOBALS._player.disableControl(); + + if (BF_GLOBALS.getFlag(showEugeneNapkin)) { + SceneItem::display2(450, 16); + BF_GLOBALS._player.enableControl(); + } else { + BF_GLOBALS.setFlag(showEugeneNapkin); + + if (!BF_GLOBALS.getFlag(showEugeneID)) { + scene->_sceneMode = 4513; + scene->setAction(&scene->_sequenceManager, scene, 4513, &BF_GLOBALS._player, this, NULL); + } else if (BF_GLOBALS.getFlag(fMgrCallsWeasel)) { + SceneItem::display2(450, 16); + BF_GLOBALS._player.enableControl(); + } else { + BF_GLOBALS._uiElements.addScore(30); + scene->_sceneMode = 4510; + BF_INVENTORY.setObjectScene(INV_NAPKIN, 450); + scene->setAction(&scene->_sequenceManager, scene, 4510, &BF_GLOBALS._player, this, NULL); + } + } + return true; + case INV_ID: + if (BF_GLOBALS.getFlag(takenWeasel)) { + return startAction(CURSOR_TALK, event); + } else { + animate(ANIM_MODE_8, 1, NULL); + BF_GLOBALS._player.disableControl(); + + if (!BF_GLOBALS.getFlag(showEugeneID)) + BF_GLOBALS._uiElements.addScore(30); + BF_GLOBALS.setFlag(showEugeneID); + + if ((BF_GLOBALS.getFlag(showRapEugene) || BF_GLOBALS.getFlag(showEugeneNapkin)) && + !BF_GLOBALS.getFlag(fMgrCallsWeasel)) { + BF_GLOBALS._uiElements.addScore(30); + scene->_sceneMode = 4511; + scene->setAction(&scene->_sequenceManager, scene, 4511, &BF_GLOBALS._player, this, NULL); + } else { + scene->_sceneMode = 4506; + scene->setAction(&scene->_sequenceManager, scene, 4512, &BF_GLOBALS._player, this, NULL); + } + } + return true; + default: + return NamedObject::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene450::Item1::startAction(CursorType action, Event &event) { + Scene450 *scene = (Scene450 *)BF_GLOBALS._sceneManager._scene; + + if (event.eventType == EVENT_BUTTON_DOWN) { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 4501; + scene->signal(); + return true; + } else { + return false; + } +} + +/*--------------------------------------------------------------------------*/ + +Scene450::Scene450(): SceneExt() { + _field19AC = _field19AE = 0; +} + +void Scene450::synchronize(Serializer &s) { + SceneExt::synchronize(s); + s.syncAsSint16LE(_field19AC); + s.syncAsSint16LE(_field19AE); +} + +void Scene450::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(450); + setZoomPercents(110, 90, 155, 115); + BF_GLOBALS._sound1.fadeSound(13); + + _stripManager.addSpeaker(&_gameTextSpeaker); + _stripManager.addSpeaker(&_eugeneSpeaker); + _stripManager.addSpeaker(&_billySpeaker); + _stripManager.addSpeaker(&_weaselSpeaker); + _stripManager.addSpeaker(&_jakeJacketSpeaker); + _stripManager.addSpeaker(&_lyleHatSpeaker); + _stripManager.addSpeaker(&_jakeUniformSpeaker); + + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 1341 : 129); + BF_GLOBALS._player.animate(ANIM_MODE_1, NULL); + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + BF_GLOBALS._player.setPosition(Common::Point(-30, 155)); + BF_GLOBALS._player.changeZoom(-1); + BF_GLOBALS._player.disableControl(); + + _door.postInit(); + _door.setVisage(450); + _door.setStrip(2); + _door.setPosition(Common::Point(72, 80)); + _door.setDetails(450, 15, -1, 13, 1, NULL); + + _counterDoor.postInit(); + _counterDoor.setVisage(450); + _counterDoor.setPosition(Common::Point(39, 104)); + _counterDoor.fixPriority(100); + _counterDoor.setDetails(450, 12, -1, 13, 1, NULL); + + if (BF_GLOBALS._dayNumber != 3) { + _object3.postInit(); + _object3.setVisage(463); + _object3.setPosition(Common::Point(138, 121)); + _object3.fixPriority(100); + _object3.setFrame(_object3.getFrameCount()); + BF_GLOBALS._sceneItems.push_back(&_object3); + } else if (!BF_GLOBALS.getFlag(fWithLyle) || !BF_GLOBALS.getFlag(fGivenNapkin) || + (BF_INVENTORY.getObjectScene(BF_LAST_INVENT) == 1)) { + _object3.postInit(); + _object3.setVisage(463); + _object3.setPosition(Common::Point(138, 121)); + _object3.fixPriority(100); + _object3.setFrame(_object3.getFrameCount()); + BF_GLOBALS._sceneItems.push_back(&_object3); + } else { + _object4.postInit(); + _object4.setVisage(467); + _object4.setPosition(Common::Point(138, 121)); + _object4.changeZoom(-1); + BF_GLOBALS._sceneItems.push_back(&_object4); + + if (!BF_GLOBALS.getFlag(takenWeasel)) { + _object2.postInit(); + _object2.setVisage(469); + _object2.animate(ANIM_MODE_1, NULL); + _object2.setObjectWrapper(new SceneObjectWrapper()); + _object2.setPosition(Common::Point(-30, 126)); + ADD_MOVER_NULL(_object2, 27, 126); + _object2.changeZoom(-1); + _object2.setDetails(450, 2, 18, 3, 1, NULL); + + BF_GLOBALS._walkRegions.proc1(4); + + _object1.postInit(); + _object1.setVisage(466); + _object1.animate(ANIM_MODE_1, NULL); + _object1.setObjectWrapper(new SceneObjectWrapper()); + _object1.setPosition(Common::Point(70, 80)); + _object1.setStrip(5); + _object1.changeZoom(90); + _object1.fixPriority(65); + _object1._flag = 0; + BF_GLOBALS._sceneItems.push_back(&_object1); + } + } + + _sceneMode = 4500; + setAction(&_sequenceManager, this, 4500, &BF_GLOBALS._player, NULL); + + _exit.setDetails(Rect(0, 100, 4, 167), 450, -1, -1, -1, 1, NULL); + _counter.setDetails(8, 450, 8, -1, 9, 1); + _shelf.setDetails(Rect(114, 10, 179, 77), 450, 10, -1, 11, 1, NULL); + _interior.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 450, 14, -1, -1, 1, NULL); +} + +void Scene450::signal() { + switch (_sceneMode) { + case 450: + case 451: + BF_GLOBALS._sceneManager.changeScene(440); + break; + case 4501: + if (BF_GLOBALS._sceneObjects->contains(&_object2)) { + ADD_MOVER(_object2, -20, 135); + } else { + ADD_PLAYER_MOVER(0, 160); + } + break; + case 4503: + _object1.fixPriority(100); + BF_GLOBALS._player.enableControl(); + break; + case 4505: + BF_GLOBALS.setFlag(takenWeasel); + _object1.remove(); + _object2.remove(); + BF_GLOBALS._walkRegions.proc2(4); + BF_GLOBALS._player.enableControl(); + break; + case 4507: + case 4510: + case 4511: + BF_GLOBALS.setFlag(fMgrCallsWeasel); + _field19AC = 1; + _sceneMode = 4503; + setAction(&_sequenceManager, this, 4503, &_object1, &_door, &_object4, NULL); + break; + case 4508: + _object4.remove(); + BF_GLOBALS._player.enableControl(); + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + break; + case 4517: + BF_GLOBALS.setFlag(gotTrailer450); + BF_INVENTORY.setObjectScene(BF_LAST_INVENT, 1); + _sceneMode = 4508; + setAction(&_sequenceManager, this, 4508, &BF_GLOBALS._player, &_object4, &_door, NULL); + break; + default: + BF_GLOBALS._player.enableControl(); + break; + } +} + +void Scene450::process(Event &event) { + SceneExt::process(event); + + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + // Check if the cursor is on an exit + if (_exit.contains(event.mousePos)) { + GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW); + BF_GLOBALS._events.setCursor(surface); + } else { + // In case an exit cursor was being shown, restore the previously selected cursor + CursorType cursorId = BF_GLOBALS._events.getCursor(); + BF_GLOBALS._events.setCursor(cursorId); + } + } +} + +} // End of namespace BlueForce + +} // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes4.h b/engines/tsage/blue_force/blueforce_scenes4.h new file mode 100644 index 0000000000..5da61cfaa0 --- /dev/null +++ b/engines/tsage/blue_force/blueforce_scenes4.h @@ -0,0 +1,267 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TSAGE_BLUEFORCE_SCENES4_H +#define TSAGE_BLUEFORCE_SCENES4_H + +#include "common/scummsys.h" +#include "tsage/blue_force/blueforce_logic.h" +#include "tsage/blue_force/blueforce_speakers.h" +#include "tsage/converse.h" +#include "tsage/events.h" +#include "tsage/core.h" +#include "tsage/scenes.h" +#include "tsage/globals.h" +#include "tsage/sound.h" + +namespace TsAGE { + +namespace BlueForce { + +using namespace TsAGE; + +class Scene410: public SceneExt { + /* Actions */ + class Action1: public Action { + public: + virtual void signal(); + }; + class Action2: public Action { + public: + virtual void signal(); + }; + class Action3: public Action { + public: + virtual void signal(); + }; + class Action4: public Action { + public: + virtual void signal(); + }; + class Action5: public Action { + public: + virtual void signal(); + }; + class Action6: public Action { + public: + virtual void signal(); + }; + class Action7: public Action { + public: + virtual void signal(); + }; + + /* Objects */ + class Object1: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Object2: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Object3: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Items */ + class Item2: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item4: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3; + Object1 _object1; + Object2 _object2; + Object3 _object3; + NamedObject _object4, _object5, _object6; + NamedHotspot _item1; + Item2 _item2; + NamedHotspot _item3; + Item4 _item4; + Action1 _action1; + Action2 _action2; + Action3 _action3; + Action4 _action4; + Action5 _action5; + Action6 _action6; + Action7 _action7; + SpeakerGameText _gameTextSpeaker; + SpeakerJakeUniform _jakeUniformSpeaker; + SpeakerHarrison _harrisonSpeaker; + SpeakerDriver _driverSpeaker; + SpeakerShooter _shooterSpeaker; + ASoundExt _sound1; + int _field1FB6, _field1FB8, _field1FBA; + int _field1FBC, _field1FBE; + int _field1FC0, _field1FC2, _field1FC4; + + Scene410(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void synchronize(Serializer &s); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); +}; + +class Scene415: public SceneExt { + /* Objects */ + class GunInset: public FocusObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class GunAndWig: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class BulletsInset: public FocusObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class DashDrawer: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class TheBullets: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Items */ + class Lever: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; +private: + void showBullets(); + void showGunAndWig(); +public: + SequenceManager _sequenceManager; + GunInset _gunInset; + GunAndWig _gunAndWig; + BulletsInset _bulletsInset; + DashDrawer _dashDrawer; + TheBullets _theBullets; + NamedObject _object6; + NamedHotspot _item1, _steeringWheel, _horn, _dashboard; + NamedHotspot _seat, _windowLever, _item7, _seatBelt; + Lever _lever; + SpeakerJakeRadio _jakeRadioSpeaker; + bool _fieldE14, _fieldE16; + + Scene415(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void synchronize(Serializer &s); + virtual void signal(); + virtual void dispatch(); +}; + +class Scene440: public SceneExt { + /* Objects */ + class Doorway: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Vechile: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Lyle: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Items */ + class Item1: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + SequenceManager _sequenceManager; + SpeakerGameText _gameTextSpeaker; + Doorway _doorway; + Vechile _vechile; + Lyle _lyle; + Item1 _item1; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene450: public SceneExt { + /* Objects */ + class Object1: public NamedObjectExt { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Object2: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Object3: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Object4: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Items */ + class Item1: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + SequenceManager _sequenceManager; + SpeakerGameText _gameTextSpeaker; + SpeakerLyleHat _lyleHatSpeaker; + SpeakerJakeJacket _jakeJacketSpeaker; + SpeakerJakeUniform _jakeUniformSpeaker; + SpeakerEugene _eugeneSpeaker; + SpeakerWeasel _weaselSpeaker; + SpeakerBilly _billySpeaker; + Object1 _object1; + NamedObject _object2; + Object3 _object3; + Object4 _object4; + NamedObject _door, _counterDoor; + NamedHotspot _exit, _interior, _shelf, _counter; + int _field19AC, _field19AE; + + Scene450(); + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); +}; + +} // End of namespace BlueForce + +} // End of namespace TsAGE + +#endif diff --git a/engines/tsage/blue_force/blueforce_scenes5.cpp b/engines/tsage/blue_force/blueforce_scenes5.cpp new file mode 100644 index 0000000000..4e7a39cdec --- /dev/null +++ b/engines/tsage/blue_force/blueforce_scenes5.cpp @@ -0,0 +1,898 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "tsage/blue_force/blueforce_scenes5.h" +#include "tsage/blue_force/blueforce_dialogs.h" +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/staticres.h" + +namespace TsAGE { + +namespace BlueForce { + +/*-------------------------------------------------------------------------- + * Scene 550 - Outside Bikini Hut + * + *--------------------------------------------------------------------------*/ + +void Scene550::Action1::signal() { + Scene550 *scene = (Scene550 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.disableControl(); + setDelay(5); + break; + case 1: + scene->_stripManager.start(scene->_sceneMode, this); + break; + case 2: + BF_GLOBALS._player.enableControl(); + remove(); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene550::Object1::startAction(CursorType action, Event &event) { + Scene550 *scene = (Scene550 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_TALK: + if ((BF_INVENTORY.getObjectScene(INV_SCHEDULE) == 1) || + (BF_INVENTORY.getObjectScene(INV_9MM_BULLETS) == 1)) { + if ((BF_INVENTORY.getObjectScene(INV_SCHEDULE) == 1) && + (BF_INVENTORY.getObjectScene(INV_9MM_BULLETS) == 1)) { + BF_GLOBALS.setFlag(fToldLyleOfSchedule); + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 5501; + scene->setAction(&scene->_sequenceManager, scene, 5514, &BF_GLOBALS._player, this, NULL); + } else { + scene->_sceneMode = 0; + scene->_stripManager.start(5509, scene); + } + } else if (BF_GLOBALS._sceneManager._previousScene == 930) { + scene->_sceneMode = 5512; + scene->setAction(&scene->_action1); + } else { + scene->_sceneMode = BF_INVENTORY.getObjectScene(BF_LAST_INVENT) == 1 ? 5513 : 5512; + scene->_stripManager.setAction(&scene->_action1); + } + return true; + case INV_SCHEDULE: + BF_GLOBALS.setFlag(fToldLyleOfSchedule); + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 5501; + scene->setAction(&scene->_sequenceManager, scene, 5514, &BF_GLOBALS._player, this, NULL); + return true; + default: + return NamedObject::startAction(action, event); + } +} + +bool Scene550::CaravanDoor::startAction(CursorType action, Event &event) { + Scene550 *scene = (Scene550 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(550, 0); + return true; + case CURSOR_USE: + SceneItem::display2(550, 7); + return true; + case BF_LAST_INVENT: + if ((BF_GLOBALS._dayNumber == 3) || !BF_GLOBALS.getFlag(fWithLyle)) + SceneItem::display2(550, 33); + else { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 5500; + scene->setAction(&scene->_sequenceManager, scene, 5500, &BF_GLOBALS._player, this, NULL); + } + return true; + default: + return NamedObject::startAction(action, event); + } +} + +bool Scene550::Vechile::startAction(CursorType action, Event &event) { + Scene550 *scene = (Scene550 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(550, 3); + return true; + case CURSOR_USE: + if (!BF_GLOBALS.getFlag(fWithLyle)) { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 5510; + scene->setAction(&scene->_sequenceManager, scene, BF_GLOBALS.getFlag(fWithLyle) ? 5510 : 5515, + &BF_GLOBALS._player, this, NULL); + } else if (BF_GLOBALS.getFlag(fToldLyleOfSchedule)) { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 2; + scene->setAction(&scene->_sequenceManager, scene, 5501, &BF_GLOBALS._player, NULL); + } else if ((BF_INVENTORY.getObjectScene(INV_SCHEDULE) == 1) || + (BF_INVENTORY.getObjectScene(INV_9MM_BULLETS) == 1)) { + if (BF_INVENTORY.getObjectScene(INV_9MM_BULLETS) == 1) { + scene->_sceneMode = 5501; + scene->_stripManager.start(5511, scene); + } else { + scene->_sceneMode = 0; + scene->_stripManager.start(5509, scene); + } + } else if (BF_GLOBALS._sceneManager._previousScene == 930) { + scene->_sceneMode = 5512; + scene->setAction(&scene->_action1); + } else { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 2; + scene->setAction(&scene->_sequenceManager, scene, 5501, &BF_GLOBALS._player, NULL); + } + return true; + default: + return NamedObject::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene550::postInit(SceneObjectList *OwnerList) { + BF_GLOBALS._sound1.fadeSound(16); + + if ((BF_GLOBALS._bookmark == bInspectionDone) && !BF_GLOBALS.getFlag(fHasDrivenFromDrunk)) { + _sceneMode = 1; + signal(); + return; + } + + SceneExt::postInit(); + loadScene(550); + + _stripManager.addSpeaker(&_gameTextSpeaker); + _stripManager.addSpeaker(&_lyleHatSpeaker); + _stripManager.addSpeaker(&_jakeJacketSpeaker); + + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.animate(ANIM_MODE_1, NULL); + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + BF_GLOBALS._player.setPosition(Common::Point(160, 100)); + BF_GLOBALS._player._moveDiff = Common::Point(2, 1); + BF_GLOBALS._player.enableControl(); + + _caravanDoor.postInit(); + _caravanDoor.setVisage(550); + _caravanDoor.setPosition(Common::Point(34, 66)); + BF_GLOBALS._sceneItems.push_back(&_caravanDoor); + + _vechile.postInit(); + _vechile.fixPriority(70); + + if (BF_GLOBALS.getFlag(fWithLyle)) { + BF_GLOBALS._walkRegions.proc1(10); + BF_GLOBALS._walkRegions.proc1(11); + + _vechile.setVisage(444); + _vechile.setStrip(4); + _vechile.setFrame2(2); + _vechile.setPosition(Common::Point(110, 85)); + _vechile.fixPriority(76); + + _object1.postInit(); + _object1.setVisage(835); + _object1.setPosition(Common::Point(139, 83)); + _object1.setDetails(550, 29, 30, 31, 1, NULL); + _object1.setStrip(8); + + BF_GLOBALS._player.setVisage(303); + BF_GLOBALS._player.setPosition(Common::Point(89, 76)); + BF_GLOBALS._player.updateAngle(_object1._position); + } else { + BF_GLOBALS._walkRegions.proc1(12); + + _vechile.setPosition(Common::Point(205, 77)); + _vechile.changeZoom(80); + + if (BF_GLOBALS.getFlag(onDuty)) { + _vechile.setVisage(301); + _vechile.setStrip(1); + + BF_GLOBALS._player.setVisage(304); + } else { + _vechile.setVisage(580); + _vechile.setStrip(2); + _vechile.setFrame(2); + + BF_GLOBALS._player.setVisage(303); + } + + BF_GLOBALS._sceneItems.push_back(&_vechile); + + if (BF_GLOBALS._sceneManager._previousScene == 930) { + _caravanDoor.setFrame(_caravanDoor.getFrameCount()); + BF_GLOBALS._player.disableControl(); + + _sceneMode = 0; + setAction(&_sequenceManager, this, 5512, &BF_GLOBALS._player, &_caravanDoor, NULL); + } else if (BF_GLOBALS.getFlag(onDuty)) { + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager, this, 5502, &BF_GLOBALS._player, &_vechile, NULL); + } else if (!BF_GLOBALS.getFlag(fWithLyle)) { + BF_GLOBALS._player.setPosition(Common::Point(185, 70)); + } else if (BF_GLOBALS._bookmark == bFlashBackOne) { + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager, this, 5513, &_object1, NULL); + } else { + _sceneMode = 0; + } + } + + _item2.setDetails(Rect(0, 26, 53, 67), 550, 1, -1, 2, 1, NULL); + _item3.setDetails(Rect(53, 12, 173, 65), 550, 4, -1, 5, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 170), 550, 6, -1, -1, 1, NULL); +} + +void Scene550::signal() { + switch (_sceneMode) { + case 0: + BF_GLOBALS._player.enableControl(); + break; + case 1: + BF_GLOBALS._sceneManager.changeScene(551); + break; + case 2: + case 5510: + BF_GLOBALS._sceneManager.changeScene(60); + break; + case 3: + BF_GLOBALS._driveFromScene = 16; + BF_GLOBALS._driveToScene = 128; + BF_GLOBALS._mapLocationId = 128; + BF_GLOBALS._sound1.fadeOut2(NULL); + BF_GLOBALS._sceneManager.changeScene(800); + break; + case 5500: + BF_GLOBALS._sceneManager.changeScene(930); + break; + case 5501: + BF_GLOBALS._player.disableControl(); + _sceneMode = 3; + setAction(&_sequenceManager, this, 5501, &BF_GLOBALS._player, NULL); + break; + default: + break; + } +} + +/*-------------------------------------------------------------------------- + * Scene 551 - Outside Bikini Hut (Drunk Stop) + * + *--------------------------------------------------------------------------*/ + +void Scene551::Action2::signal() { + Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + BF_GLOBALS._walkRegions.proc2(18); + BF_GLOBALS._walkRegions.proc2(4); + scene->_field1CD2 = 1; + + scene->_harrison.setObjectWrapper(new SceneObjectWrapper()); + scene->_harrison.animate(ANIM_MODE_1, NULL); + + BF_GLOBALS._player.setVisage(304); + BF_GLOBALS._player.animate(ANIM_MODE_1, NULL); + + if (scene->_drunkStanding._flag != 1) { + ADD_PLAYER_MOVER_THIS(scene->_harrison, 126, 85); + } else { + ADD_PLAYER_MOVER_THIS(scene->_harrison, 88, 91); + } + break; + case 1: + scene->_harrison.updateAngle(BF_GLOBALS._player._position); + + if (scene->_drunkStanding._flag == 1) { + BF_GLOBALS._walkRegions.proc1(4); + ADD_PLAYER_MOVER(71, 97); + } else { + ADD_PLAYER_MOVER(141, 87); + } + break; + case 2: + scene->_harrison.updateAngle(BF_GLOBALS._player._position); + BF_GLOBALS._player.updateAngle(scene->_harrison._position); + setDelay(10); + break; + case 3: + scene->_stripManager.start(scene->_harrison._flag, this); + break; + case 4: + scene->_field1CD2 = 0; + BF_GLOBALS._player.enableControl(); + remove(); + break; + default: + break; + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene551::Vechile::startAction(CursorType action, Event &event) { + Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(550, 3); + return true; + case CURSOR_USE: + if (!BF_GLOBALS.getFlag(didDrunk)) { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 1; + scene->setAction(&scene->_sequenceManager, scene, 5510, &BF_GLOBALS._player, this, NULL); + } else if (BF_INVENTORY.getObjectScene(INV_CENTER_PUNCH) == 1) { + BF_INVENTORY.setObjectScene(INV_CENTER_PUNCH, 0); + scene->_harrison._flag = 5505; + scene->setAction(&scene->_action2, scene); + scene->_sceneMode = 5509; + } else { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 1; + scene->setAction(&scene->_sequenceManager, scene, 5510, &BF_GLOBALS._player, this, NULL); + } + return true; + default: + return NamedObject::startAction(action, event); + } +} + +bool Scene551::DrunkStanding::startAction(CursorType action, Event &event) { + Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(550, 15); + return true; + case CURSOR_USE: + SceneItem::display2(550, 16); + return true; + case CURSOR_TALK: + SceneItem::display2(550, 17); + return true; + case INV_HANDCUFFS: + scene->_harrison.animate(ANIM_MODE_1, NULL); + BF_GLOBALS.set2Flags(f1098Drunk); + BF_GLOBALS.setFlag(didDrunk); + _flag = 2; + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 5509; + + scene->setAction(&scene->_sequenceManager, scene, 5509, &BF_GLOBALS._player, this, &scene->_harrison, NULL); + BF_GLOBALS.set2Flags(f1015Drunk); + return true; + default: + return NamedObjectExt::startAction(action, event); + } +} + +bool Scene551::Drunk::startAction(CursorType action, Event &event) { + Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + switch (_flag) { + case 0: + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 0; + scene->setAction(&scene->_sequenceManager, scene, 5505, &BF_GLOBALS._player, &scene->_object15, NULL); + break; + case 1: + SceneItem::display(550, 11); + break; + case 2: + SceneItem::display2(550, 12); + break; + case 3: + SceneItem::display2(550, 27); + break; + } + return true; + case CURSOR_USE: + switch (_flag) { + case 0: + BF_GLOBALS._player.disableControl(); + if (BF_GLOBALS.getFlag(fTalkedToDrunkInCar)) { + scene->_sceneMode = 5508; + scene->setAction(&scene->_sequenceManager, scene, 5508, &BF_GLOBALS._player, NULL); + } else { + BF_GLOBALS.setFlag(fTalkedToDrunkInCar); + scene->_sceneMode = 16; + scene->setAction(&scene->_sequenceManager, scene, 5504, &BF_GLOBALS._player, &scene->_object15, NULL); + } + break; + case 2: + SceneItem::display2(550, 13); + break; + case 3: + SceneItem::display2(550, 27); + break; + default: + break; + } + return true; + case CURSOR_TALK: + if (_flag) + break; + BF_GLOBALS._player.disableControl(); + + if (BF_GLOBALS.getFlag(fTalkedToDrunkInCar)) { + scene->_sceneMode = 5508; + scene->setAction(&scene->_sequenceManager, scene, 5508, &BF_GLOBALS._player, NULL); + } else { + BF_GLOBALS.setFlag(fTalkedToDrunkInCar); + scene->_sceneMode = 0; + scene->setAction(&scene->_sequenceManager, scene, 5504, &BF_GLOBALS._player, &scene->_object15, NULL); + } + return true; + case INV_CENTER_PUNCH: + if (_flag) { + SceneItem::display2(550, 14); + } else { + BF_GLOBALS.set2Flags(f1098Drunk); + BF_GLOBALS.setFlag(didDrunk); + _flag = 1; + BF_GLOBALS._uiElements.addScore(30); + + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 5506; + scene->setAction(&scene->_sequenceManager, scene, 5506, &BF_GLOBALS._player, this, + &scene->_object12, NULL); + } + return true; + default: + break; + } + + return NamedObjectExt::startAction(action, event); +} + +bool Scene551::PatrolCarTrunk::startAction(CursorType action, Event &event) { + Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (BF_INVENTORY.getObjectScene(INV_CENTER_PUNCH) != 1) { + BF_GLOBALS._walkRegions.proc2(18); + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 2; + scene->setAction(&scene->_sequenceManager, scene, 5503, &BF_GLOBALS._player, &scene->_harrison, this, NULL); + return true; + } + break; + default: + break; + } + + return NamedObject::startAction(action, event); +} + +void Scene551::TrunkInset::remove() { + Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene; + scene->_trunkKits.remove(); + BF_GLOBALS._player.disableControl(); + + scene->_sceneMode = 0; + scene->setAction(&scene->_sequenceManager, scene, 5516, &scene->_harrison, + &scene->_patrolCarTrunk, NULL); + + FocusObject::remove(); +} + +bool Scene551::TrunkInset::startAction(CursorType action, Event &event) { + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(550, 18); + return true; + case CURSOR_USE: + return true; + default: + return NamedObject::startAction(action, event); + } +} + +bool Scene551::TrunkKits::startAction(CursorType action, Event &event) { + Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene; + + Rect tempRect = _bounds; + tempRect.collapse(10, 6); + if (!tempRect.contains(event.mousePos)) + return false; + + switch (action) { + case CURSOR_LOOK: + switch (_frame) { + case 1: + SceneItem::display2(550, 19); + break; + case 2: + SceneItem::display2(550, 20); + break; + case 3: + SceneItem::display2(550, 21); + break; + default: + break; + } + return true; + case CURSOR_USE: + if (event.mousePos.y < _bounds.top) { + setFrame(1); + } else if ((event.mousePos.x < (_bounds.left - 25)) && (_frame > 1)) { + SceneItem::display2(550, 28); + } else { + switch (_frame) { + case 1: + setFrame(BF_INVENTORY.getObjectScene(INV_CENTER_PUNCH) == 1 ? 3 : 2); + break; + case 2: + if (!BF_GLOBALS.getFlag(fShowedBluePrint)) { + BF_GLOBALS._uiElements.addScore(30); + BF_GLOBALS.setFlag(fShowedBluePrint); + } + + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 5520; + scene->setAction(&scene->_sequenceManager, scene, 5520, &BF_GLOBALS._player, NULL); + BF_INVENTORY.setObjectScene(INV_CENTER_PUNCH, 1); + setFrame(3); + break; + case 3: + setFrame(1); + break; + default: + break; + } + } + return true; + case INV_CENTER_PUNCH: + SceneItem::display2(550, 22); + BF_INVENTORY.setObjectScene(INV_CENTER_PUNCH, 0); + setFrame(2); + return true; + default: + return NamedObject::startAction(action, event); + } +} + +bool Scene551::Harrison::startAction(CursorType action, Event &event) { + Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(550, 23); + return true; + case CURSOR_USE: + SceneItem::display2(550, 24); + return true; + case CURSOR_TALK: + BF_GLOBALS._player.disableControl(); + + if (scene->_drunkStanding._flag == 1) { + _flag = 5508; + } else if (!scene->_field1CD0) { + _flag = 5502; + } else { + scene->_field1CD0 = 1; + _flag = 5500; + } + scene->setAction(&scene->_action2); + return true; + default: + return NamedObjectExt::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene551::Item4::startAction(CursorType action, Event &event) { + Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(550, 34); + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 1; + scene->setAction(&scene->_sequenceManager, scene, 5510, &BF_GLOBALS._player, &scene->_vechile2, NULL); + return true; + default: + return false; + } +} + +/*--------------------------------------------------------------------------*/ + +Scene551::Scene551(): Scene550() { + _field1CD0 = _field1CD2 = 0; +} + +void Scene551::synchronize(Serializer &s) { + Scene550::synchronize(s); + s.syncAsSint16LE(_field1CD0); + s.syncAsSint16LE(_field1CD2); +} + +void Scene551::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(550); + BF_GLOBALS._walkRegions.load(551); + BF_GLOBALS._sound1.fadeSound(16); + + _stripManager.addSpeaker(&_gameTextSpeaker); + _stripManager.addSpeaker(&_jakeUniformSpeaker); + _stripManager.addSpeaker(&_gigglesSpeaker); + _stripManager.addSpeaker(&_drunkSpeaker); + + if (BF_GLOBALS.getFlag(fHasLeftDrunk)) { + _item4.setBounds(Rect(0, 0, 320, 170)); + BF_GLOBALS._sceneItems.push_back(&_item4); + } + + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.animate(ANIM_MODE_1, NULL); + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + BF_GLOBALS._player.setPosition(Common::Point(160, 100)); + BF_GLOBALS._player._moveDiff = Common::Point(2, 1); + BF_GLOBALS._player.enableControl(); + + _caravanDoor.postInit(); + _caravanDoor.setVisage(550); + _caravanDoor.setPosition(Common::Point(34, 66)); + BF_GLOBALS._sceneItems.push_back(&_caravanDoor); + + _vechile2.postInit(); + _vechile2.setVisage(301); + _vechile2.setStrip(1); + _vechile2.setPosition(Common::Point(205, 77)); + _vechile2.fixPriority(70); + _vechile2.changeZoom(80); + BF_GLOBALS._sceneItems.push_back(&_vechile2); + + BF_GLOBALS._walkRegions.proc1(14); + + _drunk.postInit(); + _drunk.setVisage(550); + _drunk.setStrip(3); + _drunk.fixPriority(84); + _drunk.setPosition(Common::Point(29, 92)); + _drunk._flag = 0; + BF_GLOBALS._sceneItems.push_back(&_drunk); + + _object12.postInit(); + _object12.setVisage(550); + _object12.setStrip(7); + _object12.setPosition(Common::Point(29, 92)); + _object12.hide(); + + _object13.postInit(); + _object13.setVisage(550); + _object13.setStrip(2); + _object13.setPosition(Common::Point(29, 92)); + _object13.fixPriority(82); + _object13.setDetails(550, 8, -1, 9, 1, NULL); + + if (BF_GLOBALS.getFlag(didDrunk)) { + _drunk._flag = 3; + _drunk.setStrip(3); + + _object12.show(); + _object12.setDetails(550, 25, -1, 26, 1, NULL); + BF_GLOBALS._sceneItems.push_front(&_object12); + + _harrison.postInit(); + _harrison.setVisage(304); + _harrison.setPosition(Common::Point(67, 102)); + _harrison.setStrip(8); + _harrison.setFrame(1); + _harrison._flag = 1; + BF_GLOBALS._sceneItems.push_back(&_harrison); + + _object14.postInit(); + _object14.setVisage(550); + _object14.setStrip(5); + _object14.animate(ANIM_MODE_2, NULL); + _object14.fixPriority(80); + _object14.setPosition(Common::Point(122, 57)); + + _object11.postInit(); + _object11.setVisage(550); + _object11.setStrip(2); + _object11.setFrame(2); + _object11.setPosition(Common::Point(116, 84)); + _object11.fixPriority(77); + _object11.setDetails(550, 32, -1, 10, 1, NULL); + + _drunkStanding.postInit(); + _drunkStanding._flag = 0; + _drunkStanding.setVisage(554); + _drunkStanding.setStrip(7); + _drunkStanding.setFrame(8); + _drunkStanding.fixPriority(83); + _drunkStanding.setPosition(Common::Point(57, 99)); + } else { + _harrison.postInit(); + _harrison.setVisage(304); + _harrison.setPosition(Common::Point(126, 83)); + _harrison.setObjectWrapper(new SceneObjectWrapper()); + _harrison._flag = 0; + _harrison._moveDiff = Common::Point(2, 1); + BF_GLOBALS._sceneItems.push_back(&_harrison); + + _object14.postInit(); + _object14.setVisage(550); + _object14.setStrip(5); + _object14.animate(ANIM_MODE_2, NULL); + _object14.fixPriority(80); + _object14.setPosition(Common::Point(122, 57)); + + _patrolCarTrunk.postInit(); + _patrolCarTrunk.setVisage(550); + _patrolCarTrunk.setStrip(4); + _patrolCarTrunk.setFrame(1); + _patrolCarTrunk.setPosition(Common::Point(149, 69)); + _patrolCarTrunk.fixPriority(79); + _patrolCarTrunk.setDetails(550, 18, -1, 9, 1, NULL); + + _object11.postInit(); + _object11.setVisage(550); + _object11.setStrip(2); + _object11.setFrame(2); + _object11.setPosition(Common::Point(116, 84)); + _object11.fixPriority(77); + _object11.setDetails(550, 32, -1, 10, 1, NULL); + + _drunkStanding.postInit(); + _drunkStanding._flag = 0; + _drunkStanding.setVisage(554); + _drunkStanding.fixPriority(83); + _drunkStanding.setPosition(Common::Point(47, 93)); + + _object15.postInit(); + _object15.setVisage(552); + _object15.setPosition(Common::Point(59, 94)); + _object15.fixPriority(200); + _object15.hide(); + } + + BF_GLOBALS._player.disableControl(); + _sceneMode = 3; + setAction(&_sequenceManager, this, 5502, &BF_GLOBALS._player, &_vechile2, NULL); + + _item2.setDetails(Rect(0, 26, 53, 67), 550, 1, -1, 2, 1, NULL); + _item3.setDetails(Rect(53, 12, 173, 65), 550, 4, -1, 5, 1, NULL); + _item1.setDetails(Rect(0, 0, 320, 170), 550, 6, -1, -1, 1, NULL); +} + +void Scene551::signal() { + switch (_sceneMode) { + case 0: + BF_GLOBALS._player.enableControl(); + break; + case 1: + BF_GLOBALS._sound1.fadeOut2(NULL); + BF_GLOBALS.set2Flags(f1027Drunk); + BF_GLOBALS.set2Flags(f1097Drunk); + + if (BF_GLOBALS.getFlag(didDrunk)) + BF_GLOBALS.setFlag(f1098Drunk); + + BF_GLOBALS._sceneManager.changeScene(60); + break; + case 2: + BF_GLOBALS._walkRegions.proc1(18); + + _trunkInset.postInit(); + _trunkInset.setVisage(553); + _trunkInset.setPosition(Common::Point(59, 92)); + _trunkInset.fixPriority(252); + BF_GLOBALS._sceneItems.push_front(&_trunkInset); + + _trunkKits.postInit(); + _trunkKits.setVisage(553); + _trunkKits.setStrip(2); + _trunkKits.setPosition(Common::Point(57, 73)); + _trunkKits.fixPriority(254); + BF_GLOBALS._sceneItems.push_front(&_trunkKits); + BF_GLOBALS._player.enableControl(); + break; + case 3: + if (BF_GLOBALS.getFlag(talkedToHarrisAboutDrunk)) { + BF_GLOBALS._player.enableControl(); + } else { + BF_GLOBALS.setFlag(talkedToHarrisAboutDrunk); + _harrison._flag = 5500; + setAction(&_action2); + } + break; + case 5506: + _harrison.setObjectWrapper(new SceneObjectWrapper()); + ADD_PLAYER_MOVER_NULL(_harrison, 88, 91); + + _object12.show(); + _object12.setDetails(550, 25, -1, 26, 1, NULL); + BF_GLOBALS._sceneItems.push_front(&_object12); + BF_GLOBALS._player.enableControl(); + + _sceneMode = 5507; + setAction(&_sequenceManager, this, 5507, &BF_GLOBALS._player, &_drunk, &_drunkStanding, NULL); + break; + case 5507: + BF_GLOBALS._walkRegions.proc1(2); + BF_GLOBALS._walkRegions.proc1(4); + + _drunkStanding._flag = 1; + BF_GLOBALS._sceneItems.push_front(&_drunkStanding); + BF_GLOBALS._player.enableControl(); + break; + case 5508: + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager, this, 5505, &BF_GLOBALS._player, &_object15, NULL); + break; + case 5509: + BF_INVENTORY.setObjectScene(INV_CENTER_PUNCH, 0); + BF_GLOBALS._player.disableControl(); + _sceneMode = 5510; + setAction(&_sequenceManager, this, 5510, &BF_GLOBALS._player, &_vechile2, NULL); + break; + case 5510: + BF_GLOBALS._bookmark = bCalledToDrunkStop; + if (BF_GLOBALS.getFlag(didDrunk)) + BF_GLOBALS.setFlag(fHasLeftDrunk); + + BF_GLOBALS._sceneManager.changeScene(60); + break; + case 5520: + BF_GLOBALS._player.animate(ANIM_MODE_1, NULL); + _harrison.animate(ANIM_MODE_1, NULL); + BF_GLOBALS._player.enableControl(); + break; + default: + BF_GLOBALS._player.enableControl(); + break; + } +} + +void Scene551::dispatch() { + SceneExt::dispatch(); + + if ((_drunkStanding._flag != 2) && !_harrison._mover && !_field1CD2) + _harrison.updateAngle(BF_GLOBALS._player._position); +} + +} // End of namespace BlueForce + +} // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes5.h b/engines/tsage/blue_force/blueforce_scenes5.h new file mode 100644 index 0000000000..94594f9594 --- /dev/null +++ b/engines/tsage/blue_force/blueforce_scenes5.h @@ -0,0 +1,148 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TSAGE_BLUEFORCE_SCENES5_H +#define TSAGE_BLUEFORCE_SCENES5_H + +#include "common/scummsys.h" +#include "tsage/blue_force/blueforce_logic.h" +#include "tsage/blue_force/blueforce_speakers.h" +#include "tsage/converse.h" +#include "tsage/events.h" +#include "tsage/core.h" +#include "tsage/scenes.h" +#include "tsage/globals.h" +#include "tsage/sound.h" + +namespace TsAGE { + +namespace BlueForce { + +using namespace TsAGE; + +class Scene550: public SceneExt { + /* Objects */ + class Object1: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class CaravanDoor: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Vechile: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Actions */ + class Action1: public ActionExt { + public: + virtual void signal(); + }; +public: + SequenceManager _sequenceManager; + Object1 _object1; + CaravanDoor _caravanDoor; + Vechile _vechile; + NamedHotspot _item1, _item2, _item3; + SpeakerGameText _gameTextSpeaker; + SpeakerLyleHat _lyleHatSpeaker; + SpeakerJakeJacket _jakeJacketSpeaker; + Action1 _action1; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene551: public Scene550 { + /* Objects */ + class Vechile: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class DrunkStanding: public NamedObjectExt { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Drunk: public NamedObjectExt { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class PatrolCarTrunk: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class TrunkInset: public FocusObject { + public: + virtual void remove(); + virtual bool startAction(CursorType action, Event &event); + }; + class TrunkKits: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Harrison: public NamedObjectExt { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Items */ + class Item4: public SceneHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Actions */ + class Action2: public Action { + public: + virtual void signal(); + }; +public: + SpeakerDrunk _drunkSpeaker; + SpeakerJakeUniform _jakeUniformSpeaker; + SpeakerGiggles _gigglesSpeaker; + Vechile _vechile2; + DrunkStanding _drunkStanding; + Drunk _drunk; + PatrolCarTrunk _patrolCarTrunk; + TrunkInset _trunkInset; + TrunkKits _trunkKits; + Harrison _harrison; + NamedObject _object11, _object12, _object13; + SceneObject _object14, _object15; + Item4 _item4; + Action2 _action2; + int _field1CD0, _field1CD2; + + Scene551(); + virtual void synchronize(Serializer &s); + void postInit(SceneObjectList *OwnerList); + virtual void signal(); + virtual void dispatch(); +}; + +} // End of namespace BlueForce + +} // End of namespace TsAGE + +#endif diff --git a/engines/tsage/blue_force/blueforce_scenes6.cpp b/engines/tsage/blue_force/blueforce_scenes6.cpp index e150a6e5b7..e6101039ab 100644 --- a/engines/tsage/blue_force/blueforce_scenes6.cpp +++ b/engines/tsage/blue_force/blueforce_scenes6.cpp @@ -31,6 +31,211 @@ namespace TsAGE { namespace BlueForce { /*-------------------------------------------------------------------------- + * Scene 600 - Crash cut-scene + * + *--------------------------------------------------------------------------*/ + +void Scene600::Action1::signal() { + Scene600 *scene = (Scene600 *)BF_GLOBALS._sceneManager._scene; + static const uint32 black = 0; + + switch (_actionIndex++) { + case 0: + setDelay(2); + break; + case 1: + BF_GLOBALS._sound1.play(57); + setDelay(120); + break; + case 2: + scene->_sound1.play(59); + setAction(&scene->_sequenceManager, this, 600, &scene->_object2, &scene->_object1, + &BF_GLOBALS._player, &scene->_object3, NULL); + break; + case 3: + BF_GLOBALS._sound1.play(61); + setDelay(180); + break; + case 4: + setDelay(180); + break; + case 5: { + BF_GLOBALS._player.remove(); + scene->_object1.remove(); + scene->_object2.remove(); + scene->_object3.remove(); + + for (int percent = 100; percent >= 0; percent -= 5) { + BF_GLOBALS._scenePalette.fade((byte *)&black, false, percent); + g_system->delayMillis(10); + } + + SynchronizedList<SceneObject *>::iterator i; + for (i = BF_GLOBALS._sceneObjects->begin(); i != BF_GLOBALS._sceneObjects->end(); ++i) { + SceneObject *pObj = *i; + pObj->addMover(NULL); + pObj->setObjectWrapper(NULL); + pObj->animate(ANIM_MODE_NONE, NULL); + } + + BF_GLOBALS._screenSurface.fillRect(BF_GLOBALS._screenSurface.getBounds(), 0); + BF_GLOBALS._v51C44 = 1; + scene->loadScene(999); + setDelay(5); + break; + } + case 6: + setDelay(5); + break; + case 7: + BF_GLOBALS._v51C44 = 0; + remove(); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene600::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(600); + setZoomPercents(0, 100, 200, 100); + _sceneBounds.moveTo(320, 0); + + _sound1.play(58); + _sound1.holdAt(1); + + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.hide(); + BF_GLOBALS._player.setPosition(Common::Point(639, 0)); + BF_GLOBALS._player.disableControl(); + + _object3.postInit(); + _object3.hide(); + _object2.postInit(); + + _object1.postInit(); + _object1.setVisage(600); + _object1.setStrip(7); + _object1.setPosition(Common::Point(417, 82)); + + BF_GLOBALS.clearFlag(onDuty); + BF_INVENTORY.setObjectScene(INV_TICKET_BOOK, 60); + BF_INVENTORY.setObjectScene(INV_MIRANDA_CARD, 60); + _sceneMode = 600; + + setAction(&_action1, this); +} + +void Scene600::signal() { + BF_GLOBALS._sceneManager.changeScene(620); +} + +/*-------------------------------------------------------------------------- + * Scene 620 - Hospital cut-scene + * + *--------------------------------------------------------------------------*/ + +void Scene620::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(999); + + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.disableControl(); + BF_GLOBALS._player.setVisage(621); + BF_GLOBALS._player.setPosition(Common::Point(47, 96)); + + static const uint32 black = 0; + sub15DD6((const byte *)&black, 2, 621, this); +} + +void Scene620::signal() { + static const uint32 black = 0; + + switch (_sceneMode++) { + case 0: + case 3: + case 9: + case 12: + _timer1.set(60, this); + break; + case 1: + case 4: + case 7: + case 10: + case 13: + case 16: + case 19: + addFader((const byte *)&black, 2, this); + break; + case 2: + BF_GLOBALS._player.remove(); + _object1.postInit(); + _object1.setVisage(622); + _object1.setPosition(Common::Point(101, 41)); + addFader((const byte *)&black, 2, this); + break; + case 5: + _object1.remove(); + + _object2.postInit(); + _object2.setVisage(623); + _object2.setPosition(Common::Point(216, 4)); + sub15DD6((const byte *)&black, 2, 623, this); + break; + case 6: + _object2.animate(ANIM_MODE_5, this); + break; + case 8: + _object2.remove(); + + _object3.postInit(); + _object3.setVisage(624); + _object3.setFrame(1); + _object3.setPosition(Common::Point(28, 88)); + sub15DD6((const byte *)&black, 2, 624, this); + break; + case 11: + _object3.remove(); + + _object4.postInit(); + _object4.setVisage(625); + _object4.setPosition(Common::Point(168, 8)); + sub15DD6((const byte *)&black, 2, 625, this); + break; + case 14: + _object4.remove(); + + _object5.postInit(); + _object5.setVisage(626); + _object5.setPosition(Common::Point(249, 183)); + sub15DD6((const byte *)&black, 2, 626, this); + break; + case 15: + _object5.animate(ANIM_MODE_5, this); + break; + case 17: + _object5.remove(); + + _object6.postInit(); + _object6.setVisage(627); + _object6.setPosition(Common::Point(65, 24)); + sub15DD6((const byte *)&black, 2, 627, this); + break; + case 18: + _object6.animate(ANIM_MODE_5, this); + break; + case 20: + _object6.remove(); + BF_GLOBALS._bookmark = bArrestedDrunk; + BF_GLOBALS._v4CEB6 = 0; + BF_GLOBALS._dayNumber = 3; + BF_GLOBALS._sceneManager.changeScene(271); + break; + } +} + +/*-------------------------------------------------------------------------- * Scene 666 - Death Scene * *--------------------------------------------------------------------------*/ @@ -163,6 +368,140 @@ void Scene666::signal() { _text.show(); } +/*-------------------------------------------------------------------------- + * Scene 690 - Decking + * + *--------------------------------------------------------------------------*/ + +bool Scene690::Object1::startAction(CursorType action, Event &event) { + Scene690 *scene = (Scene690 *)BF_GLOBALS._sceneManager._scene; + + if ((action == CURSOR_USE) && (scene->_object2._strip == 1)) { + BF_GLOBALS._player.disableControl(); + BF_GLOBALS._walkRegions.proc2(1); + BF_GLOBALS._walkRegions.proc2(6); + scene->_sceneMode = 6901; + scene->setAction(&scene->_sequenceManager, scene, 6901, &BF_GLOBALS._player, + &scene->_object2, &scene->_object1, &scene->_object4, &scene->_object5, NULL); + return true; + } else { + return NamedObject::startAction(action, event); + } +} + +bool Scene690::Object2::startAction(CursorType action, Event &event) { + Scene690 *scene = (Scene690 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + if (scene->_object2._strip == 3) { + scene->_object6.postInit(); + scene->_object6.hide(); + scene->_object6.fixPriority(1); + scene->_object6.setDetails(690, 21, 17, 23, 1, NULL); + + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 6902; + scene->setAction(&scene->_sequenceManager, scene, 6902, &BF_GLOBALS._player, + &scene->_object2, &scene->_object6, NULL); + return true; + } + break; + case CURSOR_TALK: + scene->_stripManager.start(6900, &BF_GLOBALS._stripProxy); + return true; + default: + break; + } + + return NamedObject::startAction(action, event); +} + +/*--------------------------------------------------------------------------*/ + +void Scene690::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(690); + setZoomPercents(125, 80, 140, 100); + BF_GLOBALS._sound1.fadeSound(48); + + if (BF_GLOBALS._dayNumber == 0) + BF_GLOBALS._dayNumber = 1; + + _stripManager.addSpeaker(&_jakeSpeaker); + + _object1.postInit(); + _object1.setVisage(690); + _object1.setStrip2(2); + _object1.fixPriority(188); + _object1.setPosition(Common::Point(50, 166)); + _object1.setDetails(690, 4, 17, 26, 1, NULL); + + _object3.postInit(); + _object3.setVisage(690); + _object3.fixPriority(100); + _object3.setPosition(Common::Point(238, 125)); + _object3.setDetails(690, 7, 17, 28, 1, NULL); + + _object2.postInit(); + _object2.setVisage(694); + _object2.setStrip2(3); + _object2.fixPriority(125); + _object2.setPosition(Common::Point(100, 134)); + _object2.setDetails(690, 12, -1, 11, 1, NULL); + + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.disableControl(); + BF_GLOBALS._player._moveDiff.x = 8; + + _object4.postInit(); + _object4.setDetails(690, 13, -1, -1, 1, NULL); + + _object5.postInit(); + _object5.setDetails(690, 14, -1, -1, 1, NULL); + + _sceneMode = 6903; + setAction(&_sequenceManager, this, 6903, &BF_GLOBALS._player, &_object3, &_object4, &_object5, NULL); + + _item1.setDetails(Rect(45, 28, 74, 48), 690, 0, 15, 20, 1, NULL); + _item2.setDetails(Rect(0, 0, 129, 78), 690, 1, 15, 20, 1, NULL); + _item9.setDetails(Rect(4, 26, 35, 143), 690, 29, 17, 22, 1, NULL); + _item10.setDetails(Rect(87, 29, 109, 112), 690, 29, 17, 22, 1, NULL); + _item11.setDetails(Rect(135, 30, 160, 120), 690, 29, 17, 22, 1, NULL); + _item3.setDetails(Rect(37, 89, 84, 117), 690, 2, 16, 21, 1, NULL); + _item4.setDetails(Rect(123, 98, 201, 131), 690, 5, -1, -1, 1, NULL); + _item7.setDetails(Rect(285, 95, 303, 133), 690, 8, -1, 25, 1, NULL); + _item16.setDetails(Rect(166, 35, 210, 116), 690, 32, -1, -1, 1, NULL); + _item6.setDetails(Rect(255, 44, 289, 130), 690, 7, 17, 24, 1, NULL); + _item8.setDetails(Rect(299, 44, 314, 53), 690, 27, 15, -1, 1, NULL); + _item5.setDetails(Rect(130, 20, 319, 135), 690, 6, 16, 28, 1, NULL); + _item12.setDetails(1, 690, 10, -1, -1, 1); + _item13.setDetails(2, 690, 30, -1, -1, 1); + _item14.setDetails(3, 690, 31, -1, -1, 1); + _item15.setDetails(4, 690, 9, -1, -1, 1); + _item17.setDetails(Rect(143, 0, 182, 14), 690, 33, -1, -1, 1, NULL); +} + +void Scene690::signal() { + switch (_sceneMode) { + case 6901: + BF_GLOBALS._sound1.fadeOut2(NULL); + BF_GLOBALS._sceneManager.changeScene(710); + break; + case 6902: + BF_GLOBALS._player.enableControl(); + break; + case 6903: + BF_GLOBALS._walkRegions.proc1(1); + BF_GLOBALS._walkRegions.proc1(6); + BF_GLOBALS._player.enableControl(); + break; + default: + break; + } +} + + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes6.h b/engines/tsage/blue_force/blueforce_scenes6.h index b7449c5e30..7c35b75053 100644 --- a/engines/tsage/blue_force/blueforce_scenes6.h +++ b/engines/tsage/blue_force/blueforce_scenes6.h @@ -39,6 +39,35 @@ namespace BlueForce { using namespace TsAGE; +class Scene600 : public SceneExt { + /* Actions */ + class Action1 : public Action { + public: + virtual void signal(); + }; +public: + SequenceManager _sequenceManager; + Action1 _action1; + ASoundExt _sound1; + NamedObject _object1, _object2, _object3; + BackgroundSceneObject _object4, _object5; + BackgroundSceneObject _object6, _object7, _object8; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +class Scene620 : public PalettedScene { +public: + SequenceManager _sequenceManager; + Timer _timer1; + NamedObject _object1, _object2, _object3; + NamedObject _object4, _object5, _object6; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + class Scene666 : public SceneExt { /* Actions */ class Action1 : public Action { @@ -63,6 +92,31 @@ public: virtual void signal(); }; + +class Scene690 : public SceneExt { + /* Objects */ + class Object1: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Object2: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + SequenceManager _sequenceManager; + Object1 _object1; + Object2 _object2; + NamedObject _object3, _object4, _object5, _object6; + NamedHotspot _item1, _item2, _item3, _item4, _item5; + NamedHotspot _item6, _item7, _item8, _item9, _item10; + NamedHotspot _item11, _item12, _item13, _item14, _item15; + NamedHotspot _item16, _item17; + SpeakerJake _jakeSpeaker; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes7.cpp b/engines/tsage/blue_force/blueforce_scenes7.cpp new file mode 100644 index 0000000000..1d94211871 --- /dev/null +++ b/engines/tsage/blue_force/blueforce_scenes7.cpp @@ -0,0 +1,277 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "tsage/blue_force/blueforce_scenes7.h" +#include "tsage/globals.h" +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/staticres.h" + +namespace TsAGE { + +namespace BlueForce { + +/*-------------------------------------------------------------------------- + * Scene 710 - + * + *--------------------------------------------------------------------------*/ +void Scene710::Timer1::signal() { + PaletteRotation *rotation = BF_GLOBALS._scenePalette.addRotation(136, 138, -1); + rotation->setDelay(25); + rotation = BF_GLOBALS._scenePalette.addRotation(146, 148, -1); + rotation->setDelay(30); + rotation = BF_GLOBALS._scenePalette.addRotation(187, 191, -1); + rotation->setDelay(35); + rotation = BF_GLOBALS._scenePalette.addRotation(245, 246, -1); + rotation->setDelay(20); + remove(); +} + +void Scene710::Action1::signal() { + Scene710 *scene = (Scene710 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.disableControl(); + _state = 7104; + if (BF_INVENTORY.getObjectScene(INV_CRATE1) == 1) + _state = 7105; + setDelay(3); + break; + case 1: { + PlayerMover *mover = new PlayerMover(); + BF_GLOBALS._player.addMover(mover, &scene->_laura._position, scene); + break; + } + case 2: + BF_GLOBALS._player._strip = 2; + scene->_stripManager.start(_state, this); + break; + case 3: + if (_state == 7105) + BF_GLOBALS._player.enableControl(); + else { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 7106; + scene->setAction(&scene->_sequenceManager1, scene, 7106, &BF_GLOBALS._player, &scene->_laura, &scene->_kid, &scene->_dog, NULL); + } + if (_state < 7104) { + _state++; + if ((_state != 7104) && (BF_INVENTORY.getObjectScene(INV_CRATE1) == 1)) + _state = 7105; + } + remove(); + break; + default: + break; + } +} + +// Laura +bool Scene710::Object3::startAction(CursorType action, Event &event) { + Scene710 *scene = (Scene710 *)BF_GLOBALS._sceneManager._scene; + + if (action == CURSOR_TALK) { + BF_GLOBALS._player.setAction(&scene->_action1); + return true; + } else + return NamedObject::startAction(action, event); +} + +bool Scene710::Object4::startAction(CursorType action, Event &event) { + Scene710 *scene = (Scene710 *)BF_GLOBALS._sceneManager._scene; + + if ((action == CURSOR_LOOK) && (scene->_kid._position.x < 0)) { + SceneItem::display(710, 13); + return true; + } else + return NamedObject::startAction(action, event); +} + +//Stick +bool Scene710::Object5::startAction(CursorType action, Event &event) { + Scene710 *scene = (Scene710 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + if (scene->_v1D64 <= 2) + return NamedObject::startAction(action, event); + else { + SceneItem::display(710, 3); + scene->_v1D66 = 1; + return true; + } + case CURSOR_USE: + if ((scene->_kid._position.x < 0) && (scene->_v1D62 == 1)) { + scene->_v1D64++; + if (scene->_v1D66 == 0) { + BF_GLOBALS._player.disableControl(); + scene->_v1D62 = 0; + scene->_sceneMode = 7105; + scene->setAction(&scene->_sequenceManager1, scene, 7105, &BF_GLOBALS._player, &scene->_stick, &scene->_dog, NULL); + } else { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 7101; + scene->setAction(&scene->_sequenceManager1, scene, 7101, &BF_GLOBALS._player, &scene->_dog, &scene->_stick, NULL); + } + return true; + } + // No break on purpose + default: + return NamedObject::startAction(action, event); + } +} + +void Scene710::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(710); + + _sceneBounds.moveTo(320, 0); + BF_GLOBALS._sound1.fadeSound(14); + _soundExt1.fadeSound(48); + _v51C34.set(40, 0, 280, 240); + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.hide(); + BF_GLOBALS._player._moveDiff = Common::Point(4, 2); + BF_GLOBALS._player.disableControl(); + if (BF_GLOBALS._dayNumber == 0) + BF_GLOBALS._dayNumber = 1; + _stripManager.addSpeaker(&_jakeSpeaker); + _stripManager.addSpeaker(&_skipSpeaker); + _stripManager.addSpeaker(&_lauraSpeaker); + _stripManager.addSpeaker(&_gameTextSpeaker); + + _kid.postInit(); + _kid._moveDiff = Common::Point(4, 2); + _laura.postInit(); + _laura._moveDiff = Common::Point(4, 2); + _dog.postInit(); + _dog._moveDiff = Common::Point(4, 2); + _stick.postInit(); + _stick.setVisage(710); + _stick.setStrip(2); + _stick.animate(ANIM_MODE_2, NULL); + _stick.setPosition(Common::Point(650, 160)); + _stick._moveDiff.x = 16; + _stick.setDetails(710, 4, -1, -1, 1, NULL); + _laura.setDetails(710, 2, -1, -1, 1, NULL); + _kid.setDetails(710, 6, -1, -1, 1, NULL); + _dog.setDetails(710, 0, -1, -1, 1, NULL); + + _item1.setDetails(Rect(555, 68, 583, 101), 710, 7, 23, -1, 1, NULL); + _item2.setDetails(Rect(583, 46, 611, 78), 710, 7, 23, -1, 1, NULL); + _item3.setDetails(Rect(611, 24, 639, 56), 710, 7, 23, -1, 1, NULL); + _item6.setDetails(1, 710, 9, 1, -1, 1); + _item4.setDetails(2, 710, 8, 14, -1, 1); + _item5.setDetails(3, 710, 10, 16, -1, 1); + _item8.setDetails(Rect(222, 18, 249, 42), 710, 12, 18, -1, 1, NULL); + _item7.setDetails(Rect(0, 0, 640, 52), 710, 11, 17, -1, 1, NULL); + _item9.setDetails(Rect(0, 0, 640, 128), 710, 5, 15, -1, 1, NULL); + + _v1D62 = _v1D64 = _v1D66 = _v1D68 = 0; + _action1._state = 7100; + _timer1.set(2, NULL); + _sceneMode = 7100; + setAction(&_sequenceManager1, this, 7100, &BF_GLOBALS._player, &_laura, &_kid, &_dog, NULL); +} + +void Scene710::signal() { + switch (_sceneMode++) { + case 0: + BF_GLOBALS._player.enableControl(); + break; + case 7100: + BF_GLOBALS._player.enableControl(); + _sceneMode = 7102; + setAction(&_sequenceManager1, this, 7102, &_dog, NULL); + break; + case 7101: + BF_GLOBALS._player.enableControl(); + BF_INVENTORY.setObjectScene(288, 36); + _stick.remove(); + BF_GLOBALS._walkRegions.proc2(2); + break; + case 7102: + _stick.setPosition(Common::Point(100, 122)); + _stick.animate(ANIM_MODE_NONE, NULL); + _stick._strip = 2; + if (_v1D64 <= 2) + _stick._frame = 2; + else { + if (_v1D64 == 3) { + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + _stripManager.start(7108, this); + } + _stick._frame = 1; + } + _v1D62 = 1; + BF_GLOBALS._walkRegions.proc1(2); + if ((_v1D68 != 0) && (_sceneMode != 0)) + BF_GLOBALS._player.enableControl(); + break; + case 7103: + if (BF_GLOBALS._player._position.x > 179) { + _sceneMode = 7102; + setAction(&_sequenceManager1, this, 7102, &_dog, NULL); + } else { + _sceneMode = 7104; + setAction(&_sequenceManager3, this, 7104, &_kid, NULL); + } + break; + case 7105: + _v1D68 = 1; + // No break on purpose + case 7104: + _sceneMode = 7102; + setAction(&_sequenceManager1, this, 7102, &_dog, NULL); + BF_GLOBALS._walkRegions.proc2(2); + break; + case 7106: + BF_GLOBALS._sound1.fadeOut2(NULL); + BF_GLOBALS._sceneManager.changeScene(270); + break; + default: + break; + } +} + +void Scene710::dispatch() { + if ((_kid._position.x > 0) && (_v1D62 == 1) && (_sceneMode != 7106)) { + _v1D62 = 0; + _sceneMode = 7103; + setAction(&_sequenceManager1, this, 7103, &_kid, &_stick, &_dog, NULL); + } + SceneExt::dispatch(); +} + +void Scene710::synchronize(Serializer &s) { + SceneExt::synchronize(s); + s.syncAsSint16LE(_v1D62); + s.syncAsSint16LE(_v1D64); + s.syncAsSint16LE(_v1D66); + s.syncAsSint16LE(_v1D68); +} + + +} // End of namespace BlueForce +} // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes7.h b/engines/tsage/blue_force/blueforce_scenes7.h new file mode 100644 index 0000000000..9bb43453ef --- /dev/null +++ b/engines/tsage/blue_force/blueforce_scenes7.h @@ -0,0 +1,103 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TSAGE_BLUEFORCE_SCENES7_H +#define TSAGE_BLUEFORCE_SCENES7_H + +#include "common/scummsys.h" +#include "tsage/blue_force/blueforce_logic.h" +#include "tsage/blue_force/blueforce_speakers.h" +#include "tsage/converse.h" +#include "tsage/events.h" +#include "tsage/core.h" +#include "tsage/scenes.h" +#include "tsage/globals.h" +#include "tsage/sound.h" + +namespace TsAGE { + +namespace BlueForce { + +using namespace TsAGE; + +class Scene710: public SceneExt { + // Actions + class Action1: public ActionExt { + public: + void signal(); + }; + // Timers + class Timer1: public Timer { + public: + void signal(); + }; + // Objects + class Object3: public NamedObject { + public: + bool startAction(CursorType action, Event &event); + }; + class Object4: public NamedObject { + public: + bool startAction(CursorType action, Event &event); + }; + class Object5: public NamedObject { + public: + bool startAction(CursorType action, Event &event); + }; + +public: + SequenceManager _sequenceManager1; + SequenceManager _sequenceManager2; + SequenceManager _sequenceManager3; + Timer1 _timer1; + SpeakerJake _jakeSpeaker; + SpeakerLaura _lauraSpeaker; + SpeakerSkip _skipSpeaker; + SpeakerGameText _gameTextSpeaker; + Action1 _action1; + NamedObject _object1; + NamedObject _kid; + Object3 _laura; + Object4 _dog; + Object5 _stick; + ASoundExt _soundExt1; + NamedHotspot _item1; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + NamedHotspot _item6; + NamedHotspot _item7; + NamedHotspot _item8; + NamedHotspot _item9; + int _v1D62, _v1D64, _v1D66, _v1D68; + + void postInit(SceneObjectList *OwnerList = NULL); + void signal(); + void dispatch(); + void synchronize(Serializer &s); +}; + +} // End of namespace BlueForce +} // End of namespace TsAGE + +#endif diff --git a/engines/tsage/blue_force/blueforce_scenes8.cpp b/engines/tsage/blue_force/blueforce_scenes8.cpp index 999dcc1f8b..49de0be65c 100644 --- a/engines/tsage/blue_force/blueforce_scenes8.cpp +++ b/engines/tsage/blue_force/blueforce_scenes8.cpp @@ -400,7 +400,7 @@ bool Scene830::Door::startAction(CursorType action, Event &event) { } else if (scene->_field18A4) { BF_GLOBALS._player.disableControl(); scene->_sceneMode = 832; - + if (BF_GLOBALS.getFlag(onDuty)) { scene->setAction(&scene->_sequenceManager, scene, 8302, &BF_GLOBALS._player, &scene->_door, NULL); } else if (BF_GLOBALS.getFlag(fWithLyle)) { @@ -536,7 +536,7 @@ void Scene830::postInit(SceneObjectList *OwnerList) { _object4.fixPriority(90); _object4.setDetails(830, 0, 1, 2, 1, NULL); } - + _door.postInit(); _door.setVisage(830); _door.setDetails(830, 3, 4, -1, 1, NULL); @@ -690,7 +690,7 @@ void Scene830::signal() { break; case 831: case 8306: - BF_GLOBALS._sceneManager.changeScene((BF_GLOBALS._bookmark < bStartOfGame) || + BF_GLOBALS._sceneManager.changeScene((BF_GLOBALS._bookmark < bStartOfGame) || (BF_GLOBALS._bookmark >= bCalledToDomesticViolence) ? 342 : 340); break; case 832: @@ -842,7 +842,7 @@ void Scene840::Object2::process(Event &event) { if (_bounds.contains(event.mousePos)) { CursorType cursorId = BF_GLOBALS._events.getCursor(); BF_GLOBALS._events.setCursor(cursorId); - + if ((event.eventType == EVENT_BUTTON_DOWN) && (cursorId == CURSOR_WALK) && (event.btnState == 3)) { BF_GLOBALS._events.setCursor(CURSOR_USE); event.handled = true; @@ -930,7 +930,7 @@ bool Scene840::Object2::RentalKeys::startAction(CursorType action, Event &event) SceneItem::display2(840, 55); BF_INVENTORY.setObjectScene(INV_RENTAL_KEYS, 1); BF_GLOBALS._uiElements.addScore(30); - + scene->_object2._v1B4 = 1; remove(); } @@ -1053,7 +1053,7 @@ bool Scene840::Coins::startAction(CursorType action, Event &event) { case CURSOR_LOOK: BF_GLOBALS._player.disableControl(); scene->_sceneMode = 8404; - scene->setAction(&scene->_sequenceManager1, scene, BF_GLOBALS.getFlag(onDuty) ? 8415 : 8404, + scene->setAction(&scene->_sequenceManager1, scene, BF_GLOBALS.getFlag(onDuty) ? 8415 : 8404, &BF_GLOBALS._player, NULL); return true; default: @@ -1178,7 +1178,7 @@ void Scene840::signal() { switch (BF_GLOBALS._dayNumber) { case 1: if (_field1ABA == 1) { - _stripManager.start(BF_GLOBALS.getFlag(onDuty) ? 8430 : 8406, this); + _stripManager.start(BF_GLOBALS.getFlag(onDuty) ? 8430 : 8406, this); } else if (!BF_GLOBALS.getFlag(onDuty)) { _stripManager.start(!BF_GLOBALS._v4CEB6 ? 8400 : 8406, this); } else if (BF_GLOBALS._bookmark < bStartOfGame) { @@ -1202,7 +1202,7 @@ void Scene840::signal() { } else { _stripManager.start(8413, this); } - + BF_GLOBALS.setFlag(fTalkedCarterDay3); break; case 4: @@ -1292,7 +1292,7 @@ void Scene840::signal() { _stripManager.start(8441, this); break; case 8407: - if (((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark >= bEndDayThree)) || + if (((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark >= bEndDayThree)) || (BF_INVENTORY.getObjectScene(INV_WAVE_KEYS) == 1)) { _sceneMode = 8416; setAction(&_sequenceManager1, this, 8416, &BF_GLOBALS._player, NULL); @@ -1365,7 +1365,7 @@ void Scene840::signal() { void Scene840::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { if (_exit.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_E); BF_GLOBALS._events.setCursor(surface); @@ -1379,7 +1379,7 @@ void Scene840::process(Event &event) { void Scene840::dispatch() { SceneExt::dispatch(); - + if (_field1ABC && (BF_GLOBALS._player._position.x > 310) && !_action) { _field1ABC = 0; BF_GLOBALS._player.disableControl(); diff --git a/engines/tsage/blue_force/blueforce_scenes9.cpp b/engines/tsage/blue_force/blueforce_scenes9.cpp index e39746a9fe..0768f7608d 100644 --- a/engines/tsage/blue_force/blueforce_scenes9.cpp +++ b/engines/tsage/blue_force/blueforce_scenes9.cpp @@ -422,6 +422,9 @@ Scene900::Scene900(): PalettedScene() { } void Scene900::postInit(SceneObjectList *OwnerList) { + PalettedScene::postInit(); + loadScene(900); + if (BF_GLOBALS._sceneManager._previousScene == 910) BF_GLOBALS._sound1.changeSound(91); _field1974 = 0; @@ -433,7 +436,6 @@ void Scene900::postInit(SceneObjectList *OwnerList) { BF_INVENTORY.setObjectScene(INV_FISHING_NET, 1); BF_INVENTORY.setObjectScene(INV_HOOK, 1); } - PalettedScene::postInit(); _object3._flag = 0; if (BF_GLOBALS._bookmark >= bFinishedWGreen) { _object7.postInit(); @@ -450,7 +452,7 @@ void Scene900::postInit(SceneObjectList *OwnerList) { } if (BF_INVENTORY.getObjectScene(INV_FISHING_NET) == 900) _object3._flag = 1; - loadScene(900); + _stripManager.addSpeaker(&_gameTextSpeaker); _stripManager.addSpeaker(&_jakeJacketSpeaker); _stripManager.addSpeaker(&_lyleHatSpeaker); @@ -504,7 +506,7 @@ void Scene900::postInit(SceneObjectList *OwnerList) { _object2.postInit(); _object2.setVisage(900); - + if (BF_GLOBALS._v4CEC8 == 0) _object2.setStrip(4); else @@ -576,7 +578,7 @@ void Scene900::signal() { BF_GLOBALS._player.enableControl(); break; case 9001: - if ((BF_INVENTORY.getObjectScene(INV_FISHING_NET) == 900) || (BF_GLOBALS._v4CEC0 != 0) || + if ((BF_INVENTORY.getObjectScene(INV_FISHING_NET) == 900) || (BF_GLOBALS._v4CEC0 != 0) || (_object2._flag == 0)) BF_GLOBALS.setFlag(fLeftTraceIn900); else @@ -685,7 +687,7 @@ void Scene900::signal() { void Scene900::process(Event &event) { SceneExt::process(event); - if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { if (_item4.contains(event.mousePos)) { GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_N); BF_GLOBALS._events.setCursor(surface); @@ -718,6 +720,583 @@ void Scene900::synchronize(Serializer &s) { s.syncAsSint16LE(_field1976); } -} // End of namespace BlueForce +/*-------------------------------------------------------------------------- + * Scene 920 - Inside Warehouse: Secret Room + * + *--------------------------------------------------------------------------*/ +// Crate +bool Scene920::Item1::startAction(CursorType action, Event &event) { + Scene920 *scene = (Scene920 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + if ((BF_GLOBALS.getFlag(fCrateOpen)) && (BF_GLOBALS._player._visage == 921)) { + BF_GLOBALS._player.disableControl(); + scene->_object2.postInit(); + scene->_sceneMode = 9204; + if (!BF_GLOBALS.getFlag(fGotPointsForBoots)) { + BF_GLOBALS._uiElements.addScore(30); + BF_GLOBALS.setFlag(fGotPointsForBoots); + } + scene->setAction(&scene->_sequenceManager1, scene, 9204, &BF_GLOBALS._player, &scene->_object2, NULL); + return true; + } else + return NamedHotspot::startAction(action, event); + break; + case CURSOR_USE: + BF_GLOBALS._player.disableControl(); + if (BF_GLOBALS.getFlag(fCrateOpen)) { + if (BF_GLOBALS._player._visage == 921) { + if ((BF_INVENTORY.getObjectScene(15) != 1) && (BF_GLOBALS.getFlag(fSawGuns))) { + scene->_sceneMode = 9207; + scene->setAction(&scene->_sequenceManager1, scene, 9207, &BF_GLOBALS._player, NULL); + } else { + scene->_sceneMode = 9203; + scene->setAction(&scene->_sequenceManager1, scene, 9203, &BF_GLOBALS._player, &scene->_object1, NULL); + BF_GLOBALS.clearFlag(fCrateOpen); + } + } else { + scene->_sceneMode = 9205; + scene->setAction(&scene->_sequenceManager1, scene, 9205, &BF_GLOBALS._player, NULL); + } + } else { + scene->_sceneMode = 9202; + scene->setAction(&scene->_sequenceManager1, scene, 9202, &BF_GLOBALS._player, &scene->_object1, NULL); + BF_GLOBALS.setFlag(fCrateOpen); + } + return true; + break; + default: + return NamedHotspot::startAction(action, event); + break; + } +} + +// North Exit +bool Scene920::Item8::startAction(CursorType action, Event &event) { + Scene920 *scene = (Scene920 *)BF_GLOBALS._sceneManager._scene; + + BF_GLOBALS._player.disableControl(); + if (BF_GLOBALS._player._visage == 921) { + scene->_sceneMode = 10; + scene->setAction(&scene->_sequenceManager1, scene, 9206, &BF_GLOBALS._player, NULL); + // TO BE CHECKED: Original code uses a variable to store the address of scene instance. + // As it's used later a coordinates to create a playermover, I don't understand. + // On the other hand, it's not really important as just after the hero leaves the scene + // so the variable is no longer used. + // scene->_oldCoord = &scene; + _field10 = 1; + } else { + scene->_sceneMode = 9201; + scene->setAction(&scene->_sequenceManager1, scene, 9201, &BF_GLOBALS._player, NULL); + } + return true; +} + +void Scene920::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(920); + + _stripManager.addSpeaker(&_gameTextSpeaker); + _stripManager.addSpeaker(&_jakeJacketSpeaker); + if (BF_GLOBALS._dayNumber == 0) + BF_GLOBALS._dayNumber = 4; + BF_GLOBALS._player.postInit(); + if (BF_GLOBALS._v4CEC8 != 0) { + _object3.postInit(); + _object3.setVisage(922); + _object3.setStrip(2); + _object3.fixPriority(1); + _object3.setPosition(Common::Point(145, 82)); + } + + _object1.postInit(); + _object1.setVisage(922); + if (BF_GLOBALS.getFlag(fCrateOpen)) { + _object1.setStrip(3); + _object1.setFrame(5); + } + _object1.setPosition(Common::Point(158, 107)); + _object1.setPriority(130); + _exitN.setDetails(Rect(116, 12, 165, 81), 920, -1, -1, -1, 1, NULL); + _item6.setDetails(6, 920, 15, 16, 17, 1); + _item4.setDetails(5, 920, 12, 13, 14, 1); + _item7.setDetails(4, 920, 9, 10, 11, 1); + _item5.setDetails(3, 920, 6, 7, 8, 1); + _crate.setDetails(2, 920, 3, 4, 5, 1); + _item3.setDetails(1, 920, 3, 4, 5, 1); + _item2.setDetails(Rect(0, 0, 320, 200), 920, 0, 1, 2, 1, NULL); + + BF_GLOBALS._player.disableControl(); + _sceneMode = 9200; + setAction(&_sequenceManager1, this, 9200, &BF_GLOBALS._player, NULL); +} + +void Scene920::signal() { + switch (_sceneMode) { + case 10: + _sceneMode = 9201; + setAction(&_sequenceManager1, this, 9201, &BF_GLOBALS._player, NULL); + break; + case 9201: + if (BF_GLOBALS.getFlag(fCrateOpen)) + BF_GLOBALS.setFlag(fLeftTraceIn920); + else + BF_GLOBALS.clearFlag(fLeftTraceIn920); + BF_GLOBALS._sceneManager.changeScene(910); + break; + case 9204: + _object2.remove(); + BF_GLOBALS.setFlag(fSawGuns); + BF_GLOBALS._player.enableControl(); + break; + case 9206: { + BF_GLOBALS._player.enableControl(); + PlayerMover *mover = new PlayerMover(); + BF_GLOBALS._player.addMover(mover, &_oldCoord, NULL); + break; + } + case 9207: + BF_GLOBALS._player.enableControl(); + BF_GLOBALS._uiElements.addScore(30); + BF_INVENTORY.setObjectScene(15, 1); + BF_GLOBALS._bookmark = bEndDayThree; + break; + default: + BF_GLOBALS._player.enableControl(); + break; + } +} +void Scene920::process(Event &event) { + SceneExt::process(event); + if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + if (_exitN.contains(event.mousePos)) { + GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_N); + BF_GLOBALS._events.setCursor(surface); + } else { + CursorType cursorId = BF_GLOBALS._events.getCursor(); + BF_GLOBALS._events.setCursor(cursorId); + } + } + if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == CURSOR_WALK) && (BF_GLOBALS._player._visage == 921)) { + BF_GLOBALS._player.disableControl(); + _sceneMode = 9206; + setAction(&_sequenceManager1, this, 9206, &BF_GLOBALS._player, NULL); + _oldCoord = event.mousePos; + event.handled = true; + } +} + +void Scene920::dispatch() { + SceneExt::dispatch(); + if ((_action == 0) && (BF_GLOBALS._player._position.y < 75)) { + BF_GLOBALS._player.disableControl(); + BF_GLOBALS._sceneManager.changeScene(910); + } +} + +void Scene920::synchronize(Serializer &s) { + SceneExt::synchronize(s); + s.syncAsSint16LE(_oldCoord.x); + s.syncAsSint16LE(_oldCoord.y); +} + +/*-------------------------------------------------------------------------- + * Scene 935 - ? + * + *--------------------------------------------------------------------------*/ + +void Scene935::Action1::signal() { + Scene935 *scene = (Scene935 *)BF_GLOBALS._sceneManager._scene; + static uint32 v50ECC = 0, v50EEA = 0, v50EEE = 0, v50F26 = 0, v50F2A = 0, v50F62 = 0, v50F66 = 0, v50F6A = 0; + + switch (_actionIndex++) { + case 0: + scene->addFader((const byte *)&v50ECC, 100, this); + break; + case 1: + scene->_visualSpeaker.setText("Jake! Hide in the closet!"); + for (int i = 1; i < 21; i++) + scene->sub15E4F((const byte *)&v50EEA, 5 * i, 935, NULL, 0, 255, 249, 255, 1); + warning("Scene935::Action1::signal(): sub_15E4F"); + setDelay(3); + break; + case 2: + scene->addFader((const byte *)&v50EEE, 5, this); + break; + case 3: + scene->_visualSpeaker.removeText(); + scene->_visualSpeaker._textPos.y = scene->_sceneBounds.top + 80; + scene->_visualSpeaker._color1 = 252; + scene->_visualSpeaker._color1 = 251; + scene->_visualSpeaker.setText("Jake! Hide in the closet!"); + setDelay(3); + break; + case 4: + scene->_visualSpeaker.setText("Jake! Hide in the closet!"); + for (int i = 1; i < 21; i++) + scene->sub15E4F((const byte *)&v50F26, 5 * i, 935, NULL, 0, 255, 249, 255, 1); + warning("Scene935::Action1::signal(): sub_15E4F"); + setDelay(3); + break; + case 5: + scene->addFader((const byte *)&v50F2A, 5, this); + break; + case 6: + scene->_visualSpeaker.removeText(); + scene->_visualSpeaker._textPos.y = scene->_sceneBounds.top + 150; + scene->_visualSpeaker._color1 = 250; + scene->_visualSpeaker._color1 = 249; + scene->_visualSpeaker.setText("Jake! Hide in the closet!"); + setDelay(3); + break; + case 7: + scene->_visualSpeaker.setText("Jake! Hide in the closet!"); + for (int i = 1; i < 21; i++) + scene->sub15E4F((const byte *)&v50F62, 5 * i, 935, NULL, 0, 255, 249, 255, 1); + warning("Scene935::Action1::signal(): sub_15E4F"); + setDelay(3); + break; + case 8: + scene->addFader((const byte *)&v50F66, 5, this); + break; + case 9: + scene->_visualSpeaker.removeText(); + setDelay(3); + break; + case 10: + scene->_sceneMode = 1; + scene->sub15DD6((const byte *)&v50F6A, 5, 935, scene); + remove(); + break; + default: + break; + } +} + +void Scene935::postInit(SceneObjectList *OwnerList) { + PalettedScene::postInit(); + loadScene(935); + + BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._player.disableControl(); + _visualSpeaker._textMode = ALIGN_CENTER; + _visualSpeaker._hideObjects = false; + _visualSpeaker._color1 = 254; + _visualSpeaker._color2 = 253; + _visualSpeaker._textPos.y = _sceneBounds.top + 18; + _visualSpeaker._textWidth = 300; + _visualSpeaker._textPos.x = _sceneBounds.left + 10; + setAction(&_action1); + BF_GLOBALS._sound1.fadeSound(67); +} + +void Scene935::remove() { + BF_GLOBALS._sound1.fadeOut2(NULL); + BF_GLOBALS._scrollFollower = &BF_GLOBALS._player; + PalettedScene::remove(); +} + +void Scene935::signal() { + static uint32 v50EC8 = 0; + + switch (_sceneMode) { + case 1: + _object1.postInit(); + if (BF_GLOBALS._sceneManager._previousScene == 810) { + BF_GLOBALS._player.disableControl(); + _sceneMode = 9352; + setAction(&_sequenceManager, this, 9350, &_object1, NULL); + } else if (BF_GLOBALS._sceneManager._previousScene == 930) { + _object3.postInit(); + _object3.setVisage(938); + _object3.fixPriority(255); + _object3.setPosition(Common::Point(260, -4)); + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager, this, 9354, &_object1, &_object3, NULL); + } else { + _sceneMode = 9351; + setAction(&_sequenceManager, this, 9350, &_object1, NULL); + } + break; + case 2: + BF_GLOBALS._sound1.play(68); + _sceneMode = 0; + addFader((const byte *)&v50EC8, 5, this); + break; + case 3: + _sceneMode = 2; + _object1.animate(ANIM_MODE_6, NULL); + signal(); + break; + case 9351: + BF_GLOBALS._player.disableControl(); + _sceneMode = 2; + setAction(&_sequenceManager, this, 9351, &_object1, NULL); + if (BF_GLOBALS._sceneManager._previousScene == 910) + _sceneMode = 9353; + break; + case 9352: + BF_GLOBALS._player.disableControl(); + _sceneMode = 2; + setAction(&_sequenceManager, this, 9352, &_object1, NULL); + break; + case 9353: + _object2.postInit(); + BF_GLOBALS._player.disableControl(); + _sceneMode = 3; + setAction(&_sequenceManager, this, 9353, &_object1, &_object2, NULL); + break; + default: + BF_GLOBALS._sceneManager.changeScene(BF_GLOBALS._sceneManager._previousScene); + break; + } +} + +void Scene935::dispatch() { + SceneExt::dispatch(); +} + +/*-------------------------------------------------------------------------- + * Scene 940 - ? + * + *--------------------------------------------------------------------------*/ + +bool Scene940::Item1::startAction(CursorType action, Event &event) { + return true; +} + +void Scene940::Action1::signal() { + Scene940 *scene = (Scene940 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex) { + case 0: + _actionIndex = 2; + setDelay(60); + break; + case 2: + _actionIndex = 941; + if (BF_GLOBALS.getFlag(fBackupAt340)) + scene->_stripManager.start(9408, this); + else + scene->_stripManager.start(9400, this); + break; + case 5: + setActionIndex(948); + setDelay(90); + scene->_object2.remove(); + scene->_object3.remove(); + scene->_object4.remove(); + scene->_object5.remove(); + scene->_object6.remove(); + scene->_object7.remove(); + scene->_object8.remove(); + scene->_object9.remove(); + scene->_object10.remove(); + break; + case 99: + BF_GLOBALS._sound1.play(117); + BF_GLOBALS._sceneManager.changeScene(100); + remove(); + break; + case 941: + scene->_gameTextSpeaker1._textWidth = 312; + _actionIndex = 944; + setAction(&scene->_sequenceManager1, this, 941, &BF_GLOBALS._player, NULL); + break; + case 942: + _actionIndex = 955; + setAction(&scene->_sequenceManager1, this, 942, &scene->_object2, NULL); + break; + case 943: + _actionIndex = 946; + setAction(&scene->_sequenceManager1, this, 943, &scene->_object3, NULL); + break; + case 944: + scene->_object4.setAction(&scene->_sequenceManager2, NULL, 944, &scene->_object4, &scene->_object5); + _actionIndex = 945; + setDelay(3); + break; + case 945: + scene->_object6.setAction(&scene->_sequenceManager3, NULL, 945, &scene->_object6, &scene->_object10, NULL); + _actionIndex = 943; + setDelay(3); + break; + case 946: + _actionIndex = 942; + setAction(&scene->_sequenceManager1, this, 946, &scene->_object7, &scene->_object8, NULL); + break; + case 947: + _actionIndex = 5; + setAction(&scene->_sequenceManager1, this, 947, &scene->_object1, &scene->_object11, &scene->_object12, &scene->_object13, NULL); + break; + case 948: + scene->_gameTextSpeaker1._textPos.x = scene->_sceneBounds.left + 10; + scene->_object17.postInit(); + scene->_object17.hide(); + scene->_object18.postInit(); + scene->_object18.hide(); + _actionIndex = 960; + setAction(&scene->_sequenceManager1, this, 948, &scene->_object11, &scene->_object12, &scene->_object13, &scene->_object1, &scene->_object14, NULL); + break; + case 949: + _actionIndex = 950; + setAction(&scene->_sequenceManager1, this, 949, &scene->_object17, &scene->_object18, &scene->_object1, &scene->_object12, &scene->_object13, &scene->_object15, NULL); + scene->_object11.setAction(&scene->_sequenceManager2, NULL, 952, &scene->_object11, NULL); + break; + case 950: + _actionIndex = 951; + setAction(&scene->_sequenceManager1, this, 950, &scene->_object17, &scene->_object18, &scene->_object1, &scene->_object13, &scene->_object16, NULL); + scene->_object12.setAction(&scene->_sequenceManager3, NULL, 953, &scene->_object12, NULL); + break; + case 951: + scene->_object13.setAction(&scene->_sequenceManager4, NULL, 954, &scene->_object13, NULL); + scene->_object11.setAction(&scene->_sequenceManager2, NULL, 952, &scene->_object11, NULL); + scene->_stripManager.start(9407, this); + setActionIndex(99); + break; + case 955: + scene->_object2.remove(); + _actionIndex = 956; + setAction(&scene->_sequenceManager1, this, 955, &BF_GLOBALS._player, NULL); + break; + case 956: + _actionIndex = 947; + setAction(&scene->_sequenceManager1, this, 956, &scene->_object3, NULL); + scene->_object11.postInit(); + scene->_object11.setVisage(943); + scene->_object11.setStrip(1); + scene->_object11.setPosition(Common::Point(-8, 178)); + scene->_object12.postInit(); + scene->_object12.setVisage(942); + scene->_object12.setStrip(1); + scene->_object12.setPosition(Common::Point(-41, 181)); + scene->_object13.postInit(); + scene->_object13.setVisage(944); + scene->_object13.setStrip(2); + scene->_object13.setPosition(Common::Point(-74, 179)); + scene->_object1.postInit(); + scene->_object1.setVisage(948); + scene->_object1.setStrip(2); + scene->_object1.setPosition(Common::Point(-107, 180)); + scene->_object14.postInit(); + scene->_object14.setVisage(949); + scene->_object14.setStrip(1); + scene->_object14.setFrame(3); + scene->_object14.setPosition(Common::Point(234, 75)); + scene->_object15.postInit(); + scene->_object15.setVisage(949); + scene->_object15.setStrip(1); + scene->_object15.setFrame(2); + scene->_object15.setPosition(Common::Point(144, 76)); + scene->_object16.postInit(); + scene->_object16.setVisage(949); + scene->_object16.setStrip(1); + scene->_object16.setFrame(1); + scene->_object16.setPosition(Common::Point(45, 77)); + break; + case 960: + _actionIndex = 949; + setAction(&scene->_sequenceManager1, this, 960, &scene->_object11, &scene->_object17, &scene->_object18, &scene->_object1, &scene->_object14, NULL); + break; + default: + break; + } +} + +void Scene940::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(940); + + BF_GLOBALS._sound1.play(115); + BF_GLOBALS._dayNumber = 6; + BF_GLOBALS._interfaceY = 200; + BF_GLOBALS._uiElements._active = false; + + _gameTextSpeaker2._speakerName = "SENTTEXT"; + _gameTextSpeaker2._color1 = 104; + _gameTextSpeaker2._textMode = ALIGN_CENTER; + _stripManager.addSpeaker(&_gameTextSpeaker1); + _stripManager.addSpeaker(&_gameTextSpeaker2); + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.setVisage(941); + BF_GLOBALS._player.setStrip(1); + BF_GLOBALS._player.setFrame(7); + BF_GLOBALS._player.setPosition(Common::Point(563, 80)); + BF_GLOBALS._player.disableControl(); + _object3.postInit(); + _object3.setVisage(944); + _object3.setStrip(3); + _object3.setFrame(3); + _object3.setPosition(Common::Point(626, 78)); + _object3.fixPriority(0); + _object2.postInit(); + _object2.setVisage(944); + _object2.setStrip(3); + _object2.setFrame(6); + _object2.setPosition(Common::Point(378, 136)); + _object2.setZoom(80); + _object2.fixPriority(0); + _object4.postInit(); + _object4.setVisage(945); + _object4.setStrip(6); + _object4.setPosition(Common::Point(361, 70)); + _object4.setZoom(80); + _object4.fixPriority(0); + _object5.postInit(); + _object5.setVisage(945); + _object5.setStrip(7); + _object5.setPosition(Common::Point(366, 39)); + _object5.setZoom(80); + _object5.fixPriority(3); + _object6.postInit(); + _object6.setVisage(945); + _object6.setStrip(4); + _object6.setPosition(Common::Point(432, 70)); + _object6.setZoom(65); + _object6.fixPriority(0); + _object7.postInit(); + _object7.setVisage(945); + _object7.setStrip(1); + _object7.setPosition(Common::Point(423, 131)); + _object7.setZoom(65); + _object7.fixPriority(0); + _object8.postInit(); + _object8.setVisage(945); + _object8.setStrip(2); + _object8.setPosition(Common::Point(420, 99)); + _object8.setZoom(65); + _object8.fixPriority(3); + _object9.postInit(); + _object9.setVisage(945); + _object9.setStrip(3); + _object9.setPosition(Common::Point(458, 65)); + _object9.setZoom(55); + _object9.fixPriority(0); + _object10.postInit(); + _object10.setVisage(945); + _object10.setStrip(3); + _object10.setFrame(2); + _object10.setPosition(Common::Point(465, 118)); + _object10.setZoom(55); + _object10.fixPriority(0); + _item1.setBounds(Rect(0, 0, 320, 200)); + BF_GLOBALS._sceneItems.push_back(&_item1); + _sceneBounds.moveTo(320, 0); + _gameTextSpeaker1._textPos.x = _sceneBounds.left + 10; + _gameTextSpeaker1._color1 = 16; + _gameTextSpeaker1._textWidth = 265; + setAction(&_action1); +} + +void Scene940::remove() { + // clearScren(); + BF_GLOBALS._scrollFollower = &BF_GLOBALS._player; + SceneExt::remove(); + BF_GLOBALS._uiElements._active = true; +} + +} // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes9.h b/engines/tsage/blue_force/blueforce_scenes9.h index 09752d40d5..b8d855cd0a 100644 --- a/engines/tsage/blue_force/blueforce_scenes9.h +++ b/engines/tsage/blue_force/blueforce_scenes9.h @@ -43,50 +43,50 @@ class Scene900: public PalettedScene { /* Items */ class Item1: public NamedHotspot { public: - virtual bool startAction(CursorType action, Event &event); + bool startAction(CursorType action, Event &event); }; class Item4: public NamedHotspot { public: - virtual bool startAction(CursorType action, Event &event); + bool startAction(CursorType action, Event &event); }; /* Objects */ class Object1: public NamedObject { public: - virtual bool startAction(CursorType action, Event &event); + bool startAction(CursorType action, Event &event); }; class Object2: public NamedObjectExt { public: - virtual bool startAction(CursorType action, Event &event); + bool startAction(CursorType action, Event &event); }; class Object3: public NamedObjectExt { public: - virtual bool startAction(CursorType action, Event &event); + bool startAction(CursorType action, Event &event); }; class Object6: public NamedObject { public: - virtual bool startAction(CursorType action, Event &event); + bool startAction(CursorType action, Event &event); }; class Object7: public NamedObject { public: - virtual bool startAction(CursorType action, Event &event); + bool startAction(CursorType action, Event &event); }; /* Actions */ class Action1 : public Action { public: - virtual void signal(); + void signal(); }; class Action2 : public Action { public: - virtual void signal(); + void signal(); }; class Action3 : public Action { public: - virtual void signal(); + void signal(); }; class Action4 : public Action { public: - virtual void signal(); + void signal(); }; public: @@ -114,15 +114,117 @@ public: int _field1976; Scene900(); - virtual void postInit(SceneObjectList *OwnerList = NULL); - virtual void signal(); - virtual void process(Event &event); - virtual void dispatch(); + void postInit(SceneObjectList *OwnerList = NULL); + void signal(); + void process(Event &event); + void dispatch(); void synchronize(Serializer &s); }; -} // End of namespace BlueForce +class Scene920: public SceneExt { + /* Items */ + class Item1: public NamedHotspot { + public: + bool startAction(CursorType action, Event &event); + }; + class Item8: public NamedHotspot { + public: + bool startAction(CursorType action, Event &event); + }; + +public: + SequenceManager _sequenceManager1; + SpeakerGameText _gameTextSpeaker; + SpeakerJakeJacket _jakeJacketSpeaker; + + Item1 _crate; + NamedHotspot _item2; + NamedHotspot _item3; + NamedHotspot _item4; + NamedHotspot _item5; + NamedHotspot _item6; + NamedHotspot _item7; + NamedObject _object1; + NamedObject _object2; + NamedObject _object3; + Item8 _exitN; + Common::Point _oldCoord; + + void postInit(SceneObjectList *OwnerList = NULL); + void signal(); + void process(Event &event); + void dispatch(); + void synchronize(Serializer &s); +}; + +class Scene935: public PalettedScene { + /* Actions */ + class Action1 : public Action { + public: + void signal(); + }; + +public: + ScenePalette _scenePalette; + SequenceManager _sequenceManager; + NamedObject _object1; + NamedObject _object2; + NamedObject _object3; + Action1 _action1; + VisualSpeaker _visualSpeaker; + + void postInit(SceneObjectList *OwnerList = NULL); + void remove(); + void signal(); + void dispatch(); +}; +class Scene940: public SceneExt { + /* Items */ + class Item1: public NamedHotspot { + public: + bool startAction(CursorType action, Event &event); + }; + /* Actions */ + class Action1 : public Action { + public: + void signal(); + }; + +public: + SequenceManager _sequenceManager1; + SequenceManager _sequenceManager2; + SequenceManager _sequenceManager3; + SequenceManager _sequenceManager4; + NamedObject _object1; + NamedObject _object2; + NamedObject _object3; + NamedObject _object4; + NamedObject _object5; + NamedObject _object6; + NamedObject _object7; + NamedObject _object8; + NamedObject _object9; + NamedObject _object10; + NamedObject _object11; + NamedObject _object12; + NamedObject _object13; + NamedObject _object14; + NamedObject _object15; + NamedObject _object16; + NamedObject _object17; + NamedObject _object18; + Item1 _item1; + Action1 _action1; + + SpeakerGameText _gameTextSpeaker1; + SpeakerGameText _gameTextSpeaker2; + + void postInit(SceneObjectList *OwnerList = NULL); + void remove(); +}; + +} // End of namespace BlueForce } // End of namespace TsAGE #endif diff --git a/engines/tsage/blue_force/blueforce_speakers.cpp b/engines/tsage/blue_force/blueforce_speakers.cpp index 66dd33c40c..dbd7419378 100644 --- a/engines/tsage/blue_force/blueforce_speakers.cpp +++ b/engines/tsage/blue_force/blueforce_speakers.cpp @@ -54,7 +54,7 @@ void VisualSpeaker::remove() { void VisualSpeaker::synchronize(Serializer &s) { Speaker::synchronize(s); - + s.syncAsByte(_removeObject1); s.syncAsByte(_removeObject2); s.syncAsSint16LE(_xp); @@ -201,6 +201,35 @@ void SpeakerHarrison::setText(const Common::String &msg) { /*--------------------------------------------------------------------------*/ +SpeakerJake::SpeakerJake(): VisualSpeaker() { + _color1 = 13; + _color2 = 7; + _speakerName = "JAKE"; +} + +void SpeakerJake::setText(const Common::String &msg) { + _removeObject1 = _removeObject2 = true; + + _object1.postInit(); + _object1.setVisage(1001); + _object1.setStrip2(2); + _object1.fixPriority(254); + _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 38, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + _object2.postInit(); + _object2.setVisage(1001); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 38, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + VisualSpeaker::setText(msg); + _object2.fixCountdown(8, _numFrames); +} + +/*--------------------------------------------------------------------------*/ + SpeakerJakeJacket::SpeakerJakeJacket(): VisualSpeaker() { _color1 = 13; _color2 = 7; @@ -391,6 +420,35 @@ void SpeakerJordan::setText(const Common::String &msg) { /*--------------------------------------------------------------------------*/ +SpeakerSkip::SpeakerSkip(): VisualSpeaker() { + _color1 = 80; + _color2 = 82; + _speakerName = "SKIP"; +} + +void SpeakerSkip::setText(const Common::String &msg) { + _removeObject1 = _removeObject2 = true; + + _object1.postInit(); + _object1.setVisage(345); + _object1.setStrip2(4); + _object1.fixPriority(254); + _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 282, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + _object2.postInit(); + _object2.setVisage(345); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 282, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + VisualSpeaker::setText(msg); + _object2.fixCountdown(8, _numFrames); +} + +/*--------------------------------------------------------------------------*/ + SpeakerSkipB::SpeakerSkipB(): VisualSpeaker() { _color1 = 80; _color2 = 82; @@ -466,7 +524,7 @@ void SpeakerDriver::setText(const Common::String &msg) { _object2.postInit(); _object2.setVisage(416); _object2.setStrip2(1); - _object2.fixPriority(-1); + _object2.fixPriority(255); _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 263, BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); @@ -495,7 +553,7 @@ void SpeakerShooter::setText(const Common::String &msg) { _object2.postInit(); _object2.setVisage(418); _object2.setStrip2(1); - _object2.fixPriority(-1); + _object2.fixPriority(255); _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 268, BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); @@ -618,6 +676,134 @@ void SpeakerLauraHeld::setText(const Common::String &msg) { _object2.fixCountdown(8, _numFrames); } +/*--------------------------------------------------------------------------*/ + +SpeakerEugene::SpeakerEugene(): VisualSpeaker() { + _color1 = 20; + _color2 = 22; + _speakerName = "EUGENE"; +} + +void SpeakerEugene::setText(const Common::String &msg) { + _removeObject1 = _removeObject2 = true; + + _object1.postInit(); + _object1.setVisage(465); + _object1.setStrip2(3); + _object1.fixPriority(254); + _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + _object2.postInit(); + _object2.setVisage(465); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + VisualSpeaker::setText(msg); + _object2.fixCountdown(8, _numFrames); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerWeasel::SpeakerWeasel(): VisualSpeaker() { + _color1 = 8; + _color2 = 5; + _speakerName = "WEASEL"; +} + +void SpeakerWeasel::setText(const Common::String &msg) { + _removeObject1 = _removeObject2 = true; + + _object1.postInit(); + _object1.setVisage(464); + _object1.setStrip2(3); + _object1.fixPriority(254); + _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + _object2.postInit(); + _object2.setVisage(464); + _object2.fixPriority(255); + _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + VisualSpeaker::setText(msg); + _object2.fixCountdown(8, _numFrames); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerBilly::SpeakerBilly(): VisualSpeaker() { + _color1 = 20; + _color2 = 22; + _speakerName = "BILLY"; +} + +void SpeakerBilly::setText(const Common::String &msg) { + _removeObject1 = _removeObject2 = true; + + _object1.postInit(); + _object1.setVisage(463); + _object1.setStrip2(7); + _object1.fixPriority(254); + _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + _object2.postInit(); + _object2.setVisage(463); + _object2.setStrip2(6); + _object2.fixPriority(255); + _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 167)); + + VisualSpeaker::setText(msg); + _object2.fixCountdown(8, _numFrames); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerDrunk::SpeakerDrunk(): VisualSpeaker() { + _color1 = 21; + _speakerName = "DRUNK"; +} + +void SpeakerDrunk::setText(const Common::String &msg) { + _removeObject2 = true; + + _object2.postInit(); + _object2.setVisage(556); + _object2.fixPriority(255); + _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 52, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + VisualSpeaker::setText(msg); + _object2.fixCountdown(8, _numFrames); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerGiggles::SpeakerGiggles(): VisualSpeaker() { + _color1 = 32; + + _speakerName = "GIGGLES"; +} + +void SpeakerGiggles::setText(const Common::String &msg) { + _removeObject2 = true; + + _object2.postInit(); + _object2.setVisage(557); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 262, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + VisualSpeaker::setText(msg); + _object2.fixCountdown(8, _numFrames); +} + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_speakers.h b/engines/tsage/blue_force/blueforce_speakers.h index 3e6728c771..df2a617941 100644 --- a/engines/tsage/blue_force/blueforce_speakers.h +++ b/engines/tsage/blue_force/blueforce_speakers.h @@ -92,6 +92,14 @@ public: virtual void setText(const Common::String &msg); }; +class SpeakerJake: public VisualSpeaker { +public: + SpeakerJake(); + + virtual Common::String getClassName() { return "SpeakerJake"; } + virtual void setText(const Common::String &msg); +}; + class SpeakerJakeJacket: public VisualSpeaker { public: SpeakerJakeJacket(); @@ -155,6 +163,14 @@ public: virtual void setText(const Common::String &msg); }; +class SpeakerSkip: public VisualSpeaker { +public: + SpeakerSkip(); + + virtual Common::String getClassName() { return "SpeakerSkip"; } + virtual void setText(const Common::String &msg); +}; + class SpeakerSkipB: public VisualSpeaker { public: SpeakerSkipB(); @@ -227,6 +243,46 @@ public: virtual void setText(const Common::String &msg); }; +class SpeakerEugene: public VisualSpeaker { +public: + SpeakerEugene(); + + virtual Common::String getClassName() { return "SpeakerEugene"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerWeasel: public VisualSpeaker { +public: + SpeakerWeasel(); + + virtual Common::String getClassName() { return "SpeakerWeasel"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerBilly: public VisualSpeaker { +public: + SpeakerBilly(); + + virtual Common::String getClassName() { return "SpeakerBilly"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerDrunk: public VisualSpeaker { +public: + SpeakerDrunk(); + + virtual Common::String getClassName() { return "SpeakerDrunk"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerGiggles: public VisualSpeaker { +public: + SpeakerGiggles(); + + virtual Common::String getClassName() { return "SpeakerGiggles"; } + virtual void setText(const Common::String &msg); +}; + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_ui.cpp b/engines/tsage/blue_force/blueforce_ui.cpp index 89a7d85f89..a4edffbe39 100644 --- a/engines/tsage/blue_force/blueforce_ui.cpp +++ b/engines/tsage/blue_force/blueforce_ui.cpp @@ -38,7 +38,7 @@ void StripProxy::process(Event &event) { /*--------------------------------------------------------------------------*/ void UIElement::synchronize(Serializer &s) { - AltSceneObject::synchronize(s); + BackgroundSceneObject::synchronize(s); s.syncAsSint16LE(_field88); s.syncAsSint16LE(_enabled); s.syncAsSint16LE(_frameNum); @@ -137,7 +137,7 @@ void UIScore::draw() { void UIScore::updateScore() { int score = BF_GLOBALS._uiElements._scoreValue; - + _digit3.setFrame(score / 1000 + 1); score %= 1000; _digit2.setFrame(score / 100 + 1); score %= 100; _digit1.setFrame(score / 10 + 1); score %= 10; @@ -166,7 +166,7 @@ void UIInventorySlot::process(Event &event) { showAmmoBelt(); } else if (_objIndex != INV_NONE) { - _object->setCursor(); + _object->setCursor(); } } } @@ -203,7 +203,7 @@ void UIInventoryScroll::process(Event &event) { // Scroll the inventory as necessary BF_GLOBALS._uiElements.scrollInventory(_isLeft); event.handled = true; - break; + break; default: break; } @@ -243,7 +243,8 @@ void UICollection::show() { void UICollection::erase() { if (_clearScreen) { Rect tempRect(0, BF_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT); - GLOBALS._screenSurface.fillRect(tempRect, 0); + BF_GLOBALS._screenSurface.fillRect(tempRect, 0); + BF_GLOBALS._sceneManager._scene->_backSurface.fillRect(tempRect, 0); _clearScreen = false; } } @@ -254,10 +255,15 @@ void UICollection::resetClear() { void UICollection::draw() { if (_visible) { - // Draw the elements + // Draw the elements onto the background for (uint idx = 0; idx < _objList.size(); ++idx) _objList[idx]->draw(); + // Draw the resulting UI onto the screen + BF_GLOBALS._screenSurface.copyFrom(BF_GLOBALS._sceneManager._scene->_backSurface, + Rect(0, BF_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT), + Rect(0, BF_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT)); + _clearScreen = 1; } } @@ -329,7 +335,7 @@ void UIElements::process(Event &event) { _cursorChanged = false; SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; - if (scene->_eventHandler) { + if (scene->_focusObject) { GfxSurface surface = _cursorVisage.getFrame(7); BF_GLOBALS._events.setCursor(surface); } @@ -399,7 +405,7 @@ void UIElements::setup(const Common::Point &pt) { } void UIElements::add(UIElement *obj) { - // Add object + // Add object assert(_objList.size() < 12); _objList.push_back(obj); @@ -415,7 +421,7 @@ void UIElements::add(UIElement *obj) { */ void UIElements::updateInventory() { _score.updateScore(); - updateInvList(); + updateInvList(); // Enable scroll buttons if the player has more than four items if (_itemList.size() > 4) { diff --git a/engines/tsage/blue_force/blueforce_ui.h b/engines/tsage/blue_force/blueforce_ui.h index d9c593b900..601b97a9fe 100644 --- a/engines/tsage/blue_force/blueforce_ui.h +++ b/engines/tsage/blue_force/blueforce_ui.h @@ -39,7 +39,7 @@ public: virtual void process(Event &event); }; -class UIElement: public AltSceneObject { +class UIElement: public BackgroundSceneObject { public: int _field88; bool _enabled; @@ -71,7 +71,7 @@ public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void draw(); - + void updateScore(); }; diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index b8d1c8d5c4..4d3d7761a6 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -98,7 +98,7 @@ void InvObjectList::synchronize(Serializer &s) { int InvObjectList::indexOf(InvObject *obj) const { int idx = 0; SynchronizedList<InvObject *>::const_iterator i; - + for (i = _itemList.begin(); i != _itemList.end(); ++i, ++idx) { if ((*i) == obj) return idx; @@ -1426,7 +1426,7 @@ void ScenePalette::changeBackground(const Rect &bounds, FadeMode fadeMode) { Rect tempRect = bounds; if (_vm->getGameID() == GType_BlueForce) tempRect.setHeight(BF_GLOBALS._interfaceY); - + _globals->_screenSurface.copyFrom(_globals->_sceneManager._scene->_backSurface, tempRect, Rect(0, 0, tempRect.width(), tempRect.height()), NULL); @@ -1472,9 +1472,9 @@ void SceneItem::remove() { _globals->_sceneItems.remove(this); } -bool SceneItem::startAction(CursorType action, Event &event) { +bool SceneItem::startAction(CursorType action, Event &event) { if (_vm->getGameID() == GType_Ringworld) { - doAction(action); + doAction(action); return true; } else if ((action == CURSOR_LOOK) || (action == CURSOR_USE) || (action == CURSOR_TALK) || (action < CURSOR_LOOK)) { @@ -1520,7 +1520,7 @@ bool SceneItem::contains(const Common::Point &pt) { } void SceneItem::display(int resNum, int lineNum, ...) { - Common::String msg = (!resNum || (resNum == -1)) ? Common::String() : + Common::String msg = (!resNum || (resNum == -1)) ? Common::String() : _resourceManager->getMessage(resNum, lineNum); if ((_vm->getGameID() == GType_BlueForce) && BF_GLOBALS._uiElements._active) @@ -1666,8 +1666,8 @@ void SceneItem::display(int resNum, int lineNum, ...) { void SceneItem::display2(int resNum, int lineNum) { if (_vm->getGameID() == GType_BlueForce) - display(resNum, lineNum, SET_WIDTH, 312, - SET_X, 4 + GLOBALS._sceneManager._scene->_sceneBounds.left, + display(resNum, lineNum, SET_WIDTH, 312, + SET_X, 4 + GLOBALS._sceneManager._scene->_sceneBounds.left, SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + BF_INTERFACE_Y + 2, SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9, SET_EXT_FGCOLOR, 13, LIST_END); @@ -1679,8 +1679,8 @@ void SceneItem::display(const Common::String &msg) { assert(_vm->getGameID() == GType_BlueForce); display(-1, -1, msg.c_str(), - SET_WIDTH, 312, - SET_X, 4 + GLOBALS._sceneManager._scene->_sceneBounds.left, + SET_WIDTH, 312, + SET_X, 4 + GLOBALS._sceneManager._scene->_sceneBounds.left, SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + BF_INTERFACE_Y + 2, SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9, SET_EXT_FGCOLOR, 13, LIST_END); @@ -2528,17 +2528,22 @@ void SceneObject::setup(int visage, int stripFrameNum, int frameNum, int posX, i /*--------------------------------------------------------------------------*/ -void AltSceneObject::postInit(SceneObjectList *OwnerList) { - SceneObject::postInit(&_globals->_sceneManager._altSceneObjects); +void BackgroundSceneObject::postInit(SceneObjectList *OwnerList) { + SceneObjectList dummyList; + SceneObjectList *pList = !_globals->_sceneManager._scene ? &dummyList : + &_globals->_sceneManager._scene->_bgSceneObjects; + + SceneObject::postInit(pList); } -void AltSceneObject::draw() { +void BackgroundSceneObject::draw() { + assert(_globals->_sceneManager._scene); Rect destRect = _bounds; destRect.translate(-_globals->_sceneManager._scene->_sceneBounds.left, -_globals->_sceneManager._scene->_sceneBounds.top); Region *priorityRegion = _globals->_sceneManager._scene->_priorities.find(_priority); GfxSurface frame = getFrame(); - _globals->_gfxManagerInstance.copyFrom(frame, destRect, priorityRegion); + _globals->_sceneManager._scene->_backSurface.copyFrom(frame, destRect, priorityRegion); } /*--------------------------------------------------------------------------*/ @@ -2961,6 +2966,7 @@ void Visage::flip(GfxSurface &gfxSurface) { Player::Player(): SceneObject() { _canWalk = false; + _enabled = false; _uiEnabled = false; _field8C = 0; } @@ -3878,10 +3884,10 @@ void SceneHandler::process(Event &event) { // Handle any fallback text display processEnd(event); - - // Handle player processing - _globals->_player.process(event); } + + // Handle player processing + _globals->_player.process(event); } } diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 9bcf77b110..4e219f67db 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -606,9 +606,9 @@ public: void setup(int visage, int stripFrameNum, int frameNum, int posX, int posY, int priority); }; -class AltSceneObject: public SceneObject { +class BackgroundSceneObject: public SceneObject { public: - virtual Common::String getClassName() { return "AltObjectExt"; } + virtual Common::String getClassName() { return "BackgroundSceneObject"; } virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void draw(); }; diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp index f12efc02e8..8a4b834f46 100644 --- a/engines/tsage/detection.cpp +++ b/engines/tsage/detection.cpp @@ -131,6 +131,8 @@ public: if (in) { if (TsAGE::Saver::readSavegameHeader(in, header)) { saveList.push_back(SaveStateDescriptor(slot, header.saveName)); + + header.thumbnail->free(); delete header.thumbnail; } diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index d2ade971fa..834cb58765 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -212,7 +212,7 @@ void EventsClass::setCursor(CursorType cursorType) { cursor = _resourceManager->getSubResource(1, 5, 1, &size); } else { // Inventory icon - cursor = _resourceManager->getSubResource(10, ((int)cursorType - 1) / 20 + 1, + cursor = _resourceManager->getSubResource(10, ((int)cursorType - 1) / 20 + 1, ((int)cursorType - 1) % 20 + 1, &size); questionEnabled = true; } @@ -310,7 +310,7 @@ void EventsClass::setCursor(GfxSurface &cursor) { Graphics::Surface s = cursor.lockSurface(); const byte *cursorData = (const byte *)s.getBasePtr(0, 0); - CursorMan.replaceCursor(cursorData, cursor.getBounds().width(), cursor.getBounds().height(), + CursorMan.replaceCursor(cursorData, cursor.getBounds().width(), cursor.getBounds().height(), cursor._centroid.x, cursor._centroid.y, cursor._transColor); _lastCursor = CURSOR_NONE; diff --git a/engines/tsage/events.h b/engines/tsage/events.h index fb3e19bafa..78ae893a81 100644 --- a/engines/tsage/events.h +++ b/engines/tsage/events.h @@ -65,18 +65,18 @@ enum CursorType { OBJECT_TUNIC2 = 29, OBJECT_BONE = 30, OBJECT_EMPTY_JAR = 31, OBJECT_JAR = 32, // Blue Force objects - INV_NONE = 0, INV_COLT45 = 1, INV_AMMO_CLIP = 2, INV_SPARE_CLIP = 3, INV_HANDCUFFS = 4, - INV_GREENS_GUN = 5, INV_TICKET_BOOK = 6, INV_MIRANDA_CARD = 7, INV_FOREST_RAP = 8, - INV_GREEN_ID = 9, INV_BASEBALL_CARD = 10, INV_BOOKING_GREEN = 11, INV_FLARE = 12, + INV_NONE = 0, INV_COLT45 = 1, INV_AMMO_CLIP = 2, INV_SPARE_CLIP = 3, INV_HANDCUFFS = 4, + INV_GREENS_GUN = 5, INV_TICKET_BOOK = 6, INV_MIRANDA_CARD = 7, INV_FOREST_RAP = 8, + INV_GREEN_ID = 9, INV_BASEBALL_CARD = 10, INV_BOOKING_GREEN = 11, INV_FLARE = 12, INV_COBB_RAP = 13, INV_22_BULLET = 14, INV_AUTO_RIFLE = 15, INV_WIG = 16, INV_FRANKIE_ID = 17, INV_TYRONE_ID = 18, INV_22_SNUB = 19, INV_BOOKING_FRANKIE = 21, INV_BOOKING_GANG = 22, INV_FBI_TELETYPE = 23, INV_DA_NOTE = 24, INV_PRINT_OUT = 25, INV_WAREHOUSE_KEYS = 26, INV_CENTER_PUNCH = 27, INV_TRANQ_GUN = 28, INV_HOOK = 29, INV_RAGS = 30, INV_JAR = 31, INV_SCREWDRIVER = 32, INV_D_FLOPPY = 33, INV_BLANK_DISK = 34, INV_STICK = 35, INV_CRATE1 = 36, INV_CRATE2 = 37, INV_SHOEBOX = 38, INV_BADGE = 39, INV_RENTAL_COUPON = 41, - INV_NICKEL = 42, INV_LYLE_CARD = 43, INV_CARTER_NOTE = 44, INV_MUG_SHOT = 45, - INV_CLIPPING = 46, INV_MICROFILM = 47, INV_WAVE_KEYS = 48, INV_RENTAL_KEYS = 49, - INV_NAPKIN = 50, INV_DMV_PRINTOUT = 51, INV_FISHING_NET = 52, INV_ID = 53, + INV_NICKEL = 42, INV_LYLE_CARD = 43, INV_CARTER_NOTE = 44, INV_MUG_SHOT = 45, + INV_CLIPPING = 46, INV_MICROFILM = 47, INV_WAVE_KEYS = 48, INV_RENTAL_KEYS = 49, + INV_NAPKIN = 50, INV_DMV_PRINTOUT = 51, INV_FISHING_NET = 52, INV_ID = 53, INV_9MM_BULLETS = 54, INV_SCHEDULE = 55, INV_GRENADES = 56, INV_YELLOW_CORD = 57, INV_HALF_YELLOW_CORD = 58, INV_BLACK_CORD = 59, INV_HALF_BLACK_CORD = 61, INV_WARRANT = 62, INV_JACKET = 63, INV_GREENS_KNIFE = 64, INV_DOG_WHISTLE = 65, INV_AMMO_BELT = 66, diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 6ee1d24657..ef0e7fdc14 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -204,6 +204,10 @@ void BlueForceGlobals::synchronize(Serializer &s) { s.syncAsSint16LE(_v50696); s.syncAsSint16LE(_v5098C); s.syncAsSint16LE(_v5098D); + s.syncAsSint16LE(_v50CC2); + s.syncAsSint16LE(_v50CC4); + s.syncAsSint16LE(_v50CC6); + s.syncAsSint16LE(_v50CC8); s.syncAsSint16LE(_v51C42); s.syncAsSint16LE(_v51C44); s.syncAsSint16LE(_interfaceY); @@ -243,6 +247,10 @@ void BlueForceGlobals::reset() { _v50696 = 0; _v5098C = 0; _v5098D = 0; + _v50CC2 = 0; + _v50CC4 = 0; + _v50CC6 = 0; + _v50CC8 = 0; _v51C42 = 0; _v51C44 = 1; _clip1Bullets = 8; diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 850ff40693..8fba716878 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -182,6 +182,10 @@ public: int _v50696; uint8 _v5098C; uint8 _v5098D; + int _v50CC2; + int _v50CC4; + int _v50CC6; + int _v50CC8; int _v51C42; int _v51C44; int _interfaceY; diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk index 2e0a4eb6c3..7d15b66b93 100644 --- a/engines/tsage/module.mk +++ b/engines/tsage/module.mk @@ -6,7 +6,10 @@ MODULE_OBJS := \ blue_force/blueforce_scenes0.o \ blue_force/blueforce_scenes1.o \ blue_force/blueforce_scenes3.o \ + blue_force/blueforce_scenes4.o \ + blue_force/blueforce_scenes5.o \ blue_force/blueforce_scenes6.o \ + blue_force/blueforce_scenes7.o \ blue_force/blueforce_scenes8.o \ blue_force/blueforce_scenes9.o \ blue_force/blueforce_speakers.o \ @@ -43,5 +46,5 @@ ifeq ($(ENABLE_TSAGE), DYNAMIC_PLUGIN) PLUGIN := 1 endif -# Include common rules +# Include common rules include $(srcdir)/rules.mk diff --git a/engines/tsage/ringworld/ringworld_scenes10.cpp b/engines/tsage/ringworld/ringworld_scenes10.cpp index 1d310c6f8f..fdb0532cb7 100644 --- a/engines/tsage/ringworld/ringworld_scenes10.cpp +++ b/engines/tsage/ringworld/ringworld_scenes10.cpp @@ -37,7 +37,7 @@ Scene2::Scene2() : Scene() { /*--------------------------------------------------------------------------*/ void Object9350::postInit(SceneObjectList *OwnerList) { - //SceneObject::postInit(&_globals->_sceneManager._altSceneObjects); + //SceneObject::postInit(&_globals->_sceneManager._bgSceneObjects); SceneObject::postInit(OwnerList); } diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h index f81454d5e9..d0876d1cb6 100644 --- a/engines/tsage/saveload.h +++ b/engines/tsage/saveload.h @@ -33,7 +33,7 @@ namespace TsAGE { typedef void (*SaveNotifierFn)(bool postFlag); -#define TSAGE_SAVEGAME_VERSION 6 +#define TSAGE_SAVEGAME_VERSION 7 class SavedObject; diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index d68f5c2ee5..69985382bd 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -80,9 +80,6 @@ void SceneManager::sceneChange() { sceneObj->removeObject(); } - // Clear the secondary scene object list - _altSceneObjects.clear(); - // Clear the hotspot list SynchronizedList<SceneItem *>::iterator ii = _globals->_sceneItems.begin(); while (ii != _globals->_sceneItems.end()) { @@ -234,7 +231,10 @@ void SceneManager::listenerSynchronize(Serializer &s) { // in order for the savegame loading to work correctly _globals->_sceneManager._scene = new Scene(); - _altSceneObjects.synchronize(s); + // Depreciated: the background scene objects used to be located here + uint32 unused = 0; + s.syncAsUint32LE(unused); + s.syncAsSint32LE(_sceneNumber); s.syncAsUint16LE(_globals->_sceneManager._scene->_activeScreenNumber); @@ -283,6 +283,9 @@ void Scene::synchronize(Serializer &s) { s.syncAsUint16LE(_enabledSections[i]); for (int i = 0; i < 256; ++i) s.syncAsSint16LE(_zoomPercents[i]); + + if (s.getVersion() >= 7) + _bgSceneObjects.synchronize(s); } void Scene::postInit(SceneObjectList *OwnerList) { @@ -442,16 +445,15 @@ void Scene::refreshBackground(int xAmount, int yAmount) { } if (changedFlag) { - drawAltObjects(); + drawBackgroundObjects(); } } -void Scene::drawAltObjects() { +void Scene::drawBackgroundObjects() { Common::Array<SceneObject *> objList; // Initial loop to set the priority for entries in the list - for (SynchronizedList<SceneObject *>::iterator i = _globals->_sceneManager._altSceneObjects.begin(); - i != _globals->_sceneManager._altSceneObjects.end(); ++i) { + for (SynchronizedList<SceneObject *>::iterator i = _bgSceneObjects.begin(); i != _bgSceneObjects.end(); ++i) { SceneObject *obj = *i; objList.push_back(obj); @@ -463,7 +465,7 @@ void Scene::drawAltObjects() { } // Sort the list by priority - _globals->_sceneManager._altSceneObjects.sortList(objList); + _bgSceneObjects.sortList(objList); // Drawing loop for (uint objIndex = 0; objIndex < objList.size(); ++objIndex) { diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h index b03b8fa906..da813f019a 100644 --- a/engines/tsage/scenes.h +++ b/engines/tsage/scenes.h @@ -33,7 +33,7 @@ namespace TsAGE { class Scene : public StripCallback { private: - void drawAltObjects(); + void drawBackgroundObjects(); public: int _field12; int _screenNumber; @@ -48,6 +48,7 @@ public: int _enabledSections[256]; int _zoomPercents[256]; ScenePriorities _priorities; + SceneObjectList _bgSceneObjects; int _fieldA; int _fieldE; @@ -71,8 +72,8 @@ public: class SceneManager : public GameHandler, public SaveListener { private: - void disposeRegions() { - // No need to do anything, since regions will be freed automatically when the scene is + void disposeRegions() { + // No need to do anything, since regions will be freed automatically when the scene is } Scene *getNewScene(); public: @@ -86,7 +87,6 @@ public: Common::Point _sceneBgOffset; int _sceneLoadCount; Rect _scrollerRect; - SceneObjectList _altSceneObjects; int _objectCount; public: SceneManager(); diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index 2139056770..ce82ac2fc7 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -91,7 +91,7 @@ void SoundManager::postInit() { // I originally separated the sound manager update method into a separate thread, since // it handles updates for both music and Fx. However, since Adlib updates also get done in a -// thread, and doesn't get too far ahead, I've left it to the AdlibSoundDriver class to +// thread, and doesn't get too far ahead, I've left it to the AdlibSoundDriver class to // call the update method, rather than having it be called separately // g_system->getTimerManager()->installTimerProc(_sfUpdateCallback, 1000000 / SOUND_FREQUENCY, NULL, "tsageSoundUpdate"); __sndmgrReady = true; @@ -139,7 +139,7 @@ Common::List<SoundDriverEntry> &SoundManager::buildDriverList(bool detectFlag) { assert(__sndmgrReady); _availableDrivers.clear(); - // Build up a list of available drivers. Currently we only implement an Adlib music + // Build up a list of available drivers. Currently we only implement an Adlib music // and SoundBlaster FX driver // Adlib driver @@ -1362,7 +1362,7 @@ void SoundManager::_sfExtractGroupMask() { bool SoundManager::_sfInstallDriver(SoundDriver *driver) { if (!driver->open()) return false; - + sfManager()._installedDrivers.push_back(driver); driver->_groupOffset = driver->getGroupData(); driver->_groupMask = driver->_groupOffset->groupMask; diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index a8ff348bc6..010394a42e 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -72,7 +72,7 @@ struct RegisterValue { uint8 _regNum; uint8 _value; - RegisterValue(int regNum, int value) { + RegisterValue(int regNum, int value) { _regNum = regNum; _value = value; } }; diff --git a/gui/credits.h b/gui/credits.h index ca2c10ca52..47336c4900 100644 --- a/gui/credits.h +++ b/gui/credits.h @@ -262,6 +262,8 @@ static const char *credits[] = { "", "C1""Maemo", "C0""Frantisek Dufka", +"C2""(retired)", +"C0""Tarek Soliman", "", "C1""Nintendo 64", "C0""Fabio Battaglia", diff --git a/gui/saveload.cpp b/gui/saveload.cpp index 02ddf814dc..ae950a21fb 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -240,7 +240,7 @@ void SaveLoadChooser::updateSelection(bool redraw) { _time->setLabel(_("No time saved")); _playtime->setLabel(_("No playtime saved")); - if (selItem >= 0 && !_list->getSelectedString().empty() && _metaInfoSupport) { + if (selItem >= 0 && _metaInfoSupport) { SaveStateDescriptor desc = (*_plugin)->querySaveMetaInfos(_target.c_str(), _saveList[selItem].getSaveSlot()); isDeletable = desc.getDeletableFlag() && _delSupport; @@ -256,5 +256,11 @@ endif pkg.py --contentid UP0001-SCUM12000_00-0000000000000000 ps3pkg/ scummvm-ps3.pkg package_finalize scummvm-ps3.pkg +ps3run: $(EXECUTABLE) + $(STRIP) $(EXECUTABLE) + sprxlinker $(EXECUTABLE) + make_self $(EXECUTABLE) $(EXECUTABLE).self + ps3load $(EXECUTABLE).self + # Mark special targets as phony .PHONY: deb bundle osxsnap win32dist install uninstall ps3pkg |