From f4207b8149f562381f6a1b6ea4a908a6be9221c5 Mon Sep 17 00:00:00 2001 From: Bertrand Augereau Date: Sat, 20 Aug 2011 13:23:47 +0200 Subject: DREAMWEB: 'placesetobject' and 'removesetobject' ported to C++ --- engines/dreamweb/dreamgen.cpp | 28 ---------------------------- engines/dreamweb/dreamgen.h | 6 ++---- engines/dreamweb/stubs.cpp | 24 ++++++++++++++++++++---- engines/dreamweb/stubs.h | 4 ++++ 4 files changed, 26 insertions(+), 36 deletions(-) (limited to 'engines') diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index b3ca7508b7..7a48d7313d 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -11243,32 +11243,6 @@ void DreamGenContext::findpuztext() { si = ax; } -void DreamGenContext::placesetobject() { - STACK_CHECK; - push(es); - push(bx); - cl = 0; - ch = 0; - findormake(); - getsetad(); - es.byte(bx+58) = 0; - bx = pop(); - es = pop(); -} - -void DreamGenContext::removesetobject() { - STACK_CHECK; - push(es); - push(bx); - cl = 255; - ch = 0; - findormake(); - getsetad(); - es.byte(bx+58) = 255; - bx = pop(); - es = pop(); -} - void DreamGenContext::issetobonmap() { STACK_CHECK; push(es); @@ -18595,8 +18569,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_putbackobstuff: putbackobstuff(); break; case addr_showpuztext: showpuztext(); break; case addr_findpuztext: findpuztext(); break; - case addr_placesetobject: placesetobject(); break; - case addr_removesetobject: removesetobject(); break; case addr_issetobonmap: issetobonmap(); break; case addr_placefreeobject: placefreeobject(); break; case addr_removefreeobject: removefreeobject(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index a6dff60400..bca9cc634a 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -308,8 +308,6 @@ public: static const uint16 addr_removefreeobject = 0xc6f4; static const uint16 addr_placefreeobject = 0xc6f0; static const uint16 addr_issetobonmap = 0xc6ec; - static const uint16 addr_removesetobject = 0xc6e8; - static const uint16 addr_placesetobject = 0xc6e4; static const uint16 addr_findpuztext = 0xc6e0; static const uint16 addr_showpuztext = 0xc6dc; static const uint16 addr_putbackobstuff = 0xc6d8; @@ -1578,7 +1576,7 @@ public: void copper(); void folderhints(); void openhoteldoor(); - void removesetobject(); + //void removesetobject(); //void dumptimedtext(); //void frameoutfx(); void blank(); @@ -1996,7 +1994,7 @@ public: //void getmapad(); void getlocation(); void geteitherad(); - void placesetobject(); + //void placesetobject(); void drawflags(); void zoomonoff(); void updatesymboltop(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 2968a5e9b7..67811f91f9 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -840,12 +840,10 @@ void DreamGenContext::fillspace() { void DreamGenContext::dealwithspecial(uint8 firstParam, uint8 secondParam) { uint8 type = firstParam - 220; if (type == 0) { - al = secondParam; - placesetobject(); + placesetobject(secondParam); data.byte(kHavedoneobs) = 1; } else if (type == 1) { - al = secondParam; - removesetobject(); + removesetobject(secondParam); data.byte(kHavedoneobs) = 1; } else if (type == 2) { al = secondParam; @@ -1115,6 +1113,24 @@ void DreamGenContext::deletetaken() { } } +void DreamGenContext::placesetobject() { + placesetobject(al); +} + +void DreamGenContext::placesetobject(uint8 index) { + findormake(index, 0, 0); + getsetad(index)->b58[0] = 0; +} + +void DreamGenContext::removesetobject() { + removesetobject(al); +} + +void DreamGenContext::removesetobject(uint8 index) { + findormake(index, 0xff, 0); + getsetad(index)->b58[0] = 0xff; +} + 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 diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 3ffc608f1e..61a65a3a80 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -158,4 +158,8 @@ void dochange(uint8 index, uint8 value, uint8 type); void deletetaken(); bool isCD(); + void placesetobject(); + void placesetobject(uint8 index); + void removesetobject(); + void removesetobject(uint8 index); -- cgit v1.2.3