From bf44e97d79019c926b214f9f6b109a192d46e2ec Mon Sep 17 00:00:00 2001 From: Peter Kohaut Date: Sat, 10 Sep 2016 18:33:04 +0200 Subject: BLADERUNNER: added all scene scripts, esper script, kia script, vk script, completed init script. Added decoding of lights from VQA. Moved view from scene. --- engines/bladerunner/lights.cpp | 65 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 5 deletions(-) (limited to 'engines/bladerunner/lights.cpp') diff --git a/engines/bladerunner/lights.cpp b/engines/bladerunner/lights.cpp index 29e4c2f58e..7a6be94c6d 100644 --- a/engines/bladerunner/lights.cpp +++ b/engines/bladerunner/lights.cpp @@ -19,7 +19,7 @@ Lights::~Lights() reset(); } -void Lights::read(Common::ReadStream* stream, int framesCount) +void Lights::read(Common::ReadStream *stream, int framesCount) { _ambientLightColor.r = stream->readFloatLE(); _ambientLightColor.g = stream->readFloatLE(); @@ -58,11 +58,66 @@ void Lights::read(Common::ReadStream* stream, int framesCount) } } -void Lights::readVqa(Common::ReadStream* stream) +void Lights::removeAnimated() { - reset(); - //int framesCount = stream->readUint32LE(); - //int count = stream->readUint32LE(); + Light **nextLight; + Light *light; + + nextLight = &this->_lights; + light = this->_lights; + if (light) + { + do + { + if (light->_animated) + { + *nextLight = light->_next; + delete light; + } + else + { + nextLight = &light->_next; + } + light = *nextLight; + } while (*nextLight); + } +} + +void Lights::readVqa(Common::ReadStream *stream) +{ + removeAnimated(); + if (stream->eos()) + return; + + int framesCount = stream->readUint32LE(); + int count = stream->readUint32LE(); + for (int i = 0; i < count; i++) { + int lightType = stream->readUint32LE(); + Light* light; + switch(lightType) + { + case 5: + light = new Light5(); + break; + case 4: + light = new Light4(); + break; + case 3: + light = new Light3(); + break; + case 2: + light = new Light2(); + break; + case 1: + light = new Light1(); + break; + default: + light = new Light(); + } + light->readVqa(stream, framesCount, _frame, 1); + light->_next = _lights; + _lights = light; + } } void Lights::setupFrame(int frame) -- cgit v1.2.3