diff options
author | Travis Howell | 2004-01-16 01:52:49 +0000 |
---|---|---|
committer | Travis Howell | 2004-01-16 01:52:49 +0000 |
commit | 555caf225131389d878ba35f484b00bb1d1ba2f1 (patch) | |
tree | 3c27be5ffd678e9e92e4aa445d2d183e3268d06f /scumm/actor.cpp | |
parent | 34e1dca97e246e73742c0107b88600c7fed9ccac (diff) | |
download | scummvm-rg350-555caf225131389d878ba35f484b00bb1d1ba2f1.tar.gz scummvm-rg350-555caf225131389d878ba35f484b00bb1d1ba2f1.tar.bz2 scummvm-rg350-555caf225131389d878ba35f484b00bb1d1ba2f1.zip |
Add correct actor palette color changing for HE games.
svn-id: r12419
Diffstat (limited to 'scumm/actor.cpp')
-rw-r--r-- | scumm/actor.cpp | 34 |
1 files changed, 34 insertions, 0 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; |