diff options
author | Filippos Karapetis | 2011-12-25 18:26:13 +0200 |
---|---|---|
committer | Filippos Karapetis | 2011-12-25 18:26:13 +0200 |
commit | 21a278bb630fc7bae6f152861900101a58836344 (patch) | |
tree | 1d698bb0368c172e2c121f5715d63685d1d3023e /engines | |
parent | bf4271dfc116fa6f4b4245051e2d6a391f1d850c (diff) | |
download | scummvm-rg350-21a278bb630fc7bae6f152861900101a58836344.tar.gz scummvm-rg350-21a278bb630fc7bae6f152861900101a58836344.tar.bz2 scummvm-rg350-21a278bb630fc7bae6f152861900101a58836344.zip |
DREAMWEB: Port 'outofopen' to C++
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 70 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 1 | ||||
-rw-r--r-- | engines/dreamweb/object.cpp | 72 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 1 |
4 files changed, 67 insertions, 77 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index d68bd3b88f..6ecbba7995 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -365,76 +365,6 @@ findopenp1: _add(bx, (0+(228*13))); } -void DreamGenContext::outOfOpen() { - STACK_CHECK; - _cmp(data.byte(kOpenedob), 255); - if (flags.z()) - goto cantuseopen; - findOpenPos(); - ax = es.word(bx); - _cmp(al, 255); - if (!flags.z()) - goto canpick4; -cantuseopen: - blank(); - return; -canpick4: - _cmp(ax, data.word(kOldsubject)); - if (!flags.z()) - goto difsub4; - _cmp(data.byte(kCommandtype), 228); - if (flags.z()) - goto alreadygrb; - data.byte(kCommandtype) = 228; -difsub4: - data.word(kOldsubject) = ax; - bx = ax; - al = 36; - commandWithOb(); -alreadygrb: - ax = data.word(kMousebutton); - _cmp(ax, data.word(kOldbutton)); - if (flags.z()) - return /* (notletgo4) */; - _cmp(ax, 1); - if (flags.z()) - goto dogrb; - _cmp(ax, 2); - if (!flags.z()) - return /* (notletgo4) */; - reExFromOpen(); - return; -dogrb: - delPointer(); - data.byte(kPickup) = 1; - findOpenPos(); - ax = es.word(bx); - data.byte(kItemframe) = al; - data.byte(kObjecttype) = ah; - _cmp(ah, 4); - if (!flags.z()) - goto makeintoex; - getEitherAd(); - es.byte(bx+2) = 20; - es.byte(bx+3) = 255; - goto actuallyout; -makeintoex: - transferToEx(); - data.byte(kItemframe) = al; - data.byte(kObjecttype) = 4; - getEitherAd(); - es.byte(bx+2) = 20; - es.byte(bx+3) = 255; -actuallyout: - fillOpen(); - underTextLine(); - readMouse(); - useOpened(); - showPointer(); - workToScreen(); - delPointer(); -} - void DreamGenContext::transferToEx() { STACK_CHECK; emergencyPurge(); diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index f585c6a7b4..7bb4793d05 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -454,7 +454,6 @@ public: void __start(); #include "stubs.h" // Allow hand-reversed functions to have a signature different than void f() - void outOfOpen(); void dirCom(); void findFirstPath(); void getAnyAd(); diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 6546f19da4..64b3d276bb 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -887,9 +887,9 @@ void DreamGenContext::useOpened() { } findOpenPos(); - ax = es.word(bx); + uint16 subject = es.word(bx); - if (al != 255) { + if ((subject & 0x00FF) != 255) { swapWithOpen(); return; } @@ -899,7 +899,7 @@ void DreamGenContext::useOpened() { return; } - uint16 subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); + subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); if (subject == data.word(kOldsubject)) { if (data.byte(kCommandtype) != 227) { data.byte(kCommandtype) = 227; @@ -945,6 +945,66 @@ void DreamGenContext::useOpened() { delPointer(); } +void DreamGenContext::outOfOpen() { + if (data.byte(kOpenedob) == 255) + return; // cannot use opened object + + findOpenPos(); + uint16 subject = es.word(bx); + + if ((subject & 0x00FF) == 255) { + blank(); + return; + } + + if (subject == data.word(kOldsubject)) { + if (data.byte(kCommandtype) != 228) { + data.byte(kCommandtype) = 228; + data.word(kOldsubject) = subject; + commandWithOb(36, subject >> 8, subject & 0x00FF); + } + } else { + data.word(kOldsubject) = subject; + commandWithOb(36, subject >> 8, subject & 0x00FF); + } + + if (data.word(kMousebutton) == data.word(kOldbutton)) + return; // notletgo4 + + if (data.word(kMousebutton) != 1) { + if (data.word(kMousebutton) != 2) + return; // notletgo4 + + reExFromOpen(); + return; + } + + delPointer(); + data.byte(kPickup) = 1; + findOpenPos(); + subject = es.word(bx); + data.byte(kObjecttype) = subject >> 8; + data.byte(kItemframe) = subject & 0xFF; + + if (data.byte(kObjecttype) != 4) { + transferToEx(); + data.byte(kItemframe) = al; + data.byte(kObjecttype) = 4; + } + + DynObject *object = getEitherAdCPP(); + object->mapad[0] = 20; + object->mapad[1] = 255; + + fillOpen(); + underTextLine(); + readMouse(); + useOpened(); + showPointer(); + workToScreenCPP(); + delPointer(); +} + void DreamGenContext::swapWithOpen() { uint16 subject = (data.byte(kObjecttype) << 8) | data.byte(kItemframe); if (subject == data.word(kOldsubject)) { @@ -980,9 +1040,9 @@ void DreamGenContext::swapWithOpen() { byte prevType = data.byte(kObjecttype); byte prevFrame = data.byte(kItemframe); findOpenPos(); - ax = es.word(bx); - data.byte(kItemframe) = al; - data.byte(kObjecttype) = ah; + subject = es.word(bx); + data.byte(kObjecttype) = subject >> 8; + data.byte(kItemframe) = subject & 0xFF; if (data.byte(kObjecttype) != 4) { transferToEx(); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 0cdd68fa18..4cc0ee0027 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -196,6 +196,7 @@ void reExFromInv(); void locationPic(); void useOpened(); + void outOfOpen(); void swapWithOpen(); void swapWithInv(); |