diff options
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.cpp | 48 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_logic.h | 3 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes3.cpp | 72 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_scenes3.h | 13 | ||||
-rw-r--r-- | engines/tsage/blue_force/blueforce_ui.cpp | 2 | ||||
-rw-r--r-- | engines/tsage/core.cpp | 60 | ||||
-rw-r--r-- | engines/tsage/core.h | 5 | ||||
-rw-r--r-- | engines/tsage/events.cpp | 2 | ||||
-rw-r--r-- | engines/tsage/globals.cpp | 2 | ||||
-rw-r--r-- | engines/tsage/globals.h | 2 |
10 files changed, 165 insertions, 44 deletions
diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp index 985a1578ab..31ebab3c47 100644 --- a/engines/tsage/blue_force/blueforce_logic.cpp +++ b/engines/tsage/blue_force/blueforce_logic.cpp @@ -314,6 +314,38 @@ void NamedObject::synchronize(Serializer &s) { s.syncAsSint16LE(_useLineNum); } +void NamedObject::startAction(CursorType action) { + 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); +*/ +} + void NamedObject::setup(int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) { _resNum = resNum; _lookLineNum = lookLineNum; @@ -336,6 +368,7 @@ void NamedObject::setup(int resNum, int lookLineNum, int talkLineNum, int useLin } } + /*--------------------------------------------------------------------------*/ CountdownObject::CountdownObject(): NamedObject() { @@ -467,6 +500,21 @@ void SceneExt::loadScene(int sceneNum) { _v51C34.bottom = 300; } +void SceneExt::checkGun() { + if (BF_GLOBALS.getFlag(fLoadedSpare) && (BF_GLOBALS._v4CEBA > 0)) { + if (--BF_GLOBALS._v4CEBA == 0) + BF_GLOBALS.clearFlag(fGunLoaded); + } else { + if (BF_GLOBALS._v4CEB8 > 0) + --BF_GLOBALS._v4CEB8; + + if (!BF_GLOBALS._v4CEB8) + BF_GLOBALS.clearFlag(fGunLoaded); + } + + BF_GLOBALS._sound3.play(4); +} + /*--------------------------------------------------------------------------*/ GameScene::GameScene() { diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h index a3bcf9ea01..9de7add49d 100644 --- a/engines/tsage/blue_force/blueforce_logic.h +++ b/engines/tsage/blue_force/blueforce_logic.h @@ -106,6 +106,7 @@ public: virtual Common::String getClassName() { return "NamedObject"; } virtual void synchronize(Serializer &s); virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void startAction(CursorType action); void setup(int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item); }; @@ -151,7 +152,7 @@ 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); } diff --git a/engines/tsage/blue_force/blueforce_scenes3.cpp b/engines/tsage/blue_force/blueforce_scenes3.cpp index 42c5c5dcde..fd1e613d00 100644 --- a/engines/tsage/blue_force/blueforce_scenes3.cpp +++ b/engines/tsage/blue_force/blueforce_scenes3.cpp @@ -36,18 +36,18 @@ namespace BlueForce { * *--------------------------------------------------------------------------*/ -void Scene300::Object::startMover(CursorType action) { +void Scene300::Object::startAction(CursorType action) { if (action == CURSOR_TALK) { Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene; scene->_stripManager.start(_stripNumber, scene); } else { - NamedObject::startMover(action); + NamedObject::startAction(action); } } -void Scene300::Object17::startMover(CursorType action) { +void Scene300::Object17::startAction(CursorType action) { if ((action != CURSOR_USE) || !BF_GLOBALS.getFlag(3)) { - NamedObject::startMover(action); + NamedObject::startAction(action); } else if ((BF_GLOBALS._dayNumber != 2) || (BF_GLOBALS._bookmark >= bEndDayOne)) { Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene; setAction(&scene->_action4); @@ -56,32 +56,32 @@ void Scene300::Object17::startMover(CursorType action) { } } -void Scene300::Item1::startMover(CursorType action) { - if (action == CURSOR_TALK) { +void Scene300::Item1::startAction(CursorType action) { + 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); } else { - NamedHotspot::startMover(action); + NamedHotspot::startAction(action); } } -void Scene300::Item2::startMover(CursorType action) { +void Scene300::Item2::startAction(CursorType action) { if ((action == CURSOR_LOOK) || (action == CURSOR_USE)) { Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene; scene->setAction(&scene->_sequenceManager1, scene, 304, &scene->_object11, NULL); } else { - NamedHotspot::startMover(action); + NamedHotspot::startAction(action); } } -void Scene300::Item14::startMover(CursorType action) { +void Scene300::Item14::startAction(CursorType action) { ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 151, 54); } -void Scene300::Item15::startMover(CursorType action) { +void Scene300::Item15::startAction(CursorType action) { ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 316, 90); } @@ -94,10 +94,10 @@ void Scene300::Action1::signal() { setDelay(1); break; case 1: - if (BF_GLOBALS.getFlag(7)) - SceneItem::display2(300, 0); - else + if (BF_GLOBALS.getFlag(fWithLyle)) SceneItem::display2(666, 27); + else + SceneItem::display2(300, 0); setDelay(1); break; case 2: { @@ -222,6 +222,8 @@ void Scene300::Action5::signal() { Scene300::Scene300(): SceneExt(), _object13(3000), _object14(3001), _object15(3002), _object16(3003) { _field2760 = _field2762 = 0; + + _cursorVisage.setVisage(1, 8); } void Scene300::postInit(SceneObjectList *OwnerList) { @@ -341,6 +343,20 @@ BF_GLOBALS._player.setStrip(1); setAction(&_sequenceManager1, this, 306, &BF_GLOBALS._player, &_object8, NULL); break; } + + _item10.setup(4, 300, 7, 13, 16, 1); + _item11.setup(2, 300, 9, 13, 18, 1); + _item12.setup(5, 300, 10, 13, 19, 1); + _item13.setup(3, 300, 25, 26, 27, 1); + _item2.setup(Rect(266, 54, 272, 59), 300, -1, -1, -1, 1, NULL); + _item1.setup(Rect(262, 47, 299, 76), 300, 1, 13, -1, 1, NULL); + _item4.setup(Rect(0, 85, SCREEN_WIDTH - 1, BF_INTERFACE_Y - 1), 300, 6, 13, 15, 1, NULL); + _item7.setup(Rect(219, 46, 251, 74), 300, 22, 23, 24, 1, NULL); + _item8.setup(Rect(301, 53, 319, 78), 300, 22, 23, 24, 1, NULL); + _item5.setup(Rect(179, 44, 200, 55), 300, 8, 13, 17, 1, NULL); + _item6.setup(Rect(210, 46, 231, 55), 300, 8, 13, 17, 1, NULL); + _item3.setup(Rect(160, 0, SCREEN_WIDTH - 1, 75), 300, 4, 13, 14, 1, NULL); + _item9.setup(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y), 300, 29, 30, 31, 1, NULL); } void Scene300::signal() { @@ -509,19 +525,16 @@ void Scene300::signal() { void Scene300::process(Event &event) { SceneExt::process(event); - if ((BF_GLOBALS._player._field8E != 0) && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { - Visage visage; - + if (BF_GLOBALS._player._enabled && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) { if (_item14.contains(event.mousePos)) { - visage.setVisage(1, 8); - GfxSurface surface = visage.getFrame(2); + GfxSurface surface = _cursorVisage.getFrame(2); BF_GLOBALS._events.setCursor(surface); } else if (_item15.contains(event.mousePos)) { - visage.setVisage(1, 8); - GfxSurface surface = visage.getFrame(3); + GfxSurface surface = _cursorVisage.getFrame(3); BF_GLOBALS._events.setCursor(surface); } else { - CursorType cursorId = BF_GLOBALS._events.hideCursor(); + // In case an exit cursor was being shown, restore the previously selected cursor + CursorType cursorId = BF_GLOBALS._events.getCursor(); BF_GLOBALS._events.setCursor(cursorId); } } @@ -530,7 +543,7 @@ void Scene300::process(Event &event) { void Scene300::dispatch() { SceneExt::dispatch(); - if (_action) { + if (!_action) { int regionIndex = BF_GLOBALS._player.getRegionIndex(); if ((regionIndex == 1) && (_field2762 == 1)) { BF_GLOBALS._player.disableControl(); @@ -546,6 +559,19 @@ void Scene300::dispatch() { 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); + } + } } } diff --git a/engines/tsage/blue_force/blueforce_scenes3.h b/engines/tsage/blue_force/blueforce_scenes3.h index 42ae69fc3f..4acb424207 100644 --- a/engines/tsage/blue_force/blueforce_scenes3.h +++ b/engines/tsage/blue_force/blueforce_scenes3.h @@ -46,29 +46,29 @@ class Scene300: public SceneExt { public: Object(int stripNumber) { _stripNumber = stripNumber; } - virtual void startMover(CursorType action); + virtual void startAction(CursorType action); }; class Object17: public NamedObject { public: - virtual void startMover(CursorType action); + virtual void startAction(CursorType action); }; /* Items */ class Item1: public NamedHotspot { public: - virtual void startMover(CursorType action); + virtual void startAction(CursorType action); }; class Item2: public NamedHotspot { public: - virtual void startMover(CursorType action); + virtual void startAction(CursorType action); }; class Item14: public NamedHotspot { public: - virtual void startMover(CursorType action); + virtual void startAction(CursorType action); }; class Item15: public NamedHotspot { public: - virtual void startMover(CursorType action); + virtual void startAction(CursorType action); }; /* Actions */ @@ -97,6 +97,7 @@ private: public: SequenceManager _sequenceManager1, _sequenceManager2; SequenceManager _sequenceManager3, _sequenceManager4; + Visage _cursorVisage; NamedObject _object1; FollowerObject _object2, _object3, _object4, _object5, _object6, _object7; SceneObject _object8, _object9, _object10; diff --git a/engines/tsage/blue_force/blueforce_ui.cpp b/engines/tsage/blue_force/blueforce_ui.cpp index b455541dd4..56c13572cc 100644 --- a/engines/tsage/blue_force/blueforce_ui.cpp +++ b/engines/tsage/blue_force/blueforce_ui.cpp @@ -201,7 +201,7 @@ void UICollection::draw() { /*--------------------------------------------------------------------------*/ void UIElements::process(Event &event) { - if (_clearScreen && BF_GLOBALS._player._field8E && (BF_GLOBALS._sceneManager._sceneNumber != 50)) { + if (_clearScreen && BF_GLOBALS._player._enabled && (BF_GLOBALS._sceneManager._sceneNumber != 50)) { if (_bounds.contains(event.mousePos)) { } else if (_field4E) { diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 4842284442..10d2663fe0 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -1463,7 +1463,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(); @@ -1475,12 +1479,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 @@ -1590,6 +1597,9 @@ void SceneItem::display(int resNum, int lineNum, ...) { _globals->_sceneText.remove(); } + + if ((_vm->getGameID() == GType_BlueForce) && BF_GLOBALS._uiElements._active) + BF_GLOBALS._uiElements.show(); } void SceneItem::display2(int resNum, int lineNum) { @@ -1603,23 +1613,46 @@ void SceneItem::display2(int resNum, int lineNum) { 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); +} + /*--------------------------------------------------------------------------*/ 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; } } @@ -1639,18 +1672,24 @@ 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); 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::display2(_resNum, _talkLineNum); break; @@ -2814,7 +2853,7 @@ void Player::disableControl() { _canWalk = false; _uiEnabled = false; _globals->_events.setCursor(CURSOR_NONE); - _field8E = 0; + _enabled = false; if ((_vm->getGameID() == GType_BlueForce) && BF_GLOBALS._uiElements._active) BF_GLOBALS._uiElements.hide(); @@ -2823,6 +2862,7 @@ void Player::disableControl() { void Player::enableControl() { _canWalk = true; _uiEnabled = true; + _enabled = true; _globals->_events.setCursor(CURSOR_WALK); switch (_globals->_events.getCursor()) { @@ -2863,7 +2903,7 @@ void Player::synchronize(Serializer &s) { s.syncAsSint16LE(_field8C); if (_vm->getGameID() == GType_BlueForce) - s.syncAsSint16LE(_field8E); + s.syncAsByte(_enabled); } /*--------------------------------------------------------------------------*/ @@ -3662,7 +3702,7 @@ 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.handled = _globals->_events.getCursor() != CURSOR_WALK; if (_globals->_player._uiEnabled && _globals->_player._canWalk && diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 9cd28b1e89..13761cec79 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -412,7 +412,7 @@ public: virtual Common::String getClassName() { return "SceneItem"; } virtual void remove(); virtual void destroy() {} - virtual void startMover(CursorType action) { doAction(action); } + virtual void startAction(CursorType action) { doAction(action); } virtual void doAction(int action); bool contains(const Common::Point &pt); @@ -420,6 +420,7 @@ public: 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); + static void display(const Common::String &msg); }; class SceneItemExt : public SceneItem { @@ -617,7 +618,7 @@ public: bool _canWalk; bool _uiEnabled; int _field8C; - int _field8E; + bool _enabled; public: Player(); diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index 72393832c8..6bda6c9af8 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -293,7 +293,7 @@ void EventsClass::setCursor(GfxSurface &cursor) { CursorMan.replaceCursor(cursorData, cursor.getBounds().width(), cursor.getBounds().height(), cursor._centroid.x, cursor._centroid.y, cursor._transColor); - _currentCursor = CURSOR_NONE; + _lastCursor = CURSOR_NONE; } void EventsClass::setCursorFromFlag() { diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index f8b42ec604..ebad77abc4 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -189,6 +189,8 @@ BlueForceGlobals::BlueForceGlobals(): Globals() { _dayNumber = 1; _v4CEA4 = 0; _v4CEA8 = 0; + _v4CEB8 = 0; + _v4CEBA = 0; _driveFromScene = 0; _driveToScene = 0; _v4CF9E = 0; diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h index c5324c38cd..dda95a9ef7 100644 --- a/engines/tsage/globals.h +++ b/engines/tsage/globals.h @@ -169,6 +169,8 @@ public: int _dayNumber; int _v4CEA4; int _v4CEA8; + int _v4CEB8; + int _v4CEBA; int _driveFromScene; int _driveToScene; int _v4CF9E; |