aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/kernel.cpp11
-rw-r--r--engines/sci/engine/kernel.h1
-rw-r--r--engines/sci/engine/kernel_tables.h13
-rw-r--r--engines/sci/engine/kfile.cpp6
-rw-r--r--engines/sci/engine/kgraphics.cpp118
-rw-r--r--engines/sci/engine/kmath.cpp8
-rw-r--r--engines/sci/engine/kmisc.cpp38
-rw-r--r--engines/sci/engine/kstring.cpp34
-rw-r--r--engines/sci/engine/savegame.cpp8
-rw-r--r--engines/sci/engine/scriptdebug.cpp5
-rw-r--r--engines/sci/engine/static_selectors.cpp32
-rw-r--r--engines/sci/engine/vm.cpp1
-rw-r--r--engines/sci/engine/workarounds.cpp9
13 files changed, 210 insertions, 74 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 8fb6322f55..a83a026762 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -488,8 +488,15 @@ bool Kernel::signatureMatch(const uint16 *sig, int argc, const reg_t *argv) {
if ((type & SIG_IS_INVALID) && (!(curSig & SIG_IS_INVALID)))
return false; // pointer is invalid and signature doesn't allow that?
- if (!((type & ~SIG_IS_INVALID) & curSig))
- return false; // type mismatch
+ if (!((type & ~SIG_IS_INVALID) & curSig)) {
+ if ((type & ~SIG_IS_INVALID) == SIG_TYPE_ERROR && (curSig & SIG_IS_INVALID)) {
+ // Type is unknown (error - usually because of a deallocated object or
+ // stale pointer) and the signature allows invalid pointers. In this case,
+ // ignore the invalid pointer.
+ } else {
+ return false; // type mismatch
+ }
+ }
if (!(curSig & SIG_MORE_MAY_FOLLOW)) {
sig++;
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index ff3c67c84b..b605908dc1 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -476,6 +476,7 @@ reg_t kSetLanguage(EngineState *s, int argc, reg_t *argv);
reg_t kScrollWindow(EngineState *s, int argc, reg_t *argv);
reg_t kSetFontRes(EngineState *s, int argc, reg_t *argv);
reg_t kFont(EngineState *s, int argc, reg_t *argv);
+reg_t kBitmap(EngineState *s, int argc, reg_t *argv);
#endif
reg_t kDoSoundInit(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 0c5d4e680d..d3adcaccbf 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -546,6 +546,7 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(ScrollWindow), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_CALL(SetFontRes), SIG_EVERYWHERE, "ii", NULL, NULL },
{ MAP_CALL(Font), SIG_EVERYWHERE, "i(.*)", NULL, NULL },
+ { MAP_CALL(Bitmap), SIG_EVERYWHERE, "(.*)", NULL, NULL },
// SCI2.1 Empty Functions
@@ -564,6 +565,9 @@ static SciKernelMapEntry s_kernelMap[] = {
// just use GetConfig and mark this one as empty, like the DOS version does.
{ MAP_EMPTY(GetSierraProfileInt), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ // Debug function called whenever the current room changes
+ { MAP_EMPTY(NewRoom), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+
// Unused / debug SCI2.1 unused functions, always mapped to kDummy
// The debug functions are called from the inbuilt debugger or polygon
@@ -593,7 +597,6 @@ static SciKernelMapEntry s_kernelMap[] = {
// UpdateLine - used by LSL6
// SetPalStyleRange - 2 integer parameters, start and end. All styles from start-end
// (inclusive) are set to 0
- // NewRoom - 1 integer parameter, the current room number
// MorphOn - used by SQ6, script 900, the datacorder reprogramming puzzle (from room 270)
// SetHotRectangles - used by Phantasmagoria 1
#endif
@@ -602,7 +605,7 @@ static SciKernelMapEntry s_kernelMap[] = {
};
/** Default kernel name table. */
-static const char *s_defaultKernelNames[] = {
+static const char *const s_defaultKernelNames[] = {
/*0x00*/ "Load",
/*0x01*/ "UnLoad",
/*0x02*/ "ScriptID",
@@ -751,7 +754,7 @@ static const char *s_defaultKernelNames[] = {
// NOTE: 0x72-0x79, 0x85-0x86, 0x88 are from the GK2 demo (which has debug support) and are
// just Dummy in other SCI2 games.
-static const char *sci2_default_knames[] = {
+static const char *const sci2_default_knames[] = {
/*0x00*/ "Load",
/*0x01*/ "UnLoad",
/*0x02*/ "ScriptID",
@@ -916,7 +919,7 @@ static const char *sci2_default_knames[] = {
/*0x9f*/ "MessageBox"
};
-static const char *sci21_default_knames[] = {
+static const char *const sci21_default_knames[] = {
/*0x00*/ "Load",
/*0x01*/ "UnLoad",
/*0x02*/ "ScriptID",
@@ -1059,7 +1062,7 @@ static const char *sci21_default_knames[] = {
/*0x8b*/ "SetPalStyleRange",
/*0x8c*/ "AddPicAt",
/*0x8d*/ "MessageBox", // SCI3, was Dummy in SCI2.1
- /*0x8e*/ "NewRoom",
+ /*0x8e*/ "NewRoom", // debug function
/*0x8f*/ "Dummy",
/*0x90*/ "Priority",
/*0x91*/ "MorphOn",
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 1bd6754ca5..0c73125bdb 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -578,11 +578,15 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
game_description = dialog->getResultString();
if (game_description.empty()) {
// create our own description for the saved game, the user didnt enter it
+ #if defined(USE_SAVEGAME_TIMESTAMP)
TimeDate curTime;
g_system->getTimeAndDate(curTime);
curTime.tm_year += 1900; // fixup year
curTime.tm_mon++; // fixup month
- game_description = Common::String::format("%02d.%02d.%04d / %02d:%02d:%02d", curTime.tm_mday, curTime.tm_mon, curTime.tm_year, curTime.tm_hour, curTime.tm_min, curTime.tm_sec);
+ game_description = Common::String::format("%04d.%02d.%02d / %02d:%02d:%02d", curTime.tm_year, curTime.tm_mon, curTime.tm_mday, curTime.tm_hour, curTime.tm_min, curTime.tm_sec);
+ #else
+ game_description = Common::String::format("Save %d", savegameId + 1);
+ #endif
}
delete dialog;
g_sci->_soundCmd->pauseAll(false); // unpause music ( we can't have it paused during save)
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 36de767464..9f309aeab7 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -49,6 +49,7 @@
#include "sci/graphics/text16.h"
#include "sci/graphics/view.h"
#ifdef ENABLE_SCI32
+#include "sci/graphics/text32.h"
#include "sci/graphics/frameout.h"
#include "sci/video/robot_decoder.h"
#endif
@@ -1321,10 +1322,10 @@ reg_t kRepaintPlane(EngineState *s, int argc, reg_t *argv) {
reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv) {
reg_t planeObj = argv[0];
GuiResourceId pictureId = argv[1].toUint16();
- int16 forWidth = argv[2].toSint16();
- // argv[3] seems to be 0 most of the time
+ int16 pictureX = argv[2].toSint16();
+ int16 pictureY = argv[3].toSint16();
- g_sci->_gfxFrameout->kernelAddPicAt(planeObj, forWidth, pictureId);
+ g_sci->_gfxFrameout->kernelAddPicAt(planeObj, pictureId, pictureX, pictureY);
return s->r_acc;
}
@@ -1333,12 +1334,7 @@ reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv) {
}
reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) {
- // This kernel call likely seems to be doing the screen updates,
- // as its called right after a view is updated
-
- // TODO
g_sci->_gfxFrameout->kernelFrameout();
-
return NULL_REG;
}
@@ -1380,15 +1376,19 @@ reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) {
}
reg_t kCreateTextBitmap(EngineState *s, int argc, reg_t *argv) {
- // TODO: argument 0 is usually 0, and arguments 1 and 2 are usually 1
switch (argv[0].toUint16()) {
case 0: {
if (argc != 4) {
warning("kCreateTextBitmap(0): expected 4 arguments, got %i", argc);
return NULL_REG;
}
- //reg_t object = argv[3];
- //Common::String text = s->_segMan->getString(readSelector(s->_segMan, object, SELECTOR(text)));
+ reg_t object = argv[3];
+ Common::String text = s->_segMan->getString(readSelector(s->_segMan, object, SELECTOR(text)));
+ debugC(kDebugLevelStrings, "kCreateTextBitmap case 0 (%04x:%04x, %04x:%04x, %04x:%04x)",
+ PRINT_REG(argv[1]), PRINT_REG(argv[2]), PRINT_REG(argv[3]));
+ debugC(kDebugLevelStrings, "%s", text.c_str());
+ // TODO: arguments 1 and 2
+ g_sci->_gfxText32->createTextBitmap(object);
break;
}
case 1: {
@@ -1396,8 +1396,11 @@ reg_t kCreateTextBitmap(EngineState *s, int argc, reg_t *argv) {
warning("kCreateTextBitmap(0): expected 2 arguments, got %i", argc);
return NULL_REG;
}
- //reg_t object = argv[1];
- //Common::String text = s->_segMan->getString(readSelector(s->_segMan, object, SELECTOR(text)));
+ reg_t object = argv[1];
+ Common::String text = s->_segMan->getString(readSelector(s->_segMan, object, SELECTOR(text)));
+ debugC(kDebugLevelStrings, "kCreateTextBitmap case 1 (%04x:%04x)", PRINT_REG(argv[1]));
+ debugC(kDebugLevelStrings, "%s", text.c_str());
+ g_sci->_gfxText32->createTextBitmap(object);
break;
}
default:
@@ -1667,6 +1670,95 @@ reg_t kFont(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
+reg_t kBitmap(EngineState *s, int argc, reg_t *argv) {
+ // Used for bitmap operations in SCI2.1 and SCI3.
+ // This is the SCI2.1 version, the functionality seems to have changed in SCI3.
+
+ switch (argv[0].toUint16()) {
+ case 0: // init bitmap surface
+ {
+ // 6 params, called e.g. from TextView::init() in Torin's Passage,
+ // script 64890 and TransView::init() in script 64884
+ uint16 width = argv[1].toUint16();
+ uint16 height = argv[2].toUint16();
+ uint16 skip = argv[3].toUint16();
+ uint16 back = argv[4].toUint16();
+ uint16 width2 = (argc >= 6) ? argv[5].toUint16() : 0;
+ uint16 height2 = (argc >= 7) ? argv[6].toUint16() : 0;
+ uint16 transparent = (argc >= 8) ? argv[7].toUint16() : 0;
+ warning("kBitmap(0): width %d, height %d, skip %d, back %d, width2 %d, height2 %d, transparent %d",
+ width, height, skip, back, width2, height2, transparent);
+ // returns a pointer to a bitmap
+ }
+ break;
+ case 1: // dispose bitmap surface
+ // 1 param, bitmap pointer, called e.g. from MenuItem::dispose
+ // in Torin's Passage, script 64893
+ warning("kBitmap(1), bitmap ptr %04x:%04x", PRINT_REG(argv[1]));
+ break;
+ case 2: // dispose bitmap surface, with extra param
+ // 2 params, called e.g. from MenuItem::dispose in Torin's Passage,
+ // script 64893
+ warning("kBitmap(2), unk1 %d, bitmap ptr %04x:%04x", argv[1].toUint16(), PRINT_REG(argv[2]));
+ break;
+ case 3: // tiled surface
+ {
+ // 6 params, called e.g. from TiledBitmap::resize() in Torin's Passage,
+ // script 64869
+ reg_t bitmapPtr = argv[1]; // obtained from kBitmap(0)
+ // The tiled view seems to always have 2 loops.
+ // These loops need to have 1 cel in loop 0 and 8 cels in loop 1.
+ uint16 view = argv[2].toUint16(); // vTiles selector
+ uint16 loop = argv[3].toUint16();
+ uint16 cel = argv[4].toUint16();
+ uint16 x = argv[5].toUint16();
+ uint16 y = argv[6].toUint16();
+ warning("kBitmap(3): bitmap ptr %04x:%04x, view %d, loop %d, cel %d, x %d, y %d",
+ PRINT_REG(bitmapPtr), view, loop, cel, x, y);
+ }
+ break;
+ case 4: // process text
+ {
+ // 13 params, called e.g. from TextButton::createBitmap() in Torin's Passage,
+ // script 64894
+ reg_t bitmapPtr = argv[1]; // obtained from kBitmap(0)
+ Common::String text = s->_segMan->getString(argv[2]);
+ // unk3
+ // unk4
+ // unk5
+ // unk6
+ // skip?
+ // back?
+ uint16 font = argv[9].toUint16();
+ uint16 mode = argv[10].toUint16();
+ // unk
+ uint16 dimmed = argv[12].toUint16();
+ warning("kBitmap(4): bitmap ptr %04x:%04x, font %d, mode %d, dimmed %d - text: \"%s\"",
+ PRINT_REG(bitmapPtr), font, mode, dimmed, text.c_str());
+ }
+ break;
+ case 5:
+ {
+ // 6 params, called e.g. from TextView::init() and TextView::draw()
+ // in Torin's Passage, script 64890
+ reg_t bitmapPtr = argv[1]; // obtained from kBitmap(0)
+ uint16 unk1 = argv[2].toUint16(); // unknown, usually 0, judging from scripts?
+ uint16 unk2 = argv[3].toUint16(); // unknown, usually 0, judging from scripts?
+ uint16 width = argv[4].toUint16(); // width - 1
+ uint16 height = argv[5].toUint16(); // height - 1
+ uint16 back = argv[6].toUint16();
+ warning("kBitmap(5): bitmap ptr %04x:%04x, unk1 %d, unk2 %d, width %d, height %d, back %d",
+ PRINT_REG(bitmapPtr), unk1, unk2, width, height, back);
+ }
+ break;
+ default:
+ kStub(s, argc, argv);
+ break;
+ }
+
+ return s->r_acc;
+}
+
#endif
} // End of namespace Sci
diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp
index ef795d7e2f..7570856dff 100644
--- a/engines/sci/engine/kmath.cpp
+++ b/engines/sci/engine/kmath.cpp
@@ -37,6 +37,14 @@ reg_t kRandom(EngineState *s, int argc, reg_t *argv) {
// some codes in sq4 are also random and 5 digit (if i remember correctly)
const uint16 fromNumber = argv[0].toUint16();
const uint16 toNumber = argv[1].toUint16();
+ // Some scripts may request a range in the reverse order (from largest
+ // to smallest). An example can be found in Longbow, room 710, where a
+ // random number is requested from 119 to 83. In this case, we're
+ // supposed to return toNumber (determined by the KQ5CD disasm).
+ // Fixes bug #3413020.
+ if (fromNumber > toNumber)
+ return make_reg(0, toNumber);
+
uint16 range = toNumber - fromNumber + 1;
// calculating range is exactly how sierra sci did it and is required for hoyle 4
// where we get called with kRandom(0, -1) and we are supposed to give back values from 0 to 0
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index e6837242e4..a32480c168 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -54,8 +54,33 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
uint32 neededSleep = 30;
- // WORKAROUNDS:
+ // WORKAROUNDS for scripts that are polling too quickly in scenes that
+ // are not animating much
switch (g_sci->getGameId()) {
+ case GID_CASTLEBRAIN:
+ // In Castle of Dr. Brain, memory color matching puzzle in the first
+ // room (room 100), the game scripts constantly poll the state of each
+ // stone when the user clicks on one. Since the scene is not animating
+ // much, this results in activating and deactivating each stone very
+ // quickly (together with its associated tone sound), depending on how
+ // low it is in the animate list. This worked somewhat in older PCs, but
+ // not in modern computers. We throttle the scene in order to allow the
+ // stones to display, otherwise the game scripts reset them too soon.
+ // Fixes bug #3127824.
+ if (s->currentRoomNumber() == 100) {
+ s->_throttleTrigger = true;
+ neededSleep = 60;
+ }
+ break;
+ case GID_ICEMAN:
+ // In ICEMAN the submarine control room is not animating much, so it
+ // runs way too fast. We calm it down even more, otherwise fighting
+ // against other submarines is almost impossible.
+ if (s->currentRoomNumber() == 27) {
+ s->_throttleTrigger = true;
+ neededSleep = 60;
+ }
+ break;
case GID_LSL3:
// LSL3 calculates a machinespeed variable during game startup
// (right after the filthy questions). This one would go through w/o
@@ -65,21 +90,12 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
if (s->currentRoomNumber() == 290)
s->_throttleTrigger = true;
break;
- case GID_ICEMAN:
- // In ICEMAN the submarine control room is not animating much, so it runs way too fast
- // we calm it down even more otherwise especially fighting against other submarines
- // is almost impossible
- if (s->currentRoomNumber() == 27) {
- s->_throttleTrigger = true;
- neededSleep = 60;
- }
- break;
case GID_SQ4:
// In SQ4 (floppy and CD) the sequel police appear way too quickly in
// the Skate-o-rama rooms, resulting in all sorts of timer issues, like
// #3109139 (which occurs because a police officer instantly teleports
// just before Roger exits and shoots him). We throttle these scenes a
- // bit more, in order to prevent timer bugs related to the sequel police
+ // bit more, in order to prevent timer bugs related to the sequel police.
if (s->currentRoomNumber() == 405 || s->currentRoomNumber() == 406 ||
s->currentRoomNumber() == 410 || s->currentRoomNumber() == 411) {
s->_throttleTrigger = true;
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 783845bb76..1a9359bb26 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -201,8 +201,8 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
char xfer;
int i;
int startarg;
- int str_leng = 0; /* Used for stuff like "%13s" */
- int unsigned_var = 0;
+ int strLength = 0; /* Used for stuff like "%13s" */
+ bool unsignedVar = false;
if (position.segment)
startarg = 2;
@@ -236,7 +236,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
mode = 0;
} else {
mode = 1;
- str_leng = 0;
+ strLength = 0;
}
} else if (mode == 1) { /* xfer != '%' */
char fillchar = ' ';
@@ -256,22 +256,22 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
else if (isdigit(static_cast<unsigned char>(xfer)) || (xfer == '-'))
source--; // Go to start of length argument
- str_leng = strtol(source, &destp, 10);
+ strLength = strtol(source, &destp, 10);
if (destp > source)
source = destp;
- if (str_leng < 0) {
+ if (strLength < 0) {
align = ALIGN_LEFT;
- str_leng = -str_leng;
+ strLength = -strLength;
} else if (align != ALIGN_CENTER)
align = ALIGN_RIGHT;
xfer = *source++;
} else
- str_leng = 0;
+ strLength = 0;
- assert((target - targetbuf) + str_leng + 1 <= maxsize);
+ assert((target - targetbuf) + strLength + 1 <= maxsize);
switch (xfer) {
case 's': { /* Copy string */
@@ -286,7 +286,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
Common::String tempsource = g_sci->getKernel()->lookupText(reg,
arguments[paramindex + 1]);
int slen = strlen(tempsource.c_str());
- int extralen = str_leng - slen;
+ int extralen = strLength - slen;
assert((target - targetbuf) + extralen <= maxsize);
if (extralen < 0)
extralen = 0;
@@ -342,7 +342,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
case 'c': { /* insert character */
assert((target - targetbuf) + 2 <= maxsize);
if (align >= 0)
- while (str_leng-- > 1)
+ while (strLength-- > 1)
*target++ = ' '; /* Format into the text */
char argchar = arguments[paramindex++];
if (argchar)
@@ -353,8 +353,14 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
case 'x':
case 'u':
- unsigned_var = 1;
+ unsignedVar = true;
case 'd': { /* Copy decimal */
+ // In the new SCI2 kString function, %d is used for unsigned
+ // integers. An example is script 962 in Shivers - it uses %d
+ // to create file names.
+ if (getSciVersion() >= SCI_VERSION_2)
+ unsignedVar = true;
+
/* int templen; -- unused atm */
const char *format_string = "%d";
@@ -362,14 +368,14 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
format_string = "%x";
int val = arguments[paramindex];
- if (!unsigned_var)
+ if (!unsignedVar)
val = (int16)arguments[paramindex];
target += sprintf(target, format_string, val);
paramindex++;
assert((target - targetbuf) <= maxsize);
- unsigned_var = 0;
+ unsignedVar = false;
mode = 0;
}
@@ -384,7 +390,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
if (align) {
int written = target - writestart;
- int padding = str_leng - written;
+ int padding = strLength - written;
if (padding > 0) {
if (align > 0) {
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index e43c7097ed..c30518ab42 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -626,12 +626,8 @@ void SoundCommandParser::reconstructPlayList() {
const MusicList::iterator end = _music->getPlayListEnd();
for (MusicList::iterator i = _music->getPlayListStart(); i != end; ++i) {
- if ((*i)->resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, (*i)->resourceId))) {
- (*i)->soundRes = new SoundResource((*i)->resourceId, _resMan, _soundVersion);
- _music->soundInitSnd(*i);
- } else {
- (*i)->soundRes = 0;
- }
+ initSoundResource(*i);
+
if ((*i)->status == kSoundPlaying) {
// Sync the sound object's selectors related to playing with the stored
// ones in the playlist, as they may have been invalidated when loading.
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 3a18fbc68f..ad3f4fb788 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -31,6 +31,8 @@
namespace Sci {
+//#define VM_DEBUG_SEND
+
// This table is only used for debugging. Don't include it for devices
// with not enough available memory (e.g. phones), where REDUCE_MEMORY_USAGE
// is defined
@@ -618,12 +620,13 @@ void debugSelectorCall(reg_t send_obj, Selector selector, int argc, StackPtr arg
#ifdef VM_DEBUG_SEND
debugN("Send to %04x:%04x (%s), selector %04x (%s):", PRINT_REG(send_obj),
- s->_segMan->getObjectName(send_obj), selector,
+ segMan->getObjectName(send_obj), selector,
g_sci->getKernel()->getSelectorName(selector).c_str());
#endif // VM_DEBUG_SEND
switch (selectorType) {
case kSelectorNone:
+ debugN("\n");
break;
case kSelectorVariable:
#ifdef VM_DEBUG_SEND
diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp
index cca4c47be8..8f3337743d 100644
--- a/engines/sci/engine/static_selectors.cpp
+++ b/engines/sci/engine/static_selectors.cpp
@@ -102,18 +102,28 @@ static const char * const sci2Selectors[] = {
#endif
static const SelectorRemap sciSelectorRemap[] = {
- { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "moveDone", 170 },
- { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "points", 316 },
- { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "flags", 368 },
- { SCI_VERSION_1_EARLY, SCI_VERSION_1_LATE, "nodePtr", 44 },
- { SCI_VERSION_1_LATE, SCI_VERSION_1_LATE, "cantBeHere", 57 },
- { SCI_VERSION_1_EARLY, SCI_VERSION_1_LATE, "topString", 101 },
- { SCI_VERSION_1_EARLY, SCI_VERSION_1_LATE, "flags", 102 },
+ { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "moveDone", 170 },
+ { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "points", 316 },
+ { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "flags", 368 },
+ { SCI_VERSION_1_EARLY, SCI_VERSION_1_LATE, "nodePtr", 44 },
+ { SCI_VERSION_1_LATE, SCI_VERSION_1_LATE, "cantBeHere", 57 },
+ { SCI_VERSION_1_EARLY, SCI_VERSION_1_LATE, "topString", 101 },
+ { SCI_VERSION_1_EARLY, SCI_VERSION_1_LATE, "flags", 102 },
// SCI1.1
- { SCI_VERSION_1_1, SCI_VERSION_1_1, "nodePtr", 41 },
- { SCI_VERSION_1_1, SCI_VERSION_1_1, "cantBeHere", 54 },
- { SCI_VERSION_1_1, SCI_VERSION_2_1, "-info-",4103 },
- { SCI_VERSION_NONE, SCI_VERSION_NONE, 0, 0 }
+ { SCI_VERSION_1_1, SCI_VERSION_1_1, "nodePtr", 41 },
+ { SCI_VERSION_1_1, SCI_VERSION_1_1, "cantBeHere", 54 },
+ // The following are not really needed. They've only been defined to
+ // ease game debugging.
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-objID-", 4096 },
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-size-", 4097 },
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-propDict-", 4098 },
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-methDict-", 4099 },
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-classScript-", 4100 },
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-script-", 4101 },
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-super-", 4102 },
+ //
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-info-", 4103 },
+ { SCI_VERSION_NONE, SCI_VERSION_NONE, 0, 0 }
};
struct ClassReference {
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 274b0bbbc9..7c22b48ece 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -41,7 +41,6 @@ namespace Sci {
const reg_t NULL_REG = {0, 0};
const reg_t SIGNAL_REG = {0, SIGNAL_OFFSET};
const reg_t TRUE_REG = {0, 1};
-//#define VM_DEBUG_SEND
// Enable the define below to have the VM abort on cases where a conditional
// statement is followed by an unconditional jump (which will most likely lead
// to an infinite loop). Aids in detecting script bugs such as #3040722.
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 968afcb11c..ac8d5fa262 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -209,15 +209,9 @@ const SciWorkaroundEntry kDeviceInfo_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, call,index, workaround
const SciWorkaroundEntry kDisplay_workarounds[] = {
{ GID_ISLANDBRAIN, 300, 300, 0, "geneDude", "show", -1, 0, { WORKAROUND_IGNORE, 0 } }, // when looking at the gene explanation chart - a parameter is an object
- { GID_PQ1, 500, 500, 0, "endInter", "changeState", 0x3e8, 0, { WORKAROUND_IGNORE, 0 } }, // restoring a game at the map scene (bug #3389579)
- { GID_PQ1, 500, 500, 0, "endInter", "changeState", 0x46b, 0, { WORKAROUND_IGNORE, 0 } }, // restoring a game at the map scene (bug #3389579)
{ GID_PQ2, 23, 23, 0, "rm23Script", "elements", 0x4ae, 0, { WORKAROUND_IGNORE, 0 } }, // when looking at the 2nd page of pate's file - 0x75 as id
{ GID_PQ2, 23, 23, 0, "rm23Script", "elements", 0x4c1, 0, { WORKAROUND_IGNORE, 0 } }, // when looking at the 2nd page of pate's file - 0x75 as id (another pq2 version, bug #3043904)
{ GID_QFG1, 11, 11, 0, "battle", "<noname90>", -1, 0, { WORKAROUND_IGNORE, 0 } }, // DEMO: When entering battle, 0x75 as id
- { GID_QFG3, -1, 47, 0, "barterWin", "open", 0x1426, 0, { WORKAROUND_IGNORE, 0 } }, // sometimes when talking with a vendor that can be bartered with, the wrong local variable is checked and the variable contents are wrong - bug #3292251
- { GID_QFG3, -1, 47, 0, "barterIcon", "show", 0x135c, 0, { WORKAROUND_IGNORE, 0 } }, // sometimes when talking with a vendor that can be bartered with, the wrong local variable is checked and the variable contents are wrong - bug #3292251
- { GID_SQ1, -1, 700, 0, "arcadaRegion", "doit", -1, 0, { WORKAROUND_IGNORE, 0 } }, // restoring in some rooms of the arcada (right at the start)
- { GID_SQ1, 44, 44, 0, "spinDone", "changeState",0x13b0, 0, { WORKAROUND_IGNORE, 0 } }, // restoring a game at the slot machine in Ulence Flats (bug #3308087)
{ GID_SQ4, 397, 0, 0, "", "export 12", -1, 0, { WORKAROUND_IGNORE, 0 } }, // FLOPPY: when going into the computer store (bug #3044044)
{ GID_SQ4, 391, 391, 0, "doCatalog", "mode", 0x84, 0, { WORKAROUND_IGNORE, 0 } }, // CD: clicking on catalog in roboter sale - a parameter is an object
{ GID_SQ4, 391, 391, 0, "choosePlug", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // CD: ordering connector in roboter sale - a parameter is an object
@@ -285,10 +279,7 @@ const SciWorkaroundEntry kGraphSaveBox_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, call,index, workaround
const SciWorkaroundEntry kGraphRestoreBox_workarounds[] = {
- { GID_LSL6, -1, 86, 0, "LL6Inv", "show", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // happens when restoring, is called with hunk segment, but hunk is not allocated at that time
- // ^^ TODO: check, if this is really a script error or an issue with our restore code
{ GID_LSL6, -1, 86, 0, "LL6Inv", "hide", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // happens during the game, gets called with 1 extra parameter
- { GID_SQ5, 850, 850, 0, NULL, "changeState", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // happens while playing Battle Cruiser (invalid segment) - bug #3056811
SCI_WORKAROUNDENTRY_TERMINATOR
};