diff options
author | Paul Gilbert | 2016-12-15 22:58:04 -0500 |
---|---|---|
committer | Paul Gilbert | 2016-12-15 22:58:04 -0500 |
commit | 8777868c2842bb0fe5a3475695b730c1e1292e43 (patch) | |
tree | 9686c25f9014d023ac16a799fd56c50bb37166ba /engines/titanic | |
parent | d6126ffcfacb7bb29986196e5826e9ca7e34ad70 (diff) | |
download | scummvm-rg350-8777868c2842bb0fe5a3475695b730c1e1292e43.tar.gz scummvm-rg350-8777868c2842bb0fe5a3475695b730c1e1292e43.tar.bz2 scummvm-rg350-8777868c2842bb0fe5a3475695b730c1e1292e43.zip |
TITANIC: Fixes and cleanup for conversation dials movement
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/pet_control/pet_conversations.cpp | 25 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_conversations.h | 4 |
2 files changed, 15 insertions, 14 deletions
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp index 490ed754d1..f7cfedf8c4 100644 --- a/engines/titanic/pet_control/pet_conversations.cpp +++ b/engines/titanic/pet_control/pet_conversations.cpp @@ -532,30 +532,31 @@ void CPetConversations::updateDial(uint dialNum, const CString &npcName) { _npcLevels[dialNum] = newLevel; } -uint CPetConversations::getDialLevel(uint dialNum, TTnpcScript *script, int v) { - bool flag = v != 0; - +uint CPetConversations::getDialLevel(uint dialNum, TTnpcScript *script, bool flag) { if (!script) return 0; else return MAX(script->getDialLevel(dialNum, flag), 15); } -void CPetConversations::npcDialChange(uint dialNum, int oldLevel, int newLevel) { - const uint range1[2] = { 0, 21 }; - const uint range2[2] = { 22, 43 }; +void CPetConversations::npcDialChange(uint dialNum, uint oldLevel, uint newLevel) { + const uint ascending[2] = { 0, 21 }; + const uint descending[2] = { 43, 22 }; + assert(oldLevel <= 100 && newLevel <= 100); if (newLevel != oldLevel) { - uint src = range1[0], dest = range1[1]; - if (oldLevel < newLevel) { - src = range2[0]; - dest = range2[1]; + debugC(ERROR_DETAILED, kDebugScripts, "Dial %d change from %d to %d", + dialNum, oldLevel, newLevel); + uint src = ascending[0], dest = ascending[1]; + if (newLevel < oldLevel) { + src = descending[0]; + dest = descending[1]; } - int64 val1 = (oldLevel * dest) + (100 - oldLevel) * src; + uint val1 = (oldLevel * dest) + (100 - oldLevel) * src; uint startFrame = val1 / 100; - int64 val2 = (newLevel * dest) + (100 - newLevel) * src; + uint val2 = (newLevel * dest) + (100 - newLevel) * src; uint endFrame = val2 / 100; if (startFrame != endFrame) diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h index 1837e5df2a..c3508f62a8 100644 --- a/engines/titanic/pet_control/pet_conversations.h +++ b/engines/titanic/pet_control/pet_conversations.h @@ -122,12 +122,12 @@ private: /** * Get a dial level */ - uint getDialLevel(uint dialNum, TTnpcScript *script, int v = 1); + uint getDialLevel(uint dialNum, TTnpcScript *script, bool flag = true); /** * Called when the dial for an NPC is being changed */ - void npcDialChange(uint dialNum, int oldLevel, int newLevel); + void npcDialChange(uint dialNum, uint oldLevel, uint newLevel); public: CPetConversations(); virtual ~CPetConversations() {} |