aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/npcs/true_talk_npc.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-28 14:39:59 -0400
committerPaul Gilbert2016-08-28 14:39:59 -0400
commit4933b59e8e039ae346f650c044e5fe0ba6310ead (patch)
tree805e33ea6fa6109e42d8f8b267ed2b6e5c2a00e2 /engines/titanic/npcs/true_talk_npc.cpp
parent1760fb3e0d25704685e9b44f0792536da962082d (diff)
downloadscummvm-rg350-4933b59e8e039ae346f650c044e5fe0ba6310ead.tar.gz
scummvm-rg350-4933b59e8e039ae346f650c044e5fe0ba6310ead.tar.bz2
scummvm-rg350-4933b59e8e039ae346f650c044e5fe0ba6310ead.zip
TITANIC: Implemented remaining game classes
Diffstat (limited to 'engines/titanic/npcs/true_talk_npc.cpp')
-rw-r--r--engines/titanic/npcs/true_talk_npc.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp
index 5ba68aafbe..97913dffea 100644
--- a/engines/titanic/npcs/true_talk_npc.cpp
+++ b/engines/titanic/npcs/true_talk_npc.cpp
@@ -188,7 +188,34 @@ bool CTrueTalkNPC::TimerMsg(CTimerMsg *msg) {
}
bool CTrueTalkNPC::NPCPlayAnimationMsg(CNPCPlayAnimationMsg *msg) {
- warning("CTrueTalkNPC::NPCPlayAnimationMsg");
+// const char *const *nameP = msg->_names;
+ int count;
+ for (count = 0; msg->_names[count]; ++count)
+ ;
+
+ if (msg->_maxDuration) {
+ // Randomly pick a clip that's less than the allowed maximum
+ int tries = 10, index;
+ do {
+ index = getRandomNumber(count - 1);
+ } while (getClipDuration(msg->_names[index]) > msg->_maxDuration && --tries);
+
+ if (tries) {
+ // Sequentially go through the clips to find any below the maximum
+ index = 0;
+ for (int idx = 0; idx < count; ++idx) {
+ if (getClipDuration(msg->_names[idx]) < msg->_maxDuration) {
+ index = idx;
+ break;
+ }
+ }
+ }
+
+ playClip(msg->_names[index], MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT);
+ } else {
+ playClip(msg->_names[getRandomNumber(count - 1)]);
+ }
+
return true;
}