aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/core/game_object.cpp4
-rw-r--r--engines/titanic/core/game_object.h5
-rw-r--r--engines/titanic/game/arboretum_gate.cpp357
-rw-r--r--engines/titanic/game/arboretum_gate.h61
-rw-r--r--engines/titanic/titanic.h7
5 files changed, 311 insertions, 123 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 0661f25478..723f2456f3 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -1172,6 +1172,10 @@ void CGameObject::loadSurface() {
_surface->loadIfReady();
}
+bool CGameObject::changeView(const CString &viewName) {
+ return changeView(viewName, "");
+}
+
bool CGameObject::changeView(const CString &viewName, const CString &clipName) {
CViewItem *newView = parseView(viewName);
CGameManager *gameManager = getGameManager();
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index cad05dea00..2dc539f739 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -336,6 +336,11 @@ protected:
bool changeView(const CString &viewName, const CString &clipName);
/**
+ * Change the view
+ */
+ bool changeView(const CString &viewName);
+
+ /**
* Get the centre of the game object's bounds
*/
Point getControid() const;
diff --git a/engines/titanic/game/arboretum_gate.cpp b/engines/titanic/game/arboretum_gate.cpp
index 9caa87c48d..f51d2aa436 100644
--- a/engines/titanic/game/arboretum_gate.cpp
+++ b/engines/titanic/game/arboretum_gate.cpp
@@ -21,139 +21,312 @@
*/
#include "titanic/game/arboretum_gate.h"
+#include "titanic/titanic.h"
namespace Titanic {
BEGIN_MESSAGE_MAP(CArboretumGate, CBackground)
+ ON_MESSAGE(ChangeSeasonMsg)
ON_MESSAGE(ActMsg)
+ ON_MESSAGE(MovieEndMsg)
ON_MESSAGE(LeaveViewMsg)
ON_MESSAGE(TurnOff)
ON_MESSAGE(MouseButtonDownMsg)
ON_MESSAGE(EnterViewMsg)
ON_MESSAGE(TurnOn)
- ON_MESSAGE(MovieEndMsg)
END_MESSAGE_MAP()
int CArboretumGate::_v1;
-int CArboretumGate::_v2;
+int CArboretumGate::_initialFrame;
int CArboretumGate::_v3;
CArboretumGate::CArboretumGate() : CBackground() {
- _string1 = "NULL";
- _string2 = "NULL";
- _fieldE0 = 0;
+ _viewName1 = "NULL";
+ _viewName2 = "NULL";
+ _seasonNum = 0;
_fieldF0 = 0;
- _fieldF4 = 244;
- _fieldF8 = 304;
- _fieldFC = 122;
- _field100 = 182;
- _field104 = 183;
- _field108 = 243;
- _field10C = 665;
- _field110 = 724;
- _field114 = 61;
- _field118 = 121;
- _field11C = 0;
- _field120 = 60;
- _field124 = 485;
- _field128 = 544;
- _field12C = 425;
- _field130 = 484;
- _field134 = 545;
- _field138 = 604;
- _field13C = 605;
- _field140 = 664;
- _field144 = 305;
- _field148 = 364;
- _field14C = 365;
- _field150 = 424;
+ _winterOffStartFrame = 244;
+ _winterOffEndFrame = 304;
+ _springOffStartFrame = 122;
+ _springOffEndFrame = 182;
+ _summerOffStartFrame1 = 183;
+ _summerOffEndFrame1 = 243;
+ _summerOffStartFrame2 = 665;
+ _summerOffEndFrame2 = 724;
+ _autumnOffStartFrame1 = 61;
+ _autumnOffEndFrame1 = 121;
+ _autumnOffStartFrame2 = 0;
+ _autumnOffEndFrame2 = 60;
+ _winterOnStartFrame = 485;
+ _winterOnEndFrame = 544;
+ _springOnStartFrame = 425;
+ _springOnEndFrame = 484;
+ _summerOnStartFrame1 = 545;
+ _summerOnEndFrame1 = 604;
+ _summerOnStartFrame2 = 605;
+ _summerOnEndFrame2 = 664;
+ _autumnOnStartFrame1 = 305;
+ _autumnOnEndFrame1 = 364;
+ _autumnOnStartFrame2 = 365;
+ _autumnOnEndFrame2 = 424;
}
void CArboretumGate::save(SimpleFile *file, int indent) {
file->writeNumberLine(1, indent);
- file->writeNumberLine(_fieldE0, indent);
+ file->writeNumberLine(_seasonNum, indent);
file->writeNumberLine(_v1, indent);
- file->writeNumberLine(_v2, indent);
+ file->writeNumberLine(_initialFrame, indent);
file->writeNumberLine(_v3, indent);
- file->writeQuotedLine(_string1, indent);
+ file->writeQuotedLine(_viewName1, indent);
file->writeNumberLine(_fieldF0, indent);
- file->writeNumberLine(_fieldF4, indent);
- file->writeNumberLine(_fieldF8, indent);
- file->writeNumberLine(_fieldFC, indent);
- file->writeNumberLine(_field100, indent);
- file->writeNumberLine(_field104, indent);
- file->writeNumberLine(_field108, indent);
- file->writeNumberLine(_field10C, indent);
- file->writeNumberLine(_field110, indent);
- file->writeNumberLine(_field114, indent);
- file->writeNumberLine(_field118, indent);
- file->writeNumberLine(_field11C, indent);
- file->writeNumberLine(_field120, indent);
- file->writeNumberLine(_field124, indent);
- file->writeNumberLine(_field128, indent);
- file->writeNumberLine(_field12C, indent);
- file->writeNumberLine(_field130, indent);
- file->writeNumberLine(_field134, indent);
- file->writeNumberLine(_field138, indent);
- file->writeNumberLine(_field13C, indent);
- file->writeNumberLine(_field140, indent);
- file->writeNumberLine(_field144, indent);
- file->writeNumberLine(_field148, indent);
- file->writeNumberLine(_field14C, indent);
- file->writeNumberLine(_field150, indent);
- file->writeQuotedLine(_string2, indent);
+ file->writeNumberLine(_winterOffStartFrame, indent);
+ file->writeNumberLine(_winterOffEndFrame, indent);
+ file->writeNumberLine(_springOffStartFrame, indent);
+ file->writeNumberLine(_springOffEndFrame, indent);
+ file->writeNumberLine(_summerOffStartFrame1, indent);
+ file->writeNumberLine(_summerOffEndFrame1, indent);
+ file->writeNumberLine(_summerOffStartFrame2, indent);
+ file->writeNumberLine(_summerOffEndFrame2, indent);
+ file->writeNumberLine(_autumnOffStartFrame1, indent);
+ file->writeNumberLine(_autumnOffEndFrame1, indent);
+ file->writeNumberLine(_autumnOffStartFrame2, indent);
+ file->writeNumberLine(_autumnOffEndFrame2, indent);
+ file->writeNumberLine(_winterOnStartFrame, indent);
+ file->writeNumberLine(_winterOnEndFrame, indent);
+ file->writeNumberLine(_springOnStartFrame, indent);
+ file->writeNumberLine(_springOnEndFrame, indent);
+ file->writeNumberLine(_summerOnStartFrame1, indent);
+ file->writeNumberLine(_summerOnEndFrame1, indent);
+ file->writeNumberLine(_summerOnStartFrame2, indent);
+ file->writeNumberLine(_summerOnEndFrame2, indent);
+ file->writeNumberLine(_autumnOnStartFrame1, indent);
+ file->writeNumberLine(_autumnOnEndFrame1, indent);
+ file->writeNumberLine(_autumnOnStartFrame2, indent);
+ file->writeNumberLine(_autumnOnEndFrame2, indent);
+ file->writeQuotedLine(_viewName2, indent);
CBackground::save(file, indent);
}
void CArboretumGate::load(SimpleFile *file) {
file->readNumber();
- _fieldE0 = file->readNumber();
+ _seasonNum = file->readNumber();
_v1 = file->readNumber();
- _v2 = file->readNumber();
+ _initialFrame = file->readNumber();
_v3 = file->readNumber();
- _string1 = file->readString();
+ _viewName1 = file->readString();
_fieldF0 = file->readNumber();
- _fieldF4 = file->readNumber();
- _fieldF8 = file->readNumber();
- _fieldFC = file->readNumber();
- _field100 = file->readNumber();
- _field104 = file->readNumber();
- _field108 = file->readNumber();
- _field10C = file->readNumber();
- _field110 = file->readNumber();
- _field114 = file->readNumber();
- _field118 = file->readNumber();
- _field11C = file->readNumber();
- _field120 = file->readNumber();
- _field124 = file->readNumber();
- _field128 = file->readNumber();
- _field12C = file->readNumber();
- _field130 = file->readNumber();
- _field134 = file->readNumber();
- _field138 = file->readNumber();
- _field13C = file->readNumber();
- _field140 = file->readNumber();
- _field144 = file->readNumber();
- _field148 = file->readNumber();
- _field14C = file->readNumber();
- _field150 = file->readNumber();
- _string2 = file->readString();
+ _winterOffStartFrame = file->readNumber();
+ _winterOffEndFrame = file->readNumber();
+ _springOffStartFrame = file->readNumber();
+ _springOffEndFrame = file->readNumber();
+ _summerOffStartFrame1 = file->readNumber();
+ _summerOffEndFrame1 = file->readNumber();
+ _summerOffStartFrame2 = file->readNumber();
+ _summerOffEndFrame2 = file->readNumber();
+ _autumnOffStartFrame1 = file->readNumber();
+ _autumnOffEndFrame1 = file->readNumber();
+ _autumnOffStartFrame2 = file->readNumber();
+ _autumnOffEndFrame2 = file->readNumber();
+ _winterOnStartFrame = file->readNumber();
+ _winterOnEndFrame = file->readNumber();
+ _springOnStartFrame = file->readNumber();
+ _springOnEndFrame = file->readNumber();
+ _summerOnStartFrame1 = file->readNumber();
+ _summerOnEndFrame1 = file->readNumber();
+ _summerOnStartFrame2 = file->readNumber();
+ _summerOnEndFrame2 = file->readNumber();
+ _autumnOnStartFrame1 = file->readNumber();
+ _autumnOnEndFrame1 = file->readNumber();
+ _autumnOnStartFrame2 = file->readNumber();
+ _autumnOnEndFrame2 = file->readNumber();
+ _viewName2 = file->readString();
CBackground::load(file);
}
-bool CArboretumGate::ActMsg(CActMsg *msg) { return false; }
-bool CArboretumGate::LeaveViewMsg(CLeaveViewMsg *msg) { return false; }
-bool CArboretumGate::TurnOff(CTurnOff *msg) { return false; }
-bool CArboretumGate::MouseButtonDownMsg(CMouseButtonDownMsg *msg) { return false; }
+bool CArboretumGate::ChangeSeasonMsg(CChangeSeasonMsg *msg) {
+ _seasonNum = (_seasonNum + 1) % 4;
+ return true;
+}
+
+bool CArboretumGate::ActMsg(CActMsg *msg) {
+ if (msg->_action == "PlayerGetsSpeechCentre") {
+ _v1 = 1;
+ CVisibleMsg visibleMsg(true);
+ visibleMsg.execute("SpCtrOverlay");
+ } else if (msg->_action == "ExitLFrozen") {
+ if (_v3) {
+ _viewName2 = "FrozenArboretum.Node 2.W";
+ CTurnOn onMsg;
+ onMsg.execute(this);
+ } else {
+ changeView("FrozenArboretum.Node 2.W");
+ }
+ } else if (msg->_action == "ExitRFrozen") {
+ if (_v3) {
+ _viewName2 = "FrozenArboretum.Node 2.E";
+ CTurnOn onMsg;
+ onMsg.execute(this);
+ } else {
+ changeView("FrozenArboretum.Node 2.E");
+ }
+ } else if (msg->_action == "ExitLNormal") {
+ if (_v3) {
+ _viewName2 = "Arboretum.Node 2.W";
+ CTurnOn onMsg;
+ onMsg.execute(this);
+ } else {
+ changeView("Arboretum.Node 2.W");
+ }
+ } else if (msg->_action == "ExitRNormal") {
+ if (_v3) {
+ _viewName2 = "Arboretum.Node 2.E";
+ CTurnOn onMsg;
+ onMsg.execute(this);
+ }
+ else {
+ changeView("Arboretum.Node 2.E");
+ }
+ }
+
+ return true;
+}
+
+bool CArboretumGate::MovieEndMsg(CMovieEndMsg *msg) {
+ setVisible(!_v3);
+
+ if (_viewName1 != "NULL") {
+ changeView(_viewName1);
+ } else if (_viewName2 != "NULL") {
+ changeView(_viewName2);
+ _viewName2 = "NULL";
+ }
+
+ return true;
+}
+
+bool CArboretumGate::LeaveViewMsg(CLeaveViewMsg *msg) {
+ return false;
+}
+
+bool CArboretumGate::TurnOff(CTurnOff *msg) {
+ if (!_v3) {
+ switch (_seasonNum) {
+ case SPRING:
+ playMovie(_springOffStartFrame, _springOffEndFrame, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT);
+ break;
+
+ case SUMMER:
+ if (_v1) {
+ playMovie(_summerOffStartFrame2, _summerOffEndFrame2, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT);
+ } else {
+ playMovie(_summerOffStartFrame1, _summerOffEndFrame1, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT);
+ }
+ break;
+
+ case AUTUMN:
+ if (_v1) {
+ playMovie(_autumnOffStartFrame2, _autumnOffEndFrame2, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT);
+ } else {
+ playMovie(_autumnOffStartFrame1, _autumnOffEndFrame1, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT);
+ }
+ break;
+
+ case WINTER:
+ playMovie(_winterOffStartFrame, _winterOffEndFrame, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT);
+ break;
+
+ default:
+ break;
+ }
+
+ _v3 = 1;
+ CArboretumGateMsg gateMsg;
+ gateMsg.execute("Arboretum", nullptr, MSGFLAG_SCAN);
+ }
+
+ return true;
+}
+
+bool CArboretumGate::TurnOn(CTurnOn *msg) {
+ if (_v3) {
+ CArboretumGateMsg gateMsg(0);
+ gateMsg.execute("Arboretum");
+ setVisible(true);
+
+ switch (_seasonNum) {
+ case SPRING:
+ playMovie(_springOnStartFrame, _springOnEndFrame, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT);
+ break;
+
+ case SUMMER:
+ if (_v1) {
+ playMovie(_summerOnStartFrame2, _summerOnEndFrame2, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT);
+ } else {
+ playMovie(_summerOnStartFrame1, _summerOnEndFrame1, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT);
+ }
+ break;
+
+ case AUTUMN:
+ if (_v1) {
+ playMovie(_autumnOnStartFrame2, _autumnOnEndFrame2, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT);
+ } else {
+ playMovie(_autumnOnStartFrame1, _autumnOnEndFrame1, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT);
+ }
+ break;
+
+ case WINTER:
+ playMovie(_winterOnStartFrame, _winterOnEndFrame, MOVIE_GAMESTATE || MOVIE_NOTIFY_OBJECT);
+ break;
+
+ default:
+ break;
+ }
+
+ _v3 = 0;
+ }
+
+ return true;
+}
+
+bool CArboretumGate::MouseButtonDownMsg(CMouseButtonDownMsg *msg) {
+ if (!_v3) {
+ CTurnOff offMsg;
+ offMsg.execute(this);
+ }
+
+ return true;
+}
bool CArboretumGate::EnterViewMsg(CEnterViewMsg *msg) {
+ if (!_v3) {
+ switch (_seasonNum) {
+ case SPRING:
+ _initialFrame = _springOffStartFrame;
+ break;
+
+ case SUMMER:
+ _initialFrame = _v1 ? _summerOffStartFrame2 : _summerOffStartFrame1;
+ break;
+
+ case AUTUMN:
+ _initialFrame = _v1 ? _autumnOffStartFrame1 : _autumnOffStartFrame2;
+ break;
+
+ case WINTER:
+ _initialFrame = _winterOffStartFrame;
+ break;
+
+ default:
+ break;
+ }
+
+ loadFrame(_initialFrame);
+ }
+
warning("CArboretumGate::handleEvent");
return false;
}
-bool CArboretumGate::TurnOn(CTurnOn *msg) { return false; }
-bool CArboretumGate::MovieEndMsg(CMovieEndMsg *msg) { return false; }
-
} // End of namespace Titanic
diff --git a/engines/titanic/game/arboretum_gate.h b/engines/titanic/game/arboretum_gate.h
index 927b2190c7..62c9200a64 100644
--- a/engines/titanic/game/arboretum_gate.h
+++ b/engines/titanic/game/arboretum_gate.h
@@ -31,48 +31,47 @@ namespace Titanic {
class CArboretumGate : public CBackground {
DECLARE_MESSAGE_MAP;
+ bool ChangeSeasonMsg(CChangeSeasonMsg *msg);
bool ActMsg(CActMsg *msg);
+ bool MovieEndMsg(CMovieEndMsg *msg);
bool LeaveViewMsg(CLeaveViewMsg *msg);
bool TurnOff(CTurnOff *msg);
bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
bool EnterViewMsg(CEnterViewMsg *msg);
bool TurnOn(CTurnOn *msg);
- bool MovieEndMsg(CMovieEndMsg *msg);
private:
static int _v1;
- static int _v2;
+ static int _initialFrame;
static int _v3;
private:
- int _fieldE0;
- CString _string1;
- int _fieldE8;
- int _fieldEC;
+ int _seasonNum;
+ CString _viewName1;
int _fieldF0;
- int _fieldF4;
- int _fieldF8;
- int _fieldFC;
- int _field100;
- int _field104;
- int _field108;
- int _field10C;
- int _field110;
- int _field114;
- int _field118;
- int _field11C;
- int _field120;
- int _field124;
- int _field128;
- int _field12C;
- int _field130;
- int _field134;
- int _field138;
- int _field13C;
- int _field140;
- int _field144;
- int _field148;
- int _field14C;
- int _field150;
- CString _string2;
+ int _winterOffStartFrame;
+ int _winterOffEndFrame;
+ int _springOffStartFrame;
+ int _springOffEndFrame;
+ int _summerOffStartFrame2;
+ int _summerOffEndFrame2;
+ int _summerOffStartFrame1;
+ int _summerOffEndFrame1;
+ int _autumnOffStartFrame2;
+ int _autumnOffEndFrame2;
+ int _autumnOffStartFrame1;
+ int _autumnOffEndFrame1;
+ int _winterOnStartFrame;
+ int _winterOnEndFrame;
+ int _springOnStartFrame;
+ int _springOnEndFrame;
+ int _summerOnStartFrame1;
+ int _summerOnEndFrame1;
+ int _summerOnStartFrame2;
+ int _summerOnEndFrame2;
+ int _autumnOnStartFrame1;
+ int _autumnOnEndFrame1;
+ int _autumnOnStartFrame2;
+ int _autumnOnEndFrame2;
+ CString _viewName2;
public:
CLASSDEF;
CArboretumGate();
diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h
index ec015551b8..3c71f68b6e 100644
--- a/engines/titanic/titanic.h
+++ b/engines/titanic/titanic.h
@@ -58,6 +58,13 @@ enum TitanicDebugChannels {
kDebugSound = 1 << 3
};
+enum Season {
+ SPRING = 0,
+ SUMMER = 1,
+ AUTUMN = 2,
+ WINTER = 3
+};
+
#define TITANIC_SAVEGAME_VERSION 1
#define SCREEN_WIDTH 640