diff options
Diffstat (limited to 'engines/bladerunner/set.cpp')
-rw-r--r-- | engines/bladerunner/set.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
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; } |