diff options
-rw-r--r-- | scumm/intern.h | 1 | ||||
-rw-r--r-- | scumm/script.cpp | 14 | ||||
-rw-r--r-- | scumm/script_v6.cpp | 14 | ||||
-rw-r--r-- | scumm/script_v72he.cpp | 6 | ||||
-rw-r--r-- | scumm/script_v7he.cpp | 4 | ||||
-rw-r--r-- | scumm/script_v90he.cpp | 28 |
6 files changed, 44 insertions, 23 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index 78cd66d1a0..17d5bd1f50 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -860,6 +860,7 @@ protected: virtual void executeOpcode(byte i); virtual const char *getOpcodeDesc(byte i); + int getWizImageStates(int resnum); void drawWizComplexPolygon(int resnum, int state, int po_x, int po_y, int arg14, int angle, int zoom, const Common::Rect *r); void displayWizComplexImage(const WizParameters *params); void processWizImage(const WizParameters *params); diff --git a/scumm/script.cpp b/scumm/script.cpp index d015d10c5e..41cb9e61d2 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -126,10 +126,10 @@ void ScummEngine::runObjectScript(int object, int entry, bool freezeResistant, b void ScummEngine::initializeLocals(int slot, int *vars) { int i; if (!vars) { - for (i = 0; i < 16; i++) + for (i = 0; i < 25; i++) vm.localvar[slot][i] = 0; } else { - for (i = 0; i < 16; i++) + for (i = 0; i < 25; i++) vm.localvar[slot][i] = vars[i]; } } @@ -549,7 +549,7 @@ int ScummEngine::readVar(uint var) { } if (_heversion >= 72) - checkRange(24, 0, var, "Local variable %d out of range(r)"); + checkRange(25, 0, var, "Local variable %d out of range(r)"); else checkRange(20, 0, var, "Local variable %d out of range(r)"); return vm.localvar[_currentScript][var]; @@ -628,7 +628,7 @@ void ScummEngine::writeVar(uint var, int value) { } if (_heversion >= 72) - checkRange(24, 0, var, "Local variable %d out of range(w)"); + checkRange(25, 0, var, "Local variable %d out of range(w)"); else checkRange(20, 0, var, "Local variable %d out of range(w)"); @@ -706,7 +706,7 @@ void ScummEngine::runInventoryScript(int i) { if (_version <= 2) { redrawV2Inventory(); } else { - int args[16]; + int args[24]; memset(args, 0, sizeof(args)); args[0] = i; if (VAR(VAR_INVENTORY_SCRIPT)) { @@ -933,7 +933,7 @@ void ScummEngine::doSentence(int verb, int objectA, int objectB) { void ScummEngine::checkAndRunSentenceScript() { int i; - int localParamList[16]; + int localParamList[24]; const ScriptSlot *ss; int sentenceScript; if (_version <= 2) @@ -974,7 +974,7 @@ void ScummEngine::checkAndRunSentenceScript() { } void ScummEngine::runInputScript(int a, int cmd, int mode) { - int args[16]; + int args[24]; int verbScript; if (_version <= 2) { diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp index 730c353f5f..1df9e227e9 100644 --- a/scumm/script_v6.cpp +++ b/scumm/script_v6.cpp @@ -819,7 +819,7 @@ void ScummEngine_v6::o6_jump() { } void ScummEngine_v6::o6_startScript() { - int args[16]; + int args[24]; int script, flags; getStackList(args, ARRAYSIZE(args)); @@ -857,7 +857,7 @@ void ScummEngine_v6::o6_startScript() { } void ScummEngine_v6::o6_jumpToScript() { - int args[16]; + int args[24]; int script, flags; getStackList(args, ARRAYSIZE(args)); @@ -868,7 +868,7 @@ void ScummEngine_v6::o6_jumpToScript() { } void ScummEngine_v6::o6_startScriptQuick() { - int args[16]; + int args[24]; int script; getStackList(args, ARRAYSIZE(args)); script = pop(); @@ -876,7 +876,7 @@ void ScummEngine_v6::o6_startScriptQuick() { } void ScummEngine_v6::o6_startScriptQuick2() { - int args[16]; + int args[24]; int script; getStackList(args, ARRAYSIZE(args)); script = pop(); @@ -884,7 +884,7 @@ void ScummEngine_v6::o6_startScriptQuick2() { } void ScummEngine_v6::o6_startObject() { - int args[16]; + int args[24]; int script, entryp; int flags; getStackList(args, ARRAYSIZE(args)); @@ -895,7 +895,7 @@ void ScummEngine_v6::o6_startObject() { } void ScummEngine_v6::o6_startObjectQuick() { - int args[16]; + int args[24]; int script, entryp; getStackList(args, ARRAYSIZE(args)); entryp = pop(); @@ -930,7 +930,7 @@ void ScummEngine_v6::o6_endCutscene() { } void ScummEngine_v6::o6_cutscene() { - int args[16]; + int args[24]; getStackList(args, ARRAYSIZE(args)); beginCutscene(args); } diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp index 93d43766af..78d45c7e9c 100644 --- a/scumm/script_v72he.cpp +++ b/scumm/script_v72he.cpp @@ -787,7 +787,7 @@ void ScummEngine_v72he::o72_unknown5A() { } void ScummEngine_v72he::o72_startScript() { - int args[16]; + int args[24]; int script; byte flags; @@ -798,7 +798,7 @@ void ScummEngine_v72he::o72_startScript() { } void ScummEngine_v72he::o72_startObject() { - int args[16]; + int args[24]; int script, entryp; byte flags; @@ -1871,7 +1871,7 @@ void ScummEngine_v72he::o72_unknownCF() { } void ScummEngine_v72he::o72_jumpToScript() { - int args[16]; + int args[24]; int script; byte flags; diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp index 791cfefc52..2dd7eefbf1 100644 --- a/scumm/script_v7he.cpp +++ b/scumm/script_v7he.cpp @@ -1019,7 +1019,7 @@ void ScummEngine::polygonStore(int id, bool flag, int vert1x, int vert1y, int ve wp->bound.bottom = -10000; // compute bounding box - for (int j = 0; j < 5; j++) { + for (int j = 0; j < wp->numVerts; j++) { Common::Rect r(wp->vert[j].x, wp->vert[j].y, wp->vert[j].x + 1, wp->vert[j].y + 1); wp->bound.extend(r); } @@ -1060,7 +1060,7 @@ bool ScummEngine_v70he::polygonDefined(int id) { } bool ScummEngine_v70he::polygonContains(const WizPolygon &pol, int x, int y) { - int pi = pol.numVerts - 1; + int pi = pol.numVerts; bool diry = (y < pol.vert[pi].y); bool curdir; bool r = false; diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp index f9ce4ce817..0e234f6f16 100644 --- a/scumm/script_v90he.cpp +++ b/scumm/script_v90he.cpp @@ -452,7 +452,7 @@ void ScummEngine_v90he::o90_getSegmentAngle() { } void ScummEngine_v90he::o90_startScriptUnk() { - int args[16]; + int args[24]; int script, cycle; byte flags; @@ -464,7 +464,7 @@ void ScummEngine_v90he::o90_startScriptUnk() { } void ScummEngine_v90he::o90_jumpToScriptUnk() { - int args[16]; + int args[24]; int script, cycle; byte flags; @@ -1119,6 +1119,26 @@ void ScummEngine_v90he::o90_unknown28() { debug(1,"o90_unknown28 stub (%d)", subOp); } +int ScummEngine_v90he::getWizImageStates(int resnum) { + const uint8 *dataPtr = getResourceAddress(rtImage, resnum); + assert(dataPtr); + if (READ_UINT32(dataPtr) == MKID('MULT')) { + const byte *offs, *wrap; + + wrap = findResource(MKID('WRAP'), dataPtr); + if (wrap == NULL) + return 1; + + offs = findResourceData(MKID('OFFS'), wrap); + if (offs == NULL) + return 1; + + return(getResourceDataSize(offs) / 4); + } else { + return 1; + } +} + void ScummEngine_v90he::o90_unknown29() { int state, resId; uint32 w, h; @@ -1153,8 +1173,8 @@ void ScummEngine_v90he::o90_unknown29() { push(h); break; case 6: - pop(); - push(0); + resId = pop(); + push(getWizImageStates(resId)); break; case 15: pop(); |