diff options
author | Bertrand Augereau | 2011-08-09 22:04:06 +0200 |
---|---|---|
committer | Bertrand Augereau | 2011-08-09 22:40:03 +0200 |
commit | 4ad8b54241fb04aca95618637b50e4220e461034 (patch) | |
tree | 0bc5c7696cc6272b51d5a595b54e7f5aae3e21f5 | |
parent | 3407f2803aec89fcf091900b841f83683fcc8675 (diff) | |
download | scummvm-rg350-4ad8b54241fb04aca95618637b50e4220e461034.tar.gz scummvm-rg350-4ad8b54241fb04aca95618637b50e4220e461034.tar.bz2 scummvm-rg350-4ad8b54241fb04aca95618637b50e4220e461034.zip |
DREAMWEB: 'checkdest' ported to C++
-rwxr-xr-x | devtools/tasmrecover/tasm-recover | 1 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 51 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 3 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 27 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 1 |
5 files changed, 27 insertions, 56 deletions
diff --git a/devtools/tasmrecover/tasm-recover b/devtools/tasmrecover/tasm-recover index ed4c9f1352..d4f4af715a 100755 --- a/devtools/tasmrecover/tasm-recover +++ b/devtools/tasmrecover/tasm-recover @@ -75,6 +75,7 @@ generator = cpp(context, "DreamGen", blacklist = [ 'findsource', 'walking', 'autosetwalk', + 'checkdest', 'spriteupdate', 'dodoor', 'lockeddoorway', diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 291078169f..2a7c67e889 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -17359,56 +17359,6 @@ holdingreel: data.byte(kWatchmode) = 2; } -void DreamGenContext::checkdest() { - STACK_CHECK; - push(bx); - _add(bx, 12*8); - ah = data.byte(kManspath); - cl = 4; - _shl(ah, cl); - al = data.byte(kDestination); - cl = 24; - ch = data.byte(kDestination); -checkdestloop: - dh = es.byte(bx); - _and(dh, 0xf0); - dl = es.byte(bx); - _and(dl, 0xf); - _cmp(ax, dx); - if (!flags.z()) - goto nextcheck; - al = es.byte(bx+1); - _and(al, 15); - data.byte(kDestination) = al; - bx = pop(); - return; -nextcheck: - dl = es.byte(bx); - _and(dl, 0xf0); - _shr(dl, 1); - _shr(dl, 1); - _shr(dl, 1); - _shr(dl, 1); - dh = es.byte(bx); - _and(dh, 0xf); - _shl(dh, 1); - _shl(dh, 1); - _shl(dh, 1); - _shl(dh, 1); - _cmp(ax, dx); - if (!flags.z()) - goto nextcheck2; - ch = es.byte(bx+1); - _and(ch, 15); -nextcheck2: - _add(bx, 2); - _dec(cl); - if (!flags.z()) - goto checkdestloop; - data.byte(kDestination) = ch; - bx = pop(); -} - void DreamGenContext::bresenhams() { STACK_CHECK; workoutframes(); @@ -20137,7 +20087,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_walktotext: walktotext(); break; case addr_getflagunderp: getflagunderp(); break; case addr_setwalk: setwalk(); break; - case addr_checkdest: checkdest(); break; case addr_bresenhams: bresenhams(); break; case addr_workoutframes: workoutframes(); break; case addr_copyname: copyname(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 18be264a9e..60abf44c01 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -119,7 +119,6 @@ public: static const uint16 addr_copyname = 0xca5c; static const uint16 addr_workoutframes = 0xca54; static const uint16 addr_bresenhams = 0xca50; - static const uint16 addr_checkdest = 0xca4c; static const uint16 addr_setwalk = 0xca44; static const uint16 addr_getflagunderp = 0xca40; static const uint16 addr_walktotext = 0xca3c; @@ -1875,7 +1874,7 @@ public: void makecaps(); void read(); void fadescreenups(); - void checkdest(); + //void checkdest(); //void initman(); void loadpalfromiff(); //void facerightway(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 6d2fee1ecd..cd6a9d6b4f 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -886,9 +886,8 @@ void DreamGenContext::autosetwalk() { al = data.byte(kManspath); if (data.byte(kFinaldest) == al) return; - getroomspaths(); - uint8 *roomsPaths = getroomspathsCPP(); - checkdest(); + const uint8 *roomsPaths = getroomspathsCPP(); + checkdest(roomsPaths); data.word(kLinestartx) = roomsPaths[data.byte(kManspath) * 8 + 0] - 12; data.word(kLinestarty) = roomsPaths[data.byte(kManspath) * 8 + 1] - 12; data.word(kLineendx) = roomsPaths[data.byte(kDestination) * 8 + 0] - 12; @@ -902,5 +901,27 @@ void DreamGenContext::autosetwalk() { data.byte(kLinepointer) = 0; } +void DreamGenContext::checkdest(const uint8 *roomsPaths) { + const uint8 *p = roomsPaths + 12 * 8; + ah = data.byte(kManspath) << 4; + al = data.byte(kDestination); + uint8 destination = data.byte(kDestination); + for (size_t i = 0; i < 24; ++i) { + dh = p[0] & 0xf0; + dl = p[0] & 0x0f; + if (ax == dx) { + data.byte(kDestination) = p[1] & 0x0f; + return; + } + dl = (p[0] & 0xf0) >> 4; + dh = (p[0] & 0x0f) << 4; + if (ax == dx) { + destination = p[1] & 0x0f; + } + p += 2; + } + data.byte(kDestination) = destination; +} + } /*namespace dreamgen */ diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index 809e5f45f7..746a75b97b 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -83,6 +83,7 @@ void walking(); void walking(Sprite *sprite); void autosetwalk(); + void checkdest(const uint8 *roomsPaths); void aboutturn(Sprite *sprite); void backobject(Sprite *sprite); void constant(Sprite *sprite, ObjData *objData); |