aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2005-04-12 02:29:50 +0000
committerTravis Howell2005-04-12 02:29:50 +0000
commitdea27e2c63bbedcc1dfb51bfb1c0ace902281e2e (patch)
tree130ba16262b7e4618f95fd10b5a61fcc6aac43c2
parente096cf83f28025233728f4e7b6cf80ee85ca6aad (diff)
downloadscummvm-rg350-dea27e2c63bbedcc1dfb51bfb1c0ace902281e2e.tar.gz
scummvm-rg350-dea27e2c63bbedcc1dfb51bfb1c0ace902281e2e.tar.bz2
scummvm-rg350-dea27e2c63bbedcc1dfb51bfb1c0ace902281e2e.zip
Work in progress on opcodeE0 for HE games.
Cleanup. svn-id: r17560
-rw-r--r--scumm/actor.cpp23
-rw-r--r--scumm/actor.h1
-rw-r--r--scumm/intern.h2
-rw-r--r--scumm/script_v100he.cpp42
-rw-r--r--scumm/script_v6he.cpp18
-rw-r--r--scumm/script_v72he.cpp18
-rw-r--r--scumm/script_v80he.cpp205
7 files changed, 204 insertions, 105 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp
index f9cf50eb18..00ebacd764 100644
--- a/scumm/actor.cpp
+++ b/scumm/actor.cpp
@@ -578,6 +578,29 @@ void Actor::setDirection(int direction) {
_needRedraw = true;
}
+void Actor::drawActorToBackBuf(int x, int y) {
+ int curTop = _top;
+ int curBottom = _bottom;
+
+ _pos.x = x;
+ _pos.y = y;
+
+ _drawToBackBuf = true;
+ _needRedraw = true;
+ drawActorCostume();
+
+ _drawToBackBuf = false;
+ _needRedraw = true;
+ drawActorCostume();
+ _needRedraw = false;
+
+ if (_top > curTop)
+ _top = curTop;
+ if (_bottom < curBottom)
+ _bottom = curBottom;
+}
+
+
void Actor::putActor(int dstX, int dstY, byte newRoom) {
if (_visible && _vm->_currentRoom != newRoom && _vm->getTalkingActor() == _number) {
_vm->stopTalk();
diff --git a/scumm/actor.h b/scumm/actor.h
index 7580b418fa..6e45845bed 100644
--- a/scumm/actor.h
+++ b/scumm/actor.h
@@ -191,6 +191,7 @@ public:
void turnToDirection(int newdir);
void walkActor();
void walkActorOld();
+ void drawActorToBackBuf(int x, int y);
void drawActorCostume(bool hitTestMode = false);
void animateCostume();
void setActorCostume(int c);
diff --git a/scumm/intern.h b/scumm/intern.h
index a1ffcc8293..408a2a90ab 100644
--- a/scumm/intern.h
+++ b/scumm/intern.h
@@ -872,6 +872,8 @@ protected:
void loadImgSpot(int resId, int state, int16 &x, int16 &y);
void loadWizCursor(int resId);
+ void unknownE0(int x1, int y1, int x, int cycles, int arg_10, int type, int resNum);
+ void unknownE0Helper(int x, int y, int flags);
/* HE version 80 script opcodes */
void o80_loadSBNG();
diff --git a/scumm/script_v100he.cpp b/scumm/script_v100he.cpp
index 4217385073..63f5c5c893 100644
--- a/scumm/script_v100he.cpp
+++ b/scumm/script_v100he.cpp
@@ -817,13 +817,12 @@ void ScummEngine_v100he::o100_dimArray() {
}
void ScummEngine_v100he::o100_unknownE0() {
- // wizImage related
- int b, c, d, num, x1, y1, type = 0;
+ int id, unk1, unk2, x, x1, y1, type;
- b = pop();
- num = pop();
- c = pop();
- d = pop();
+ unk2 = pop();
+ id = pop();
+ unk1 = pop();
+ x = pop();
y1 = pop();
x1 = pop();
@@ -831,45 +830,20 @@ void ScummEngine_v100he::o100_unknownE0() {
switch (subOp) {
case 1:
- {
- Actor *a = derefActorSafe(num, "o100_unknownE0");
- int top_actor = a->_top;
- int bottom_actor = a->_bottom;
- a->_drawToBackBuf = true;
- a->_needRedraw = true;
- a->drawActorCostume();
- a->_drawToBackBuf = false;
- a->_needRedraw = true;
- a->drawActorCostume();
- a->_needRedraw = false;
-
- if (a->_top > top_actor)
- a->_top = top_actor;
- if (a->_bottom < bottom_actor)
- a->_bottom = bottom_actor;
-
type = 2;
- }
+ unknownE0(x1, y1, x, unk1, unk2, type, id);
break;
case 20:
type = 1;
+ unknownE0(x1, y1, x, unk1, unk2, type, id);
break;
case 40:
- _wizParams.processFlags |= kWPFSetPos;
- _wizParams.img.flags = 0;
- _wizParams.img.state = 0;
- _wizParams.img.y1 = y1;
- _wizParams.img.x1 = x1;
- _wizParams.img.resNum = num;
- displayWizComplexImage(&_wizParams);
-
type = 3;
+ unknownE0(x1, y1, x, unk1, unk2, type, id);
break;
default:
error("o100_unknownE0: default case %d", subOp);
}
-
- debug(1,"o100_unknownE0 stub: type %d (%d, num %d, %d, %d, y %d, x %d)", type, b, num, c, d, y1, x1);
}
void ScummEngine_v100he::o100_drawObject() {
diff --git a/scumm/script_v6he.cpp b/scumm/script_v6he.cpp
index eff6626ec8..b697f8257d 100644
--- a/scumm/script_v6he.cpp
+++ b/scumm/script_v6he.cpp
@@ -725,23 +725,7 @@ void ScummEngine_v60he::o60_actorOps() {
a->initActor(2);
break;
case 218:
- {
- int top_actor = a->_top;
- int bottom_actor = a->_bottom;
- a->_drawToBackBuf = true;
- a->_needRedraw = true;
- a->drawActorCostume();
- a->_drawToBackBuf = false;
- a->_needRedraw = true;
- a->drawActorCostume();
- a->_needRedraw = false;
-
- if (a->_top > top_actor)
- a->_top = top_actor;
- if (a->_bottom < bottom_actor)
- a->_bottom = bottom_actor;
-
- }
+ a->drawActorToBackBuf(a->_pos.x, a->_pos.y);
break;
case 219:
a->_drawToBackBuf = false;
diff --git a/scumm/script_v72he.cpp b/scumm/script_v72he.cpp
index 76c2ce85c3..a78b073100 100644
--- a/scumm/script_v72he.cpp
+++ b/scumm/script_v72he.cpp
@@ -1230,23 +1230,7 @@ void ScummEngine_v72he::o72_actorOps() {
a->initActor(2);
break;
case 218:
- {
- int top_actor = a->_top;
- int bottom_actor = a->_bottom;
- a->_drawToBackBuf = true;
- a->_needRedraw = true;
- a->drawActorCostume();
- a->_drawToBackBuf = false;
- a->_needRedraw = true;
- a->drawActorCostume();
- a->_needRedraw = false;
-
- if (a->_top > top_actor)
- a->_top = top_actor;
- if (a->_bottom < bottom_actor)
- a->_bottom = bottom_actor;
-
- }
+ a->drawActorToBackBuf(a->_pos.x, a->_pos.y);
break;
case 219:
a->_drawToBackBuf = false;
diff --git a/scumm/script_v80he.cpp b/scumm/script_v80he.cpp
index 73b820ad86..d12d9b75c0 100644
--- a/scumm/script_v80he.cpp
+++ b/scumm/script_v80he.cpp
@@ -598,14 +598,171 @@ void ScummEngine_v80he::o80_drawWizPolygon() {
displayWizImage(&wi);
}
+void ScummEngine_v80he::unknownE0(int x1, int y1, int x, int unk1, int unk2, int type, int id) {
+ debug(0,"unknownE0: x1 %d y1 %d x %d unk1 %d, unk2 %d type %d id %d", x1, y1, x, unk1, unk2, type, id);
+
+ int eax, ebx, ecx, y, edp, edx, esi;
+ int var_4, var_8, var_C;
+
+ // edx is never set?
+ edx = 0;
+
+ ebx = 0;
+ var_C = 0;
+
+ if (unk2 < 0) {
+ unk2 = -unk2;
+ }
+ if (unk2 == 0) {
+ unk2 = 1;
+ }
+
+ eax = x;
+ ecx = x1;
+
+ esi = unk1;
+ y = y1;
+
+ eax -= ecx;
+ esi -= y;
+
+ var_8 = eax;
+ var_4 = esi;
+
+ edp = eax;
+ eax = esi;
+
+ edp ^= edx;
+ edp -= edx;
+
+ eax ^= edx;
+ eax -= edx;
+
+ esi = edp;
+
+ y1 = eax;
+
+ if (eax > edp) {
+ esi = eax;
+ }
+
+ x = x1;
+ x1 = 0;
+
+ if (type == 2) {
+ Actor *a = derefActorSafe(id, "unknownE0");
+ a->drawActorToBackBuf(x1, y1);
+ } else if (type == 3) {
+ WizImage wi;
+ wi.flags = 0;
+ wi.y1 = y1;
+ wi.x1 = x1;
+ wi.resNum = id;
+ wi.state = 0;
+ displayWizImage(&wi);
+ } else {
+ unknownE0Helper(x1, y1, id);
+ }
+
+ for (int i = 0; i <= esi; i++) {
+ ecx = x1;
+ eax = y1;
+ ebx += edp;
+ ecx += eax;
+
+ eax ^= eax;
+ x1 = ecx;
+
+ if (ebx > esi) {
+ edx = var_8;
+ edx -= esi;
+
+ eax = 1;
+ int tmp = edx;
+ edx = x;
+ if (tmp >= 0) {
+ edx++;
+ } else {
+ edx--;
+ }
+
+ x = edx;
+ }
+ if (ecx > esi) {
+ eax = var_4;
+ ecx -= esi;
+
+ x1 = ecx;
+ if (eax >= 0) {
+ y++;
+ } else {
+ y--;
+ }
+ }
+
+ if (eax == 0)
+ continue;
+
+ ecx = var_C;
+ eax = ecx;
+ eax /= unk2;
+ ecx++;
+ var_C = ecx;
+
+ if (edx != 0 && esi != i)
+ continue;
+
+ if (type == 2) {
+ Actor *a = derefActorSafe(id, "unknownE0");
+ a->drawActorToBackBuf(x, y);
+ } else if (type == 3) {
+ WizImage wi;
+ wi.flags = 0;
+ wi.y1 = y;
+ wi.x1 = x;
+ wi.resNum = id;
+ wi.state = 0;
+ displayWizImage(&wi);
+ } else {
+ unknownE0Helper(x, y, id);
+ }
+ }
+}
+
+void ScummEngine_v80he::unknownE0Helper(int x, int y, int flags) {
+ VirtScreen *vs;
+
+ if (x < 0 || x > 639)
+ return;
+
+ if (y < 0)
+ return;
+
+ if ((vs = findVirtScreen(y)) == NULL)
+ return;
+
+ markRectAsDirty(vs->number, x, y, x, y + 1);
+
+ // TODO flags
+ if (flags & 0x4000) {
+
+
+ } else if (flags & 0x2000) {
+
+
+ } else if (flags & 0x8000) {
+
+
+ }
+}
+
void ScummEngine_v80he::o80_unknownE0() {
- // wizImage related
- int b, c, d, num, x1, y1, type = 0;
+ int id, unk1, unk2, x, x1, y1, type;
- b = pop();
- num = pop();
- c = pop();
- d = pop();
+ unk2 = pop();
+ id = pop();
+ unk1 = pop();
+ x = pop();
y1 = pop();
x1 = pop();
@@ -613,47 +770,21 @@ void ScummEngine_v80he::o80_unknownE0() {
switch (subOp) {
case 55:
- {
- Actor *a = derefActorSafe(num, "o80_unknownE0");
- int top_actor = a->_top;
- int bottom_actor = a->_bottom;
- a->_drawToBackBuf = true;
- a->_needRedraw = true;
- a->drawActorCostume();
- a->_drawToBackBuf = false;
- a->_needRedraw = true;
- a->drawActorCostume();
- a->_needRedraw = false;
-
- if (a->_top > top_actor)
- a->_top = top_actor;
- if (a->_bottom < bottom_actor)
- a->_bottom = bottom_actor;
-
- type = 2;
- }
+ type = 2;
+ unknownE0(x1, y1, x, unk1, unk2, type, id);
break;
case 63:
- {
- WizImage wi;
- wi.flags = 0;
- wi.y1 = y1;
- wi.x1 = x1;
- wi.resNum = num;
- wi.state = 0;
- displayWizImage(&wi);
-
- type = 3;
- }
+ type = 3;
+ unknownE0(x1, y1, x, unk1, unk2, type, id);
break;
case 66:
type = 1;
+ unknownE0(x1, y1, x, unk1, unk2, type, id);
break;
default:
error("o80_unknownE0: default case %d", subOp);
}
- debug(1,"o80_unknownE0 stub: type %d (%d, num %d, %d, %d, y %d, x %d)", type, b, num, c, d, y1, x1);
}
void ScummEngine_v80he::o80_pickVarRandom() {