From fe73a2407820000d0321173a50e0d98dbcfc213f Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Wed, 27 Jul 2011 17:53:50 +0200 Subject: [PATCH] DREAMWEB: 'makebackob' ported --- devtools/tasmrecover/tasm-recover | 1 + engines/dreamweb/dreamgen.cpp | 35 ------------------------------- engines/dreamweb/dreamgen.h | 3 +-- engines/dreamweb/structs.h | 3 ++- engines/dreamweb/stubs.cpp | 23 ++++++++++++++++++++ engines/dreamweb/stubs.h | 1 + 6 files changed, 28 insertions(+), 38 deletions(-) diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index e0b0e213941..f550cb0826d 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -75,6 +75,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'cancelch0', 'cancelch1', 'getroomspaths', + 'makebackob', 'facerightway', ]) generator.generate('dreamweb') #start routine diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 182a4411ddb..9fa7f169959 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -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; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 130e0f0b5be..2b7149621b7 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -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(); diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index e274375cf46..ac304ae2c24 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -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; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 140e278d1dd..8c278b5990c 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -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 */ diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 559c95625db..e72229639be 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -90,6 +90,7 @@ void turnpathoffCPP(uint8 param); void getroomspaths(); uint8 *getroomspathsCPP(); + void makebackob(); void modifychar(); void lockmon(); void cancelch0();