From f1cb735ee07c11785f67080ea800a72dd551ae19 Mon Sep 17 00:00:00 2001 From: Peter Kohaut Date: Mon, 26 Sep 2016 23:38:35 +0200 Subject: BLADERUNNER: added rendering support for lighting and effects, but its not working correctly yet --- engines/bladerunner/lights.cpp | 88 +++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 52 deletions(-) (limited to 'engines/bladerunner/lights.cpp') diff --git a/engines/bladerunner/lights.cpp b/engines/bladerunner/lights.cpp index eb18958020..0d6a1be175 100644 --- a/engines/bladerunner/lights.cpp +++ b/engines/bladerunner/lights.cpp @@ -2,8 +2,7 @@ namespace BladeRunner { -Lights::Lights(BladeRunnerEngine *vm) -{ +Lights::Lights(BladeRunnerEngine *vm) { _vm = vm; _ambientLightColor.r = 1.0; @@ -11,28 +10,25 @@ Lights::Lights(BladeRunnerEngine *vm) _ambientLightColor.b = 0.0; _lights = nullptr; + _lightsCount = 0; _frame = 0; } -Lights::~Lights() -{ +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(); _ambientLightColor.b = stream->readFloatLE(); _lightsCount = stream->readUint32LE(); int i; - for (i = 0; i < _lightsCount; i++) - { + for (i = 0; i < _lightsCount; i++) { Light *light; int type = stream->readUint32LE(); - switch (type) - { + switch (type) { case 1: light = new Light1(); break; @@ -58,24 +54,18 @@ void Lights::read(Common::ReadStream *stream, int framesCount) } } -void Lights::removeAnimated() -{ +void Lights::removeAnimated() { Light **nextLight; - Light *light; + Light *light; nextLight = &this->_lights; light = this->_lights; - if (light) - { - do - { - if (light->_animated) - { + if (light) { + do { + if (light->_animated) { *nextLight = light->_next; delete light; - } - else - { + } else { nextLight = &light->_next; } light = *nextLight; @@ -83,8 +73,7 @@ void Lights::removeAnimated() } } -void Lights::readVqa(Common::ReadStream *stream) -{ +void Lights::readVqa(Common::ReadStream *stream) { removeAnimated(); if (stream->eos()) return; @@ -93,26 +82,25 @@ void Lights::readVqa(Common::ReadStream *stream) 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 *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; @@ -120,8 +108,7 @@ void Lights::readVqa(Common::ReadStream *stream) } } -void Lights::setupFrame(int frame) -{ +void Lights::setupFrame(int frame) { Light *light; if (frame == _frame) @@ -130,22 +117,19 @@ void Lights::setupFrame(int frame) if (!_lights) return; - for (light = _lights; light; light = light->_next) - { + for (light = _lights; light; light = light->_next) { light->setupFrame(frame); } } -void Lights::reset() -{ +void Lights::reset() { Light *light; Light *nextLight; if (!_lights) return; - do - { + do { light = _lights; nextLight = light->_next; delete light; -- cgit v1.2.3