[Scummvm-git-logs] scummvm master -> 8777868c2842bb0fe5a3475695b730c1e1292e43
dreammaster
dreammaster at scummvm.org
Fri Dec 16 04:58:07 CET 2016
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8777868c28 TITANIC: Fixes and cleanup for conversation dials movement
Commit: 8777868c2842bb0fe5a3475695b730c1e1292e43
https://github.com/scummvm/scummvm/commit/8777868c2842bb0fe5a3475695b730c1e1292e43
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-12-15T22:58:04-05:00
Commit Message:
TITANIC: Fixes and cleanup for conversation dials movement
Changed paths:
engines/titanic/pet_control/pet_conversations.cpp
engines/titanic/pet_control/pet_conversations.h
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index 490ed75..f7cfedf 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 1837e5d..c3508f6 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() {}
More information about the Scummvm-git-logs
mailing list