aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/game/television.cpp52
-rw-r--r--engines/titanic/game/television.h4
-rw-r--r--engines/titanic/messages/messages.h4
-rw-r--r--engines/titanic/pet_control/pet_control.cpp4
-rw-r--r--engines/titanic/pet_control/pet_control.h2
-rw-r--r--engines/titanic/titanic.cpp3
6 files changed, 62 insertions, 7 deletions
diff --git a/engines/titanic/game/television.cpp b/engines/titanic/game/television.cpp
index e7a1b8dbb4..cb59647cc1 100644
--- a/engines/titanic/game/television.cpp
+++ b/engines/titanic/game/television.cpp
@@ -21,11 +21,12 @@
*/
#include "titanic/game/television.h"
+#include "titanic/pet_control/pet_control.h"
namespace Titanic {
int CTelevision::_v1;
-int CTelevision::_v2;
+bool CTelevision::_turnOn;
int CTelevision::_v3;
int CTelevision::_v4;
int CTelevision::_v5;
@@ -35,12 +36,24 @@ CTelevision::CTelevision() : CBackground(), _fieldE0(1),
_fieldE4(7), _isOn(false), _fieldEC(0), _fieldF0(0) {
}
+void CTelevision::init() {
+ _v1 = 531;
+ _turnOn = true;
+ _v3 = 0;
+ _v4 = 27;
+ _v5 = 1;
+ _v6 = 1;
+}
+
+void CTelevision::deinit() {
+}
+
void CTelevision::save(SimpleFile *file, int indent) const {
file->writeNumberLine(1, indent);
file->writeNumberLine(_fieldE0, indent);
file->writeNumberLine(_v1, indent);
file->writeNumberLine(_fieldE4, indent);
- file->writeNumberLine(_v2, indent);
+ file->writeNumberLine(_turnOn, indent);
file->writeNumberLine(_isOn, indent);
file->writeNumberLine(_v3, indent);
file->writeNumberLine(_fieldEC, indent);
@@ -57,7 +70,7 @@ void CTelevision::load(SimpleFile *file) {
_fieldE0 = file->readNumber();
_v1 = file->readNumber();
_fieldE4 = file->readNumber();
- _v2 = file->readNumber();
+ _turnOn = file->readNumber() != 0;
_isOn = file->readNumber() != 0;
_v3 = file->readNumber();
_fieldEC = file->readNumber();
@@ -81,7 +94,7 @@ bool CTelevision::handleMessage(CLeaveViewMsg &msg) {
_isOn = false;
if (compareRoomNameTo("CSGState")) {
- CVisibleMsg visibleMsg(1, 0);
+ CVisibleMsg visibleMsg(true);
visibleMsg.execute("Tellypic");
}
}
@@ -176,26 +189,57 @@ bool CTelevision::handleMessage(CActMsg &msg) {
}
bool CTelevision::handleMessage(CPETActivateMsg &msg) {
+ if (msg._name == "Television") {
+ CVisibleMsg visibleMsg(_isOn);
+ _isOn = !_isOn;
+
+ if (_isOn) {
+ set5C(true);
+ fn1(0, 55, 0);
+ _fieldE0 = 1;
+ } else {
+ stopMovie();
+ if (soundFn1(_fieldF0))
+ soundFn2(_fieldF0, 0);
+
+ set5C(false);
+ }
+
+ if (compareRoomNameTo("SGTState"))
+ visibleMsg.execute("Tellypic");
+ }
+
return true;
}
bool CTelevision::handleMessage(CMovieEndMsg &msg) {
+ warning("TODO: CMovieEndMsg");
return true;
}
bool CTelevision::handleMessage(CShipSettingMsg &msg) {
+ _v4 = msg._value;
return true;
}
bool CTelevision::handleMessage(CTurnOff &msg) {
+ _turnOn = false;
return true;
}
bool CTelevision::handleMessage(CTurnOn &msg) {
+ _turnOn = true;
return true;
}
bool CTelevision::handleMessage(CLightsMsg &msg) {
+ CPetControl *pet = getPetControl();
+ if (pet)
+ pet->fn4();
+
+ if (msg._field8 || !_turnOn)
+ _turnOn = true;
+
return true;
}
diff --git a/engines/titanic/game/television.h b/engines/titanic/game/television.h
index ed41606c57..3b44f80c1a 100644
--- a/engines/titanic/game/television.h
+++ b/engines/titanic/game/television.h
@@ -45,7 +45,7 @@ class CTelevision : public CBackground,
public CLightsMsgTarget {
private:
static int _v1;
- static int _v2;
+ static bool _turnOn;
static int _v3;
static int _v4;
static int _v5;
@@ -73,6 +73,8 @@ protected:
public:
CLASSDEF
CTelevision();
+ static void init();
+ static void deinit();
/**
* Save the data for the class to file
diff --git a/engines/titanic/messages/messages.h b/engines/titanic/messages/messages.h
index 493152b299..77d53f21a6 100644
--- a/engines/titanic/messages/messages.h
+++ b/engines/titanic/messages/messages.h
@@ -369,7 +369,7 @@ MESSAGE1(CSetChevRoomBits, int, value, 0);
MESSAGE0(CSetMusicControlsMsg);
MESSAGE2(CSetVarMsg, CString, varName, "", int, value, 0);
MESSAGE2(CSetVolumeMsg, int, value1, 70, int, value2, 0);
-MESSAGE2(CShipSettingMsg, CString, strValue, "", int, numValue, 0);
+MESSAGE2(CShipSettingMsg, int, value, 0, CString, name, "");
MESSAGE1(CShowTextMsg, CString, value, "NO TEXT INCLUDED!!!");
MESSAGE2(CSignalObject, CString, strValue, "", int, numValue, 0);
MESSAGE2(CSpeechFallsFromTreeMsg, int, value1, 0, int, value2, 0);
@@ -405,7 +405,7 @@ MESSAGE1(CUse, int, value, 0);
MESSAGE1(CUseWithCharMsg, int, value, 0);
MESSAGE1(CUseWithOtherMsg, int, value, 0);
MESSAGE1(CVirtualKeyCharMsg, int, value, 0);
-MESSAGE2(CVisibleMsg, int, value1, 1, int, value2, 0);
+MESSAGE1(CVisibleMsg, bool, visible, true);
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index 920e6b24d9..f3e78a2212 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -115,4 +115,8 @@ void CPetControl::fn3(int val) {
warning("TODO: CPetControl::fn3");
}
+void CPetControl::fn4() {
+ warning("TODO: CPetControl::fn4");
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index 1beded2453..b0762736fb 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -105,6 +105,8 @@ public:
void fn2(int val);
void fn3(int val);
+
+ void fn4();
};
} // End of namespace Titanic
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index 4d43199184..82d0997744 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -33,6 +33,7 @@
#include "titanic/carry/hose.h"
#include "titanic/core/saveable_object.h"
#include "titanic/game/get_lift_eye2.h"
+#include "titanic/game/television.h"
#include "titanic/game/parrot/parrot_lobby_object.h"
#include "titanic/game/sgt/sgt_navigation.h"
#include "titanic/game/sgt/sgt_state_room.h"
@@ -84,6 +85,7 @@ void TitanicEngine::initialize() {
CSGTStateRoom::init();
CExitPellerator::init();
CEnterExitSecClassMiniLift::init();
+ CTelevision::init();
_debugger = new Debugger(this);
_events = new Events(this);
@@ -101,6 +103,7 @@ void TitanicEngine::deinitialize() {
CSGTStateRoom::deinit();
CExitPellerator::deinit();
CEnterExitSecClassMiniLift::deinit();
+ CTelevision::deinit();
}
Common::Error TitanicEngine::run() {