diff options
Diffstat (limited to 'saga')
-rw-r--r-- | saga/animation.cpp | 2 | ||||
-rw-r--r-- | saga/events.cpp | 25 | ||||
-rw-r--r-- | saga/gfx.cpp | 35 | ||||
-rw-r--r-- | saga/gfx.h | 6 | ||||
-rw-r--r-- | saga/scene.cpp | 10 |
5 files changed, 42 insertions, 36 deletions
diff --git a/saga/animation.cpp b/saga/animation.cpp index f936922ec4..2ac8d27bfe 100644 --- a/saga/animation.cpp +++ b/saga/animation.cpp @@ -114,7 +114,7 @@ void Anim::playCutaway(int cut, bool fade) { const Rect rect(width, height); bgSurface->blit(rect, buf); - _vm->_gfx->setPalette(palette, 0, 248); + _vm->_gfx->setPalette(palette); free(buf); free(resourceData); diff --git a/saga/events.cpp b/saga/events.cpp index 85ba125910..457051e35a 100644 --- a/saga/events.cpp +++ b/saga/events.cpp @@ -149,17 +149,11 @@ int Events::handleContinuous(Event *event) { case kPalEvent: switch (event->op) { case kEventBlackToPal: - if (_vm->getGameType() == GType_IHNM) - _vm->_gfx->blackToPal((PalEntry *)event->data, event_pc, 0, 248); - else - _vm->_gfx->blackToPal((PalEntry *)event->data, event_pc); + _vm->_gfx->blackToPal((PalEntry *)event->data, event_pc); break; case kEventPalToBlack: - if (_vm->getGameType() == GType_IHNM) - _vm->_gfx->palToBlack((PalEntry *)event->data, event_pc, 0, 248); - else - _vm->_gfx->palToBlack((PalEntry *)event->data, event_pc); + _vm->_gfx->palToBlack((PalEntry *)event->data, event_pc); break; default: break; @@ -238,17 +232,11 @@ int Events::handleImmediate(Event *event) { case kPalEvent: switch (event->op) { case kEventBlackToPal: - if (_vm->getGameType() == GType_IHNM) - _vm->_gfx->blackToPal((PalEntry *)event->data, event_pc, 0, 248); - else - _vm->_gfx->blackToPal((PalEntry *)event->data, event_pc); + _vm->_gfx->blackToPal((PalEntry *)event->data, event_pc); break; case kEventPalToBlack: - if (_vm->getGameType() == GType_IHNM) - _vm->_gfx->palToBlack((PalEntry *)event->data, event_pc, 0, 248); - else - _vm->_gfx->palToBlack((PalEntry *)event->data, event_pc); + _vm->_gfx->palToBlack((PalEntry *)event->data, event_pc); break; default: break; @@ -344,10 +332,7 @@ int Events::handleOneShot(Event *event) { if (event->param == kEvPSetPalette) { PalEntry *palPointer; _vm->_scene->getBGPal(palPointer); - if (_vm->getGameType() == GType_IHNM) - _vm->_gfx->setPalette(palPointer, 0, 248); - else - _vm->_gfx->setPalette(palPointer); + _vm->_gfx->setPalette(palPointer); } } } diff --git a/saga/gfx.cpp b/saga/gfx.cpp index 3cb68e1437..cdad674972 100644 --- a/saga/gfx.cpp +++ b/saga/gfx.cpp @@ -191,12 +191,21 @@ void Gfx::initPalette() { free(resourcePointer); - setPalette(_globalPalette, 0, 256); + setPalette(_globalPalette, true); } -void Gfx::setPalette(const PalEntry *pal, int from, int numcolors) { +void Gfx::setPalette(const PalEntry *pal, bool full) { int i; byte *ppal; + int from, numcolors; + + if (_vm->getGameType() != GType_IHNM || full) { + from = 0; + numcolors = PAL_ENTRIES; + } else { + from = 0; + numcolors = 248; + } for (i = 0, ppal = &_currentPal[from * 4]; i < numcolors; i++, ppal += 4) { ppal[0] = _globalPalette[i].red = pal[i].red; @@ -250,15 +259,24 @@ void Gfx::getCurrentPal(PalEntry *src_pal) { } } -void Gfx::palToBlack(PalEntry *srcPal, double percent, int from, int numcolors) { +void Gfx::palToBlack(PalEntry *srcPal, double percent) { int i; //int fade_max = 255; int new_entry; byte *ppal; PalEntry *palE; + int from, numcolors; double fpercent; + if (_vm->getGameType() != GType_IHNM) { + from = 0; + numcolors = PAL_ENTRIES; + } else { + from = 0; + numcolors = 248; + } + if (percent > 1.0) { percent = 1.0; } @@ -308,12 +326,21 @@ void Gfx::palToBlack(PalEntry *srcPal, double percent, int from, int numcolors) _system->setPalette(_currentPal, 0, PAL_ENTRIES); } -void Gfx::blackToPal(PalEntry *srcPal, double percent, int from, int numcolors) { +void Gfx::blackToPal(PalEntry *srcPal, double percent) { int new_entry; double fpercent; byte *ppal; int i; PalEntry *palE; + int from, numcolors; + + if (_vm->getGameType() != GType_IHNM) { + from = 0; + numcolors = PAL_ENTRIES; + } else { + from = 0; + numcolors = 248; + } if (percent > 1.0) { percent = 1.0; diff --git a/saga/gfx.h b/saga/gfx.h index 5a4a96bb67..0a836da1a1 100644 --- a/saga/gfx.h +++ b/saga/gfx.h @@ -135,11 +135,11 @@ public: } void initPalette(); - void setPalette(const PalEntry *pal, int from = 0, int numcolors = PAL_ENTRIES); + void setPalette(const PalEntry *pal, bool full = false); void setPaletteColor(int n, int r, int g, int b); void getCurrentPal(PalEntry *src_pal); - void palToBlack(PalEntry *src_pal, double percent, int from = 0, int numcolors = PAL_ENTRIES); - void blackToPal(PalEntry *src_pal, double percent, int from = 0, int numcolors = PAL_ENTRIES); + void palToBlack(PalEntry *src_pal, double percent); + void blackToPal(PalEntry *src_pal, double percent); void updateCursor() { setCursor(); } void showCursor(bool state); diff --git a/saga/scene.cpp b/saga/scene.cpp index 0ce7ee17ac..dd58ba67cb 100644 --- a/saga/scene.cpp +++ b/saga/scene.cpp @@ -447,10 +447,7 @@ void Scene::changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionTy cPal[j].blue = *pal++; } free(colors); - if (_vm->getGameType() == GType_IHNM) - _vm->_gfx->setPalette(cPal, 0, 248); - else - _vm->_gfx->setPalette(cPal); + _vm->_gfx->setPalette(cPal); } @@ -1135,10 +1132,7 @@ void Scene::processSceneResources() { pal[c].green = *palPtr++; pal[c].blue = *palPtr++; } - if (_vm->getGameType() == GType_IHNM) - _vm->_gfx->setPalette(pal, 0, 248); - else - _vm->_gfx->setPalette(pal); + _vm->_gfx->setPalette(pal); } break; default: |