diff options
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 50 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics32.cpp | 103 | ||||
-rw-r--r-- | engines/sci/engine/kpathing.cpp | 12 | ||||
-rw-r--r-- | engines/sci/engine/kvideo.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cpp | 2 |
5 files changed, 84 insertions, 85 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 8b790e6a58..0b945c1eec 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -254,7 +254,7 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) { } reg_t kGraphGetColorCount(EngineState *s, int argc, reg_t *argv) { - return make_reg(0, g_sci->_gfxPalette->getTotalColorCount()); + return make_reg(0, g_sci->_gfxPalette16->getTotalColorCount()); } reg_t kGraphDrawLine(EngineState *s, int argc, reg_t *argv) { @@ -596,10 +596,10 @@ reg_t kPaletteSetFromResource(EngineState *s, int argc, reg_t *argv) { // Non-VGA games don't use palette resources. // This has been changed to 64 colors because Longbow Amiga does have // one palette (palette 999). - if (g_sci->_gfxPalette->getTotalColorCount() < 64) + if (g_sci->_gfxPalette16->getTotalColorCount() < 64) return s->r_acc; - g_sci->_gfxPalette->kernelSetFromResource(resourceId, force); + g_sci->_gfxPalette16->kernelSetFromResource(resourceId, force); return s->r_acc; } @@ -607,7 +607,7 @@ reg_t kPaletteSetFlag(EngineState *s, int argc, reg_t *argv) { uint16 fromColor = CLIP<uint16>(argv[0].toUint16(), 1, 255); uint16 toColor = CLIP<uint16>(argv[1].toUint16(), 1, 255); uint16 flags = argv[2].toUint16(); - g_sci->_gfxPalette->kernelSetFlag(fromColor, toColor, flags); + g_sci->_gfxPalette16->kernelSetFlag(fromColor, toColor, flags); return s->r_acc; } @@ -615,7 +615,7 @@ reg_t kPaletteUnsetFlag(EngineState *s, int argc, reg_t *argv) { uint16 fromColor = CLIP<uint16>(argv[0].toUint16(), 1, 255); uint16 toColor = CLIP<uint16>(argv[1].toUint16(), 1, 255); uint16 flags = argv[2].toUint16(); - g_sci->_gfxPalette->kernelUnsetFlag(fromColor, toColor, flags); + g_sci->_gfxPalette16->kernelUnsetFlag(fromColor, toColor, flags); return s->r_acc; } @@ -626,10 +626,10 @@ reg_t kPaletteSetIntensity(EngineState *s, int argc, reg_t *argv) { bool setPalette = (argc < 4) ? true : (argv[3].isNull()) ? true : false; // Palette intensity in non-VGA SCI1 games has been removed - if (g_sci->_gfxPalette->getTotalColorCount() < 256) + if (g_sci->_gfxPalette16->getTotalColorCount() < 256) return s->r_acc; - g_sci->_gfxPalette->kernelSetIntensity(fromColor, toColor, intensity, setPalette); + g_sci->_gfxPalette16->kernelSetIntensity(fromColor, toColor, intensity, setPalette); return s->r_acc; } @@ -637,7 +637,7 @@ reg_t kPaletteFindColor(EngineState *s, int argc, reg_t *argv) { uint16 r = argv[0].toUint16(); uint16 g = argv[1].toUint16(); uint16 b = argv[2].toUint16(); - return make_reg(0, g_sci->_gfxPalette->kernelFindColor(r, g, b)); + return make_reg(0, g_sci->_gfxPalette16->kernelFindColor(r, g, b)); } reg_t kPaletteAnimate(EngineState *s, int argc, reg_t *argv) { @@ -645,18 +645,18 @@ reg_t kPaletteAnimate(EngineState *s, int argc, reg_t *argv) { bool paletteChanged = false; // Palette animation in non-VGA SCI1 games has been removed - if (g_sci->_gfxPalette->getTotalColorCount() < 256) + if (g_sci->_gfxPalette16->getTotalColorCount() < 256) return s->r_acc; for (argNr = 0; argNr < argc; argNr += 3) { uint16 fromColor = argv[argNr].toUint16(); uint16 toColor = argv[argNr + 1].toUint16(); int16 speed = argv[argNr + 2].toSint16(); - if (g_sci->_gfxPalette->kernelAnimate(fromColor, toColor, speed)) + if (g_sci->_gfxPalette16->kernelAnimate(fromColor, toColor, speed)) paletteChanged = true; } if (paletteChanged) - g_sci->_gfxPalette->kernelAnimateSet(); + g_sci->_gfxPalette16->kernelAnimateSet(); // WORKAROUND: The game scripts in SQ4 floppy count the number of elapsed // cycles in the intro from the number of successive kAnimate calls during @@ -676,11 +676,11 @@ reg_t kPaletteAnimate(EngineState *s, int argc, reg_t *argv) { } reg_t kPaletteSave(EngineState *s, int argc, reg_t *argv) { - return g_sci->_gfxPalette->kernelSave(); + return g_sci->_gfxPalette16->kernelSave(); } reg_t kPaletteRestore(EngineState *s, int argc, reg_t *argv) { - g_sci->_gfxPalette->kernelRestore(argv[0]); + g_sci->_gfxPalette16->kernelRestore(argv[0]); return argv[0]; } @@ -695,7 +695,7 @@ reg_t kPalVaryInit(EngineState *s, int argc, reg_t *argv) { uint16 ticks = argv[1].toUint16(); uint16 stepStop = argc >= 3 ? argv[2].toUint16() : 64; uint16 direction = argc >= 4 ? argv[3].toUint16() : 1; - if (g_sci->_gfxPalette->kernelPalVaryInit(paletteId, ticks, stepStop, direction)) + if (g_sci->_gfxPalette16->kernelPalVaryInit(paletteId, ticks, stepStop, direction)) return SIGNAL_REG; return NULL_REG; } @@ -705,40 +705,40 @@ reg_t kPalVaryReverse(EngineState *s, int argc, reg_t *argv) { int16 stepStop = argc >= 2 ? argv[1].toUint16() : 0; int16 direction = argc >= 3 ? argv[2].toSint16() : -1; - return make_reg(0, g_sci->_gfxPalette->kernelPalVaryReverse(ticks, stepStop, direction)); + return make_reg(0, g_sci->_gfxPalette16->kernelPalVaryReverse(ticks, stepStop, direction)); } reg_t kPalVaryGetCurrentStep(EngineState *s, int argc, reg_t *argv) { - return make_reg(0, g_sci->_gfxPalette->kernelPalVaryGetCurrentStep()); + return make_reg(0, g_sci->_gfxPalette16->kernelPalVaryGetCurrentStep()); } reg_t kPalVaryDeinit(EngineState *s, int argc, reg_t *argv) { - g_sci->_gfxPalette->kernelPalVaryDeinit(); + g_sci->_gfxPalette16->kernelPalVaryDeinit(); return NULL_REG; } reg_t kPalVaryChangeTarget(EngineState *s, int argc, reg_t *argv) { GuiResourceId paletteId = argv[0].toUint16(); - int16 currentStep = g_sci->_gfxPalette->kernelPalVaryChangeTarget(paletteId); + int16 currentStep = g_sci->_gfxPalette16->kernelPalVaryChangeTarget(paletteId); return make_reg(0, currentStep); } reg_t kPalVaryChangeTicks(EngineState *s, int argc, reg_t *argv) { uint16 ticks = argv[0].toUint16(); - g_sci->_gfxPalette->kernelPalVaryChangeTicks(ticks); + g_sci->_gfxPalette16->kernelPalVaryChangeTicks(ticks); return NULL_REG; } reg_t kPalVaryPauseResume(EngineState *s, int argc, reg_t *argv) { bool pauseState = !argv[0].isNull(); - g_sci->_gfxPalette->kernelPalVaryPause(pauseState); + g_sci->_gfxPalette16->kernelPalVaryPause(pauseState); return NULL_REG; } reg_t kAssertPalette(EngineState *s, int argc, reg_t *argv) { GuiResourceId paletteId = argv[0].toUint16(); - g_sci->_gfxPalette->kernelAssertPalette(paletteId); + g_sci->_gfxPalette16->kernelAssertPalette(paletteId); return s->r_acc; } @@ -1253,16 +1253,16 @@ 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->resetRemapping(); - g_sci->_gfxPalette->setRemappingPercent(254, percent); + g_sci->_gfxPalette16->resetRemapping(); + g_sci->_gfxPalette16->setRemappingPercent(254, percent); } break; case 1: { // remap by range uint16 from = argv[1].toUint16(); uint16 to = argv[2].toUint16(); uint16 base = argv[3].toUint16(); - g_sci->_gfxPalette->resetRemapping(); - g_sci->_gfxPalette->setRemappingRange(254, from, to, base); + g_sci->_gfxPalette16->resetRemapping(); + g_sci->_gfxPalette16->setRemappingRange(254, from, to, base); } break; case 2: // turn remapping off (unused) diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp index 8953f45266..5de440c536 100644 --- a/engines/sci/engine/kgraphics32.cpp +++ b/engines/sci/engine/kgraphics32.cpp @@ -49,6 +49,7 @@ #include "sci/graphics/text16.h" #include "sci/graphics/view.h" #ifdef ENABLE_SCI32 +#include "sci/graphics/palette32.h" #include "sci/graphics/controls32.h" #include "sci/graphics/font.h" // TODO: remove once kBitmap is moved in a separate class #include "sci/graphics/text32.h" @@ -707,66 +708,64 @@ reg_t kPalVaryUnknown2(EngineState *s, int argc, reg_t *argv) { return kStub(s, argc, argv); } +enum { + kSetCycle = 0, + kDoCycle = 1, + kCyclePause = 2, + kCycleOn = 3, + kCycleOff = 4 +}; + reg_t kPalCycle(EngineState *s, int argc, reg_t *argv) { // Examples: GK1 room 480 (Bayou ritual), LSL6 room 100 (title screen) switch (argv[0].toUint16()) { - case 0: { // Palette animation initialization - // 3 or 4 extra params - // Case 1 sends fromColor and speed again, so we don't need them here. - // Only toColor is stored - //uint16 fromColor = argv[1].toUint16(); - s->_palCycleToColor = argv[2].toUint16(); - //uint16 speed = argv[3].toUint16(); - - // Invalidate the picture, so that the palette steps calls (case 1 - // below) can update its palette without it being overwritten by the - // view/picture palettes. - g_sci->_gfxScreen->_picNotValid = 1; - - // TODO: The fourth optional parameter is an unknown integer, and is 0 by default - if (argc == 5) { - // When this variant is used, picNotValid doesn't seem to be set - // (e.g. GK1 room 480). In this case, the animation step calls are - // not made, so perhaps this signifies the palette cycling steps - // to make. - // GK1 sets this to 6 (6 palette steps?) - g_sci->_gfxScreen->_picNotValid = 0; - } - kStub(s, argc, argv); + case kSetCycle: { + uint16 fromColor = argv[1].toUint16(); + uint16 toColor = argv[2].toUint16(); + int16 direction = argv[3].toSint16(); + uint16 delay = (argc == 4 ? 0 : argv[4].toUint16()); + + g_sci->_gfxPalette32->setCycle(fromColor, toColor, direction, delay); } break; - case 1: { // Palette animation step - // This is the same as the old kPaletteAnimate call, with 1 set of colors. - // The end color is set up during initialization in case 0 above. - - // 1 or 2 extra params + case kDoCycle: { uint16 fromColor = argv[1].toUint16(); - uint16 speed = (argc == 2) ? 1 : argv[2].toUint16(); - // TODO: For some reason, this doesn't set the color correctly - // (e.g. LSL6 intro, room 100, Sierra logo) - if (g_sci->_gfxPalette->kernelAnimate(fromColor, s->_palCycleToColor, speed)) - g_sci->_gfxPalette->kernelAnimateSet(); + int16 speed = (argc == 2) ? 1 : argv[2].toSint16(); + g_sci->_gfxPalette32->doCycle(fromColor, speed); } - // No kStub() call here, as this gets called loads of times, like kPaletteAnimate break; - // case 2 hasn't been encountered - // case 3 hasn't been encountered - case 4: // reset any palette cycling and make the picture valid again - // Gets called when changing rooms and after palette cycling animations finish - // 0 or 1 extra params + case kCyclePause: { if (argc == 1) { - g_sci->_gfxScreen->_picNotValid = 0; - // TODO: This also seems to perform more steps + g_sci->_gfxPalette32->cycleAllPause(); } else { - // The variant with the 1 extra param resets remapping to base - // TODO + uint16 fromColor = argv[1].toUint16(); + g_sci->_gfxPalette32->cyclePause(fromColor); + } + } + break; + case kCycleOn: { + if (argc == 1) { + g_sci->_gfxPalette32->cycleAllOn(); + } else { + uint16 fromColor = argv[1].toUint16(); + g_sci->_gfxPalette32->cycleOn(fromColor); + } + } + break; + case kCycleOff: { + if (argc == 1) { + g_sci->_gfxPalette32->cycleAllOff(); + } else { + uint16 fromColor = argv[1].toUint16(); + g_sci->_gfxPalette32->cycleOff(fromColor); } - kStub(s, argc, argv); break; + } default: - // TODO - kStub(s, argc, argv); + // In SCI2.1 there are no values above 4, so should never get here; + // SCI just returns early if this ever happens. + assert(false); break; } @@ -787,7 +786,7 @@ 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->resetRemapping(); + g_sci->_gfxPalette32->resetRemapping(); } break; case 1: { // remap by range @@ -798,7 +797,7 @@ 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->setRemappingRange(color, from, to, base); + g_sci->_gfxPalette32->setRemappingRange(color, from, to, base); } break; case 2: { // remap by percent @@ -806,7 +805,7 @@ 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->setRemappingPercent(color, percent); + g_sci->_gfxPalette32->setRemappingPercent(color, percent); } break; case 3: { // remap to gray @@ -816,7 +815,7 @@ reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv) { int16 percent = argv[2].toSint16(); // 0 - 100 if (argc >= 4) warning("RemapToGray called with 4 parameters, unknown parameter is %d", argv[3].toUint16()); - g_sci->_gfxPalette->setRemappingPercentGray(color, percent); + g_sci->_gfxPalette32->setRemappingPercentGray(color, percent); } break; case 4: { // remap to percent gray @@ -826,7 +825,7 @@ reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv) { // argv[3] is unknown (a number, e.g. 200) - start color, perhaps? if (argc >= 5) warning("RemapToGrayPercent called with 5 parameters, unknown parameter is %d", argv[4].toUint16()); - g_sci->_gfxPalette->setRemappingPercentGray(color, percent); + g_sci->_gfxPalette32->setRemappingPercentGray(color, percent); } break; case 5: { // don't map to range @@ -834,7 +833,7 @@ reg_t kRemapColors32(EngineState *s, int argc, reg_t *argv) { uint16 intensity = argv[2].toUint16(); // HACK for PQ4 if (g_sci->getGameId() == GID_PQ4) - g_sci->_gfxPalette->kernelSetIntensity(0, 255, intensity, true); + g_sci->_gfxPalette32->kernelSetIntensity(0, 255, intensity, true); kStub(s, argc, argv); } diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp index 67d814b86f..5b2245e84d 100644 --- a/engines/sci/engine/kpathing.cpp +++ b/engines/sci/engine/kpathing.cpp @@ -312,10 +312,10 @@ static void draw_line(EngineState *s, Common::Point p1, Common::Point p2, int ty // Red : Barred access // Yellow: Contained access int poly_colors[4] = { - g_sci->_gfxPalette->kernelFindColor(0, 255, 0), // green - g_sci->_gfxPalette->kernelFindColor(0, 0, 255), // blue - g_sci->_gfxPalette->kernelFindColor(255, 0, 0), // red - g_sci->_gfxPalette->kernelFindColor(255, 255, 0) // yellow + g_sci->_gfxPalette16->kernelFindColor(0, 255, 0), // green + g_sci->_gfxPalette16->kernelFindColor(0, 0, 255), // blue + g_sci->_gfxPalette16->kernelFindColor(255, 0, 0), // red + g_sci->_gfxPalette16->kernelFindColor(255, 255, 0) // yellow }; // Clip @@ -334,8 +334,8 @@ static void draw_point(EngineState *s, Common::Point p, int start, int width, in // Green: End point // Blue: Starting point int point_colors[2] = { - g_sci->_gfxPalette->kernelFindColor(0, 255, 0), // green - g_sci->_gfxPalette->kernelFindColor(0, 0, 255) // blue + g_sci->_gfxPalette16->kernelFindColor(0, 255, 0), // green + g_sci->_gfxPalette16->kernelFindColor(0, 0, 255) // blue }; Common::Rect rect = Common::Rect(p.x - 1, p.y - 1, p.x - 1 + 3, p.y - 1 + 3); diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp index 6920466711..8db0c542eb 100644 --- a/engines/sci/engine/kvideo.cpp +++ b/engines/sci/engine/kvideo.cpp @@ -231,7 +231,7 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) { initGraphics(screenWidth, screenHeight, screenWidth > 320); else { g_sci->_gfxScreen->kernelSyncWithFramebuffer(); - g_sci->_gfxPalette->kernelSyncScreenPalette(); + g_sci->_gfxPalette16->kernelSyncScreenPalette(); } } diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index b464d347bd..09ccff39ac 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -304,7 +304,7 @@ void EngineState::saveLoadWithSerializer(Common::Serializer &s) { _segMan->saveLoadWithSerializer(s); g_sci->_soundCmd->syncPlayList(s); - g_sci->_gfxPalette->saveLoadWithSerializer(s); + g_sci->_gfxPalette16->saveLoadWithSerializer(s); } void Vocabulary::saveLoadWithSerializer(Common::Serializer &s) { |