SCI32: Fix support for RAMA demo

Fixes Trac#10251.
This commit is contained in:
Colin Snover 2017-09-30 00:03:05 -05:00
parent dc7e37fdb6
commit b2966f3fc8
7 changed files with 25 additions and 14 deletions

View File

@ -480,11 +480,12 @@ bool GameFeatures::autoDetectSci21KernelType() {
// don't have sounds at all, but they're using a SCI2 kernel
if (g_sci->getGameId() == GID_CHEST || g_sci->getGameId() == GID_KQUESTIONS) {
_sci21KernelType = SCI_VERSION_2;
return true;
} else if (g_sci->getGameId() == GID_RAMA && g_sci->isDemo()) {
_sci21KernelType = SCI_VERSION_2_1_MIDDLE;
} else {
warning("autoDetectSci21KernelType(): Sound object not loaded, assuming a SCI2.1 table");
_sci21KernelType = SCI_VERSION_2_1_EARLY;
}
warning("autoDetectSci21KernelType(): Sound object not loaded, assuming a SCI2.1 table");
_sci21KernelType = SCI_VERSION_2_1_EARLY;
return true;
}

View File

@ -163,7 +163,7 @@ void GuestAdditions::writeVarHook(const int type, const int index, const reg_t v
syncAudioVolumeGlobalsToScummVM(index, value);
} else if (g_sci->getGameId() == GID_GK1) {
syncGK1StartupVolumeFromScummVM(index, value);
} else if (g_sci->getGameId() == GID_RAMA && index == kGlobalVarRamaMusicVolume) {
} else if (g_sci->getGameId() == GID_RAMA && !g_sci->isDemo() && index == kGlobalVarRamaMusicVolume) {
syncRamaVolumeFromScummVM((ConfMan.getInt("music_volume") + 1) * kRamaVolumeMax / Audio::Mixer::kMaxMixerVolume);
}

View File

@ -73,6 +73,7 @@ struct SciKernelMapSubEntry {
#define SIG_SINCE_SCI21 SCI_VERSION_2_1_EARLY, SCI_VERSION_3
#define SIG_SINCE_SCI21MID SCI_VERSION_2_1_MIDDLE, SCI_VERSION_3
#define SIG_SINCE_SCI21LATE SCI_VERSION_2_1_LATE, SCI_VERSION_3
#define SIG_SCI21LATE SCI_VERSION_2_1_LATE, SCI_VERSION_2_1_LATE
#define SIG_SCI3 SCI_VERSION_3, SCI_VERSION_3
#define SIG_SCI16 SCI_VERSION_NONE, SCI_VERSION_1_1
@ -898,7 +899,8 @@ static SciKernelMapEntry s_kernelMap[] = {
// our garbage collector (i.e. the SCI0-SCI1.1 semantics).
{ "Purge", kFlushResources, SIG_EVERYWHERE, "i", NULL, NULL },
{ MAP_CALL(SetShowStyle), SIG_THRU_SCI21MID, SIGFOR_ALL, "ioiiiii([ri])(i)", NULL, NULL },
{ MAP_CALL(SetShowStyle), SIG_SINCE_SCI21LATE, SIGFOR_ALL, "ioiiiiii(r)(i)", NULL, NULL },
{ MAP_CALL(SetShowStyle), SIG_SCI21LATE, SIGFOR_ALL, "ioiiiii([ri])([ri])(i)", NULL, NULL },
{ MAP_CALL(SetShowStyle), SIG_SCI3, SIGFOR_ALL, "ioiiiiii(r)(i)", NULL, NULL },
{ MAP_CALL(String), SIG_EVERYWHERE, "(.*)", kString_subops, NULL },
{ MAP_CALL(UpdatePlane), SIG_EVERYWHERE, "o", NULL, NULL },
{ MAP_CALL(UpdateScreenItem), SIG_EVERYWHERE, "o", NULL, NULL },

View File

@ -76,7 +76,7 @@ reg_t kBaseSetter32(EngineState *s, int argc, reg_t *argv) {
CelObjView celObj(viewId, loopNo, celNo);
Ratio scaleX;
if (getSciVersion() < SCI_VERSION_3) {
if (getSciVersion() < SCI_VERSION_2_1_LATE) {
const int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth;
scaleX = Ratio(scriptWidth, celObj._xResolution);
}
@ -418,7 +418,7 @@ reg_t kCelHigh32(EngineState *s, int argc, reg_t *argv) {
int16 celNo = argv[2].toSint16();
CelObjView celObj(resourceId, loopNo, celNo);
int16 height = celObj._height;
if (getSciVersion() < SCI_VERSION_3) {
if (getSciVersion() < SCI_VERSION_2_1_LATE) {
height = mulru(height, Ratio(g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight, celObj._yResolution));
}
return make_reg(0, height);
@ -430,7 +430,7 @@ reg_t kCelWide32(EngineState *s, int argc, reg_t *argv) {
int16 celNo = argv[2].toSint16();
CelObjView celObj(resourceId, loopNo, celNo);
int16 width = celObj._width;
if (getSciVersion() < SCI_VERSION_3) {
if (getSciVersion() < SCI_VERSION_2_1_LATE) {
width = mulru(width, Ratio(g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth, celObj._xResolution));
}
return make_reg(0, width);

View File

@ -835,6 +835,10 @@ reg_t kArrayGetSize(EngineState *s, int argc, reg_t *argv) {
}
reg_t kArrayGetElement(EngineState *s, int argc, reg_t *argv) {
if (getSciVersion() == SCI_VERSION_2_1_LATE) {
return kStringGetChar(s, argc, argv);
}
SciArray &array = *s->_segMan->lookupArray(argv[0]);
return array.getAsID(argv[1].toUint16());
}
@ -846,6 +850,10 @@ reg_t kArraySetElements(EngineState *s, int argc, reg_t *argv) {
}
reg_t kArrayFree(EngineState *s, int argc, reg_t *argv) {
if (getSciVersion() == SCI_VERSION_2_1_LATE && !s->_segMan->isValidAddr(argv[0], SEG_TYPE_ARRAY)) {
return s->r_acc;
}
s->_segMan->freeArray(argv[0]);
return s->r_acc;
}

View File

@ -1228,7 +1228,7 @@ bool GfxFrameout::isOnMe(const ScreenItem &screenItem, const Plane &plane, const
scaledPosition.x -= screenItem._scaledPosition.x;
scaledPosition.y -= screenItem._scaledPosition.y;
if (getSciVersion() < SCI_VERSION_3) {
if (getSciVersion() < SCI_VERSION_2_1_LATE) {
mulru(scaledPosition, Ratio(celObj._xResolution, _currentBuffer.screenWidth), Ratio(celObj._yResolution, _currentBuffer.screenHeight));
}

View File

@ -299,7 +299,7 @@ void ScreenItem::calcRects(const Plane &plane) {
Ratio celToScreenX;
Ratio celToScreenY;
if (getSciVersion() < SCI_VERSION_3) {
if (getSciVersion() < SCI_VERSION_2_1_LATE) {
celToScreenX = Ratio(screenWidth, celObj._xResolution);
celToScreenY = Ratio(screenHeight, celObj._yResolution);
}
@ -311,7 +311,7 @@ void ScreenItem::calcRects(const Plane &plane) {
// high resolution coordinates
if (_useInsetRect) {
if (getSciVersion() < SCI_VERSION_3) {
if (getSciVersion() < SCI_VERSION_2_1_LATE) {
const Ratio scriptToCelX(celObj._xResolution, scriptWidth);
const Ratio scriptToCelY(celObj._yResolution, scriptHeight);
mulru(_screenItemRect, scriptToCelX, scriptToCelY, 0);
@ -632,7 +632,7 @@ Common::Rect ScreenItem::getNowSeenRect(const Plane &plane) const {
// high resolution coordinates
if (_useInsetRect) {
if (getSciVersion() < SCI_VERSION_3) {
if (getSciVersion() < SCI_VERSION_2_1_LATE) {
const Ratio scriptToCelX(celObj._xResolution, scriptWidth);
const Ratio scriptToCelY(celObj._yResolution, scriptHeight);
mulru(nsRect, scriptToCelX, scriptToCelY, 0);
@ -678,7 +678,7 @@ Common::Rect ScreenItem::getNowSeenRect(const Plane &plane) const {
Ratio celToScriptX;
Ratio celToScriptY;
if (getSciVersion() < SCI_VERSION_3) {
if (getSciVersion() < SCI_VERSION_2_1_LATE) {
celToScriptX = Ratio(scriptWidth, celObj._xResolution);
celToScriptY = Ratio(scriptHeight, celObj._yResolution);
}