aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2010-11-17 14:28:32 +0000
committerFilippos Karapetis2010-11-17 14:28:32 +0000
commit47e137fd8e26471ff678b49355a2f01cfe1e6c39 (patch)
tree166aa1ee57cd5b92b1060beafd6fae60b200296f /engines/sci
parentc003032b4cb25e1ea9e3f9cdee904604c30fb4ff (diff)
downloadscummvm-rg350-47e137fd8e26471ff678b49355a2f01cfe1e6c39.tar.gz
scummvm-rg350-47e137fd8e26471ff678b49355a2f01cfe1e6c39.tar.bz2
scummvm-rg350-47e137fd8e26471ff678b49355a2f01cfe1e6c39.zip
SCI: lofsa/lofss functionality for SCI3
- Updated detectLofsType() for SCI3 - Cleaned up op_lofsa and op_lofss and updated them for SCI3 svn-id: r54293
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/features.cpp11
-rw-r--r--engines/sci/engine/features.h2
-rw-r--r--engines/sci/engine/vm.cpp20
3 files changed, 27 insertions, 6 deletions
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp
index 97eec38caf..7d9b4f43fc 100644
--- a/engines/sci/engine/features.cpp
+++ b/engines/sci/engine/features.cpp
@@ -270,11 +270,20 @@ SciVersion GameFeatures::detectLofsType() {
return _lofsType;
}
- if (getSciVersion() >= SCI_VERSION_1_1) {
+ if (getSciVersion() >= SCI_VERSION_1_1 && getSciVersion() <= SCI_VERSION_2_1) {
+ // SCI1.1 type, i.e. we compensate for the fact that the heap is attached
+ // to the end of the script
_lofsType = SCI_VERSION_1_1;
return _lofsType;
}
+ if (getSciVersion() == SCI_VERSION_3) {
+ // SCI3 type, same as pre-SCI1.1, really, as there is no separate heap
+ // resource
+ _lofsType = SCI_VERSION_3;
+ return _lofsType;
+ }
+
// Find a function of the "Game" object (which is the game super class) which invokes lofsa/lofss
reg_t gameSuperClass = g_sci->getGameSuperClassAddress();
bool found = false;
diff --git a/engines/sci/engine/features.h b/engines/sci/engine/features.h
index 755054fb25..336520f0d9 100644
--- a/engines/sci/engine/features.h
+++ b/engines/sci/engine/features.h
@@ -57,7 +57,7 @@ public:
/**
* Autodetects the Lofs type
- * @return Lofs type, SCI_VERSION_0_EARLY / SCI_VERSION_1_MIDDLE / SCI_VERSION_1_1
+ * @return Lofs type, SCI_VERSION_0_EARLY / SCI_VERSION_1_MIDDLE / SCI_VERSION_1_1 / SCI_VERSION_3
*/
SciVersion detectLofsType();
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 79fe08792d..b251521041 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1723,14 +1723,20 @@ void run_vm(EngineState *s) {
s->r_acc.segment = s->xs->addr.pc.segment;
switch (g_sci->_features->detectLofsType()) {
+ case SCI_VERSION_0_EARLY:
+ s->r_acc.offset = s->xs->addr.pc.offset + opparams[0];
+ break;
+ case SCI_VERSION_1_MIDDLE:
+ s->r_acc.offset = opparams[0];
+ break;
case SCI_VERSION_1_1:
s->r_acc.offset = opparams[0] + local_script->getScriptSize();
break;
- case SCI_VERSION_1_MIDDLE:
+ case SCI_VERSION_3:
s->r_acc.offset = opparams[0];
break;
default:
- s->r_acc.offset = s->xs->addr.pc.offset + opparams[0];
+ error("Unknown lofs type");
}
if (s->r_acc.offset >= scr->getBufSize()) {
@@ -1744,14 +1750,20 @@ void run_vm(EngineState *s) {
r_temp.segment = s->xs->addr.pc.segment;
switch (g_sci->_features->detectLofsType()) {
+ case SCI_VERSION_0_EARLY:
+ r_temp.offset = s->xs->addr.pc.offset + opparams[0];
+ break;
+ case SCI_VERSION_1_MIDDLE:
+ r_temp.offset = opparams[0];
+ break;
case SCI_VERSION_1_1:
r_temp.offset = opparams[0] + local_script->getScriptSize();
break;
- case SCI_VERSION_1_MIDDLE:
+ case SCI_VERSION_3:
r_temp.offset = opparams[0];
break;
default:
- r_temp.offset = s->xs->addr.pc.offset + opparams[0];
+ error("Unknown lofs type");
}
if (r_temp.offset >= scr->getBufSize()) {