aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Fach-Pedersen2015-02-06 17:14:52 +0100
committerEugene Sandulenko2016-09-29 22:33:37 +0200
commitabf98fca036025fac269f9b03cdb318b921ce804 (patch)
tree28649a3a64c979dc5fc48713b70617ba918f0bcb
parent420d7f9ecc1b2281b36e98c036d090ced3b8b891 (diff)
downloadscummvm-rg350-abf98fca036025fac269f9b03cdb318b921ce804.tar.gz
scummvm-rg350-abf98fca036025fac269f9b03cdb318b921ce804.tar.bz2
scummvm-rg350-abf98fca036025fac269f9b03cdb318b921ce804.zip
BLADERUNNER: Read set objects and walkboxes
-rw-r--r--engines/bladerunner/boundingbox.cpp37
-rw-r--r--engines/bladerunner/boundingbox.h40
-rw-r--r--engines/bladerunner/module.mk1
-rw-r--r--engines/bladerunner/scene.cpp4
-rw-r--r--engines/bladerunner/scene.h5
-rw-r--r--engines/bladerunner/set.cpp64
-rw-r--r--engines/bladerunner/set.h32
7 files changed, 178 insertions, 5 deletions
diff --git a/engines/bladerunner/boundingbox.cpp b/engines/bladerunner/boundingbox.cpp
new file mode 100644
index 0000000000..10e529b1e3
--- /dev/null
+++ b/engines/bladerunner/boundingbox.cpp
@@ -0,0 +1,37 @@
+/* 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 "bladerunner/boundingbox.h"
+
+namespace BladeRunner {
+
+BoundingBox::BoundingBox(float x0, float y0, float z0, float x1, float y1, float z1) {
+ _vertices[0].x = x0;
+ _vertices[0].y = y0;
+ _vertices[0].z = z0;
+
+ _vertices[1].x = x1;
+ _vertices[1].y = y1;
+ _vertices[1].z = z1;
+}
+
+} // End of namespace BladeRunner
diff --git a/engines/bladerunner/boundingbox.h b/engines/bladerunner/boundingbox.h
new file mode 100644
index 0000000000..5dda3f0e3f
--- /dev/null
+++ b/engines/bladerunner/boundingbox.h
@@ -0,0 +1,40 @@
+/* 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 BLADERUNNER_BOUNDING_BOX_H
+#define BLADERUNNER_BOUNDING_BOX_H
+
+#include "vector.h"
+
+namespace BladeRunner {
+
+class BoundingBox {
+ Vector3 _vertices[2];
+
+public:
+ BoundingBox() {}
+ BoundingBox(float x0, float y0, float z0, float x1, float y1, float z1);
+};
+
+} // End of namespace BladeRunner
+
+#endif
diff --git a/engines/bladerunner/module.mk b/engines/bladerunner/module.mk
index 080eda93f8..52fcf90b6a 100644
--- a/engines/bladerunner/module.mk
+++ b/engines/bladerunner/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS = \
aud_decoder.o \
audio_player.o \
bladerunner.o \
+ boundingbox.o \
chapters.o \
decompress_lcw.o \
decompress_lzo.o \
diff --git a/engines/bladerunner/scene.cpp b/engines/bladerunner/scene.cpp
index 8a5870d64f..8ec8b59d1b 100644
--- a/engines/bladerunner/scene.cpp
+++ b/engines/bladerunner/scene.cpp
@@ -70,8 +70,8 @@ bool Scene::open(int setId, int sceneId, bool isLoadingGame) {
_vm->_script->InitializeScene();
Common::String setResourceName = Common::String::format("%s-MIN.SET", sceneName.c_str());
- // if (!_set->open(setResourceName))
- // return false;
+ if (!_set->open(setResourceName))
+ return false;
// TODO: Set view
if (isLoadingGame) {
diff --git a/engines/bladerunner/scene.h b/engines/bladerunner/scene.h
index 5856e0b0d3..3a71fb3bcd 100644
--- a/engines/bladerunner/scene.h
+++ b/engines/bladerunner/scene.h
@@ -23,6 +23,9 @@
#ifndef BLADERUNNER_SCENE_H
#define BLADERUNNER_SCENE_H
+#include "bladerunner/bladerunner.h"
+
+#include "bladerunner/set.h"
#include "bladerunner/view.h"
#include "bladerunner/vqa_player.h"
@@ -34,6 +37,7 @@ class Scene {
BladeRunnerEngine *_vm;
public:
+ Set *_set;
int _setId;
int _sceneId;
VQAPlayer _vqaPlayer;
@@ -49,6 +53,7 @@ public:
public:
Scene(BladeRunnerEngine *vm)
: _vm(vm),
+ _set(new Set(vm)),
_setId(-1),
_sceneId(-1),
_vqaPlayer(vm),
diff --git a/engines/bladerunner/set.cpp b/engines/bladerunner/set.cpp
index 2751c1dc48..c37b31a80e 100644
--- a/engines/bladerunner/set.cpp
+++ b/engines/bladerunner/set.cpp
@@ -24,6 +24,7 @@
#include "bladerunner/bladerunner.h"
+#include "common/debug.h"
#include "common/ptr.h"
#include "common/str.h"
#include "common/stream.h"
@@ -32,6 +33,18 @@ namespace BladeRunner {
#define kSet0 0x53657430
+Set::Set(BladeRunnerEngine *vm) : _vm(vm) {
+ _objectCount = 0;
+ _walkboxCount = 0;
+ _objects = new Object[85];
+ _walkboxes = new Walkbox[95];
+}
+
+Set::~Set() {
+ delete[] _objects;
+ delete[] _walkboxes;
+}
+
bool Set::open(const Common::String &name) {
Common::ScopedPtr<Common::SeekableReadStream> s(_vm->getResourceStream(name));
@@ -39,6 +52,57 @@ bool Set::open(const Common::String &name) {
if (sig != kSet0)
return false;
+ s->skip(4); // TODO: LITE length
+
+ _objectCount = s->readUint32LE();
+ assert(_objectCount <= 85);
+
+ for (uint32 i = 0; i != _objectCount; ++i) {
+ s->read(_objects[i]._name, 20);
+
+ float x0, y0, z0, x1, y1, z1;
+ x0 = s->readFloatLE();
+ y0 = s->readFloatLE();
+ z0 = s->readFloatLE();
+ x1 = s->readFloatLE();
+ y1 = s->readFloatLE();
+ z1 = s->readFloatLE();
+
+ _objects[i]._bbox = BoundingBox(x0, y0, z0, x1, y1, z1);
+
+ _objects[i]._isObstacle = s->readByte();
+ _objects[i]._isClickable = s->readByte();
+ _objects[i]._isHotMouse = 0;
+ _objects[i]._isCombatTarget = 0;
+ s->skip(4);
+
+ // debug("OBJECT: %s", _objects[i]._name);
+ }
+
+ _walkboxCount = s->readUint32LE();
+ assert(_walkboxCount <= 95);
+
+ for (uint32 i = 0; i != _walkboxCount; ++i) {
+ float x, y, z;
+
+ s->read(_walkboxes[i]._name, 20);
+ y = s->readFloatLE();
+ _walkboxes[i]._vertexCount = s->readUint32LE();
+
+ assert(_walkboxes[i]._vertexCount <= 8);
+
+ for (uint32 j = 0; j != _walkboxes[i]._vertexCount; ++j) {
+ x = s->readFloatLE();
+ z = s->readFloatLE();
+
+ _walkboxes[i]._vertices[j] = Vector3(x, y, z);
+ }
+
+ // debug("WALKBOX: %s", _walkboxes[i]._name);
+ }
+
+ // TODO: Read LITE
+
return true;
}
diff --git a/engines/bladerunner/set.h b/engines/bladerunner/set.h
index b2982781c9..e7358fdb2a 100644
--- a/engines/bladerunner/set.h
+++ b/engines/bladerunner/set.h
@@ -23,6 +23,9 @@
#ifndef BLADERUNNER_SET_H
#define BLADERUNNER_SET_H
+#include "bladerunner/boundingbox.h"
+
+#include "common/scummsys.h"
#include "common/str.h"
namespace BladeRunner {
@@ -31,13 +34,36 @@ class BladeRunnerEngine;
class VQADecoder;
+struct Object {
+ char _name[20];
+ BoundingBox _bbox;
+ uint8 _isObstacle;
+ uint8 _isClickable;
+ uint8 _isHotMouse;
+ uint8 _isCombatTarget;
+};
+
+struct Walkbox {
+ char _name[20];
+ float _altitude;
+ uint32 _vertexCount;
+ Vector3 _vertices[8];
+};
+
class Set {
BladeRunnerEngine *_vm;
+ uint32 _objectCount;
+ uint32 _walkboxCount;
+ Object *_objects;
+ Walkbox *_walkboxes;
+ int _walkboxStepSound[85];
+ int _footstepSoundOverride;
+ float _unknown[10];
+
public:
- Set(BladeRunnerEngine *vm)
- {
- }
+ Set(BladeRunnerEngine *vm);
+ ~Set();
bool open(const Common::String &name);
};