From c0e55de8f08027b4715facfd7febc1910e254afd Mon Sep 17 00:00:00 2001 From: The_E Date: Tue, 15 Jun 2010 12:04:50 +0000 Subject: [PATCH] Fix for Mantis 2210 (Ship models in ship selection do not always show up properly) --- code/missionui/missionshipchoice.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/code/missionui/missionshipchoice.cpp b/code/missionui/missionshipchoice.cpp index 80c444ec72..9ffbb21567 100644 --- a/code/missionui/missionshipchoice.cpp +++ b/code/missionui/missionshipchoice.cpp @@ -1481,7 +1481,7 @@ void ship_select_do(float frametime) ////////////////////////////////// // Render and draw the 3D model // ////////////////////////////////// - if( Cmdline_ship_choice_3d || ((Ss_icons != NULL) && (Selected_ss_class >= 0) && (Ss_icons[Selected_ss_class].ss_anim.num_frames > 0)) ) + if( Cmdline_ship_choice_3d || ( (Selected_ss_class >= 0) && (Ss_icons[Selected_ss_class].ss_anim.num_frames == 0)) ) { // check we have a valid ship class selected if ( (Selected_ss_class >= 0) && (ShipSelectModelNum >= 0) ) @@ -1713,6 +1713,12 @@ void start_ship_animation(int ship_class, int play_sound) return; } + //Unload Anim if one was playing + if(Ship_anim_class > 0 && Ss_icons[Ship_anim_class].ss_anim.num_frames > 0) { + generic_anim_unload(&Ss_icons[Ship_anim_class].ss_anim); + Ship_anim_class = -1; + } + // Load the necessary model file ShipSelectModelNum = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]); @@ -1733,6 +1739,12 @@ void start_ship_animation(int ship_class, int play_sound) ss_icon = &Ss_icons[ship_class]; + //If there was a model loaded for the previous ship, unload it + if (ShipSelectModelNum >= 0 ) { + model_unload(ShipSelectModelNum); + ShipSelectModelNum = -1; + } + //unload the previous anim if(Ship_anim_class > 0 && Ss_icons[Ship_anim_class].ss_anim.num_frames > 0) generic_anim_unload(&Ss_icons[Ship_anim_class].ss_anim); @@ -1764,7 +1776,6 @@ void start_ship_animation(int ship_class, int play_sound) // if ( play_sound ) { gamesnd_play_iface(SND_SHIP_ICON_CHANGE); // } - } void ss_unload_all_anims()