DREAMWEB: 'makebackob' ported

This commit is contained in:
Bertrand Augereau 2011-07-27 17:53:50 +02:00
parent b5c6ac150b
commit fe73a24078
6 changed files with 28 additions and 38 deletions

View File

@ -75,6 +75,7 @@ generator = cpp(context, "DreamGen", blacklist = [
'cancelch0',
'cancelch1',
'getroomspaths',
'makebackob',
'facerightway',
])
generator.generate('dreamweb') #start routine

View File

@ -7476,40 +7476,6 @@ blankframe:
goto showobsloop;
}
void DreamGenContext::makebackob() {
STACK_CHECK;
_cmp(data.byte(kNewobs), 0);
if (flags.z())
return /* (nomake) */;
al = es.byte(si+5);
ah = es.byte(si+8);
push(si);
push(ax);
push(si);
ax = data.word(kObjectx);
bx = data.word(kObjecty);
ah = bl;
si = ax;
cx = 49520;
dx = data.word(kSetframes);
di = (0);
makesprite();
ax = pop();
es.word(bx+20) = ax;
ax = pop();
_cmp(al, 255);
if (!flags.z())
goto usedpriority;
al = 0;
usedpriority:
es.byte(bx+23) = al;
es.byte(bx+30) = ah;
es.byte(bx+16) = 0;
es.byte(bx+18) = 0;
es.byte(bx+19) = 0;
si = pop();
}
void DreamGenContext::showallfree() {
STACK_CHECK;
es = data.word(kBuffers);
@ -21046,7 +21012,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_addlength: addlength(); break;
case addr_drawflags: drawflags(); break;
case addr_showallobs: showallobs(); break;
case addr_makebackob: makebackob(); break;
case addr_showallfree: showallfree(); break;
case addr_showallex: showallex(); break;
case addr_calcfrframe: calcfrframe(); break;

View File

@ -505,7 +505,6 @@ public:
static const uint16 addr_calcfrframe = 0xc454;
static const uint16 addr_showallex = 0xc450;
static const uint16 addr_showallfree = 0xc44c;
static const uint16 addr_makebackob = 0xc448;
static const uint16 addr_showallobs = 0xc444;
static const uint16 addr_drawflags = 0xc43c;
static const uint16 addr_addlength = 0xc438;
@ -1559,7 +1558,7 @@ public:
void discops();
//void printdirect();
void delthisone();
void makebackob();
//void makebackob();
void middlepanel();
void dumpwatch();
void saveload();

View File

@ -31,7 +31,8 @@ struct Sprite {
uint16 w12;
uint8 b14;
uint8 b15;
uint16 w16;
uint8 b16;
uint8 b17;
uint8 delay;
uint8 frame;
uint16 obj_data;

View File

@ -825,5 +825,28 @@ uint8 *DreamGenContext::getroomspathsCPP() {
return (uint8 *)result;
}
void DreamGenContext::makebackob() {
if (data.byte(kNewobs) == 0)
return;
uint8 priority = es.byte(si+5);
uint8 type = es.byte(si+8);
Sprite *sprite = makesprite(data.word(kObjectx), data.word(kObjecty), addr_backobject, data.word(kSetframes), 0);
// Recover es:bx from sprite
es = data.word(kBuffers);
bx = kSpritetable;
Sprite *sprites = (Sprite *)es.ptr(bx, sizeof(Sprite) * 16);
bx += sizeof(Sprite) * (sprite - sprites);
//
WRITE_LE_UINT16(&sprite->obj_data, si);
if (priority == 255)
priority = 0;
sprite->priority = priority;
sprite->type = type;
sprite->b16 = 0;
sprite->delay = 0;
sprite->frame = 0;
}
} /*namespace dreamgen */

View File

@ -90,6 +90,7 @@
void turnpathoffCPP(uint8 param);
void getroomspaths();
uint8 *getroomspathsCPP();
void makebackob();
void modifychar();
void lockmon();
void cancelch0();