aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/lights.cpp
diff options
context:
space:
mode:
authorPeter Kohaut2016-09-26 23:38:35 +0200
committerEugene Sandulenko2016-09-29 22:33:41 +0200
commitf1cb735ee07c11785f67080ea800a72dd551ae19 (patch)
tree7f67364d748a1091164ecaa98386165a76f78a8f /engines/bladerunner/lights.cpp
parentcfc8ffed8af71714cc6378b412557d5fc03781d4 (diff)
downloadscummvm-rg350-f1cb735ee07c11785f67080ea800a72dd551ae19.tar.gz
scummvm-rg350-f1cb735ee07c11785f67080ea800a72dd551ae19.tar.bz2
scummvm-rg350-f1cb735ee07c11785f67080ea800a72dd551ae19.zip
BLADERUNNER: added rendering support for lighting and effects, but its not working correctly yet
Diffstat (limited to 'engines/bladerunner/lights.cpp')
-rw-r--r--engines/bladerunner/lights.cpp88
1 files changed, 36 insertions, 52 deletions
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;