aboutsummaryrefslogtreecommitdiff
path: root/scumm/script_v2.cpp
diff options
context:
space:
mode:
authorMax Horn2003-05-14 12:26:23 +0000
committerMax Horn2003-05-14 12:26:23 +0000
commitd8048837f396cebafc9cf5474dc9d358a2a3a349 (patch)
treeb04545113dd24bb7c09d4466e5363baf1e8949e8 /scumm/script_v2.cpp
parent45ae0f0d61544376248996f8395ba4801aa6b90e (diff)
downloadscummvm-rg350-d8048837f396cebafc9cf5474dc9d358a2a3a349.tar.gz
scummvm-rg350-d8048837f396cebafc9cf5474dc9d358a2a3a349.tar.bz2
scummvm-rg350-d8048837f396cebafc9cf5474dc9d358a2a3a349.zip
fixed v2 verb handling
svn-id: r7500
Diffstat (limited to 'scumm/script_v2.cpp')
-rw-r--r--scumm/script_v2.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp
index 780d4c00f5..bdb1577dcb 100644
--- a/scumm/script_v2.cpp
+++ b/scumm/script_v2.cpp
@@ -725,15 +725,15 @@ void Scumm_v2::o2_resourceRoutines() {
}
void Scumm_v2::o2_verbOps() {
- int opcode = fetchScriptByte();
- int verb, slot, state;
+ int verb = fetchScriptByte();
+ int slot, state;
- switch (opcode) {
+ switch (verb) {
case 0: // Delete Verb
- verb = getVarOrDirectByte(0x80);
- slot = getVerbSlot(verb, 0);
+ slot = getVarOrDirectByte(0x80) + 1;
+ assert(0 < slot && slot < _maxVerbs);
- printf("o2_verbOps delete verb = %d, slot = %d\n", verb, slot);
+ //printf("o2_verbOps delete slot = %d\n", slot);
killVerb(slot);
break;
@@ -742,7 +742,7 @@ void Scumm_v2::o2_verbOps() {
state = fetchScriptByte();
slot = getVerbSlot(verb, 0);
- printf("o2_verbOps Verb On/Off: verb = %d, slot = %d, state = %d\n", verb, slot, state);
+ //printf("o2_verbOps Verb On/Off: verb = %d, slot = %d, state = %d\n", verb, slot, state);
_verbs[slot].curmode = state;
@@ -751,22 +751,12 @@ void Scumm_v2::o2_verbOps() {
default: { // New Verb
int x = fetchScriptByte() << 3;
int y = fetchScriptByte() << 3;
- verb = getVarOrDirectByte(0x80);
+ slot = getVarOrDirectByte(0x80) + 1;
int unk = fetchScriptByte(); // ?
- printf("o2_verbOps: opcode = %d, x = %d, y = %d, slot = %d, unk = %d, name = %s\n",
- opcode, x, y, verb, unk, _scriptPointer);
-
VerbSlot *vs;
- slot = getVerbSlot(verb, 0);
- if (slot == 0) {
- for (slot = 1; slot < _maxVerbs; slot++) {
- if (_verbs[slot].verbid == 0)
- break;
- }
- if (slot == _maxVerbs)
- error("Too many verbs");
- }
+ assert(0 < slot && slot < _maxVerbs);
+
vs = &_verbs[slot];
vs->verbid = verb;
vs->color = 2;
@@ -783,6 +773,9 @@ void Scumm_v2::o2_verbOps() {
vs->x = x;
vs->y = y;
+ //printf("o2_verbOps: verb = %d, slot = %d, x = %d, y = %d, unk = %d, name = %s\n",
+ // verb, slot, x, y, unk, _scriptPointer);
+
// It follows the verb name
loadPtrToResource(rtVerb, slot, NULL);
}