aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/core/game_object.cpp28
-rw-r--r--engines/titanic/core/game_object.h9
-rw-r--r--engines/titanic/game/television.cpp74
-rw-r--r--engines/titanic/game/television.h2
-rw-r--r--engines/titanic/messages/messages.h2
-rw-r--r--engines/titanic/messages/pet_messages.h2
-rw-r--r--engines/titanic/pet_control/pet_control.cpp13
-rw-r--r--engines/titanic/pet_control/pet_control.h6
8 files changed, 122 insertions, 14 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index a1fde3f74e..a442f09937 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -27,6 +27,7 @@
#include "titanic/video_surface.h"
#include "titanic/core/game_object.h"
#include "titanic/core/resource_key.h"
+#include "titanic/pet_control/pet_control.h"
namespace Titanic {
@@ -44,7 +45,7 @@ CGameObject::CGameObject(): CNamedItem() {
_field50 = 0;
_field54 = 0;
_field58 = 0;
- _field5C = 1;
+ _field5C = true;
_field60 = 0;
_cursorId = CURSOR_1;
_field78 = 0;
@@ -105,7 +106,7 @@ void CGameObject::load(SimpleFile *file) {
_field48 = file->readNumber();
_field4C = file->readNumber();
_fieldB8 = file->readNumber();
- _field5C = file->readNumber();
+ _field5C = file->readNumber() != 0;
_field50 = file->readNumber();
_field54 = file->readNumber();
_field58 = file->readNumber();
@@ -275,11 +276,32 @@ void CGameObject::soundFn2(int val, int val2) {
}
}
-void CGameObject::set5C(int val) {
+void CGameObject::set5C(bool val) {
if (val != _field5C) {
_field5C = val;
makeDirty();
}
}
+bool CGameObject::petFn1(int val) {
+ CPetControl *pet = getPetControl();
+ return pet ? pet->fn1(val) : true;
+}
+
+void CGameObject::petFn2(int val) {
+ CPetControl *pet = getPetControl();
+ if (pet)
+ pet->fn2(val);
+}
+
+void CGameObject::petFn3(int val) {
+ CPetControl *pet = getPetControl();
+ if (pet)
+ pet->fn3(val);
+}
+
+void CGameObject::fn1(int val1, int val2, int val3) {
+ warning("TODO: CGameObject::fn1");
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 1ccbb7d85f..46ec502c56 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -74,7 +74,7 @@ protected:
int _field50;
int _field54;
int _field58;
- int _field5C;
+ bool _field5C;
CMovieClipList _clipList1;
int _field78;
CMovieClipList _clipList2;
@@ -96,7 +96,10 @@ protected:
bool soundFn1(int val);
void soundFn2(int val, int val2);
- void set5C(int val);
+ void set5C(bool val);
+ bool petFn1(int val);
+ void petFn2(int val);
+ void petFn3(int val);
public:
int _field60;
CursorId _cursorId;
@@ -125,6 +128,8 @@ public:
void stopMovie();
bool checkPoint(const Point &pt, int v0, int v1);
+
+ void fn1(int val1, int val2, int val3);
};
} // End of namespace Titanic
diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp
index 08f29df7f9..e7a1b8dbb4 100644
--- a/engines/titanic/game/television.cpp
+++ b/engines/titanic/game/television.cpp
@@ -32,7 +32,7 @@ int CTelevision::_v5;
int CTelevision::_v6;
CTelevision::CTelevision() : CBackground(), _fieldE0(1),
- _fieldE4(7), _fieldE8(0), _fieldEC(0), _fieldF0(0) {
+ _fieldE4(7), _isOn(false), _fieldEC(0), _fieldF0(0) {
}
void CTelevision::save(SimpleFile *file, int indent) const {
@@ -41,7 +41,7 @@ void CTelevision::save(SimpleFile *file, int indent) const {
file->writeNumberLine(_v1, indent);
file->writeNumberLine(_fieldE4, indent);
file->writeNumberLine(_v2, indent);
- file->writeNumberLine(_fieldE8, indent);
+ file->writeNumberLine(_isOn, indent);
file->writeNumberLine(_v3, indent);
file->writeNumberLine(_fieldEC, indent);
file->writeNumberLine(_v4, indent);
@@ -58,7 +58,7 @@ void CTelevision::load(SimpleFile *file) {
_v1 = file->readNumber();
_fieldE4 = file->readNumber();
_v2 = file->readNumber();
- _fieldE8 = file->readNumber();
+ _isOn = file->readNumber() != 0;
_v3 = file->readNumber();
_fieldEC = file->readNumber();
_v4 = file->readNumber();
@@ -71,14 +71,14 @@ void CTelevision::load(SimpleFile *file) {
bool CTelevision::handleMessage(CLeaveViewMsg &msg) {
clearPet();
- if (_fieldE8) {
+ if (_isOn) {
if (soundFn1(_fieldF0))
soundFn2(_fieldF0, 0);
loadFrame(622);
stopMovie();
set5C(0);
- _fieldE8 = 0;
+ _isOn = false;
if (compareRoomNameTo("CSGState")) {
CVisibleMsg visibleMsg(1, 0);
@@ -90,26 +90,88 @@ bool CTelevision::handleMessage(CLeaveViewMsg &msg) {
}
bool CTelevision::handleMessage(CChangeSeasonMsg &msg) {
+ if (msg._season.compareTo("Autumn")) {
+ _v1 = 545;
+ _v3 = 0;
+ } else if (msg._season.compareTo("Winter")) {
+ _v1 = 503;
+ _v3 = 0;
+ } else if (msg._season.compareTo("Spring")) {
+ _v1 = 517;
+ _v3 = 0;
+ } else if (msg._season.compareTo("Winter")) {
+ _v1 = 531;
+ _v3 = 0;
+ }
+
return true;
}
bool CTelevision::handleMessage(CEnterViewMsg &msg) {
+ petFn1(2);
+ petFn2(2);
+ petFn3(0);
+ set5C(0);
+ _fieldE0 = 1;
+
return true;
}
+static const int FRAMES1[9] = { 0, 0, 56, 112, 168, 224, 280, 336, 392 };
+static const int FRAMES2[8] = { 0, 55, 111, 167, 223, 279, 335, 391 };
+
bool CTelevision::handleMessage(CPETUpMsg &msg) {
+ if (msg._name == "Television" && _isOn) {
+ if (soundFn1(_fieldF0))
+ soundFn2(_fieldF0, 0);
+
+ _fieldE0 = _fieldE0 % _fieldE4 + 1;
+ stopMovie();
+ fn1(FRAMES1[_fieldE0], FRAMES2[_fieldE0], 4);
+ }
+
return true;
}
bool CTelevision::handleMessage(CPETDownMsg &msg) {
- return true;
+ if (msg._name == "Television" && _isOn) {
+ if (soundFn1(_fieldF0))
+ soundFn2(_fieldF0, 0);
+ if (--_fieldE0 < 1)
+ _fieldE0 += _fieldE4;
+
+ _fieldE0 = _fieldE0 % _fieldE4 + 1;
+ stopMovie();
+ fn1(FRAMES1[_fieldE0], FRAMES2[_fieldE0], 4);
+ }
+
+ return true;
}
bool CTelevision::handleMessage(CStatusChangeMsg &msg) {
+ if (_isOn) {
+ stopMovie();
+ // TODO:
+ }
+ warning("TODO");
+
return true;
}
bool CTelevision::handleMessage(CActMsg &msg) {
+ if (msg._action == "TurnTVOnOff") {
+ _isOn = !_isOn;
+ if (_isOn) {
+ set5C(true);
+ CStatusChangeMsg changeMsg;
+ changeMsg.execute(this);
+ } else {
+ // TODO: Should 5C be a boolean?
+ set5C(_isOn);
+ stopMovie();
+ }
+ }
+
return true;
}
diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h
index 04c201e681..ed41606c57 100644
--- a/engines/titanic/game/television.h
+++ b/engines/titanic/game/television.h
@@ -53,7 +53,7 @@ private:
private:
int _fieldE0;
int _fieldE4;
- int _fieldE8;
+ bool _isOn;
int _fieldEC;
int _fieldF0;
protected:
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index b7a7cd6e7b..493152b299 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -252,7 +252,7 @@ public:
return dest != nullptr && dest->handleMessage(*this); \
} }
-MESSAGE1(CActMsg, CString, value, "");
+MESSAGE1(CActMsg, CString, action, "");
MESSAGE1(CActivationmsg, CString, value, "");
MESSAGE1(CAddHeadPieceMsg, CString, value, "NULL");
MESSAGE1(CAnimateMaitreDMsg, int, value, 0);
diff --git a/engines/titanic/messages/pet_messages.h b/engines/titanic/messages/pet_messages.h
index caca53dfee..7e39056742 100644
--- a/engines/titanic/messages/pet_messages.h
+++ b/engines/titanic/messages/pet_messages.h
@@ -40,7 +40,7 @@ MESSAGE0(CPETReceiveMsg);
MESSAGE0(CPETSetStarDestinationMsg);
MESSAGE1(CPETStarFieldLockMsg, int, value, 0);
MESSAGE0(CPETStereoFieldOnOffMsg);
-MESSAGE2(CPETTargetMsg, CString, strValue, "", int, numValue, -1);
+MESSAGE2(CPETTargetMsg, CString, name, "", int, numValue, -1);
#define PET_MESSAGE(NAME) MSGTARGET(NAME); \
class NAME: public CPETTargetMsg { \
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index 097c72d586..920e6b24d9 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -102,4 +102,17 @@ void CPetControl::clear() {
_string2.clear();
}
+bool CPetControl::fn1(int val) {
+ warning("TODO: CPetControl::fn1");
+ return false;
+}
+
+void CPetControl::fn2(int val) {
+ warning("TODO: CPetControl::fn2");
+}
+
+void CPetControl::fn3(int val) {
+ warning("TODO: CPetControl::fn3");
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index e2b31bea4a..1beded2453 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -99,6 +99,12 @@ public:
* Called to clear the PET display
*/
void clear();
+
+ bool fn1(int val);
+
+ void fn2(int val);
+
+ void fn3(int val);
};
} // End of namespace Titanic