SCI: Fixed bug #3038767 - "SCI Fanmade - Cascade Quest: Crash when restoring a game"

svn-id: r52447
This commit is contained in:
Filippos Karapetis 2010-08-29 23:25:30 +00:00
parent b53d4dcd96
commit e004831576

View File

@ -46,12 +46,13 @@ reg_t kSetMenu(EngineState *s, int argc, reg_t *argv) {
uint16 itemId = argv[0].toUint16() & 0xFF; uint16 itemId = argv[0].toUint16() & 0xFF;
uint16 attributeId; uint16 attributeId;
int argPos = 1; int argPos = 1;
reg_t value;
while (argPos < argc) { while (argPos < argc) {
attributeId = argv[argPos].toUint16(); attributeId = argv[argPos].toUint16();
if ((argPos + 1) >= argc) // Happens in the fanmade game Cascade Quest when loading - bug #3038767
error("Too few parameters for kSetMenu"); value = (argPos + 1 < argc) ? argv[argPos + 1] : NULL_REG;
g_sci->_gfxMenu->kernelSetAttribute(menuId, itemId, attributeId, argv[argPos + 1]); g_sci->_gfxMenu->kernelSetAttribute(menuId, itemId, attributeId, value);
argPos += 2; argPos += 2;
} }
return s->r_acc; return s->r_acc;
@ -76,6 +77,11 @@ reg_t kDrawStatus(EngineState *s, int argc, reg_t *argv) {
// Sometimes this is called without giving text, if thats the case dont process it. // Sometimes this is called without giving text, if thats the case dont process it.
text = s->_segMan->getString(textReference); text = s->_segMan->getString(textReference);
if (text == "Replaying sound") {
// Happens in the fanmade game Cascade Quest when loading - ignore it
return s->r_acc;
}
g_sci->_gfxMenu->kernelDrawStatus(g_sci->strSplit(text.c_str(), NULL).c_str(), colorPen, colorBack); g_sci->_gfxMenu->kernelDrawStatus(g_sci->strSplit(text.c_str(), NULL).c_str(), colorPen, colorBack);
} }
return s->r_acc; return s->r_acc;