void techroom_unload_animation() { int i; //clear everything, just in case, it will get loaded when needed later if (Weapon_list != NULL) { for (i = 0; i < Weapon_list_size; i++) { if (Weapon_list[i].animation.num_frames != 0) { generic_anim_unload(&Weapon_list[i].animation); } if (Weapon_list[i].bitmap >= 0) { bm_release(Weapon_list[i].bitmap); Weapon_list[i].bitmap = -1; } } } for (i = 0; i < Intel_list_size; i++) { if (Intel_list[i].animation.num_frames != 0) { generic_anim_unload(&Intel_list[i].animation); } if (Intel_list[i].bitmap >= 0) { bm_release(Intel_list[i].bitmap); Intel_list[i].bitmap = -1; } } }
void techroom_lists_reset() { int i; //unload the current animation, we load another one for the new current entry if(Tab != SHIPS_DATA_TAB) techroom_unload_animation(); Current_list = NULL; Current_list_size = 0; model_free_all(); if (Ship_list != NULL) { delete[] Ship_list; Ship_list = NULL; } Ship_list_size = 0; Ships_loaded = 0; if (Weapon_list != NULL) { for (i = 0; i < Weapon_list_size; i++) { if (Weapon_list[i].animation.num_frames != 0) { generic_anim_unload(&Weapon_list[i].animation); } if (Weapon_list[i].bitmap >= 0) { bm_release(Weapon_list[i].bitmap); Weapon_list[i].bitmap = -1; } } delete[] Weapon_list; Weapon_list = NULL; } Weapon_list_size = 0; Weapons_loaded = 0; for (i = 0; i < Intel_list_size; i++) { if (Intel_list[i].animation.num_frames != 0) { generic_anim_unload(&Intel_list[i].animation); } if (Intel_list[i].bitmap >= 0) { bm_release(Intel_list[i].bitmap); Intel_list[i].bitmap = -1; } } Intel_list_size = 0; Intel_loaded = 0; }
void cmd_brief_close() { int i; if (Cmd_brief_inited) { cmd_brief_stop_anim(); generic_anim_unload(&Cur_Anim); for (i=0; i<Cur_cmd_brief->num_stages; i++) { if (Cur_cmd_brief->stage[i].wave >= 0) audiostream_close_file(Cur_cmd_brief->stage[i].wave, 0); } // so that the same ani will reload properly upon return Cur_anim_filename = "~~~~"; if (Cmd_brief_background_bitmap >= 0) bm_release(Cmd_brief_background_bitmap); // unload the overlay bitmap help_overlay_unload(CMD_BRIEF_OVERLAY); Ui_window.destroy(); game_flush(); Cmd_brief_inited = 0; } // Stop any speech from running over fsspeech_stop(); }
// close void loop_brief_close() { // this makes sure that we're all cool no matter how the user decides to exit mission_campaign_mission_over(); // free the bitmap if (Loop_brief_bitmap >= 0){ bm_release(Loop_brief_bitmap); } Loop_brief_bitmap = -1; // destroy the window Loop_brief_window.destroy(); if (Loop_anim.num_frames > 0) { generic_anim_unload(&Loop_anim); } // stop voice if(Loop_sound != -1){ audiostream_stop(Loop_sound, 1, 0); audiostream_close_file(Loop_sound, 1); Loop_sound = -1; } fsspeech_stop(); // stop music common_music_close(); }
void cmd_brief_new_stage(int stage) { if (stage < 0) { cmd_brief_stop_anim(); Cur_stage = -1; } Cur_stage = stage; brief_color_text_init(Cur_cmd_brief->stage[stage].text.c_str(), Cmd_text_wnd_coords[Uses_scroll_buttons][gr_screen.res][CMD_W_COORD]); // load a new animation if it's different to what's already playing if (strcmp(Cur_anim_filename, Cur_cmd_brief->stage[stage].ani_filename) != 0) { // unload the previous anim if(Cur_Anim.num_frames > 0) { generic_anim_unload(&Cur_Anim); } // save new filename Cur_anim_filename = Cur_cmd_brief->stage[stage].ani_filename; // try to load the new anim in either high or low res int stream_result = generic_anim_init_and_stream(&Cur_Anim, Cur_anim_filename, bm_get_type(Cmd_brief_background_bitmap), true); // we've failed to load any animation if (stream_result < 0) { // load an image and treat it like a 1 frame animation Cur_Anim.first_frame = bm_load(Cur_cmd_brief->stage[stage].ani_filename); //if we fail here, the value is still -1 if(Cur_Anim.first_frame != -1) { Cur_Anim.num_frames = 1; } } } //resetting the audio here cmd_brief_stop_anim(); Top_cmd_brief_text_line = 0; }