aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-02-28 12:46:48 -0500
committerPaul Gilbert2016-02-28 12:46:48 -0500
commit0471a25575d7cabff26f8abbace55c1dadaf6320 (patch)
treecbcafc1f288ab5dbb629933974b2dec8dd8f34ed
parentfa015808acb611f681a8027128e48fb458a84d14 (diff)
downloadscummvm-rg350-0471a25575d7cabff26f8abbace55c1dadaf6320.tar.gz
scummvm-rg350-0471a25575d7cabff26f8abbace55c1dadaf6320.tar.bz2
scummvm-rg350-0471a25575d7cabff26f8abbace55c1dadaf6320.zip
TITANIC: Implement light switch and buttons
-rw-r--r--engines/titanic/core/saveable_object.cpp14
-rw-r--r--engines/titanic/game/enter_exit_first_class_state.cpp49
-rw-r--r--engines/titanic/game/enter_exit_first_class_state.h62
-rw-r--r--engines/titanic/game/light.cpp60
-rw-r--r--engines/titanic/game/light.h61
-rw-r--r--engines/titanic/game/light_switch.cpp53
-rw-r--r--engines/titanic/game/light_switch.h58
-rw-r--r--engines/titanic/game/little_lift_button.cpp39
-rw-r--r--engines/titanic/game/little_lift_button.h54
-rw-r--r--engines/titanic/module.mk4
-rw-r--r--engines/titanic/titanic.cpp6
-rw-r--r--engines/titanic/titanic.h5
12 files changed, 465 insertions, 0 deletions
diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp
index f0429a73d3..12efdc17d2 100644
--- a/engines/titanic/core/saveable_object.cpp
+++ b/engines/titanic/core/saveable_object.cpp
@@ -82,7 +82,11 @@
#include "titanic/game/drawer.h"
#include "titanic/game/ear_sweet_bowl.h"
#include "titanic/game/empty_nut_bowl.h"
+#include "titanic/game/enter_exit_first_class_state.h"
#include "titanic/game/hammer_dispensor_button.h"
+#include "titanic/game/light.h"
+#include "titanic/game/light_switch.h"
+#include "titanic/game/little_lift_button.h"
#include "titanic/game/no_nut_bowl.h"
#include "titanic/game/null_port_hole.h"
#include "titanic/game/nut_replacer.h"
@@ -188,6 +192,7 @@ DEFFN(CCarryParrot);
DEFFN(CChicken);
DEFFN(CCrushedTV);
DEFFN(CEar);
+DEFFN(CEye);
DEFFN(CFeathers);
DEFFN(CFruit);
DEFFN(CGlass);
@@ -237,7 +242,11 @@ DEFFN(CDeskClickResponder);
DEFFN(CDoorbotHomeHandler);
DEFFN(CEarSweetBowl);
DEFFN(CEmptyNutBowl);
+DEFFN(CEnterExitFirstClassState);
DEFFN(CHammerDispensorButton);
+DEFFN(CLight);
+DEFFN(CLightSwitch);
+DEFFN(CLittleLiftButton);
DEFFN(CNoNutBowl);
DEFFN(CNullPortHole);
DEFFN(CNutReplacer);
@@ -507,6 +516,7 @@ void CSaveableObject::initClassList() {
ADDFN(CChicken);
ADDFN(CCrushedTV);
ADDFN(CEar);
+ ADDFN(CEye);
ADDFN(CFeathers);
ADDFN(CFruit);
ADDFN(CGlass);
@@ -557,7 +567,11 @@ void CSaveableObject::initClassList() {
ADDFN(CDropTarget);
ADDFN(CEarSweetBowl);
ADDFN(CEmptyNutBowl);
+ ADDFN(CEnterExitFirstClassState);
ADDFN(CHammerDispensorButton);
+ ADDFN(CLight);
+ ADDFN(CLightSwitch);
+ ADDFN(CLittleLiftButton);
ADDFN(CNoNutBowl);
ADDFN(CNullPortHole);
ADDFN(CNutReplacer);
diff --git a/engines/titanic/game/enter_exit_first_class_state.cpp b/engines/titanic/game/enter_exit_first_class_state.cpp
new file mode 100644
index 0000000000..7fa191b0e3
--- /dev/null
+++ b/engines/titanic/game/enter_exit_first_class_state.cpp
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "titanic/game/enter_exit_first_class_state.h"
+
+namespace Titanic {
+
+CString *CEnterExitFirstClassState::_v1;
+
+void CEnterExitFirstClassState::init() {
+ _v1 = new CString();
+}
+
+void CEnterExitFirstClassState::deinit() {
+ delete _v1;
+}
+
+void CEnterExitFirstClassState::save(SimpleFile *file, int indent) const {
+ file->writeNumberLine(1, indent);
+ file->writeQuotedLine(*_v1, indent);
+ CGameObject::save(file, indent);
+}
+
+void CEnterExitFirstClassState::load(SimpleFile *file) {
+ file->readNumber();
+ *_v1 = file->readString();
+ CGameObject::load(file);
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/game/enter_exit_first_class_state.h b/engines/titanic/game/enter_exit_first_class_state.h
new file mode 100644
index 0000000000..f7bc4c69f7
--- /dev/null
+++ b/engines/titanic/game/enter_exit_first_class_state.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TITANIC_ENTER_EXIT_FIRST_CLASS_STATE_H
+#define TITANIC_ENTER_EXIT_FIRST_CLASS_STATE_H
+
+#include "titanic/core/game_object.h"
+
+namespace Titanic {
+
+class CEnterExitFirstClassState : public CGameObject {
+public:
+ static CString *_v1;
+
+ /**
+ * Initialize static data
+ */
+ static void init();
+
+ /**
+ * De-initialize static data
+ */
+ static void deinit();
+public:
+ /**
+ * Return the class name
+ */
+ virtual const char *getClassName() const { return "CBowlUnlocker"; }
+
+ /**
+ * Save the data for the class to file
+ */
+ virtual void save(SimpleFile *file, int indent) const;
+
+ /**
+ * Load the data for the class from file
+ */
+ virtual void load(SimpleFile *file);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_ENTER_EXIT_FIRST_CLASS_STATE_H */
diff --git a/engines/titanic/game/light.cpp b/engines/titanic/game/light.cpp
new file mode 100644
index 0000000000..4f5a492f2f
--- /dev/null
+++ b/engines/titanic/game/light.cpp
@@ -0,0 +1,60 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "titanic/game/light.h"
+
+namespace Titanic {
+
+CLight::CLight() : CBackground(), _fieldE0(0), _fieldE4(0),
+ _fieldE8(0), _fieldEC(0), _fieldF0(0), _fieldF4(0),
+ _fieldF8(0), _fieldFC(0) {
+}
+
+void CLight::save(SimpleFile *file, int indent) const {
+ file->writeNumberLine(1, indent);
+ file->writeNumberLine(_fieldE0, indent);
+ file->writeNumberLine(_fieldE4, indent);
+ file->writeNumberLine(_fieldE8, indent);
+ file->writeNumberLine(_fieldEC, indent);
+ file->writeNumberLine(_fieldF0, indent);
+ file->writeNumberLine(_fieldF4, indent);
+ file->writeNumberLine(_fieldF8, indent);
+ file->writeNumberLine(_fieldFC, indent);
+
+ CBackground::save(file, indent);
+}
+
+void CLight::load(SimpleFile *file) {
+ file->readNumber();
+ _fieldE0 = file->readNumber();
+ _fieldE4 = file->readNumber();
+ _fieldE8 = file->readNumber();
+ _fieldEC = file->readNumber();
+ _fieldF0 = file->readNumber();
+ _fieldF4 = file->readNumber();
+ _fieldF8 = file->readNumber();
+ _fieldFC = file->readNumber();
+
+ CBackground::load(file);
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/game/light.h b/engines/titanic/game/light.h
new file mode 100644
index 0000000000..482d1be65b
--- /dev/null
+++ b/engines/titanic/game/light.h
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TITANIC_LIGHT_H
+#define TITANIC_LIGHT_H
+
+#include "titanic/core/background.h"
+
+namespace Titanic {
+
+class CLight : public CBackground {
+private:
+ int _fieldE0;
+ int _fieldE4;
+ int _fieldE8;
+ int _fieldEC;
+ int _fieldF0;
+ int _fieldF4;
+ int _fieldF8;
+ int _fieldFC;
+public:
+ CLight();
+
+ /**
+ * Return the class name
+ */
+ virtual const char *getClassName() const { return "CLight"; }
+
+ /**
+ * Save the data for the class to file
+ */
+ virtual void save(SimpleFile *file, int indent) const;
+
+ /**
+ * Load the data for the class from file
+ */
+ virtual void load(SimpleFile *file);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_LIGHT_H */
diff --git a/engines/titanic/game/light_switch.cpp b/engines/titanic/game/light_switch.cpp
new file mode 100644
index 0000000000..605fab37f8
--- /dev/null
+++ b/engines/titanic/game/light_switch.cpp
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "titanic/game/light_switch.h"
+
+namespace Titanic {
+
+int CLightSwitch::_v1;
+
+CLightSwitch::CLightSwitch() : CBackground(),
+ _fieldE0(0), _fieldE4(0), _fieldE8(0) {
+}
+
+void CLightSwitch::save(SimpleFile *file, int indent) const {
+ file->writeNumberLine(1, indent);
+ file->writeNumberLine(_fieldE0, indent);
+ file->writeNumberLine(_fieldE4, indent);
+ file->writeNumberLine(_v1, indent);
+ file->writeNumberLine(_fieldE8, indent);
+
+ CBackground::save(file, indent);
+}
+
+void CLightSwitch::load(SimpleFile *file) {
+ file->readNumber();
+ _fieldE0 = file->readNumber();
+ _fieldE4 = file->readNumber();
+ _v1 = file->readNumber();
+ _fieldE8 = file->readNumber();
+
+ CBackground::load(file);
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/game/light_switch.h b/engines/titanic/game/light_switch.h
new file mode 100644
index 0000000000..0228b1009b
--- /dev/null
+++ b/engines/titanic/game/light_switch.h
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TITANIC_LIGHT_SWITCH_H
+#define TITANIC_LIGHT_SWITCH_H
+
+#include "titanic/core/background.h"
+
+namespace Titanic {
+
+class CLightSwitch : public CBackground {
+public:
+ static int _v1;
+private:
+ int _fieldE0;
+ int _fieldE4;
+ int _fieldE8;
+public:
+ CLightSwitch();
+
+ /**
+ * Return the class name
+ */
+ virtual const char *getClassName() const { return "CLightSwitch"; }
+
+ /**
+ * Save the data for the class to file
+ */
+ virtual void save(SimpleFile *file, int indent) const;
+
+ /**
+ * Load the data for the class from file
+ */
+ virtual void load(SimpleFile *file);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_LIGHT_SWITCH_H */
diff --git a/engines/titanic/game/little_lift_button.cpp b/engines/titanic/game/little_lift_button.cpp
new file mode 100644
index 0000000000..3e2fbdd6e8
--- /dev/null
+++ b/engines/titanic/game/little_lift_button.cpp
@@ -0,0 +1,39 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "titanic/game/little_lift_button.h"
+
+namespace Titanic {
+
+void CLittleLiftButton::save(SimpleFile *file, int indent) const {
+ file->writeNumberLine(1, indent);
+ file->writeNumberLine(_value, indent);
+ CBackground::save(file, indent);
+}
+
+void CLittleLiftButton::load(SimpleFile *file) {
+ file->readNumber();
+ _value = file->readNumber();
+ CBackground::load(file);
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/game/little_lift_button.h b/engines/titanic/game/little_lift_button.h
new file mode 100644
index 0000000000..475b8435d5
--- /dev/null
+++ b/engines/titanic/game/little_lift_button.h
@@ -0,0 +1,54 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef TITANIC_LITTLE_LIFT_BUTTON_H
+#define TITANIC_LITTLE_LIFT_BUTTON_H
+
+#include "titanic/core/background.h"
+
+namespace Titanic {
+
+class CLittleLiftButton : public CBackground {
+private:
+ int _value;
+public:
+ CLittleLiftButton() : CBackground(), _value(0) {}
+
+ /**
+ * Return the class name
+ */
+ virtual const char *getClassName() const { return "CLittleLiftButton"; }
+
+ /**
+ * Save the data for the class to file
+ */
+ virtual void save(SimpleFile *file, int indent) const;
+
+ /**
+ * Load the data for the class from file
+ */
+ virtual void load(SimpleFile *file);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_LITTLE_LIFT_BUTTON_H */
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 0b43dbbbc1..111fd25de2 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -80,7 +80,11 @@ MODULE_OBJS := \
game/drawer.o \
game/ear_sweet_bowl.o \
game/empty_nut_bowl.o \
+ game/enter_exit_first_class_state.o \
game/hammer_dispensor_button.o \
+ game/light.o \
+ game/light_switch.o \
+ game/little_lift_button.o \
game/no_nut_bowl.o \
game/pet_position.o \
game/port_hole.o \
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index 9deb5e6e7a..b3aae7bf1b 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -30,6 +30,7 @@
#include "titanic/titanic.h"
#include "titanic/core/saveable_object.h"
#include "titanic/game/parrot/parrot_lobby_object.h"
+#include "titanic/game/enter_exit_first_class_state.h"
namespace Titanic {
@@ -54,12 +55,17 @@ void TitanicEngine::initialize() {
CSaveableObject::initClassList();
CParrotLobbyObject::init();
+ CEnterExitFirstClassState::init();
_screenManager = new OSScreenManager(this);
_window = new CMainGameWindow(this);
_window->applicationStarting();
}
+void TitanicEngine::deinitialize() {
+ CEnterExitFirstClassState::deinit();
+}
+
Common::Error TitanicEngine::run() {
initialize();
diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h
index ec0585c410..3a95e86b54 100644
--- a/engines/titanic/titanic.h
+++ b/engines/titanic/titanic.h
@@ -72,6 +72,11 @@ private:
* Handles basic initialization
*/
void initialize();
+
+ /**
+ * Handles game deinitialization
+ */
+ void deinitialize();
protected:
const TitanicGameDescription *_gameDescription;
int _loadSaveSlot;