aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorColin Snover2017-09-30 00:03:05 -0500
committerColin Snover2017-09-30 01:08:12 -0500
commitb2966f3fc8b7bbf429373d9988ea1280660dc33b (patch)
treef65095e68becdbe369bd3adef42903b28ef69cac /engines
parentdc7e37fdb6800124cccf231282d4b1475249a654 (diff)
downloadscummvm-rg350-b2966f3fc8b7bbf429373d9988ea1280660dc33b.tar.gz
scummvm-rg350-b2966f3fc8b7bbf429373d9988ea1280660dc33b.tar.bz2
scummvm-rg350-b2966f3fc8b7bbf429373d9988ea1280660dc33b.zip
SCI32: Fix support for RAMA demo
Fixes Trac#10251.
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/features.cpp9
-rw-r--r--engines/sci/engine/guest_additions.cpp2
-rw-r--r--engines/sci/engine/kernel_tables.h4
-rw-r--r--engines/sci/engine/kgraphics32.cpp6
-rw-r--r--engines/sci/engine/klists.cpp8
-rw-r--r--engines/sci/graphics/frameout.cpp2
-rw-r--r--engines/sci/graphics/screen_item32.cpp8
7 files changed, 25 insertions, 14 deletions
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index f94ab8a6a7..1297ba2abc 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -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;
}
diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp
index d4e410261f..06d8d9a5d3 100644
--- a/engines/sci/engine/guest_additions.cpp
+++ b/engines/sci/engine/guest_additions.cpp
@@ -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);
}
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 797edeeda2..b60d6ccce8 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -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 },
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index bed4a09342..b7fae2e05d 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -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);
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 2ca5a65fc0..330b78b2b2 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -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;
}
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 6ea4975ea8..f2ae0dfdba 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -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));
}
diff --git a/engines/sci/graphics/screen_item32.cpp b/engines/sci/graphics/screen_item32.cpp
index 5a35d30c54..14e71735fb 100644
--- a/engines/sci/graphics/screen_item32.cpp
+++ b/engines/sci/graphics/screen_item32.cpp
@@ -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);
}