DREAMWEB: 'setallchanges' ported to C++

This commit is contained in:
Bertrand Augereau 2011-08-19 11:42:13 +02:00
parent 663ca4774f
commit eaa342fdd8
5 changed files with 17 additions and 25 deletions

View File

@ -135,6 +135,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'personnametext',
'findxyfrompath',
'findormake',
'setallchanges',
], skip_output = [
# These functions are processed but not output
'dreamweb',

View File

@ -11338,28 +11338,6 @@ void DreamGenContext::switchryanoff() {
data.byte(kRyanon) = 1;
}
void DreamGenContext::setallchanges() {
STACK_CHECK;
es = data.word(kBuffers);
bx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40)+(5*80));
setallloop:
ax = es.word(bx);
_cmp(al, 255);
if (flags.z())
return /* (endsetloop) */;
cx = es.word(bx+2);
_add(bx, 4);
_cmp(ah, data.byte(kReallocation));
if (!flags.z())
goto setallloop;
push(es);
push(bx);
dochange();
bx = pop();
es = pop();
goto setallloop;
}
void DreamGenContext::dochange() {
STACK_CHECK;
_cmp(ch, 0);
@ -18692,7 +18670,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_removefreeobject: removefreeobject(); break;
case addr_switchryanon: switchryanon(); break;
case addr_switchryanoff: switchryanoff(); break;
case addr_setallchanges: setallchanges(); break;
case addr_dochange: dochange(); break;
case addr_autoappear: autoappear(); break;
case addr_setuptimeduse: setuptimeduse(); break;

View File

@ -304,7 +304,6 @@ public:
static const uint16 addr_setuptimeduse = 0xc71c;
static const uint16 addr_autoappear = 0xc70c;
static const uint16 addr_dochange = 0xc708;
static const uint16 addr_setallchanges = 0xc704;
static const uint16 addr_switchryanoff = 0xc700;
static const uint16 addr_switchryanon = 0xc6fc;
static const uint16 addr_removefreeobject = 0xc6f4;
@ -2023,7 +2022,7 @@ public:
void openhoteldoor2();
void getridoftempsp();
void scanfornames();
void setallchanges();
//void setallchanges();
void readsetdata();
//void printboth();
void standardload();

View File

@ -1066,6 +1066,20 @@ void DreamGenContext::findormake(uint8 b0, uint8 b2, uint8 b3) {
}
}
void DreamGenContext::setallchanges() {
Change *change = (Change *)segRef(data.word(kBuffers)).ptr(kListofchanges, sizeof(Change));
while (change->b0 != 0xff) {
if (change->location == data.byte(kReallocation)) {
al = change->b0;
ah = change->location;
cl = change->b2;
ch = change->b3;
dochange();
}
++change;
}
}
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

View File

@ -151,5 +151,6 @@
void findxyfrompath();
void findormake();
void findormake(uint8 b0, uint8 b2, uint8 b3);
void setallchanges();
bool isCD();