diff options
author | Strangerke | 2018-03-31 01:04:09 +0200 |
---|---|---|
committer | Strangerke | 2018-03-31 01:55:40 +0200 |
commit | 3720c04cb642f42f5bda9df7e9e4679f38526249 (patch) | |
tree | 2027e2051de69bf762cb5880c1d96bb3808332df /engines/lilliput/lilliput.cpp | |
parent | 467cfbc42a16fdac59a8a21d0d6ae9c411bbaa3b (diff) | |
download | scummvm-rg350-3720c04cb642f42f5bda9df7e9e4679f38526249.tar.gz scummvm-rg350-3720c04cb642f42f5bda9df7e9e4679f38526249.tar.bz2 scummvm-rg350-3720c04cb642f42f5bda9df7e9e4679f38526249.zip |
LILLIPUT: Refactor a bit sequenceMoveCharacter to use 3 parameters instead of 2
Diffstat (limited to 'engines/lilliput/lilliput.cpp')
-rw-r--r-- | engines/lilliput/lilliput.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp index 3264fca2ec..a3a26ed969 100644 --- a/engines/lilliput/lilliput.cpp +++ b/engines/lilliput/lilliput.cpp @@ -1620,11 +1620,12 @@ void LilliputEngine::updateCharPosSequence() { Common::Point var1 = _scriptHandler->_sequenceArr[index2]; // /8, then /2 as the function array is a word array - int16 var2 = var1.x / 16; + int16 posSeqType = var1.x / 16; - switch (var2) { + switch (posSeqType) { case 0: // Move - sequenceMoveCharacter(index, var1); + // x stands for moveType, y for poseType + sequenceMoveCharacter(index, var1.x, var1.y); result = 0; break; case 1: // Face @@ -1659,7 +1660,7 @@ void LilliputEngine::updateCharPosSequence() { result = sub166EA(index); break; default: - error("updateCharPosSequence - unexpected value %d", var2); + error("updateCharPosSequence - unexpected value %d", posSeqType); break; } @@ -1705,7 +1706,7 @@ byte LilliputEngine::sub166DD(int index, Common::Point var1) { char var1h = var1.x & 3; _characterDirectionArray[index] = var1h; - setCharacterPose(index, Common::Point(var1h, var1.y)); + setCharacterPose(index, var1.y); return 0; } @@ -2011,20 +2012,21 @@ void LilliputEngine::handleInterfaceHotspot(byte index, byte button) { displayInterfaceHotspots(); } -void LilliputEngine::setCharacterPose(int charIdx, Common::Point var1) { - debugC(2, kDebugEngine, "setCharacterPose(%d, poseIdx %d)", charIdx, var1.y); +void LilliputEngine::setCharacterPose(int charIdx, int poseIdx) { + debugC(2, kDebugEngine, "setCharacterPose(%d, %d)", charIdx, poseIdx); - int index = (charIdx * 32) + var1.y; + // CHECKME: Add an assert on poseIdx to check if it's between 0 and 31? + int index = (charIdx * 32) + poseIdx; _scriptHandler->_characterPose[charIdx] = _poseArray[index]; } -void LilliputEngine::sequenceMoveCharacter(int idx, Common::Point var1) { - debugC(2, kDebugEngine, "sequenceMoveCharacter(%d, %d - %d)", idx, var1.x, var1.y); +void LilliputEngine::sequenceMoveCharacter(int idx, int moveType, int poseType) { + debugC(2, kDebugEngine, "sequenceMoveCharacter(%d, %d - %d)", idx, moveType, poseType); - setCharacterPose(idx, var1); + setCharacterPose(idx, poseType); int index = idx; - switch (var1.x) { + switch (moveType) { case 0: // No movement break; @@ -2060,7 +2062,7 @@ void LilliputEngine::sequenceMoveCharacter(int idx, Common::Point var1) { break; default: // CHECKME: It's so bad it could be an error() - warning("sequenceMoveCharacter - Unexpected value %d", var1.x); + warning("sequenceMoveCharacter - Unexpected value %d", moveType); } } |