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 /engines/titanic/game | |
parent | 65bc8cb83c01cc1e7e6c8c093b8f42080800718d (diff) | |
download | scummvm-rg350-8b3829549a2c82a09f7475c35173238f7470d587.tar.gz scummvm-rg350-8b3829549a2c82a09f7475c35173238f7470d587.tar.bz2 scummvm-rg350-8b3829549a2c82a09f7475c35173238f7470d587.zip |
TITANIC: Cleanup of engine references
Diffstat (limited to 'engines/titanic/game')
-rw-r--r-- | engines/titanic/game/announce.cpp | 11 | ||||
-rw-r--r-- | engines/titanic/game/arboretum_gate.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/game/bomb.cpp | 3 | ||||
-rw-r--r-- | engines/titanic/game/desk_click_responder.cpp | 3 | ||||
-rw-r--r-- | engines/titanic/game/head_smash_event.cpp | 19 | ||||
-rw-r--r-- | engines/titanic/game/head_smash_event.h | 3 | ||||
-rw-r--r-- | engines/titanic/game/head_smash_lever.cpp | 63 | ||||
-rw-r--r-- | engines/titanic/game/head_smash_lever.h | 11 | ||||
-rw-r--r-- | engines/titanic/game/seasonal_adjustment.h | 7 | ||||
-rw-r--r-- | engines/titanic/game/television.cpp | 6 |
10 files changed, 106 insertions, 22 deletions
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"); } |