DREAMWEB: Use of the new feature of the generator to stop generating code for 'backobject' and 'mainman' (because addr_backobject is used)

This commit is contained in:
Bertrand Augereau 2011-07-29 01:12:29 +02:00
parent 16348053c7
commit 5de064f1e4
4 changed files with 14 additions and 156 deletions

View File

@ -80,6 +80,8 @@ generator = cpp(context, "DreamGen", blacklist = [
'facerightway',
], skip_output = [
# These functions are processed but not output
'dreamweb'
'dreamweb',
'backobject',
'mainman',
])
generator.generate('dreamweb') #start routine

View File

@ -2258,104 +2258,6 @@ over1001:
data.word(kTakeoff) = 320;
}
void DreamGenContext::mainman() {
STACK_CHECK;
_cmp(data.byte(kResetmanxy), 1);
if (!flags.z())
goto notinnewroom;
data.byte(kResetmanxy) = 0;
al = data.byte(kRyanx);
ah = data.byte(kRyany);
es.word(bx+10) = ax;
es.byte(bx+29) = 0;
goto executewalk;
notinnewroom:
_dec(es.byte(bx+22));
_cmp(es.byte(bx+22), -1);
if (flags.z())
goto executewalk;
return;
executewalk:
es.byte(bx+22) = 0;
al = data.byte(kTurntoface);
_cmp(al, data.byte(kFacing));
if (flags.z())
goto facingok;
aboutturn();
goto notwalk;
facingok:
_cmp(data.byte(kTurndirection), 0);
if (flags.z())
goto alreadyturned;
_cmp(data.byte(kLinepointer), 254);
if (!flags.z())
goto alreadyturned;
data.byte(kReasseschanges) = 1;
al = data.byte(kFacing);
_cmp(al, data.byte(kLeavedirection));
if (!flags.z())
goto alreadyturned;
checkforexit();
alreadyturned:
data.byte(kTurndirection) = 0;
_cmp(data.byte(kLinepointer), 254);
if (!flags.z())
goto walkman;
es.byte(bx+29) = 0;
goto notwalk;
walkman:
al = es.byte(bx+29);
_inc(al);
_cmp(al, 11);
if (!flags.z())
goto notanimend1;
al = 1;
notanimend1:
es.byte(bx+29) = al;
walking();
_cmp(data.byte(kLinepointer), 254);
if (flags.z())
goto afterwalk;
al = data.byte(kFacing);
_and(al, 1);
if (flags.z())
goto isdouble;
al = es.byte(bx+29);
_cmp(al, 2);
if (flags.z())
goto afterwalk;
_cmp(al, 7);
if (flags.z())
goto afterwalk;
isdouble:
walking();
afterwalk:
_cmp(data.byte(kLinepointer), 254);
if (!flags.z())
goto notwalk;
al = data.byte(kTurntoface);
_cmp(al, data.byte(kFacing));
if (!flags.z())
goto notwalk;
data.byte(kReasseschanges) = 1;
al = data.byte(kFacing);
_cmp(al, data.byte(kLeavedirection));
if (!flags.z())
goto notwalk;
checkforexit();
notwalk:
al = data.byte(kFacing);
ah = 0;
di = 1105;
_add(di, ax);
al = cs.byte(di);
_add(al, es.byte(bx+29));
es.byte(bx+15) = al;
ax = es.word(bx+10);
data.byte(kRyanx) = al;
data.byte(kRyany) = ah;
}
void DreamGenContext::aboutturn() {
STACK_CHECK;
_cmp(data.byte(kTurndirection), 1);
@ -2841,60 +2743,6 @@ isthunder1:
playchannel1();
}
void DreamGenContext::backobject() {
STACK_CHECK;
ds = data.word(kSetdat);
di = es.word(bx+20);
al = es.byte(bx+18);
_cmp(al, 0);
if (flags.z())
goto _tmp48z;
_dec(al);
es.byte(bx+18) = al;
return /* (finishback) */;
_tmp48z:
al = ds.byte(di+7);
es.byte(bx+18) = al;
al = ds.byte(di+8);
_cmp(al, 6);
if (!flags.z())
goto notwidedoor;
widedoor();
return /* (finishback) */;
notwidedoor:
_cmp(al, 5);
if (!flags.z())
goto notrandom;
random();
return /* (finishback) */;
notrandom:
_cmp(al, 4);
if (!flags.z())
goto notlockdoor;
lockeddoorway();
return /* (finishback) */;
notlockdoor:
_cmp(al, 3);
if (!flags.z())
goto notlift;
liftsprite();
return /* (finishback) */;
notlift:
_cmp(al, 2);
if (!flags.z())
goto notdoor;
doorway();
return /* (finishback) */;
notdoor:
_cmp(al, 1);
if (!flags.z())
goto steadyob;
constant();
return /* (finishback) */;
steadyob:
steady();
}
void DreamGenContext::liftnoise() {
STACK_CHECK;
_cmp(data.byte(kReallocation), 5);

View File

@ -115,7 +115,7 @@ void DreamGenContext::spriteupdate() {
if (updateCallback != 0xffff) {
sprite->w24 = sprite->w2;
if (updateCallback == addr_mainman) // NB : Let's consider the callback as an enum while more code is not ported to C++
mainmanCPP(sprite);
mainman(sprite);
else {
assert(updateCallback == addr_backobject);
backobject(sprite);
@ -135,7 +135,11 @@ void DreamGenContext::initman() {
sprite->b29 = 0;
}
void DreamGenContext::mainmanCPP(Sprite *sprite) {
void DreamGenContext::mainman() {
assert(false);
}
void DreamGenContext::mainman(Sprite *sprite) {
push(es);
push(ds);
@ -267,6 +271,10 @@ void DreamGenContext::aboutturn(Sprite *sprite) {
}
}
void DreamGenContext::backobject() {
assert(false);
}
void DreamGenContext::backobject(Sprite *sprite) {
push(ds);

View File

@ -69,7 +69,7 @@
Sprite *makesprite(uint8 x, uint8 y, uint16 updateCallback, uint16 somethingInDx, uint16 somethingInDi);
void spriteupdate();
void initman();
void mainmanCPP(Sprite *sprite);
void mainman(Sprite *sprite);
void facerightway();
void walking();
void walking(Sprite *sprite);