From e0b77beb99138cf840dee93037ca11ea98a9e333 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Fri, 2 Sep 2011 09:35:52 +0200 Subject: DREAMWEB: 'obtoinv' ported to C++ --- engines/dreamweb/dreamgen.cpp | 61 ------------------------------------------- engines/dreamweb/dreamgen.h | 3 +-- engines/dreamweb/stubs.cpp | 20 ++++++++++++++ engines/dreamweb/stubs.h | 2 ++ 4 files changed, 23 insertions(+), 63 deletions(-) (limited to 'engines/dreamweb') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index c28c289b77..3ee8c791ce 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -3955,66 +3955,6 @@ findopen2a: goto findopen1a; } -void DreamGenContext::obtoinv() { - STACK_CHECK; - push(bx); - push(es); - push(si); - push(ax); - push(ax); - push(di); - push(bx); - ds = data.word(kIcons1); - _sub(di, 2); - _sub(bx, 1); - al = 10; - ah = 0; - showframe(); - bx = pop(); - di = pop(); - ax = pop(); - _cmp(al, 255); - if (flags.z()) - goto finishfill; - push(bx); - push(di); - push(ax); - ds = data.word(kExtras); - _cmp(ah, 4); - if (flags.z()) - goto isanextra; - ds = data.word(kFreeframes); -isanextra: - cl = al; - _add(al, al); - _add(al, cl); - _inc(al); - ah = 128; - _add(bx, 19); - _add(di, 18); - showframe(); - ax = pop(); - di = pop(); - bx = pop(); - push(bx); - getanyaddir(); - isitworn(); - bx = pop(); - if (!flags.z()) - goto finishfill; - ds = data.word(kIcons1); - _sub(di, 3); - _sub(bx, 2); - al = 7; - ah = 0; - showframe(); -finishfill: - ax = pop(); - si = pop(); - es = pop(); - bx = pop(); -} - void DreamGenContext::examineob() { STACK_CHECK; data.byte(kPointermode) = 0; @@ -17368,7 +17308,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_fillopen: fillopen(); break; case addr_findallryan: findallryan(); break; case addr_findallopen: findallopen(); break; - case addr_obtoinv: obtoinv(); break; case addr_examineob: examineob(); break; case addr_makemainscreen: makemainscreen(); break; case addr_getbackfromob: getbackfromob(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index f3b502a8f6..68e7b65ac2 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -494,7 +494,6 @@ public: static const uint16 addr_getbackfromob = 0xc344; static const uint16 addr_makemainscreen = 0xc340; static const uint16 addr_examineob = 0xc33c; - static const uint16 addr_obtoinv = 0xc330; static const uint16 addr_findallopen = 0xc32c; static const uint16 addr_findallryan = 0xc328; static const uint16 addr_fillopen = 0xc324; @@ -1480,7 +1479,7 @@ public: void checkspeed(); //void printchar(); void showkeypad(); - void obtoinv(); + //void obtoinv(); //void getroomdata(); void removeobfrominv(); void usecoveredbox(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 731396697d..e6c868530d 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1796,5 +1796,25 @@ void DreamGenContext::makeworn(DynObject *object) { object->id[1] = 'E'-'A'; } +void DreamGenContext::obtoinv() { + obtoinv(al, ah, di, bx); +} + +void DreamGenContext::obtoinv(uint8 index, uint8 flag, uint16 x, uint16 y) { + Frame *icons1 = (Frame *)segRef(data.word(kIcons1)).ptr(0, 0); + showframe(icons1, x - 2, y - 1, 10, 0); + if (index == 0xff) + return; + + Frame *extras = (Frame *)segRef(data.word(kExtras)).ptr(0, 0); + Frame *frees = (Frame *)segRef(data.word(kFreeframes)).ptr(0, 0); + Frame *frames = (ah == 4) ? extras : frees; + showframe(frames, x + 18, y + 19, 3 * index + 1, 128); + const DynObject *object = (const DynObject *)getanyaddir(index, flag); + bool worn = isitworn(object); + if (worn) + showframe(icons1, x - 3, y - 2, 7, 0); +} + } /*namespace dreamgen */ diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 4d22fcc0bf..70ba5f70d5 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -224,4 +224,6 @@ bool isitworn(const DynObject *object); void makeworn(); void makeworn(DynObject *object); + void obtoinv(); + void obtoinv(uint8 index, uint8 flag, uint16 x, uint16 y); -- cgit v1.2.3