aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/module.mk5
-rw-r--r--engines/titanic/objects/auto_sound_event.cpp46
-rw-r--r--engines/titanic/objects/auto_sound_event.h55
-rw-r--r--engines/titanic/objects/game_object.cpp94
-rw-r--r--engines/titanic/objects/game_object.h47
-rw-r--r--engines/titanic/objects/resource_key.h2
-rw-r--r--engines/titanic/objects/saveable_object.cpp3
-rw-r--r--engines/titanic/rooms/door_auto_sound_event.cpp51
-rw-r--r--engines/titanic/rooms/door_auto_sound_event.h57
-rw-r--r--engines/titanic/rooms/service_elevator_door.cpp48
-rw-r--r--engines/titanic/rooms/service_elevator_door.h52
-rw-r--r--engines/titanic/simple_file.cpp30
-rw-r--r--engines/titanic/simple_file.h21
13 files changed, 510 insertions, 1 deletions
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 9dfbb2fd74..5dc7195426 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -15,6 +15,7 @@ MODULE_OBJS := \
string.o \
titanic.o \
video_surface.o \
+ objects/auto_sound_event.o \
objects/dont_save_file_item.o \
objects/file_item.o \
objects/game_object.o \
@@ -28,7 +29,9 @@ MODULE_OBJS := \
objects/resource_key.o \
objects/saveable_object.o \
objects/tree_item.o \
- rooms/room_item.o
+ rooms/door_auto_sound_event.o \
+ rooms/room_item.o \
+ rooms/service_elevator_door.o
# This module can be built as a plugin
ifeq ($(ENABLE_TITANIC), DYNAMIC_PLUGIN)
diff --git a/engines/titanic/objects/auto_sound_event.cpp b/engines/titanic/objects/auto_sound_event.cpp
new file mode 100644
index 0000000000..7160ac7b24
--- /dev/null
+++ b/engines/titanic/objects/auto_sound_event.cpp
@@ -0,0 +1,46 @@
+/* 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/objects/auto_sound_event.h"
+
+namespace Titanic {
+
+CAutoSoundEvent::CAutoSoundEvent() : CGameObject(), _fieldBC(-1), _fieldC0(0xFFFFFF) {
+}
+
+void CAutoSoundEvent::save(SimpleFile *file, int indent) const {
+ file->writeNumberLine(1, indent);
+ file->writeNumberLine(_fieldBC, indent);
+ file->writeNumberLine(_fieldC0, indent);
+
+ CGameObject::save(file, indent);
+}
+
+void CAutoSoundEvent::load(SimpleFile *file) {
+ file->readNumber();
+ _fieldBC = file->readNumber();
+ _fieldC0 = file->readNumber();
+
+ CGameObject::load(file);
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/objects/auto_sound_event.h b/engines/titanic/objects/auto_sound_event.h
new file mode 100644
index 0000000000..bcfc6a49c6
--- /dev/null
+++ b/engines/titanic/objects/auto_sound_event.h
@@ -0,0 +1,55 @@
+/* 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_AUTO_SOUND_EVENT_H
+#define TITANIC_AUTO_SOUND_EVENT_H
+
+#include "titanic/objects/game_object.h"
+
+namespace Titanic {
+
+class CAutoSoundEvent : public CGameObject {
+private:
+ int _fieldBC;
+ int _fieldC0;
+public:
+ CAutoSoundEvent();
+
+ /**
+ * Return the class name
+ */
+ virtual const char *getClassName() const { return "CAutoSoundEvent"; }
+
+ /**
+ * 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_AUTO_SOUND_EVENT_H */
diff --git a/engines/titanic/objects/game_object.cpp b/engines/titanic/objects/game_object.cpp
index a1e1faccce..2e35417bd5 100644
--- a/engines/titanic/objects/game_object.cpp
+++ b/engines/titanic/objects/game_object.cpp
@@ -21,7 +21,101 @@
*/
#include "titanic/objects/game_object.h"
+#include "titanic/objects/resource_key.h"
namespace Titanic {
+CGameObject::CGameObject(): CNamedItem() {
+ _bounds = Common::Rect(0, 0, 15, 15);
+ _field34 = 0;
+ _field38 = 0;
+ _field3C = 0;
+ _field40 = 0;
+ _field44 = 0xF0;
+ _field48 = 0xF0;
+ _field4C = 0xFF;
+ _field50 = 0;
+ _field54 = 0;
+ _field58 = 0;
+ _field5C = 1;
+ _field60 = 0;
+ _field74 = 1;
+ _field78 = 0;
+ _field8C = -1;
+ _field90 = 0;
+ _field94 = 0;
+ _field98 = 0;
+ _field9C = 0;
+ _fieldA0 = 0;
+ _fieldA4 = 0;
+ _fieldA8 = nullptr;
+ _fieldB8 = 0;
+}
+
+void CGameObject::save(SimpleFile *file, int indent) const {
+ file->writeNumberLine(7, indent);
+ error("TODO: CGameObject::save");
+
+ CNamedItem::save(file, indent);
+}
+
+void CGameObject::load(SimpleFile *file) {
+ int val = file->readNumber();
+ CResourceKey resourceKey;
+
+ switch (val) {
+ case 7:
+ _clipList2.load(file);
+ _field8C = file->readNumber();
+ // Deliberate fall-through
+
+ case 6:
+ val = _field74 = file->readNumber();
+ // Deliberate fall-through
+
+ case 5:
+ _clipList1.load(file);
+ // Deliberate fall-through
+
+ case 4:
+ _field60 = file->readNumber();
+ // Deliberate fall-through
+
+ case 3:
+ _field40 = file->readNumber();
+ // Deliberate fall-through
+
+ case 2:
+ _string = file->readString();
+ // Deliberate fall-through
+
+ case 1:
+ _bounds = file->readRect();
+ _field34 = file->readFloat();
+ _field38 = file->readFloat();
+ _field3C = file->readFloat();
+ _field44 = file->readNumber();
+ _field48 = file->readNumber();
+ _field4C = file->readNumber();
+ _fieldB8 = file->readNumber();
+ _field5C = file->readNumber();
+ _field50 = file->readNumber();
+ _field54 = file->readNumber();
+ _field58 = file->readNumber();
+
+ resourceKey.load(file);
+ _fieldA8 = nullptr;
+ val = file->readNumber();
+ if (val) {
+ _string = resourceKey.getString();
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ CNamedItem::load(file);
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/objects/game_object.h b/engines/titanic/objects/game_object.h
index 7e0fba6e87..53814f6d3d 100644
--- a/engines/titanic/objects/game_object.h
+++ b/engines/titanic/objects/game_object.h
@@ -23,11 +23,58 @@
#ifndef TITANIC_GAME_OBJECT_H
#define TITANIC_GAME_OBJECT_H
+#include "common/rect.h"
+#include "titanic/objects/movie_clip.h"
#include "titanic/objects/named_item.h"
namespace Titanic {
class CGameObject : public CNamedItem {
+protected:
+ Common::Rect _bounds;
+ double _field34;
+ double _field38;
+ double _field3C;
+ int _field40;
+ int _field44;
+ int _field48;
+ int _field4C;
+ int _field50;
+ int _field54;
+ int _field58;
+ int _field5C;
+ int _field60;
+ CMovieClipList _clipList1;
+ int _field74;
+ int _field78;
+ CMovieClipList _clipList2;
+ int _field8C;
+ int _field90;
+ int _field94;
+ int _field98;
+ int _field9C;
+ int _fieldA0;
+ int _fieldA4;
+ void *_fieldA8;
+ CString _string;
+ int _fieldB8;
+public:
+ CGameObject();
+
+ /**
+ * Return the class name
+ */
+ virtual const char *getClassName() const { return "CGameObject"; }
+
+ /**
+ * 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
diff --git a/engines/titanic/objects/resource_key.h b/engines/titanic/objects/resource_key.h
index 4cb40cd568..9d1b70ffc9 100644
--- a/engines/titanic/objects/resource_key.h
+++ b/engines/titanic/objects/resource_key.h
@@ -47,6 +47,8 @@ public:
* Load the data for the class from file
*/
virtual void load(SimpleFile *file);
+
+ const CString &getString() const { return _key; }
};
} // End of namespace Titanic
diff --git a/engines/titanic/objects/saveable_object.cpp b/engines/titanic/objects/saveable_object.cpp
index 7e9aa4b9ab..555394d45e 100644
--- a/engines/titanic/objects/saveable_object.cpp
+++ b/engines/titanic/objects/saveable_object.cpp
@@ -29,6 +29,7 @@
#include "titanic/objects/project_item.h"
#include "titanic/objects/tree_item.h"
#include "titanic/rooms/room_item.h"
+#include "titanic/rooms/service_elevator_door.h"
namespace Titanic {
@@ -46,6 +47,7 @@ DEFFN(CMovieClipList);
DEFFN(CNodeItem);
DEFFN(CProjectItem);
DEFFN(CRoomItem);
+DEFFN(CServiceElevatorDoor);
DEFFN(CTreeItem);
void CSaveableObject::initClassList() {
@@ -58,6 +60,7 @@ void CSaveableObject::initClassList() {
ADDFN(CNodeItem);
ADDFN(CProjectItem);
ADDFN(CRoomItem);
+ ADDFN(CServiceElevatorDoor);
ADDFN(CTreeItem);
}
diff --git a/engines/titanic/rooms/door_auto_sound_event.cpp b/engines/titanic/rooms/door_auto_sound_event.cpp
new file mode 100644
index 0000000000..279f4f98e6
--- /dev/null
+++ b/engines/titanic/rooms/door_auto_sound_event.cpp
@@ -0,0 +1,51 @@
+/* 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/rooms/door_auto_sound_event.h"
+
+namespace Titanic {
+
+CDoorAutoSoundEvent::CDoorAutoSoundEvent() : CAutoSoundEvent(),
+ _string1("z#44.wav"), _string2("z#43.wav"), _fieldDC(25), _fieldE0(25) {
+}
+
+void CDoorAutoSoundEvent::save(SimpleFile *file, int indent) const {
+ file->writeNumberLine(1, indent);
+ file->writeQuotedLine(_string1, indent);
+ file->writeQuotedLine(_string2, indent);
+ file->writeNumberLine(_fieldDC, indent);
+ file->writeNumberLine(_fieldE0, indent);
+
+ CAutoSoundEvent::save(file, indent);
+}
+
+void CDoorAutoSoundEvent::load(SimpleFile *file) {
+ file->readNumber();
+ _string1 = file->readString();
+ _string2 = file->readString();
+ _fieldDC = file->readNumber();
+ _fieldE0 = file->readNumber();
+
+ CAutoSoundEvent::load(file);
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/rooms/door_auto_sound_event.h b/engines/titanic/rooms/door_auto_sound_event.h
new file mode 100644
index 0000000000..4f960273b5
--- /dev/null
+++ b/engines/titanic/rooms/door_auto_sound_event.h
@@ -0,0 +1,57 @@
+/* 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_DOOR_AUTO_SOUND_EVENT_H
+#define TITANIC_DOOR_AUTO_SOUND_EVENT_H
+
+#include "titanic/objects/auto_sound_event.h"
+
+namespace Titanic {
+
+class CDoorAutoSoundEvent : public CAutoSoundEvent {
+protected:
+ CString _string1;
+ CString _string2;
+ int _fieldDC;
+ int _fieldE0;
+public:
+ CDoorAutoSoundEvent();
+
+ /**
+ * Return the class name
+ */
+ virtual const char *getClassName() const { return "CDoorAutoSoundEvent"; }
+
+ /**
+ * 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_DOOR_AUTO_SOUND_EVENT_H */
diff --git a/engines/titanic/rooms/service_elevator_door.cpp b/engines/titanic/rooms/service_elevator_door.cpp
new file mode 100644
index 0000000000..931a9d6474
--- /dev/null
+++ b/engines/titanic/rooms/service_elevator_door.cpp
@@ -0,0 +1,48 @@
+/* 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/rooms/service_elevator_door.h"
+
+namespace Titanic {
+
+CServiceElevatorDoor::CServiceElevatorDoor() : CDoorAutoSoundEvent() {
+ _string1 = "z#31.wav";
+ _string2 = "z#32.wav";
+}
+
+void CServiceElevatorDoor::save(SimpleFile *file, int indent) const {
+ file->writeNumberLine(1, indent);
+ file->writeQuotedLine(_string2, indent);
+ file->writeQuotedLine(_string1, indent);
+
+ CDoorAutoSoundEvent::save(file, indent);
+}
+
+void CServiceElevatorDoor::load(SimpleFile *file) {
+ file->readNumber();
+ _string2 = file->readString();
+ _string1 = file->readString();
+
+ CDoorAutoSoundEvent::load(file);
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/rooms/service_elevator_door.h b/engines/titanic/rooms/service_elevator_door.h
new file mode 100644
index 0000000000..5b924bc17c
--- /dev/null
+++ b/engines/titanic/rooms/service_elevator_door.h
@@ -0,0 +1,52 @@
+/* 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_SERVICE_ELEVATOR_DOOR_H
+#define TITANIC_SERVICE_ELEVATOR_DOOR_H
+
+#include "titanic/rooms/door_auto_sound_event.h"
+
+namespace Titanic {
+
+class CServiceElevatorDoor : public CDoorAutoSoundEvent {
+public:
+ CServiceElevatorDoor();
+
+ /**
+ * Return the class name
+ */
+ virtual const char *getClassName() const { return "CServiceElevatorDoor"; }
+
+ /**
+ * 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_SERVICE_ELEVATOR_DOOR_H */
diff --git a/engines/titanic/simple_file.cpp b/engines/titanic/simple_file.cpp
index 521f9e9b99..045de1fe07 100644
--- a/engines/titanic/simple_file.cpp
+++ b/engines/titanic/simple_file.cpp
@@ -191,6 +191,24 @@ double SimpleFile::readFloat() {
return floatValue;
}
+Common::Point SimpleFile::readPoint() {
+ Common::Point pt;
+ pt.x = readNumber();
+ pt.y = readNumber();
+
+ return pt;
+}
+
+Common::Rect SimpleFile::readRect() {
+ Common::Rect r;
+ r.left = readNumber();
+ r.top = readNumber();
+ r.right = readNumber();
+ r.bottom = readNumber();
+
+ return r;
+}
+
void SimpleFile::readBuffer(char *buffer, size_t count) {
CString tempString = readString();
if (buffer) {
@@ -264,6 +282,18 @@ void SimpleFile::writeNumberLine(int val, int indent) {
write("\n", 1);
}
+void SimpleFile::writePoint(const Common::Point &pt, int indent) {
+ writeIndent(indent);
+ writeNumber(pt.x);
+ writeNumber(pt.y);
+ write("\n", 1);
+}
+
+void SimpleFile::writeRect(const Common::Rect &r, int indent) {
+ writePoint(Common::Point(r.left, r.top), indent);
+ writePoint(Common::Point(r.right, r.bottom), indent);
+}
+
void SimpleFile::writeIndent(uint indent) {
for (uint idx = 0; idx < indent; ++idx)
write("\t", 1);
diff --git a/engines/titanic/simple_file.h b/engines/titanic/simple_file.h
index 852c75b0f7..c5ca7016e7 100644
--- a/engines/titanic/simple_file.h
+++ b/engines/titanic/simple_file.h
@@ -26,6 +26,7 @@
#include "common/scummsys.h"
#include "common/file.h"
#include "common/queue.h"
+#include "common/rect.h"
#include "common/savefile.h"
#include "titanic/string.h"
@@ -95,6 +96,16 @@ public:
double readFloat();
/**
+ * Read in a point
+ */
+ Common::Point readPoint();
+
+ /**
+ * Read in a rect
+ */
+ Common::Rect readRect();
+
+ /**
* Read a string and copy it into an optionally passed buffer
*/
void readBuffer(char *buffer = nullptr, size_t count = 0);
@@ -130,6 +141,16 @@ public:
void writeNumberLine(int val, int indent);
/**
+ * Write out a point line
+ */
+ void writePoint(const Common::Point &pt, int indent);
+
+ /**
+ * Write out a rect line
+ */
+ void writeRect(const Common::Rect &r, int indent);
+
+ /**
* Write out a number of tabs to form an indent in the output
*/
void writeIndent(uint indent);