diff options
author | Paul Gilbert | 2016-06-11 16:23:40 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:23:13 -0400 |
commit | d13501bd1c78504f7d75443e8f45bcee67900e96 (patch) | |
tree | 056ec6ef1f3bb58681a60fb3b11cae39a771abd2 /engines | |
parent | 840557236c7f9f3e4e10b586781a36eb712b7de3 (diff) | |
download | scummvm-rg350-d13501bd1c78504f7d75443e8f45bcee67900e96.tar.gz scummvm-rg350-d13501bd1c78504f7d75443e8f45bcee67900e96.tar.bz2 scummvm-rg350-d13501bd1c78504f7d75443e8f45bcee67900e96.zip |
TITANIC: Added TTnpcScript getDialLevel
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/true_talk/tt_npc_script.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_npc_script.h | 8 |
2 files changed, 20 insertions, 6 deletions
diff --git a/engines/titanic/true_talk/tt_npc_script.cpp b/engines/titanic/true_talk/tt_npc_script.cpp index d7fc34f4e6..94401da7b5 100644 --- a/engines/titanic/true_talk/tt_npc_script.cpp +++ b/engines/titanic/true_talk/tt_npc_script.cpp @@ -20,6 +20,7 @@ * */ +#include "common/algorithm.h" #include "common/textconsole.h" #include "titanic/pet_control/pet_control.h" #include "titanic/true_talk/tt_npc_script.h" @@ -494,9 +495,20 @@ int TTnpcScript::getDialRegion(int dialNum) { } } -int TTnpcScript::getDialLevel(uint dialNum, bool flag) { - warning("TODO"); - return 0; +int TTnpcScript::getDialLevel(uint dialNum, bool randomizeFlag) { + int result = _dialValues[dialNum]; + if (randomizeFlag) { + bool lowFlag = result <= 50; + result = CLIP(result + (int)getRandomNumber(18) - 9, 0, 100); + + if (lowFlag) { + result = MIN(result, 46); + } else { + result = MAX(result, 54); + } + } + + return result; } int TTnpcScript::proc36(int id) const { diff --git a/engines/titanic/true_talk/tt_npc_script.h b/engines/titanic/true_talk/tt_npc_script.h index d2a53287c0..0e4359b7b0 100644 --- a/engines/titanic/true_talk/tt_npc_script.h +++ b/engines/titanic/true_talk/tt_npc_script.h @@ -331,10 +331,12 @@ public: virtual int getDialRegion(int dialNum); /** - * Gets the value for a dial, introducing a slight random variance so that - * the displayed dial will oscillate randomly around it's real level + * Gets the value for a dial + * @param dialNum Dial number + * @param randomizeFlag If set, introduces a slight random variance so that + * the displayed dial will oscillate randomly around it's real level */ - virtual int getDialLevel(uint dialNum, bool flag = true); + virtual int getDialLevel(uint dialNum, bool randomizeFlag = true); virtual int proc36(int val) const; virtual uint translateId(uint id) const; |