aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-01-09 22:53:21 +0000
committerMax Horn2003-01-09 22:53:21 +0000
commitc3657ff6373269260ae487ab51d977a481971acd (patch)
treea184abe68a9ac9a43e22fcc698299262d2ae88ca
parent86dea678e2759566110b1b6520363e888086c66b (diff)
downloadscummvm-rg350-c3657ff6373269260ae487ab51d977a481971acd.tar.gz
scummvm-rg350-c3657ff6373269260ae487ab51d977a481971acd.tar.bz2
scummvm-rg350-c3657ff6373269260ae487ab51d977a481971acd.zip
fixed the 'too many verbs' bug: verbid is 16 bits but was stored in save games as a byte. This means that existing savegames are still affected by the bug
svn-id: r6376
-rw-r--r--scumm/saveload.cpp5
-rw-r--r--scumm/saveload.h3
-rw-r--r--scumm/script_v8.cpp25
3 files changed, 20 insertions, 13 deletions
diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp
index cf98762ca7..bf9ea4427c 100644
--- a/scumm/saveload.cpp
+++ b/scumm/saveload.cpp
@@ -322,7 +322,10 @@ void Scumm::saveOrLoad(Serializer *s, uint32 savegameVersion)
MKLINE(VerbSlot, oldtop, sleInt16, VER_V8),
MKLINE(VerbSlot, oldright, sleInt16, VER_V8),
MKLINE(VerbSlot, oldbottom, sleInt16, VER_V8),
- MKLINE(VerbSlot, verbid, sleByte, VER_V8),
+
+ MKLINE_OLD(VerbSlot, verbid, sleByte, VER_V8, VER_V11),
+ MKLINE(VerbSlot, verbid, sleInt16, VER_V12),
+
MKLINE(VerbSlot, color, sleByte, VER_V8),
MKLINE(VerbSlot, hicolor, sleByte, VER_V8),
MKLINE(VerbSlot, dimcolor, sleByte, VER_V8),
diff --git a/scumm/saveload.h b/scumm/saveload.h
index d30a771a83..9ac60b4eff 100644
--- a/scumm/saveload.h
+++ b/scumm/saveload.h
@@ -25,13 +25,14 @@
// Support for "old" savegames (made with 2501 CVS build)
// Can be useful for other ports too :)
+#define VER_V12 12
#define VER_V11 11
#define VER_V10 10
#define VER_V9 9
#define VER_V8 8
#define VER_V7 7
-#define CURRENT_VER VER_V11
+#define CURRENT_VER VER_V12
// To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types,
diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp
index 043e5dbcce..ca02abb4b9 100644
--- a/scumm/script_v8.cpp
+++ b/scumm/script_v8.cpp
@@ -37,7 +37,6 @@
void Scumm_v8::setupOpcodes()
{
- // TODO: any of the o6_ entries are potentially wrong and pure guesses :-)
static const OpcodeEntryV8 opcodes[256] = {
/* 00 */
OPCODE(o6_invalid),
@@ -1154,16 +1153,21 @@ void Scumm_v8::o8_verbOps()
_verbRedraw = true;
- if (0 <= _curVerbSlot && _curVerbSlot < _maxVerbs)
- vs = &_verbs[_curVerbSlot];
- if (subOp != 0x96)
- assert(vs);
-
- switch (subOp) {
- case 0x96: // SO_VERB_INIT Choose verb number for editing
+ if (subOp == 0x96) {
_curVerb = pop();
_curVerbSlot = getVerbSlot(_curVerb, 0);
checkRange(_maxVerbs - 1, 0, _curVerbSlot, "Illegal new verb slot %d");
+ //printf("Setting current actor to %d\n", _curActor);
+ return;
+ }
+
+ assert(0 <= _curVerbSlot && _curVerbSlot < _maxVerbs);
+ vs = &_verbs[_curVerbSlot];
+ assert(vs);
+
+ switch (subOp) {
+ case 0x96: // SO_VERB_INIT Choose verb number for editing
+ // handled above!
break;
case 0x97: // SO_VERB_NEW New verb
if (_curVerbSlot == 0) {
@@ -1171,9 +1175,8 @@ void Scumm_v8::o8_verbOps()
if (_verbs[slot].verbid == 0)
break;
}
- if (slot == _maxVerbs) {
- warning("Too many verbs");
- break;
+ if (slot >= _maxVerbs) {
+ error("Too many verbs");
}
_curVerbSlot = slot;
}