mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-07 02:39:56 +00:00
DREAMWEB: 'checkcoords' ported to C++
(Still has __dispatch_call dependency)
This commit is contained in:
parent
42e435c604
commit
7d5f6fedda
@ -151,6 +151,7 @@ generator = cpp(context, "DreamGen", blacklist = [
|
||||
'delpointer',
|
||||
'showblink',
|
||||
'dumpblink',
|
||||
'checkcoords',
|
||||
], skip_output = [
|
||||
# These functions are processed but not output
|
||||
'dreamweb',
|
||||
|
@ -15156,43 +15156,6 @@ alreadyrun:
|
||||
data.byte(kLastweapon) = 8;
|
||||
}
|
||||
|
||||
void DreamGenContext::checkcoords() {
|
||||
STACK_CHECK;
|
||||
_cmp(data.byte(kNewlocation), 255);
|
||||
if (flags.z())
|
||||
goto loop048;
|
||||
return;
|
||||
loop048:
|
||||
ax = cs.word(bx);
|
||||
_cmp(ax, 0x0ffff);
|
||||
if (flags.z())
|
||||
return /* (nonefound) */;
|
||||
push(bx);
|
||||
_cmp(data.word(kMousex), ax);
|
||||
if (flags.l())
|
||||
goto over045;
|
||||
ax = cs.word(bx+2);
|
||||
_cmp(data.word(kMousex), ax);
|
||||
if (!flags.l())
|
||||
goto over045;
|
||||
ax = cs.word(bx+4);
|
||||
_cmp(data.word(kMousey), ax);
|
||||
if (flags.l())
|
||||
goto over045;
|
||||
ax = cs.word(bx+6);
|
||||
_cmp(data.word(kMousey), ax);
|
||||
if (!flags.l())
|
||||
goto over045;
|
||||
ax = cs.word(bx+8);
|
||||
__dispatch_call(ax);
|
||||
ax = pop();
|
||||
return;
|
||||
over045:
|
||||
bx = pop();
|
||||
_add(bx, 10);
|
||||
goto loop048;
|
||||
}
|
||||
|
||||
void DreamGenContext::identifyob() {
|
||||
STACK_CHECK;
|
||||
_cmp(data.word(kWatchingtime), 0);
|
||||
@ -18257,7 +18220,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
|
||||
case addr_convnum: convnum(); break;
|
||||
case addr_mainscreen: mainscreen(); break;
|
||||
case addr_madmanrun: madmanrun(); break;
|
||||
case addr_checkcoords: checkcoords(); break;
|
||||
case addr_identifyob: identifyob(); break;
|
||||
case addr_checkifset: checkifset(); break;
|
||||
case addr_checkifex: checkifex(); break;
|
||||
|
@ -130,7 +130,6 @@ public:
|
||||
static const uint16 addr_checkifex = 0xc9e0;
|
||||
static const uint16 addr_checkifset = 0xc9dc;
|
||||
static const uint16 addr_identifyob = 0xc9d4;
|
||||
static const uint16 addr_checkcoords = 0xc9d0;
|
||||
static const uint16 addr_madmanrun = 0xc9cc;
|
||||
static const uint16 addr_mainscreen = 0xc9c8;
|
||||
static const uint16 addr_convnum = 0xc9c4;
|
||||
@ -1598,7 +1597,7 @@ public:
|
||||
void showouterpad();
|
||||
void getkeyandlogo();
|
||||
void selectob();
|
||||
void checkcoords();
|
||||
//void checkcoords();
|
||||
void dumpmenu();
|
||||
void chewy();
|
||||
void accesslighton();
|
||||
|
@ -54,6 +54,22 @@ struct Sprite {
|
||||
uint8 hidden;
|
||||
};
|
||||
|
||||
struct RectWithCallback {
|
||||
uint16 _xMin, _xMax;
|
||||
uint16 _yMin, _yMax;
|
||||
uint16 _callback;
|
||||
|
||||
uint16 xMin() const { return READ_LE_UINT16(&_xMin); }
|
||||
uint16 xMax() const { return READ_LE_UINT16(&_xMax); }
|
||||
uint16 yMin() const { return READ_LE_UINT16(&_yMin); }
|
||||
uint16 yMax() const { return READ_LE_UINT16(&_yMax); }
|
||||
uint16 callback() const { return READ_LE_UINT16(&_callback); }
|
||||
|
||||
bool contains(uint16 x, uint16 y) const {
|
||||
return (x >= xMin()) && (x < xMax()) && (y >= yMin()) && (y < yMax());
|
||||
}
|
||||
};
|
||||
|
||||
struct SetObject {
|
||||
uint8 b0;
|
||||
uint8 b1;
|
||||
|
@ -1308,6 +1308,25 @@ void DreamGenContext::dumpblink() {
|
||||
multidump(44, 32, 16, 12);
|
||||
}
|
||||
|
||||
void DreamGenContext::checkcoords() {
|
||||
checkcoords((const RectWithCallback *)cs.ptr(bx, 0));
|
||||
}
|
||||
|
||||
void DreamGenContext::checkcoords(const RectWithCallback *rectWithCallbacks) {
|
||||
if (data.byte(kNewlocation) != 0xff)
|
||||
return;
|
||||
|
||||
const RectWithCallback *rectWithCallback = rectWithCallbacks;
|
||||
while (rectWithCallback->xMin() != 0xffff) {
|
||||
if (rectWithCallback->contains(data.word(kMousex), data.word(kMousey))) {
|
||||
// TODO : Explicit dispatching
|
||||
__dispatch_call(rectWithCallback->callback());
|
||||
return;
|
||||
}
|
||||
++rectWithCallback;
|
||||
}
|
||||
}
|
||||
|
||||
bool DreamGenContext::isCD() {
|
||||
// The original sources has two codepaths depending if the game is 'if cd' or not
|
||||
// This is a hack to guess which version to use with the assumption that if we have a cd version
|
||||
|
@ -181,4 +181,6 @@
|
||||
void delpointer();
|
||||
void showblink();
|
||||
void dumpblink();
|
||||
void checkcoords();
|
||||
void checkcoords(const RectWithCallback *rectWithCallbacks);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user