diff options
author | Martin Kiewitz | 2016-01-31 01:52:00 +0100 |
---|---|---|
committer | Martin Kiewitz | 2016-01-31 01:52:00 +0100 |
commit | 83495eab28d5f8967e2ce26b34af06c568019739 (patch) | |
tree | db582375bea4b5999b867b0a12afed25b436c610 /engines | |
parent | 4afda5bbea086dff5f9e90c6d49f5fa017dd92d2 (diff) | |
download | scummvm-rg350-83495eab28d5f8967e2ce26b34af06c568019739.tar.gz scummvm-rg350-83495eab28d5f8967e2ce26b34af06c568019739.tar.bz2 scummvm-rg350-83495eab28d5f8967e2ce26b34af06c568019739.zip |
AGI: change key -> direction handling
After the VM Var 6 <-> ego direction change, this is required
Also our original behavior was inaccurate in that part as well.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agi/keyboard.cpp | 77 |
1 files changed, 42 insertions, 35 deletions
diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp index 62bcfc2cc4..00c6a36014 100644 --- a/engines/agi/keyboard.cpp +++ b/engines/agi/keyboard.cpp @@ -452,38 +452,38 @@ bool AgiEngine::handleController(uint16 key) { return true; } - if (_game.playerControl) { - int16 newDirection = 0; - - switch (key) { - case AGI_KEY_UP: - newDirection = 1; - break; - case AGI_KEY_DOWN: - newDirection = 5; - break; - case AGI_KEY_LEFT: - newDirection = 7; - break; - case AGI_KEY_RIGHT: - newDirection = 3; - break; - case AGI_KEY_UP_RIGHT: - newDirection = 2; - break; - case AGI_KEY_DOWN_RIGHT: - newDirection = 4; - break; - case AGI_KEY_UP_LEFT: - newDirection = 8; - break; - case AGI_KEY_DOWN_LEFT: - newDirection = 6; - break; - default: - break; - } + int16 newDirection = 0; + + switch (key) { + case AGI_KEY_UP: + newDirection = 1; + break; + case AGI_KEY_DOWN: + newDirection = 5; + break; + case AGI_KEY_LEFT: + newDirection = 7; + break; + case AGI_KEY_RIGHT: + newDirection = 3; + break; + case AGI_KEY_UP_RIGHT: + newDirection = 2; + break; + case AGI_KEY_DOWN_RIGHT: + newDirection = 4; + break; + case AGI_KEY_UP_LEFT: + newDirection = 8; + break; + case AGI_KEY_DOWN_LEFT: + newDirection = 6; + break; + default: + break; + } + if (_game.playerControl) { if (!(getFeatures() & GF_AGIMOUSE)) { // Handle mouse button events if (!_game.mouseHidden) { @@ -515,13 +515,20 @@ bool AgiEngine::handleController(uint16 key) { } } } + } - if (newDirection || key == AGI_KEY_STATIONARY) { - screenObjEgo->flags &= ~fAdjEgoXY; - screenObjEgo->direction = screenObjEgo->direction == newDirection ? 0 : newDirection; + if (newDirection || key == AGI_KEY_STATIONARY) { + // TODO: not sure, what original AGI did with AdjEgoXY + screenObjEgo->flags &= ~fAdjEgoXY; + if (screenObjEgo->direction == newDirection) { + setVar(VM_VAR_EGO_DIRECTION, 0); + } else { + setVar(VM_VAR_EGO_DIRECTION, newDirection); + } + if (_game.playerControl) { screenObjEgo->motionType = kMotionNormal; - return true; } + return true; } return false; |