mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-23 20:51:14 +00:00
Work in progress on opcodeE0 for HE games.
Cleanup. svn-id: r17560
This commit is contained in:
parent
e096cf83f2
commit
dea27e2c63
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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() {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -598,14 +598,171 @@ void ScummEngine_v80he::o80_drawWizPolygon() {
|
||||
displayWizImage(&wi);
|
||||
}
|
||||
|
||||
void ScummEngine_v80he::o80_unknownE0() {
|
||||
// wizImage related
|
||||
int b, c, d, num, x1, y1, type = 0;
|
||||
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);
|
||||
|
||||
b = pop();
|
||||
num = pop();
|
||||
c = pop();
|
||||
d = pop();
|
||||
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() {
|
||||
int id, unk1, unk2, x, x1, y1, type;
|
||||
|
||||
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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user