From 859d1f07c0f1b353349643dc05f2e1436fb381b7 Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Fri, 12 Aug 2005 08:55:13 +0000 Subject: [PATCH] sync up talking head fixes from FS2_Open code base (still not 100%) --- src/anim/animplay.cpp | 5 ++++- src/mission/missionmessage.cpp | 37 ++++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/anim/animplay.cpp b/src/anim/animplay.cpp index 81ee820..5144632 100644 --- a/src/anim/animplay.cpp +++ b/src/anim/animplay.cpp @@ -15,6 +15,9 @@ * C module for playing back anim files * * $Log$ + * Revision 1.6 2005/08/12 08:55:13 taylor + * sync up talking head fixes from FS2_Open code base (still not 100%) + * * Revision 1.5 2004/09/20 01:31:44 theoddone33 * GCC 3.4 fixes. * @@ -1048,7 +1051,7 @@ int anim_free(anim *ptr) } if ( !list ) - return -1; + return -2; // only free when ref_count is 0 ptr->ref_count--; diff --git a/src/mission/missionmessage.cpp b/src/mission/missionmessage.cpp index 92dff01..f4245da 100644 --- a/src/mission/missionmessage.cpp +++ b/src/mission/missionmessage.cpp @@ -15,6 +15,9 @@ * Controls messaging to player during the mission * * $Log$ + * Revision 1.7 2005/08/12 08:55:13 taylor + * sync up talking head fixes from FS2_Open code base (still not 100%) + * * Revision 1.6 2004/07/04 11:42:56 taylor * cleanup talking head code a little, fix anim free to work better and prevent crashes, fix test for old anim * @@ -832,24 +835,31 @@ void messages_init() // free a loaded avi void message_mission_free_avi(int m_index) { - int count = 0; - int i; + int rc = 0, try_count = 0; // check for bogus index - if ( (m_index < 0) || (m_index > Num_message_avis) ) + if ( (m_index < 0) || (m_index >= Num_message_avis) ) + return; + + // Make sure this code doesn't get run if the talking head guage is off + // helps prevent a crash on jump out if this code doesn't work right + if ( !hud_gauge_active(HUD_TALKING_HEAD) ) return; if (Message_avis[m_index].anim_data != NULL) { - // how many tries do we need to make - count = Message_avis[m_index].anim_data->ref_count; + do { + rc = anim_free( Message_avis[m_index].anim_data ); + try_count++; - for (i=0; i