diff options
-rw-r--r-- | scumm/actor.cpp | 34 | ||||
-rw-r--r-- | scumm/actor.h | 1 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 5 |
3 files changed, 39 insertions, 1 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index 82e2b6613b..4fac4740b2 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -1586,6 +1586,40 @@ byte *Actor::getActorName() { return ptr; } +void Actor::remapActorPaletteColor(int color, int new_color) { + const byte *akos, *akpl; + int akpl_size, i; + byte akpl_color; + + akos = _vm->getResourceAddress(rtCostume, costume); + if (!akos) { + warning("Can't remap actor %d, costume %d not found", number, costume); + return; + } + + akpl = findResource(MKID('AKPL'), akos); + if (!akpl) { + warning("Can't remap actor %d, costume %d doesn't contain an AKPL block", number, costume); + return; + } + + //get num palette entries + akpl_size = RES_SIZE(akpl) - 8; + + //skip resource header + akpl = RES_DATA(akpl); + + for (i = 0; i < akpl_size; i++) { + akpl_color = *akpl++; + if (akpl_color == color) { + palette[i] = new_color; + return; + } + } + + warning("Color %d not found in actor %d", color, number); +} + void Actor::remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold) { const byte *akos, *rgbs, *akpl; int akpl_size, i; diff --git a/scumm/actor.h b/scumm/actor.h index 90e735516e..335efd96ca 100644 --- a/scumm/actor.h +++ b/scumm/actor.h @@ -167,6 +167,7 @@ public: void startAnimActor(int frame); void remapActorPalette(int r_fact, int g_fact, int b_fact, int threshold); + void remapActorPaletteColor(int slot, int color); void animateActor(int anim); diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index e6f8da5f53..2edf01ffbe 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -1705,7 +1705,10 @@ void ScummEngine_v6::o6_actorOps() { j = pop(); i = pop(); checkRange(255, 0, i, "Illegal palette slot %d"); - a->setPalette(i, j); + if (_features & GF_HUMONGOUS) + a->remapActorPaletteColor(i, j); + else + a->setPalette(i, j); break; case 87: // SO_TALK_COLOR a->talkColor = pop(); |