aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-08-19 17:23:48 +0000
committerMax Horn2002-08-19 17:23:48 +0000
commita5b5b23ae8f28925609208a45af147cf0d8b90f8 (patch)
tree313dd1a5e3ab3437eca7ca52c158880e484f5958
parentbe528b93dabe8f595dd179bc3e39d0a8460ad6d1 (diff)
downloadscummvm-rg350-a5b5b23ae8f28925609208a45af147cf0d8b90f8.tar.gz
scummvm-rg350-a5b5b23ae8f28925609208a45af147cf0d8b90f8.tar.bz2
scummvm-rg350-a5b5b23ae8f28925609208a45af147cf0d8b90f8.zip
added lights support to the costume renderer; begun work on flashlight support (no real code yet :-)
svn-id: r4774
-rw-r--r--actor.cpp2
-rw-r--r--actor.h2
-rw-r--r--costume.cpp10
-rw-r--r--gfx.cpp10
-rw-r--r--script_v1.cpp8
-rw-r--r--script_v2.cpp4
-rw-r--r--scumm.h7
-rw-r--r--scummvm.cpp2
8 files changed, 30 insertions, 15 deletions
diff --git a/actor.cpp b/actor.cpp
index 363bf0ef1f..697a1cdadf 100644
--- a/actor.cpp
+++ b/actor.cpp
@@ -1308,7 +1308,7 @@ byte *Actor::getActorName()
return ptr;
}
-void Actor::remapActor(int r_fact, int g_fact, int b_fact, int threshold)
+void Actor::remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold)
{
byte *akos, *rgbs, *akpl;
int akpl_size, i;
diff --git a/actor.h b/actor.h
index 2297528845..d0b3ba8d35 100644
--- a/actor.h
+++ b/actor.h
@@ -151,7 +151,7 @@ public:
byte *getActorName();
void startWalkActor(int x, int y, int dir);
- void remapActor(int b, int c, int d, int e);
+ void remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold);
void walkActorOld();
void animateActor(int anim);
diff --git a/costume.cpp b/costume.cpp
index 348556b974..98a8257fb1 100644
--- a/costume.cpp
+++ b/costume.cpp
@@ -1349,9 +1349,13 @@ void CostumeRenderer::setPalette(byte *palette)
byte color;
for (i = 0; i < _loaded._numColors; i++) {
- color = palette[i];
- if (color == 255)
- color = _loaded._ptr[8 + i];
+ if (_vm->_vars[_vm->VAR_CURRENT_LIGHTS] & LIGHTMODE_actor_color) {
+ color = palette[i];
+ if (color == 255)
+ color = _loaded._ptr[8 + i];
+ } else {
+ color = (i == 12) ? 0 : 8;
+ }
_palette[i] = color;
}
}
diff --git a/gfx.cpp b/gfx.cpp
index aecdfa79ac..94fbc8af5e 100644
--- a/gfx.cpp
+++ b/gfx.cpp
@@ -581,6 +581,10 @@ void Scumm::moveMemInPalRes(int start, int end, byte direction)
}
}
+void Scumm::drawFlashlight()
+{
+}
+
void Scumm::fadeIn(int effect)
{
switch (effect) {
@@ -2602,11 +2606,11 @@ int Scumm::remapPaletteColor(int r, int g, int b, uint threshold)
if (ar == r && ag == g && ab == b)
return i;
- j = abs(ar - r);
+ j = ar - r;
sum = j * j * 3;
- j = abs(ag - g);
+ j = ag - g;
sum += j * j * 6;
- j = abs(ab - b);
+ j = ab - b;
sum += j * j * 2;
if (sum < bestsum) {
diff --git a/script_v1.cpp b/script_v1.cpp
index 205dabc978..3ad7289798 100644
--- a/script_v1.cpp
+++ b/script_v1.cpp
@@ -1547,11 +1547,11 @@ void Scumm::o5_lights()
warning("o5_lights(%d,%d,%d): lights not implemented", a, b, c);
- if (c==0)
+ if (c == 0)
_vars[VAR_CURRENT_LIGHTS] = a;
- else if (c==1) {
- //LightDx = a;
- //LightDy = b;
+ else if (c == 1) {
+ _lightDx = a;
+ _lightDy = b;
}
_fullRedraw = 1;
}
diff --git a/script_v2.cpp b/script_v2.cpp
index 6e6cca5df3..e402495943 100644
--- a/script_v2.cpp
+++ b/script_v2.cpp
@@ -2726,10 +2726,10 @@ void Scumm::o6_miscOps()
setCursorImg(args[1], (uint) - 1, args[2]);
break;
case 13:
- derefActorSafe(args[1], "o6_miscOps:14")->remapActor(args[2], args[3], args[4], -1);
+ derefActorSafe(args[1], "o6_miscOps:14")->remapActorPalette(args[2], args[3], args[4], -1);
break;
case 14:
- derefActorSafe(args[1], "o6_miscOps:14")->remapActor(args[2], args[3], args[4], args[5]);
+ derefActorSafe(args[1], "o6_miscOps:14")->remapActorPalette(args[2], args[3], args[4], args[5]);
break;
case 15:
_insaneFlag = args[1];
diff --git a/scumm.h b/scumm.h
index a2eb2012c5..4261c7b8aa 100644
--- a/scumm.h
+++ b/scumm.h
@@ -754,6 +754,8 @@ public:
byte _newEffect, _switchRoomEffect2, _switchRoomEffect;
bool _doEffect;
+
+ uint16 _lightDx, _lightDy;
void getGraphicsPerformance();
void initScreens(int a, int b, int w, int h);
@@ -818,10 +820,13 @@ public:
void updateDirtyScreen(int slot);
VirtScreen *findVirtScreen(int y);
- void fadeOut(int a);
static void setVirtscreenDirty(VirtScreen *vs, int left, int top, int right, int bottom);
+ void drawFlashlight();
+
void fadeIn(int effect);
+ void fadeOut(int effect);
+
void unkScreenEffect1();
void unkScreenEffect2();
void unkScreenEffect3();
diff --git a/scummvm.cpp b/scummvm.cpp
index 419fc07c8c..d9275900ba 100644
--- a/scummvm.cpp
+++ b/scummvm.cpp
@@ -442,6 +442,8 @@ int Scumm::scummLoop(int delta)
if (!(_vars[VAR_CURRENT_LIGHTS] & LIGHTMODE_screen) &&
_vars[VAR_CURRENT_LIGHTS] & LIGHTMODE_flashlight) {
warning("Flashlight not implemented in this version");
+ drawFlashlight();
+ setActorRedrawFlags();
}
processActors();