diff options
Diffstat (limited to 'engines/tsage')
55 files changed, 7876 insertions, 1784 deletions
diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp new file mode 100644 index 0000000000..e074f8884d --- /dev/null +++ b/engines/tsage/blue_force/blueforce_dialogs.cpp @@ -0,0 +1,434 @@ +/* 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 "common/translation.h" + +#include "gui/dialog.h" +#include "gui/widget.h" + +#include "tsage/tsage.h" +#include "tsage/core.h" +#include "tsage/dialogs.h" +#include "tsage/staticres.h" +#include "tsage/globals.h" +#include "tsage/blue_force/blueforce_dialogs.h" +#include "tsage/ringworld/ringworld_logic.h" + +namespace TsAGE { + +namespace BlueForce { + +/** + * This dialog implements the right-click dialog + */ +RightClickDialog::RightClickDialog() : GfxDialog() { + // Setup button areas + _rectList1[0] = Rect(7, 50, 41, 67); + _rectList1[1] = Rect(13, 27, 50, 50); + _rectList1[2] = Rect(49, 27, 84, 50); + _rectList1[3] = Rect(56, 50, 90, 67); + _rectList1[4] = Rect(26, 68, 69, 99); + + _rectList3[0] = Rect(12, 49, 27, 64); + _rectList3[1] = Rect(27, 31, 42, 46); + _rectList3[2] = Rect(56, 31, 71, 46); + _rectList3[3] = Rect(72, 50, 87, 65); + _rectList3[4] = Rect(41, 81, 56, 96); + + // Set the palette and change the cursor + GfxSurface cursor = surfaceFromRes(1, 5, 9); + BF_GLOBALS._events.setCursor(cursor); + + setPalette(); + + // Get the dialog image + _surface = surfaceFromRes(1, 1, 1); + + // Set the dialog position + Rect dialogRect; + dialogRect.resize(_surface, 0, 0, 100); + dialogRect.center(_globals->_events._mousePos.x, _globals->_events._mousePos.y); + + // Ensure the dialog will be entirely on-screen + Rect screenRect = _globals->gfxManager()._bounds; + screenRect.collapse(4, 4); + dialogRect.contain(screenRect); + + // Load selected button images + _btnImages.setVisage(1, 2); + + _bounds = dialogRect; + _gfxManager._bounds = _bounds; + + _highlightedAction = -1; + _selectedAction = -1; +} + +RightClickDialog::~RightClickDialog() { +} + +void RightClickDialog::draw() { + // Save the covered background area + _savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds); + + // Draw the dialog image + _globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top); + + // Pre-process rect lists + for (int idx = 0; idx < 5; ++idx) { + _rectList2[idx] = _rectList1[idx]; + _rectList4[idx] = _rectList3[idx]; + + _rectList2[idx].translate(_bounds.left, _bounds.top); + _rectList4[idx].translate(_bounds.left, _bounds.top); + } +} + +bool RightClickDialog::process(Event &event) { + switch (event.eventType) { + case EVENT_MOUSE_MOVE: { + // Check whether a button is highlighted + int buttonIndex = 0; + while ((buttonIndex < 5) && !_rectList1[buttonIndex].contains(event.mousePos)) + ++buttonIndex; + if (buttonIndex == 5) + buttonIndex = -1; + + // If selection has changed, handle it + if (buttonIndex != _highlightedAction) { + if (_highlightedAction != -1) { + // Another button was previously selected, so restore dialog + _gfxManager.copyFrom(_surface, 0, 0); + } + + if (buttonIndex != -1) { + // Draw newly selected button + GfxSurface btn = _btnImages.getFrame(buttonIndex + 1); + _gfxManager.copyFrom(btn, _rectList3[buttonIndex].left, _rectList3[buttonIndex].top); + } + + _highlightedAction = buttonIndex; + } + + event.handled = true; + return true; + } + + case EVENT_BUTTON_DOWN: + // Specify the selected action + _selectedAction = (_highlightedAction == -1) ? 5 : _highlightedAction; + event.handled = true; + return true; + + default: + break; + } + + return false; +} + +void RightClickDialog::execute() { + // Draw the dialog + draw(); + + // Dialog event handler loop + _gfxManager.activate(); + + while (!_vm->shouldQuit() && (_selectedAction == -1)) { + Event evt; + while (_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) { + evt.mousePos.x -= _bounds.left; + evt.mousePos.y -= _bounds.top; + + process(evt); + } + + g_system->delayMillis(10); + g_system->updateScreen(); + } + + // Execute the specified action + CursorType cursorNum = CURSOR_NONE; + switch (_selectedAction) { + case 0: + // Walk action + cursorNum = BF_GLOBALS._player._canWalk ? CURSOR_WALK : CURSOR_USE; + break; + case 1: + // Use action + cursorNum = CURSOR_USE; + break; + case 2: + // Look action + cursorNum = CURSOR_LOOK; + break; + case 3: + // Talk action + cursorNum = CURSOR_TALK; + break; + case 4: + // Options dialog + break; + } + + if (cursorNum != CURSOR_NONE) + BF_GLOBALS._events.setCursor(cursorNum); + + _gfxManager.deactivate(); +} + +/*--------------------------------------------------------------------------*/ + +AmmoBeltDialog::AmmoBeltDialog() : GfxDialog() { + _cursorNum = BF_GLOBALS._events.getCursor(); + _inDialog = -1; + _closeFlag = false; + + // Get the dialog image + _surface = surfaceFromRes(9, 5, 2); + + // Set the dialog position + _dialogRect.resize(_surface, 0, 0, 100); + _dialogRect.center(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2); + + _bounds = _dialogRect; + _gfxManager._bounds = _bounds; + _savedArea = NULL; + + // Set up area rects + _gunRect.set(0, 0, 82, 48); + _clip1Rect.set(90, 6, _bounds.width(), 39); + _clip2Rect.set(90, 40, _bounds.width(), _bounds.height()); + _loadedRect.set(50, 40, 60, 50); +} + +AmmoBeltDialog::~AmmoBeltDialog() { + BF_GLOBALS._events.setCursor(_cursorNum); +} + +void AmmoBeltDialog::execute() { + // Draw the dialog + draw(); + + // Dialog event handler loop + _gfxManager.activate(); + + while (!_vm->shouldQuit() && !_closeFlag) { + Event evt; + while (_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) { + evt.mousePos.x -= _bounds.left; + evt.mousePos.y -= _bounds.top; + + process(evt); + } + + g_system->delayMillis(10); + g_system->updateScreen(); + } + + _gfxManager.deactivate(); +} + +bool AmmoBeltDialog::process(Event &event) { + switch (event.eventType) { + case EVENT_MOUSE_MOVE: { + // Handle updating cursor depending on whether cursor is in dialog or not + int inDialog = Rect(0, 0, _bounds.width(), _bounds.height()).contains(event.mousePos); + if (inDialog != _inDialog) { + // Update cursor + BF_GLOBALS._events.setCursor(inDialog ? CURSOR_USE : CURSOR_EXIT); + _inDialog = inDialog; + } + return true; + } + + case EVENT_BUTTON_DOWN: + if (!_inDialog) + // Clicked outside dialog, so flag to close it + _closeFlag = true; + else { + int v = (BF_GLOBALS.getFlag(fGunLoaded) ? 1 : 0) * (BF_GLOBALS.getFlag(fLoadedSpare) ? 2 : 1); + + // Handle first clip + if ((v != 1) && _clip1Rect.contains(event.mousePos)) { + if (BF_GLOBALS.getFlag(fGunLoaded)) { + event.mousePos.x = event.mousePos.y = 0; + } + + BF_GLOBALS.setFlag(fGunLoaded); + BF_GLOBALS.clearFlag(fLoadedSpare); + } + + // Handle second clip + if ((v != 2) && _clip2Rect.contains(event.mousePos)) { + if (BF_GLOBALS.getFlag(fGunLoaded)) { + event.mousePos.x = event.mousePos.y = 0; + } + + BF_GLOBALS.setFlag(fGunLoaded); + BF_GLOBALS.setFlag(fLoadedSpare); + } + + if (_gunRect.contains(event.mousePos) && BF_GLOBALS.getFlag(fGunLoaded)) { + BF_GLOBALS.clearFlag(fGunLoaded); + v = (BF_GLOBALS.getFlag(fGunLoaded) ? 1 : 0) * (BF_GLOBALS.getFlag(fLoadedSpare) ? 2 : 1); + + if (v != 2) + BF_GLOBALS.clearFlag(fLoadedSpare); + } + + draw(); + } + + return true; + + case EVENT_KEYPRESS: + if ((event.kbd.keycode == Common::KEYCODE_ESCAPE) || (event.kbd.keycode == Common::KEYCODE_RETURN)) { + // Escape pressed, so flag to close dialog + _closeFlag = true; + return true; + } + break; + + default: + break; + } + + return false; +} + +void AmmoBeltDialog::draw() { + Rect bounds = _bounds; + + if (!_savedArea) { + // Save the covered background area + _savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds); + } else { + bounds.moveTo(0, 0); + } + + // Draw the dialog image + _globals->gfxManager().copyFrom(_surface, bounds.left, bounds.top); + + // Setup clip flags + bool clip1 = true, clip2 = true; + bool gunLoaded = BF_GLOBALS.getFlag(fGunLoaded); + if (gunLoaded) { + // A clip is currently loaded. Hide the appropriate clip + if (BF_GLOBALS.getFlag(fLoadedSpare)) + clip2 = false; + else + clip1 = false; + } + + // Draw the first clip if necessary + 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, + bounds.top + _clip1Rect.top); + } + + // Draw the second clip if necessary + 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, + bounds.top + _clip2Rect.top); + } + + // If a clip is loaded, draw the 'loaded' portion of the gun + if (gunLoaded) { + GfxSurface loadedSurface = surfaceFromRes(9, 7, 1); + _loadedRect.resize(loadedSurface, _loadedRect.left, _loadedRect.top, 100); + _globals->gfxManager().copyFrom(loadedSurface, bounds.left + _loadedRect.left, + bounds.top + _loadedRect.top); + } +} + +/*--------------------------------------------------------------------------*/ + +RadioConvDialog::RadioConvDialog() : ModalDialog() { + int idx; + + // Set up the list of buttons + int maxWidth = 0; + for (idx = 0; idx < 8; ++idx) { + _buttons[idx].setText(RADIO_BTN_LIST[idx]); + maxWidth = MAX(maxWidth, (int)_buttons[idx]._bounds.width()); + + add(&_buttons[idx]); + } + + // Set up the button positions and add them to the dialog + for (idx = 0; idx < 8; ++idx) { + _buttons[idx]._bounds.moveTo((idx % 2) * maxWidth + 2, + idx / 2 * _buttons[idx]._bounds.height() + 2); + _buttons[idx]._bounds.setWidth(maxWidth); + + add(&_buttons[idx]); + } + + // Set the dialog size and position + setDefaults(); + setTopLeft(8, 92); + + BF_GLOBALS._events.setCursor(CURSOR_ARROW); +} + +RadioConvDialog::~RadioConvDialog() { + BF_GLOBALS._events.setCursor(CURSOR_WALK); +} + +int RadioConvDialog::execute() { + GfxButton *btn = ModalDialog::execute(); + + // Get which button was pressed + int btnIndex = -1; + for (int idx = 0; idx < 8; ++idx) { + if (btn == &_buttons[idx]) { + btnIndex = idx; + break; + } + } + + return btnIndex; +} + +int RadioConvDialog::show() { + // Show the dialog + RadioConvDialog *dlg = new RadioConvDialog(); + dlg->draw(); + + int btnIndex = dlg->execute(); + + // Close the dialog + dlg->remove(); + delete dlg; + + return btnIndex; +} + + +} // End of namespace BlueForce + +} // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_dialogs.h b/engines/tsage/blue_force/blueforce_dialogs.h new file mode 100644 index 0000000000..e9ce29c019 --- /dev/null +++ b/engines/tsage/blue_force/blueforce_dialogs.h @@ -0,0 +1,92 @@ +/* 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_DIALOGS_H +#define TSAGE_BLUEFORCE_DIALOGS_H + +#include "gui/options.h" +#include "tsage/dialogs.h" +#include "tsage/events.h" +#include "tsage/graphics.h" +#include "common/list.h" +#include "common/rect.h" +#include "common/system.h" + +namespace TsAGE { + +namespace BlueForce { + +using namespace TsAGE; + +class RightClickDialog : public GfxDialog { +private: + GfxSurface _surface; + Visage _btnImages; + Rect _rectList1[5]; + Rect _rectList2[5]; + Rect _rectList3[5]; + Rect _rectList4[5]; + + int _highlightedAction; + int _selectedAction; +public: + RightClickDialog(); + ~RightClickDialog(); + + virtual void draw(); + virtual bool process(Event &event); + void execute(); +}; + +class AmmoBeltDialog : public GfxDialog { +private: + GfxSurface _surface; + Visage _cursorImages; + Rect _dialogRect, _loadedRect, _gunRect, _clip1Rect, _clip2Rect; + CursorType _cursorNum; + int _inDialog; + bool _closeFlag; +public: + AmmoBeltDialog(); + ~AmmoBeltDialog(); + + virtual void draw(); + virtual bool process(Event &event); + void execute(); +}; + +class RadioConvDialog : public ModalDialog { +private: + GfxButton _buttons[8]; +public: + RadioConvDialog(); + virtual ~RadioConvDialog(); + int execute(); + + static int show(); +}; + +} // End of namespace BlueForce + +} // End of namespace TsAGE + +#endif diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 46c9307632..0a64e90304 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -21,10 +21,14 @@ */ #include "tsage/blue_force/blueforce_logic.h" +#include "tsage/blue_force/blueforce_dialogs.h" #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_scenes6.h" #include "tsage/scenes.h" #include "tsage/tsage.h" +#include "tsage/graphics.h" #include "tsage/staticres.h" namespace TsAGE { @@ -33,7 +37,7 @@ namespace BlueForce { void BlueForceGame::start() { // Start the game - _globals->_sceneManager.changeScene(50); + _globals->_sceneManager.changeScene(300); _globals->_events.setCursor(CURSOR_WALK); } @@ -45,9 +49,11 @@ Scene *BlueForceGame::createScene(int sceneNumber) { // Tsunami Title Screen return new Scene20(); case 50: + // Map screen return new Scene50(); case 60: - error("Scene group 0 not implemented"); + // Motorcycle + return new Scene60(); /* Scene Group #1 */ case 100: // Tsnunami Title Screen #2 @@ -64,8 +70,10 @@ Scene *BlueForceGame::createScene(int sceneNumber) { case 150: case 160: case 180: - case 190: error("Scene group 1 not implemented"); + case 190: + // Front of Police Station + return new Scene190(); case 200: case 210: case 220: @@ -76,8 +84,14 @@ Scene *BlueForceGame::createScene(int sceneNumber) { case 280: error("Scene group 2 not implemented"); case 300: + // Outside Police Station + return new Scene300(); case 315: + // Inside Police Station + return new Scene315(); case 325: + // Police Station Conference Room + return new Scene325(); case 330: case 340: case 342: @@ -104,6 +118,8 @@ Scene *BlueForceGame::createScene(int sceneNumber) { case 600: case 620: case 666: + // Death scene + return new Scene666(); case 690: error("Scene group 6 not implemented"); case 710: @@ -131,6 +147,56 @@ Scene *BlueForceGame::createScene(int sceneNumber) { } } +void BlueForceGame::rightClick() { + RightClickDialog *dlg = new RightClickDialog(); + dlg->execute(); + delete dlg; +} + +void BlueForceGame::processEvent(Event &event) { + if (event.eventType == EVENT_KEYPRESS) { + switch (event.kbd.keycode) { + case Common::KEYCODE_F1: + // F1 - Help + MessageDialog::show(HELP_MSG, OK_BTN_STRING); + break; + + case Common::KEYCODE_F2: + // F2 - Sound Options + SoundDialog::execute(); + break; + + case Common::KEYCODE_F3: + // F3 - Quit + quitGame(); + event.handled = false; + break; + + case Common::KEYCODE_F4: + // F4 - Restart + restartGame(); + _globals->_events.setCursorFromFlag(); + break; + + case Common::KEYCODE_F7: + // F7 - Restore + restoreGame(); + _globals->_events.setCursorFromFlag(); + break; + + case Common::KEYCODE_F10: + // F10 - Pause + GfxDialog::setPalette(); + MessageDialog::show(GAME_PAUSED_MSG, OK_BTN_STRING); + _globals->_events.setCursorFromFlag(); + break; + + default: + break; + } + } +} + /*--------------------------------------------------------------------------*/ AObjectArray::AObjectArray(): EventHandler() { @@ -212,6 +278,13 @@ void Timer::remove() { ((Scene100 *)BF_GLOBALS._sceneManager._scene)->removeTimer(this); } +void Timer::synchronize(Serializer &s) { + EventHandler::synchronize(s); + SYNC_POINTER(_tickAction); + SYNC_POINTER(_endAction); + s.syncAsUint32LE(_endFrame); +} + void Timer::signal() { assert(_endAction); Action *action = _endAction; @@ -231,24 +304,49 @@ void Timer::dispatch() { } } -void Timer::set(uint32 delay, Action *action) { +void Timer::set(uint32 delay, Action *endAction) { assert(delay != 0); _endFrame = BF_GLOBALS._sceneHandler->getFrameDifference() + delay; - _endAction = action; + _endAction = endAction; ((SceneExt *)BF_GLOBALS._sceneManager._scene)->addTimer(this); } /*--------------------------------------------------------------------------*/ -void SceneItemType1::process(Event &event) { - if (_action) - _action->process(event); +TimerExt::TimerExt(): Timer() { + _action = NULL; +} + +void TimerExt::set(uint32 delay, Action *endAction, Action *newAction) { + _newAction = newAction; + Timer::set(delay, endAction); +} + +void TimerExt::synchronize(Serializer &s) { + EventHandler::synchronize(s); + SYNC_POINTER(_action); +} + +void TimerExt::remove() { + _action = NULL; + remove(); } -void SceneItemType1::startMove(SceneObject *sceneObj, va_list va) { - warning("TODO: sub_1621C"); +void TimerExt::signal() { + Action *endAction = _endAction; + Action *newAction = _newAction; + remove(); + + // If the end action doesn't have an action anymore, set it to the specified new action + assert(endAction); + if (!endAction->_action) + endAction->setAction(newAction); +} + +void TimerExt::dispatch() { + } /*--------------------------------------------------------------------------*/ @@ -258,17 +356,172 @@ void SceneItemType2::startMove(SceneObject *sceneObj, va_list va) { /*--------------------------------------------------------------------------*/ -SceneExt::SceneExt(): Scene() { - warning("TODO: dword_503AA/dword_503AE/dword_53030"); +void NamedObject::postInit(SceneObjectList *OwnerList) { + _lookLineNum = _talkLineNum = _useLineNum = -1; + SceneObject::postInit(); +} + +void NamedObject::synchronize(Serializer &s) { + SceneObject::synchronize(s); + s.syncAsSint16LE(_resNum); + s.syncAsSint16LE(_lookLineNum); + s.syncAsSint16LE(_talkLineNum); + s.syncAsSint16LE(_useLineNum); +} + +bool NamedObject::startAction(CursorType action, Event &event) { + bool handled = true; + + switch (action) { + case CURSOR_LOOK: + if (_lookLineNum == -1) + handled = false; + else + SceneItem::display2(_resNum, _lookLineNum); + break; + case CURSOR_USE: + if (_useLineNum == -1) + handled = false; + else + SceneItem::display2(_resNum, _useLineNum); + break; + case CURSOR_TALK: + if (_talkLineNum == -1) + handled = false; + else + SceneItem::display2(_resNum, _talkLineNum); + break; + default: + handled = false; + break; + } + + if (!handled) + ((SceneExt *)BF_GLOBALS._sceneManager._scene)->display(action); + return handled; +} + +void NamedObject::setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) { + _resNum = resNum; + _lookLineNum = lookLineNum; + _talkLineNum = talkLineNum; + _useLineNum = useLineNum; + + switch (mode) { + case 2: + _globals->_sceneItems.push_front(this); + break; + case 4: + _globals->_sceneItems.addBefore(item, this); + break; + case 5: + _globals->_sceneItems.addAfter(item, this); + break; + default: + _globals->_sceneItems.push_back(this); + break; + } +} + + +/*--------------------------------------------------------------------------*/ + +CountdownObject::CountdownObject(): NamedObject() { + _countDown = 0; +} + +void CountdownObject::synchronize(Serializer &s) { + SceneObject::synchronize(s); + s.syncAsSint16LE(_countDown); +} + +void CountdownObject::dispatch() { + int frameNum = _frame; + SceneObject::dispatch(); + + if ((frameNum != _frame) && (_countDown > 0)) { + if (--_countDown == 0) { + animate(ANIM_MODE_NONE, 0); + _frame = 1; + } + } +} + +void CountdownObject::fixCountdown(int mode, ...) { + if (mode == 8) { + va_list va; + va_start(va, mode); + + _countDown = va_arg(va, int); + animate(ANIM_MODE_8, _countDown, NULL); + va_end(va); + } +} + +/*--------------------------------------------------------------------------*/ + +FollowerObject::FollowerObject(): NamedObject() { + _object = NULL; +} + +void FollowerObject::synchronize(Serializer &s) { + NamedObject::synchronize(s); + SYNC_POINTER(_object); +} + +void FollowerObject::remove() { + NamedObject::remove(); + _object = NULL; +} + +void FollowerObject::dispatch() { + SceneObject::dispatch(); + assert(_object); + + if ((_object->_flags & OBJFLAG_HIDE) || ((_object->_visage != 307) && + ((_object->_visage != 308) || (_object->_strip != 1)))) { + hide(); + } else if ((_object->_visage != 308) || (_object->_strip != 1)) { + show(); + setStrip(_object->_strip); + setPosition(_object->_position, _object->_yDiff); + } +} + +void FollowerObject::reposition() { + assert(_object); + setStrip(_object->_strip); + setPosition(_object->_position, _object->_yDiff); + reposition(); +} + +void FollowerObject::setup(SceneObject *object, int visage, int frameNum, int yDiff) { + SceneObject::postInit(); + _object = object; + _yDiff = yDiff; + setVisage(visage); + setFrame(frameNum); - _field372 = 0; - _field37A = 0; - _field37C = NULL; + dispatch(); +} + +/*--------------------------------------------------------------------------*/ + +SceneExt::SceneExt(): Scene() { + _stripManager._onBegin = SceneExt::startStrip; + _stripManager._onEnd = SceneExt::endStrip; + + _field372 = _field37A = 0; + _savedPlayerEnabled = false; + _savedUiEnabled = false; + _savedCanWalk = false; + _eventHandler = NULL; + _cursorVisage.setVisage(1, 8); } void SceneExt::postInit(SceneObjectList *OwnerList) { Scene::postInit(OwnerList); - if (BF_GLOBALS._v4CEA2) { + if (BF_GLOBALS._dayNumber) { // Blank out the bottom portion of the screen BF_GLOBALS._interfaceY = BF_INTERFACE_Y; @@ -287,7 +540,7 @@ void SceneExt::dispatch() { _timerList.dispatch(); if (_field37A) { - if ((--_field37A == 0) && BF_GLOBALS._v4CEA2) { + if ((--_field37A == 0) && BF_GLOBALS._dayNumber) { if (BF_GLOBALS._v4E238 && (BF_GLOBALS._v4CF9E == 1)) { warning("sub_1B052"); } @@ -306,19 +559,110 @@ void SceneExt::loadScene(int sceneNum) { _v51C34.bottom = 300; } +void SceneExt::checkGun() { + // Remove a bullet from the currently loaded clip + if (BF_GLOBALS.getFlag(fLoadedSpare) && (BF_GLOBALS._clip2Bullets > 0)) { + if (--BF_GLOBALS._clip2Bullets == 0) + BF_GLOBALS.clearFlag(fGunLoaded); + } else { + if (BF_GLOBALS._clip1Bullets > 0) + --BF_GLOBALS._clip1Bullets; + + if (!BF_GLOBALS._clip1Bullets) + BF_GLOBALS.clearFlag(fGunLoaded); + } + + BF_GLOBALS._sound3.play(4); +} + +bool SceneExt::display(CursorType action) { + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(9000, BF_GLOBALS._randomSource.getRandomNumber(2)); + break; + case CURSOR_USE: + SceneItem::display2(9000, BF_GLOBALS._randomSource.getRandomNumber(2) + 6); + break; + case CURSOR_TALK: + SceneItem::display2(9000, BF_GLOBALS._randomSource.getRandomNumber(2) + 3); + break; + case INV_COLT45: + gunDisplay(); + break; + default: + if (action < BF_LAST_INVENT) + SceneItem::display2(9002, (int)action); + else + return false; + break; + } + + return true; +} + +void SceneExt::fadeOut() { + uint32 black = 0; + BF_GLOBALS._scenePalette.fade((const byte *)&black, false, 100); +} + +void SceneExt::gunDisplay() { + if (!BF_GLOBALS.getFlag(gunDrawn)) { + // Gun not drawn + SceneItem::display2(1, BF_GLOBALS.getFlag(fCanDrawGun) ? 0 : 4); + } else if (!BF_GLOBALS.getFlag(fGunLoaded)) { + // Gun not loaded + SceneItem::display2(1, 1); + } else if (!BF_GLOBALS.getHasBullets()) { + // Out of ammunition + SceneItem::display2(1, 2); + } else { + // Check scene for whether gun can fire + checkGun(); + } +} + +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; + BF_GLOBALS._player.disableControl(); + + if (!BF_GLOBALS._v50696 && BF_GLOBALS._uiElements._active) + BF_GLOBALS._uiElements.hide(); + } +} + +void SceneExt::endStrip() { + SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; + scene->_field372 = 0; + + if (scene->_savedPlayerEnabled) { + BF_GLOBALS._player.enableControl(); + BF_GLOBALS._player._uiEnabled = scene->_savedUiEnabled; + BF_GLOBALS._player._canWalk = scene->_savedCanWalk; + + if (!BF_GLOBALS._v50696 && BF_GLOBALS._uiElements._active) + BF_GLOBALS._uiElements.show(); + } +} + /*--------------------------------------------------------------------------*/ -GameScene::GameScene() { +GroupedScene::GroupedScene() { } -void GameScene::postInit(SceneObjectList *OwnerList) { +void GroupedScene::postInit(SceneObjectList *OwnerList) { _field794 = 0; _field412 = 1; SceneExt::postInit(OwnerList); } -void GameScene::remove() { +void GroupedScene::remove() { SceneExt::remove(); if (_field794 == 1) { for (SynchronizedList<SceneObject *>::iterator i = BF_GLOBALS._sceneObjects->begin(); @@ -340,16 +684,271 @@ void SceneHandlerExt::postInit(SceneObjectList *OwnerList) { SceneHandler::postInit(OwnerList); // Load the low end palette data - GLOBALS._scenePalette.loadPalette(2); - GLOBALS._scenePalette.refresh(); + BF_GLOBALS._scenePalette.loadPalette(2); + BF_GLOBALS._scenePalette.refresh(); } void SceneHandlerExt::process(Event &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, + // then pass all events to it first + if (BF_GLOBALS._stripProxy._action) { + BF_GLOBALS._stripProxy._action->process(event); + if (event.handled) + return; + } + SceneHandler::process(event); +} + +void SceneHandlerExt::playerAction(Event &event) { + if (BF_GLOBALS._events.getCursor() == INV_DOG_WHISTLE) { + SceneItem::display2(1, 6); + event.handled = true; + } +} - // TODO: All the new stuff from Blue Force +void SceneHandlerExt::processEnd(Event &event) { + // Check for a fallback text display for the given cursor/item being used in the scene + if (!event.handled && BF_GLOBALS._sceneManager._scene) { + CursorType cursor = BF_GLOBALS._events.getCursor(); + if (((SceneExt *)BF_GLOBALS._sceneManager._scene)->display(cursor)) + event.handled = true; + } } +/*--------------------------------------------------------------------------*/ + +BlueForceInvObjectList::BlueForceInvObjectList(): + _none(9, 5, 1), + _colt45(9, 1, 1), + _ammoClip(9, 4, 2), + _spareClip(9, 4, 3), + _handcuffs(9, 1, 4), + _greensGun(9, 1, 5), + _ticketBook(9, 1, 6), + _mirandaCard(9, 1, 7), + _forestRap(9, 1, 8), + _greenId(9, 1, 9), + _baseballCard(9, 1, 10), + _bookingGreen(9, 1, 11), + _flare(9, 1, 12), + _cobbRap(9, 1, 13), + _bullet22(9, 1, 14), + _autoRifle(9, 1, 15), + _wig(9, 1, 16), + _frankieId(9, 1, 17), + _tyroneId(9, 1, 18), + _snub22(9, 1, 19), + _bug(1, 1, 1), + _bookingFrankie(9, 2, 1), + _bookingGang(9, 2, 2), + _fbiTeletype(9, 2, 3), + _daNote(9, 2, 4), + _printOut(9, 2, 5), + _warehouseKeys(9, 2, 6), + _centerPunch(9, 2, 7), + _tranqGun(9, 2, 8), + _hook(9, 2, 9), + _rags(9, 2, 10), + _jar(9, 2, 11), + _screwdriver(9, 2, 12), + _dFloppy(9, 2, 13), + _blankDisk(9, 2, 14), + _stick(9, 2, 15), + _crate1(9, 2, 16), + _crate2(9, 2, 17), + _shoebox(9, 2, 18), + _badge(9, 2, 19), + _bug2(1, 1, 1), + _rentalCoupon(9, 3, 1), + _nickel(9, 3, 2), + _lyleCard(9, 3, 3), + _carterNote(9, 3, 4), + _mugshot(9, 3, 5), + _clipping(9, 3, 6), + _microfilm(9, 3, 7), + _waveKeys(9, 3, 8), + _rentalKeys(9, 3, 9), + _napkin(9, 3, 10), + _dmvPrintout(9, 3, 11), + _fishingNet(9, 3, 12), + _id(9, 3, 13), + _bullets9mm(9, 3, 14), + _schedule(9, 3, 15), + _grenades(9, 3, 16), + _yellowCord(9, 3, 17), + _halfYellowCord(9, 3, 18), + _blackCord(9, 3, 19), + _bug3(1, 1, 1), + _halfBlackCord(9, 4, 1), + _warrant(9, 4, 2), + _jacket(9, 4, 3), + _greensKnife(9, 4, 4), + _dogWhistle(9, 4, 5), + _ammoBelt(9, 1, 2), + _lastInvent(9, 4, 7) { + + // Add the items to the list + _itemList.push_back(&_none); + _itemList.push_back(&_colt45); + _itemList.push_back(&_ammoClip); + _itemList.push_back(&_spareClip); + _itemList.push_back(&_handcuffs); + _itemList.push_back(&_greensGun); + _itemList.push_back(&_ticketBook); + _itemList.push_back(&_mirandaCard); + _itemList.push_back(&_forestRap); + _itemList.push_back(&_greenId); + _itemList.push_back(&_baseballCard); + _itemList.push_back(&_bookingGreen); + _itemList.push_back(&_flare); + _itemList.push_back(&_cobbRap); + _itemList.push_back(&_bullet22); + _itemList.push_back(&_autoRifle); + _itemList.push_back(&_wig); + _itemList.push_back(&_frankieId); + _itemList.push_back(&_tyroneId); + _itemList.push_back(&_snub22); + _itemList.push_back(&_bug); + _itemList.push_back(&_bookingFrankie); + _itemList.push_back(&_bookingGang); + _itemList.push_back(&_fbiTeletype); + _itemList.push_back(&_daNote); + _itemList.push_back(&_printOut); + _itemList.push_back(&_warehouseKeys); + _itemList.push_back(&_centerPunch); + _itemList.push_back(&_tranqGun); + _itemList.push_back(&_hook); + _itemList.push_back(&_rags); + _itemList.push_back(&_jar); + _itemList.push_back(&_screwdriver); + _itemList.push_back(&_dFloppy); + _itemList.push_back(&_blankDisk); + _itemList.push_back(&_stick); + _itemList.push_back(&_crate1); + _itemList.push_back(&_crate2); + _itemList.push_back(&_shoebox); + _itemList.push_back(&_badge); + _itemList.push_back(&_bug2); + _itemList.push_back(&_rentalCoupon); + _itemList.push_back(&_nickel); + _itemList.push_back(&_lyleCard); + _itemList.push_back(&_carterNote); + _itemList.push_back(&_mugshot); + _itemList.push_back(&_clipping); + _itemList.push_back(&_microfilm); + _itemList.push_back(&_waveKeys); + _itemList.push_back(&_rentalKeys); + _itemList.push_back(&_napkin); + _itemList.push_back(&_dmvPrintout); + _itemList.push_back(&_fishingNet); + _itemList.push_back(&_id); + _itemList.push_back(&_bullets9mm); + _itemList.push_back(&_schedule); + _itemList.push_back(&_grenades); + _itemList.push_back(&_yellowCord); + _itemList.push_back(&_halfYellowCord); + _itemList.push_back(&_blackCord); + _itemList.push_back(&_bug3); + _itemList.push_back(&_halfBlackCord); + _itemList.push_back(&_warrant); + _itemList.push_back(&_jacket); + _itemList.push_back(&_greensKnife); + _itemList.push_back(&_dogWhistle); + _itemList.push_back(&_ammoBelt); + _itemList.push_back(&_lastInvent); +} + +void BlueForceInvObjectList::reset() { + // Reset all object scene numbers + SynchronizedList<InvObject *>::iterator i; + for (i = _itemList.begin(); i != _itemList.end(); ++i) { + (*i)->_sceneNumber = 0; + } + + // Set up default inventory + setObjectScene(INV_COLT45, 1); + setObjectScene(INV_HANDCUFFS, 1); + setObjectScene(INV_AMMO_BELT, 1); + setObjectScene(INV_ID, 1); + + // Set default room for other objects + setObjectScene(INV_TICKET_BOOK, 60); + setObjectScene(INV_MIRANDA_CARD, 60); + setObjectScene(INV_FOREST_RAP, 320); + setObjectScene(INV_GREEN_ID, 370); + setObjectScene(INV_BASEBALL_CARD, 840); + setObjectScene(INV_BOOKING_GREEN, 390); + setObjectScene(INV_FLARE, 355); + setObjectScene(INV_COBB_RAP, 810); + setObjectScene(INV_22_BULLET, 415); + setObjectScene(INV_AUTO_RIFLE, 415); + setObjectScene(INV_WIG, 415); + setObjectScene(INV_FRANKIE_ID, 410); + setObjectScene(INV_TYRONE_ID, 410); + setObjectScene(INV_22_SNUB, 410); + setObjectScene(INV_FBI_TELETYPE, 320); + setObjectScene(INV_DA_NOTE, 320); + setObjectScene(INV_PRINT_OUT, 570); + setObjectScene(INV_WHAREHOUSE_KEYS, 360); + setObjectScene(INV_CENTER_PUNCH, 0); + setObjectScene(INV_TRANQ_GUN, 830); + setObjectScene(INV_HOOK, 350); + setObjectScene(INV_RAGS, 870); + setObjectScene(INV_JAR, 870); + setObjectScene(INV_SCREWDRIVER, 355); + setObjectScene(INV_D_FLOPPY, 570); + setObjectScene(INV_BLANK_DISK, 560); + setObjectScene(INV_STICK, 710); + setObjectScene(INV_CRATE1, 710); + setObjectScene(INV_CRATE2, 870); + setObjectScene(INV_SHOEBOX, 270); + setObjectScene(INV_BADGE, 560); + setObjectScene(INV_RENTAL_COUPON, 0); + setObjectScene(INV_NICKEL, 560); + setObjectScene(INV_LYLE_CARD, 270); + setObjectScene(INV_CARTER_NOTE, 830); + setObjectScene(INV_MUG_SHOT, 810); + setObjectScene(INV_CLIPPING, 810); + setObjectScene(INV_MICROFILM, 810); + setObjectScene(INV_WAVE_KEYS, 840); + setObjectScene(INV_RENTAL_KEYS, 840); + setObjectScene(INV_NAPKIN, 115); + setObjectScene(INV_DMV_PRINTOUT, 810); + setObjectScene(INV_FISHING_NET, 830); + setObjectScene(INV_9MM_BULLETS, 930); + setObjectScene(INV_SCHEDULE, 930); + setObjectScene(INV_GRENADES, 355); + setObjectScene(INV_GREENS_KNIFE, 370); + setObjectScene(INV_JACKET, 880); + setObjectScene(INV_DOG_WHISTLE, 880); + setObjectScene(INV_YELLOW_CORD, 910); + setObjectScene(INV_BLACK_CORD, 910); +} + +void BlueForceInvObjectList::setObjectScene(int objectNum, int sceneNumber) { + // Find the appropriate object + int num = objectNum; + 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); + + // Update the user interface if necessary + BF_GLOBALS._uiElements.updateInventory(); +} + +/*--------------------------------------------------------------------------*/ + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index 9ab8a87a0c..8a827a3214 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -29,18 +29,20 @@ #include "tsage/scenes.h" #include "tsage/globals.h" -#define BF_INTERFACE_Y 168 - namespace TsAGE { namespace BlueForce { using namespace TsAGE; +#define BF_INVENTORY (*((::TsAGE::BlueForce::BlueForceInvObjectList *)_globals->_inventory)) + class BlueForceGame: public Game { public: virtual void start(); virtual Scene *createScene(int sceneNumber); + virtual void rightClick(); + virtual void processEvent(Event &event); }; #define OBJ_ARRAY_SIZE 10 @@ -69,30 +71,90 @@ public: uint32 _endFrame; public: Timer(); - void set(uint32 delay, Action *action); + void set(uint32 delay, Action *endAction); + virtual Common::String getClassName() { return "Timer"; } + virtual void synchronize(Serializer &s); virtual void remove(); virtual void signal(); virtual void dispatch(); }; -class SceneItemType1: public SceneItem { +class TimerExt: public Timer { +public: + Action *_newAction; +public: + TimerExt(); + void set(uint32 delay, Action *endAction, Action *action); + + virtual Common::String getClassName() { return "TimerExt"; } + virtual void synchronize(Serializer &s); + virtual void remove(); + virtual void signal(); + virtual void dispatch(); +}; + +class SceneItemType2: public SceneHotspot { public: - virtual void process(Event &event); virtual void startMove(SceneObject *sceneObj, va_list va); }; -class SceneItemType2: public SceneItemType1 { +class NamedObject: public SceneObject { public: - virtual void startMove(SceneObject *sceneObj, va_list va); + int _resNum; + int _lookLineNum, _talkLineNum, _useLineNum; + + virtual Common::String getClassName() { return "NamedObject"; } + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual bool startAction(CursorType action, Event &event); + + void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item); }; +class CountdownObject: public NamedObject { +public: + int _countDown; + CountdownObject(); + void fixCountdown(int mode, ...); + + virtual Common::String getClassName() { return "CountdownObject"; } + virtual void synchronize(Serializer &s); + virtual void dispatch(); +}; + +class FollowerObject: public NamedObject { +public: + SceneObject *_object; + FollowerObject(); + + virtual Common::String getClassName() { return "SceneObjectExt4"; } + virtual void synchronize(Serializer &s); + virtual void remove(); + virtual void dispatch(); + virtual void reposition(); + + void setup(SceneObject *object, int visage, int frameNum, int yDiff); +}; + +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 { +private: + void gunDisplay(); + static void startStrip(); + static void endStrip(); public: AObjectArray _timerList, _objArray2; int _field372; + bool _savedPlayerEnabled; + bool _savedUiEnabled; + bool _savedCanWalk; int _field37A; - EventHandler *_field37C; + + EventHandler *_eventHandler; + Visage _cursorVisage; Rect _v51C34; public: @@ -103,18 +165,20 @@ public: virtual void process(Event &event); virtual void dispatch(); virtual void loadScene(int sceneNum); - virtual void proc13() { warning("TODO: SceneExt::proc13"); } + virtual void checkGun(); void addTimer(Timer *timer) { _timerList.add(timer); } void removeTimer(Timer *timer) { _timerList.remove(timer); } + bool display(CursorType action); + void fadeOut(); }; -class GameScene: public SceneExt { +class GroupedScene: public SceneExt { public: int _field412; int _field794; public: - GameScene(); + GroupedScene(); virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void remove(); @@ -124,10 +188,87 @@ class SceneHandlerExt: public SceneHandler { public: virtual void postInit(SceneObjectList *OwnerList = NULL); virtual void process(Event &event); + + virtual void playerAction(Event &event); + virtual void processEnd(Event &event); }; -class BlueAnimatedSpeaker: public Speaker { +class BlueForceInvObjectList : public InvObjectList { public: + InvObject _none; + InvObject _colt45; + InvObject _ammoClip; + InvObject _spareClip; + InvObject _handcuffs; + InvObject _greensGun; + InvObject _ticketBook; + InvObject _mirandaCard; + InvObject _forestRap; + InvObject _greenId; + InvObject _baseballCard; + InvObject _bookingGreen; + InvObject _flare; + InvObject _cobbRap; + InvObject _bullet22; + InvObject _autoRifle; + InvObject _wig; + InvObject _frankieId; + InvObject _tyroneId; + InvObject _snub22; + InvObject _bug; + InvObject _bookingFrankie; + InvObject _bookingGang; + InvObject _fbiTeletype; + InvObject _daNote; + InvObject _printOut; + InvObject _warehouseKeys; + InvObject _centerPunch; + InvObject _tranqGun; + InvObject _hook; + InvObject _rags; + InvObject _jar; + InvObject _screwdriver; + InvObject _dFloppy; + InvObject _blankDisk; + InvObject _stick; + InvObject _crate1; + InvObject _crate2; + InvObject _shoebox; + InvObject _badge; + InvObject _bug2; + InvObject _rentalCoupon; + InvObject _nickel; + InvObject _lyleCard; + InvObject _carterNote; + InvObject _mugshot; + InvObject _clipping; + InvObject _microfilm; + InvObject _waveKeys; + InvObject _rentalKeys; + InvObject _napkin; + InvObject _dmvPrintout; + InvObject _fishingNet; + InvObject _id; + InvObject _bullets9mm; + InvObject _schedule; + InvObject _grenades; + InvObject _yellowCord; + InvObject _halfYellowCord; + InvObject _blackCord; + InvObject _bug3; + InvObject _halfBlackCord; + InvObject _warrant; + InvObject _jacket; + InvObject _greensKnife; + InvObject _dogWhistle; + InvObject _ammoBelt; + InvObject _lastInvent; + + BlueForceInvObjectList(); + void reset(); + void setObjectScene(int objectNum, int sceneNumber); + + virtual Common::String getClassName() { return "BlueForceInvObjectList"; } }; } // End of namespace BlueForce diff --git a/engines/tsage/blue_force/blueforce_scenes0.cpp b/engines/tsage/blue_force/blueforce_scenes0.cpp index f1b714ec6c..9ba1db8688 100644 --- a/engines/tsage/blue_force/blueforce_scenes0.cpp +++ b/engines/tsage/blue_force/blueforce_scenes0.cpp @@ -21,6 +21,7 @@ */ #include "tsage/blue_force/blueforce_scenes0.h" +#include "tsage/blue_force/blueforce_dialogs.h" #include "tsage/scenes.h" #include "tsage/tsage.h" #include "tsage/staticres.h" @@ -191,6 +192,7 @@ void Scene20::postInit(SceneObjectList *OwnerList) { _object8.changeZoom(100); setAction(&_action1); + BF_GLOBALS._dialogCenter.y = 165; } /*-------------------------------------------------------------------------- @@ -263,34 +265,36 @@ void Scene50::Tooltip::highlight(bool btnDown) { update(); if (btnDown) { - if ((BF_GLOBALS._bikiniHutState == 14) && BF_GLOBALS.getFlag(98)) + if ((BF_GLOBALS._bookmark == bCalledToDrunkStop) && BF_GLOBALS.getFlag(beenToJRDay2)) scene->_sceneNumber = 600; - else if (BF_GLOBALS._bikiniHutState == 5) + else if (BF_GLOBALS._bookmark == bBookedGreen) scene->_sceneNumber = 410; else { - BF_GLOBALS._v4CEF4 = _newSceneNumber; + BF_GLOBALS._driveToScene = _newSceneNumber; - switch (BF_GLOBALS._v4CEF2) { + switch (BF_GLOBALS._driveFromScene) { case 330: case 340: case 342: BF_GLOBALS._player.disableControl(); - if (_locationId != BF_GLOBALS._mapLocationId) { + BF_GLOBALS._mapLocationId = _locationId; + + if (BF_GLOBALS._driveToScene == 330) { scene->_sceneNumber = 330; } else { - scene->_sceneNumber = (BF_GLOBALS._v4CEA2 != 1) || (BF_GLOBALS._bikiniHutState < 1) || - (BF_GLOBALS._bikiniHutState >= 2) ? 342 : 340; + scene->_sceneNumber = (BF_GLOBALS._dayNumber != 1) || (BF_GLOBALS._bookmark < bStartOfGame) || + (BF_GLOBALS._bookmark >= bCalledToDomesticViolence) ? 342 : 340; } break; case 410: case 551: - if (BF_GLOBALS.getFlag((BF_GLOBALS._v4CEF2 == 410) ? 41 : 40)) { + if (BF_GLOBALS.getFlag((BF_GLOBALS._driveFromScene == 410) ? fSearchedTruck : didDrunk)) { BF_GLOBALS._mapLocationId = _locationId; BF_GLOBALS._player.disableControl(); scene->_sceneNumber = _newSceneNumber; } else { - BF_GLOBALS._v4CEA8 = 4; + BF_GLOBALS._deathReason = 4; BF_GLOBALS._sceneManager.changeScene(666); return; } @@ -298,7 +302,7 @@ void Scene50::Tooltip::highlight(bool btnDown) { case 300: if (_locationId == 1) { - BF_GLOBALS._v4CEF4 = 300; + BF_GLOBALS._driveToScene = 300; _newSceneNumber = 300; } // Deliberate fall through to default @@ -354,7 +358,7 @@ void Scene50::postInit(SceneObjectList *OwnerList) { _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), - (BF_GLOBALS._bikiniHutState == 13) || (BF_GLOBALS._bikiniHutState == 14) ? 551 : 550, + (BF_GLOBALS._bookmark == bInspectionDone) || (BF_GLOBALS._bookmark == bCalledToDrunkStop) ? 551 : 550, BIKINI_HUT, 16); _item.setBounds(Rect(0, 0, SCREEN_WIDTH * 2, SCREEN_HEIGHT)); @@ -424,7 +428,7 @@ void Scene50::remove() { void Scene50::signal() { if (_sceneMode == 1) { // Destination selected - if ((BF_GLOBALS._v4CEF2 == 551) && (_sceneNumber != BF_GLOBALS._v4CEF2)) { + if ((BF_GLOBALS._driveFromScene == 551) && (_sceneNumber != BF_GLOBALS._driveFromScene)) { BF_GLOBALS.setFlag(109); BF_GLOBALS.setFlag(115); BF_GLOBALS.setFlag(121); @@ -432,21 +436,21 @@ void Scene50::signal() { BF_GLOBALS.setFlag(133); } - if ((BF_GLOBALS._v4CEF2 == 410) && (_sceneNumber != BF_GLOBALS._v4CEF2)) { + if ((BF_GLOBALS._driveFromScene == 410) && (_sceneNumber != BF_GLOBALS._driveFromScene)) { BF_GLOBALS.setFlag(125); } - if ((BF_GLOBALS._v4CEF2 == 340) && (_sceneNumber != BF_GLOBALS._v4CEF2)) { + if ((BF_GLOBALS._driveFromScene == 340) && (_sceneNumber != BF_GLOBALS._driveFromScene)) { BF_GLOBALS.setFlag(123); } - if ((BF_GLOBALS._v4CEF2 == 380) && (_sceneNumber != BF_GLOBALS._v4CEF2)) { - if (BF_GLOBALS._bikiniHutState >= 4) + if ((BF_GLOBALS._driveFromScene == 380) && (_sceneNumber != BF_GLOBALS._driveFromScene)) { + if (BF_GLOBALS._bookmark >= bLauraToParamedics) BF_GLOBALS.setFlag(129); - if (BF_GLOBALS._bikiniHutState >= 6) + if (BF_GLOBALS._bookmark >= bStoppedFrankie) BF_GLOBALS.setFlag(131); - if (BF_GLOBALS._bikiniHutState == 3) { - BF_GLOBALS._v4CEA8 = 19; + if (BF_GLOBALS._bookmark == bArrestedGreen) { + BF_GLOBALS._deathReason = 19; _sceneNumber = 666; } } @@ -496,6 +500,613 @@ void Scene50::process(Event &event) { } } +/*-------------------------------------------------------------------------- + * Scene 60 - Motorcycle + * + *--------------------------------------------------------------------------*/ + +bool Scene60::Item2::startAction(CursorType action, Event &event) { + Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene; + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(60, 15); + break; + default: + switch (BF_GLOBALS._dayNumber) { + case 1: + if (BF_GLOBALS.getFlag(onDuty) && check1()) + return true; + break; + case 2: + 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(); + BF_GLOBALS._sceneManager.changeScene(50); + break; + } + + return true; +} + +bool Scene60::Item2::check1() { + if (BF_GLOBALS._bookmark >= bStoppedFrankie) { + BF_GLOBALS._v5098C |= 1; + return false; + } else { + if ((BF_GLOBALS._bookmark == bBookedGreen) && BF_GLOBALS.getFlag(fArrivedAtGangStop)) { + BF_GLOBALS.set2Flags(f1035Frankie); + BF_GLOBALS._sceneManager.changeScene(410); + } + + if (BF_GLOBALS._bookmark >= bLauraToParamedics) { + if (BF_GLOBALS.getFlag(fLeftTraceIn910)) { + if (BF_GLOBALS._bookmark < bBookedGreen) { + BF_GLOBALS._bookmark = bBookedGreen; + BF_GLOBALS.clearFlag(fCalledBackup); + BF_GLOBALS.set2Flags(f1035Frankie); + return false; + } else if (BF_GLOBALS._bookmark == bBookedGreen) { + if (!BF_GLOBALS.getFlag(fCalledBackup)) + BF_GLOBALS.setFlag(f1035Frankie); + + BF_GLOBALS._sceneManager.changeScene(410); + return true; + } + } + + } else if (BF_GLOBALS._bookmark < bStartOfGame) { + // Should never reach here + } else if (BF_GLOBALS._bookmark < bCalledToDomesticViolence) { + if ((BF_GLOBALS._v5098C >> 1) & 1) + BF_GLOBALS.setFlag(fLateToMarina); + else + BF_GLOBALS._v5098C |= 2; + } else { + int v = ((BF_GLOBALS._v5098C >> 2) & 15 + 1) & 15; + BF_GLOBALS._v5098C = (BF_GLOBALS._v5098C & 0xC3) | (v << 2); + + if ((v != 1) && (v != 2)) { + BF_GLOBALS._deathReason = 19; + BF_GLOBALS._sceneManager.changeScene(666); + return true; + } + } + } + + BF_GLOBALS._v5098C |= 1; + return false; +} + +bool Scene60::Item2::check2() { + switch (BF_GLOBALS._bookmark) { + case bInspectionDone: + if (BF_GLOBALS._v5098D & 1) { + BF_GLOBALS.setFlag(fLateToDrunkStop); + } else { + BF_GLOBALS._v5098D |= 1; + } + break; + case bCalledToDrunkStop: + BF_GLOBALS.setFlag(fHasDrivenFromDrunk); + break; + default: + break; + } + + BF_GLOBALS._v5098C |= 0x80; + return false; +} + +/*--------------------------------------------------------------------------*/ + +bool Scene60::Item3::startAction(CursorType action, Event &event) { + Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene; + scene->fadeOut(); + BF_GLOBALS._sceneManager.changeScene(scene->_newScene); + return true; +} + +bool Scene60::Radio::startAction(CursorType action, Event &event) { + Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene; + + switch(action) { + case CURSOR_LOOK: + SceneItem::display2(60, 0); + break; + case CURSOR_USE: + case CURSOR_TALK: + scene->_sound.play(32); + scene->setAction(&scene->_action1); + break; + default: + SceneItem::display2(60, 1); + break; + } + return true; +} + +bool Scene60::Compartment::startAction(CursorType action, Event &event) { + Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene; + + switch(action) { + case CURSOR_LOOK: + SceneItem::display2(60, 8); + break; + case CURSOR_USE: + if ((BF_INVENTORY.getObjectScene(INV_TICKET_BOOK) == 1) && + (BF_INVENTORY.getObjectScene(INV_MIRANDA_CARD) == 1)) { + SceneItem::display2(60, 9); + } + break; + case CURSOR_TALK: + SceneItem::display2(60, 10); + break; + case INV_TICKET_BOOK: + SceneItem::display2(60, 11); + scene->_ticketBook.show(); + BF_INVENTORY.setObjectScene(INV_TICKET_BOOK, 60); + BF_GLOBALS._events.setCursor(CURSOR_USE); + BF_GLOBALS._sceneItems.addBefore(&scene->_radio, &scene->_ticketBook); + break; + case INV_MIRANDA_CARD: + SceneItem::display2(60, 12); + scene->_mirandaCard.show(); + BF_INVENTORY.setObjectScene(INV_MIRANDA_CARD, 60); + BF_GLOBALS._events.setCursor(CURSOR_USE); + BF_GLOBALS._sceneItems.addAfter(&scene->_compartmentDoor, &scene->_mirandaCard); + break; + default: + return NamedHotspot::startAction(action, event); + } + + return true; +} + +/*--------------------------------------------------------------------------*/ + +bool Scene60::MirandaCard::startAction(CursorType action, Event &event) { + Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(60, 5); + return true; + case CURSOR_USE: + if (BF_INVENTORY.getObjectScene(INV_MIRANDA_CARD) == 60) { + SceneItem::display2(60, 6); + BF_INVENTORY.setObjectScene(INV_MIRANDA_CARD, 1); + if (!BF_GLOBALS.getFlag(fGotPointsForTktBook)) { + BF_GLOBALS._uiElements.addScore(10); + BF_GLOBALS.setFlag(fGotPointsForTktBook); + } + + scene->_mirandaCard.hide(); + BF_GLOBALS._sceneItems.remove(&scene->_mirandaCard); + } + return true; + case CURSOR_TALK: + SceneItem::display2(60, 7); + return true; + default: + return NamedObject::startAction(action, event); + break; + } +} + +bool Scene60::TicketBook::startAction(CursorType action, Event &event) { + Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(60, 2); + return true; + case CURSOR_USE: + if (BF_INVENTORY.getObjectScene(INV_TICKET_BOOK) == 60) { + scene->_ticketBook.hide(); + BF_GLOBALS._sceneItems.remove(&scene->_ticketBook); + SceneItem::display2(60, 3); + BF_INVENTORY.setObjectScene(INV_TICKET_BOOK, 1); + if (!BF_GLOBALS.getFlag(fShotNicoIn910)) { + BF_GLOBALS._uiElements.addScore(10); + BF_GLOBALS.setFlag(fShotNicoIn910); + } + } + return true; + case CURSOR_TALK: + SceneItem::display2(60, 4); + return true; + default: + return NamedObject::startAction(action, event); + break; + } +} + +bool Scene60::CompartmentDoor::startAction(CursorType action, Event &event) { + Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + SceneItem::display2(60, 13); + return true; + case CURSOR_USE: + if (_flag) { + _flag = false; + BF_GLOBALS._player.disableControl(); + Common::Point pt(308, 165); + NpcMover *mover = new NpcMover(); + addMover(mover, &pt, scene); + } else { + _flag = true; + BF_GLOBALS._player.disableControl(); + Common::Point pt(288, 165); + NpcMover *mover = new NpcMover(); + addMover(mover, &pt, scene); + } + return true; + case CURSOR_TALK: + SceneItem::display2(60, 14); + return true; + default: + return NamedObject::startAction(action, event); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene60::Action1::signal() { + Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + setDelay(2); + break; + case 1: + scene->_stripManager.start(634, this); + break; + case 2: + _state = useRadio(); + setDelay(4); + break; + case 3: + switch (_state) { + case 1: + if (BF_GLOBALS.removeFlag(fCan1004Marina)) { + BF_GLOBALS._uiElements.addScore(10); + _state = 606; + } else if (BF_GLOBALS.removeFlag(fCan1004Drunk)) { + BF_GLOBALS._uiElements.addScore(10); + _state = 606; + } else { + _state = 611; + } + break; + case 2: + _state = 612; + break; + case 3: + if (BF_GLOBALS.removeFlag(f1015Marina)) { + BF_GLOBALS._uiElements.addScore(10); + _state = 613; + } else if (BF_GLOBALS.removeFlag(f1015Frankie)) { + BF_GLOBALS._uiElements.addScore(10); + _state = 614; + } else if (BF_GLOBALS.removeFlag(f1015Drunk)) { + BF_GLOBALS._uiElements.addScore(10); + _state = 615; + } else { + _state = 616; + } + break; + case 4: + if (BF_GLOBALS.removeFlag(f1027Marina)) { + BF_GLOBALS._uiElements.addScore(10); + _actionIndex = 5; + _state = 617; + } else if (BF_GLOBALS.removeFlag(f1027Frankie)) { + BF_GLOBALS._uiElements.addScore(10); + _actionIndex = 5; + _state = 618; + } else if (BF_GLOBALS.removeFlag(f1015Drunk)) { + BF_GLOBALS._uiElements.addScore(10); + _actionIndex = 5; + _state = 619; + } else { + _state = 620; + } + break; + case 5: + if (BF_GLOBALS.removeFlag(f1035Marina)) { + BF_GLOBALS.setFlag(fCalledBackup); + BF_GLOBALS._uiElements.addScore(50); + _state = 621; + } else if (BF_GLOBALS.removeFlag(f1035Frankie)) { + BF_GLOBALS.setFlag(fCalledBackup); + BF_GLOBALS._uiElements.addScore(50); + _actionIndex = 5; + _state = 622; + } else if (BF_GLOBALS.removeFlag(f1035Drunk)) { + BF_GLOBALS._uiElements.addScore(10); + _state = 623; + } else { + _state = 624; + } + break; + case 6: + if (BF_GLOBALS.removeFlag(f1097Marina)) { + BF_GLOBALS._uiElements.addScore(10); + _state = 625; + } else if (BF_GLOBALS.removeFlag(f1097Frankie)) { + BF_GLOBALS._uiElements.addScore(10); + _actionIndex = 5; + _state = 626; + } else if (BF_GLOBALS.removeFlag(f1097Drunk)) { + BF_GLOBALS._uiElements.addScore(10); + _state = 627; + } else { + _state = 628; + } + break; + case 7: + if (BF_GLOBALS.removeFlag(f1098Marina)) { + BF_GLOBALS._uiElements.addScore(10); + _state = 629; + } else if (BF_GLOBALS.removeFlag(f1098Frankie)) { + BF_GLOBALS._uiElements.addScore(10); + _state = 630; + } else if (BF_GLOBALS.removeFlag(f1098Drunk)) { + BF_GLOBALS._uiElements.addScore(10); + _state = 631; + } else { + _state = 632; + } + break; + case 0: + default: + _state = 610; + break; + } + + scene->_stripManager.start(_state, this); + break; + case 4: + remove(); + case 5: + setDelay(120); + break; + case 6: + _actionIndex = 4; + scene->_stripManager.start(633, this); + break; + } +} + +int Scene60::Action1::useRadio() { + return RadioConvDialog::show(); +} + +void Scene60::Action2::signal() { + Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.disableControl(); + scene->_sound.play(32); + setDelay(2); + break; + case 1: + BF_GLOBALS._bookmark = bStartOfGame; + BF_GLOBALS.set2Flags(f1035Marina); + scene->_stripManager.start(60, this); + break; + case 2: + BF_GLOBALS._player.enableControl(); + remove(); + break; + } +} + +void Scene60::Action3::signal() { + Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.disableControl(); + scene->_sound.play(32); + setDelay(2); + break; + case 1: + BF_GLOBALS._bookmark = bInspectionDone; + BF_GLOBALS.set2Flags(f1035Drunk); + BF_GLOBALS.setFlag(fCan1004Drunk); + scene->_stripManager.start(71, this); + break; + case 2: + scene->_field1222 = true; + BF_GLOBALS._player.enableControl(); + remove(); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +Scene60::Scene60(): SceneExt() { + _field1222 = false; + _newScene = 0; +} + +void Scene60::postInit(SceneObjectList *OwnerList) { + _newScene = BF_GLOBALS._driveFromScene = BF_GLOBALS._sceneManager._previousScene; + + // Set up which scene background to use + switch (_newScene) { + case 300: + _sceneNumber = 1301; + break; + case 380: + _sceneNumber = 1380; + break; + case 410: + _sceneNumber = 1410; + break; + case 551: + _sceneNumber = 1550; + break; + case 550: + _sceneNumber = 1555; + break; + case 580: + _sceneNumber = 1580; + break; + case 800: + _sceneNumber = 1810; + break; + default: + _sceneNumber = 60; + break; + } + + if (_sceneNumber == 1550) { + if (BF_GLOBALS.getFlag(fHasDrivenFromDrunk)) + _sceneNumber = 1555; + else { + _object1.postInit(); + _object1.setVisage(1550); + _object1.animate(ANIM_MODE_2); + _object1.setPosition(Common::Point(158, 18)); + } + } + + loadScene(_sceneNumber); + + 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); + } + + if ((_sceneNumber == 1410) && (BF_GLOBALS._bookmark == bBookedGreen) && + !BF_GLOBALS.getFlag(fDriverOutOfTruck)) { + _object1.postInit(); + _object1.setVisage(410); + _object1.setStrip(6); + _object1.setPosition(Common::Point(135, 47)); + } + + if (BF_GLOBALS.getFlag(fWithLyle)) { + _visage = 62; + _item2._sceneRegionId = 22; + } else if (BF_GLOBALS.getFlag(onDuty)) { + _visage = 63; + _item2._sceneRegionId = 20; + } else { + _visage = 61; + _item2._sceneRegionId = 28; + } + _dashboard.setup(_visage, 1, 1, 160, 168, 100); + _cursorId = CURSOR_USE; + + if (_visage == 63) { + _compartmentDoor.postInit(); + _compartmentDoor.setVisage(60); + _compartmentDoor.setStrip(1); + _compartmentDoor.setFrame(1); + _compartmentDoor.setPosition(Common::Point(288, 165)); + _compartmentDoor.setPriority(250); + _compartmentDoor._flag = true; + BF_GLOBALS._sceneItems.push_back(&_compartmentDoor); + + _mirandaCard.postInit(); + _mirandaCard.setVisage(60); + _mirandaCard.setStrip(2); + _mirandaCard.setFrame(2); + _mirandaCard.setPosition(Common::Point(280, 160)); + + if (BF_INVENTORY.getObjectScene(INV_MIRANDA_CARD) == 60) { + _mirandaCard.show(); + BF_GLOBALS._sceneItems.push_back(&_mirandaCard); + } else { + _mirandaCard.hide(); + } + + _ticketBook.postInit(); + _ticketBook.setVisage(60); + _ticketBook.setStrip(2); + _ticketBook.setFrame(1); + _ticketBook.setPosition(Common::Point(289, 161)); + + if (BF_INVENTORY.getObjectScene(INV_TICKET_BOOK) == 60) { + _ticketBook.show(); + BF_GLOBALS._sceneItems.push_back(&_ticketBook); + } else { + _ticketBook.hide(); + } + } + + _item3._sceneRegionId = 7; + _radio._sceneRegionId = 12; + _compartment._sceneRegionId = 14; + + _stripManager.addSpeaker(&_gameTextSpeaker); + _stripManager.addSpeaker(&_jakeRadioSpeaker); + + if (BF_GLOBALS.getFlag(onDuty) && !BF_GLOBALS.getFlag(fWithLyle)) { + BF_GLOBALS._sceneItems.push_back(&_radio); + BF_GLOBALS._sceneItems.push_back(&_compartment); + } + + BF_GLOBALS._sceneItems.push_back(&_item2); + BF_GLOBALS._sceneItems.push_back(&_item3); + BF_GLOBALS._player.enableControl(); + BF_GLOBALS._events.setCursor(CURSOR_USE); + + switch (BF_GLOBALS._dayNumber) { + case 1: + if (BF_GLOBALS.getFlag(onDuty) && (BF_GLOBALS._v5098C & 1) && + (BF_GLOBALS._bookmark < bStartOfGame) && (BF_GLOBALS._sceneManager._previousScene != 342)) { + setAction(&_action2); + if (BF_GLOBALS._sceneManager._previousScene == 342) + _newScene = 340; + } + break; + case 2: + if (BF_GLOBALS.getFlag(onDuty) && ((BF_GLOBALS._v5098C >> 7) & 1) && + (BF_GLOBALS._sceneManager._previousScene != 550) && + (BF_GLOBALS._bookmark < bInspectionDone)) { + setAction(&_action3); + } + } +} + +void Scene60::signal() { + ++_sceneMode; + BF_GLOBALS._player.enableControl(); +} + +void Scene60::dispatch() { + SceneExt::dispatch(); + + int idx = BF_GLOBALS._sceneRegions.indexOf(Common::Point( + BF_GLOBALS._sceneManager._scene->_sceneBounds.left + BF_GLOBALS._events._mousePos.x, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + BF_GLOBALS._events._mousePos.y)); + + if (idx == _item3._sceneRegionId) { + if (BF_GLOBALS._events.getCursor() != CURSOR_EXIT) { + _cursorId = BF_GLOBALS._events.getCursor(); + BF_GLOBALS._events.setCursor(CURSOR_EXIT); + } + } else { + if (BF_GLOBALS._events.getCursor() == CURSOR_EXIT) { + BF_GLOBALS._events.setCursor(_cursorId); + } + } +} + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes0.h b/engines/tsage/blue_force/blueforce_scenes0.h index 5c98184ed8..963f8b25a8 100644 --- a/engines/tsage/blue_force/blueforce_scenes0.h +++ b/engines/tsage/blue_force/blueforce_scenes0.h @@ -25,6 +25,7 @@ #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" @@ -96,6 +97,90 @@ public: virtual void process(Event &event); }; +class Scene60 : public SceneExt { + /* Items */ + class Item2: public NamedHotspot { + private: + bool check1(); + 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 { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class TicketBook: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class CompartmentDoor: public NamedObject { + public: + bool _flag; + virtual bool startAction(CursorType action, Event &event); + }; + + /* Actions */ + class Action1: public ActionExt { + private: + int useRadio(); + public: + virtual void signal(); + }; + class Action2: public Action { + public: + virtual void signal(); + }; + class Action3: public Action { + public: + virtual void signal(); + }; +public: + SequenceManager _sequenceManager; + Action1 _action1; + Action2 _action2; + Action3 _action3; + NamedObject _object1; + MirandaCard _mirandaCard; + TicketBook _ticketBook; + CompartmentDoor _compartmentDoor; + SceneObject _dashboard; + AltSceneObject _car; + NamedHotspot _item1; + Item2 _item2; + Item3 _item3; + Radio _radio; + Compartment _compartment; + SpeakerGameText _gameTextSpeaker; + SpeakerJakeRadio _jakeRadioSpeaker; + ASound _sound; + int _newScene; + int _sceneNumber; + int _visage; + CursorType _cursorId; + bool _field1222; + + Scene60(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void dispatch(); +}; + + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes1.cpp b/engines/tsage/blue_force/blueforce_scenes1.cpp index 650b63c24b..b4e41c20e3 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.cpp +++ b/engines/tsage/blue_force/blueforce_scenes1.cpp @@ -176,7 +176,7 @@ void Scene100::postInit(SceneObjectList *OwnerList) { _globals->_player.disableControl(); _index = 109; - if (BF_GLOBALS._v4CEA2 < 6) { + if (BF_GLOBALS._dayNumber < 6) { // Title loadScene(100); BF_GLOBALS._sound1.play(2); @@ -191,7 +191,7 @@ void Scene100::postInit(SceneObjectList *OwnerList) { void Scene100::signal() { ++_sceneMode; - if (BF_GLOBALS._v4CEA2 < 6) { + if (BF_GLOBALS._dayNumber < 6) { BF_GLOBALS._scenePalette.clearListeners(); BF_GLOBALS._scenePalette.loadPalette(100); BF_GLOBALS._sceneManager.changeScene(_index); @@ -346,11 +346,11 @@ void Scene109::Text::dispatch() { /*--------------------------------------------------------------------------*/ -Scene109::Scene109(): GameScene() { +Scene109::Scene109(): GroupedScene() { } void Scene109::postInit(SceneObjectList *OwnerList) { - GameScene::postInit(OwnerList); + GroupedScene::postInit(OwnerList); loadScene(999); _protaginist2.postInit(); @@ -427,6 +427,281 @@ void Scene109::signal() { } } +/*-------------------------------------------------------------------------- + * Scene 190 - Front of Police Station + * + *--------------------------------------------------------------------------*/ + +bool Scene190::Object4::startAction(CursorType action, Event &event) { + Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 13; + Common::Point pt(62, 96); + PlayerMover *mover = new PlayerMover(); + BF_GLOBALS._player.addMover(mover, &pt, scene); + return true; + } + default: + return NamedObject::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene190::Item1::startAction(CursorType action, Event &event) { + Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + scene->setAction(&scene->_action1); + return true; + default: + return NamedHotspot::startAction(action, event); + } +} + +bool Scene190::Item2::startAction(CursorType action, Event &event) { + Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_USE: + scene->_stripManager.start(1900, scene); + return true; + default: + return NamedHotspot::startAction(action, event); + } +} + +bool Scene190::Exit::startAction(CursorType action, Event &event) { + Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene; + + Common::Point pt(316, 91); + PlayerMover *mover = new PlayerMover(); + BF_GLOBALS._player.addMover(mover, &pt, scene); + return true; +} + +/*--------------------------------------------------------------------------*/ + +void Scene190::Action1::signal() { + Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.disableControl(); + setDelay(2); + break; + case 1: { + ADD_MOVER(BF_GLOBALS._player, 165, 91); + break; + } + case 2: + scene->_sound.play(82); + scene->_object2.animate(ANIM_MODE_5, this); + break; + case 3: + ADD_MOVER(BF_GLOBALS._player, 180, 86); + break; + case 4: + scene->_sound.play(82); + scene->_object2.animate(ANIM_MODE_6, this); + break; + case 5: + BF_GLOBALS._sound1.fadeOut2(NULL); + BF_GLOBALS._sceneManager.changeScene(315); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +Scene190::Scene190(): SceneExt() { + _fieldB52 = true; + _cursorVisage.setVisage(1, 8); +} + +void Scene190::postInit(SceneObjectList *OwnerList) { + BF_GLOBALS._dialogCenter.y = 100; + if ((BF_GLOBALS._sceneManager._previousScene == 100) || + (BF_GLOBALS._sceneManager._previousScene == 20)) { +// clearScreen(); + } + if (BF_GLOBALS._dayNumber == 0) + // If at start of game, change to first day + BF_GLOBALS._dayNumber = 1; + + // Load the scene data + loadScene(190); + BF_GLOBALS._scenePalette.loadPalette(2); + + _stripManager.addSpeaker(&_speaker); + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.disableControl(); + + // Initialise objects + _object2.postInit(); + _object2.setVisage(190); + _object2.setStrip(1); + _object2.setPosition(Common::Point(179, 88)); + + _object3.postInit(); + _object3.setVisage(190); + _object3.setStrip(2); + _object3.fixPriority(200); + _object3.setPosition(Common::Point(170, 31)); + _object3.animate(ANIM_MODE_7, 0, NULL); + _object3.setDetails(190, 8, 26, 19, 1, NULL); + + if (BF_GLOBALS.getFlag(fWithLyle)) { + BF_GLOBALS._player.setVisage(303); + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + BF_GLOBALS._player.animate(ANIM_MODE_1, NULL); + BF_GLOBALS._player._moveDiff = Common::Point(3, 1); + + _object4.postInit(); + _object4.setVisage(444); + _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; + BF_GLOBALS._player.setPosition(Common::Point(316, 91)); + ADD_MOVER(BF_GLOBALS._player, 305, 91); + break; + } + case 315: + _sceneMode = 1901; + setAction(&_sequenceManager, this, 1901, &BF_GLOBALS._player, &_object2, NULL); + break; + case 50: + case 60: + default: + _fieldB52 = false; + BF_GLOBALS._player.setPosition(Common::Point(62, 96)); + BF_GLOBALS._player._strip = 3; + BF_GLOBALS._player.enableControl(); + break; + } + } else { + BF_GLOBALS._player.setVisage(BF_GLOBALS._player._visage); + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + BF_GLOBALS._player.animate(ANIM_MODE_1, NULL); + + switch (BF_GLOBALS._sceneManager._previousScene) { + case 300: { + if (!BF_GLOBALS.getFlag(onBike)) { + BF_GLOBALS._player._moveDiff = Common::Point(3, 1); + _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 11 : 12; + BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 1304 : 303); + BF_GLOBALS._player.setPosition(Common::Point(316, 91)); + ADD_MOVER(BF_GLOBALS._player, 305, 91); + } else { + BF_GLOBALS._player.disableControl(); + _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 193 : 191; + setAction(&_sequenceManager, this, 193, &BF_GLOBALS._player, NULL); + } + break; + } + case 315: + BF_GLOBALS._player._moveDiff = Common::Point(3, 1); + _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 1900 : 1901; + setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, &_object2, NULL); + break; + case 50: + case 60: + default: + BF_GLOBALS.setFlag(onBike); + BF_GLOBALS._player.disableControl(); + _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 192 : 190; + setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, NULL); + break; + } + } + + if (BF_GLOBALS.getFlag(onBike)) { + BF_GLOBALS._sound1.play(BF_GLOBALS.getFlag(onDuty) ? 37 : 29); + } else if (BF_GLOBALS._sceneManager._previousScene != 300) { + BF_GLOBALS._sound1.play(33); + } + + _exit.setDetails(Rect(310, 50, 320, 125), 190, -1, -1, -1, 1, NULL); + _item2.setDetails(Rect(108, 1, 111, 94), 190, 7, 11, 18, 1, NULL); + _item4.setDetails(2, 190, 5, 10, 16, 1); + _item3.setDetails(1, 190, 4, 10, 15, 1); + _item8.setDetails(6, 190, 20, 21, 22, 1); + _item1.setDetails(7, 190, 1, 10, -1, 1); + _item7.setDetails(5, 190, 0, 10, 12, 1); + _item6.setDetails(4, 190, 2, 10, 13, 1); + _item5.setDetails(3, 190, 3, 10, 14, 1); + _item9.setDetails(Rect(0, 0, 89, 68), 190, 6, 10, 17, 1, NULL); + _item10.setDetails(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y), 190, 23, -1, -1, 1, NULL); +} + +void Scene190::signal() { + switch (_sceneMode) { + case 10: + if ((BF_GLOBALS._dayNumber == 2) && (BF_GLOBALS._bookmark < bEndDayOne)) + BF_GLOBALS._sound1.changeSound(49); + BF_GLOBALS._sceneManager.changeScene(300); + break; + case 11: + case 12: + case 1900: + case 1901: + BF_GLOBALS._player.enableControl(); + _fieldB52 = false; + break; + case 13: + case 191: + case 193: + BF_GLOBALS._sceneManager.changeScene(60); + break; + case 190: + case 192: + BF_GLOBALS._sceneManager.changeScene(300); + break; + case 0: + default: + BF_GLOBALS._player.enableControl(); + break; + } +} + +void Scene190::process(Event &event) { + SceneExt::process(event); + + if (BF_GLOBALS._player._enabled && !_eventHandler && (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); + 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); + } + } +} + +void Scene190::dispatch() { + SceneExt::dispatch(); + + 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(); + _fieldB52 = true; + _sceneMode = 10; + + ADD_MOVER(BF_GLOBALS._player, 330, BF_GLOBALS._player._position.y); + } +} + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes1.h b/engines/tsage/blue_force/blueforce_scenes1.h index 0769c6e3c6..3028dcc9f9 100644 --- a/engines/tsage/blue_force/blueforce_scenes1.h +++ b/engines/tsage/blue_force/blueforce_scenes1.h @@ -71,7 +71,7 @@ public: Action1 _action1; Action2 _action2; ScenePalette _scenePalette; - SceneObjectExt2 _object1, _object2, _object3, _object4, _object5; + NamedObject _object1, _object2, _object3, _object4, _object5; int _index; Scene100(); @@ -79,7 +79,7 @@ public: virtual void signal(); }; -class Scene109: public GameScene { +class Scene109: public GroupedScene { /* Actions */ class Action1: public Action { public: @@ -115,7 +115,6 @@ public: SceneObject _object1, _object2, _protaginist2, _protaginist1, _object5; SceneObject _drunk, _object7, _bartender, _object9, _object10; Text _text; - BlueAnimatedSpeaker _speaker; Action1 _action1; Action _action2, _action3; public: @@ -125,6 +124,58 @@ public: virtual void signal(); }; +class Scene190: public SceneExt { + /* Objects */ + 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); + }; + class Item2: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Exit: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Actions */ + class Action1: public Action { + public: + virtual void signal(); + }; +public: + SequenceManager _sequenceManager; + FollowerObject _object1; + NamedObject _object2, _object3; + Object4 _object4; + Item1 _item1; + Item2 _item2; + NamedHotspot _item3, _item4, _item5, _item6; + NamedHotspot _item7, _item8, _item9, _item10; + Exit _exit; + Action1 _action1; + ASoundExt _sound; + SpeakerGameText _speaker; + bool _fieldB52; + + Scene190(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); + virtual void synchronize(Serializer &s) { + SceneExt::synchronize(s); + s.syncAsSint16LE(_fieldB52); + } +}; + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes3.cpp b/engines/tsage/blue_force/blueforce_scenes3.cpp new file mode 100644 index 0000000000..cfed3fab11 --- /dev/null +++ b/engines/tsage/blue_force/blueforce_scenes3.cpp @@ -0,0 +1,1445 @@ +/* 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 "common/config-manager.h" +#include "tsage/blue_force/blueforce_scenes3.h" +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/staticres.h" +#include "tsage/globals.h" + +namespace TsAGE { + +namespace BlueForce { + +/*-------------------------------------------------------------------------- + * Scene 300 - Outside Police Station + * + *--------------------------------------------------------------------------*/ + +bool Scene300::Object::startAction(CursorType action, Event &event) { + if (action == CURSOR_TALK) { + Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene; + scene->_stripManager.start(_stripNumber, scene); + return true; + } else { + return NamedObject::startAction(action, event); + } +} + +bool Scene300::Object19::startAction(CursorType action, Event &event) { + if ((action != CURSOR_USE) || !BF_GLOBALS.getFlag(onDuty)) { + return NamedObject::startAction(action, event); + } else if ((BF_GLOBALS._dayNumber != 2) || (BF_GLOBALS._bookmark >= bEndDayOne)) { + Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene; + setAction(&scene->_action4); + } else { + SceneItem::display2(300, 33); + } + + return true; +} + +bool Scene300::Item1::startAction(CursorType action, Event &event) { + if (action == CURSOR_USE) { + Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene; + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 305; + scene->setAction(&scene->_sequenceManager1, scene, 305, &BF_GLOBALS._player, + &scene->_object8, NULL); + return true; + } else { + return NamedHotspot::startAction(action, event); + } +} + +bool Scene300::Item2::startAction(CursorType action, Event &event) { + if ((action == CURSOR_LOOK) || (action == CURSOR_USE)) { + Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene; + scene->setAction(&scene->_sequenceManager1, scene, 304, &scene->_object11, NULL); + return true; + } else { + return NamedHotspot::startAction(action, event); + } +} + +bool Scene300::Item14::startAction(CursorType action, Event &event) { + ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 151, 54); + return true; +} + +bool Scene300::Item15::startAction(CursorType action, Event &event) { + ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 316, 90); + return true; +} + +/*--------------------------------------------------------------------------*/ + +void Scene300::Action1::signal() { + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.disableControl(); + setDelay(1); + break; + case 1: + if (BF_GLOBALS.getFlag(fWithLyle)) + SceneItem::display2(666, 27); + else + SceneItem::display2(300, 0); + setDelay(1); + break; + case 2: { + ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, BF_GLOBALS._player._position.x - 8, + BF_GLOBALS._player._position.y); + break; + } + case 3: + BF_GLOBALS._player.enableControl(); + remove(); + break; + default: + break; + } +} + +void Scene300::Action2::signal() { + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.disableControl(); + setDelay(1); + break; + case 1: + SceneItem::display2(300, 28); + setDelay(1); + break; + case 2: { + ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x + 8, + BF_GLOBALS._player._position.y); + break; + } + case 3: + BF_GLOBALS._player.enableControl(); + remove(); + break; + default: + break; + } +} + +void Scene300::Action3::signal() { + Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.disableControl(); + setDelay(1); + break; + case 1: + BF_GLOBALS._player.setAction(&scene->_sequenceManager1, this, 306, &BF_GLOBALS._player, + &scene->_object8, NULL); + break; + case 2: + SceneItem::display2(300, 35); + setDelay(1); + break; + case 3: + BF_GLOBALS._player.enableControl(); + remove(); + break; + default: + break; + } +} + +void Scene300::Action4::signal() { + Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.disableControl(); + setDelay(1); + break; + case 1: + setAction(&scene->_sequenceManager1, this, 316, &BF_GLOBALS._player, &scene->_object19, NULL); + break; + case 2: + BF_GLOBALS._sceneManager.changeScene(60); + break; + case 3: + setAction(&scene->_sequenceManager1, this, 319, &scene->_object19, NULL); + break; + case 4: + BF_GLOBALS.setFlag(2); + BF_GLOBALS._sceneManager.changeScene(190); + break; + default: + break; + } +} + +void Scene300::Action5::signal() { + Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.disableControl(); + scene->_field2760 = 1; + setDelay(1); + break; + case 1: + setAction(&scene->_sequenceManager1, this, 1306, &scene->_object1, &scene->_object8, NULL); + break; + case 2: + scene->_stripManager.start(3004, this); + break; + case 3: { + ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 186, 140); + break; + } + case 4: + remove(); + break; + default: + break; + } +} + +/*--------------------------------------------------------------------------*/ + +Scene300::Scene300(): SceneExt(), _object13(3000), _object14(3001), _object15(3002), + _object16(3003) { + _field2760 = _field2762 = 0; +} + +void Scene300::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(300); + + // Add the speakers + _stripManager.addSpeaker(&_gameTextSpeaker); + _stripManager.addSpeaker(&_sutterSpeaker); + _stripManager.addSpeaker(&_dougSpeaker); + _stripManager.addSpeaker(&_jakeSpeaker); + + _field2762 = 0; + _item14.setDetails(Rect(144, 27, 160, 60), 300, -1, -1, -1, 1, NULL); + _item15.setDetails(Rect(310, 76, SCREEN_WIDTH, 105), 300, -1, -1, -1, 1, NULL); + + // Setup the player + int playerVisage = BF_GLOBALS._player._visage; + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.setVisage(playerVisage); + BF_GLOBALS._player.setStrip(3); + BF_GLOBALS._player.setPosition(Common::Point(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2)); + BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper()); + BF_GLOBALS._player.animate(ANIM_MODE_1, NULL); + BF_GLOBALS._player._moveDiff = Common::Point(3, 1); + BF_GLOBALS._player.disableControl(); + + _object8.postInit(); + _object8.setVisage(301); + _object8.setStrip(2); + _object8.setPosition(Common::Point(300, 77)); + + if ((BF_GLOBALS._dayNumber != 2) || (BF_GLOBALS._bookmark < bEndDayOne)) { + _object17.postInit(); + _object17.setVisage(301); + _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); + _object18.setPosition(Common::Point(137, 92)); + _object18.setDetails(300, 11, 13, 3, 1, NULL); + } + + _object19.postInit(); + _object19.setVisage(301); + _object19.setStrip(1); + _object19.setPosition(Common::Point(175, 99)); + _object19.setDetails(300, 11, 13, 34, 1, NULL); + + _object11.postInit(); + _object11.setVisage(301); + _object11.setStrip(8); + _object11.setPosition(Common::Point(265, 91)); + _object11.hide(); + + switch (BF_GLOBALS._sceneManager._previousScene) { + case 50: + case 60: + BF_GLOBALS.clearFlag(onBike); + if (BF_GLOBALS.getFlag(onDuty)) { + BF_GLOBALS._player.disableControl(); + _sceneMode = 318; + setAction(&_sequenceManager1, this, 318, &BF_GLOBALS._player, &_object19, NULL); + } else { + BF_GLOBALS._player.disableControl(); + _sceneMode = 300; + setAction(&_sequenceManager1, this, 1300, &BF_GLOBALS._player, NULL); + } + break; + case 190: + _sceneMode = 0; + if (!BF_GLOBALS.getFlag(2)) { + _sceneMode = 7308; + BF_GLOBALS._player.setPosition(Common::Point(175, 50)); + ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, 123, 71); + + if ((BF_GLOBALS._dayNumber == 2) && (BF_GLOBALS._bookmark < bEndDayOne)) + setup(); + } else if (!BF_GLOBALS.getFlag(3)) { + BF_GLOBALS._player.disableControl(); + _sceneMode = 300; + setAction(&_sequenceManager1, this, 300, &BF_GLOBALS._player, NULL); + } else { + BF_GLOBALS._player.disableControl(); + _sceneMode = 318; + setAction(&_sequenceManager1, this, 318, &BF_GLOBALS._player, &_object19, NULL); + } + break; + case 315: + BF_GLOBALS._player.setPosition(Common::Point(305, 66)); + if ((BF_GLOBALS._dayNumber != 2) || (BF_GLOBALS._bookmark >= bEndDayOne)) { + BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 1304 : 303); + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager1, this, 306, &BF_GLOBALS._player, &_object8, NULL); + } else { + BF_GLOBALS._player.setVisage(1304); + setup(); + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + setAction(&_sequenceManager1, this, 306, &BF_GLOBALS._player, &_object8, NULL); + } + break; + default: + _sceneMode = 0; + BF_GLOBALS._player.setVisage(1304); + BF_GLOBALS._player.disableControl(); + setAction(&_sequenceManager1, this, 306, &BF_GLOBALS._player, &_object8, NULL); + break; + } + + _item10.setDetails(4, 300, 7, 13, 16, 1); + _item11.setDetails(2, 300, 9, 13, 18, 1); + _item12.setDetails(5, 300, 10, 13, 19, 1); + _item13.setDetails(3, 300, 25, 26, 27, 1); + _item2.setDetails(Rect(266, 54, 272, 59), 300, -1, -1, -1, 1, NULL); + _item1.setDetails(Rect(262, 47, 299, 76), 300, 1, 13, -1, 1, NULL); + _item4.setDetails(Rect(0, 85, SCREEN_WIDTH - 1, BF_INTERFACE_Y - 1), 300, 6, 13, 15, 1, NULL); + _item7.setDetails(Rect(219, 46, 251, 74), 300, 22, 23, 24, 1, NULL); + _item8.setDetails(Rect(301, 53, 319, 78), 300, 22, 23, 24, 1, NULL); + _item5.setDetails(Rect(179, 44, 200, 55), 300, 8, 13, 17, 1, NULL); + _item6.setDetails(Rect(210, 46, 231, 55), 300, 8, 13, 17, 1, NULL); + _item3.setDetails(Rect(160, 0, SCREEN_WIDTH - 1, 75), 300, 4, 13, 14, 1, NULL); + _item9.setDetails(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y), 300, 29, 30, 31, 1, NULL); +} + +void Scene300::signal() { + switch (_sceneMode) { + case 300: + BF_GLOBALS._sound1.fadeSound(33); + BF_GLOBALS.clearFlag(onBike); + _sceneMode = 0; + + if ((BF_GLOBALS._dayNumber != 1) || (BF_GLOBALS._bookmark != bNone)) { + signal(); + } else { + _stripManager.start(3005, this); + } + break; + case 301: + if (_field2760) { + _sceneMode = 1302; + signal(); + } else { + BF_GLOBALS._player.disableControl(); + _sceneMode = 1302; + setAction(&_sequenceManager1, this, 306, &_object1, &_object8, NULL); + } + + _object12.show(); + _object5.dispatch(); + BF_GLOBALS._player.hide(); + break; + case 303: + BF_GLOBALS._player.disableControl(); + _sceneMode = 2307; + setAction(&_sequenceManager1, this, 303, &_object13, &_object1, NULL); + break; + case 305: + if ((BF_GLOBALS._dayNumber == 4) || (BF_GLOBALS._dayNumber == 5)) { + _sceneMode = 0; + setAction(&_action3); + } else { + BF_GLOBALS._sound1.fadeOut2(NULL); + BF_GLOBALS._sceneManager.changeScene(315); + } + break; + case 309: + BF_GLOBALS._player.disableControl(); + _sceneMode = 3307; + setAction(&_sequenceManager1, this, 309, &_object14, &_object1, NULL); + break; + case 310: + BF_GLOBALS._player.disableControl(); + _sceneMode = 4307; + setAction(&_sequenceManager1, this, 310, &_object12, &_object1, NULL); + break; + case 311: + BF_GLOBALS._player.disableControl(); + _sceneMode = 5307; + setAction(&_sequenceManager1, this, 311, &_object15, &_object1, NULL); + break; + case 312: + case 5307: + BF_GLOBALS._player.disableControl(); + _sceneMode = 1305; + setAction(&_sequenceManager1, this, 312, &_object1, &_object16, NULL); + break; + case 317: + BF_GLOBALS.setFlag(2); + BF_GLOBALS._sceneManager.changeScene(60); + break; + case 318: + BF_GLOBALS.clearFlag(onBike); + _sceneMode = 0; + signal(); + break; + case 1302: + _field2762 = 0; + BF_GLOBALS._player.disableControl(); + _sceneMode = 1308; + setAction(&_sequenceManager1, this, 302, &_object1, NULL); + break; + case 1305: + BF_GLOBALS._player.disableControl(); + _sceneMode = 1313; + setAction(&_sequenceManager1, this, 305, &_object1, &_object8, NULL); + BF_GLOBALS._player.show(); + _object12.hide(); + break; + case 1307: + case 2308: + BF_GLOBALS._player.disableControl(); + _sceneMode = 303; + setAction(&_sequenceManager1, this, 308, &_object14, NULL); + break; + case 1308: + BF_GLOBALS._player.disableControl(); + _sceneMode = 1307; + setAction(&_sequenceManager1, this, 308, &_object13, NULL); + break; + case 1313: + BF_GLOBALS._player.disableControl(); + _sceneMode = 0; + _object15.setAction(&_sequenceManager4, NULL, 315, &_object15, &_object16, NULL); + _object13.setAction(&_sequenceManager2, NULL, 313, &_object13, &_object17, NULL); + _object14.setAction(&_sequenceManager3, this, 314, &_object14, &_object18, NULL); + + BF_GLOBALS._bookmark = bEndDayOne; + BF_GLOBALS._sound1.changeSound(33); + break; + case 2307: + case 3308: + BF_GLOBALS._player.disableControl(); + _sceneMode = 309; + setAction(&_sequenceManager1, this, 308, &_object12, NULL); + break; + case 3307: + _object9.postInit(); + _object9.hide(); + _object10.postInit(); + _object10.hide(); + + if (BF_GLOBALS.getFlag(1)) { + BF_GLOBALS._player.disableControl(); + _sceneMode = 4308; + setAction(&_sequenceManager1, this, 6307, &_object2, &_object1, &_object9, &_object10, NULL); + } else { + BF_GLOBALS._player.disableControl(); + _sceneMode = 4308; + setAction(&_sequenceManager1, this, 7307, &_object12, &_object1, &_object9, &_object10, NULL); + } + break; + case 4307: + case 5308: + BF_GLOBALS._player.disableControl(); + _sceneMode = 311; + setAction(&_sequenceManager1, this, 308, &_object16, NULL); + break; + case 4308: + BF_GLOBALS._player.disableControl(); + _sceneMode = 310; + setAction(&_sequenceManager1, this, 308, &_object15, NULL); + break; + case 6308: + BF_GLOBALS._sceneManager.changeScene(190); + break; + case 7308: + if (_field2762) { + BF_GLOBALS._player.disableControl(); + _sceneMode = 301; + setAction(&_sequenceManager1, this, 301, &BF_GLOBALS._player, NULL); + } else { + BF_GLOBALS._player.enableControl(); + } + break; + case 0: + default: + if (_field2762) { + BF_GLOBALS._player.disableControl(); + _sceneMode = 301; + setAction(&_sequenceManager1, this, 301, &BF_GLOBALS._player, NULL); + } else { + BF_GLOBALS._player.enableControl(); + } + break; + } +} + +void Scene300::process(Event &event) { + SceneExt::process(event); + + if (BF_GLOBALS._player._enabled && !_eventHandler && (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); + BF_GLOBALS._events.setCursor(surface); + } else if (_item15.contains(event.mousePos)) { + GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_E); + 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); + } + } +} + +void Scene300::dispatch() { + SceneExt::dispatch(); + + if (!_action) { + int regionIndex = BF_GLOBALS._player.getRegionIndex(); + if ((regionIndex == 1) && (_field2762 == 1)) { + BF_GLOBALS._player.disableControl(); + _sceneMode = 301; + setAction(&_sequenceManager1, this, 301, &BF_GLOBALS._player, NULL); + } + + if ((BF_GLOBALS._player._position.y < 59) && (BF_GLOBALS._player._position.x > 137) && + (_sceneMode != 6308) && (_sceneMode != 7308)) { + BF_GLOBALS._v4CEA4 = 3; + _sceneMode = 6308; + BF_GLOBALS._player.disableControl(); + ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x + 20, + BF_GLOBALS._player._position.y - 5); + } + + if (BF_GLOBALS._player._position.x <= 5) + setAction(&_action2); + + if (BF_GLOBALS._player._position.x >= 315) { + if (BF_GLOBALS.getFlag(onDuty) || (BF_GLOBALS._bookmark == bNone) || !BF_GLOBALS.getFlag(fWithLyle)) { + setAction(&_action1); + } else { + BF_GLOBALS._player.disableControl(); + _sceneMode = 317; + setAction(&_sequenceManager1, this, 1301, &BF_GLOBALS._player, NULL); + } + } + } +} + +void Scene300::setup() { + _object13.postInit(); + _object13.setVisage(307); + _object13.setStrip(6); + _object13.setPosition(Common::Point(156, 134)); + _object13._moveDiff = Common::Point(3, 1); + _object3.setup(&_object13, 306, 1, 29); + + _object14.postInit(); + _object14.setVisage(307); + _object14.setStrip(6); + _object14.setPosition(Common::Point(171, 137)); + _object14._moveDiff = Common::Point(3, 1); + _object4.setup(&_object14, 306, 2, 29); + + _object12.postInit(); + _object12.setVisage(307); + _object12.setStrip(6); + _object12.setPosition(Common::Point(186, 140)); + _object12._moveDiff = Common::Point(3, 1); + _object5.setup(&_object12, 306, 2, 29); + _object12.hide(); + + _object15.postInit(); + _object15.setVisage(307); + _object15.setStrip(6); + _object15.setPosition(Common::Point(201, 142)); + _object15._moveDiff = Common::Point(3, 1); + _object6.setup(&_object15, 306, 3, 29); + + _object16.postInit(); + _object16.setVisage(307); + _object16.setStrip(6); + _object16.setPosition(Common::Point(216, 145)); + _object16._moveDiff = Common::Point(3, 1); + _object7.setup(&_object16, 306, 1, 29); + + _object1.postInit(); + _object1.setVisage(307); + _object1.setStrip(6); + _object1.setPosition(Common::Point(305, 66)); + _object1._moveDiff = Common::Point(3, 1); + _object1.setObjectWrapper(new SceneObjectWrapper()); + _object1.animate(ANIM_MODE_1, NULL); + _object2.setup(&_object1, 306, 4, 9); + + BF_GLOBALS._sceneItems.addItems(&_object13, &_object14, &_object15, &_object16, NULL); + _timer.set(3600, this, &_action5); + + _field2760 = 0; + _field2762 = 1; +} + +/*-------------------------------------------------------------------------- + * Scene 315 - Inside Police Station + * + *--------------------------------------------------------------------------*/ + +bool Scene315::Item1::startAction(CursorType action, Event &event) { + Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; + scene->_currentCursor = action; + + switch (action) { + case CURSOR_USE: + if (scene->_field1B60 || scene->_field1B64) + SceneItem::display2(320, 51); + else + NamedHotspot::startAction(action, event); + break; + case CURSOR_TALK: + if ((BF_GLOBALS._dayNumber == 2) && (BF_GLOBALS._sceneManager._previousScene == 325)) + NamedHotspot::startAction(action, event); + else { + if (!BF_GLOBALS.getFlag(onDuty)) + scene->_stripNumber = 3172; + else if (BF_GLOBALS.getFlag(fTalkedToBarry)) + scene->_stripNumber = 3166; + else if (BF_GLOBALS.getFlag(fTalkedToLarry)) + scene->_stripNumber = 3164; + else + scene->_stripNumber = 3165; + + scene->setAction(&scene->_action1); + BF_GLOBALS.setFlag(fTalkedToBarry); + } + break; + case INV_GREENS_GUN: + case INV_GREENS_KNIFE: + BF_GLOBALS._player.disableControl(); + 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); + } + break; + case INV_FOREST_RAP: + BF_GLOBALS._player.disableControl(); + scene->_stripNumber = BF_GLOBALS.getFlag(onDuty) ? 3178 : 3173; + scene->setAction(&scene->_action1); + break; + case INV_GREEN_ID: + case INV_FRANKIE_ID: + case INV_TYRONE_ID: + BF_GLOBALS._player.disableControl(); + scene->_stripNumber = 3175; + scene->setAction(&scene->_action1); + break; + case INV_BOOKING_GREEN: + case INV_BOOKING_FRANKIE: + case INV_BOOKING_GANG: + BF_GLOBALS._player.disableControl(); + scene->_stripNumber = 3167; + scene->setAction(&scene->_action1); + break; + case INV_COBB_RAP: + if (BF_INVENTORY._mugshot._sceneNumber == 1) + NamedHotspot::startAction(action, event); + else { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 3169; + if (BF_GLOBALS._dayNumber > 2) + scene->_stripNumber = 3176; + else if (BF_GLOBALS.getFlag(onDuty)) + scene->_stripNumber = 3177; + else + scene->_stripNumber = 3170; + scene->setAction(&scene->_action1); + } + break; + case INV_22_BULLET: + case INV_AUTO_RIFLE: + case INV_WIG: + case INV_22_SNUB: + BF_GLOBALS._player.disableControl(); + if ((BF_GLOBALS.getFlag(fCuffedFrankie) && (BF_INVENTORY._bookingFrankie._sceneNumber == 0)) || + (!BF_GLOBALS.getFlag(fCuffedFrankie) && (BF_INVENTORY._bookingGang._sceneNumber == 0))) { + scene->_stripNumber = 3174; + scene->setAction(&scene->_action1); + } else { + if (!scene->_field1B6C & (scene->_field1B66 == 1)) { + scene->_field1B6C = 1; + scene->_stripNumber = 3169; + } else { + scene->_stripNumber = 0; + } + + scene->_sceneMode = 3153; + scene->setAction(&scene->_sequenceManager, scene, 3153, &BF_GLOBALS._player, NULL); + } + break; + default: + return NamedHotspot::startAction(action, event); + } + + return true; +} + +bool Scene315::Item2::startAction(CursorType action, Event &event) { + Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case INV_GREENS_GUN: + case INV_22_BULLET: + case INV_AUTO_RIFLE: + case INV_WIG: + case INV_22_SNUB: + SceneItem::display2(315, 30); + break; + case INV_GREEN_ID: + case INV_FRANKIE_ID: + case INV_TYRONE_ID: + BF_GLOBALS._player.disableControl(); + scene->_stripNumber = 3175; + scene->setAction(&scene->_action1); + break; + case INV_BOOKING_GREEN: + case INV_BOOKING_FRANKIE: + case INV_BOOKING_GANG: + if (action == INV_BOOKING_GREEN) + ++scene->_field1B62; + else + ++scene->_field1B66; + + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 12; + scene->setAction(&scene->_sequenceManager, scene, 3154, &BF_GLOBALS._player, NULL); + break; + default: + return NamedHotspot::startAction(action, event); + } + + return true; +} + +bool Scene315::Item4::startAction(CursorType action, Event &event) { + Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; + + if (action == CURSOR_LOOK) { + BF_GLOBALS._player.disableControl(); + BF_GLOBALS._player.addMover(NULL); + scene->_object9.postInit(); + scene->_object9.hide(); + scene->_sceneMode = 3167; + scene->setAction(&scene->_sequenceManager, scene, 3167, &scene->_object9, this, NULL); + return true; + } else { + return NamedHotspot::startAction(action, event); + } +} + +bool Scene315::Item5::startAction(CursorType action, Event &event) { + Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; + + if (action == CURSOR_LOOK) { + BF_GLOBALS._player.addMover(NULL); + scene->_stripManager.start(3154, &BF_GLOBALS._stripProxy); + return true; + } else { + return NamedHotspot::startAction(action, event); + } +} + +bool Scene315::Item14::startAction(CursorType action, Event &event) { + Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; + + if ((action == INV_COLT45) && BF_GLOBALS.getFlag(onDuty)) { + if (!BF_GLOBALS.getFlag(onDuty)) + SceneItem::display2(315, 27); + else if (BF_GLOBALS.getHasBullets()) { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 3162; + scene->setAction(&scene->_sequenceManager, scene, 3162, &BF_GLOBALS._player, NULL); + } else if (BF_GLOBALS.getFlag(fGunLoaded)) + SceneItem::display2(315, 46); + else { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 3159; + scene->setAction(&scene->_sequenceManager, scene, 3159, &BF_GLOBALS._player, NULL); + } + return true; + } else { + return NamedHotspot::startAction(action, event); + } +} + +bool Scene315::Item15::startAction(CursorType action, Event &event) { + Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; + + if (action != CURSOR_USE) + return NamedHotspot::startAction(action, event); + else if (BF_INVENTORY._forestRap._sceneNumber == 1) { + SceneItem::display2(315, 37); + return true; + } else { + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 3158; + scene->setAction(&scene->_sequenceManager, scene, 3158, &BF_GLOBALS._player, NULL); + return true; + } +} + +bool Scene315::Item16::startAction(CursorType action, Event &event) { + ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 190, 75); + return true; +} + +bool Scene315::Item17::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) { + Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + scene->_stripManager.start(3157, &BF_GLOBALS._stripProxy); + return true; + case CURSOR_USE: + if (!BF_GLOBALS.getFlag(fGotPointsForCleaningGun)) { + BF_GLOBALS._uiElements.addScore(10); + BF_GLOBALS.setFlag(fGotPointsForCleaningGun); + } + BF_GLOBALS._player.addMover(NULL); + scene->_stripManager.start(3159, &BF_GLOBALS._stripProxy); + return true; + default: + return NamedObject::startAction(action, event); + break; + } +} + +bool Scene315::Object2::startAction(CursorType action, Event &event) { + Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + BF_GLOBALS._player.disableControl(); + scene->_object9.postInit(); + scene->_object9.hide(); + scene->_sceneMode = 3157; + scene->setAction(&scene->_sequenceManager, scene, 3157, &BF_GLOBALS._player, &scene->_object9, NULL); + return true; + case CURSOR_USE: + BF_GLOBALS._player.disableControl(); + scene->_sceneMode = 3156; + scene->setAction(&scene->_sequenceManager, scene, BF_GLOBALS.getFlag(onDuty) ? 3156 : 3168, + &BF_GLOBALS._player, this, NULL); + return true; + default: + return NamedObject::startAction(action, event); + } +} + +bool Scene315::Object3::startAction(CursorType action, Event &event) { + Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; + + switch (action) { + case CURSOR_LOOK: + BF_GLOBALS._player.addMover(NULL); + scene->_stripManager.start(3156, &BF_GLOBALS._stripProxy); + return true; + case CURSOR_USE: + if (!BF_GLOBALS.getFlag(fGotPointsForMemo)) { + BF_GLOBALS._uiElements.addScore(30); + BF_GLOBALS.setFlag(fGotPointsForMemo); + } + + BF_GLOBALS._player.addMover(NULL); + scene->_stripManager.start(3158, &BF_GLOBALS._stripProxy); + return true; + default: + return NamedObject::startAction(action, event); + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene315::Action1::signal() { + Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.disableControl(); + ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, 128, 128); + break; + case 1: + BF_GLOBALS._player.changeAngle(315); + setDelay(2); + break; + case 2: + scene->_stripManager.start(scene->_stripNumber, this); + break; + case 3: + if (scene->_sceneMode == 3169) { + BF_GLOBALS._uiElements.addScore(30); + BF_INVENTORY.setObjectScene(INV_MUG_SHOT, 1); + } + + remove(); + BF_GLOBALS._player.enableControl(); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +Scene315::Scene315() { + BF_GLOBALS._v51C44 = 1; + _field1B6C = _field139C = 0; + if (BF_GLOBALS._dayNumber == 0) + BF_GLOBALS._dayNumber = 1; + + BF_GLOBALS.clearFlag(fCanDrawGun); + _field1B68 = true; + _field1B6A = false; + _field1B60 = _field1B62 = 0; + _field1B64 = _field1B66 = 0; +} + +void Scene315::synchronize(Serializer &s) { + SceneExt::synchronize(s); + + s.syncAsSint16LE(_field1390); + s.syncAsSint16LE(_stripNumber); + s.syncAsSint16LE(_field1398); + s.syncAsSint16LE(_field1B60); + s.syncAsSint16LE(_field1B62); + s.syncAsSint16LE(_field1B64); + s.syncAsSint16LE(_field1B66); + s.syncAsSint16LE(_field1B6C); + s.syncAsSint16LE(_field139C); + s.syncAsByte(_field1B68); + s.syncAsByte(_field1B6A); + s.syncAsSint16LE(_currentCursor); +} + +void Scene315::postInit(SceneObjectList *OwnerList) { + loadScene(315); + + if (BF_GLOBALS._sceneManager._previousScene != 325) + BF_GLOBALS._sound1.fadeSound(11); + + setZoomPercents(67, 72, 124, 100); + + _stripManager.addSpeaker(&_gameTextSpeaker); + _stripManager.addSpeaker(&_sutterSpeaker); + _stripManager.addSpeaker(&_harrisonSpeaker); + _stripManager.addSpeaker(&_jakeJacketSpeaker); + _stripManager.addSpeaker(&_jakeUniformSpeaker); + _stripManager.addSpeaker(&_jailerSpeaker); + + _object8.postInit(); + _object8.setVisage(315); + _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); + } + + 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); + } + } else if ((BF_INVENTORY._daNote._sceneNumber != 1) && (BF_GLOBALS._dayNumber < 3)) { + _object2.postInit(); + _object2.setVisage(315); + _object2.setStrip(3); + _object2.setFrame(2); + _object2.setPosition(Common::Point(304, 31)); + _object2.fixPriority(70); + _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); + _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); + + 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(); + + if ((BF_GLOBALS._dayNumber != 2) || (BF_GLOBALS._sceneManager._previousScene != 325)) { + _object4.postInit(); + _object4.setVisage(316); + _object4.setPosition(Common::Point(99, 82)); + _object4.fixPriority(95); + + _object5.postInit(); + _object5.setVisage(395); + _object5.setStrip(2); + _object5.setPosition(Common::Point(96, 86)); + } + + // Set up evidence objects in inventory + if (BF_INVENTORY._bookingGreen.inInventory()) + ++_field1B60; + if (BF_INVENTORY._greensGun.inInventory()) + ++_field1B60; + if (BF_INVENTORY._greensKnife.inInventory()) + ++_field1B60; + + if (BF_INVENTORY._bullet22.inInventory()) + ++_field1B64; + if (BF_INVENTORY._autoRifle.inInventory()) + ++_field1B64; + if (BF_INVENTORY._wig.inInventory()) + ++_field1B64; + if (BF_INVENTORY._bookingFrankie.inInventory()) + ++_field1B64; + if (BF_INVENTORY._bookingGang.inInventory()) + ++_field1B64; + if (BF_INVENTORY._snub22.inInventory()) + ++_field1B64; + + switch (BF_GLOBALS._sceneManager._previousScene) { + case 190: + if (_field1398) + _field1B6A = true; + _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 3150 : 3165; + setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, NULL); + break; + case 325: + BF_GLOBALS._uiElements._active = false; + _object6.postInit(); + _object7.postInit(); + _object8.setFrame(8); + _sceneMode = (BF_GLOBALS._dayNumber == 1) ? 3152 : 3155; + setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, &_object6, + &_object7, &_object8, NULL); + break; + case 300: + default: + if (_field1398) + _field1B6A = true; + if (!BF_GLOBALS.getFlag(onDuty)) + _sceneMode = 3166; + else if (!_field1398) + _sceneMode = 3164; + else + _sceneMode = 3163; + + setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, NULL); + break; + } + + if (_field1B6A) { + _object8.setFrame(8); + } else { + BF_GLOBALS._walkRegions.proc1(4); + } + + _item15.setDetails(24, 315, 38, 39, 40, 1); + _item14.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); + _item11.setDetails(9, 315, 14, -1, -1, 1); + _item8.setDetails(7, 315, 15, 16, 17, 1); + _item9.setDetails(10, 315, 18, 19, 20, 1); +} + +void Scene315::signal() { + int ctr = 0; + + switch (_sceneMode) { + case 0: + BF_GLOBALS._player.enableControl(); + break; + case 10: + if (_field1B62) { + if (_field1B62 >= _field1B60) + BF_GLOBALS.setFlag(fLeftTraceIn910); + else + ++ctr; + } + + if (_field1B66) { + if (_field1B66 < _field1B64) + ++ctr; + else if (BF_GLOBALS._bookmark < bBookedFrankieEvidence) + BF_GLOBALS._bookmark = bBookedFrankieEvidence; + } + + if (ctr) { + BF_GLOBALS._deathReason = 20; + BF_GLOBALS._sceneManager.changeScene(666); + } else { + BF_GLOBALS._sceneManager.changeScene(300); + } + BF_GLOBALS._sound1.fadeOut2(NULL); + break; + case 11: + if (_field1B62) { + if (_field1B62 >= _field1B60) + BF_GLOBALS.setFlag(fLeftTraceIn910); + else + ++ctr; + } + + if (_field1B66) { + if (_field1B66 < _field1B64) + ++ctr; + else if (BF_GLOBALS._bookmark < bBookedFrankie) + BF_GLOBALS._bookmark = bBookedFrankie; + else if (BF_GLOBALS._bookmark < bBookedFrankieEvidence) + BF_GLOBALS._bookmark = bBookedFrankie; + } + + if (ctr == 1) { + BF_GLOBALS._deathReason = 20; + BF_GLOBALS._sound1.fadeOut2(NULL); + } else if ((BF_GLOBALS._bookmark != bBookedFrankie) || !BF_GLOBALS.getFlag(onDuty)) { + BF_GLOBALS._sound1.fadeOut2(NULL); + BF_GLOBALS._sceneManager.changeScene(190); + } else { + BF_GLOBALS._bookmark = bBookedFrankieEvidence; + _field139C = 0; + BF_GLOBALS.clearFlag(onDuty); + BF_INVENTORY.setObjectScene(INV_TICKET_BOOK, 60); + BF_INVENTORY.setObjectScene(INV_MIRANDA_CARD, 60); + _sceneMode = 3165; + setAction(&_sequenceManager, this, 3165, &BF_GLOBALS._player, NULL); + } + break; + case 12: + BF_GLOBALS._uiElements.addScore(30); + BF_INVENTORY.setObjectScene((int)_currentCursor, 315); + + if (!_field1B64 || (_field1B66 != _field1B64)) + BF_GLOBALS._player.enableControl(); + else { + _field139C = 1; + _stripNumber = 3171; + setAction(&_action1); + } + break; + case 3150: + case 3164: + case 3165: + case 3166: + BF_GLOBALS._player.enableControl(); + _field1B68 = false; + break; + case 3151: + BF_GLOBALS._sceneManager.changeScene(325); + break; + case 3152: + BF_GLOBALS._walkRegions.proc1(4); + _object7.remove(); + _object6.remove(); + + BF_GLOBALS._player.enableControl(); + _field1B68 = false; + BF_GLOBALS._walkRegions.proc1(4); + BF_GLOBALS._uiElements._active = true; + BF_GLOBALS._uiElements.show(); + break; + case 3153: + BF_GLOBALS._uiElements.addScore(30); + BF_INVENTORY.setObjectScene((int)_currentCursor, 315); + + if (_stripNumber != 0) + setAction(&_action1); + else if (!_field1B64 || (_field1B66 != _field1B64)) + BF_GLOBALS._player.enableControl(); + else { + _stripNumber = 3171; + setAction(&_action1); + _field139C = 1; + } + break; + case 3155: + BF_GLOBALS._player.enableControl(); + _field1B68 = false; + BF_GLOBALS._walkRegions.proc1(4); + BF_GLOBALS._uiElements._active = true; + BF_GLOBALS._uiElements.show(); + break; + case 3156: + BF_GLOBALS._uiElements.addScore(10); + BF_INVENTORY.setObjectScene(INV_DA_NOTE, 1); + _object2.remove(); + BF_GLOBALS._player.enableControl(); + break; + case 3157: + BF_GLOBALS._player.enableControl(); + _object9.remove(); + break; + case 3158: + BF_GLOBALS._player.enableControl(); + BF_GLOBALS._uiElements.addScore(10); + BF_INVENTORY.setObjectScene(INV_FOREST_RAP, 1); + break; + case 3159: + if (!BF_GLOBALS.getFlag(fBookedGreenEvidence)) { + BF_GLOBALS._uiElements.addScore(30); + BF_GLOBALS.setFlag(fBookedGreenEvidence); + } + BF_GLOBALS.setFlag(gunClean); + BF_GLOBALS._player.enableControl(); + break; + case 3161: + BF_GLOBALS._deathReason = 21; + BF_GLOBALS._sound1.fadeOut2(NULL); + BF_GLOBALS._sceneManager.changeScene(666); + break; + case 3162: + BF_GLOBALS._player.disableControl(); + _sceneMode = 3161; + setAction(&_sequenceManager, this, 3161, &BF_GLOBALS._player, NULL); + BF_GLOBALS.setFlag(fShotSuttersDesk); + break; + case 3163: + _sceneMode = 3150; + setAction(&_sequenceManager, this, 3150, &BF_GLOBALS._player, NULL); + break; + case 3167: + BF_GLOBALS._player.enableControl(); + _object9.remove(); + break; + case 3154: + default: + break; + } +} + +void Scene315::process(Event &event) { + SceneExt::process(event); + + if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { + // Check if the cursor is on an exit + if (_item17.contains(event.mousePos)) { + GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW); + BF_GLOBALS._events.setCursor(surface); + } else if ((BF_GLOBALS._bookmark != bBookedFrankie) && _item16.contains(event.mousePos)) { + GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_W); + 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); + } + } +} + +void Scene315::dispatch() { + SceneExt::dispatch(); + + if (_field1B68) + return; + + if (_field1B6A) { + if (BF_GLOBALS._player._position.y < 69) { + BF_GLOBALS._player.disableControl(); + _field1B68 = true; + _sceneMode = 3151; + setAction(&_sequenceManager, this, 3151, &BF_GLOBALS._player, NULL); + } else if (BF_GLOBALS._player.getRegionIndex() == 1) { + BF_GLOBALS._player.disableControl(); + _field1B68 = true; + SceneItem::display2(315, 28); + _sceneMode = 3150; + 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(); + _field1B68 = true; + SceneItem::display2(315, 28); + _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; + _sceneMode = 11; + ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x - 30, + BF_GLOBALS._player._position.y - 5); + } else if (BF_GLOBALS._player._position.y > 156) { + BF_GLOBALS._player.disableControl(); + _field1B68 = true; + + if (_field139C) { + SceneItem::display2(315, 45); + _sceneMode = 3150; + ADD_MOVER(BF_GLOBALS._player, 112, 152); + } else { + _sceneMode = 10; + ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x - 150, + BF_GLOBALS._player._position.y + 120); + } + } +} + +/*-------------------------------------------------------------------------- + * Scene 325 - Police Station Conference Room + * + *--------------------------------------------------------------------------*/ + +bool Scene325::Item1::startAction(CursorType action, Event &event) { + if (action == CURSOR_EXIT) { + BF_GLOBALS._events.setCursor(CURSOR_WALK); + BF_GLOBALS._player.disableControl(); + BF_GLOBALS._sceneManager.changeScene(315); + return true; + } else { + return false; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene325::postInit(SceneObjectList *OwnerList) { + SceneExt::postInit(); + loadScene(325); + BF_GLOBALS._interfaceY = 200; + BF_GLOBALS.clearFlag(fCanDrawGun); + + if (BF_GLOBALS._dayNumber == 0) + BF_GLOBALS._dayNumber = 1; + + // Add the speakers + _stripManager.addSpeaker(&_gameTextSpeaker); + _stripManager.addSpeaker(&_PSutterSpeaker); + + BF_GLOBALS._player.postInit(); + BF_GLOBALS._player.hide(); + + if (BF_GLOBALS._dayNumber == 1) { + _object1.postInit(); + _object1.setVisage(325); + _object1.setStrip(8); + _object1.setPosition(Common::Point(128, 44)); + } else { + _object1.postInit(); + _object1.setVisage(325); + _object1.setStrip(8); + _object1.setFrame(2); + _object1.setPosition(Common::Point(132, 28)); + + _object2.postInit(); + _object2.setVisage(325); + _object2.setStrip(8); + _object2.setFrame(3); + _object2.setPosition(Common::Point(270, 24)); + } + + _object3.postInit(); + _object3.setVisage(335); + _object3.setStrip(4); + _object3.setPosition(Common::Point(202, 122)); + + _object4.postInit(); + _object4.setVisage(335); + _object4.setStrip(2); + _object4.setPosition(Common::Point(283, 102)); + + _object5.postInit(); + _object5.setVisage(335); + _object5.setStrip(1); + _object5.setPosition(Common::Point(135, 167)); + + _item1.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 560, -1, -1, -1, 1, NULL); + BF_GLOBALS._player.disableControl(); + + _sceneMode = (BF_GLOBALS._dayNumber == 1) ? 3250 : 3251; + setAction(&_sequenceManager, this, _sceneMode, &_object3, &_object4, &_object5, NULL); +} + +void Scene325::signal() { + BF_GLOBALS._player._uiEnabled = 0; + BF_GLOBALS._player._canWalk = true; + BF_GLOBALS._player._enabled = true; + BF_GLOBALS._events.setCursor(CURSOR_EXIT); +} + +} // End of namespace BlueForce + +} // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_scenes3.h b/engines/tsage/blue_force/blueforce_scenes3.h new file mode 100644 index 0000000000..18911d58fb --- /dev/null +++ b/engines/tsage/blue_force/blueforce_scenes3.h @@ -0,0 +1,250 @@ +/* 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_SCENES3_H +#define TSAGE_BLUEFORCE_SCENES3_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 Scene300: public SceneExt { + /* Objects */ + class Object: public NamedObject { + public: + int _stripNumber; + public: + Object(int stripNumber) { _stripNumber = stripNumber; } + + virtual bool startAction(CursorType action, Event &event); + }; + class Object19: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Items */ + class Item1: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item2: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item14: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item15: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* 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(); + }; +private: + void setup(); +public: + SequenceManager _sequenceManager1, _sequenceManager2; + SequenceManager _sequenceManager3, _sequenceManager4; + NamedObject _object1; + FollowerObject _object2, _object3, _object4, _object5, _object6, _object7; + SceneObject _object8, _object9, _object10; + NamedObject _object11, _object12; + Object _object13, _object14, _object15, _object16; + NamedObject _object17, _object18; + Object19 _object19; + Item1 _item1; + Item2 _item2; + NamedHotspot _item3, _item4, _item5, _item6, _item7; + NamedHotspot _item8, _item9, _item10, _item11; + NamedHotspot _item12, _item13; + Item14 _item14; + Item15 _item15; + Action1 _action1; + Action2 _action2; + Action3 _action3; + Action4 _action4; + Action5 _action5; + SpeakerGameText _gameTextSpeaker; + SpeakerSutter _sutterSpeaker; + SpeakerDoug _dougSpeaker; + SpeakerJakeNoHead _jakeSpeaker; + TimerExt _timer; + int _field2760, _field2762; + + Scene300(); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); +}; + +class Scene315: 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); + }; + class Object3: public NamedObject { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Items */ + class Item1: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item2: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item4: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item5: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item14: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item15: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item16: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + class Item17: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; + + /* Actions */ + class Action1: public Action { + public: + virtual void signal(); + }; +public: + SequenceManager _sequenceManager; + SpeakerGameText _gameTextSpeaker; + SpeakerSutter _sutterSpeaker; + SpeakerHarrison _harrisonSpeaker; + SpeakerJakeJacket _jakeJacketSpeaker; + SpeakerJakeUniform _jakeUniformSpeaker; + SpeakerJailer _jailerSpeaker; + Item1 _item1; + Item2 _item2; + NamedHotspot _item3; + Item4 _item4; + Item5 _item5; + Object1 _object1; + Object2 _object2; + Object3 _object3; + 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; + Action1 _action1; + int _field1390; + int _stripNumber; + int _field1398; + int _field1B60, _field1B62, _field1B64; + int _field1B66, _field1B6C, _field139C; + bool _field1B68, _field1B6A; + CursorType _currentCursor; + + Scene315(); + virtual void synchronize(Serializer &s); + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); + virtual void process(Event &event); + virtual void dispatch(); +}; + +class Scene325: public SceneExt { + /* Items */ + class Item1: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + SequenceManager _sequenceManager; + SpeakerGameText _gameTextSpeaker; + SpeakerPSutter _PSutterSpeaker; + Item1 _item1; + NamedObject _object1, _object2, _object3, _object4, _object5; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void signal(); +}; + +} // 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 new file mode 100644 index 0000000000..e150a6e5b7 --- /dev/null +++ b/engines/tsage/blue_force/blueforce_scenes6.cpp @@ -0,0 +1,168 @@ +/* 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_scenes6.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 666 - Death Scene + * + *--------------------------------------------------------------------------*/ + +void Scene666::Action1::signal() { + switch (_actionIndex++) { + case 0: + BF_GLOBALS._player.hide(); + setDelay(6); + break; + case 1: + BF_GLOBALS._game->restartGame(); + break; + } +} + +/*--------------------------------------------------------------------------*/ + +bool Scene666::Item1::startAction(CursorType action, Event &event) { + return true; +} + +/*--------------------------------------------------------------------------*/ + +void Scene666::postInit(SceneObjectList *OwnerList) { + BF_GLOBALS._sound1.play(27); + SceneExt::postInit(); + BF_GLOBALS._interfaceY = 200; + loadScene(999); + BF_GLOBALS._screenSurface.fillRect(BF_GLOBALS._screenSurface.getBounds(), 0); + + if (BF_GLOBALS._dayNumber == 0) { + BF_GLOBALS._dayNumber = 1; + BF_GLOBALS._deathReason = BF_GLOBALS._randomSource.getRandomNumber(23); + } + + BF_GLOBALS._scenePalette.loadPalette(BF_GLOBALS._sceneManager._previousScene); + BF_GLOBALS._uiElements._active = false; + + _item1.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 666, -1, -1, -1, 1, NULL); + BF_GLOBALS._player.postInit(); + BF_GLOBALS._events.setCursor(CURSOR_WALK); + + if (BF_GLOBALS._sceneManager._previousScene == 271) { + setAction(&_action1); + } else { + switch (BF_GLOBALS._deathReason) { + case 4: + case 18: + case 19: + case 20: + BF_GLOBALS._scenePalette.loadPalette(668); + BF_GLOBALS._player.setVisage(668); + BF_GLOBALS._player.setStrip2(1); + BF_GLOBALS._player.setPosition(Common::Point(77, 155)); + BF_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + case 5: + BF_GLOBALS._scenePalette.loadPalette(900); + BF_GLOBALS._scenePalette.refresh(); + BF_GLOBALS._player.setVisage(666); + BF_GLOBALS._player.setPosition(Common::Point(60, 160)); + signal(); + break; + case 7: + case 11: + case 12: + case 22: + BF_GLOBALS._scenePalette.loadPalette(667); + BF_GLOBALS._scenePalette.refresh(); + + _object1.postInit(); + _object2.postInit(); + _object3.postInit(); + setAction(&_sequenceManager, this, 6660, &BF_GLOBALS._player, &_object1, &_object2, + &_object3, NULL); + break; + case 13: + case 14: + BF_GLOBALS._scenePalette.loadPalette(665); + BF_GLOBALS._scenePalette.refresh(); + BF_GLOBALS._player.setVisage(665); + BF_GLOBALS._player.setPosition(Common::Point(80, 140)); + signal(); + break; + case 24: + BF_GLOBALS._player.setVisage(664); + BF_GLOBALS._player.setPosition(Common::Point(70, 160)); + signal(); + break; + default: + BF_GLOBALS._scenePalette.loadPalette(669); + BF_GLOBALS._scenePalette.refresh(); + BF_GLOBALS._player.setVisage(669); + BF_GLOBALS._player.setStrip(1); + BF_GLOBALS._player.setPosition(Common::Point(27, 27)); + BF_GLOBALS._player.animate(ANIM_MODE_5, this); + break; + } + } +} + +void Scene666::remove() { + BF_GLOBALS._sound1.fadeOut2(NULL); + BF_GLOBALS._scrollFollower = &BF_GLOBALS._player; + SceneExt::remove(); + BF_GLOBALS._uiElements._active = true; +} + +void Scene666::signal() { + BF_GLOBALS._player.enableControl(); + Rect textRect, sceneBounds; + + _text._color1 = 19; + _text._color2 = 9; + _text._color3 = 13; + _text._fontNumber = 4; + _text._width = 150; + + Common::String msg = _resourceManager->getMessage(666, BF_GLOBALS._deathReason); + sceneBounds = BF_GLOBALS._sceneManager._scene->_sceneBounds; + sceneBounds.collapse(4, 2); + BF_GLOBALS.gfxManager()._font.getStringBounds(msg.c_str(), textRect, _text._width); + textRect.moveTo(160, 10); + textRect.contain(sceneBounds); + + _text.setup(msg); + _text.setPosition(Common::Point(textRect.left, textRect.top)); + _text.setPriority(255); + _text.show(); +} + +} // 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 new file mode 100644 index 0000000000..b7449c5e30 --- /dev/null +++ b/engines/tsage/blue_force/blueforce_scenes6.h @@ -0,0 +1,70 @@ +/* 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_SCENES6_H +#define TSAGE_BLUEFORCE_SCENES6_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 Scene666 : public SceneExt { + /* Actions */ + class Action1 : public Action { + public: + virtual void signal(); + }; + + /* Items */ + class Item1: public NamedHotspot { + public: + virtual bool startAction(CursorType action, Event &event); + }; +public: + Action1 _action1; + SequenceManager _sequenceManager; + NamedObject _object1, _object2, _object3; + Item1 _item1; + SceneText _text; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); +}; + +} // 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 new file mode 100644 index 0000000000..dc2511dedb --- /dev/null +++ b/engines/tsage/blue_force/blueforce_speakers.cpp @@ -0,0 +1,320 @@ +/* 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_speakers.h" +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/graphics.h" +#include "tsage/staticres.h" + +namespace TsAGE { + +namespace BlueForce { + +VisualSpeaker::VisualSpeaker(): Speaker() { + _textWidth = 312; + _color1 = 19; + _hideObjects = false; + _removeObject1 = false; + _removeObject2 = false; + _xp = 160; + _fontNumber = 4; + _color2 = 82; + _offsetPos = Common::Point(4, 170); + _numFrames = 0; +} + +void VisualSpeaker::remove() { + if (_removeObject2) + _object2.remove(); + if (_removeObject1) + _object1.remove(); + + Speaker::remove(); +} + +void VisualSpeaker::synchronize(Serializer &s) { + Speaker::synchronize(s); + + s.syncAsByte(_removeObject1); + s.syncAsByte(_removeObject2); + s.syncAsSint16LE(_xp); + s.syncAsSint16LE(_numFrames); + s.syncAsSint16LE(_offsetPos.x); + s.syncAsSint16LE(_offsetPos.y); +} + +void VisualSpeaker::proc12(Action *action) { + Speaker::proc12(action); + _textPos = Common::Point(_offsetPos.x + BF_GLOBALS._sceneManager._scene->_sceneBounds.left, + _offsetPos.y + BF_GLOBALS._sceneManager._scene->_sceneBounds.top); + _numFrames = 0; +} + +void VisualSpeaker::setText(const Common::String &msg) { + _objectList.draw(); + BF_GLOBALS._sceneObjects->draw(); + + _sceneText._color1 = _color1; + _sceneText._color2 = _color2; + _sceneText._color3 = _color3; + _sceneText._width = _textWidth; + _sceneText._fontNumber = _fontNumber; + _sceneText._textMode = _textMode; + _sceneText.setup(msg); + + // Get the string bounds + GfxFont f; + f.setFontNumber(_fontNumber); + Rect bounds; + f.getStringBounds(msg.c_str(), bounds, _textWidth); + + // Set the position for the text + switch (_textMode) { + case ALIGN_LEFT: + case ALIGN_JUSTIFIED: + _sceneText.setPosition(_textPos); + break; + case ALIGN_CENTER: + _sceneText.setPosition(Common::Point(_textPos.x + (_textWidth - bounds.width()) / 2, _textPos.y)); + break; + case ALIGN_RIGHT: + _sceneText.setPosition(Common::Point(_textPos.x + _textWidth - bounds.width(), _textPos.y)); + break; + default: + break; + } + + // Ensure the text is in the foreground + _sceneText.fixPriority(256); + + // Count the number of words (by spaces) in the string + const char *s = msg.c_str(); + int spaceCount = 0; + while (*s) { + if (*s++ == ' ') + ++spaceCount; + } + + _numFrames = spaceCount * 3 + 2; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerGameText::SpeakerGameText(): VisualSpeaker() { + _speakerName = "GAMETEXT"; + _color1 = 8; + _color2 = 19; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerSutter::SpeakerSutter() { + _speakerName = "SUTTER"; + _color1 = 20; + _color2 = 22; + _textMode = ALIGN_CENTER; +} + +void SpeakerSutter::setText(const Common::String &msg) { + _removeObject1 = _removeObject2 = true; + + _object1.postInit(); + _object1.setVisage(329); + _object1.setStrip2(2); + _object1.fixPriority(254); + _object1.changeZoom(100); + _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 45, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + _object2.postInit(); + _object2.setVisage(329); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 45, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + VisualSpeaker::setText(msg); + _object2.fixCountdown(8, _numFrames); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerDoug::SpeakerDoug(): VisualSpeaker() { + _color1 = 32; + _speakerName = "DOUG"; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerJakeNoHead::SpeakerJakeNoHead(): VisualSpeaker() { + _color1 = 13; + _speakerName = "JAKE_NO_HEAD"; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerHarrison::SpeakerHarrison(): VisualSpeaker() { + _color1 = 32; + _speakerName = "HARRISON"; +} + +void SpeakerHarrison::setText(const Common::String &msg) { + _removeObject1 = _removeObject2 = true; + + _object1.postInit(); + _object1.setVisage(325); + _object1.setStrip2(7); + _object1.fixPriority(254); + _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 277, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + _object2.postInit(); + _object2.fixPriority(255); + _object2.setVisage(325); + _object2.setStrip2(6); + _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 277, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + VisualSpeaker::setText(msg); + _object2.fixCountdown(8, _numFrames); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerJakeJacket::SpeakerJakeJacket(): VisualSpeaker() { + _color1 = 13; + _color2 = 7; + _speakerName = "JAKEJACKET"; +} + +void SpeakerJakeJacket::setText(const Common::String &msg) { + _removeObject1 = _removeObject2 = true; + + _object1.postInit(); + _object1.setVisage(1001); + _object1.setStrip2(4); + _object1.fixPriority(254); + _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + _xp, + 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 + _xp, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + VisualSpeaker::setText(msg); + _object2.fixCountdown(8, _numFrames); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerJakeUniform::SpeakerJakeUniform(): VisualSpeaker() { + _color1 = 13; + _color2 = 7; + _speakerName = "JAKEUNIFORM"; +} + +void SpeakerJakeUniform::setText(const Common::String &msg) { + _removeObject1 = _removeObject2 = true; + + _object1.postInit(); + _object1.setVisage(1001); + _object1.setStrip2(3); + _object1.fixPriority(254); + _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 45, + 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 + 45, + BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166)); + + VisualSpeaker::setText(msg); + _object2.fixCountdown(8, _numFrames); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerJailer::SpeakerJailer(): VisualSpeaker() { + _color1 = 13; + _color2 = 7; + _speakerName = "JAILER"; +} + +void SpeakerJailer::setText(const Common::String &msg) { + _removeObject1 = _removeObject2 = true; + + _object1.postInit(); + _object1.setVisage(395); + _object1.setStrip(6); + _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(395); + _object2.setStrip(5); + _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); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerPSutter::SpeakerPSutter(): VisualSpeaker() { + _color1 = 20; + _color2 = 22; + _speakerName = "PSUTTER"; +} + +void SpeakerPSutter::setText(const Common::String &msg) { + _removeObject2 = true; + + _object2.postInit(); + _object2.setVisage(335); + _object2.setStrip2(3); + _object2.fixPriority(200); + _object2.setPosition(Common::Point(202, 48)); + + VisualSpeaker::setText(msg); + _object2.fixCountdown(8, _numFrames); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerJakeRadio::SpeakerJakeRadio(): VisualSpeaker() { + _color1 = 13; + _color2 = 7; + _speakerName = "JAKE_RADIO"; +} + +} // 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 new file mode 100644 index 0000000000..c05938506a --- /dev/null +++ b/engines/tsage/blue_force/blueforce_speakers.h @@ -0,0 +1,139 @@ +/* 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_SPEAKERS_H +#define TSAGE_BLUEFORCE_SPEAKERS_H + +#include "common/scummsys.h" +#include "tsage/converse.h" +#include "tsage/events.h" +#include "tsage/core.h" +#include "tsage/scenes.h" +#include "tsage/globals.h" +#include "tsage/blue_force/blueforce_logic.h" + +namespace TsAGE { + +namespace BlueForce { + +using namespace TsAGE; + +class VisualSpeaker: public Speaker { +public: + NamedObject _object1; + CountdownObject _object2; + bool _removeObject1, _removeObject2; + int _xp; + int _numFrames; + Common::Point _offsetPos; +public: + VisualSpeaker(); + + virtual Common::String getClassName() { return "VisualSpeaker"; } + virtual void synchronize(Serializer &s); + virtual void remove(); + virtual void proc12(Action *action); + virtual void setText(const Common::String &msg); +}; + +class SpeakerGameText: public VisualSpeaker { +public: + SpeakerGameText(); + + virtual Common::String getClassName() { return "SpeakerGameText"; } +}; + +class SpeakerSutter: public VisualSpeaker { +public: + SpeakerSutter(); + + virtual Common::String getClassName() { return "SpeakerSutter"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerDoug: public VisualSpeaker { +public: + SpeakerDoug(); + + virtual Common::String getClassName() { return "SpeakerDoug"; } +}; + +class SpeakerJakeNoHead: public VisualSpeaker { +public: + SpeakerJakeNoHead(); + + virtual Common::String getClassName() { return "SpeakerJakeNoHead"; } +}; + +class SpeakerHarrison: public VisualSpeaker { +public: + SpeakerHarrison(); + + virtual Common::String getClassName() { return "SpeakerHarrison"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerJakeJacket: public VisualSpeaker { +public: + SpeakerJakeJacket(); + + virtual Common::String getClassName() { return "SpeakerJakeJacket"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerJakeUniform: public VisualSpeaker { +public: + SpeakerJakeUniform(); + + virtual Common::String getClassName() { return "SpeakerJakeUniform"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerJailer: public VisualSpeaker { +public: + SpeakerJailer(); + + virtual Common::String getClassName() { return "SpeakerJailer"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerPSutter: public VisualSpeaker { +public: + SpeakerPSutter(); + + virtual Common::String getClassName() { return "SpeakerPSutter"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerJakeRadio: public VisualSpeaker { +public: + SpeakerJakeRadio(); + + virtual Common::String getClassName() { return "SpeakerJakeRadio"; } +}; + + +} // End of namespace BlueForce + +} // End of namespace TsAGE + +#endif diff --git a/engines/tsage/blue_force/blueforce_ui.cpp b/engines/tsage/blue_force/blueforce_ui.cpp new file mode 100644 index 0000000000..8f40d2b565 --- /dev/null +++ b/engines/tsage/blue_force/blueforce_ui.cpp @@ -0,0 +1,476 @@ +/* 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_ui.h" +#include "tsage/blue_force/blueforce_dialogs.h" +#include "tsage/blue_force/blueforce_logic.h" +#include "tsage/tsage.h" +#include "tsage/core.h" + +namespace TsAGE { + +namespace BlueForce { + +void StripProxy::process(Event &event) { + if (_action) + _action->process(event); +} + +/*--------------------------------------------------------------------------*/ + +void UIElement::synchronize(Serializer &s) { + AltSceneObject::synchronize(s); + s.syncAsSint16LE(_field88); + s.syncAsSint16LE(_enabled); + s.syncAsSint16LE(_frameNum); +} + +void UIElement::setup(int visage, int stripNum, int frameNum, int posX, int posY, int priority) { + _field88 = 0; + _frameNum = frameNum; + _enabled = true; + + SceneObject::setup(visage, stripNum, frameNum, posX, posY, priority); +} + +void UIElement::setEnabled(bool flag) { + if (_enabled != flag) { + _enabled = flag; + setFrame(_enabled ? _frameNum : _frameNum + 2); + } +} + +/*--------------------------------------------------------------------------*/ + +void UIQuestion::process(Event &event) { + if (event.eventType == EVENT_BUTTON_DOWN) { + CursorType currentCursor = GLOBALS._events.getCursor(); + GLOBALS._events.hideCursor(); + showDescription(currentCursor); + + event.handled = true; + } +} + +void UIQuestion::showDescription(CursorType cursor) { + if (cursor == INV_FOREST_RAP) { + // Forest rap item has a graphical display + showItem(5, 1, 1); + } else { + // Display object description + SceneItem::display2(9001, (int)cursor); + } +} + +void UIQuestion::setEnabled(bool flag) { + if (_enabled != flag) { + UIElement::setEnabled(flag); + BF_GLOBALS._uiElements.draw(); + } +} + +void UIQuestion::showItem(int resNum, int rlbNum, int frameNum) { + GfxDialog::setPalette(); + + // Get the item to display + GfxSurface objImage = surfaceFromRes(resNum, rlbNum, frameNum); + Rect imgRect; + imgRect.resize(objImage, 0, 0, 100); + imgRect.center(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2); + + // Save the area behind where the image will be displayed + GfxSurface *savedArea = Surface_getArea(BF_GLOBALS.gfxManager().getSurface(), imgRect); + + // Draw the image + BF_GLOBALS.gfxManager().copyFrom(objImage, imgRect); + + // Wait for a press + BF_GLOBALS._events.waitForPress(); + + // Restore the old area + BF_GLOBALS.gfxManager().copyFrom(*savedArea, imgRect); + delete savedArea; +} + +/*--------------------------------------------------------------------------*/ + +void UIScore::postInit(SceneObjectList *OwnerList) { + int xp = 266; + _digit3.setup(1, 6, 1, xp, 180, 255); + _digit3.reposition(); + xp += 7; + _digit2.setup(1, 6, 1, xp, 180, 255); + _digit2.reposition(); + xp += 7; + _digit1.setup(1, 6, 1, xp, 180, 255); + _digit1.reposition(); + xp += 7; + _digit0.setup(1, 6, 1, xp, 180, 255); + _digit0.reposition(); +} + +void UIScore::draw() { + _digit3.draw(); + _digit2.draw(); + _digit1.draw(); + _digit0.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; + _digit0.setFrame(score + 1); +} + +/*--------------------------------------------------------------------------*/ + +UIInventorySlot::UIInventorySlot(): UIElement() { + _objIndex = 0; + _object = NULL; +} + +void UIInventorySlot::synchronize(Serializer &s) { + UIElement::synchronize(s); + s.syncAsSint16LE(_objIndex); + SYNC_POINTER(_object); +} + +void UIInventorySlot::process(Event &event) { + if (event.eventType == EVENT_BUTTON_DOWN) { + event.handled = true; + + if (_objIndex == INV_AMMO_BELT) { + // Handle showing ammo belt + showAmmoBelt(); + + } else if (_objIndex != INV_NONE) { + _object->setCursor(); + } + } +} + +void UIInventorySlot::showAmmoBelt() { + AmmoBeltDialog *dlg = new AmmoBeltDialog(); + dlg->execute(); + delete dlg; +} + +/*--------------------------------------------------------------------------*/ + +UIInventoryScroll::UIInventoryScroll() { + _isLeft = false; +} + +void UIInventoryScroll::synchronize(Serializer &s) { + UIElement::synchronize(s); + s.syncAsSint16LE(_isLeft); +} + +void UIInventoryScroll::process(Event &event) { + switch (event.eventType) { + case EVENT_BUTTON_DOWN: + // Draw the button as selected + toggle(true); + + event.handled = true; + break; + case EVENT_BUTTON_UP: + // Restore unselected version + toggle(false); + + // Scroll the inventory as necessary + BF_GLOBALS._uiElements.scrollInventory(_isLeft); + event.handled = true; + break; + } +} + +void UIInventoryScroll::toggle(bool pressed) { + if (_enabled) { + setFrame(pressed ? (_frameNum + 1) : _frameNum); + BF_GLOBALS._uiElements.draw(); + } +} + +/*--------------------------------------------------------------------------*/ + +UICollection::UICollection(): EventHandler() { + _clearScreen = false; + _visible = false; + _cursorChanged = false; +} + +void UICollection::setup(const Common::Point &pt) { + _position = pt; + _bounds.left = _bounds.right = pt.x; + _bounds.top = _bounds.bottom = pt.y; +} + +void UICollection::hide() { + erase(); + _visible = false; +} + +void UICollection::show() { + _visible = true; + draw(); +} + +void UICollection::erase() { + if (_clearScreen) { + Rect tempRect(0, BF_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT); + GLOBALS._screenSurface.fillRect(tempRect, 0); + _clearScreen = false; + } +} + +void UICollection::resetClear() { + _clearScreen = false; +} + +void UICollection::draw() { + if (_visible) { + // Draw the elements + for (uint idx = 0; idx < _objList.size(); ++idx) + _objList[idx]->draw(); + + _clearScreen = 1; + } +} + +/*--------------------------------------------------------------------------*/ + +UIElements::UIElements(): UICollection() { + _cursorVisage.setVisage(1, 5); +} + +void UIElements::process(Event &event) { + if (_clearScreen && BF_GLOBALS._player._enabled && (BF_GLOBALS._sceneManager._sceneNumber != 50)) { + if (_bounds.contains(event.mousePos)) { + // Cursor inside UI area + if (!_cursorChanged) { + if (BF_GLOBALS._events.isInventoryIcon()) { + // Inventory icon being displayed, so leave alone + } else { + // Change to the inventory use cursor + GfxSurface surface = _cursorVisage.getFrame(6); + BF_GLOBALS._events.setCursor(surface); + } + _cursorChanged = true; + } + + // Pass event to any element that the cursor falls on + for (int idx = (int)_objList.size() - 1; idx >= 0; --idx) { + if (_objList[idx]->_bounds.contains(event.mousePos) && _objList[idx]->_enabled) { + _objList[idx]->process(event); + if (event.handled) + break; + } + } + + if (event.eventType == EVENT_BUTTON_DOWN) + event.handled = true; + + } else if (_cursorChanged) { + // Cursor outside UI area, so reset as necessary + BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor()); + _cursorChanged = false; + + SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene; + if (scene->_eventHandler) { + GfxSurface surface = _cursorVisage.getFrame(7); + BF_GLOBALS._events.setCursor(surface); + } + } + } +} + +void UIElements::setup(const Common::Point &pt) { + _slotStart = 0; + _itemList.clear(); + _scoreValue = 0; + _active = true; + UICollection::setup(pt); + hide(); + + _object1.setup(1, 3, 1, 0, 0, 255); + add(&_object1); + + // Set up the inventory slots + int xp = 0; + for (int idx = 0; idx < 4; ++idx) { + UIElement *item = NULL; + switch (idx) { + case 0: + item = &_slot1; + break; + case 1: + item = &_slot2; + break; + case 2: + item = &_slot3; + break; + case 3: + item = &_slot4; + break; + } + + xp = idx * 63 + 2; + item->setup(9, 1, idx, xp, 4, 255); + add(item); + } + + // Setup bottom-right hand buttons + xp += 62; + _question.setup(1, 4, 7, xp, 16, 255); + _question.setEnabled(false); + add(&_question); + + xp += 21; + _scrollLeft.setup(1, 4, 1, xp, 16, 255); + add(&_scrollLeft); + _scrollLeft._isLeft = true; + + xp += 22; + _scrollRight.setup(1, 4, 4, xp, 16, 255); + add(&_scrollRight); + _scrollRight._isLeft = false; + + // Set up the score + _score.postInit(); + add(&_score); + + // Set interface area + _bounds = Rect(0, BF_INTERFACE_Y - 1, SCREEN_WIDTH, SCREEN_HEIGHT); + + updateInventory(); +} + +void UIElements::add(UIElement *obj) { + // Add object + assert(_objList.size() < 12); + _objList.push_back(obj); + + obj->setPosition(Common::Point(_bounds.left + obj->_position.x, _bounds.top + obj->_position.y)); + obj->reposition(); + + GfxSurface s = obj->getFrame(); + s.draw(obj->_position); +} + +/** + * Handles updating the visual inventory in the user interface + */ +void UIElements::updateInventory() { + _score.updateScore(); + updateInvList(); + + // Enable scroll buttons if the player has more than four items + if (_itemList.size() > 4) { + _scrollLeft.setEnabled(true); + _scrollRight.setEnabled(true); + } else { + _scrollLeft.setEnabled(false); + _scrollRight.setEnabled(false); + } + + // Handle cropping the slots start within inventory + int lastPage = (_itemList.size() - 1) / 4 + 1; + if (_slotStart < 0) + _slotStart = lastPage - 1; + else if (_slotStart > (lastPage - 1)) + _slotStart = 0; + + // Handle refreshing slot graphics + UIInventorySlot *slotList[4] = { &_slot1, &_slot2, &_slot3, &_slot4 }; + + // Loop through the inventory objects + SynchronizedList<InvObject *>::iterator i; + int objIndex = 0; + for (i = BF_INVENTORY._itemList.begin(); i != BF_INVENTORY._itemList.end(); ++i, ++objIndex) { + InvObject *obj = *i; + + // Check whether the object is in any of the four inventory slots + for (int slotIndex = 0; slotIndex < 4; ++slotIndex) { + int idx = _slotStart * 4 + slotIndex; + int objectIdx = (idx < (int)_itemList.size()) ? _itemList[idx] : 0; + + if (objectIdx == objIndex) { + UIInventorySlot *slot = slotList[slotIndex]; + + slot->_objIndex = objIndex; + slot->_object = obj; + slot->setVisage(obj->_visage); + slot->setStrip(obj->_strip); + slot->setFrame(obj->_frame); + } + } + } + + // Refresh the display if necessary + if (_active) + draw(); +} + +/** + * Update the list of the indexes of items in the player's inventory + */ +void UIElements::updateInvList() { + // Update the index list of items in the player's inventory + _itemList.clear(); + + SynchronizedList<InvObject *>::iterator i; + int itemIndex = 0; + for (i = BF_GLOBALS._inventory->_itemList.begin(); i != BF_GLOBALS._inventory->_itemList.end(); ++i, ++itemIndex) { + InvObject *invObject = *i; + if (invObject->inInventory()) + _itemList.push_back(itemIndex); + } +} + +/** + * Set the game score + */ +void UIElements::addScore(int amount) { + _scoreValue += amount; + BF_GLOBALS._sound2.play(0); + updateInventory(); +} + +/* + * Scroll the inventory slots + */ +void UIElements::scrollInventory(bool isLeft) { + if (isLeft) + --_slotStart; + else + ++_slotStart; + + updateInventory(); +} + +} // End of namespace BlueForce + +} // End of namespace TsAGE diff --git a/engines/tsage/blue_force/blueforce_ui.h b/engines/tsage/blue_force/blueforce_ui.h new file mode 100644 index 0000000000..927e667cff --- /dev/null +++ b/engines/tsage/blue_force/blueforce_ui.h @@ -0,0 +1,152 @@ +/* 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_UI_H +#define TSAGE_BLUEFORCE_UI_H + +#include "common/scummsys.h" +#include "tsage/core.h" +#include "tsage/graphics.h" +#include "tsage/sound.h" + +namespace TsAGE { + +namespace BlueForce { + +using namespace TsAGE; + +class StripProxy: public EventHandler { +public: + virtual void process(Event &event); +}; + +class UIElement: public AltSceneObject { +public: + int _field88; + bool _enabled; + int _frameNum; + + virtual Common::String getClassName() { return "UIElement"; } + virtual void synchronize(Serializer &s); + + void setup(int visage, int stripNum, int frameNum, int posX, int posY, int priority); + void setEnabled(bool flag); +}; + +// This class implements the Question mark button +class UIQuestion: public UIElement { +private: + void showDescription(CursorType item); + void showItem(int resNum, int rlbNum, int frameNum); +public: + virtual void process(Event &event); + void setEnabled(bool flag); +}; + +// This class implements the score counter +class UIScore: public UIElement { +private: + void showDescription(int lineNum); +public: + UIElement _digit3, _digit2, _digit1, _digit0; + + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void draw(); + + void updateScore(); +}; + +class UIInventorySlot: public UIElement { +private: + void showAmmoBelt(); +public: + int _objIndex; + InvObject *_object; + + UIInventorySlot(); + virtual Common::String getClassName() { return "UIInventorySlot"; } + virtual void synchronize(Serializer &s); + virtual void process(Event &event); +}; + +class UIInventoryScroll: public UIElement { +private: + void toggle(bool pressed); +public: + bool _isLeft; + + UIInventoryScroll(); + virtual Common::String getClassName() { return "UIInventoryScroll"; } + virtual void synchronize(Serializer &s); + virtual void process(Event &event); +}; + +class UICollection: public EventHandler { +protected: + void erase(); +public: + Common::Point _position; + Rect _bounds; + bool _visible; + bool _clearScreen; + bool _cursorChanged; + Common::Array<UIElement *> _objList; + + UICollection(); + void setup(const Common::Point &pt); + void hide(); + void show(); + void resetClear(); + void draw(); +}; + +class UIElements: public UICollection { +private: + void add(UIElement *obj); + void updateInvList(); +public: + UIElement _object1; + UIQuestion _question; + UIScore _score; + UIInventorySlot _slot1, _slot2, _slot3, _slot4; + UIInventoryScroll _scrollLeft, _scrollRight; + ASound _sound; + int _slotStart, _scoreValue; + bool _active; + Common::Array<int> _itemList; + Visage _cursorVisage; + + UIElements(); + virtual void postInit(SceneObjectList *OwnerList = NULL) { error("Wrong init() called"); } + virtual void process(Event &event); + + void setup(const Common::Point &pt); + void updateInventory(); + void addScore(int amount); + void scrollInventory(bool isLeft); +}; + +} // End of namespace BlueForce + +} // End of namespace TsAGE + +#endif diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index 615b1c36fd..32a4861036 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -40,6 +40,7 @@ SequenceManager::SequenceManager() : Action() { _field26 = 0; _objectIndex = 0; _keepActive = false; + _onCallback = NULL; setup(); } @@ -287,7 +288,7 @@ void SequenceManager::signal() { /* Following indexes were introduced for Blue Force */ case 35: v1 = getNextValue(); - _sceneObject->updateAngle(_objectList[v1]); + _sceneObject->updateAngle(_objectList[v1]->_position); break; case 36: _sceneObject->animate(ANIM_MODE_9, NULL); @@ -295,7 +296,8 @@ void SequenceManager::signal() { case 37: v1 = getNextValue(); v2 = getNextValue(); - warning("TODO: dword_53030(%d,%d)", v1, v2); + if (_onCallback) + _onCallback(v1, v2); break; case 38: { int resNum = getNextValue(); @@ -558,6 +560,8 @@ void Obj44::synchronize(Serializer &s) { StripManager::StripManager() { _callbackObject = NULL; _activeSpeaker = NULL; + _onBegin = NULL; + _onEnd = NULL; reset(); } @@ -565,6 +569,8 @@ StripManager::~StripManager() { } void StripManager::start(int stripNum, EventHandler *owner, StripCallback *callback) { + if (_onBegin) + _onBegin(); reset(); _stripNum = stripNum; @@ -678,6 +684,9 @@ void StripManager::remove() { _globals->_sceneManager._scene->loadScene(_sceneNumber); } + if (_onEnd) + _onEnd(); + Action::remove(); } diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h index e263a12d12..f82c07a7dd 100644 --- a/engines/tsage/converse.h +++ b/engines/tsage/converse.h @@ -34,6 +34,8 @@ public: virtual void stripCallback(int v) = 0; }; +typedef void (*SequenceCallback)(int v1, int v2); + class SequenceManager : public Action { private: void setup(); @@ -54,6 +56,7 @@ public: SceneObject *_sceneObject; SceneObject *_objectList[6]; ASound _soundHandler; + SequenceCallback _onCallback; public: SequenceManager(); @@ -187,6 +190,8 @@ public: virtual void synchronize(Serializer &s); }; +typedef void (*StripProc)(); + class StripManager : public Action { private: void reset(); @@ -208,6 +213,8 @@ public: int _field2E8; Common::Array<Obj44> _obj44List; Common::Array<byte> _script; + StripProc _onBegin; + StripProc _onEnd; public: StripManager(); virtual ~StripManager(); diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 42cb1d039f..0de400fe5d 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -22,6 +22,7 @@ #include "common/system.h" #include "common/config-manager.h" +#include "common/util.h" #include "engines/engine.h" #include "graphics/palette.h" #include "tsage/tsage.h" @@ -55,14 +56,30 @@ InvObject::InvObject(int sceneNumber, int rlbNum, int cursorNum, CursorType curs DEALLOCATE(imgData); } +InvObject::InvObject(int visage, int strip, int frame) { + assert(_vm->getGameID() == GType_BlueForce); + _visage = visage; + _strip = strip; + _frame = frame; + _sceneNumber = 0; + _iconResNum = 10; +} + void InvObject::setCursor() { - _globals->_events._currentCursor = _cursorId; + if (_vm->getGameID() == GType_BlueForce) { + // Blue Force cursor handling + _cursorId = (CursorType)BF_GLOBALS._inventory->indexOf(this); + _globals->_events.setCursor(_cursorId); + } else { + // Ringworld cursor handling + _globals->_events._currentCursor = _cursorId; - if (_iconResNum != -1) { - GfxSurface s = surfaceFromRes(_iconResNum, _rlbNum, _cursorNum); + if (_iconResNum != -1) { + GfxSurface s = surfaceFromRes(_iconResNum, _rlbNum, _cursorNum); - Graphics::Surface src = s.lockSurface(); - _globals->_events.setCursor(src, s._transColor, s._centroid, _cursorId); + Graphics::Surface src = s.lockSurface(); + _globals->_events.setCursor(src, s._transColor, s._centroid, _cursorId); + } } } @@ -77,6 +94,31 @@ void InvObjectList::synchronize(Serializer &s) { SYNC_POINTER(_selectedItem); } +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; + } + + return -1; +} + +InvObject *InvObjectList::getItem(int objectNum) { + SynchronizedList<InvObject *>::const_iterator i = _itemList.begin(); + while (objectNum-- > 0) + ++i; + + return *i; +} + +int InvObjectList::getObjectScene(int objectNum) { + InvObject *obj = getItem(objectNum); + return obj->_sceneNumber; +} + /*--------------------------------------------------------------------------*/ void EventHandler::dispatch() { @@ -279,8 +321,12 @@ void ObjectMover::dispatch() { void ObjectMover::setup(const Common::Point &destPos) { _sceneObject->calcAngle(destPos); - if ((_sceneObject->_objectWrapper) && !(_sceneObject->_flags & OBJFLAG_SUPPRESS_DISPATCH)) - _sceneObject->_objectWrapper->dispatch(); + if ((_sceneObject->_objectWrapper) && !(_sceneObject->_flags & OBJFLAG_SUPPRESS_DISPATCH)) { + if (_vm->getGameID() == GType_Ringworld) + _sceneObject->_objectWrapper->dispatch(); + else + _sceneObject->updateAngle(destPos); + } // Get the difference int diffX = destPos.x - _sceneObject->_position.x; @@ -1238,6 +1284,15 @@ void ScenePalette::setPalette(int index, int count) { } /** + * Set a palette entry + */ +void ScenePalette::setEntry(int index, uint r, uint g, uint b) { + _palette[index * 3] = r; + _palette[index * 3 + 1] = g; + _palette[index * 3 + 2] = b; +} + +/** * Returns the palette index with the closest matching color to that specified * @param r R component * @param g G component @@ -1412,6 +1467,19 @@ void SceneItem::remove() { _globals->_sceneItems.remove(this); } +bool SceneItem::startAction(CursorType action, Event &event) { + if (_vm->getGameID() == GType_Ringworld) { + doAction(action); + return true; + } else if ((action == CURSOR_LOOK) || (action == CURSOR_USE) || (action == CURSOR_TALK) || + (action < CURSOR_LOOK)) { + doAction(action); + return true; + } else { + return false; + } +} + void SceneItem::doAction(int action) { const char *msg = NULL; @@ -1447,7 +1515,11 @@ bool SceneItem::contains(const Common::Point &pt) { } void SceneItem::display(int resNum, int lineNum, ...) { - Common::String msg = !resNum ? Common::String() : _resourceManager->getMessage(resNum, lineNum); + Common::String msg = (!resNum || (resNum == -1)) ? Common::String() : + _resourceManager->getMessage(resNum, lineNum); + + if ((_vm->getGameID() == GType_BlueForce) && BF_GLOBALS._uiElements._active) + BF_GLOBALS._uiElements.hide(); if (_globals->_sceneObjects->contains(&_globals->_sceneText)) { _globals->_sceneText.remove(); @@ -1459,12 +1531,15 @@ void SceneItem::display(int resNum, int lineNum, ...) { Rect textRect; int maxWidth = 120; bool keepOnscreen = false; - bool centerText = true; + bool centerText = _vm->getGameID() == GType_Ringworld; - if (resNum) { + if (resNum != 0) { va_list va; va_start(va, lineNum); + if (resNum == -1) + msg = Common::String(va_arg(va, const char *)); + int mode; do { // Get next instruction @@ -1574,6 +1649,36 @@ void SceneItem::display(int resNum, int lineNum, ...) { _globals->_sceneText.remove(); } + + if ((_vm->getGameID() == GType_BlueForce) && BF_GLOBALS._uiElements._active) { + // Show user interface + BF_GLOBALS._uiElements.show(); + + // Re-show the cursor + BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor()); + } +} + +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, + 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); + else + display(resNum, lineNum, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); +} + +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_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); } /*--------------------------------------------------------------------------*/ @@ -1581,24 +1686,41 @@ void SceneItem::display(int resNum, int lineNum, ...) { void SceneHotspot::doAction(int action) { switch ((int)action) { case CURSOR_LOOK: - display(1, 0, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); + if (_vm->getGameID() == GType_BlueForce) + SceneItem::display(LOOK_SCENE_HOTSPOT); + else + display(1, 0, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; case CURSOR_USE: - display(1, 5, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); + if (_vm->getGameID() == GType_BlueForce) + SceneItem::display(USE_SCENE_HOTSPOT); + else + display(1, 5, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; case CURSOR_TALK: - display(1, 15, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); + if (_vm->getGameID() == GType_BlueForce) + SceneItem::display(TALK_SCENE_HOTSPOT); + else + display(1, 15, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; case CURSOR_WALK: break; default: - display(2, action, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); + if (_vm->getGameID() == GType_BlueForce) + SceneItem::display(DEFAULT_SCENE_HOTSPOT); + else + display(2, action, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; } } /*--------------------------------------------------------------------------*/ +NamedHotspot::NamedHotspot() : SceneHotspot() { + _resNum = 0; + _lookLineNum = _useLineNum = _talkLineNum = -1; +} + void NamedHotspot::doAction(int action) { switch (action) { case CURSOR_WALK: @@ -1607,14 +1729,26 @@ void NamedHotspot::doAction(int action) { case CURSOR_LOOK: if (_lookLineNum == -1) SceneHotspot::doAction(action); + else if (_vm->getGameID() == GType_BlueForce) + SceneItem::display2(_resNum, _lookLineNum); else - SceneItem::display(_resnum, _lookLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); + SceneItem::display(_resNum, _lookLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); break; case CURSOR_USE: if (_useLineNum == -1) SceneHotspot::doAction(action); + else if (_vm->getGameID() == GType_BlueForce) + SceneItem::display2(_resNum, _useLineNum); + else + SceneItem::display(_resNum, _useLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); + break; + case CURSOR_TALK: + if (_talkLineNum == -1) + SceneHotspot::doAction(action); + else if (_vm->getGameID() == GType_BlueForce) + SceneItem::display2(_resNum, _talkLineNum); else - SceneItem::display(_resnum, _useLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); + SceneItem::display2(_resNum, _talkLineNum); break; default: SceneHotspot::doAction(action); @@ -1622,19 +1756,66 @@ void NamedHotspot::doAction(int action) { } } -void NamedHotspot::setup(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum) { +void NamedHotspot::setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum) { setBounds(ys, xe, ye, xs); - _resnum = resnum; + _resNum = resnum; _lookLineNum = lookLineNum; _useLineNum = useLineNum; + _talkLineNum = -1; _globals->_sceneItems.addItems(this, NULL); } +void NamedHotspot::setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) { + setBounds(bounds); + _resNum = resNum; + _lookLineNum = lookLineNum; + _talkLineNum = talkLineNum; + _useLineNum = useLineNum; + + switch (mode) { + case 2: + _globals->_sceneItems.push_front(this); + break; + case 4: + _globals->_sceneItems.addBefore(item, this); + break; + case 5: + _globals->_sceneItems.addAfter(item, this); + break; + default: + _globals->_sceneItems.push_back(this); + break; + } +} + +void NamedHotspot::setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode) { + _sceneRegionId = sceneRegionId; + _resNum = resNum; + _lookLineNum = lookLineNum; + _talkLineNum = talkLineNum; + _useLineNum = useLineNum; + + // Handle adding hotspot to scene items list as necessary + switch (mode) { + case 2: + GLOBALS._sceneItems.push_front(this); + break; + case 3: + break; + default: + GLOBALS._sceneItems.push_back(this); + break; + } +} + void NamedHotspot::synchronize(Serializer &s) { SceneHotspot::synchronize(s); - s.syncAsSint16LE(_resnum); + s.syncAsSint16LE(_resNum); s.syncAsSint16LE(_lookLineNum); s.syncAsSint16LE(_useLineNum); + + if (_vm->getGameID() == GType_BlueForce) + s.syncAsSint16LE(_talkLineNum); } /*--------------------------------------------------------------------------*/ @@ -1661,11 +1842,11 @@ void SceneObjectWrapper::dispatch() { void SceneObjectWrapper::check() { _visageImages.setVisage(_sceneObject->_visage); - int frameCount = _visageImages.getFrameCount(); + int visageCount = _visageImages.getFrameCount(); int angle = _sceneObject->_angle; int strip = _sceneObject->_strip; - if (frameCount == 4) { + if (visageCount == 4) { if ((angle > 314) || (angle < 45)) strip = 4; if ((angle > 44) && (angle < 135)) @@ -1674,7 +1855,7 @@ void SceneObjectWrapper::check() { strip = 3; if ((angle >= 225) && (angle < 315)) strip = 2; - } else if (frameCount == 8) { + } else if (visageCount == 8) { if ((angle > 330) || (angle < 30)) strip = 4; if ((angle >= 30) && (angle < 70)) @@ -1693,8 +1874,8 @@ void SceneObjectWrapper::check() { strip = 8; } - if (strip > frameCount) - strip = frameCount; + if (strip > visageCount) + strip = visageCount; _sceneObject->setStrip(strip); } @@ -1722,6 +1903,8 @@ SceneObject::SceneObject() : SceneHotspot() { _frameChange = 0; _visage = 0; + _strip = 0; + _frame = 0; } SceneObject::SceneObject(const SceneObject &so) : SceneHotspot() { @@ -2008,6 +2191,7 @@ void SceneObject::animate(AnimateMode animMode, ...) { break; case ANIM_MODE_8: + case ANIM_MODE_9: _field68 = va_arg(va, int); _endAction = va_arg(va, Action *); _frameChange = 1; @@ -2024,9 +2208,16 @@ SceneObject *SceneObject::clone() const { } void SceneObject::checkAngle(const SceneObject *obj) { - _angle = GfxManager::getAngle(_position, obj->_position); + checkAngle(obj->_position); +} - if (_objectWrapper) +void SceneObject::checkAngle(const Common::Point &pt) { + int angleAmount = GfxManager::getAngle(_position, pt); + if ((_vm->getGameID() == GType_Ringworld) || + ((angleAmount != -1) && (_animateMode == ANIM_MODE_9))) + _angle = angleAmount; + + if (_objectWrapper && (_vm->getGameID() == GType_Ringworld)) _objectWrapper->dispatch(); } @@ -2194,7 +2385,25 @@ void SceneObject::dispatch() { } else { setFrame(changeFrame()); } + break; + + case ANIM_MODE_9: + if (_frame == _endFrame) { + if (_frameChange != -1) { + _frameChange = -1; + _strip = ((_strip - 1) ^ 1) + 1; + _endFrame = 1; + } else if ((_field68 == 0) || (--_field68 != 0)) { + _frameChange = 1; + _endFrame = getFrameCount(); + setFrame(changeFrame()); + } else { + animEnded(); + } + } else { + setFrame(changeFrame()); + } break; default: @@ -2222,10 +2431,6 @@ void SceneObject::removeObject() { _globals->_sceneItems.remove(this); _globals->_sceneObjects->remove(this); - if (_visage) { - _visage = 0; - } - if (_objectWrapper) { _objectWrapper->remove(); _objectWrapper = NULL; @@ -2283,8 +2488,8 @@ void SceneObject::updateScreen() { } } -void SceneObject::updateAngle(SceneObject *sceneObj) { - checkAngle(sceneObj); +void SceneObject::updateAngle(const Common::Point &pt) { + checkAngle(pt); if (_objectWrapper) _objectWrapper->check(); } @@ -2306,18 +2511,17 @@ void SceneObject::setup(int visage, int stripFrameNum, int frameNum, int posX, i /*--------------------------------------------------------------------------*/ -void SceneObjectExt2::postInit(SceneObjectList *OwnerList) { - _v8A = -1; - _v8C = -1; - _v8E = -1; - SceneObject::postInit(); +void AltSceneObject::postInit(SceneObjectList *OwnerList) { + SceneObject::postInit(&_globals->_sceneManager._altSceneObjects); } -void SceneObjectExt2::synchronize(Serializer &s) { - SceneObject::synchronize(s); - s.syncAsSint16LE(_v8A); - s.syncAsSint16LE(_v8C); - s.syncAsSint16LE(_v8E); +void AltSceneObject::draw() { + 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); } /*--------------------------------------------------------------------------*/ @@ -2630,12 +2834,21 @@ void SceneText::synchronize(Serializer &s) { _textSurface.synchronize(s); } +void SceneText::updateScreen() { + // FIXME: Hack for Blue Force to handle not refreshing the screen if the user interface + // has been re-activated after showing some scene text + if ((_vm->getGameID() != GType_BlueForce) || (_bounds.top < BF_INTERFACE_Y) || + !BF_GLOBALS._uiElements._visible) + SceneObject::updateScreen(); +} + /*--------------------------------------------------------------------------*/ Visage::Visage() { - _resNum = 0; - _rlbNum = 0; + _resNum = -1; + _rlbNum = -1; _data = NULL; + _flipHoriz = false; } Visage::Visage(const Visage &v) { @@ -2661,7 +2874,32 @@ void Visage::setVisage(int resNum, int rlbNum) { _resNum = resNum; _rlbNum = rlbNum; DEALLOCATE(_data); - _data = _resourceManager->getResource(RES_VISAGE, resNum, rlbNum); + + if (_vm->getGameID() == GType_Ringworld) { + // In Ringworld, we immediately get the data + _data = _resourceManager->getResource(RES_VISAGE, resNum, rlbNum); + } else { + // Blue Force has an extra indirection via the visage index file + byte *indexData = _resourceManager->getResource(RES_VISAGE, resNum, 9999); + if (rlbNum == 9999) { + _data = indexData; + } else { + if (rlbNum == 0) + rlbNum = 1; + + // Get the flags/rlbNum to use + uint32 v = READ_LE_UINT32(indexData + (rlbNum - 1) * 4 + 2); + int flags = v >> 30; + + if (flags & 3) { + rlbNum = (int)(v & 0xff); + } + _flipHoriz = flags & 1; + + _data = _resourceManager->getResource(RES_VISAGE, resNum, rlbNum); + } + } + assert(_data); } } @@ -2680,13 +2918,28 @@ GfxSurface Visage::getFrame(int frameNum) { int offset = READ_LE_UINT32(_data + 2 + frameNum * 4); byte *frameData = _data + offset; - return surfaceFromRes(frameData); + GfxSurface result = surfaceFromRes(frameData); + if (_flipHoriz) flip(result); + return result; } int Visage::getFrameCount() const { return READ_LE_UINT16(_data); } +void Visage::flip(GfxSurface &gfxSurface) { + Graphics::Surface s = gfxSurface.lockSurface(); + + for (int y = 0; y < s.h; ++y) { + // Flip the line + byte *lineP = (byte *)s.getBasePtr(0, y); + for (int x = 0; x < (s.w / 2); ++x) + SWAP(lineP[x], lineP[s.w - x - 1]); + } + + gfxSurface.unlockSurface(); +} + /*--------------------------------------------------------------------------*/ Player::Player(): SceneObject() { @@ -2710,11 +2963,16 @@ void Player::disableControl() { _canWalk = false; _uiEnabled = false; _globals->_events.setCursor(CURSOR_NONE); + _enabled = false; + + if ((_vm->getGameID() == GType_BlueForce) && BF_GLOBALS._uiElements._active) + BF_GLOBALS._uiElements.hide(); } void Player::enableControl() { _canWalk = true; _uiEnabled = true; + _enabled = true; _globals->_events.setCursor(CURSOR_WALK); switch (_globals->_events.getCursor()) { @@ -2728,6 +2986,9 @@ void Player::enableControl() { _globals->_events.setCursor(CURSOR_WALK); break; } + + if ((_vm->getGameID() == GType_BlueForce) && BF_GLOBALS._uiElements._active) + BF_GLOBALS._uiElements.show(); } void Player::process(Event &event) { @@ -2735,6 +2996,9 @@ void Player::process(Event &event) { (_globals->_events.getCursor() == CURSOR_WALK) && _globals->_player._canWalk && (_position != event.mousePos) && _globals->_sceneObjects->contains(this)) { + if ((_vm->getGameID() == GType_BlueForce) && !BF_GLOBALS._player._enabled) + return; + PlayerMover *newMover = new PlayerMover(); Common::Point destPos(event.mousePos.x + _globals->_sceneManager._scene->_sceneBounds.left, event.mousePos.y + _globals->_sceneManager._scene->_sceneBounds.top); @@ -2750,6 +3014,9 @@ void Player::synchronize(Serializer &s) { s.syncAsByte(_canWalk); s.syncAsByte(_uiEnabled); s.syncAsSint16LE(_field8C); + + if (_vm->getGameID() == GType_BlueForce) + s.syncAsByte(_enabled); } /*--------------------------------------------------------------------------*/ @@ -3394,8 +3661,11 @@ void ScenePriorities::load(int resNum) { Region *ScenePriorities::find(int priority) { // If no priority regions are loaded, then return the placeholder region - if (empty()) - return &_defaultPriorityRegion; + if (empty()) { + if (_vm->getGameID() == GType_Ringworld) + return &_defaultPriorityRegion; + return NULL; + } if (priority > 255) priority = 255; @@ -3511,9 +3781,7 @@ void SceneHandler::process(Event &event) { // Check for displaying right-click dialog if ((event.eventType == EVENT_BUTTON_DOWN) && (event.btnState == BTNSHIFT_RIGHT) && _globals->_player._uiEnabled) { - RightClickDialog *dlg = new RightClickDialog(); - dlg->execute(); - delete dlg; + _globals->_game->rightClick(); event.handled = true; return; @@ -3541,8 +3809,16 @@ void SceneHandler::process(Event &event) { } // Mouse press handling - if (_globals->_player._uiEnabled && (event.eventType == EVENT_BUTTON_DOWN) && - !_globals->_sceneItems.empty()) { + bool enabled = (_vm->getGameID() == GType_BlueForce) ? _globals->_player._enabled : + _globals->_player._uiEnabled; + if (enabled && (event.eventType == EVENT_BUTTON_DOWN) && !_globals->_sceneItems.empty()) { + // Check if the mouse is on the player + if (_globals->_player.contains(event.mousePos)) { + playerAction(event); + if (event.handled) + return; + } + // Scan the item list to find one the mouse is within SynchronizedList<SceneItem *>::iterator i = _globals->_sceneItems.begin(); while ((i != _globals->_sceneItems.end()) && !(*i)->contains(event.mousePos)) @@ -3550,7 +3826,8 @@ void SceneHandler::process(Event &event) { if (i != _globals->_sceneItems.end()) { // Pass the action to the item - (*i)->doAction(_globals->_events.getCursor()); + (*i)->startAction(_globals->_events.getCursor(), event); + event.handled = _globals->_events.getCursor() != CURSOR_WALK; if (_globals->_player._uiEnabled && _globals->_player._canWalk && @@ -3561,8 +3838,14 @@ void SceneHandler::process(Event &event) { } else if (_globals->_player._uiEnabled && (_globals->_events.getCursor() != CURSOR_LOOK)) { _globals->_events.setCursor(CURSOR_USE); } + + if (_vm->getGameID() == GType_BlueForce) + event.handled = true; } + // Handle any fallback text display + processEnd(event); + // Handle player processing _globals->_player.process(event); } diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 19987ed399..ccb3817b16 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -55,8 +55,13 @@ public: CursorType _cursorId; Common::String _description; int _iconResNum; + + int _visage; + int _strip; + int _frame; public: InvObject(int sceneNumber, int rlbNum, int cursorNum, CursorType cursorId, const Common::String description); + InvObject(int visage, int strip, int frame); bool inInventory() const { return _sceneNumber == 1; } void setCursor(); @@ -73,6 +78,9 @@ public: InvObject *_selectedItem; InvObjectList(); + int indexOf(InvObject *obj) const; + InvObject *getItem(int objectNum); + int getObjectScene(int objectNum); virtual Common::String getClassName() { return "InvObjectList"; } virtual void synchronize(Serializer &s); @@ -157,6 +165,18 @@ public: int _state; }; +#define ADD_PLAYER_MOVER(X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \ + _globals->_player.addMover(mover, &pt, this); } +#define ADD_PLAYER_MOVER_NULL(OBJ, X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \ + OBJ.addMover(mover, &pt, NULL); } +#define ADD_PLAYER_MOVER_THIS(OBJ, X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \ + OBJ.addMover(mover, &pt, this); } + +#define ADD_MOVER(OBJ, X, Y) { Common::Point pt(X, Y); NpcMover *mover = new NpcMover(); \ + OBJ.addMover(mover, &pt, this); } +#define ADD_MOVER_NULL(OBJ, X, Y) { Common::Point pt(X, Y); NpcMover *mover = new NpcMover(); \ + OBJ.addMover(mover, &pt, NULL); } + class ObjectMover : public EventHandler { public: Common::Point _destPosition; @@ -351,6 +371,7 @@ public: bool loadPalette(int paletteNum); void refresh(); void setPalette(int index, int count); + void setEntry(int index, uint r, uint g, uint b); uint8 indexOf(uint r, uint g, uint b, int threshold = 0xffff); void getPalette(int start = 0, int count = 256); void signalListeners(); @@ -394,16 +415,15 @@ public: virtual Common::String getClassName() { return "SceneItem"; } virtual void remove(); virtual void destroy() {} - virtual void startMover(CursorType action) { doAction(action); } + virtual bool startAction(CursorType action, Event &event); virtual void doAction(int action); bool contains(const Common::Point &pt); void setBounds(const Rect &newBounds) { _bounds = newBounds; } void setBounds(const int ys, const int xe, const int ye, const int xs) { _bounds = Rect(MIN(xs, xe), MIN(ys, ye), MAX(xs, xe), MAX(ys, ye)); } static void display(int resNum, int lineNum, ...); - static void display2(int resNum, int lineNum) { - display(resNum, lineNum, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END); - } + static void display2(int resNum, int lineNum); + static void display(const Common::String &msg); }; class SceneItemExt : public SceneItem { @@ -427,13 +447,15 @@ public: class NamedHotspot : public SceneHotspot { public: - int _resnum, _lookLineNum, _useLineNum; - NamedHotspot() : SceneHotspot() {} + int _resNum, _lookLineNum, _useLineNum, _talkLineNum; + NamedHotspot(); - void setup(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum); virtual void doAction(int action); virtual Common::String getClassName() { return "NamedHotspot"; } virtual void synchronize(Serializer &s); + virtual void setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum); + virtual void setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item); + virtual void setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode); }; enum AnimateMode {ANIM_MODE_NONE = 0, ANIM_MODE_1 = 1, ANIM_MODE_2 = 2, ANIM_MODE_3 = 3, @@ -447,9 +469,12 @@ class SceneObject; class Visage { private: byte *_data; + + void flip(GfxSurface &s); public: int _resNum; int _rlbNum; + bool _flipHoriz; public: Visage(); Visage(const Visage &v); @@ -458,7 +483,7 @@ public: void setVisage(int resNum, int rlbNum = 9999); GfxSurface getFrame(int frameNum); int getFrameCount() const; - Visage &operator=(const Visage &s); + Visage &operator=(const Visage &gfxSurface); }; class SceneObjectWrapper : public EventHandler { @@ -542,6 +567,7 @@ public: void animate(AnimateMode animMode, ...); SceneObject *clone() const; void checkAngle(const SceneObject *obj); + void checkAngle(const Common::Point &pt); void hide(); void show(); int getSpliceArea(const SceneObject *obj); @@ -560,34 +586,20 @@ public: virtual void draw(); virtual void proc19() {} virtual void updateScreen(); - // New methods introduced by Blue FOrce - virtual void updateAngle(SceneObject *sceneObj); + // New methods introduced by Blue Force + virtual void updateAngle(const Common::Point &pt); virtual void changeAngle(int angle); void setup(int visage, int stripFrameNum, int frameNum, int posX, int posY, int priority); }; -class SceneObjectExt : public SceneObject { -public: - int _state; - - virtual void synchronize(Serializer &s) { - SceneObject::synchronize(s); - s.syncAsSint16LE(_state); - } - virtual Common::String getClassName() { return "SceneObjectExt"; } -}; - -class SceneObjectExt2: public SceneObject { +class AltSceneObject: public SceneObject { public: - int _v88, _v8A, _v8C, _v8E; - - virtual Common::String getClassName() { return "BF100Object"; } - virtual void synchronize(Serializer &s); + virtual Common::String getClassName() { return "AltObjectExt"; } virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void draw(); }; - class SceneText : public SceneObject { public: int _fontNumber; @@ -606,6 +618,7 @@ public: virtual void synchronize(Serializer &s); virtual Common::String getClassName() { return "SceneText"; } virtual GfxSurface getFrame() { return _textSurface; } + virtual void updateScreen(); }; class Player : public SceneObject { @@ -613,6 +626,7 @@ public: bool _canWalk; bool _uiEnabled; int _field8C; + bool _enabled; public: Player(); @@ -721,6 +735,7 @@ public: _objList.remove(sceneObj); _listAltered = true; } + void clear() { _objList.clear(); } }; class ScenePriorities : public Common::List<Region> { @@ -807,6 +822,7 @@ public: assert((idx >= 1) && (idx <= (int)_regionList.size())); return _regionList[idx - 1]; } + void proc1(int v) { warning("TODO: WalkRegions::proc1"); } }; /*--------------------------------------------------------------------------*/ @@ -847,6 +863,9 @@ public: int _delayTicks; Common::String _saveName; uint32 _prevFrameNumber; +protected: + virtual void playerAction(Event &event) {} + virtual void processEnd(Event &event) {} public: SceneHandler(); void registerHandler(); diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp index e3c4569dd2..2a6b4eb66b 100644 --- a/engines/tsage/debugger.cpp +++ b/engines/tsage/debugger.cpp @@ -32,6 +32,7 @@ Debugger::Debugger() : GUI::Debugger() { DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_Scene)); DCmd_Register("walk_regions", WRAP_METHOD(Debugger, Cmd_WalkRegions)); DCmd_Register("priority_regions", WRAP_METHOD(Debugger, Cmd_PriorityRegions)); + DCmd_Register("scene_regions", WRAP_METHOD(Debugger, Cmd_SceneRegions)); DCmd_Register("setflag", WRAP_METHOD(Debugger, Cmd_SetFlag)); DCmd_Register("getflag", WRAP_METHOD(Debugger, Cmd_GetFlag)); DCmd_Register("clearflag", WRAP_METHOD(Debugger, Cmd_ClearFlag)); @@ -171,6 +172,59 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) { } /* + * This command draws the scene regions onto the screen. These are the regions + * used by hotspots that have non-rectangular areas. + */ +bool Debugger::Cmd_SceneRegions(int argc, const char **argv) { + int regionNum = 0; + + // Check for an optional specific region to display + if (argc == 2) + regionNum = strToInt(argv[1]); + + // Color index to use for the first priority region + int color = 16; + int count = 0; + + // Lock the background surface for access + Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface(); + + Common::List<Region>::iterator i = _globals->_sceneRegions.begin(); + Common::String regionsDesc; + + for (; i != _globals->_sceneRegions.end(); ++i, ++color, ++count) { + Region &r = *i; + + if ((regionNum == 0) || (regionNum == (count + 1))) { + for (int y = 0; y < destSurface.h; ++y) { + byte *destP = (byte *)destSurface.getBasePtr(0, y); + + for (int x = 0; x < destSurface.w; ++x) { + if (r.contains(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + x, + _globals->_sceneManager._scene->_sceneBounds.top + y))) + *destP = color; + ++destP; + } + } + } + + regionsDesc += Common::String::format("Region id = %d bounds=%d,%d,%d,%d\n", + r._regionId, r._bounds.left, r._bounds.top, r._bounds.right, r._bounds.bottom); + } + + // Release the surface + _globals->_sceneManager._scene->_backSurface.unlockSurface(); + + // Mark the scene as requiring a full redraw + _globals->_paneRefreshFlag[0] = 2; + + DebugPrintf("Total regions = %d\n", count); + DebugPrintf("%s", regionsDesc.c_str()); + + return true; +} + +/* * This command sets a flag */ bool Debugger::Cmd_SetFlag(int argc, const char **argv) { @@ -414,7 +468,7 @@ bool Debugger::Cmd_Hotspots(int argc, const char **argv) { if (ri != _globals->_sceneRegions.end()) { // Fill out the areas defined by the region Region &r = *ri; - + for (int y = r._bounds.top; y < r._bounds.bottom; ++y) { LineSliceSet set = r.getLineSlices(y); diff --git a/engines/tsage/debugger.h b/engines/tsage/debugger.h index 8bc1b06336..fcdbc2d243 100644 --- a/engines/tsage/debugger.h +++ b/engines/tsage/debugger.h @@ -37,6 +37,7 @@ protected: bool Cmd_Scene(int argc, const char **argv); bool Cmd_WalkRegions(int argc, const char **argv); bool Cmd_PriorityRegions(int argc, const char **argv); + bool Cmd_SceneRegions(int argc, const char **argv); bool Cmd_SetFlag(int argc, const char **argv); bool Cmd_GetFlag(int argc, const char **argv); bool Cmd_ClearFlag(int argc, const char **argv); diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp index ae385b8c15..841a7b776d 100644 --- a/engines/tsage/dialogs.cpp +++ b/engines/tsage/dialogs.cpp @@ -109,186 +109,6 @@ ConfigDialog::ConfigDialog() : GUI::OptionsDialog("", "GlobalConfig") { /*--------------------------------------------------------------------------*/ -#define BUTTON_WIDTH 28 -#define BUTTON_HEIGHT 29 - -RightClickButton::RightClickButton(int buttonIndex, int xp, int yp) : GfxButton() { - _buttonIndex = buttonIndex; - this->_bounds.left = xp; - this->_bounds.top = yp; - this->_bounds.setWidth(BUTTON_WIDTH); - this->_bounds.setHeight(BUTTON_HEIGHT); - _savedButton = NULL; -} - -void RightClickButton::highlight() { - if (_savedButton) { - // Button was previously highlighted, so de-highlight by restoring saved area - _globals->gfxManager().copyFrom(*_savedButton, _bounds.left, _bounds.top); - delete _savedButton; - _savedButton = NULL; - } else { - // Highlight button by getting the needed highlighted image resource - _savedButton = Surface_getArea(_globals->gfxManager().getSurface(), _bounds); - - uint size; - byte *imgData = _resourceManager->getSubResource(7, 2, _buttonIndex, &size); - - GfxSurface btnSelected = surfaceFromRes(imgData); - _globals->gfxManager().copyFrom(btnSelected, _bounds.left, _bounds.top); - - DEALLOCATE(imgData); - } -} - -/*--------------------------------------------------------------------------*/ - -/** - * This dialog implements the right-click dialog - */ -RightClickDialog::RightClickDialog() : GfxDialog(), - _walkButton(1, 48, 12), _lookButton(2, 31, 29), _useButton(3, 65, 29), - _talkButton(4, 14, 47), _inventoryButton(5, 48, 47), _optionsButton(6, 83, 47) { - Rect rectArea, dialogRect; - - // Set the palette and change the cursor - _gfxManager.setDialogPalette(); - _globals->_events.setCursor(CURSOR_ARROW); - - // Get the dialog image - _surface = surfaceFromRes(7, 1, 1); - - // Set the dialog position - dialogRect.resize(_surface, 0, 0, 100); - dialogRect.center(_globals->_events._mousePos.x, _globals->_events._mousePos.y); - - // Ensure the dialog will be entirely on-screen - Rect screenRect = _globals->gfxManager()._bounds; - screenRect.collapse(4, 4); - dialogRect.contain(screenRect); - - _bounds = dialogRect; - _gfxManager._bounds = _bounds; - - _highlightedButton = NULL; - _selectedAction = -1; -} - -RightClickDialog::~RightClickDialog() { -} - -RightClickButton *RightClickDialog::findButton(const Common::Point &pt) { - RightClickButton *btnList[] = { &_walkButton, &_lookButton, &_useButton, &_talkButton, &_inventoryButton, &_optionsButton }; - - for (int i = 0; i < 6; ++i) { - btnList[i]->_owner = this; - - if (btnList[i]->_bounds.contains(pt)) - return btnList[i]; - } - - return NULL; -} - -void RightClickDialog::draw() { - // Save the covered background area - _savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds); - - // Draw the dialog image - _globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top); -} - -bool RightClickDialog::process(Event &event) { - switch (event.eventType) { - case EVENT_MOUSE_MOVE: { - // Check whether a button is highlighted - RightClickButton *btn = findButton(event.mousePos); - - if (btn != _highlightedButton) { - // De-highlight any previously selected button - if (_highlightedButton) { - _highlightedButton->highlight(); - _highlightedButton = NULL; - } - if (btn) { - // Highlight the new button - btn->highlight(); - _highlightedButton = btn; - } - } - event.handled = true; - return true; - } - - case EVENT_BUTTON_DOWN: - // If a button is highlighted, then flag the selected button index - if (_highlightedButton) - _selectedAction = _highlightedButton->_buttonIndex; - else - _selectedAction = _lookButton._buttonIndex; - event.handled = true; - return true; - - default: - break; - } - - return false; -} - -void RightClickDialog::execute() { - // Draw the dialog - draw(); - - // Dialog event handler loop - _gfxManager.activate(); - - while (!_vm->shouldQuit() && (_selectedAction == -1)) { - Event evt; - while (_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) { - evt.mousePos.x -= _bounds.left; - evt.mousePos.y -= _bounds.top; - - process(evt); - } - - g_system->delayMillis(10); - g_system->updateScreen(); - } - - // Execute the specified action - switch (_selectedAction) { - case 1: - // Look action - _globals->_events.setCursor(CURSOR_LOOK); - break; - case 2: - // Walk action - _globals->_events.setCursor(CURSOR_WALK); - break; - case 3: - // Use cursor - _globals->_events.setCursor(CURSOR_USE); - break; - case 4: - // Talk cursor - _globals->_events.setCursor(CURSOR_TALK); - break; - case 5: - // Inventory dialog - InventoryDialog::show(); - break; - case 6: - // Dialog options - OptionsDialog::show(); - break; - } - - _gfxManager.deactivate(); -} - -/*--------------------------------------------------------------------------*/ - void ModalDialog::draw() { // Set the palette for use in the dialog setPalette(); @@ -547,6 +367,7 @@ void OptionsDialog::show() { _globals->_game->restartGame(); } else if (btn == &dlg->_btnSound) { // Sound dialog + SoundDialog::execute(); } else if (btn == &dlg->_btnSave) { // Save button _globals->_game->saveGame(); @@ -594,5 +415,14 @@ OptionsDialog::OptionsDialog() { setCenter(160, 100); } +/*--------------------------------------------------------------------------*/ + +void SoundDialog::execute() { + ConfigDialog *dlg = new ConfigDialog(); + dlg->runModal(); + delete dlg; + _globals->_soundManager.syncSounds(); + _globals->_events.setCursorFromFlag(); +} } // End of namespace TsAGE diff --git a/engines/tsage/dialogs.h b/engines/tsage/dialogs.h index 55adb6c813..35ed60ba1a 100644 --- a/engines/tsage/dialogs.h +++ b/engines/tsage/dialogs.h @@ -49,35 +49,6 @@ public: ConfigDialog(); }; -class RightClickButton : public GfxButton { -private: - GfxSurface *_savedButton; -public: - int _buttonIndex; - - RightClickButton(int buttonIndex, int xp, int yp); - ~RightClickButton() { delete _savedButton; } - - virtual void highlight(); -}; - -class RightClickDialog : public GfxDialog { -private: - GfxSurface _surface; - RightClickButton *_highlightedButton; - int _selectedAction; - RightClickButton _walkButton, _lookButton, _useButton, _talkButton, _inventoryButton, _optionsButton; - - RightClickButton *findButton(const Common::Point &pt); -public: - RightClickDialog(); - ~RightClickDialog(); - - virtual void draw(); - virtual bool process(Event &event); - void execute(); -}; - /*--------------------------------------------------------------------------*/ class ModalDialog : public GfxDialog { @@ -128,6 +99,13 @@ public: static void show(); }; +/*--------------------------------------------------------------------------*/ + +class SoundDialog { +public: + static void execute(); +}; + } // End of namespace TsAGE #endif diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index 44c79bd2fe..d2ade971fa 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -149,6 +149,7 @@ void EventsClass::setCursor(CursorType cursorType) { const byte *cursor; bool delFlag = true; uint size; + bool questionEnabled = false; switch (cursorType) { case CURSOR_NONE: @@ -164,22 +165,40 @@ void EventsClass::setCursor(CursorType cursorType) { case CURSOR_LOOK: // Look cursor - cursor = _resourceManager->getSubResource(4, 1, 5, &size); + if (_vm->getGameID() == GType_BlueForce) + cursor = _resourceManager->getSubResource(1, 5, 3, &size); + else + cursor = _resourceManager->getSubResource(4, 1, 5, &size); _currentCursor = CURSOR_LOOK; break; case CURSOR_USE: // Use cursor - cursor = _resourceManager->getSubResource(4, 1, 4, &size); + if (_vm->getGameID() == GType_BlueForce) { + cursor = _resourceManager->getSubResource(1, 5, 2, &size); + } else { + cursor = _resourceManager->getSubResource(4, 1, 4, &size); + } _currentCursor = CURSOR_USE; break; case CURSOR_TALK: // Talk cursor - cursor = _resourceManager->getSubResource(4, 1, 3, &size); + if (_vm->getGameID() == GType_BlueForce) { + cursor = _resourceManager->getSubResource(1, 5, 4, &size); + } else { + cursor = _resourceManager->getSubResource(4, 1, 3, &size); + } _currentCursor = CURSOR_TALK; break; + case CURSOR_EXIT: + // Exit cursor (Blue Force) + assert(_vm->getGameID() == GType_BlueForce); + cursor = _resourceManager->getSubResource(1, 5, 7, &size); + _currentCursor = CURSOR_EXIT; + break; + case CURSOR_ARROW: // Arrow cursor cursor = CURSOR_ARROW_DATA; @@ -188,10 +207,22 @@ void EventsClass::setCursor(CursorType cursorType) { case CURSOR_WALK: default: - // Walk cursor - cursor = CURSOR_WALK_DATA; - _currentCursor = CURSOR_WALK; - delFlag = false; + if (_vm->getGameID() == GType_BlueForce) { + if (cursorType == CURSOR_WALK) { + cursor = _resourceManager->getSubResource(1, 5, 1, &size); + } else { + // Inventory icon + cursor = _resourceManager->getSubResource(10, ((int)cursorType - 1) / 20 + 1, + ((int)cursorType - 1) % 20 + 1, &size); + questionEnabled = true; + } + _currentCursor = cursorType; + } else { + // For Ringworld, always treat as the walk cursor + cursor = CURSOR_WALK_DATA; + _currentCursor = CURSOR_WALK; + delFlag = false; + } break; } @@ -205,6 +236,10 @@ void EventsClass::setCursor(CursorType cursorType) { if (delFlag) DEALLOCATE(cursor); + + // For Blue Force, enable the question button when an inventory icon is selected + if (_vm->getGameID() == GType_BlueForce) + BF_GLOBALS._uiElements._question.setEnabled(questionEnabled); } void EventsClass::pushCursor(CursorType cursorType) { @@ -270,6 +305,17 @@ void EventsClass::setCursor(Graphics::Surface &cursor, int transColor, const Com _currentCursor = cursorId; } +void EventsClass::setCursor(GfxSurface &cursor) { + // TODO: Find proper parameters for this form in Blue Force + Graphics::Surface s = cursor.lockSurface(); + + const byte *cursorData = (const byte *)s.getBasePtr(0, 0); + CursorMan.replaceCursor(cursorData, cursor.getBounds().width(), cursor.getBounds().height(), + cursor._centroid.x, cursor._centroid.y, cursor._transColor); + + _lastCursor = CURSOR_NONE; +} + void EventsClass::setCursorFromFlag() { setCursor(isCursorVisible() ? _currentCursor : CURSOR_NONE); } @@ -278,8 +324,10 @@ void EventsClass::showCursor() { setCursor(_currentCursor); } -void EventsClass::hideCursor() { +CursorType EventsClass::hideCursor() { + CursorType oldCursor = _currentCursor; setCursor(CURSOR_NONE); + return oldCursor; } bool EventsClass::isCursorVisible() const { diff --git a/engines/tsage/events.h b/engines/tsage/events.h index c36db59270..3680250ee9 100644 --- a/engines/tsage/events.h +++ b/engines/tsage/events.h @@ -54,6 +54,7 @@ public: }; enum CursorType { + // Ringworld objects OBJECT_STUNNER = 0, OBJECT_SCANNER = 1, OBJECT_STASIS_BOX = 2, OBJECT_INFODISK = 3, OBJECT_STASIS_NEGATOR = 4, OBJECT_KEY_DEVICE = 5, OBJECT_MEDKIT = 6, OBJECT_LADDER = 7, OBJECT_ROPE = 8, OBJECT_KEY = 9, OBJECT_TRANSLATOR = 10, OBJECT_ALE = 11, @@ -63,10 +64,32 @@ enum CursorType { OBJECT_NULLIFIER = 25, OBJECT_PEG = 26, OBJECT_VIAL = 27, OBJECT_JACKET = 28, 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_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_WHAREHOUSE_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_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, + BF_LAST_INVENT = 67, + + // Cursors CURSOR_WALK = 0x100, CURSOR_LOOK = 0x200, CURSOR_700 = 700, CURSOR_USE = 0x400, CURSOR_TALK = 0x800, + CURSOR_1000 = 0x1000, CURSOR_EXIT = 0x7004, CURSOR_NONE = -1, CURSOR_CROSSHAIRS = -2, CURSOR_ARROW = -3 }; +class GfxSurface; + class EventsClass : public SaveListener { private: Common::Event _event; @@ -84,10 +107,11 @@ public: void pushCursor(CursorType cursorType); void popCursor(); void setCursor(Graphics::Surface &cursor, int transColor, const Common::Point &hotspot, CursorType cursorId); + void setCursor(GfxSurface &cursor); void setCursorFromFlag(); CursorType getCursor() const { return _currentCursor; } void showCursor(); - void hideCursor(); + CursorType hideCursor(); bool isCursorVisible() const; bool pollEvent(); @@ -98,6 +122,7 @@ public: Common::EventType type() { return _event.type; } uint32 getFrameNumber() const { return _frameNumber; } void delay(int numFrames); + bool isInventoryIcon() const { return _currentCursor < 256; } virtual void listenerSynchronize(Serializer &s); static void loadNotifierProc(bool postFlag); diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 27067c7d1c..1895fbc2d2 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -74,7 +74,7 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface _gfxColors.foreground = 83; _fontColors.background = 88; _fontColors.foreground = 92; - _dialogCenter.y = 165; + _dialogCenter.y = 140; } else if ((_vm->getGameID() == GType_Ringworld) && (_vm->getFeatures() & GF_CD)) { _gfxFontNumber = 50; _gfxColors.background = 53; @@ -121,6 +121,7 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface case GType_BlueForce: _game = new BlueForce::BlueForceGame(); + _inventory = new BlueForce::BlueForceInvObjectList(); _sceneHandler = new BlueForce::SceneHandlerExt(); break; } @@ -183,32 +184,79 @@ void Globals::dispatchSounds() { namespace BlueForce { BlueForceGlobals::BlueForceGlobals(): Globals() { +} + +void BlueForceGlobals::synchronize(Serializer &s) { + Globals::synchronize(s); + + s.syncAsSint16LE(_dayNumber); + s.syncAsSint16LE(_v4CEA4); + s.syncAsSint16LE(_deathReason); + s.syncAsSint16LE(_driveFromScene); + s.syncAsSint16LE(_driveToScene); + s.syncAsSint16LE(_v4CF9E); + s.syncAsSint16LE(_v4E238); + s.syncAsSint16LE(_v501FC); + s.syncAsSint16LE(_v50696); + s.syncAsSint16LE(_v51C42); + s.syncAsSint16LE(_v51C44); + s.syncAsSint16LE(_interfaceY); + s.syncAsSint16LE(_bookmark); + s.syncAsSint16LE(_mapLocationId); + s.syncAsSint16LE(_clip1Bullets); + s.syncAsSint16LE(_clip2Bullets); + +} + +void BlueForceGlobals::reset() { + Globals::reset(); + _scenePalette.clearListeners(); + + _scrollFollower = &_player; + _bookmark = bNone; + + // Reset the inventory + ((BlueForceInvObjectList *)_inventory)->reset(); + BF_GLOBALS._uiElements.updateInventory(); + BF_GLOBALS._uiElements._scoreValue = 0; + + _mapLocationId = 1; + _driveFromScene = 300; + _driveToScene = 0; + _interfaceY = 0; _v51C44 = 1; - _v4CEA2 = 0; - _v4CEA8 = 0; - _v4CEF2 = 0; - _v4CEF4 = 0; + _dayNumber = 0; + _v4CEA4 = 0; + _deathReason = 0; _v4CF9E = 0; _v4E238 = 0; + _v50696 = 0; _v501FC = 0; + _v5098C = 0; + _v5098D = 0; _v51C42 = 0; - _bikiniHutState = 0; - _mapLocationId = 1; - Common::set_to(&_globalFlags[0], &_globalFlags[12], 0); + _clip1Bullets = 8; + _clip2Bullets = 8; } -void BlueForceGlobals::synchronize(Serializer &s) { - Globals::synchronize(s); - error("Sync variables"); +bool BlueForceGlobals::getHasBullets() { + if (!getFlag(fGunLoaded)) + return false; + return BF_GLOBALS.getFlag(fLoadedSpare) ? (_clip2Bullets > 0) : (_clip1Bullets > 0); } -bool BlueForceGlobals::getFlag(int v) { - return _globalFlags[v / 16] & (1 << (v % 8)); +void BlueForceGlobals::set2Flags(int flagNum) { + if (!getFlag(flagNum + 1)) { + setFlag(flagNum + 1); + setFlag(flagNum); + } } -void BlueForceGlobals::setFlag(int v) { - _globalFlags[v / 16] |= 1 << (v % 8); +bool BlueForceGlobals::removeFlag(int flagNum) { + bool result = getFlag(flagNum); + clearFlag(flagNum); + return result; } } // end of namespace BlueForce diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index 2d409b6343..651a0c8893 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -30,6 +30,7 @@ #include "tsage/events.h" #include "tsage/sound.h" #include "tsage/saveload.h" +#include "tsage/blue_force/blueforce_ui.h" namespace TsAGE { @@ -110,29 +111,88 @@ namespace BlueForce { using namespace TsAGE; +enum Bookmark { + bNone, + bStartOfGame, bCalledToDomesticViolence, bArrestedGreen, bLauraToParamedics, + bBookedGreen, bStoppedFrankie, bBookedFrankie, bBookedFrankieEvidence, + bEndOfWorkDayOne, bTalkedToGrannyAboutSkipsCard, bLyleStoppedBy, bEndDayOne, + bInspectionDone, bCalledToDrunkStop, bArrestedDrunk, bEndDayTwo, + bFlashBackOne, bFlashBackTwo, bFlashBackThree, bDroppedOffLyle, bEndDayThree, + bDoneWithIsland, bDoneAtLyles, bEndDayFour, bInvestigateBoat, bFinishedWGreen, + bAmbushed, bAmbushOver, bEndOfGame +}; + +enum Flag { + JAKE_FILE_COPIED, gunClean, onBike, onDuty, fShowedIdToKate, fLateToMarina, + fCalledBackup, fWithLyle, gunDrawn, fBackupArrived340, fBriefedBackup, + fGotAllSkip340, fToldToLeave340, fBackupIn350, fNetInBoat, fForbesWaiting, + fWithCarter, fTalkedToTony, fMugOnKate, takenWeasel, gotTrailer450, + showEugeneNapkin, showRapEugene, fMgrCallsWeasel, fCarterMetLyle, + fGunLoaded, fLoadedSpare, showEugeneID, fRandomShot350, examinedFile810, + shownLyleCrate1, shownLyleRapsheet, shownLyleDisk, shownLylePO, + fCanDrawGun, fGotAutoWeapon, fGotBulletsFromDash, fShotSuttersDesk, + greenTaken, fLateToDrunkStop, didDrunk, fSearchedTruck, seenFolder, + showMugAround, frankInJail, fTalkedCarterDay3, fDecryptedBluePrints, + fTalkedToDrunkInCar, fToldLyleOfSchedule, fTalkedShooterNoBkup, + fTalkedDriverNoBkup, fDriverOutOfTruck, readGreenRights, readFrankRights, + talkedToHarrisAboutDrunk, unlockBoat, fShootGoon, fBlowUpGoon, + fTalkedToBarry, fTalkedToLarry, fLeftTraceIn920, fLeftTraceIn900, + fBackupAt340, fShotNicoIn910, fGotPointsForTktBook, fGotPointsForMCard, + fShowedBluePrint, fGotPointsForPunch, fGotPointsForBox, fGotPointsForBank, + fGotPointsForCombo, fGotPointsForCoin, fGotPointsForCPU, fGotPointsForBoots, + fGotPointsForCrate, fGotPointsForBlackCord, fGotPointsForGeneratorPlug, + fGotPointsForFuseBoxPlug, fGotPointsForStartGenerator, fGotPointsForLightsOn, + fGotPointsForOpeningDoor, fGotPointsForClosingDoor, fGotPointsForLightsOff, + fGotPointsForGeneratorOff, fGotPointsForCordOnForklift, fGotPointsForCuffingNico, + fGotPointsForCuffingDA, fGotPointsForSearchingNico, fGotPointsForSearchingDA, + fLeftTraceIn910, fBookedGreenEvidence, fGotPointsForCleaningGun, + fGotPointsForMemo, fGotPointsForFBI, fTookTrailerAmmo, fAlertedGreen355, + fGotGreen355fTalkedToGrannyDay3, shownFax, beenToJRDay2, shownLyleCrate1Day1, + fLyleOnIsland, iWasAmbushed, fGangInCar, fArrivedAtGangStop, ticketVW, + f1015Marina, fCan1015Marina, f1015Frankie, fCan1015Frankie, f1015Drunk, + fCan1015Drunk, f1027Marina, fCan1027Marina, f1027Frankie, fCan1027Frankie, + f1027Drunk, fCan1027Drunk, f1035Marina, fCan1035Marina, f1035Frankie, + fCan1035Frankie, f1035Drunk, fCan1035Drunk, f1097Marina, fCan1097Marina, + f1097Frankie, fCan1097Frankie, f1097Drunk, fCan1097Drunk, f1098Marina, + fCan1098Marina, f1098Frankie, fCan1098Frankie, f1098Drunk, fCan1098Drunk, + fCuffedFrankie, fGotPointsForTrapDog, fGotPointsForUnlockGate, + fGotPointsForUnlockWarehouse, fGotPointsForLockWarehouse, fGotPointsForLockGate, + fGotPointsForFreeDog, fGotPointsForWhistleDog, fGivenNapkin, fCan1004Marina, + fCan1004Drunk, fHasLeftDrunk, fHasDrivenFromDrunk, fCrateOpen, fSawGuns, + hookPoints +}; + class BlueForceGlobals: public Globals { public: ASoundExt _sound1, _sound2, _sound3; - int _v4CEA2; - int _v4CEA8; - int _v4CEF2; - int _v4CEF4; + UIElements _uiElements; + StripProxy _stripProxy; + int _dayNumber; + int _v4CEA4; + int _deathReason; + int _driveFromScene; + int _driveToScene; int _v4CF9E; int _v4E238; int _v501FC; + int _v50696; + uint8 _v5098C; + uint8 _v5098D; int _v51C42; int _v51C44; int _interfaceY; - int _bikiniHutState; + Bookmark _bookmark; int _mapLocationId; - uint8 _globalFlags[12]; + int _clip1Bullets, _clip2Bullets; BlueForceGlobals(); + void reset(); + bool getHasBullets(); + virtual Common::String getClassName() { return "BFGlobals"; } virtual void synchronize(Serializer &s); - - void setFlag(int v); - bool getFlag(int v); + void set2Flags(int flagNum); + bool removeFlag(int flagNum); }; } // End of namespace BlueForce diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 1884bfb4f5..69c9995b93 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -1069,12 +1069,23 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) { } void GfxDialog::setPalette() { - _globals->_scenePalette.loadPalette(0); - _globals->_scenePalette.setPalette(0, 1); - _globals->_scenePalette.setPalette(_globals->_scenePalette._colors.foreground, 1); - _globals->_scenePalette.setPalette(_globals->_fontColors.background, 1); - _globals->_scenePalette.setPalette(_globals->_fontColors.foreground, 1); - _globals->_scenePalette.setPalette(255, 1); + if (_vm->getGameID() == GType_BlueForce) { + _globals->_scenePalette.loadPalette(2); + _globals->_scenePalette.setPalette(0, 1); + _globals->_scenePalette.setPalette(_globals->_gfxColors.background, 1); + _globals->_scenePalette.setPalette(_globals->_gfxColors.foreground, 1); + _globals->_scenePalette.setPalette(_globals->_fontColors.background, 1); + _globals->_scenePalette.setPalette(_globals->_fontColors.foreground, 1); + _globals->_scenePalette.setEntry(255, 0xff, 0xff, 0xff); + _globals->_scenePalette.setPalette(255, 1); + } else { + _globals->_scenePalette.loadPalette(0); + _globals->_scenePalette.setPalette(0, 1); + _globals->_scenePalette.setPalette(_globals->_scenePalette._colors.foreground, 1); + _globals->_scenePalette.setPalette(_globals->_fontColors.background, 1); + _globals->_scenePalette.setPalette(_globals->_fontColors.foreground, 1); + _globals->_scenePalette.setPalette(255, 1); + } } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk index 5c7104936e..b0279c0260 100644 --- a/engines/tsage/module.mk +++ b/engines/tsage/module.mk @@ -1,9 +1,14 @@ MODULE := engines/tsage MODULE_OBJS := \ + blue_force/blueforce_dialogs.o \ blue_force/blueforce_logic.o \ blue_force/blueforce_scenes0.o \ blue_force/blueforce_scenes1.o \ + blue_force/blueforce_scenes3.o \ + blue_force/blueforce_scenes6.o \ + blue_force/blueforce_speakers.o \ + blue_force/blueforce_ui.o \ converse.o \ core.o \ debugger.o \ @@ -14,6 +19,7 @@ MODULE_OBJS := \ graphics.o \ resources.o \ ringworld/ringworld_demo.o \ + ringworld/ringworld_dialogs.o \ ringworld/ringworld_logic.o \ ringworld/ringworld_scenes1.o \ ringworld/ringworld_scenes2.o \ @@ -23,6 +29,7 @@ MODULE_OBJS := \ ringworld/ringworld_scenes6.o \ ringworld/ringworld_scenes8.o \ ringworld/ringworld_scenes10.o \ + ringworld/ringworld_speakers.o \ saveload.o \ scenes.o \ sound.o \ diff --git a/engines/tsage/ringworld/ringworld_dialogs.cpp b/engines/tsage/ringworld/ringworld_dialogs.cpp new file mode 100644 index 0000000000..ca4ccbc7c5 --- /dev/null +++ b/engines/tsage/ringworld/ringworld_dialogs.cpp @@ -0,0 +1,222 @@ +/* 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 "common/translation.h" + +#include "gui/dialog.h" +#include "gui/widget.h" + +#include "tsage/tsage.h" +#include "tsage/core.h" +#include "tsage/dialogs.h" +#include "tsage/staticres.h" +#include "tsage/globals.h" +#include "tsage/ringworld/ringworld_dialogs.h" +#include "tsage/ringworld/ringworld_logic.h" + +namespace TsAGE { + +namespace Ringworld { + +/*--------------------------------------------------------------------------*/ + +#define BUTTON_WIDTH 28 +#define BUTTON_HEIGHT 29 + +RightClickButton::RightClickButton(int buttonIndex, int xp, int yp) : GfxButton() { + _buttonIndex = buttonIndex; + this->_bounds.left = xp; + this->_bounds.top = yp; + this->_bounds.setWidth(BUTTON_WIDTH); + this->_bounds.setHeight(BUTTON_HEIGHT); + _savedButton = NULL; +} + +void RightClickButton::highlight() { + if (_savedButton) { + // Button was previously highlighted, so de-highlight by restoring saved area + _globals->gfxManager().copyFrom(*_savedButton, _bounds.left, _bounds.top); + delete _savedButton; + _savedButton = NULL; + } else { + // Highlight button by getting the needed highlighted image resource + _savedButton = Surface_getArea(_globals->gfxManager().getSurface(), _bounds); + + uint size; + byte *imgData = _resourceManager->getSubResource(7, 2, _buttonIndex, &size); + + GfxSurface btnSelected = surfaceFromRes(imgData); + _globals->gfxManager().copyFrom(btnSelected, _bounds.left, _bounds.top); + + DEALLOCATE(imgData); + } +} + +/*--------------------------------------------------------------------------*/ + +/** + * This dialog implements the right-click dialog + */ +RightClickDialog::RightClickDialog() : GfxDialog(), + _walkButton(1, 48, 12), _lookButton(2, 31, 29), _useButton(3, 65, 29), + _talkButton(4, 14, 47), _inventoryButton(5, 48, 47), _optionsButton(6, 83, 47) { + Rect rectArea, dialogRect; + + // Set the palette and change the cursor + _gfxManager.setDialogPalette(); + _globals->_events.setCursor(CURSOR_ARROW); + + // Get the dialog image + _surface = surfaceFromRes(7, 1, 1); + + // Set the dialog position + dialogRect.resize(_surface, 0, 0, 100); + dialogRect.center(_globals->_events._mousePos.x, _globals->_events._mousePos.y); + + // Ensure the dialog will be entirely on-screen + Rect screenRect = _globals->gfxManager()._bounds; + screenRect.collapse(4, 4); + dialogRect.contain(screenRect); + + _bounds = dialogRect; + _gfxManager._bounds = _bounds; + + _highlightedButton = NULL; + _selectedAction = -1; +} + +RightClickDialog::~RightClickDialog() { +} + +RightClickButton *RightClickDialog::findButton(const Common::Point &pt) { + RightClickButton *btnList[] = { &_walkButton, &_lookButton, &_useButton, &_talkButton, &_inventoryButton, &_optionsButton }; + + for (int i = 0; i < 6; ++i) { + btnList[i]->_owner = this; + + if (btnList[i]->_bounds.contains(pt)) + return btnList[i]; + } + + return NULL; +} + +void RightClickDialog::draw() { + // Save the covered background area + _savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds); + + // Draw the dialog image + _globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top); +} + +bool RightClickDialog::process(Event &event) { + switch (event.eventType) { + case EVENT_MOUSE_MOVE: { + // Check whether a button is highlighted + RightClickButton *btn = findButton(event.mousePos); + + if (btn != _highlightedButton) { + // De-highlight any previously selected button + if (_highlightedButton) { + _highlightedButton->highlight(); + _highlightedButton = NULL; + } + if (btn) { + // Highlight the new button + btn->highlight(); + _highlightedButton = btn; + } + } + event.handled = true; + return true; + } + + case EVENT_BUTTON_DOWN: + // If a button is highlighted, then flag the selected button index + if (_highlightedButton) + _selectedAction = _highlightedButton->_buttonIndex; + else + _selectedAction = _lookButton._buttonIndex; + event.handled = true; + return true; + + default: + break; + } + + return false; +} + +void RightClickDialog::execute() { + // Draw the dialog + draw(); + + // Dialog event handler loop + _gfxManager.activate(); + + while (!_vm->shouldQuit() && (_selectedAction == -1)) { + Event evt; + while (_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) { + evt.mousePos.x -= _bounds.left; + evt.mousePos.y -= _bounds.top; + + process(evt); + } + + g_system->delayMillis(10); + g_system->updateScreen(); + } + + // Execute the specified action + switch (_selectedAction) { + case 1: + // Look action + _globals->_events.setCursor(CURSOR_LOOK); + break; + case 2: + // Walk action + _globals->_events.setCursor(CURSOR_WALK); + break; + case 3: + // Use cursor + _globals->_events.setCursor(CURSOR_USE); + break; + case 4: + // Talk cursor + _globals->_events.setCursor(CURSOR_TALK); + break; + case 5: + // Inventory dialog + InventoryDialog::show(); + break; + case 6: + // Dialog options + OptionsDialog::show(); + break; + } + + _gfxManager.deactivate(); +} + +} // End of namespace Ringworld + +} // End of namespace TsAGE diff --git a/engines/tsage/ringworld/ringworld_dialogs.h b/engines/tsage/ringworld/ringworld_dialogs.h new file mode 100644 index 0000000000..11a8f10e70 --- /dev/null +++ b/engines/tsage/ringworld/ringworld_dialogs.h @@ -0,0 +1,70 @@ +/* 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_RINGWORLD_DIALOGS_H +#define TSAGE_RINGWORLD_DIALOGS_H + +#include "gui/options.h" +#include "tsage/events.h" +#include "tsage/graphics.h" +#include "common/list.h" +#include "common/rect.h" +#include "common/system.h" + +namespace TsAGE { + +namespace Ringworld { + +class RightClickButton : public GfxButton { +private: + GfxSurface *_savedButton; +public: + int _buttonIndex; + + RightClickButton(int buttonIndex, int xp, int yp); + ~RightClickButton() { delete _savedButton; } + + virtual void highlight(); +}; + +class RightClickDialog : public GfxDialog { +private: + GfxSurface _surface; + RightClickButton *_highlightedButton; + int _selectedAction; + RightClickButton _walkButton, _lookButton, _useButton, _talkButton, _inventoryButton, _optionsButton; + + RightClickButton *findButton(const Common::Point &pt); +public: + RightClickDialog(); + ~RightClickDialog(); + + virtual void draw(); + virtual bool process(Event &event); + void execute(); +}; + +} // End of namespace Ringworld + +} // End of namespace TsAGE + +#endif diff --git a/engines/tsage/ringworld/ringworld_logic.cpp b/engines/tsage/ringworld/ringworld_logic.cpp index 2a34e49b39..a131969633 100644 --- a/engines/tsage/ringworld/ringworld_logic.cpp +++ b/engines/tsage/ringworld/ringworld_logic.cpp @@ -21,13 +21,12 @@ */ #include "common/config-manager.h" -#include "common/translation.h" -#include "gui/saveload.h" #include "tsage/ringworld/ringworld_logic.h" #include "tsage/scenes.h" #include "tsage/tsage.h" #include "tsage/staticres.h" #include "tsage/ringworld/ringworld_demo.h" +#include "tsage/ringworld/ringworld_dialogs.h" #include "tsage/ringworld/ringworld_scenes1.h" #include "tsage/ringworld/ringworld_scenes2.h" #include "tsage/ringworld/ringworld_scenes3.h" @@ -330,878 +329,6 @@ void SceneArea::synchronize(Serializer &s) { /*--------------------------------------------------------------------------*/ -SpeakerGText::SpeakerGText() { - _speakerName = "GTEXT"; - _textWidth = 160; - _textPos = Common::Point(130, 10); - _color1 = 42; - _hideObjects = false; -} - -void SpeakerGText::setText(const Common::String &msg) { - // Set the animation properties - _sceneObject.postInit(); - _sceneObject.setVisage(9405); - _sceneObject.setStrip2(3); - _sceneObject.fixPriority(255); - _sceneObject.changeZoom(100); - _sceneObject._frame = 1; - _sceneObject.setPosition(Common::Point(183, 71)); - _sceneObject.animate(ANIM_MODE_7, 0, NULL); - - // Set the text - Rect textRect; - _globals->gfxManager()._font.getStringBounds(msg.c_str(), textRect, _textWidth); - textRect.center(_sceneObject._position.x, _sceneObject._position.y); - _textPos.x = textRect.left; - Speaker::setText(msg); -} - -void SpeakerGText::removeText() { - _sceneObject.remove(); - Speaker::removeText(); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerPOR::SpeakerPOR() { - _speakerName = "POR"; - _newSceneNumber = 7221; - _textPos = Common::Point(10, 30); - _color1 = 41; -} - -void SpeakerPOR::SpeakerAction1::signal(){ - switch (_actionIndex++) { - case 0: - setDelay(_globals->_randomSource.getRandomNumber(60) + 60); - break; - case 1: - static_cast<SceneObject *>(_owner)->animate(ANIM_MODE_5, this, NULL); - break; - case 2: - setDelay(_globals->_randomSource.getRandomNumber(10)); - _actionIndex = 0; - break; - default: - break; - } -} - -void SpeakerPOR::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(7223); - _object1.setStrip2(2); - _object1.setPosition(Common::Point(191, 166)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(7223); - _object2.setPosition(Common::Point(159, 86)); - _object2.setAction(&_speakerAction, NULL); - - _object3.postInit(&_objectList); - _object3.setVisage(7223); - _object3.setStrip(3); - _object3.setPosition(Common::Point(119, 107)); - _object3.fixPriority(199); - _object3.setAction(&_action2); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerOR::SpeakerOR() { - _speakerName = "OR"; - _newSceneNumber = 9430; - _textPos = Common::Point(8, 36); - _color1 = 42; - _textWidth = 136; -} - -void SpeakerOR::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(9431); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(202, 147)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(9431); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.setZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(199, 85)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerOText::SpeakerOText() : SpeakerGText() { - _speakerName = "OTEXT"; - _textWidth = 240; - _textPos = Common::Point(130, 10); - _color1 = 42; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerQText::SpeakerQText() : ScreenSpeaker() { - _speakerName = "QTEXT"; - _textPos = Common::Point(160, 40); - _color1 = 35; - _textWidth = 240; - _textMode = ALIGN_CENTER; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerSText::SpeakerSText() : ScreenSpeaker() { - _speakerName = "STEXT"; - _color1 = 13; - _textWidth = 240; - _textMode = ALIGN_CENTER; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerPOText::SpeakerPOText() : ScreenSpeaker() { - _speakerName = "POTEXT"; - _textWidth = 240; - _textMode = ALIGN_CENTER; - _color1 = 41; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerMText::SpeakerMText() { - _speakerName = "MTEXT"; - _color1 = 22; - _textWidth = 230; - _textMode = ALIGN_CENTER; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerCText::SpeakerCText() { - _speakerName = "CTEXT"; - _color1 = 4; - _textWidth = 240; - _textMode = ALIGN_CENTER; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerEText::SpeakerEText() { - _speakerName = "ETEXT"; - _textPos = Common::Point(20, 20); - _color1 = 22; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerGR::SpeakerGR() : AnimatedSpeaker() { - _speakerName = "GR"; - _newSceneNumber = 9220; - _textWidth = 136; - _textPos = Common::Point(168, 36); - _color1 = 14; -} - -void SpeakerGR::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(9221); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(101, 70)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerHText::SpeakerHText() { - _speakerName = "HTEXT"; - _textPos = Common::Point(160, 40); - _color1 = 52; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerSKText::SpeakerSKText() : ScreenSpeaker() { - _speakerName = "SKTEXT"; - _textWidth = 240; - _textMode = ALIGN_CENTER; - _color1 = 9; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerPText::SpeakerPText() { - _speakerName = "PTEXT"; - _textWidth = 240; - _textMode = ALIGN_CENTER; - _color1 = 5; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerCHFText::SpeakerCHFText() { - _speakerName = "CHFTEXT"; - _textWidth = 240; - _textMode = ALIGN_CENTER; - _color1 = 56; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerCDRText::SpeakerCDRText() { - _speakerName = "CDRTEXT"; - _textWidth = 240; - _textMode = ALIGN_CENTER; - _color1 = 52; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerFLText::SpeakerFLText() { - _speakerName = "FLTEXT"; - _textPos = Common::Point(10, 40); - _color1 = 17; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerBatText::SpeakerBatText() { - _speakerName = "BATTEXT"; - _textWidth = 240; - _textMode = ALIGN_CENTER; - _color1 = 3; - _hideObjects = false; -} - -/*--------------------------------------------------------------------------*/ - -SpeakerSKL::SpeakerSKL() : AnimatedSpeaker() { - _speakerName = "SKL"; - _newSceneNumber = 7011; - _textPos = Common::Point(10, 30); - _color1 = 9; -} - -void SpeakerSKL::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(7013); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(203, 120)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(7013); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(197, 80)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerQL::SpeakerQL() : AnimatedSpeaker() { - _speakerName = "QL"; - _newSceneNumber = 2610; - _textPos = Common::Point(160, 30); - _color1 = 35; - _textMode = ALIGN_CENTER; -} - -void SpeakerQL::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(2612); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(128, 146)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(2612); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(122, 84)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerSR::SpeakerSR() { - _speakerName = "SR"; - _newSceneNumber = 2811; - _textPos = Common::Point(10, 30); - _color1 = 13; - _textMode = ALIGN_CENTER; -} - -void SpeakerSR::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(2813); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(224, 198)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(2813); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(203, 96)); - _object2.setAction(&_speakerAction, NULL); - - _object3.postInit(&_objectList); - _object3.setVisage(2813); - _object3.setStrip(3); - _object3.setPosition(Common::Point(204, 91)); - _object3.fixPriority(199); - _object3._numFrames = 3; - _object3.animate(ANIM_MODE_7, 0, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerSL::SpeakerSL() { - _speakerName = "SL"; - _newSceneNumber = 2810; - _textPos = Common::Point(140, 30); - _textWidth = 160; - _color1 = 13; - _textMode = ALIGN_CENTER; -} - -void SpeakerSL::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(2812); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(95, 198)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(2812); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(116, 96)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerQR::SpeakerQR() { - _speakerName = "QR"; - _newSceneNumber = 2611; - _textPos = Common::Point(10, 30); - _color1 = 35; - _textMode = ALIGN_CENTER; -} - -void SpeakerQR::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(2613); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(191, 146)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(2613); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(197, 84)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerQU::SpeakerQU() { - _speakerName = "QU"; - _newSceneNumber = 7020; - _textPos = Common::Point(160, 30); - _color1 = 35; - _textMode = ALIGN_CENTER; -} - -void SpeakerQU::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(7021); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(116, 120)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(7021); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(111, 84)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerCR::SpeakerCR() { - _speakerName = "CR"; - _newSceneNumber = 9010; - _textPos = Common::Point(20, 40); - _color1 = 4; -} - -void SpeakerCR::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(9011); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.setPosition(Common::Point(219, 168)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(9011); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.setPosition(Common::Point(232, 81)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerMR::SpeakerMR() { - _speakerName = "MR"; - _newSceneNumber = 2711; - _textPos = Common::Point(10, 40); - _color1 = 22; -} - -void SpeakerMR::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(2713); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(220, 143)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(2713); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(215, 99)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerSAL::SpeakerSAL() { - _speakerName = "SAL"; - _newSceneNumber = 2851; - _textPos = Common::Point(10, 30); - _color1 = 13; - _textMode = ALIGN_CENTER; -} - -void SpeakerSAL::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(2853); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(185, 200)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(2853); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(170, 92)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerML::SpeakerML() { - _speakerName = "ML"; - _newSceneNumber = 2710; - _textPos = Common::Point(160, 40); - _color1 = 22; -} - -void SpeakerML::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(2712); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(99, 143)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(2712); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(105, 99)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerCHFL::SpeakerCHFL() { - _speakerName = "CHFL"; - _newSceneNumber = 4111; - _textPos = Common::Point(10, 40); - _color1 = 56; -} - -void SpeakerCHFL::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(4113); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(205, 116)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(4113); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(202, 71)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerCHFR::SpeakerCHFR() { - _speakerName = "CHFR"; - _newSceneNumber = 4110; - _textPos = Common::Point(160, 40); - _color1 = 56; -} - -void SpeakerCHFR::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(4112); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(103, 116)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(4112); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(106, 71)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerPL::SpeakerPL() { - _speakerName = "PL"; - _newSceneNumber = 4060; - _textPos = Common::Point(160, 40); - _color1 = 5; -} - -void SpeakerPL::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(4062); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(107, 117)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(4062); - _object2.setStrip2(1); - _object2.fixPriority(200); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(105, 62)); - _object2.setAction(&_speakerAction, NULL); - - _object3.postInit(&_objectList); - _object3.setVisage(4062); - _object3.setStrip2(3); - _object3.fixPriority(255); - _object3.changeZoom(100); - _object3._frame = 1; - _object3.setPosition(Common::Point(105, 59)); - _object3.setAction(&_speakerAction2, NULL); - - Speaker::setText(msg); -} - -void SpeakerPL::removeText() { - _object3.remove(); - AnimatedSpeaker::removeText(); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerPR::SpeakerPR() { - _speakerName = "PR"; - _newSceneNumber = 4061; - _textPos = Common::Point(10, 40); - _color1 = 5; -} - -void SpeakerPR::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(4063); - _object1.setStrip2(1); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(212, 117)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(4063); - _object2.setStrip2(2); - _object2.fixPriority(200); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(214, 62)); - _object2.setAction(&_speakerAction, NULL); - - _object3.postInit(&_objectList); - _object3.setVisage(4063); - _object3.setStrip2(3); - _object3.fixPriority(255); - _object3.changeZoom(100); - _object3._frame = 1; - _object3.setPosition(Common::Point(214, 59)); - _object3.setAction(&_speakerAction2, NULL); - - Speaker::setText(msg); -} - -void SpeakerPR::removeText() { - _object3.remove(); - AnimatedSpeaker::removeText(); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerCDR::SpeakerCDR() { - _speakerName = "CDR"; - _newSceneNumber = 4161; - _textPos = Common::Point(10, 40); - _color1 = 52; -} - -void SpeakerCDR::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(4163); - _object1.setStrip2(1); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(208, 97)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(4163); - _object2.setStrip2(2); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(200, 57)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerCDL::SpeakerCDL() { - _speakerName = "CDL"; - _newSceneNumber = 4160; - _textPos = Common::Point(160, 40); - _color1 = 52; -} - -void SpeakerCDL::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(4162); - _object1.setStrip2(1); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(112, 97)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(4162); - _object2.setStrip2(2); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(115, 57)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerFLL::SpeakerFLL() { - _speakerName = "FLL"; - _newSceneNumber = 5221; - _textPos = Common::Point(10, 40); - _color1 = 17; -} - -void SpeakerFLL::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(5223); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(216, 129)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(5223); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(210, 67)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - -SpeakerBatR::SpeakerBatR() { - _speakerName = "BATR"; - _newSceneNumber = 5360; - _textPos = Common::Point(140, 40); - _color1 = 3; -} - -void SpeakerBatR::setText(const Common::String &msg) { - _object1.postInit(&_objectList); - _object1.setVisage(5361); - _object1.setStrip2(2); - _object1.fixPriority(255); - _object1.changeZoom(100); - _object1._frame = 1; - _object1.setPosition(Common::Point(137, 122)); - _object1.animate(ANIM_MODE_7, 0, NULL); - - _object2.postInit(&_objectList); - _object2.setVisage(5361); - _object2.setStrip2(1); - _object2.fixPriority(255); - _object2.changeZoom(100); - _object2._frame = 1; - _object2.setPosition(Common::Point(137, 104)); - _object2.setAction(&_speakerAction, NULL); - - Speaker::setText(msg); -} - -/*--------------------------------------------------------------------------*/ - RingworldInvObjectList::RingworldInvObjectList() : _stunner(2280, 1, 2, OBJECT_STUNNER, "This is your stunner."), _scanner(1, 1, 3, OBJECT_SCANNER, "A combination scanner comm unit."), @@ -1277,51 +404,6 @@ RingworldInvObjectList::RingworldInvObjectList() : /*--------------------------------------------------------------------------*/ -void RingworldGame::restartGame() { - if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1) - _globals->_game->restart(); -} - -void RingworldGame::saveGame() { - if (!_vm->canSaveGameStateCurrently()) - MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING); - else { - // Show the save dialog - handleSaveLoad(true, _globals->_sceneHandler->_saveGameSlot, _globals->_sceneHandler->_saveName); - } -} - -void RingworldGame::restoreGame() { - if (!_vm->canLoadGameStateCurrently()) - MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING); - else { - // Show the load dialog - handleSaveLoad(false, _globals->_sceneHandler->_loadGameSlot, _globals->_sceneHandler->_saveName); - } -} - -void RingworldGame::quitGame() { - if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) - _vm->quitGame(); -} - -void RingworldGame::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) { - const EnginePlugin *plugin = 0; - EngineMan.findGame(_vm->getGameId(), &plugin); - GUI::SaveLoadChooser *dialog; - if (saveFlag) - dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save")); - else - dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load")); - - dialog->setSaveMode(saveFlag); - - saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); - saveName = dialog->getResultString(); - - delete dialog; -} - void RingworldGame::start() { // Set some default flags _globals->setFlag(12); @@ -1448,15 +530,10 @@ void RingworldGame::processEvent(Event &event) { MessageDialog::show(HELP_MSG, OK_BTN_STRING); break; - case Common::KEYCODE_F2: { + case Common::KEYCODE_F2: // F2 - Sound Options - ConfigDialog *dlg = new ConfigDialog(); - dlg->runModal(); - delete dlg; - _globals->_soundManager.syncSounds(); - _globals->_events.setCursorFromFlag(); + SoundDialog::execute(); break; - } case Common::KEYCODE_F3: // F3 - Quit @@ -1489,6 +566,12 @@ void RingworldGame::processEvent(Event &event) { } } +void RingworldGame::rightClick() { + RightClickDialog *dlg = new RightClickDialog(); + dlg->execute(); + delete dlg; +} + } // End of namespace Ringworld } // End of namespace TsAGE diff --git a/engines/tsage/ringworld/ringworld_logic.h b/engines/tsage/ringworld/ringworld_logic.h index 73ecc9722b..40b202bd7f 100644 --- a/engines/tsage/ringworld/ringworld_logic.h +++ b/engines/tsage/ringworld/ringworld_logic.h @@ -35,19 +35,6 @@ namespace Ringworld { using namespace TsAGE; -#define ADD_PLAYER_MOVER(X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \ - _globals->_player.addMover(mover, &pt, this); } -#define ADD_PLAYER_MOVER_NULL(OBJ, X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \ - OBJ.addMover(mover, &pt, NULL); } -#define ADD_PLAYER_MOVER_THIS(OBJ, X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \ - OBJ.addMover(mover, &pt, this); } - -#define ADD_MOVER(OBJ, X, Y) { Common::Point pt(X, Y); NpcMover *mover = new NpcMover(); \ - OBJ.addMover(mover, &pt, this); } -#define ADD_MOVER_NULL(OBJ, X, Y) { Common::Point pt(X, Y); NpcMover *mover = new NpcMover(); \ - OBJ.addMover(mover, &pt, NULL); } - - class SceneFactory { public: static Scene *createScene(int sceneNumber); @@ -79,6 +66,17 @@ public: } }; +class SceneObjectExt : public SceneObject { +public: + int _state; + + virtual void synchronize(Serializer &s) { + SceneObject::synchronize(s); + s.syncAsSint16LE(_state); + } + virtual Common::String getClassName() { return "SceneObjectExt"; } +}; + class SceneArea : public SavedObject { public: GfxSurface _surface; @@ -104,302 +102,6 @@ public: }; /*--------------------------------------------------------------------------*/ -// Ringworld specific game speakers - -class SpeakerGText : public Speaker { -public: - SceneObject _sceneObject; -public: - SpeakerGText(); - - virtual Common::String getClassName() { return "SpeakerGText"; } - virtual void setText(const Common::String &msg); - virtual void removeText(); -}; - -class SpeakerPOR : public AnimatedSpeaker { - class SpeakerAction1 : public SpeakerAction { - public: - virtual void signal(); - }; - -public: - SceneObject _object3; - SpeakerAction1 _action2; -public: - SpeakerPOR(); - virtual Common::String getClassName() { return "SpeakerPOR"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerOR : public AnimatedSpeaker { -public: - SpeakerOR(); - virtual Common::String getClassName() { return "SpeakerOR"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerOText : public SpeakerGText { -public: - SpeakerOText(); - - virtual Common::String getClassName() { return "SpeakerOText"; } -}; - -class SpeakerPOText : public ScreenSpeaker { -public: - SpeakerPOText(); - - virtual Common::String getClassName() { return "SpeakerPOText"; } -}; - -class SpeakerSText : public ScreenSpeaker { -public: - SpeakerSText(); - - virtual Common::String getClassName() { return "SpeakerSText"; } -}; - -class SpeakerQText : public ScreenSpeaker { -public: - SpeakerQText(); - - virtual Common::String getClassName() { return "SpeakerQText"; } -}; - -class SpeakerMText : public ScreenSpeaker { -public: - SpeakerMText(); - - virtual Common::String getClassName() { return "SpeakerMText"; } -}; - -class SpeakerCText : public ScreenSpeaker { -public: - SpeakerCText(); - - virtual Common::String getClassName() { return "SpeakerCText"; } -}; - -class SpeakerEText : public ScreenSpeaker { -public: - SpeakerEText(); - - virtual Common::String getClassName() { return "SpeakerEText"; } -}; - -class SpeakerGR : public AnimatedSpeaker { -public: - SpeakerGR(); - - virtual Common::String getClassName() { return "SpeakerGR"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerHText : public ScreenSpeaker { -public: - SpeakerHText(); - - virtual Common::String getClassName() { return "SpeakerHText"; } -}; - -class SpeakerPText : public ScreenSpeaker { -public: - SpeakerPText(); - - virtual Common::String getClassName() { return "SpeakerPText"; } -}; - -class SpeakerCHFText : public ScreenSpeaker { -public: - SpeakerCHFText(); - - virtual Common::String getClassName() { return "SpeakerCHFText"; } -}; - -class SpeakerSKText : public ScreenSpeaker { -public: - SpeakerSKText(); - - virtual Common::String getClassName() { return "SpeakerSKText"; } -}; - -class SpeakerCDRText : public ScreenSpeaker { -public: - SpeakerCDRText(); - - virtual Common::String getClassName() { return "SpeakerCDRText"; } -}; - -class SpeakerFLText : public ScreenSpeaker { -public: - SpeakerFLText(); - - virtual Common::String getClassName() { return "SpeakerFLText"; } -}; - -class SpeakerBatText : public ScreenSpeaker { -public: - SpeakerBatText(); - - virtual Common::String getClassName() { return "SpeakerFLText"; } -}; - -class SpeakerQR : public AnimatedSpeaker { -public: - SpeakerQR(); - - virtual Common::String getClassName() { return "SpeakerQR"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerQU : public AnimatedSpeaker { -public: - SpeakerQU(); - - virtual Common::String getClassName() { return "SpeakerQU"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerSKL : public AnimatedSpeaker { -public: - SpeakerSKL(); - - virtual Common::String getClassName() { return "SpeakerQL"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerQL : public AnimatedSpeaker { -public: - SpeakerQL(); - - virtual Common::String getClassName() { return "SpeakerQL"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerSR : public AnimatedSpeaker { -public: - SceneObject _object3; -public: - SpeakerSR(); - - virtual Common::String getClassName() { return "SpeakerSR"; } - void setText(const Common::String &msg); -}; - -class SpeakerSL : public AnimatedSpeaker { -public: - SpeakerSL(); - - virtual Common::String getClassName() { return "SpeakerSL"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerCR : public AnimatedSpeaker { -public: - SpeakerCR(); - - virtual Common::String getClassName() { return "SpeakerCR"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerMR : public AnimatedSpeaker { -public: - SpeakerMR(); - - virtual Common::String getClassName() { return "SpeakerMR"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerSAL : public AnimatedSpeaker { -public: - SpeakerSAL(); - - virtual Common::String getClassName() { return "SpeakerSAL"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerML : public AnimatedSpeaker { -public: - SpeakerML(); - - virtual Common::String getClassName() { return "SpeakerML"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerCHFL : public AnimatedSpeaker { -public: - SpeakerCHFL(); - - virtual Common::String getClassName() { return "SpeakerCHFL"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerCHFR : public AnimatedSpeaker { -public: - SpeakerCHFR(); - - virtual Common::String getClassName() { return "SpeakerCHFR"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerPL : public AnimatedSpeaker { -public: - SceneObject _object3; - SpeakerAction _speakerAction2; - - SpeakerPL(); - - virtual Common::String getClassName() { return "SpeakerPL"; } - virtual void setText(const Common::String &msg); - virtual void removeText(); -}; - -class SpeakerPR : public AnimatedSpeaker { -public: - SceneObject _object3; - SpeakerAction _speakerAction2; - - SpeakerPR(); - - virtual Common::String getClassName() { return "SpeakerPR"; } - virtual void setText(const Common::String &msg); - virtual void removeText(); -}; - -class SpeakerCDR : public AnimatedSpeaker { -public: - SpeakerCDR(); - - virtual Common::String getClassName() { return "SpeakerCDR"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerCDL : public AnimatedSpeaker { -public: - SpeakerCDL(); - - virtual Common::String getClassName() { return "SpeakerCDL"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerFLL : public AnimatedSpeaker { -public: - SpeakerFLL(); - - virtual Common::String getClassName() { return "SpeakerFLL"; } - virtual void setText(const Common::String &msg); -}; - -class SpeakerBatR : public AnimatedSpeaker { -public: - SpeakerBatR(); - - virtual Common::String getClassName() { return "SpeakerBatR"; } - virtual void setText(const Common::String &msg); -}; - -/*--------------------------------------------------------------------------*/ class RingworldInvObjectList : public InvObjectList { public: @@ -445,19 +147,14 @@ public: #define RING_INVENTORY (*((::TsAGE::Ringworld::RingworldInvObjectList *)_globals->_inventory)) class RingworldGame: public Game { -protected: - virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName); public: virtual void start(); virtual void restart(); - virtual void restartGame(); - virtual void saveGame(); - virtual void restoreGame(); - virtual void quitGame(); virtual void endGame(int resNum, int lineNum); virtual Scene *createScene(int sceneNumber); virtual void processEvent(Event &event); + virtual void rightClick(); }; } // End of namespace Ringworld diff --git a/engines/tsage/ringworld/ringworld_scenes1.h b/engines/tsage/ringworld/ringworld_scenes1.h index 49ea65eb3a..bb98c89a8c 100644 --- a/engines/tsage/ringworld/ringworld_scenes1.h +++ b/engines/tsage/ringworld/ringworld_scenes1.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "tsage/ringworld/ringworld_logic.h" +#include "tsage/ringworld/ringworld_speakers.h" #include "tsage/converse.h" #include "tsage/events.h" #include "tsage/core.h" diff --git a/engines/tsage/ringworld/ringworld_scenes10.cpp b/engines/tsage/ringworld/ringworld_scenes10.cpp index df25c324ab..1d310c6f8f 100644 --- a/engines/tsage/ringworld/ringworld_scenes10.cpp +++ b/engines/tsage/ringworld/ringworld_scenes10.cpp @@ -145,13 +145,13 @@ void Scene9100::postInit(SceneObjectList *OwnerList) { _object6.setStrip(6); _object6.setFrame(1); _object6.setPosition(Common::Point(138, 166)); - _sceneHotspot3.setup(145, 125, 166, 156, 9100, 40, 43); + _sceneHotspot3.setDetails(145, 125, 166, 156, 9100, 40, 43); } - _sceneHotspot1.setup(140, 176, 185, 215, 9100, 36, 37); - _sceneHotspot2.setup(161, 138, 182, 175, 9100, 38, 39); - _sceneHotspot4.setup(37, 196, 47, 320, 9100, 44, -1); - _sceneHotspot5.setup(69, 36, 121, 272, 9100, 45, 46); - _sceneHotspot6.setup(127, 0, 200, 52, 9100, 47, 48); + _sceneHotspot1.setDetails(140, 176, 185, 215, 9100, 36, 37); + _sceneHotspot2.setDetails(161, 138, 182, 175, 9100, 38, 39); + _sceneHotspot4.setDetails(37, 196, 47, 320, 9100, 44, -1); + _sceneHotspot5.setDetails(69, 36, 121, 272, 9100, 45, 46); + _sceneHotspot6.setDetails(127, 0, 200, 52, 9100, 47, 48); _globals->_soundHandler.play(251); if (_globals->_sceneManager._previousScene == 9150) { @@ -261,16 +261,16 @@ void Scene9150::postInit(SceneObjectList *OwnerList) { _object3.setPosition(Common::Point(312, 95)); _object3.signal(); - _sceneHotspot1.setup(0, 0, 200, 94, 9150, 46, -1); - _sceneHotspot2.setup(51, 90, 118, 230, 9150, 47, -1); - _sceneHotspot3.setup(182, 104, 200, 320, 9150, 48, 49); - _sceneHotspot4.setup(103, 292, 152, 314, 9150, 50, 51); - _sceneHotspot5.setup(115, 350, 160, 374, 9150, 52, 53); - _sceneHotspot6.setup(0, 471, 200, 531, 9150, 54, 55); - _sceneHotspot7.setup(170, 320, 185, 640, 9150, 56, -1); - _sceneHotspot9.setup(157, 107, 186, 320, 9150, 56, -1); - _sceneHotspot8.setup(133, 584, 142, 640, 9150, 57, -1); - _sceneHotspot10.setup(83, 304, 103, 323, 9150, 58, 59); + _sceneHotspot1.setDetails(0, 0, 200, 94, 9150, 46, -1); + _sceneHotspot2.setDetails(51, 90, 118, 230, 9150, 47, -1); + _sceneHotspot3.setDetails(182, 104, 200, 320, 9150, 48, 49); + _sceneHotspot4.setDetails(103, 292, 152, 314, 9150, 50, 51); + _sceneHotspot5.setDetails(115, 350, 160, 374, 9150, 52, 53); + _sceneHotspot6.setDetails(0, 471, 200, 531, 9150, 54, 55); + _sceneHotspot7.setDetails(170, 320, 185, 640, 9150, 56, -1); + _sceneHotspot9.setDetails(157, 107, 186, 320, 9150, 56, -1); + _sceneHotspot8.setDetails(133, 584, 142, 640, 9150, 57, -1); + _sceneHotspot10.setDetails(83, 304, 103, 323, 9150, 58, 59); _globals->_soundHandler.play(285); _globals->_player.disableControl(); @@ -412,15 +412,15 @@ void Scene9200::postInit(SceneObjectList *OwnerList) { if (!_globals->getFlag(86)) { _object2.postInit(); - _hotspot1.setup(96, 194, 160, 234, 9200, 29, 31); + _hotspot1.setDetails(96, 194, 160, 234, 9200, 29, 31); } - _hotspot2.setup(164, 0, 200, 282, 9200, 0, 1); - _hotspot3.setup(140, 39, 165, 153, 9200, 2, 3); - _hotspot4.setup(92, 122, 139, 152, 9200, 4, 5); - _hotspot5.setup(33, 20, 142, 115, 9200, 6, 7); - _hotspot6.setup(104, 235, 153, 265, 9200, 8, 9); - _hotspot7.setup(107, 262, 153, 286, 9200, 10, 11); - _hotspot8.setup(69, 276, 164, 320, 9200, 12, 13); + _hotspot2.setDetails(164, 0, 200, 282, 9200, 0, 1); + _hotspot3.setDetails(140, 39, 165, 153, 9200, 2, 3); + _hotspot4.setDetails(92, 122, 139, 152, 9200, 4, 5); + _hotspot5.setDetails(33, 20, 142, 115, 9200, 6, 7); + _hotspot6.setDetails(104, 235, 153, 265, 9200, 8, 9); + _hotspot7.setDetails(107, 262, 153, 286, 9200, 10, 11); + _hotspot8.setDetails(69, 276, 164, 320, 9200, 12, 13); _globals->_events.setCursor(CURSOR_WALK); _globals->_player.disableControl(); @@ -514,19 +514,19 @@ void Scene9300::postInit(SceneObjectList *OwnerList) { _object2.postInit(); _globals->_soundHandler.play(289); - _hotspot1.setup(35, 142, 76, 212, 9300, 0, 1); - _hotspot2.setup(28, 90, 81, 143, 9300, 2, 3); - _hotspot3.setup(78, 142, 146, 216, 9300, 4, 5); - _hotspot4.setup(3, 43, 91, 74, 9300, 6, 7); - _hotspot5.setup(82, 19, 157, 65, 9300, 8, 9); - _hotspot6.setup(5, 218, 84, 274, 9300, 10, 11); - _hotspot7.setup(86, 233, 168, 293, 9300, 12, 13); - _hotspot8.setup(157, 0, 200, 230, 9300, 14, 15); - _hotspot9.setup(169, 227, 200, 320, 9300, 16, 17); - _hotspot10.setup(145, 97, 166, 225, 9300, 18, 19); - _hotspot11.setup(81, 75, 145, 145, 9300, 20, 21); - _hotspot12.setup(0, 0, 94, 35, 9300, 22, 23); - _hotspot13.setup(12, 268, 149, 320, 9300, 24, 25); + _hotspot1.setDetails(35, 142, 76, 212, 9300, 0, 1); + _hotspot2.setDetails(28, 90, 81, 143, 9300, 2, 3); + _hotspot3.setDetails(78, 142, 146, 216, 9300, 4, 5); + _hotspot4.setDetails(3, 43, 91, 74, 9300, 6, 7); + _hotspot5.setDetails(82, 19, 157, 65, 9300, 8, 9); + _hotspot6.setDetails(5, 218, 84, 274, 9300, 10, 11); + _hotspot7.setDetails(86, 233, 168, 293, 9300, 12, 13); + _hotspot8.setDetails(157, 0, 200, 230, 9300, 14, 15); + _hotspot9.setDetails(169, 227, 200, 320, 9300, 16, 17); + _hotspot10.setDetails(145, 97, 166, 225, 9300, 18, 19); + _hotspot11.setDetails(81, 75, 145, 145, 9300, 20, 21); + _hotspot12.setDetails(0, 0, 94, 35, 9300, 22, 23); + _hotspot13.setDetails(12, 268, 149, 320, 9300, 24, 25); if (_globals->_sceneManager._previousScene == 9350) { _globals->_player.disableControl(); @@ -593,11 +593,11 @@ void Scene9350::postInit(SceneObjectList *OwnerList) { _globals->_player.postInit(); _object1.setup(9351, 1, 3, 139, 97, 0); - _sceneHotspot1.setup(42, 0, 97, 60, 9350, 0, -1); - _sceneHotspot2.setup(37, 205, 82, 256, 9350, 0, -1); - _sceneHotspot3.setup(29, 93, 92, 174, 9350, 1, -1); - _sceneHotspot4.setup(0, 308, 109, 320, 9350, 2, -1); - _sceneHotspot5.setup(0, 0, 200, 320, 9350, 3, -1); + _sceneHotspot1.setDetails(42, 0, 97, 60, 9350, 0, -1); + _sceneHotspot2.setDetails(37, 205, 82, 256, 9350, 0, -1); + _sceneHotspot3.setDetails(29, 93, 92, 174, 9350, 1, -1); + _sceneHotspot4.setDetails(0, 308, 109, 320, 9350, 2, -1); + _sceneHotspot5.setDetails(0, 0, 200, 320, 9350, 3, -1); _globals->_events.setCursor(CURSOR_WALK); _globals->_player.disableControl(); @@ -677,14 +677,14 @@ void Scene9360::postInit(SceneObjectList *OwnerList) { setZoomPercents(95, 80, 200, 100); _globals->_player.postInit(); - _hotspot1.setup(37, 92, 93, 173, 9360, 0, 1); - _hotspot2.setup(42, 0, 100, 63, 9360, 2, -1); - _hotspot3.setup(36, 205, 82, 260, 9360, 3, -1); - _hotspot4.setup(103, 2, 200, 320, 9360, 4, -1); - _hotspot5.setup(0, 0, 37, 320, 9360, 4, -1); - _hotspot6.setup(35, 61, 103, 92, 9360, 4, -1); - _hotspot7.setup(33, 174, 93, 207, 9360, 4, -1); - _hotspot8.setup(28, 257, 149, 320, 9360, 4, -1); + _hotspot1.setDetails(37, 92, 93, 173, 9360, 0, 1); + _hotspot2.setDetails(42, 0, 100, 63, 9360, 2, -1); + _hotspot3.setDetails(36, 205, 82, 260, 9360, 3, -1); + _hotspot4.setDetails(103, 2, 200, 320, 9360, 4, -1); + _hotspot5.setDetails(0, 0, 37, 320, 9360, 4, -1); + _hotspot6.setDetails(35, 61, 103, 92, 9360, 4, -1); + _hotspot7.setDetails(33, 174, 93, 207, 9360, 4, -1); + _hotspot8.setDetails(28, 257, 149, 320, 9360, 4, -1); _globals->_events.setCursor(CURSOR_WALK); _globals->_player.disableControl(); if (_globals->_sceneManager._previousScene == 9350) { @@ -796,14 +796,14 @@ void Scene9400::postInit(SceneObjectList *OwnerList) { _object3.postInit(); _speakerQText._textPos.x = 20; - _hotspot7.setup(157, 66, 180, 110, 9400, 21, 23); - _hotspot5.setup(130, 133, 152, 198, 9400, 22, -1); - _hotspot1.setup(33, 280, 69, 297, 9400, 1, 2); - _hotspot2.setup(73, 96, 87, 159, 9400, 3, 4); - _hotspot3.setup(89, 253, 111, 305, 9400, 5, 6); - _hotspot4.setup(46, 0, 116, 35, 9400, 7, 8); - _hotspot8.setup(58, 169, 122, 200, 9400, 9, 10); - _hotspot6.setup(0, 0, 199, 319, 9400, 16, 0); + _hotspot7.setDetails(157, 66, 180, 110, 9400, 21, 23); + _hotspot5.setDetails(130, 133, 152, 198, 9400, 22, -1); + _hotspot1.setDetails(33, 280, 69, 297, 9400, 1, 2); + _hotspot2.setDetails(73, 96, 87, 159, 9400, 3, 4); + _hotspot3.setDetails(89, 253, 111, 305, 9400, 5, 6); + _hotspot4.setDetails(46, 0, 116, 35, 9400, 7, 8); + _hotspot8.setDetails(58, 169, 122, 200, 9400, 9, 10); + _hotspot6.setDetails(0, 0, 199, 319, 9400, 16, 0); _stripManager.addSpeaker(&_speakerQText); _stripManager.addSpeaker(&_speakerOR); @@ -992,23 +992,23 @@ void Scene9450::postInit(SceneObjectList *OwnerList) { } if (RING_INVENTORY._tunic._sceneNumber != 1) - _hotspot1.setup(123, 139, 138, 170, 9450, 37, -1); - - _hotspot2.setup(153, 102, 176, 141, 9450, 39, 40); - _hotspot3.setup(97, 198, 130, 229, 9450, 41, 42); - _hotspot15.setup(131, 190, 145, 212, 9450, 43, 44); - _hotspot4.setup(33, 144, 105, 192, 9450, 0, 1); - _hotspot5.setup(20, 236, 106, 287, 9450, 2, 3); - _hotspot6.setup(137, 119, 195, 320, 9450, 4, 5); - _hotspot7.setup(20, 59, 99, 111, 9450, 6, -1); - _hotspot8.setup(110, 0, 199, 117, 9450, 7, 8); - _hotspot9.setup(101, 104, 130, 174, 9450, 9, 10); - _hotspot10.setup(110, 246, 149, 319, 9450, 11, 12); - _hotspot11.setup(16, 34, 74, 62, 6450, 13, 14); - _hotspot12.setup(19, 108, 72, 134, 9450, 15, 16); - _hotspot13.setup(18, 215, 71, 237, 9450, 17, 18); - _hotspot14.setup(15, 288, 76, 314, 9450, 19, 20); - _hotspot16.setup(0, 0, 200, 320, 9450, 46, -1); + _hotspot1.setDetails(123, 139, 138, 170, 9450, 37, -1); + + _hotspot2.setDetails(153, 102, 176, 141, 9450, 39, 40); + _hotspot3.setDetails(97, 198, 130, 229, 9450, 41, 42); + _hotspot15.setDetails(131, 190, 145, 212, 9450, 43, 44); + _hotspot4.setDetails(33, 144, 105, 192, 9450, 0, 1); + _hotspot5.setDetails(20, 236, 106, 287, 9450, 2, 3); + _hotspot6.setDetails(137, 119, 195, 320, 9450, 4, 5); + _hotspot7.setDetails(20, 59, 99, 111, 9450, 6, -1); + _hotspot8.setDetails(110, 0, 199, 117, 9450, 7, 8); + _hotspot9.setDetails(101, 104, 130, 174, 9450, 9, 10); + _hotspot10.setDetails(110, 246, 149, 319, 9450, 11, 12); + _hotspot11.setDetails(16, 34, 74, 62, 6450, 13, 14); + _hotspot12.setDetails(19, 108, 72, 134, 9450, 15, 16); + _hotspot13.setDetails(18, 215, 71, 237, 9450, 17, 18); + _hotspot14.setDetails(15, 288, 76, 314, 9450, 19, 20); + _hotspot16.setDetails(0, 0, 200, 320, 9450, 46, -1); } /*-------------------------------------------------------------------------- @@ -1024,7 +1024,7 @@ void Scene9500::Hotspot1::doAction(int action) { RING_INVENTORY._sword._sceneNumber = 9500; _globals->_player.disableControl(); _globals->_sceneItems.remove(this); - scene->_hotspot2.setup(87, 294, 104, 314, 9400, 17, -1); + scene->_hotspot2.setDetails(87, 294, 104, 314, 9400, 17, -1); scene->setAction(&scene->_sequenceManager, scene, 9510, &_globals->_player, &scene->_object2, NULL); } else { NamedHotspot::doAction(action); @@ -1182,37 +1182,37 @@ void Scene9500::postInit(SceneObjectList *OwnerList) { _object2.setPosition(Common::Point(303, 130)); _object2.fixPriority(132); if (RING_INVENTORY._helmet._sceneNumber == 1) { - _hotspot2.setup(87, 294, 104, 314, 9400, 17, -1); + _hotspot2.setDetails(87, 294, 104, 314, 9400, 17, -1); } else { _object2.setStrip(2); _object2.setFrame(1); } } else { - _hotspot1.setup(105, 295, 134, 313, 9500, 9, 10); + _hotspot1.setDetails(105, 295, 134, 313, 9500, 9, 10); } - _hotspot17.setup(101, 293, 135, 315, 9500, 9, 10); - _hotspot3.setup(84, 12, 107, 47, 9500, 15, 15); - _hotspot6.setup(93, 11, 167, 46, 9500, 0, 1); - _hotspot7.setup(100, 70, 125, 139, 9500, 2, 3); + _hotspot17.setDetails(101, 293, 135, 315, 9500, 9, 10); + _hotspot3.setDetails(84, 12, 107, 47, 9500, 15, 15); + _hotspot6.setDetails(93, 11, 167, 46, 9500, 0, 1); + _hotspot7.setDetails(100, 70, 125, 139, 9500, 2, 3); if (!_globals->getFlag(85)) { - _hotspot5.setup(111, 68, 155, 244, 9500, 17, -1); - _hotspot4.setup(57, 71, 120, 126, 9500, 16, -1); - } - - _hotspot8.setup(60, 24, 90, 53, 9500, 4, 5); - _hotspot9.setup(72, 143, 93, 163, 9500, 4, 5); - _hotspot10.setup(70, 205, 92, 228, 9500, 4, 5); - _hotspot11.setup(66, 291, 90, 317, 9500, 4, 5); - _hotspot12.setup(22, 58, 101, 145, 9500, 6, 7); - _hotspot13.setup(121, 57, 163, 249, 9500, 6, 7); - _hotspot14.setup(115, 133, 135, 252, 9500, 6, 7); - _hotspot15.setup(55, 240, 125, 254, 9500, 6, 7); - _hotspot16.setup(53, 251, 132, 288, 9500, 8, -1); - _hotspot19.setup(101, 207, 120, 225, 9500, 9, 10); - _hotspot18.setup(98, 144, 117, 162, 9500, 9, 10); - _hotspot20.setup(102, 27, 132, 50, 9500, 9, 10); + _hotspot5.setDetails(111, 68, 155, 244, 9500, 17, -1); + _hotspot4.setDetails(57, 71, 120, 126, 9500, 16, -1); + } + + _hotspot8.setDetails(60, 24, 90, 53, 9500, 4, 5); + _hotspot9.setDetails(72, 143, 93, 163, 9500, 4, 5); + _hotspot10.setDetails(70, 205, 92, 228, 9500, 4, 5); + _hotspot11.setDetails(66, 291, 90, 317, 9500, 4, 5); + _hotspot12.setDetails(22, 58, 101, 145, 9500, 6, 7); + _hotspot13.setDetails(121, 57, 163, 249, 9500, 6, 7); + _hotspot14.setDetails(115, 133, 135, 252, 9500, 6, 7); + _hotspot15.setDetails(55, 240, 125, 254, 9500, 6, 7); + _hotspot16.setDetails(53, 251, 132, 288, 9500, 8, -1); + _hotspot19.setDetails(101, 207, 120, 225, 9500, 9, 10); + _hotspot18.setDetails(98, 144, 117, 162, 9500, 9, 10); + _hotspot20.setDetails(102, 27, 132, 50, 9500, 9, 10); _globals->_events.setCursor(CURSOR_WALK); _globals->_player.disableControl(); @@ -1223,7 +1223,7 @@ void Scene9500::postInit(SceneObjectList *OwnerList) { setAction(&_sequenceManager, this, 9501, &_globals->_player, &_candle, NULL); } else { RING_INVENTORY._helmet._sceneNumber = 9500; - _hotspot2.setup(87, 294, 104, 314, 9400, 17, -1); + _hotspot2.setDetails(87, 294, 104, 314, 9400, 17, -1); setAction(&_sequenceManager, this, 9513, &_globals->_player, &_object2, NULL); } } else { @@ -1282,12 +1282,12 @@ void Scene9700::postInit(SceneObjectList *OwnerList) { Scene::postInit(); setZoomPercents(0, 100, 200, 100); - _sceneHotspot1.setup(84, 218, 151, 278, 9700, 14, -1); - _sceneHotspot2.setup(89, 11, 151, 121, 9700, 14, -1); - _sceneHotspot3.setup(69, 119, 138, 216, 9700, 15, 16); - _sceneHotspot4.setup(34, 13, 88, 116, 9700, 17, -1); - _sceneHotspot5.setup(52, 119, 68, 204, 9700, 17, -1); - _sceneHotspot6.setup(0, 22, 56, 275, 9700, 18, -1); + _sceneHotspot1.setDetails(84, 218, 151, 278, 9700, 14, -1); + _sceneHotspot2.setDetails(89, 11, 151, 121, 9700, 14, -1); + _sceneHotspot3.setDetails(69, 119, 138, 216, 9700, 15, 16); + _sceneHotspot4.setDetails(34, 13, 88, 116, 9700, 17, -1); + _sceneHotspot5.setDetails(52, 119, 68, 204, 9700, 17, -1); + _sceneHotspot6.setDetails(0, 22, 56, 275, 9700, 18, -1); _object1.postInit(); _object1.hide(); @@ -1617,26 +1617,26 @@ void Scene9850::postInit(SceneObjectList *OwnerList) { _objSword.hide(); } - _spotLever.setup(30, 251, 45, 270, 9850, 26, -1); - _hotspot1.setup(123, 0, 200, 320, 9850, 0, 1); - _hotspot2.setup(107, 87, 133, 308, 9850, 0, 1); - _hotspot3.setup(2, 28, 53, 80, 9850, 2, 3); - _hotspot4.setup(13, 0, 55, 27, 9850, 2, 3); - _hotspot5.setup(8, 74, 27, 91, 9850, 4, 5); - _hotspot17.setup(61, 0, 125, 28, 9850, 6, 7); - _hotspot18.setup(51, 95, 105, 145, 9850, 6, 7); - _hotspot19.setup(56, 28, 115, 97, 9850, 6, 8); - _hotspot6.setup(0, 223, 115, 257, 9850, 9, 10); - _hotspot7.setup(15, 254, 33, 268, 9850, 9, -1); - _hotspot8.setup(17, 218, 37, 233, 9850, 9, 10); - _hotspot9.setup(8, 113, 26, 221, 9850, 11, 12); - _hotspot10.setup(14, 94, 53, 112, 9850, 13, 14); - _hotspot11.setup(5, 269, 29, 303, 9850, 15, 16); - _hotspot12.setup(43, 278, 91, 317, 9850, 17, 18); - _hotspot13.setup(47, 263, 112, 282, 9850, 19, 20); - _hotspot14.setup(43, 188, 86, 224, 9850, 21, 22); - _hotspot15.setup(43, 162, 92, 191, 9850, 23, 24); - _hotspot16.setup(40, 146, 90, 169, 9850, 25, -1); + _spotLever.setDetails(30, 251, 45, 270, 9850, 26, -1); + _hotspot1.setDetails(123, 0, 200, 320, 9850, 0, 1); + _hotspot2.setDetails(107, 87, 133, 308, 9850, 0, 1); + _hotspot3.setDetails(2, 28, 53, 80, 9850, 2, 3); + _hotspot4.setDetails(13, 0, 55, 27, 9850, 2, 3); + _hotspot5.setDetails(8, 74, 27, 91, 9850, 4, 5); + _hotspot17.setDetails(61, 0, 125, 28, 9850, 6, 7); + _hotspot18.setDetails(51, 95, 105, 145, 9850, 6, 7); + _hotspot19.setDetails(56, 28, 115, 97, 9850, 6, 8); + _hotspot6.setDetails(0, 223, 115, 257, 9850, 9, 10); + _hotspot7.setDetails(15, 254, 33, 268, 9850, 9, -1); + _hotspot8.setDetails(17, 218, 37, 233, 9850, 9, 10); + _hotspot9.setDetails(8, 113, 26, 221, 9850, 11, 12); + _hotspot10.setDetails(14, 94, 53, 112, 9850, 13, 14); + _hotspot11.setDetails(5, 269, 29, 303, 9850, 15, 16); + _hotspot12.setDetails(43, 278, 91, 317, 9850, 17, 18); + _hotspot13.setDetails(47, 263, 112, 282, 9850, 19, 20); + _hotspot14.setDetails(43, 188, 86, 224, 9850, 21, 22); + _hotspot15.setDetails(43, 162, 92, 191, 9850, 23, 24); + _hotspot16.setDetails(40, 146, 90, 169, 9850, 25, -1); _globals->_player.postInit(); _globals->_player.disableControl(); diff --git a/engines/tsage/ringworld/ringworld_scenes10.h b/engines/tsage/ringworld/ringworld_scenes10.h index 02c42f3d01..6bca48776b 100644 --- a/engines/tsage/ringworld/ringworld_scenes10.h +++ b/engines/tsage/ringworld/ringworld_scenes10.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "tsage/ringworld/ringworld_logic.h" +#include "tsage/ringworld/ringworld_speakers.h" #include "tsage/events.h" #include "tsage/core.h" #include "tsage/scenes.h" diff --git a/engines/tsage/ringworld/ringworld_scenes2.h b/engines/tsage/ringworld/ringworld_scenes2.h index 3502aea15b..382d9d4157 100644 --- a/engines/tsage/ringworld/ringworld_scenes2.h +++ b/engines/tsage/ringworld/ringworld_scenes2.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "tsage/ringworld/ringworld_logic.h" +#include "tsage/ringworld/ringworld_speakers.h" #include "tsage/events.h" #include "tsage/core.h" #include "tsage/scenes.h" diff --git a/engines/tsage/ringworld/ringworld_scenes3.h b/engines/tsage/ringworld/ringworld_scenes3.h index 2dbdc27211..682ef44fc6 100644 --- a/engines/tsage/ringworld/ringworld_scenes3.h +++ b/engines/tsage/ringworld/ringworld_scenes3.h @@ -27,6 +27,7 @@ #include "tsage/core.h" #include "tsage/converse.h" #include "tsage/ringworld/ringworld_logic.h" +#include "tsage/ringworld/ringworld_speakers.h" namespace TsAGE { diff --git a/engines/tsage/ringworld/ringworld_scenes4.h b/engines/tsage/ringworld/ringworld_scenes4.h index af31de84b9..64706805bc 100644 --- a/engines/tsage/ringworld/ringworld_scenes4.h +++ b/engines/tsage/ringworld/ringworld_scenes4.h @@ -27,6 +27,7 @@ #include "tsage/core.h" #include "tsage/converse.h" #include "tsage/ringworld/ringworld_logic.h" +#include "tsage/ringworld/ringworld_speakers.h" namespace TsAGE { diff --git a/engines/tsage/ringworld/ringworld_scenes5.cpp b/engines/tsage/ringworld/ringworld_scenes5.cpp index 58f47d7f82..30093b7855 100644 --- a/engines/tsage/ringworld/ringworld_scenes5.cpp +++ b/engines/tsage/ringworld/ringworld_scenes5.cpp @@ -4033,7 +4033,7 @@ void Scene4300::postInit(SceneObjectList *OwnerList) { _stripManager.addSpeaker(&_speakerMText); _stripManager.addSpeaker(&_speakerFLText); - _hotspot11.setup(76, 97, 102, 127, 4300, 5, 6); + _hotspot11.setDetails(76, 97, 102, 127, 4300, 5, 6); _hotspot7.postInit(); _hotspot7.setPosition(Common::Point(90, 128)); @@ -4041,7 +4041,7 @@ void Scene4300::postInit(SceneObjectList *OwnerList) { _hotspot7.fixPriority(250); _globals->_sceneItems.push_back(&_hotspot7); - _hotspot9.setup(120, 49, 174, 91, 4300, -1, -1); + _hotspot9.setDetails(120, 49, 174, 91, 4300, -1, -1); _hotspot15.postInit(); _hotspot15.setVisage(4300); @@ -4414,7 +4414,7 @@ void Scene4301::postInit(SceneObjectList *OwnerList) { _field68E = false; RING_INVENTORY._stasisBox2._sceneNumber = 1; - _hotspot4.setup(97, 76, 127, 102, 4300, 5, 6); + _hotspot4.setDetails(97, 76, 127, 102, 4300, 5, 6); _hotspot1.postInit(); _hotspot1.setPosition(Common::Point(90, 128)); diff --git a/engines/tsage/ringworld/ringworld_scenes5.h b/engines/tsage/ringworld/ringworld_scenes5.h index 6c6b6b6f32..80e67755bd 100644 --- a/engines/tsage/ringworld/ringworld_scenes5.h +++ b/engines/tsage/ringworld/ringworld_scenes5.h @@ -27,6 +27,7 @@ #include "tsage/core.h" #include "tsage/converse.h" #include "tsage/ringworld/ringworld_logic.h" +#include "tsage/ringworld/ringworld_speakers.h" namespace TsAGE { diff --git a/engines/tsage/ringworld/ringworld_scenes6.h b/engines/tsage/ringworld/ringworld_scenes6.h index 79e604a177..bf353de415 100644 --- a/engines/tsage/ringworld/ringworld_scenes6.h +++ b/engines/tsage/ringworld/ringworld_scenes6.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "tsage/ringworld/ringworld_logic.h" +#include "tsage/ringworld/ringworld_speakers.h" #include "tsage/events.h" #include "tsage/core.h" #include "tsage/scenes.h" diff --git a/engines/tsage/ringworld/ringworld_scenes8.h b/engines/tsage/ringworld/ringworld_scenes8.h index 4878db5cc8..84178c36f9 100644 --- a/engines/tsage/ringworld/ringworld_scenes8.h +++ b/engines/tsage/ringworld/ringworld_scenes8.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "tsage/ringworld/ringworld_logic.h" +#include "tsage/ringworld/ringworld_speakers.h" #include "tsage/events.h" #include "tsage/core.h" #include "tsage/scenes.h" diff --git a/engines/tsage/ringworld/ringworld_speakers.cpp b/engines/tsage/ringworld/ringworld_speakers.cpp new file mode 100644 index 0000000000..c56639a5b2 --- /dev/null +++ b/engines/tsage/ringworld/ringworld_speakers.cpp @@ -0,0 +1,905 @@ +/* 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/ringworld/ringworld_speakers.h" +#include "tsage/scenes.h" +#include "tsage/tsage.h" +#include "tsage/graphics.h" +#include "tsage/staticres.h" + +namespace TsAGE { + +namespace Ringworld { + +SpeakerGText::SpeakerGText() { + _speakerName = "GTEXT"; + _textWidth = 160; + _textPos = Common::Point(130, 10); + _color1 = 42; + _hideObjects = false; +} + +void SpeakerGText::setText(const Common::String &msg) { + // Set the animation properties + _sceneObject.postInit(); + _sceneObject.setVisage(9405); + _sceneObject.setStrip2(3); + _sceneObject.fixPriority(255); + _sceneObject.changeZoom(100); + _sceneObject._frame = 1; + _sceneObject.setPosition(Common::Point(183, 71)); + _sceneObject.animate(ANIM_MODE_7, 0, NULL); + + // Set the text + Rect textRect; + _globals->gfxManager()._font.getStringBounds(msg.c_str(), textRect, _textWidth); + textRect.center(_sceneObject._position.x, _sceneObject._position.y); + _textPos.x = textRect.left; + Speaker::setText(msg); +} + +void SpeakerGText::removeText() { + _sceneObject.remove(); + Speaker::removeText(); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerPOR::SpeakerPOR() { + _speakerName = "POR"; + _newSceneNumber = 7221; + _textPos = Common::Point(10, 30); + _color1 = 41; +} + +void SpeakerPOR::SpeakerAction1::signal(){ + switch (_actionIndex++) { + case 0: + setDelay(_globals->_randomSource.getRandomNumber(60) + 60); + break; + case 1: + static_cast<SceneObject *>(_owner)->animate(ANIM_MODE_5, this, NULL); + break; + case 2: + setDelay(_globals->_randomSource.getRandomNumber(10)); + _actionIndex = 0; + break; + default: + break; + } +} + +void SpeakerPOR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(7223); + _object1.setStrip2(2); + _object1.setPosition(Common::Point(191, 166)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(7223); + _object2.setPosition(Common::Point(159, 86)); + _object2.setAction(&_speakerAction, NULL); + + _object3.postInit(&_objectList); + _object3.setVisage(7223); + _object3.setStrip(3); + _object3.setPosition(Common::Point(119, 107)); + _object3.fixPriority(199); + _object3.setAction(&_action2); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerOR::SpeakerOR() { + _speakerName = "OR"; + _newSceneNumber = 9430; + _textPos = Common::Point(8, 36); + _color1 = 42; + _textWidth = 136; +} + +void SpeakerOR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(9431); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(202, 147)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(9431); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.setZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(199, 85)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerOText::SpeakerOText() : SpeakerGText() { + _speakerName = "OTEXT"; + _textWidth = 240; + _textPos = Common::Point(130, 10); + _color1 = 42; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerQText::SpeakerQText() : ScreenSpeaker() { + _speakerName = "QTEXT"; + _textPos = Common::Point(160, 40); + _color1 = 35; + _textWidth = 240; + _textMode = ALIGN_CENTER; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerSText::SpeakerSText() : ScreenSpeaker() { + _speakerName = "STEXT"; + _color1 = 13; + _textWidth = 240; + _textMode = ALIGN_CENTER; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerPOText::SpeakerPOText() : ScreenSpeaker() { + _speakerName = "POTEXT"; + _textWidth = 240; + _textMode = ALIGN_CENTER; + _color1 = 41; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerMText::SpeakerMText() { + _speakerName = "MTEXT"; + _color1 = 22; + _textWidth = 230; + _textMode = ALIGN_CENTER; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerCText::SpeakerCText() { + _speakerName = "CTEXT"; + _color1 = 4; + _textWidth = 240; + _textMode = ALIGN_CENTER; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerEText::SpeakerEText() { + _speakerName = "ETEXT"; + _textPos = Common::Point(20, 20); + _color1 = 22; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerGR::SpeakerGR() : AnimatedSpeaker() { + _speakerName = "GR"; + _newSceneNumber = 9220; + _textWidth = 136; + _textPos = Common::Point(168, 36); + _color1 = 14; +} + +void SpeakerGR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(9221); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(101, 70)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerHText::SpeakerHText() { + _speakerName = "HTEXT"; + _textPos = Common::Point(160, 40); + _color1 = 52; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerSKText::SpeakerSKText() : ScreenSpeaker() { + _speakerName = "SKTEXT"; + _textWidth = 240; + _textMode = ALIGN_CENTER; + _color1 = 9; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerPText::SpeakerPText() { + _speakerName = "PTEXT"; + _textWidth = 240; + _textMode = ALIGN_CENTER; + _color1 = 5; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerCHFText::SpeakerCHFText() { + _speakerName = "CHFTEXT"; + _textWidth = 240; + _textMode = ALIGN_CENTER; + _color1 = 56; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerCDRText::SpeakerCDRText() { + _speakerName = "CDRTEXT"; + _textWidth = 240; + _textMode = ALIGN_CENTER; + _color1 = 52; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerFLText::SpeakerFLText() { + _speakerName = "FLTEXT"; + _textPos = Common::Point(10, 40); + _color1 = 17; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerBatText::SpeakerBatText() { + _speakerName = "BATTEXT"; + _textWidth = 240; + _textMode = ALIGN_CENTER; + _color1 = 3; + _hideObjects = false; +} + +/*--------------------------------------------------------------------------*/ + +SpeakerSKL::SpeakerSKL() : AnimatedSpeaker() { + _speakerName = "SKL"; + _newSceneNumber = 7011; + _textPos = Common::Point(10, 30); + _color1 = 9; +} + +void SpeakerSKL::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(7013); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(203, 120)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(7013); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(197, 80)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerQL::SpeakerQL() : AnimatedSpeaker() { + _speakerName = "QL"; + _newSceneNumber = 2610; + _textPos = Common::Point(160, 30); + _color1 = 35; + _textMode = ALIGN_CENTER; +} + +void SpeakerQL::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(2612); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(128, 146)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(2612); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(122, 84)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerSR::SpeakerSR() { + _speakerName = "SR"; + _newSceneNumber = 2811; + _textPos = Common::Point(10, 30); + _color1 = 13; + _textMode = ALIGN_CENTER; +} + +void SpeakerSR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(2813); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(224, 198)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(2813); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(203, 96)); + _object2.setAction(&_speakerAction, NULL); + + _object3.postInit(&_objectList); + _object3.setVisage(2813); + _object3.setStrip(3); + _object3.setPosition(Common::Point(204, 91)); + _object3.fixPriority(199); + _object3._numFrames = 3; + _object3.animate(ANIM_MODE_7, 0, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerSL::SpeakerSL() { + _speakerName = "SL"; + _newSceneNumber = 2810; + _textPos = Common::Point(140, 30); + _textWidth = 160; + _color1 = 13; + _textMode = ALIGN_CENTER; +} + +void SpeakerSL::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(2812); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(95, 198)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(2812); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(116, 96)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerQR::SpeakerQR() { + _speakerName = "QR"; + _newSceneNumber = 2611; + _textPos = Common::Point(10, 30); + _color1 = 35; + _textMode = ALIGN_CENTER; +} + +void SpeakerQR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(2613); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(191, 146)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(2613); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(197, 84)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerQU::SpeakerQU() { + _speakerName = "QU"; + _newSceneNumber = 7020; + _textPos = Common::Point(160, 30); + _color1 = 35; + _textMode = ALIGN_CENTER; +} + +void SpeakerQU::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(7021); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(116, 120)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(7021); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(111, 84)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerCR::SpeakerCR() { + _speakerName = "CR"; + _newSceneNumber = 9010; + _textPos = Common::Point(20, 40); + _color1 = 4; +} + +void SpeakerCR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(9011); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.setPosition(Common::Point(219, 168)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(9011); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.setPosition(Common::Point(232, 81)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerMR::SpeakerMR() { + _speakerName = "MR"; + _newSceneNumber = 2711; + _textPos = Common::Point(10, 40); + _color1 = 22; +} + +void SpeakerMR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(2713); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(220, 143)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(2713); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(215, 99)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerSAL::SpeakerSAL() { + _speakerName = "SAL"; + _newSceneNumber = 2851; + _textPos = Common::Point(10, 30); + _color1 = 13; + _textMode = ALIGN_CENTER; +} + +void SpeakerSAL::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(2853); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(185, 200)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(2853); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(170, 92)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerML::SpeakerML() { + _speakerName = "ML"; + _newSceneNumber = 2710; + _textPos = Common::Point(160, 40); + _color1 = 22; +} + +void SpeakerML::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(2712); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(99, 143)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(2712); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(105, 99)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerCHFL::SpeakerCHFL() { + _speakerName = "CHFL"; + _newSceneNumber = 4111; + _textPos = Common::Point(10, 40); + _color1 = 56; +} + +void SpeakerCHFL::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(4113); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(205, 116)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(4113); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(202, 71)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerCHFR::SpeakerCHFR() { + _speakerName = "CHFR"; + _newSceneNumber = 4110; + _textPos = Common::Point(160, 40); + _color1 = 56; +} + +void SpeakerCHFR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(4112); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(103, 116)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(4112); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(106, 71)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerPL::SpeakerPL() { + _speakerName = "PL"; + _newSceneNumber = 4060; + _textPos = Common::Point(160, 40); + _color1 = 5; +} + +void SpeakerPL::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(4062); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(107, 117)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(4062); + _object2.setStrip2(1); + _object2.fixPriority(200); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(105, 62)); + _object2.setAction(&_speakerAction, NULL); + + _object3.postInit(&_objectList); + _object3.setVisage(4062); + _object3.setStrip2(3); + _object3.fixPriority(255); + _object3.changeZoom(100); + _object3._frame = 1; + _object3.setPosition(Common::Point(105, 59)); + _object3.setAction(&_speakerAction2, NULL); + + Speaker::setText(msg); +} + +void SpeakerPL::removeText() { + _object3.remove(); + AnimatedSpeaker::removeText(); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerPR::SpeakerPR() { + _speakerName = "PR"; + _newSceneNumber = 4061; + _textPos = Common::Point(10, 40); + _color1 = 5; +} + +void SpeakerPR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(4063); + _object1.setStrip2(1); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(212, 117)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(4063); + _object2.setStrip2(2); + _object2.fixPriority(200); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(214, 62)); + _object2.setAction(&_speakerAction, NULL); + + _object3.postInit(&_objectList); + _object3.setVisage(4063); + _object3.setStrip2(3); + _object3.fixPriority(255); + _object3.changeZoom(100); + _object3._frame = 1; + _object3.setPosition(Common::Point(214, 59)); + _object3.setAction(&_speakerAction2, NULL); + + Speaker::setText(msg); +} + +void SpeakerPR::removeText() { + _object3.remove(); + AnimatedSpeaker::removeText(); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerCDR::SpeakerCDR() { + _speakerName = "CDR"; + _newSceneNumber = 4161; + _textPos = Common::Point(10, 40); + _color1 = 52; +} + +void SpeakerCDR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(4163); + _object1.setStrip2(1); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(208, 97)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(4163); + _object2.setStrip2(2); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(200, 57)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerCDL::SpeakerCDL() { + _speakerName = "CDL"; + _newSceneNumber = 4160; + _textPos = Common::Point(160, 40); + _color1 = 52; +} + +void SpeakerCDL::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(4162); + _object1.setStrip2(1); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(112, 97)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(4162); + _object2.setStrip2(2); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(115, 57)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerFLL::SpeakerFLL() { + _speakerName = "FLL"; + _newSceneNumber = 5221; + _textPos = Common::Point(10, 40); + _color1 = 17; +} + +void SpeakerFLL::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(5223); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(216, 129)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(5223); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(210, 67)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +/*--------------------------------------------------------------------------*/ + +SpeakerBatR::SpeakerBatR() { + _speakerName = "BATR"; + _newSceneNumber = 5360; + _textPos = Common::Point(140, 40); + _color1 = 3; +} + +void SpeakerBatR::setText(const Common::String &msg) { + _object1.postInit(&_objectList); + _object1.setVisage(5361); + _object1.setStrip2(2); + _object1.fixPriority(255); + _object1.changeZoom(100); + _object1._frame = 1; + _object1.setPosition(Common::Point(137, 122)); + _object1.animate(ANIM_MODE_7, 0, NULL); + + _object2.postInit(&_objectList); + _object2.setVisage(5361); + _object2.setStrip2(1); + _object2.fixPriority(255); + _object2.changeZoom(100); + _object2._frame = 1; + _object2.setPosition(Common::Point(137, 104)); + _object2.setAction(&_speakerAction, NULL); + + Speaker::setText(msg); +} + +} // End of namespace Ringworld + +} // End of namespace TsAGE diff --git a/engines/tsage/ringworld/ringworld_speakers.h b/engines/tsage/ringworld/ringworld_speakers.h new file mode 100644 index 0000000000..305984a184 --- /dev/null +++ b/engines/tsage/ringworld/ringworld_speakers.h @@ -0,0 +1,337 @@ +/* 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_RINGWORLD_SPEAKERS_H +#define TSAGE_RINGWORLD_SPEAKERS_H + +#include "common/scummsys.h" +#include "tsage/converse.h" +#include "tsage/events.h" +#include "tsage/core.h" +#include "tsage/scenes.h" +#include "tsage/globals.h" +#include "tsage/ringworld/ringworld_logic.h" + +namespace TsAGE { + +namespace Ringworld { + +using namespace TsAGE; + +class SpeakerGText : public Speaker { +public: + SceneObject _sceneObject; +public: + SpeakerGText(); + + virtual Common::String getClassName() { return "SpeakerGText"; } + virtual void setText(const Common::String &msg); + virtual void removeText(); +}; + +class SpeakerPOR : public AnimatedSpeaker { + class SpeakerAction1 : public SpeakerAction { + public: + virtual void signal(); + }; + +public: + SceneObject _object3; + SpeakerAction1 _action2; +public: + SpeakerPOR(); + virtual Common::String getClassName() { return "SpeakerPOR"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerOR : public AnimatedSpeaker { +public: + SpeakerOR(); + virtual Common::String getClassName() { return "SpeakerOR"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerOText : public SpeakerGText { +public: + SpeakerOText(); + + virtual Common::String getClassName() { return "SpeakerOText"; } +}; + +class SpeakerPOText : public ScreenSpeaker { +public: + SpeakerPOText(); + + virtual Common::String getClassName() { return "SpeakerPOText"; } +}; + +class SpeakerSText : public ScreenSpeaker { +public: + SpeakerSText(); + + virtual Common::String getClassName() { return "SpeakerSText"; } +}; + +class SpeakerQText : public ScreenSpeaker { +public: + SpeakerQText(); + + virtual Common::String getClassName() { return "SpeakerQText"; } +}; + +class SpeakerMText : public ScreenSpeaker { +public: + SpeakerMText(); + + virtual Common::String getClassName() { return "SpeakerMText"; } +}; + +class SpeakerCText : public ScreenSpeaker { +public: + SpeakerCText(); + + virtual Common::String getClassName() { return "SpeakerCText"; } +}; + +class SpeakerEText : public ScreenSpeaker { +public: + SpeakerEText(); + + virtual Common::String getClassName() { return "SpeakerEText"; } +}; + +class SpeakerGR : public AnimatedSpeaker { +public: + SpeakerGR(); + + virtual Common::String getClassName() { return "SpeakerGR"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerHText : public ScreenSpeaker { +public: + SpeakerHText(); + + virtual Common::String getClassName() { return "SpeakerHText"; } +}; + +class SpeakerPText : public ScreenSpeaker { +public: + SpeakerPText(); + + virtual Common::String getClassName() { return "SpeakerPText"; } +}; + +class SpeakerCHFText : public ScreenSpeaker { +public: + SpeakerCHFText(); + + virtual Common::String getClassName() { return "SpeakerCHFText"; } +}; + +class SpeakerSKText : public ScreenSpeaker { +public: + SpeakerSKText(); + + virtual Common::String getClassName() { return "SpeakerSKText"; } +}; + +class SpeakerCDRText : public ScreenSpeaker { +public: + SpeakerCDRText(); + + virtual Common::String getClassName() { return "SpeakerCDRText"; } +}; + +class SpeakerFLText : public ScreenSpeaker { +public: + SpeakerFLText(); + + virtual Common::String getClassName() { return "SpeakerFLText"; } +}; + +class SpeakerBatText : public ScreenSpeaker { +public: + SpeakerBatText(); + + virtual Common::String getClassName() { return "SpeakerFLText"; } +}; + +class SpeakerQR : public AnimatedSpeaker { +public: + SpeakerQR(); + + virtual Common::String getClassName() { return "SpeakerQR"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerQU : public AnimatedSpeaker { +public: + SpeakerQU(); + + virtual Common::String getClassName() { return "SpeakerQU"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerSKL : public AnimatedSpeaker { +public: + SpeakerSKL(); + + virtual Common::String getClassName() { return "SpeakerQL"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerQL : public AnimatedSpeaker { +public: + SpeakerQL(); + + virtual Common::String getClassName() { return "SpeakerQL"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerSR : public AnimatedSpeaker { +public: + SceneObject _object3; +public: + SpeakerSR(); + + virtual Common::String getClassName() { return "SpeakerSR"; } + void setText(const Common::String &msg); +}; + +class SpeakerSL : public AnimatedSpeaker { +public: + SpeakerSL(); + + virtual Common::String getClassName() { return "SpeakerSL"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerCR : public AnimatedSpeaker { +public: + SpeakerCR(); + + virtual Common::String getClassName() { return "SpeakerCR"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerMR : public AnimatedSpeaker { +public: + SpeakerMR(); + + virtual Common::String getClassName() { return "SpeakerMR"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerSAL : public AnimatedSpeaker { +public: + SpeakerSAL(); + + virtual Common::String getClassName() { return "SpeakerSAL"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerML : public AnimatedSpeaker { +public: + SpeakerML(); + + virtual Common::String getClassName() { return "SpeakerML"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerCHFL : public AnimatedSpeaker { +public: + SpeakerCHFL(); + + virtual Common::String getClassName() { return "SpeakerCHFL"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerCHFR : public AnimatedSpeaker { +public: + SpeakerCHFR(); + + virtual Common::String getClassName() { return "SpeakerCHFR"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerPL : public AnimatedSpeaker { +public: + SceneObject _object3; + SpeakerAction _speakerAction2; + + SpeakerPL(); + + virtual Common::String getClassName() { return "SpeakerPL"; } + virtual void setText(const Common::String &msg); + virtual void removeText(); +}; + +class SpeakerPR : public AnimatedSpeaker { +public: + SceneObject _object3; + SpeakerAction _speakerAction2; + + SpeakerPR(); + + virtual Common::String getClassName() { return "SpeakerPR"; } + virtual void setText(const Common::String &msg); + virtual void removeText(); +}; + +class SpeakerCDR : public AnimatedSpeaker { +public: + SpeakerCDR(); + + virtual Common::String getClassName() { return "SpeakerCDR"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerCDL : public AnimatedSpeaker { +public: + SpeakerCDL(); + + virtual Common::String getClassName() { return "SpeakerCDL"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerFLL : public AnimatedSpeaker { +public: + SpeakerFLL(); + + virtual Common::String getClassName() { return "SpeakerFLL"; } + virtual void setText(const Common::String &msg); +}; + +class SpeakerBatR : public AnimatedSpeaker { +public: + SpeakerBatR(); + + virtual Common::String getClassName() { return "SpeakerBatR"; } + virtual void setText(const Common::String &msg); +}; + +} // End of namespace Ringworld + +} // End of namespace TsAGE + +#endif diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h index 03beafed7c..f81454d5e9 100644 --- a/engines/tsage/saveload.h +++ b/engines/tsage/saveload.h @@ -138,6 +138,18 @@ public: } } } + + void addBefore(T existingItem, T newItem) { + typename SynchronizedList<T>::iterator i = this->begin(); + while ((i != this->end()) && (*i != existingItem)) ++i; + this->insert(i, newItem); + } + void addAfter(T existingItem, T newItem) { + typename SynchronizedList<T>::iterator i = this->begin(); + while ((i != this->end()) && (*i != existingItem)) ++i; + if (i != this->end()) ++i; + this->insert(i, newItem); + } }; /** diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 5aeacda6fe..d68f5c2ee5 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -20,11 +20,15 @@ * */ +#include "common/config-manager.h" +#include "common/translation.h" +#include "gui/saveload.h" #include "tsage/scenes.h" #include "tsage/globals.h" #include "tsage/ringworld/ringworld_logic.h" #include "tsage/tsage.h" #include "tsage/saveload.h" +#include "tsage/staticres.h" namespace TsAGE { @@ -77,12 +81,7 @@ void SceneManager::sceneChange() { } // Clear the secondary scene object list - io = _globals->_sceneManager._altSceneObjects.begin(); - while (io != _globals->_sceneManager._altSceneObjects.end()) { - SceneObject *sceneObj = *io; - ++io; - sceneObj->removeObject(); - } + _altSceneObjects.clear(); // Clear the hotspot list SynchronizedList<SceneItem *>::iterator ii = _globals->_sceneItems.begin(); @@ -510,6 +509,51 @@ void Scene::setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent /*--------------------------------------------------------------------------*/ +void Game::restartGame() { + if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1) + _globals->_game->restart(); +} + +void Game::saveGame() { + if (!_vm->canSaveGameStateCurrently()) + MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING); + else { + // Show the save dialog + handleSaveLoad(true, _globals->_sceneHandler->_saveGameSlot, _globals->_sceneHandler->_saveName); + } +} + +void Game::restoreGame() { + if (!_vm->canLoadGameStateCurrently()) + MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING); + else { + // Show the load dialog + handleSaveLoad(false, _globals->_sceneHandler->_loadGameSlot, _globals->_sceneHandler->_saveName); + } +} + +void Game::quitGame() { + if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) + _vm->quitGame(); +} + +void Game::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) { + const EnginePlugin *plugin = 0; + EngineMan.findGame(_vm->getGameId(), &plugin); + GUI::SaveLoadChooser *dialog; + if (saveFlag) + dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save")); + else + dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load")); + + dialog->setSaveMode(saveFlag); + + saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); + saveName = dialog->getResultString(); + + delete dialog; +} + void Game::execute() { // Main game loop bool activeFlag = false; diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h index 7e8c26f912..b03b8fa906 100644 --- a/engines/tsage/scenes.h +++ b/engines/tsage/scenes.h @@ -115,7 +115,7 @@ protected: SynchronizedList<GameHandler *> _handlers; static bool notLockedFn(GameHandler *g); - virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {} + virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName); public: virtual ~Game() {} @@ -125,13 +125,14 @@ public: void execute(); virtual void start() = 0; virtual void restart() {} - virtual void restartGame() {} - virtual void saveGame() {} - virtual void restoreGame() {} - virtual void quitGame() {} + virtual void restartGame(); + virtual void saveGame(); + virtual void restoreGame(); + virtual void quitGame(); virtual void endGame(int resNum, int lineNum) {} virtual Scene *createScene(int sceneNumber) = 0; virtual void processEvent(Event &event) {} + virtual void rightClick() {} }; } // End of namespace TsAGE diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp index 0b77628801..2139056770 100644 --- a/engines/tsage/sound.cpp +++ b/engines/tsage/sound.cpp @@ -2456,7 +2456,7 @@ void ASound::unPrime() { _action = NULL; } -void ASound::fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag, Action *action) { +void ASound::fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag, EventHandler *action) { if (action) _action = action; @@ -2485,10 +2485,19 @@ void ASoundExt::signal() { } } -void ASoundExt::fadeOut2(Action *action) { +void ASoundExt::fadeOut2(EventHandler *action) { fade(0, 10, 10, true, action); } +void ASoundExt::changeSound(int soundNum) { + if (isPlaying()) { + _soundNum = soundNum; + fadeOut2(this); + } else { + fadeSound(soundNum); + } +} + /*--------------------------------------------------------------------------*/ SoundDriver::SoundDriver() { diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h index afcc8f6377..a8ff348bc6 100644 --- a/engines/tsage/sound.h +++ b/engines/tsage/sound.h @@ -365,7 +365,7 @@ public: class ASound: public EventHandler { public: Sound _sound; - Action *_action; + EventHandler *_action; int _cueValue; ASound(); @@ -385,7 +385,7 @@ public: bool isMuted() const { return _sound.isMuted(); } void pause(bool flag) { _sound.pause(flag); } void mute(bool flag) { _sound.mute(flag); } - void fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag, Action *action); + void fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag, EventHandler *action); void fadeIn() { fade(127, 5, 10, false, NULL); } void fadeOut(Action *action) { fade(0, 5, 10, true, action); } void setTimeIndex(uint32 timeIndex) { _sound.setTimeIndex(timeIndex); } @@ -406,7 +406,8 @@ public: int _soundNum; ASoundExt(); - void fadeOut2(Action *action); + void fadeOut2(EventHandler *action); + void changeSound(int soundNum); virtual Common::String getClassName() { return "ASoundExt"; } virtual void synchronize(Serializer &s); diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp index 819cf56f31..6c0499cfb2 100644 --- a/engines/tsage/staticres.cpp +++ b/engines/tsage/staticres.cpp @@ -72,12 +72,8 @@ const char *DEFAULT_SCENE_HOTSPOT = "That accomplishes nothing."; const char *SAVE_ERROR_MSG = "Error occurred saving game. Please do not try to restore this game!"; const char *SAVING_NOT_ALLOWED_MSG = "Saving is not allowed at this time."; const char *RESTORING_NOT_ALLOWED_MSG = "Restoring is not allowed at this time."; -const char *RESTART_CONFIRM_MSG = "Do you want to restart your game?"; const char *INV_EMPTY_MSG = "You have nothing in your possesion."; -const char *HELP_MSG = "Ringworld\rRevenge of the Patriarch\x14\rScummVM Version\r\r\ -\x01 Keyboard shortcuts...\rF2 - Sound options\rF3 - Quit\r\ -F4 - Restart\rF5 - Save game\rF7 - Restore Game\rF10 - Pause game"; const char *QUIT_CONFIRM_MSG = "Do you want to quit playing this game?"; const char *RESTART_MSG = "Do you want to restart this game?"; const char *GAME_PAUSED_MSG = "Game is paused."; @@ -97,6 +93,9 @@ const char *PICK_BTN_STRING = "Pick"; namespace Ringworld { // Dialog resources +const char *HELP_MSG = "Ringworld\rRevenge of the Patriarch\x14\rScummVM Version\r\r\ +\x01 Keyboard shortcuts...\rF2 - Sound options\rF3 - Quit\r\ +F4 - Restart\rF5 - Save game\rF7 - Restore Game\rF10 - Pause game"; const char *WATCH_INTRO_MSG = "Do you wish to watch the introduction?"; const char *START_PLAY_BTN_STRING = " Start Play "; const char *INTRODUCTION_BTN_STRING = "Introduction"; @@ -129,6 +128,9 @@ const char *DEMO_RESUME_BTN_STRING = "Resume"; namespace BlueForce { // Dialog resources +const char *HELP_MSG = "Blue Force\x14\rScummVM Version\r\r\ +Keyboard shortcuts...\rF2 - Sound options\rF3 - Quit\r\ +F4 - Restart\rF5 - Save game\rF7 - Restore Game\rF10 - Pause game"; const char *WATCH_INTRO_MSG = "Do you wish to watch the introduction?"; const char *START_PLAY_BTN_STRING = " Play "; const char *INTRODUCTION_BTN_STRING = " Watch "; @@ -155,6 +157,9 @@ const char *CITY_HALL_JAIL = "City Hall & Jail"; const char *JAMISON_RYAN = "Jamison & Ryan"; const char *BIKINI_HUT = "Bikini Hut"; +// Scene 60 radio messages +const char *RADIO_BTN_LIST[8] = { "10-2 ", "10-4 ", "10-13", "10-15", "10-27", "10-35", "10-97", "10-98" }; + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h index b08e92def2..172adc218e 100644 --- a/engines/tsage/staticres.h +++ b/engines/tsage/staticres.h @@ -39,10 +39,8 @@ extern const char *DEFAULT_SCENE_HOTSPOT; extern const char *SAVE_ERROR_MSG; extern const char *SAVING_NOT_ALLOWED_MSG; extern const char *RESTORING_NOT_ALLOWED_MSG; -extern const char *RESTART_CONFIRM_MSG; // Dialogs -extern const char *HELP_MSG; extern const char *QUIT_CONFIRM_MSG; extern const char *RESTART_MSG; extern const char *GAME_PAUSED_MSG; @@ -62,6 +60,7 @@ extern const char *INV_EMPTY_MSG; namespace Ringworld { // Dialog resources +extern const char *HELP_MSG; extern const char *WATCH_INTRO_MSG; extern const char *START_PLAY_BTN_STRING; extern const char *INTRODUCTION_BTN_STRING; @@ -95,6 +94,7 @@ extern const char *DEMO_RESUME_BTN_STRING; namespace BlueForce { // Dialog resources +extern const char *HELP_MSG; extern const char *WATCH_INTRO_MSG; extern const char *START_PLAY_BTN_STRING; extern const char *INTRODUCTION_BTN_STRING; @@ -121,6 +121,9 @@ extern const char *CITY_HALL_JAIL; extern const char *JAMISON_RYAN; extern const char *BIKINI_HUT; +// Scene 60 radio dispatch buttons +extern const char *RADIO_BTN_LIST[8]; + } // End of namespace BlueForce } // End of namespace TsAGE diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp index 2fcabff16c..ca63c4c3e0 100644 --- a/engines/tsage/tsage.cpp +++ b/engines/tsage/tsage.cpp @@ -82,6 +82,12 @@ void TSageEngine::initialize() { _resourceManager->addLib("TSAGE.RLB"); } _globals = new BlueForce::BlueForceGlobals(); + + // Setup the user interface + BF_GLOBALS._uiElements.setup(Common::Point(0, BF_INTERFACE_Y - 2)); + + // Reset all global variables + BF_GLOBALS.reset(); } _globals->gfxManager().setDefaults(); diff --git a/engines/tsage/tsage.h b/engines/tsage/tsage.h index 88175f92ce..7bb3c7a989 100644 --- a/engines/tsage/tsage.h +++ b/engines/tsage/tsage.h @@ -62,6 +62,7 @@ struct tSageGameDescription; #define SCREEN_HEIGHT 200 #define SCREEN_CENTER_X 160 #define SCREEN_CENTER_Y 100 +#define BF_INTERFACE_Y 168 class TSageEngine : public Engine { private: |
