SCI32: Update kSetShowStyle version checks for Mac

Consolidated kSetShowStyle version/argument checks and updated them to
handle SCI2.1 Mac games and PC demos. (The demos where the wrong
arguments were being applied happened to work anyway.)

Fixes LSL7 Mac pixel dissolve at the start of the game between the
postcard and the boat (rooms 120 and 130)
This commit is contained in:
sluicebox 2022-03-22 07:20:21 -04:00
parent 8558276dd9
commit e23f5fe855
4 changed files with 20 additions and 32 deletions

View File

@ -142,8 +142,8 @@ enum SciVersion {
SCI_VERSION_2, // GK1, PQ4 floppy, QFG4 floppy
SCI_VERSION_2_1_EARLY, // GK2 demo, KQ7 1.4/1.51, LSL6 hires, PQ4CD, QFG4CD
SCI_VERSION_2_1_MIDDLE, // GK2, Hoyle 5, KQ7 2.00b, MUMG Deluxe, Phantasmagoria 1, PQ:SWAT, Shivers 1, SQ6, Torin
SCI_VERSION_2_1_LATE, // demos and Mac versions of LSL7, Lighthouse, RAMA
SCI_VERSION_3 // LSL7, Lighthouse, RAMA, Phantasmagoria 2
SCI_VERSION_2_1_LATE, // Demos and Mac versions of LSL7, Lighthouse, RAMA
SCI_VERSION_3 // LSL7, Lighthouse, RAMA, Phantasmagoria 2, interactive Lighthouse demos
};
/** MIDI devices */

View File

@ -396,18 +396,23 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
int16 divisions;
// SCI 22.1early
if (getSciVersion() < SCI_VERSION_2_1_MIDDLE) {
// KQ7 2.0b uses a mismatched version of the Styler script (SCI2.1early script
// for SCI2.1mid engine), so the calls it makes to kSetShowStyle are wrong and
// put `divisions` where `pFadeArray` is supposed to be.
if (getSciVersion() <= SCI_VERSION_1_EARLY || g_sci->getGameId() == GID_KQ7) {
blackScreen = 0;
pFadeArray = NULL_REG;
divisions = argc > 7 ? argv[7].toSint16() : -1;
}
// SCI 2.1mid
else if (getSciVersion() < SCI_VERSION_2_1_LATE) {
// SCI 2.1mid and RAMA demo (2.1late) and noninteractive Lighthouse demo (2.1late)
else if (getSciVersion() <= SCI_VERSION_2_1_MIDDLE ||
(g_sci->getGameId() == GID_RAMA && g_sci->isDemo()) ||
(g_sci->getGameId() == GID_LIGHTHOUSE && g_sci->isDemo() && getSciVersion() == SCI_VERSION_2_1_LATE)) {
blackScreen = 0;
pFadeArray = argc > 7 ? argv[7] : NULL_REG;
divisions = argc > 8 ? argv[8].toSint16() : -1;
}
// SCI 2.1late-3
// SCI 2.1late-3. Includes Mac 2.1late games and LSL7 demo (2.1late)
else {
blackScreen = argv[7].toSint16();
pFadeArray = argc > 8 ? argv[8] : NULL_REG;
@ -420,7 +425,7 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
// The order of planeObj and showStyle are reversed because this is how
// SSCI3 called the corresponding method on the KernelMgr
g_sci->_gfxTransitions32->kernelSetShowStyle(argc, planeObj, (ShowStyleType)type, seconds, back, priority, animate, refFrame, pFadeArray, divisions, blackScreen);
g_sci->_gfxTransitions32->kernelSetShowStyle(planeObj, (ShowStyleType)type, seconds, back, priority, animate, refFrame, pFadeArray, divisions, blackScreen);
return s->r_acc;
}

View File

@ -173,31 +173,12 @@ void GfxTransitions32::processEffects(PlaneShowStyle &showStyle) {
}
}
// TODO: 10-argument version is only in SCI3; argc checks are currently wrong for this version
// and need to be fixed in future
void GfxTransitions32::kernelSetShowStyle(const uint16 argc, const reg_t planeObj, const ShowStyleType type, const int16 seconds, const int16 back, const int16 priority, const int16 animate, const int16 frameOutNow, reg_t pFadeArray, int16 divisions, const int16 blackScreen) {
void GfxTransitions32::kernelSetShowStyle(const reg_t planeObj, const ShowStyleType type, const int16 seconds,
const int16 back, const int16 priority, const int16 animate, const int16 frameOutNow,
const reg_t pFadeArray, const int16 divisions, const int16 blackScreen) {
bool hasDivisions = false;
bool hasFadeArray = false;
// KQ7 2.0b uses a mismatched version of the Styler script (SCI2.1early script
// for SCI2.1mid engine), so the calls it makes to kSetShowStyle are wrong and
// put `divisions` where `pFadeArray` is supposed to be
if (getSciVersion() == SCI_VERSION_2_1_MIDDLE && g_sci->getGameId() == GID_KQ7) {
hasDivisions = argc > 7;
hasFadeArray = false;
divisions = argc > 7 ? pFadeArray.toSint16() : -1;
pFadeArray = NULL_REG;
} else if (getSciVersion() < SCI_VERSION_2_1_MIDDLE) {
hasDivisions = argc > 7;
hasFadeArray = false;
} else if (getSciVersion() < SCI_VERSION_3) {
hasDivisions = argc > 8;
hasFadeArray = argc > 7;
} else {
hasDivisions = argc > 9;
hasFadeArray = argc > 8;
}
const bool hasFadeArray = !pFadeArray.isNull();
const bool hasDivisions = (divisions != -1);
bool isFadeUp;
int16 color;

View File

@ -256,7 +256,9 @@ public:
*/
void processEffects(PlaneShowStyle &showStyle);
void kernelSetShowStyle(const uint16 argc, const reg_t planeObj, const ShowStyleType type, const int16 seconds, const int16 direction, const int16 priority, const int16 animate, const int16 frameOutNow, reg_t pFadeArray, int16 divisions, const int16 blackScreen);
void kernelSetShowStyle(const reg_t planeObj, const ShowStyleType type, const int16 seconds,
const int16 direction, const int16 priority, const int16 animate, const int16 frameOutNow,
const reg_t pFadeArray, const int16 divisions, const int16 blackScreen);
/**
* Sets the range that will be used by `GfxFrameout::palMorphFrameOut` to