diff options
author | Peter Kohaut | 2016-09-10 18:33:04 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-09-29 22:33:41 +0200 |
commit | bf44e97d79019c926b214f9f6b109a192d46e2ec (patch) | |
tree | 1e48b1b846253f25233d83f4992743210860d6aa /engines/bladerunner/lights.cpp | |
parent | b67bca20b5db7f3d6473341efd7fabfa6532f465 (diff) | |
download | scummvm-rg350-bf44e97d79019c926b214f9f6b109a192d46e2ec.tar.gz scummvm-rg350-bf44e97d79019c926b214f9f6b109a192d46e2ec.tar.bz2 scummvm-rg350-bf44e97d79019c926b214f9f6b109a192d46e2ec.zip |
BLADERUNNER: added all scene scripts, esper script, kia script, vk script, completed init script. Added decoding of lights from VQA. Moved view from scene.
Diffstat (limited to 'engines/bladerunner/lights.cpp')
-rw-r--r-- | engines/bladerunner/lights.cpp | 65 |
1 files changed, 60 insertions, 5 deletions
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) |