diff options
author | Bertrand Augereau | 2011-08-23 11:09:54 +0200 |
---|---|---|
committer | Bertrand Augereau | 2011-08-23 13:22:15 +0200 |
commit | 76db28dafb8afa84a196526e28a529905e62d151 (patch) | |
tree | 24738f413e64f4980466859ff6e4c4e05faf8c8f /engines/dreamweb | |
parent | f6670e9f1f0f86103e77293f14562ee2c93ecc40 (diff) | |
download | scummvm-rg350-76db28dafb8afa84a196526e28a529905e62d151.tar.gz scummvm-rg350-76db28dafb8afa84a196526e28a529905e62d151.tar.bz2 scummvm-rg350-76db28dafb8afa84a196526e28a529905e62d151.zip |
DREAMWEB: 'obname' ported to C++
Diffstat (limited to 'engines/dreamweb')
-rw-r--r-- | engines/dreamweb/dreamgen.cpp | 135 | ||||
-rw-r--r-- | engines/dreamweb/dreamgen.h | 7 | ||||
-rw-r--r-- | engines/dreamweb/stubs.cpp | 83 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 2 |
4 files changed, 82 insertions, 145 deletions
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp index 596fbf154f..026299a935 100644 --- a/engines/dreamweb/dreamgen.cpp +++ b/engines/dreamweb/dreamgen.cpp @@ -15703,140 +15703,6 @@ void DreamGenContext::afterintroroom() { data.byte(kNowinnewroom) = 0; } -void DreamGenContext::obname() { - STACK_CHECK; - _cmp(data.byte(kReasseschanges), 0); - if (flags.z()) - goto notnewpath; - data.byte(kReasseschanges) = 0; - goto diff; -notnewpath: - _cmp(ah, data.byte(kCommandtype)); - if (flags.z()) - goto notdiffob; - goto diff; -notdiffob: - _cmp(al, data.byte(kCommand)); - if (!flags.z()) - goto diff; - _cmp(data.byte(kWalkandexam), 1); - if (flags.z()) - { walkandexamine(); return; }; - _cmp(data.word(kMousebutton), 0); - if (flags.z()) - return /* (noobselect) */; - _cmp(data.byte(kCommandtype), 3); - if (!flags.z()) - goto isntblock; - _cmp(data.byte(kLastflag), 2); - if (flags.c()) - return /* (noobselect) */; -isntblock: - bl = data.byte(kManspath); - _cmp(bl, data.byte(kPointerspath)); - if (!flags.z()) - goto wantstowalk; - _cmp(data.byte(kCommandtype), 3); - if (flags.z()) - goto wantstowalk; - finishedwalking(); - if (!flags.z()) - return /* (noobselect) */; - _cmp(data.byte(kCommandtype), 5); - if (flags.z()) - goto wantstotalk; - _cmp(data.word(kWatchingtime), 0); - if (!flags.z()) - return /* (noobselect) */; - examineob(); - return; -wantstotalk: - _cmp(data.word(kWatchingtime), 0); - if (!flags.z()) - return /* (noobselect) */; - talk(); - return; -walkandexamine: - finishedwalking(); - if (!flags.z()) - return /* (noobselect) */; - al = data.byte(kWalkexamtype); - data.byte(kCommandtype) = al; - al = data.byte(kWalkexamnum); - data.byte(kCommand) = al; - data.byte(kWalkandexam) = 0; - _cmp(data.byte(kCommandtype), 5); - if (flags.z()) - return /* (noobselect) */; - examineob(); - return; -wantstowalk: - setwalk(); - data.byte(kReasseschanges) = 1; - return; -diff: - data.byte(kCommand) = al; - data.byte(kCommandtype) = ah; - _cmp(data.byte(kLinepointer), 254); - if (!flags.z()) - goto middleofwalk; - _cmp(data.word(kWatchingtime), 0); - if (!flags.z()) - goto middleofwalk; - al = data.byte(kFacing); - _cmp(al, data.byte(kTurntoface)); - if (!flags.z()) - goto middleofwalk; - _cmp(data.byte(kCommandtype), 3); - if (!flags.z()) - goto notblock; - bl = data.byte(kManspath); - _cmp(bl, data.byte(kPointerspath)); - if (!flags.z()) - goto dontcheck; - cl = data.byte(kRyanx); - _add(cl, 12); - ch = data.byte(kRyany); - _add(ch, 12); - checkone(); - _cmp(cl, 2); - if (flags.c()) - goto isblock; -dontcheck: - getflagunderp(); - _cmp(data.byte(kLastflag), 2); - if (flags.c()) - goto isblock; - _cmp(data.byte(kLastflag), 128); - if (!flags.c()) - goto isblock; - goto toofaraway; -notblock: - bl = data.byte(kManspath); - _cmp(bl, data.byte(kPointerspath)); - if (!flags.z()) - goto toofaraway; - _cmp(data.byte(kCommandtype), 3); - if (flags.z()) - goto isblock; - _cmp(data.byte(kCommandtype), 5); - if (flags.z()) - goto isaperson; - examineobtext(); - return; -middleofwalk: - blocknametext(); - return; -isblock: - blocknametext(); - return; -isaperson: - personnametext(); - return; -toofaraway: - walktotext(); -} - void DreamGenContext::examineobtext() { STACK_CHECK; bl = data.byte(kCommand); @@ -18484,7 +18350,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) { case addr_atmospheres: atmospheres(); break; case addr_walkintoroom: walkintoroom(); break; case addr_afterintroroom: afterintroroom(); break; - case addr_obname: obname(); break; case addr_examineobtext: examineobtext(); break; case addr_printmessage: printmessage(); break; case addr_printmessage2: printmessage2(); break; diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h index 9f2774fb9c..520c26926d 100644 --- a/engines/dreamweb/dreamgen.h +++ b/engines/dreamweb/dreamgen.h @@ -118,7 +118,6 @@ public: static const uint16 addr_printmessage2 = 0xca30; static const uint16 addr_printmessage = 0xca2c; static const uint16 addr_examineobtext = 0xca20; - static const uint16 addr_obname = 0xca18; static const uint16 addr_afterintroroom = 0xca14; static const uint16 addr_walkintoroom = 0xca10; static const uint16 addr_atmospheres = 0xca0c; @@ -1477,7 +1476,7 @@ public: //void domix(); void priesttext(); void paneltomap(); - void obname(); + //void obname(); void getridoftemp3(); void getridoftemp2(); void usebalcony(); @@ -1606,7 +1605,7 @@ public: void dumpmenu(); void chewy(); void accesslighton(); - void dosreturn(); + void useplinth(); //void adjustlen(); //void quickquit(); void showpointer(); @@ -1715,7 +1714,7 @@ public: void describeob(); void deleteexframe(); void folderexit(); - void useplinth(); + void dosreturn(); void wheelsound(); void actualsave(); void autolook(); diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 82e66ba80f..576bfac32e 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -947,9 +947,7 @@ bool DreamGenContext::checkifperson(uint8 x, uint8 y) { if (y >= ymax) continue; data.word(kPersondata) = people->w2(); - al = people->b4; - ah = 5; - obname(); + obname(people->b4, 5); return true; } return false; @@ -973,9 +971,7 @@ bool DreamGenContext::checkiffree(uint8 x, uint8 y) { continue; if (y >= objPos->yMax) continue; - al = objPos->index; - ah = 2; - obname(); + obname(objPos->index, 2); return true; } return false; @@ -1187,6 +1183,81 @@ void DreamGenContext::walkandexamine() { examineob(); } +void DreamGenContext::obname() { + obname(al, ah); +} + +void DreamGenContext::obname(uint8 command, uint8 commandType) { + if (data.byte(kReasseschanges) == 0) { + if ((commandType == data.byte(kCommandtype)) && (command == data.byte(kCommand))) { + if (data.byte(kWalkandexam) == 1) { + walkandexamine(); + return; + } else if (data.word(kMousebutton) == 0) + return; + else if ((data.byte(kCommandtype) == 3) && (data.byte(kLastflag) < 2)) + return; + else if ((data.byte(kManspath) != data.byte(kPointerspath)) || (data.byte(kCommandtype) == 3)) { + setwalk(); + data.byte(kReasseschanges) = 1; + return; + } else if (! finishedwalkingCPP()) + return; + else if (data.byte(kCommandtype) == 5) { + if (data.word(kWatchingtime) == 0) + talk(); + return; + } else { + if (data.word(kWatchingtime) == 0) + examineob(); + return; + } + } + } else + data.byte(kReasseschanges) = 0; + + data.byte(kCommand) = command; + data.byte(kCommandtype) = commandType; + if ((data.byte(kLinepointer) != 254) || (data.word(kWatchingtime) != 0) || (data.byte(kFacing) != data.byte(kTurntoface))) { + blocknametext(); + return; + } else if (data.byte(kCommandtype) != 3) { + if (data.byte(kManspath) != data.byte(kPointerspath)) { + walktotext(); + return; + } else if (data.byte(kCommandtype) == 3) { + blocknametext(); + return; + } else if (data.byte(kCommandtype) == 5) { + personnametext(); + return; + } else { + examineobtext(); + return; + } + } + if (data.byte(kManspath) == data.byte(kPointerspath)) { + uint8 flag, flagEx, type, flagX, flagY; + checkone(data.byte(kRyanx) + 12, data.byte(kRyany) + 12, &flag, &flagEx, &type, &flagX, &flagY); + if (flag < 2) { + blocknametext(); + return; + } + } + + getflagunderp(); + if (data.byte(kLastflag) < 2) { + blocknametext(); + return; + } else if (data.byte(kLastflag) >= 128) { + blocknametext(); + return; + } else { + walktotext(); + return; + } +} + 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 036e8120bb..3b5225d319 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -174,4 +174,6 @@ void getflagunderp(); void getflagunderp(uint8 *flag, uint8 *flagEx); void walkandexamine(); + void obname(); + void obname(uint8 command, uint8 commandType); |