diff options
author | Bertrand Augereau | 2011-06-28 18:13:06 +0200 |
---|---|---|
committer | Bertrand Augereau | 2011-07-18 22:59:16 +0200 |
commit | 0a6f83691d92754330a5f06b34aae5cde65d79df (patch) | |
tree | ac6f27788a292257da7c50c8bb4fe405e912d9ae /engines/dreamweb | |
parent | b8cc90ad6c6adc7ceaa54e964591729ce439f490 (diff) | |
download | scummvm-rg350-0a6f83691d92754330a5f06b34aae5cde65d79df.tar.gz scummvm-rg350-0a6f83691d92754330a5f06b34aae5cde65d79df.tar.bz2 scummvm-rg350-0a6f83691d92754330a5f06b34aae5cde65d79df.zip |
DREAMWEB: aboutturn reversed
Diffstat (limited to 'engines/dreamweb')
-rw-r--r-- | engines/dreamweb/stubs.cpp | 33 | ||||
-rw-r--r-- | engines/dreamweb/stubs.h | 1 |
2 files changed, 33 insertions, 1 deletions
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index 4dc4ef83c7..dc05e455ff 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -817,7 +817,7 @@ void DreamGenContext::mainmanCPP(Sprite* sprite) { } sprite->b22 = 0; if (data.byte(kTurntoface) != data.byte(kFacing)) { - aboutturn(); + aboutturn(sprite); } else { if ((data.byte(kTurndirection) != 0) && (data.byte(kLinepointer) == 254)) { data.byte(kReasseschanges) = 1; @@ -887,6 +887,37 @@ void DreamGenContext::walking() { es = pop(); } +void DreamGenContext::aboutturn(Sprite* sprite) { + if (data.byte(kTurndirection) == 1) + goto incdir; + else if ((int8)data.byte(kTurndirection) == -1) + goto decdir; + else { + if (data.byte(kFacing) < data.byte(kTurntoface)) { + uint8 delta = data.byte(kTurntoface) - data.byte(kFacing); + if (delta >= 4) + goto decdir; + else + goto incdir; + } else { + uint8 delta = data.byte(kFacing) - data.byte(kTurntoface); + if (delta >= 4) + goto incdir; + else + goto decdir; + } + } +incdir: + data.byte(kTurndirection) = 1; + data.byte(kFacing) = (data.byte(kFacing) + 1) & 7; + sprite->b29 = 0; + return; +decdir: + data.byte(kTurndirection) = -1; + data.byte(kFacing) = (data.byte(kFacing) - 1) & 7; + sprite->b29 = 0; +} + void DreamGenContext::backobject(Sprite* sprite) { push(es); push(ds); diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h index d1eb5aae9f..63a898acc9 100644 --- a/engines/dreamweb/stubs.h +++ b/engines/dreamweb/stubs.h @@ -28,6 +28,7 @@ void initman(); void mainmanCPP(Sprite* sprite); void walking(); + void aboutturn(Sprite* sprite); void backobject(Sprite* sprite); void constant(Sprite* sprite, ObjData* objData); void steady(Sprite* sprite, ObjData* objData); |