diff options
author | Paul Gilbert | 2016-08-22 20:22:41 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-22 20:22:41 -0400 |
commit | 8b3829549a2c82a09f7475c35173238f7470d587 (patch) | |
tree | c0965bfcae7153af1f831be1204726644d99da9e | |
parent | 65bc8cb83c01cc1e7e6c8c093b8f42080800718d (diff) | |
download | scummvm-rg350-8b3829549a2c82a09f7475c35173238f7470d587.tar.gz scummvm-rg350-8b3829549a2c82a09f7475c35173238f7470d587.tar.bz2 scummvm-rg350-8b3829549a2c82a09f7475c35173238f7470d587.zip |
TITANIC: Cleanup of engine references
29 files changed, 156 insertions, 76 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 261e77877d..29a6fd2209 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -782,24 +782,24 @@ void CGameObject::stopSound(int handle, uint seconds) { } int CGameObject::addTimer(int endVal, uint firstDuration, uint repeatDuration) { - CTimeEventInfo *timer = new CTimeEventInfo(g_vm->_events->getTicksCount(), - repeatDuration != 0, firstDuration, repeatDuration, this, endVal, CString()); + CTimeEventInfo *timer = new CTimeEventInfo(getTicksCount(), repeatDuration != 0, + firstDuration, repeatDuration, this, endVal, CString()); getGameManager()->addTimer(timer); return timer->_id; } int CGameObject::addTimer(uint firstDuration, uint repeatDuration) { - CTimeEventInfo *timer = new CTimeEventInfo(g_vm->_events->getTicksCount(), - repeatDuration != 0, firstDuration, repeatDuration, this, 0, CString()); + CTimeEventInfo *timer = new CTimeEventInfo(getTicksCount(), repeatDuration != 0, + firstDuration, repeatDuration, this, 0, CString()); getGameManager()->addTimer(timer); return timer->_id; } int CGameObject::startAnimTimer(const CString &action, uint firstDuration, uint repeatDuration) { - CTimeEventInfo *timer = new CTimeEventInfo(g_vm->_events->getTicksCount(), - repeatDuration > 0, firstDuration, repeatDuration, this, 0, action); + CTimeEventInfo *timer = new CTimeEventInfo(getTicksCount(), repeatDuration > 0, + firstDuration, repeatDuration, this, 0, action); getGameManager()->addTimer(timer); return timer->_id; @@ -1381,10 +1381,14 @@ int CGameObject::getClipDuration(const CString &name, int frameRate) const { return clip ? (clip->_endFrame - clip->_startFrame) * 1000 / frameRate : 0; } -uint32 CGameObject::getTickCount() { +uint32 CGameObject::getTicksCount() { return g_vm->_events->getTicksCount(); } +Common::SeekableReadStream *CGameObject::getResource(const CString &name) { + return g_vm->_filesManager->getResource(name); +} + bool CGameObject::compareRoomFlags(int mode, uint flags1, uint flags2) { switch (mode) { case 1: diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index fca635388e..e2170a81d5 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -23,6 +23,7 @@ #ifndef TITANIC_GAME_OBJECT_H #define TITANIC_GAME_OBJECT_H +#include "common/stream.h" #include "titanic/support/mouse_cursor.h" #include "titanic/support/credit_text.h" #include "titanic/support/movie_range_info.h" @@ -442,7 +443,12 @@ protected: /** * Returns the current system tick count */ - uint32 getTickCount(); + uint32 getTicksCount(); + + /** + * Gets a resource from the DAT file + */ + Common::SeekableReadStream *getResource(const CString &name); /** * Returns true if a mail with a specified Id exists diff --git a/engines/titanic/game/announce.cpp b/engines/titanic/game/announce.cpp index 3b7dbe28cb..74c126476f 100644 --- a/engines/titanic/game/announce.cpp +++ b/engines/titanic/game/announce.cpp @@ -21,7 +21,6 @@ */ #include "titanic/game/announce.h" -#include "titanic/titanic.h" namespace Titanic { @@ -76,7 +75,7 @@ bool CAnnounce::TimerMsg(CTimerMsg *msg) { "", "", "", "", "", "", "" }; - int randVal = _nameIndex ? g_vm->getRandomNumber(2) : 0; + int randVal = _nameIndex ? getRandomNumber(2) : 0; switch (randVal) { case 0: case 1: @@ -85,21 +84,21 @@ bool CAnnounce::TimerMsg(CTimerMsg *msg) { queueSound(waveNames1[_nameIndex], _soundHandle); ++_nameIndex; } else { - queueSound(waveNames1[1 + g_vm->getRandomNumber(17)], _soundHandle); + queueSound(waveNames1[1 + getRandomNumber(17)], _soundHandle); } break; case 2: _soundHandle = playSound("z#189.wav"); - queueSound(waveNames2[1 + g_vm->getRandomNumber(35)], _soundHandle); + queueSound(waveNames2[1 + getRandomNumber(35)], _soundHandle); break; default: break; } - addTimer(1, 300000 + g_vm->getRandomNumber(30000), 0); - if (g_vm->getRandomNumber(3) == 0) + addTimer(1, 300000 + getRandomNumber(30000), 0); + if (getRandomNumber(3) == 0) addTimer(2, 4000, 0); } else if (msg->_timerCtr == 2) { diff --git a/engines/titanic/game/arboretum_gate.cpp b/engines/titanic/game/arboretum_gate.cpp index 1f92f56acb..4c3ca03b7a 100644 --- a/engines/titanic/game/arboretum_gate.cpp +++ b/engines/titanic/game/arboretum_gate.cpp @@ -21,7 +21,7 @@ */ #include "titanic/game/arboretum_gate.h" -#include "titanic/titanic.h" +#include "titanic/game/seasonal_adjustment.h" namespace Titanic { diff --git a/engines/titanic/game/bomb.cpp b/engines/titanic/game/bomb.cpp index b1f3fdc5f7..f3f1129e22 100644 --- a/engines/titanic/game/bomb.cpp +++ b/engines/titanic/game/bomb.cpp @@ -21,7 +21,6 @@ */ #include "titanic/game/bomb.h" -#include "titanic/titanic.h" namespace Titanic { @@ -211,7 +210,7 @@ bool CBomb::EnterRoomMsg(CEnterRoomMsg *msg) { _fieldE8 = 17; _fieldEC = 9; _fieldF0 = 0; - _startingTicks = g_vm->_events->getTicksCount(); + _startingTicks = getTicksCount(); return true; } diff --git a/engines/titanic/game/desk_click_responder.cpp b/engines/titanic/game/desk_click_responder.cpp index 2cd5d1e83b..0650b3a1f5 100644 --- a/engines/titanic/game/desk_click_responder.cpp +++ b/engines/titanic/game/desk_click_responder.cpp @@ -21,7 +21,6 @@ */ #include "titanic/game/desk_click_responder.h" -#include "titanic/titanic.h" namespace Titanic { @@ -51,7 +50,7 @@ bool CDeskClickResponder::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { if (_fieldD4) return CClickResponder::MouseButtonDownMsg(msg); - uint ticks = g_vm->_events->getTicksCount(); + uint ticks = getTicksCount(); if (!_ticks || ticks > (_ticks + 4000)) { playSound("a#22.wav"); _ticks = ticks; diff --git a/engines/titanic/game/head_smash_event.cpp b/engines/titanic/game/head_smash_event.cpp index 5b79acf7a5..5ec3d299d5 100644 --- a/engines/titanic/game/head_smash_event.cpp +++ b/engines/titanic/game/head_smash_event.cpp @@ -24,6 +24,11 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CHeadSmashEvent, CBackground) + ON_MESSAGE(ActMsg) + ON_MESSAGE(MovieEndMsg) +END_MESSAGE_MAP() + void CHeadSmashEvent::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); CBackground::save(file, indent); @@ -34,4 +39,18 @@ void CHeadSmashEvent::load(SimpleFile *file) { CBackground::load(file); } +bool CHeadSmashEvent::ActMsg(CActMsg *msg) { + if (msg->_action == "PlayToEnd") { + setVisible(true); + playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); + } + + return true; +} + +bool CHeadSmashEvent::MovieEndMsg(CMovieEndMsg *msg) { + changeView("CreatorsChamber.Node 1.W"); + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/head_smash_event.h b/engines/titanic/game/head_smash_event.h index 912cf36bf3..09fd7a54cc 100644 --- a/engines/titanic/game/head_smash_event.h +++ b/engines/titanic/game/head_smash_event.h @@ -28,6 +28,9 @@ namespace Titanic { class CHeadSmashEvent : public CBackground { + DECLARE_MESSAGE_MAP; + bool ActMsg(CActMsg *msg); + bool MovieEndMsg(CMovieEndMsg *msg); public: CLASSDEF; diff --git a/engines/titanic/game/head_smash_lever.cpp b/engines/titanic/game/head_smash_lever.cpp index 5a2fe1f4c2..d5c2eaf8c4 100644 --- a/engines/titanic/game/head_smash_lever.cpp +++ b/engines/titanic/game/head_smash_lever.cpp @@ -24,25 +24,78 @@ namespace Titanic { +BEGIN_MESSAGE_MAP(CHeadSmashLever, CBackground) + ON_MESSAGE(MouseButtonDownMsg) + ON_MESSAGE(ActMsg) + ON_MESSAGE(FrameMsg) + ON_MESSAGE(LoadSuccessMsg) +END_MESSAGE_MAP() + CHeadSmashLever::CHeadSmashLever() : CBackground(), - _fieldE0(0), _fieldE4(0), _fieldE8(0) {} + _enabled(false), _fieldE4(false), _ticksCount(0) {} void CHeadSmashLever::save(SimpleFile *file, int indent) { file->writeNumberLine(1, indent); - file->writeNumberLine(_fieldE0, indent); + file->writeNumberLine(_enabled, indent); file->writeNumberLine(_fieldE4, indent); - file->writeNumberLine(_fieldE8, indent); + file->writeNumberLine(_ticksCount, indent); CBackground::save(file, indent); } void CHeadSmashLever::load(SimpleFile *file) { file->readNumber(); - _fieldE0 = file->readNumber(); + _enabled = file->readNumber(); _fieldE4 = file->readNumber(); - _fieldE8 = file->readNumber(); + _ticksCount = file->readNumber(); CBackground::load(file); } +bool CHeadSmashLever::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { + if (_enabled) { + playMovie(0, 14, 0); + playSound("z#54.wav"); + int soundHandle = playSound("z#45.wav"); + queueSound("z#49.wav", soundHandle); + _ticksCount = getTicksCount(); + _fieldE4 = true; + } else { + playMovie(0); + playSound("z#56.wav"); + } + + return true; +} + +bool CHeadSmashLever::ActMsg(CActMsg *msg) { + if (msg->_action == "EnableObject") + _enabled = true; + else if (msg->_action == "DisableObject") + _enabled = false; + + return true; +} + +bool CHeadSmashLever::FrameMsg(CFrameMsg *msg) { + if (_fieldE4 && msg->_ticks > (_ticksCount + 750)) { + CActMsg actMsg1("CreatorsChamber.Node 1.S"); + actMsg1.execute("MoveToCreators"); + CActMsg actMsg2("PlayToEnd"); + actMsg2.execute("SmashingStatue"); + + playSound("b#16.wav"); + _fieldE4 = false; + } + + return true; +} + +bool CHeadSmashLever::LoadSuccessMsg(CLoadSuccessMsg *msg) { + if (_fieldE4) + _ticksCount = getTicksCount(); + + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/head_smash_lever.h b/engines/titanic/game/head_smash_lever.h index b8f04d39de..e2426b68da 100644 --- a/engines/titanic/game/head_smash_lever.h +++ b/engines/titanic/game/head_smash_lever.h @@ -28,10 +28,15 @@ namespace Titanic { class CHeadSmashLever : public CBackground { + DECLARE_MESSAGE_MAP; + bool MouseButtonDownMsg(CMouseButtonDownMsg *msg); + bool ActMsg(CActMsg *msg); + bool FrameMsg(CFrameMsg *msg); + bool LoadSuccessMsg(CLoadSuccessMsg *msg); public: - int _fieldE0; - int _fieldE4; - int _fieldE8; + bool _enabled; + bool _fieldE4; + int _ticksCount; public: CLASSDEF; CHeadSmashLever(); diff --git a/engines/titanic/game/seasonal_adjustment.h b/engines/titanic/game/seasonal_adjustment.h index 39132d614d..f96c13619d 100644 --- a/engines/titanic/game/seasonal_adjustment.h +++ b/engines/titanic/game/seasonal_adjustment.h @@ -27,6 +27,13 @@ namespace Titanic { +enum Season { + SPRING = 0, + SUMMER = 1, + AUTUMN = 2, + WINTER = 3 +}; + class CSeasonalAdjustment : public CBackground { public: int _fieldE0; diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp index 235fc9c7b0..8ba372eb7a 100644 --- a/engines/titanic/game/television.cpp +++ b/engines/titanic/game/television.cpp @@ -20,10 +20,10 @@ * */ -#include "titanic/titanic.h" #include "titanic/game/television.h" -#include "titanic/pet_control/pet_control.h" #include "titanic/game/get_lift_eye2.h" +#include "titanic/core/project_item.h" +#include "titanic/pet_control/pet_control.h" namespace Titanic { @@ -229,7 +229,7 @@ bool CTelevision::PETActivateMsg(CPETActivateMsg *msg) { } bool CTelevision::MovieEndMsg(CMovieEndMsg *msg) { - if (g_vm->getRandomNumber(6) == 0) { + if (getRandomNumber(6) == 0) { CParrotSpeakMsg parrotMsg("Television", ""); parrotMsg.execute("PerchedParrot"); } diff --git a/engines/titanic/messages/mouse_messages.cpp b/engines/titanic/messages/mouse_messages.cpp index 8ef7f38fd3..18fa625c1c 100644 --- a/engines/titanic/messages/mouse_messages.cpp +++ b/engines/titanic/messages/mouse_messages.cpp @@ -23,7 +23,6 @@ #include "titanic/messages/mouse_messages.h" #include "titanic/support/mouse_cursor.h" #include "titanic/support/screen_manager.h" -#include "titanic/titanic.h" namespace Titanic { diff --git a/engines/titanic/moves/exit_arboretum.cpp b/engines/titanic/moves/exit_arboretum.cpp index 169adb87a5..e0c2ab9c9d 100644 --- a/engines/titanic/moves/exit_arboretum.cpp +++ b/engines/titanic/moves/exit_arboretum.cpp @@ -21,7 +21,7 @@ */ #include "titanic/moves/exit_arboretum.h" -#include "titanic/titanic.h" +#include "titanic/game/seasonal_adjustment.h" namespace Titanic { diff --git a/engines/titanic/npcs/barbot.cpp b/engines/titanic/npcs/barbot.cpp index 0247b593bd..2524a835f8 100644 --- a/engines/titanic/npcs/barbot.cpp +++ b/engines/titanic/npcs/barbot.cpp @@ -380,12 +380,12 @@ bool CBarbot::LeaveViewMsg(CLeaveViewMsg *msg) { bool CBarbot::MovieEndMsg(CMovieEndMsg *msg) { if (msg->_endFrame == _frameNum) { _frameNum = -1; - _field14C = g_vm->_events->getTicksCount(); + _field14C = getTicksCount(); } if (msg->_endFrame == _field148) { _field148 = -1; - _field150 = g_vm->_events->getTicksCount(); + _field150 = getTicksCount(); } if (msg->_endFrame == _field13C) { @@ -678,7 +678,7 @@ bool CBarbot::FrameMsg(CFrameMsg *msg) { } bool CBarbot::LoadSuccessMsg(CLoadSuccessMsg *msg) { - _field14C = _field150 = g_vm->_events->getTicksCount(); + _field14C = _field150 = getTicksCount(); _frameNum = -1; _field148 = -1; @@ -720,7 +720,7 @@ bool CBarbot::TimerMsg(CTimerMsg *msg) { if (!_fieldC4 && compareRoomNameTo("Bar")) { CParrotSpeakMsg speakMsg("Barbot", "AskForDrink"); speakMsg.execute("PerchedParrot"); - addTimer(10000 + g_vm->getRandomNumber(20000)); + addTimer(10000 + getRandomNumber(20000)); } return true; diff --git a/engines/titanic/npcs/doorbot.cpp b/engines/titanic/npcs/doorbot.cpp index 8b98e0d0ef..4a5f3690c0 100644 --- a/engines/titanic/npcs/doorbot.cpp +++ b/engines/titanic/npcs/doorbot.cpp @@ -21,7 +21,7 @@ */ #include "titanic/npcs/doorbot.h" -#include "titanic/titanic.h" +#include "titanic/core/room_item.h" namespace Titanic { @@ -180,7 +180,7 @@ bool CDoorbot::OnSummonBotMsg(COnSummonBotMsg *msg) { sleep(2000); } - playClip(g_vm->getRandomNumber(1) ? "Whizz On Left" : "Whizz On Right", + playClip(getRandomNumber(1) ? "Whizz On Left" : "Whizz On Right", MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); movieEvent(); _npcFlags |= NPCFLAG_400000; @@ -371,7 +371,7 @@ bool CDoorbot::PutBotBackInHisBoxMsg(CPutBotBackInHisBoxMsg *msg) { bool CDoorbot::DismissBotMsg(CDismissBotMsg *msg) { if (_npcFlags & NPCFLAG_400000) { - playClip(g_vm->getRandomNumber(1) ? "Whizz Off Left" : "Whizz Off Right", + playClip(getRandomNumber(1) ? "Whizz Off Left" : "Whizz Off Right", MOVIE_STOP_PREVIOUS | MOVIE_NOTIFY_OBJECT | MOVIE_GAMESTATE); movieEvent(); @@ -440,7 +440,7 @@ bool CDoorbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) case 10562: if (_field108 == 1) { stopAnimTimer(_timerId); - _timerId = addTimer(2, g_vm->getRandomNumber(5000), 0); + _timerId = addTimer(2, getRandomNumber(5000), 0); } break; diff --git a/engines/titanic/npcs/maitre_d.cpp b/engines/titanic/npcs/maitre_d.cpp index 207a97ccc3..09444f5611 100644 --- a/engines/titanic/npcs/maitre_d.cpp +++ b/engines/titanic/npcs/maitre_d.cpp @@ -23,7 +23,6 @@ #include "titanic/npcs/maitre_d.h" #include "titanic/core/room_item.h" #include "titanic/sound/music_room.h" -#include "titanic/titanic.h" namespace Titanic { @@ -192,7 +191,7 @@ bool CMaitreD::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *m bool CMaitreD::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) { if (_field12C) { stopAnimTimer(_timerId); - _timerId = startAnimTimer("MD Fight", 3000 + g_vm->getRandomNumber(3000)); + _timerId = startAnimTimer("MD Fight", 3000 + getRandomNumber(3000)); } CTrueTalkNPC::TrueTalkNotifySpeechEndedMsg(msg); @@ -201,7 +200,7 @@ bool CMaitreD::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) bool CMaitreD::LoadSuccessMsg(CLoadSuccessMsg *msg) { if (_field12C) { - _timerId = startAnimTimer("MD Fight", 3000 + g_vm->getRandomNumber(3000)); + _timerId = startAnimTimer("MD Fight", 3000 + getRandomNumber(3000)); } return true; diff --git a/engines/titanic/npcs/parrot.cpp b/engines/titanic/npcs/parrot.cpp index 62b070efa4..53e6884415 100644 --- a/engines/titanic/npcs/parrot.cpp +++ b/engines/titanic/npcs/parrot.cpp @@ -23,7 +23,6 @@ #include "titanic/npcs/parrot.h" #include "titanic/core/project_item.h" #include "titanic/carry/carry.h" -#include "titanic/titanic.h" namespace Titanic { @@ -426,7 +425,7 @@ bool CParrot::ParrotSpeakMsg(CParrotSpeakMsg *msg) { } // Don't have the parrot speak too often - if ((g_vm->_events->getTicksCount() - _field120) < 20000 || _field100) + if ((getTicksCount() - _field120) < 20000 || _field100) return true; playSound("z#475.wav", 50); @@ -446,8 +445,8 @@ bool CParrot::ParrotSpeakMsg(CParrotSpeakMsg *msg) { else if (msg->_action == "EnterView") startTalking("PerchedParrot", 80159); } else if (msg->_target == "Cellpoints") { - if (g_vm->getRandomNumber(2) == 0) { - switch (g_vm->getRandomNumber(2)) { + if (getRandomNumber(2) == 0) { + switch (getRandomNumber(2)) { case 0: startTalking("PerchedParrot", 80193); break; @@ -473,7 +472,7 @@ bool CParrot::ParrotSpeakMsg(CParrotSpeakMsg *msg) { } } - _field120 = g_vm->_events->getTicksCount(); + _field120 = getTicksCount(); return true; } @@ -502,8 +501,8 @@ bool CParrot::NPCPlayIdleAnimationMsg(CNPCPlayIdleAnimationMsg *msg) { && _visible && !_v4 && !compareViewNameTo("ParrotLobby.Node 1.N")) { CGameObject *dragItem = getDraggingObject(); if (!dragItem || dragItem->getName() == "Chicken") { - if (!_v5 || g_vm->getRandomNumber(3) != 0) { - if (g_vm->getRandomNumber(1)) { + if (!_v5 ||getRandomNumber(3) != 0) { + if (getRandomNumber(1)) { startTalking(this, 280267, findView()); } else { msg->_names = NAMES; diff --git a/engines/titanic/npcs/succubus.cpp b/engines/titanic/npcs/succubus.cpp index 872b4f33ba..5588d862c3 100644 --- a/engines/titanic/npcs/succubus.cpp +++ b/engines/titanic/npcs/succubus.cpp @@ -25,7 +25,6 @@ #include "titanic/carry/chicken.h" #include "titanic/core/view_item.h" #include "titanic/pet_control/pet_control.h" -#include "titanic/titanic.h" namespace Titanic { @@ -324,7 +323,7 @@ bool CSuccUBus::SubAcceptCCarryMsg(CSubAcceptCCarryMsg *msg) { } bool CSuccUBus::EnterViewMsg(CEnterViewMsg *msg) { - if (g_vm->getRandomNumber(4) == 0 && compareRoomNameTo("PromenadeDeck")) { + if (getRandomNumber(4) == 0 && compareRoomNameTo("PromenadeDeck")) { CParrotSpeakMsg speakMsg("SuccUBus", "EnterView"); speakMsg.execute("PerchedParrot"); } @@ -381,7 +380,7 @@ bool CSuccUBus::PETDeliverMsg(CPETDeliverMsg *msg) { CGameObject *mailObject = findMail(pet->getRoomFlags()); if (!mailObject) { - switch (g_vm->getRandomNumber(2)) { + switch (getRandomNumber(2)) { case 0: startTalking(this, 70111, findView()); break; @@ -465,7 +464,7 @@ bool CSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) { uint petRoomFlags = pet->getRoomFlags(); if (mailExists(petRoomFlags)) { - switch (g_vm->getRandomNumber(2)) { + switch (getRandomNumber(2)) { case 0: startTalking(this, 70080, findView()); break; @@ -482,7 +481,7 @@ bool CSuccUBus::PETReceiveMsg(CPETReceiveMsg *msg) { CGameObject *mailObject = findMailByFlags(compareRoomNameTo("Titania") ? 3 : _field140, petRoomFlags); if (!mailObject) { - if (g_vm->getRandomNumber(1) == 0) { + if (getRandomNumber(1) == 0) { startTalking(this, 70104, findView()); } else { startTalking(this, 70105, findView()); @@ -532,7 +531,7 @@ bool CSuccUBus::MovieEndMsg(CMovieEndMsg *msg) { findMailByFlags(_field140, petRoomFlags); if (mailObject) { - switch (g_vm->getRandomNumber(4)) { + switch (getRandomNumber(4)) { case 0: startTalking(this, 70094, findView()); break; @@ -647,7 +646,7 @@ bool CSuccUBus::SignalObject(CSignalObject *msg) { } bool CSuccUBus::TurnOn(CTurnOn *msg) { - if (g_vm->getRandomNumber(9) == 0) { + if (getRandomNumber(9) == 0) { CParrotSpeakMsg speakMsg("SuccUBus", "TurnOn"); speakMsg.execute("PerchedParrot"); } diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index 9310f285e5..c2705bf483 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -23,7 +23,7 @@ #include "titanic/npcs/true_talk_npc.h" #include "titanic/core/view_item.h" #include "titanic/pet_control/pet_control.h" -#include "titanic/titanic.h" +#include "titanic/game_manager.h" namespace Titanic { @@ -103,7 +103,7 @@ bool CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMs stopTimer(_speechTimerId); _soundId = msg->_soundId; - _fieldF0 = g_vm->_events->getTicksCount(); + _fieldF0 = getTicksCount(); if (hasActiveMovie() || (_npcFlags & NPCFLAG_2)) { _npcFlags &= ~NPCFLAG_2; @@ -147,7 +147,7 @@ bool CTrueTalkNPC::MovieEndMsg(CMovieEndMsg *msg) { return false; } - int diff = g_vm->_events->getTicksCount() - _fieldF0; + int diff = getTicksCount() - _fieldF0; int ticks = MAX((int)_soundId - diff, 0); CNPCPlayTalkingAnimationMsg msg1(ticks, ticks > 1000 ? 2 : 1, 0); msg1.execute(this); @@ -161,7 +161,7 @@ bool CTrueTalkNPC::MovieEndMsg(CMovieEndMsg *msg) { } bool CTrueTalkNPC::NPCQueueIdleAnimMsg(CNPCQueueIdleAnimMsg *msg) { - int rndVal = g_vm->getRandomNumber(_fieldF8 - 1) - (_fieldF8 / 2); + int rndVal = getRandomNumber(_fieldF8 - 1) - (_fieldF8 / 2); _speechTimerId = startAnimTimer("NPCIdleAnim", _fieldF4 + rndVal, 0); return true; diff --git a/engines/titanic/sound/music_room.cpp b/engines/titanic/sound/music_room.cpp index 34217de184..2e4ad904fa 100644 --- a/engines/titanic/sound/music_room.cpp +++ b/engines/titanic/sound/music_room.cpp @@ -24,7 +24,6 @@ #include "titanic/sound/music_room.h" #include "titanic/sound/sound.h" #include "titanic/game_manager.h" -#include "titanic/titanic.h" namespace Titanic { diff --git a/engines/titanic/sound/sound_manager.cpp b/engines/titanic/sound/sound_manager.cpp index 84d38ed2ab..4846329784 100644 --- a/engines/titanic/sound/sound_manager.cpp +++ b/engines/titanic/sound/sound_manager.cpp @@ -22,6 +22,7 @@ #include "titanic/sound/sound_manager.h" #include "titanic/titanic.h" + namespace Titanic { const uint SAMPLING_RATE = 22050; diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp index c721b395c6..cc9e239194 100644 --- a/engines/titanic/star_control/star_control_sub13.cpp +++ b/engines/titanic/star_control/star_control_sub13.cpp @@ -21,7 +21,6 @@ */ #include "titanic/star_control/star_control_sub13.h" -#include "titanic/titanic.h" namespace Titanic { diff --git a/engines/titanic/support/direct_draw.cpp b/engines/titanic/support/direct_draw.cpp index 5ddb25bec9..6958896077 100644 --- a/engines/titanic/support/direct_draw.cpp +++ b/engines/titanic/support/direct_draw.cpp @@ -23,8 +23,8 @@ #include "common/debug.h" #include "engines/util.h" #include "graphics/pixelformat.h" -#include "titanic/titanic.h" #include "titanic/support/direct_draw.h" +#include "titanic/titanic.h" namespace Titanic { diff --git a/engines/titanic/support/exe_resources.cpp b/engines/titanic/support/exe_resources.cpp index 522e92f718..b3caf1986a 100644 --- a/engines/titanic/support/exe_resources.cpp +++ b/engines/titanic/support/exe_resources.cpp @@ -21,7 +21,6 @@ */ #include "titanic/support/exe_resources.h" -#include "titanic/titanic.h" namespace Titanic { diff --git a/engines/titanic/support/image.cpp b/engines/titanic/support/image.cpp index 1e936b6940..2da2179af0 100644 --- a/engines/titanic/support/image.cpp +++ b/engines/titanic/support/image.cpp @@ -21,8 +21,8 @@ */ #include "titanic/support/image.h" -#include "titanic/titanic.h" #include "image/bmp.h" +#include "titanic/titanic.h" namespace Titanic { diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index d6a42823f5..068267cb18 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -26,9 +26,9 @@ #include "titanic/support/mouse_cursor.h" #include "titanic/support/movie.h" #include "titanic/support/screen_manager.h" -#include "titanic/titanic.h" #include "titanic/support/video_surface.h" #include "titanic/core/resource_key.h" +#include "titanic/titanic.h" namespace Titanic { diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp index d795f78764..b0d852104c 100644 --- a/engines/titanic/support/screen_manager.cpp +++ b/engines/titanic/support/screen_manager.cpp @@ -21,8 +21,8 @@ */ #include "titanic/support/screen_manager.h" -#include "titanic/titanic.h" #include "titanic/support/video_surface.h" +#include "titanic/titanic.h" namespace Titanic { @@ -38,7 +38,6 @@ CScreenManager::CScreenManager(TitanicEngine *vm): _vm(vm) { _textCursor = nullptr; _inputHandler = nullptr; _fontNumber = 0; - // TODO: Further initialization _screenManagerPtr = this; } diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h index 3c71f68b6e..ec015551b8 100644 --- a/engines/titanic/titanic.h +++ b/engines/titanic/titanic.h @@ -58,13 +58,6 @@ enum TitanicDebugChannels { kDebugSound = 1 << 3 }; -enum Season { - SPRING = 0, - SUMMER = 1, - AUTUMN = 2, - WINTER = 3 -}; - #define TITANIC_SAVEGAME_VERSION 1 #define SCREEN_WIDTH 640 |