aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-24 09:52:08 +0000
committerFilippos Karapetis2010-06-24 09:52:08 +0000
commit0fb54293181d76d5b84cb7da5ff54c883630bf86 (patch)
treed33b91e0b8c4e9495803bc15faa28a25657bfd58 /engines/sci
parentaa0c86e7557fbe68d33dec52139015562004742f (diff)
downloadscummvm-rg350-0fb54293181d76d5b84cb7da5ff54c883630bf86.tar.gz
scummvm-rg350-0fb54293181d76d5b84cb7da5ff54c883630bf86.tar.bz2
scummvm-rg350-0fb54293181d76d5b84cb7da5ff54c883630bf86.zip
Initialize the stack with 'S' or 's' characters, like SSCI does (ultimately, we should not change the stack again like we do in op_link - this is what Sierra is doing). Some cleanup
svn-id: r50207
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kgraphics.cpp2
-rw-r--r--engines/sci/engine/klists.cpp3
-rw-r--r--engines/sci/engine/seg_manager.cpp8
3 files changed, 9 insertions, 4 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index bc278a2bb1..eaef049951 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -540,7 +540,7 @@ reg_t kBaseSetter(EngineState *s, int argc, reg_t *argv) {
// WORKAROUND for a problem in LSL1VGA. This allows the casino door to be opened,
// till the actual problem is found
- if (g_sci->getGameId() == "lsl1sci" && s->currentRoomNumber() == 300) {
+ if (s->currentRoomNumber() == 300 && g_sci->getGameId() == "lsl1sci") {
int top = readSelectorValue(s->_segMan, object, SELECTOR(brTop));
writeSelectorValue(s->_segMan, object, SELECTOR(brTop), top + 2);
}
diff --git a/engines/sci/engine/klists.cpp b/engines/sci/engine/klists.cpp
index 86d82bd3d1..1fd34849ea 100644
--- a/engines/sci/engine/klists.cpp
+++ b/engines/sci/engine/klists.cpp
@@ -115,8 +115,7 @@ static void checkListPointer(SegManager *segMan, reg_t addr) {
reg_t kNewList(EngineState *s, int argc, reg_t *argv) {
reg_t listbase;
- List *l;
- l = s->_segMan->allocateList(&listbase);
+ List *l = s->_segMan->allocateList(&listbase);
l->first = l->last = NULL_REG;
debugC(2, kDebugLevelNodes, "New listbase at %04x:%04x", PRINT_REG(listbase));
diff --git a/engines/sci/engine/seg_manager.cpp b/engines/sci/engine/seg_manager.cpp
index 5371238304..b464438553 100644
--- a/engines/sci/engine/seg_manager.cpp
+++ b/engines/sci/engine/seg_manager.cpp
@@ -402,6 +402,12 @@ DataStack *SegManager::allocateStack(int size, SegmentId *segid) {
retval->_entries = (reg_t *)calloc(size, sizeof(reg_t));
retval->_capacity = size;
+ // SSCI initializes the stack with "S" characters (uppercase S in SCI0-SCI1,
+ // lowercase s in SCI0 and SCI11) - probably stands for "stack"
+ byte filler = (getSciVersion() >= SCI_VERSION_01 && getSciVersion() <= SCI_VERSION_1_LATE) ? 'S' : 's';
+ for (int i = 0; i < size; i++)
+ retval->_entries[i] = make_reg(0, filler);
+
return retval;
}
@@ -448,7 +454,7 @@ byte *SegManager::getHunkPointer(reg_t addr) {
HunkTable *ht = (HunkTable *)getSegment(addr.segment, SEG_TYPE_HUNK);
if (!ht || !ht->isValidEntry(addr.offset)) {
- warning("getHunkPointer() with invalid handle");
+ warning("getHunkPointer() with invalid handle %04x:%04x", PRINT_REG(addr));
return NULL;
}