diff options
author | Paul Gilbert | 2016-05-06 20:53:50 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:38:35 -0400 |
commit | 7396781cd44c2ec340308e5ad9de9cefc0ef3eeb (patch) | |
tree | c11d77a6b7f946e246c586ebccf0060fe40fd246 /engines/titanic/npcs | |
parent | 82299474029d0568c3de0bcbcc485ad9e14cf7dd (diff) | |
download | scummvm-rg350-7396781cd44c2ec340308e5ad9de9cefc0ef3eeb.tar.gz scummvm-rg350-7396781cd44c2ec340308e5ad9de9cefc0ef3eeb.tar.bz2 scummvm-rg350-7396781cd44c2ec340308e5ad9de9cefc0ef3eeb.zip |
TITANIC: Implemented more CTrueTalkNPC message handlers
Diffstat (limited to 'engines/titanic/npcs')
-rw-r--r-- | engines/titanic/npcs/true_talk_npc.cpp | 37 | ||||
-rw-r--r-- | engines/titanic/npcs/true_talk_npc.h | 5 |
2 files changed, 36 insertions, 6 deletions
diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index 72b3cf2537..183c189f8a 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -160,18 +160,35 @@ bool CTrueTalkNPC::MovieEndMsg(CMovieEndMsg *msg) { } bool CTrueTalkNPC::NPCQueueIdleAnimMsg(CNPCQueueIdleAnimMsg *msg) { - // TODO - return false; + int rndVal = g_vm->getRandomNumber(_fieldF8 - 1) - (_fieldF8 / 2); + _speechTimerId = startAnimTimer("NPCIdleAnim", _fieldF4 + rndVal, 0); + + return true; } bool CTrueTalkNPC::TimerMsg(CTimerMsg *msg) { - // TODO - return false; + if (_npcFlags & NPCFLAG_4) { + if (_field100 > 0) + return false; + + CNPCPlayIdleAnimationMsg idleMsg; + if (idleMsg.execute(this)) { + if (idleMsg._value) { + CNPCPlayAnimationMsg animMsg(idleMsg._value, 0); + animMsg.execute(this); + } + + _npcFlags &= ~NPCFLAG_2; + } + } + + _speechTimerId = 0; + return true; } bool CTrueTalkNPC::NPCPlayAnimationMsg(CNPCPlayAnimationMsg *msg) { - // TODO - return false; + warning("CTrueTalkNPC::NPCPlayAnimationMsg"); + return true; } void CTrueTalkNPC::processInput(CTextInputMsg *msg, CViewItem *view) { @@ -182,4 +199,12 @@ void CTrueTalkNPC::performAction(int val1, int val2) { // TODO } +int CTrueTalkNPC::startAnimTimer(const CString &action, uint firstDuration, uint duration) { + CTimeEventInfo *timer = new CTimeEventInfo(g_vm->_events->getTicksCount(), + duration > 0, firstDuration, duration, this, 0, action); + getGameManager()->addTimer(timer); + + return timer->_id; +} + } // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index 74bf044a57..ad436a5582 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -60,6 +60,11 @@ protected: protected: void processInput(CTextInputMsg *msg, CViewItem *view); void performAction(int val1, int val2); + + /** + * Start an animation timer + */ + int startAnimTimer(const CString &action, uint firstDuration, uint duration); public: CLASSDEF CTrueTalkNPC(); |