Add correct actor palette color changing for HE games.

svn-id: r12419
This commit is contained in:
Travis Howell 2004-01-16 01:52:49 +00:00
parent 34e1dca97e
commit 555caf2251
3 changed files with 39 additions and 1 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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();