aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scumm/intern.h3
-rw-r--r--scumm/object.cpp2
-rw-r--r--scumm/script_v100he.cpp32
-rw-r--r--scumm/script_v72he.cpp30
-rw-r--r--scumm/script_v7he.cpp6
-rw-r--r--scumm/script_v80he.cpp2
-rw-r--r--scumm/script_v90he.cpp2
-rw-r--r--scumm/wiz_he.cpp17
-rw-r--r--scumm/wiz_he.h2
9 files changed, 82 insertions, 14 deletions
diff --git a/scumm/intern.h b/scumm/intern.h
index 4e49d1035a..004ee94a54 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -932,7 +932,7 @@ protected:
void o72_getPixel();
void o72_pickVarRandom();
void o72_redimArray();
- void o72_checkGlobQueue();
+ void o72_isResourceLoaded();
void o72_readINI();
void o72_writeINI();
void o72_getResourceSize();
@@ -1300,6 +1300,7 @@ protected:
void o100_cursorCommand();
void o100_wait();
void o100_writeFile();
+ void o100_isResourceLoaded();
void o100_getResourceSize();
void o100_getSpriteGroupInfo();
void o100_getPaletteData();
diff --git a/scumm/object.cpp b/scumm/object.cpp
index d04d161d46..dcf53569d0 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -875,7 +875,7 @@ void ScummEngine_v70he::clearDrawQueues() {
void ScummEngine_v80he::clearDrawQueues() {
ScummEngine_v70he::clearDrawQueues();
- _wiz.imageNumClear();
+ _wiz.clearWizBuffer();
}
diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp
index e5aa8baea6..45d18ccf8b 100644
--- a/scumm/script_v100he.cpp
+++ b/scumm/script_v100he.cpp
@@ -269,7 +269,7 @@ void ScummEngine_v100he::setupOpcodes() {
/* B4 */
OPCODE(o72_getNumFreeArrays),
OPCODE(o72_getArrayDimSize),
- OPCODE(o72_checkGlobQueue),
+ OPCODE(o100_isResourceLoaded),
OPCODE(o100_getResourceSize),
/* B8 */
OPCODE(o100_getSpriteGroupInfo),
@@ -2198,6 +2198,36 @@ void ScummEngine_v100he::o100_writeFile() {
debug(1, "o100_writeFile: slot %d, subOp %d", slot, subOp);
}
+void ScummEngine_v100he::o100_isResourceLoaded() {
+ // Reports percentage of resource loaded by queue
+ int type;
+
+ byte subOp = fetchScriptByte();
+ int idx = pop();
+
+ switch (subOp) {
+ case 25:
+ type = rtCostume;
+ break;
+ case 41:
+ type = rtImage;
+ break;
+ case 62:
+ type = rtRoom;
+ break;
+ case 66:
+ type = rtScript;
+ break;
+ case 72:
+ type = rtSound;
+ break;
+ default:
+ error("o100_isResourceLoaded: default case %d", subOp);
+ }
+
+ push (res.isResourceLoaded(type, idx) ? 100 : 0);
+}
+
void ScummEngine_v100he::o100_getResourceSize() {
const byte *ptr;
int size, type;
diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp
index 9a0e25fb18..36cea0253a 100644
--- a/scumm/script_v72he.cpp
+++ b/scumm/script_v72he.cpp
@@ -346,7 +346,7 @@ void ScummEngine_v72he::setupOpcodes() {
/* F0 */
OPCODE(o70_concatString),
OPCODE(o70_compareString),
- OPCODE(o72_checkGlobQueue),
+ OPCODE(o72_isResourceLoaded),
OPCODE(o72_readINI),
/* F4 */
OPCODE(o72_writeINI),
@@ -2107,12 +2107,34 @@ void ScummEngine_v72he::copyArrayHelper(ArrayHeader *ah, int idx2, int idx1, int
}
}
-void ScummEngine_v72he::o72_checkGlobQueue() {
+void ScummEngine_v72he::o72_isResourceLoaded() {
+ // Reports percentage of resource loaded by queue
+ int type;
+
byte subOp = fetchScriptByte();
int idx = pop();
- debug(1,"o72_checkGlobQueue stub (%d, %d)", subOp, idx);
- push(100);
+ switch (subOp) {
+ case 18:
+ type = rtImage;
+ break;
+ case 226:
+ type = rtRoom;
+ break;
+ case 227:
+ type = rtCostume;
+ break;
+ case 228:
+ type = rtSound;
+ break;
+ case 229:
+ type = rtScript;
+ break;
+ default:
+ error("o72_isResourceLoaded: default case %d", subOp);
+ }
+
+ push (res.isResourceLoaded(type, idx) ? 100 : 0);
}
void ScummEngine_v72he::o72_readINI() {
diff --git a/scumm/script_v7he.cpp b/scumm/script_v7he.cpp
index 925dc82d3f..5ba8004a14 100644
--- a/scumm/script_v7he.cpp
+++ b/scumm/script_v7he.cpp
@@ -512,6 +512,7 @@ void ScummEngine_v70he::o70_resourceRoutines() {
subOp = fetchScriptByte();
+ debug(0, "o70_resourceRoutines: case %d", subOp);
switch (subOp) {
case 100: // SO_LOAD_SCRIPT
resid = pop();
@@ -605,22 +606,27 @@ void ScummEngine_v70he::o70_resourceRoutines() {
case 120:
// Queue load script
resid = pop();
+ ensureResourceLoaded(rtScript, resid);
break;
case 121:
// Queue load sound
resid = pop();
+ ensureResourceLoaded(rtSound, resid);
break;
case 122:
// Queue load costume
resid = pop();
+ ensureResourceLoaded(rtCostume, resid);
break;
case 123:
// Queue load room image
resid = pop();
+ ensureResourceLoaded(rtRoomImage, resid);
break;
case 203:
// Queue load image
resid = pop();
+ ensureResourceLoaded(rtImage, resid);
break;
case 159:
resid = pop();
diff --git a/scumm/script_v80he.cpp b/scumm/script_v80he.cpp
index e949a7172e..05e1a69931 100644
--- a/scumm/script_v80he.cpp
+++ b/scumm/script_v80he.cpp
@@ -346,7 +346,7 @@ void ScummEngine_v80he::setupOpcodes() {
/* F0 */
OPCODE(o70_concatString),
OPCODE(o70_compareString),
- OPCODE(o72_checkGlobQueue),
+ OPCODE(o72_isResourceLoaded),
OPCODE(o72_readINI),
/* F4 */
OPCODE(o72_writeINI),
diff --git a/scumm/script_v90he.cpp b/scumm/script_v90he.cpp
index 9cbc371623..4337af0757 100644
--- a/scumm/script_v90he.cpp
+++ b/scumm/script_v90he.cpp
@@ -344,7 +344,7 @@ void ScummEngine_v90he::setupOpcodes() {
/* F0 */
OPCODE(o70_concatString),
OPCODE(o70_compareString),
- OPCODE(o72_checkGlobQueue),
+ OPCODE(o72_isResourceLoaded),
OPCODE(o72_readINI),
/* F4 */
OPCODE(o72_writeINI),
diff --git a/scumm/wiz_he.cpp b/scumm/wiz_he.cpp
index 756d7cea01..5cb9aead52 100644
--- a/scumm/wiz_he.cpp
+++ b/scumm/wiz_he.cpp
@@ -36,7 +36,7 @@ Wiz::Wiz() {
_rectOverrideEnabled = false;
}
-void Wiz::imageNumClear() {
+void Wiz::clearWizBuffer() {
_imagesNum = 0;
}
@@ -948,13 +948,22 @@ void ScummEngine_v72he::getWizImageDim(int resNum, int state, int32 &w, int32 &h
void ScummEngine_v72he::displayWizImage(WizImage *pwi) {
if (_fullRedraw) {
assert(_wiz._imagesNum < ARRAYSIZE(_wiz._images));
- memcpy(&_wiz._images[_wiz._imagesNum], pwi, sizeof(WizImage));
+ WizImage *wi = &_wiz._images[_wiz._imagesNum];
+ wi->resNum = pwi->resNum;
+ wi->x1 = pwi->x1;
+ wi->y1 = pwi->y1;
+ wi->zorder = 0;
+ wi->state = pwi->state;
+ wi->flags = pwi->flags;
+ wi->xmapNum = 0;
+ wi->field_390 = 0;
+ wi->paletteNum = 0;
++_wiz._imagesNum;
} else if (pwi->flags & kWIFIsPolygon) {
- drawWizPolygon(pwi->resNum, pwi->state, pwi->x1, pwi->flags, pwi->xmapNum, 0, 0);
+ drawWizPolygon(pwi->resNum, pwi->state, pwi->x1, pwi->flags, 0, 0, 0);
} else {
const Common::Rect *r = NULL;
- drawWizImage(pwi->resNum, pwi->state, pwi->x1, pwi->y1, pwi->zorder, pwi->xmapNum, pwi->field_390, r, pwi->flags, 0, 0);
+ drawWizImage(pwi->resNum, pwi->state, pwi->x1, pwi->y1, 0, 0, 0, r, pwi->flags, 0, 0);
}
}
diff --git a/scumm/wiz_he.h b/scumm/wiz_he.h
index 2c3838db41..574ef016c5 100644
--- a/scumm/wiz_he.h
+++ b/scumm/wiz_he.h
@@ -144,7 +144,7 @@ struct Wiz {
WizPolygon _polygons[NUM_POLYGONS];
Wiz();
- void imageNumClear();
+ void clearWizBuffer();
Common::Rect _rectOverride;
bool _rectOverrideEnabled;