aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2008-09-10 12:03:42 +0000
committerFilippos Karapetis2008-09-10 12:03:42 +0000
commitf5fecc864f389d061cfadaf93d868e96ca6d4e72 (patch)
tree19c23a1e99860e45823a3d784f4813759ae39572
parent4a2a9f49ca804670e821a072acd9d697845411a0 (diff)
downloadscummvm-rg350-f5fecc864f389d061cfadaf93d868e96ca6d4e72.tar.gz
scummvm-rg350-f5fecc864f389d061cfadaf93d868e96ca6d4e72.tar.bz2
scummvm-rg350-f5fecc864f389d061cfadaf93d868e96ca6d4e72.zip
Merged all the methods to assign and set default palettes
svn-id: r34479
-rw-r--r--engines/drascula/animation.cpp4
-rw-r--r--engines/drascula/drascula.cpp2
-rw-r--r--engines/drascula/drascula.h9
-rw-r--r--engines/drascula/palette.cpp47
-rw-r--r--engines/drascula/rooms.cpp22
5 files changed, 20 insertions, 64 deletions
diff --git a/engines/drascula/animation.cpp b/engines/drascula/animation.cpp
index f9a194707a..65d009f421 100644
--- a/engines/drascula/animation.cpp
+++ b/engines/drascula/animation.cpp
@@ -1523,7 +1523,7 @@ void DrasculaEngine::animation_12_5() {
updateRoom();
updateScreen();
- setDarkPalette();
+ setDefaultPalette(darkPalette);
for (color = 0; color < 255; color++)
for (component = 0; component < 3; component++) {
@@ -1579,7 +1579,7 @@ void DrasculaEngine::animation_12_5() {
animate("frel.bin", 16);
clearRoom();
- setBrightPalette();
+ setDefaultPalette(brightPalette);
setPalette((byte *)&gamePalette);
flags[1] = 1;
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index b81c4bc729..661e0ed816 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -261,7 +261,7 @@ int DrasculaEngine::go() {
for (i = 0; i < 6; i++)
strcpy(iconName[i + 1], _textverbs[i]);
- assignDefaultPalette();
+ assignPalette(defaultPalette);
if (!runCurrentChapter()) {
endChapter();
break;
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 0c820d92c2..c6bc64735d 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -286,7 +286,8 @@ public:
typedef signed char DacPalette256[256][3];
void setRGB(byte *pal, int plt);
- void assignDefaultPalette();
+ void assignPalette(DacPalette256 pal);
+ void setDefaultPalette(DacPalette256 pal);
void setPalette(byte *PalBuf);
void copyBackground(int xorg, int yorg, int xdes, int ydes, int width,
int height, byte *src, byte *dest);
@@ -414,8 +415,6 @@ public:
void openDoor(int nflag, int doorNum);
void showMap();
- void setDarkPalette();
-
void withoutVerb();
void enterRoom(int);
void clearRoom();
@@ -484,11 +483,7 @@ public:
void updateRoom();
bool loadGame(const char *);
void updateDoor(int);
- void setDefaultPalette();
void setPaletteBase(int darkness);
- void assignBrightPalette();
- void assignDarkPalette();
- void setBrightPalette();
void updateVisible();
void startWalking();
void updateRefresh();
diff --git a/engines/drascula/palette.cpp b/engines/drascula/palette.cpp
index 3dd2a779e8..ba174c9237 100644
--- a/engines/drascula/palette.cpp
+++ b/engines/drascula/palette.cpp
@@ -127,64 +127,25 @@ void DrasculaEngine::fadeFromBlack(int fadeSpeed) {
}
}
-void DrasculaEngine::assignDefaultPalette() {
+void DrasculaEngine::assignPalette(DacPalette256 pal) {
int color, component;
for (color = 235; color < 253; color++)
for (component = 0; component < 3; component++)
- defaultPalette[color][component] = gamePalette[color][component];
+ pal[color][component] = gamePalette[color][component];
}
-void DrasculaEngine::assignBrightPalette() {
- int color, component;
-
- for (color = 235; color < 253; color++) {
- for (component = 0; component < 3; component++)
- brightPalette[color][component] = gamePalette[color][component];
- }
-}
-
-void DrasculaEngine::assignDarkPalette() {
- int color, component;
-
- for (color = 235; color < 253; color++) {
- for (component = 0; component < 3; component++)
- darkPalette[color][component] = gamePalette[color][component];
- }
-}
-
-void DrasculaEngine::setDefaultPalette() {
+void DrasculaEngine::setDefaultPalette(DacPalette256 pal) {
int color, component;
for (color = 235; color < 253; color++) {
for (component = 0; component < 3; component++) {
- gamePalette[color][component] = defaultPalette[color][component];
+ gamePalette[color][component] = pal[color][component];
}
}
setPalette((byte *)&gamePalette);
}
-void DrasculaEngine::setBrightPalette() {
- int color, component;
-
- for (color = 235; color < 253; color++) {
- for (component = 0; component < 3; component++)
- gamePalette[color][component] = brightPalette[color][component];
- }
-
- setPalette((byte *)&gamePalette);
-}
-
-void DrasculaEngine::setDarkPalette() {
- int color, component;
-
- for (color = 235; color < 253; color++ )
- for (component = 0; component < 3; component++)
- gamePalette[color][component] = darkPalette[color][component];
-
- setPalette((byte *)&gamePalette);
-}
-
void DrasculaEngine::setPaletteBase(int darkness) {
signed char fade;
unsigned int color, component;
diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp
index f5b87dd7ea..18351ec11a 100644
--- a/engines/drascula/rooms.cpp
+++ b/engines/drascula/rooms.cpp
@@ -1115,10 +1115,10 @@ void DrasculaEngine::updateRefresh_pre() {
void DrasculaEngine::update_1_pre() {
if (curX > 98 && curX < 153) {
changeColor = 1;
- setDarkPalette();
+ setDefaultPalette(darkPalette);
} else {
changeColor = 0;
- setBrightPalette();
+ setDefaultPalette(brightPalette);
}
if (flags[8] == 0)
@@ -1184,10 +1184,10 @@ void DrasculaEngine::update_3() {
void DrasculaEngine::update_4() {
if (curX > 190) {
changeColor = 1;
- setDarkPalette();
+ setDefaultPalette(darkPalette);
} else {
changeColor = 0;
- setBrightPalette();
+ setDefaultPalette(brightPalette);
}
}
@@ -1195,10 +1195,10 @@ void DrasculaEngine::update_6_pre() {
if ((curX > 149 && curY + curHeight > 160 && curX < 220 && curY + curHeight < 188) ||
(curX > 75 && curY + curHeight > 183 && curX < 145)) {
changeColor = 0;
- setBrightPalette();
+ setDefaultPalette(brightPalette);
} else {
changeColor = 1;
- setDarkPalette();
+ setDefaultPalette(darkPalette);
}
}
@@ -1741,15 +1741,15 @@ void DrasculaEngine::enterRoom(int roomIndex) {
copyBackground(0, 171, 0, 0, OBJWIDTH, OBJHEIGHT, backSurface, drawSurface3);
- setDefaultPalette();
+ setDefaultPalette(defaultPalette);
if (palLevel != 0)
setPaletteBase(palLevel);
- assignBrightPalette();
- setDefaultPalette();
+ assignPalette(brightPalette);
+ setDefaultPalette(defaultPalette);
setPaletteBase(palLevel + 2);
- assignDarkPalette();
+ assignPalette(darkPalette);
- setBrightPalette();
+ setDefaultPalette(brightPalette);
changeColor = -1;
if (currentChapter == 2)