diff options
author | Bertrand Augereau | 2011-08-15 14:35:44 +0200 |
---|---|---|
committer | Bertrand Augereau | 2011-08-15 22:30:16 +0200 |
commit | b0f5e4dfb07062002a52ded364eb02d8fc7f1dc6 (patch) | |
tree | af4e37ed16cba85a6cb2e24bf4fe99ea0090cbb1 /engines/dreamweb | |
parent | 8cb9ff31cf67c3161c9513e36cdba48db55f4ed9 (diff) | |
download | scummvm-rg350-b0f5e4dfb07062002a52ded364eb02d8fc7f1dc6.tar.gz scummvm-rg350-b0f5e4dfb07062002a52ded364eb02d8fc7f1dc6.tar.bz2 scummvm-rg350-b0f5e4dfb07062002a52ded364eb02d8fc7f1dc6.zip |
DREAMWEB: 'copyname' ported to C++
Diffstat (limited to 'engines/dreamweb')
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 28 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 3 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 46 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 5 |
4 files changed, 34 insertions, 48 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index b72c83b40c..42a6a64fa0 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -17395,33 +17395,6 @@ success: data.byte(kTurndirection) = 0; } -void DreamGenContext::copyname() { - STACK_CHECK; - push(di); - findobname(); - di = pop(); - es = cs; - cx = 28; -make: - _lodsb(); - _cmp(al, ':'); - if (flags.z()) - goto finishmakename; - _cmp(al, 0); - if (flags.z()) - goto finishmakename; - _stosb(); - if (--cx) - goto make; -finishmakename: - _inc(cx); - al = 0; - _stosb(); - return; - al = 255; - _stosb(cx, true); -} - void DreamGenContext::showicon() { STACK_CHECK; _cmp(data.byte(kReallocation), 50); @@ -19842,7 +19815,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_setwalk: setwalk(); break; case addr_bresenhams: bresenhams(); break; case addr_workoutframes: workoutframes(); break; - case addr_copyname: copyname(); break; case addr_showicon: showicon(); break; case addr_middlepanel: middlepanel(); break; case addr_showman: showman(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 4a8bcbd1a1..9c08a335c9 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -115,7 +115,6 @@ public: static const uint16 addr_showman = 0xca6c; static const uint16 addr_middlepanel = 0xca68; static const uint16 addr_showicon = 0xca64; - static const uint16 addr_copyname = 0xca5c; static const uint16 addr_workoutframes = 0xca54; static const uint16 addr_bresenhams = 0xca50; static const uint16 addr_setwalk = 0xca44; @@ -1784,7 +1783,7 @@ public: void drawitall(); void usestereo(); void showcurrentfile(); - void copyname(); + //void copyname(); void look(); void setmouse(); void checkone(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 4fcc1e4698..e15bc2aab9 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -1000,28 +1000,42 @@ bool DreamGenContext::checkifperson(uint8 x, uint8 y) { return false; } -void DreamGenContext::findobname() { - findobname(ah, al); -} - -void DreamGenContext::findobname(uint8 type, uint8 index) { +const uint8 *DreamGenContext::findobname(uint8 type, uint8 index) { if (type == 5) { - uint16 offset = 64 * 2 * (index & 127); - ds = data.word(kPeople); - si = ds.word(kPersontxtdat + offset) + kPersontext; + uint16 i = 64 * 2 * (index & 127); + uint16 offset = segRef(data.word(kPeople)).word(kPersontxtdat + i) + kPersontext; + return segRef(data.word(kPeople)).ptr(offset, 0); } else if (type == 4) { - ds = data.word(kExtras); - si = ds.word(kExtextdat + index * 2) + kExtext; + uint16 offset = segRef(data.word(kExtras)).word(kExtextdat + index * 2) + kExtext; + return segRef(data.word(kExtras)).ptr(offset, 0); } else if (type == 2) { - ds = data.word(kFreedesc); - si = ds.word(kFreetextdat + index * 2) + kFreetext; + uint16 offset = segRef(data.word(kFreedesc)).word(kFreetextdat + index * 2) + kFreetext; + return segRef(data.word(kFreedesc)).ptr(offset, 0); } else if (type == 1) { - ds = data.word(kSetdesc); - si = ds.word(kSettextdat + index * 2) + kSettext; + uint16 offset = segRef(data.word(kSetdesc)).word(kSettextdat + index * 2) + kSettext; + return segRef(data.word(kSetdesc)).ptr(offset, 0); } else { - ds = data.word(kBlockdesc); - si = ds.word(kBlocktextdat + index * 2) + kBlocktext; + uint16 offset = segRef(data.word(kBlockdesc)).word(kBlocktextdat + index * 2) + kBlocktext; + return segRef(data.word(kBlockdesc)).ptr(offset, 0); + } +} + +void DreamGenContext::copyname() { + copyname(ah, al, cs.ptr(di, 0)); +} + +void DreamGenContext::copyname(uint8 type, uint8 index, uint8 *dst) { + const uint8 *src = findobname(type, index); + size_t i; + for (i = 0; i < 28; ++i) { + char c = src[i]; + if (c == ':') + break; + if (c == 0) + break; + dst[i] = c; } + dst[i] = 0; } } /*namespace dreamgen */ diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index b9d22c25c5..27250b7451 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -121,6 +121,7 @@ void doblocks(); void checkifperson(); bool checkifperson(uint8 x, uint8 y); - void findobname(); - void findobname(uint8 type, uint8 index); + const uint8 *findobname(uint8 type, uint8 index); + void copyname(); + void copyname(uint8 type, uint8 index, uint8 *dst); |