SCI: Cleanup of the palette remapping code
This commit is contained in:
parent
6f35130204
commit
fe3fb1873c
4 changed files with 5 additions and 6 deletions
|
@ -1228,7 +1228,6 @@ reg_t kRemapColors(EngineState *s, int argc, reg_t *argv) {
|
|||
switch (operation) {
|
||||
case 0: { // remap by percent
|
||||
uint16 percent = argv[1].toUint16();
|
||||
g_sci->_gfxPalette->toggleRemapping(true);
|
||||
g_sci->_gfxPalette->resetRemapping();
|
||||
g_sci->_gfxPalette->setRemappingPercent(254, percent);
|
||||
}
|
||||
|
@ -1237,7 +1236,6 @@ reg_t kRemapColors(EngineState *s, int argc, reg_t *argv) {
|
|||
uint16 from = argv[1].toUint16();
|
||||
uint16 to = argv[2].toUint16();
|
||||
uint16 base = argv[3].toUint16();
|
||||
g_sci->_gfxPalette->toggleRemapping(true);
|
||||
g_sci->_gfxPalette->resetRemapping();
|
||||
g_sci->_gfxPalette->setRemappingRange(254, from, to, base);
|
||||
}
|
||||
|
|
|
@ -741,7 +741,6 @@ reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv) {
|
|||
int16 base = (argc >= 2) ? argv[1].toSint16() : 0;
|
||||
if (base > 0)
|
||||
warning("kRemapColors(0) called with base %d", base);
|
||||
g_sci->_gfxPalette->toggleRemapping(false);
|
||||
g_sci->_gfxPalette->resetRemapping();
|
||||
}
|
||||
break;
|
||||
|
@ -753,7 +752,6 @@ reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv) {
|
|||
uint16 unk5 = (argc >= 6) ? argv[5].toUint16() : 0;
|
||||
if (unk5 > 0)
|
||||
warning("kRemapColors(1) called with 6 parameters, unknown parameter is %d", unk5);
|
||||
g_sci->_gfxPalette->toggleRemapping(true);
|
||||
g_sci->_gfxPalette->setRemappingRange(color, from, to, base);
|
||||
}
|
||||
break;
|
||||
|
@ -762,7 +760,6 @@ reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv) {
|
|||
uint16 percent = argv[2].toUint16(); // 0 - 100
|
||||
if (argc >= 4)
|
||||
warning("RemapByPercent called with 4 parameters, unknown parameter is %d", argv[3].toUint16());
|
||||
g_sci->_gfxPalette->toggleRemapping(true);
|
||||
g_sci->_gfxPalette->setRemappingPercent(color, percent);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -337,6 +337,7 @@ bool GfxPalette::isRemapMask(byte color) {
|
|||
}
|
||||
|
||||
void GfxPalette::resetRemapping() {
|
||||
_remapOn = false;
|
||||
_remappingMaskFrom = 0;
|
||||
_remappingMaskTo = 0;
|
||||
_remappingPercentToSet = 0;
|
||||
|
@ -347,6 +348,8 @@ void GfxPalette::resetRemapping() {
|
|||
}
|
||||
|
||||
void GfxPalette::setRemappingPercent(byte color, byte percent) {
|
||||
_remapOn = true;
|
||||
|
||||
// We need to defer the setup of the remapping table until something is
|
||||
// shown on screen, otherwise kernelFindColor() won't find correct
|
||||
// colors. The actual setup of the remapping table will be performed in
|
||||
|
@ -360,6 +363,8 @@ void GfxPalette::setRemappingPercent(byte color, byte percent) {
|
|||
}
|
||||
|
||||
void GfxPalette::setRemappingRange(byte color, byte from, byte to, byte base) {
|
||||
_remapOn = true;
|
||||
|
||||
for (int i = from; i <= to; i++) {
|
||||
_remappingTable[i] = i + base;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ public:
|
|||
void getSys(Palette *pal);
|
||||
uint16 getTotalColorCount() const { return _totalScreenColors; }
|
||||
|
||||
void toggleRemapping(bool remap) { _remapOn = remap; }
|
||||
void resetRemapping();
|
||||
void setRemappingPercent(byte color, byte percent);
|
||||
void setRemappingRange(byte color, byte from, byte to, byte base);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue