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 generic_anim_unload(generic_anim *ga) { if(ga->num_frames > 0) { if(ga->streaming) { if(ga->type == BM_TYPE_ANI) { anim_free(ga->ani.animation); free_anim_instance(ga->ani.instance); } if(ga->type == BM_TYPE_EFF) { if(ga->eff.next_frame >= 0) bm_release(ga->eff.next_frame); if(ga->bitmap_id >= 0) bm_release(ga->bitmap_id); } if(ga->type == BM_TYPE_PNG) { if(ga->bitmap_id >= 0) bm_release(ga->bitmap_id); if (ga->png.anim != nullptr) { delete ga->png.anim; ga->png.anim = nullptr; } } } else { //trying to release the first frame will release ALL frames bm_release(ga->first_frame); } if(ga->buffer) { bm_release(ga->bitmap_id); } } generic_anim_init(ga, NULL); }
// ----------------------------------------------------------------------------- void barracks_close() { // destroy window Ui_window.destroy(); // release background bitmap if (Background_bitmap >= 0) { bm_release(Background_bitmap); } // release rank pip bitmaps bm_release(Rank_pips_bitmaps); // release pilot pic bitmaps for (int i=0; i<Num_pilot_images; i++) { if (Pilot_images[i] >= 0) { bm_release(Pilot_images[i]); } } if(Stat_labels != NULL) { delete[] Stat_labels; Stat_labels = NULL; } if(Stats != NULL) { delete[] Stats; Stats = NULL; } game_flush(); }
void chatbox_close() { if (!Chatbox_created) return; // destory the UI window Chat_window.destroy(); // unload any bitmaps if (Chatbox_small_bitmap != -1) { bm_release(Chatbox_small_bitmap); Chatbox_small_bitmap = -1; } if (Chatbox_big_bitmap != -1) { bm_release(Chatbox_big_bitmap); Chatbox_big_bitmap = -1; } if (Chatbox_mp_bitmap != -1) { bm_release(Chatbox_mp_bitmap); Chatbox_mp_bitmap = -1; } // clear all the text lines in the chatbox_clear(); Chatbox_created = 0; }
// reset the player infomation for this popup void multi_pinfo_reset_player(net_player *np) { // assign the player Multi_pinfo_popup_player = np; // unload any old image data if necessary strcpy_s(Mp_pilot.filename, ""); if(Mp_pilot.bitmap != -1){ bm_release(Mp_pilot.bitmap); Mp_pilot.bitmap = -1; } strcpy_s(Mp_squad.filename, ""); if(Mp_squad.bitmap != -1){ bm_release(Mp_squad.bitmap); Mp_squad.bitmap = -1; } // try and load pilot pic/squad logo if(np->m_player->image_filename[0] != '\0'){ strcpy_s(Mp_pilot.filename, np->m_player->image_filename); Mp_pilot.bitmap = bm_load_duplicate(Mp_pilot.filename); } if(np->m_player->m_squad_filename[0] != '\0'){ strcpy_s(Mp_squad.filename, np->m_player->m_squad_filename); Mp_squad.bitmap = bm_load_duplicate(Mp_squad.filename); } // build the stats value strings for this player multi_pinfo_build_stats(); }
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; }
// cleanup called when exiting the show goals screen void ML_objectives_close() { if (Goal_complete_bitmap >= 0) { bm_release(Goal_complete_bitmap); } if (Goal_incomplete_bitmap >= 0) { bm_release(Goal_incomplete_bitmap); } if (Goal_failed_bitmap >= 0) { bm_release(Goal_failed_bitmap); } }
void training_menu_close() { if (training_menu_inited) { // done with the bitmap, so unlock it bm_unlock(trainingMenuMask); // unload the bitmaps bm_release(trainingMenuBitmap); bm_release(trainingMenuMask); training_menu_inited = 0; snazzy_menu_close(); } }
// close the popup void multi_pinfo_popup_close() { int idx; // unload any bitmaps if (Multi_pinfo_bitmap != -1) { bm_release(Multi_pinfo_bitmap); } // free the background screen if possible if (Multi_pinfo_screen_save >= 0) { gr_free_screen(Multi_pinfo_screen_save); } // release the pilot/squad images if (Mp_pilot.bitmap != -1) { bm_release(Mp_pilot.bitmap); } if (Mp_squad.bitmap != -1) { bm_release(Mp_squad.bitmap); } // free up strings for (idx = 0; idx < MULTI_PINFO_NUM_STATS_LABELS; idx++) { if (Multi_pinfo_stats_labels[idx] != NULL) { vm_free(Multi_pinfo_stats_labels[idx]); Multi_pinfo_stats_labels[idx] = NULL; } } // unset the player handle Multi_pinfo_popup_player = NULL; // mark the popup as not running Multi_pinfo_popup_running = 0; // destroy the UI_WINDOW Multi_pinfo_window.destroy(); // restore hardware textures detail level Detail.hardware_textures = Multi_pinfo_hardware_texture_backup; }
// close the pause screen void pause_close() { // if we're not paused - do nothing if ( !Paused ) { return; } Assert( !(Game_mode & GM_MULTIPLAYER) ); // unpause all weapon sounds weapon_unpause_sounds(); // deinit stuff if(Pause_saved_screen != -1) { gr_free_screen(Pause_saved_screen); Pause_saved_screen = -1; } if (Pause_background_bitmap != -1){ bm_release(Pause_background_bitmap); Pause_background_bitmap = -1; } Pause_win.destroy(); game_flush(); // unpause all the music audiostream_unpause_all(); Paused = 0; }
// close void fiction_viewer_close() { if (!Fiction_viewer_inited) return; // free the fiction fiction_viewer_reset(); // destroy the window Fiction_viewer_window.destroy(); // restore the old font use_std_font(); // free the bitmap if (Fiction_viewer_bitmap >= 0) bm_release(Fiction_viewer_bitmap); Fiction_viewer_bitmap = -1; // maybe stop music if (Mission_music[SCORE_FICTION_VIEWER] != Mission_music[SCORE_BRIEFING]) common_music_close(); game_flush(); Fiction_viewer_inited = 0; }
// ------------------------------------------------------------------------------------ // shockwave_level_close() // // Call at the close of each level (mission) // void shockwave_level_close() { if ( !Shockwave_inited ) return; shockwave_delete_all(); uint i; // unload default shockwave, and erase all others for (i = 0; i < Shockwave_info.size(); i++) { if ( !i ) { if (Shockwave_info[i].bitmap_id >= 0) bm_unload( Shockwave_info[i].bitmap_id ); else if (Shockwave_info[i].model_id >= 0) model_page_out_textures( Shockwave_info[i].model_id ); continue; } if (Shockwave_info[i].bitmap_id >= 0) bm_release( Shockwave_info[i].bitmap_id ); if (Shockwave_info[i].model_id >= 0) model_unload( Shockwave_info[i].model_id ); Shockwave_info.erase( Shockwave_info.begin() + i ); } Shockwave_inited = 0; }
// shutdown nebula stuff void neb2_level_close() { int idx; // standalone servers can bail here if (Game_mode & GM_STANDALONE_SERVER) { return; } // if the mission is not a fullneb mission, skip if ( !((The_mission.flags[Mission::Mission_Flags::Fullneb]) || Nebula_sexp_used) ) { return; } // unload all nebula bitmaps for (idx=0; idx<Neb2_poof_count; idx++) { if (Neb2_poofs[idx] >= 0) { bm_release(Neb2_poofs[idx]); Neb2_poofs[idx] = -1; } } // unflag the mission as being fullneb so stuff doesn't fog in the techdata room :D The_mission.flags.remove(Mission::Mission_Flags::Fullneb); if (Neb2_htl_fog_data) { delete[] Neb2_htl_fog_data; Neb2_htl_fog_data = NULL; } }
void cutscenes_screen_close() { if (Background_bitmap) bm_release(Background_bitmap); Ui_window.destroy(); }
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 UI_DOT_SLIDER::destroy() { // release ani frames for the dots. bm_release(first_frame); UI_GADGET::destroy(); }
void credits_close() { int i; /* if (CreditsWin01 != -1){ bm_unload(CreditsWin01); CreditsWin01 = -1; } if (CreditsWin02 != -1){ bm_unload(CreditsWin02); CreditsWin02 = -1; } if (CreditsWin03 != -1){ bm_unload(CreditsWin03); CreditsWin03 = -1; } if (CreditsWin04 != -1){ bm_unload(CreditsWin04); CreditsWin04 = -1; } */ for (i=0; i<NUM_IMAGES; i++){ if (Credits_bmps[i] >= 0){ bm_release(Credits_bmps[i]); Credits_bmps[i] = -1; } } credits_stop_music(); if (Credit_text) { if (Credit_text_malloced){ vm_free(Credit_text); } Credit_text = NULL; } if (Background_bitmap){ bm_release(Background_bitmap); } Ui_window.destroy(); common_free_interface_palette(); // restore game palette }
subtitle::~subtitle() { if (image_id != -1) { if ( bm_release(image_id) ) { image_id = -1; } } }
// --------------------------------------------------------------------- // mission_hotkey_close() // // Cleanup the hotkey assignment screen system. Called when GS_STATE_HOTKEY_SCREEN // is left. // void mission_hotkey_close() { if (Background_bitmap) bm_release(Background_bitmap); if (Wing_bmp >= 0) bm_release(Wing_bmp); // unpause all weapon sounds weapon_unpause_sounds(); // unpause all game music audiostream_unpause_all(); Ui_window.destroy(); common_free_interface_palette(); // restore game palette game_flush(); }
// cleanup called when exiting the show goals screen void mission_show_goals_close() { if (Goals_screen_bg_bitmap >= 0) bm_release(Goals_screen_bg_bitmap); if (Goal_complete_bitmap) bm_release(Goal_complete_bitmap); if (Goal_incomplete_bitmap) bm_release(Goal_incomplete_bitmap); if (Goal_failed_bitmap) bm_release(Goal_failed_bitmap); Goals_screen_ui_window.destroy(); common_free_interface_palette(); // restore game palette game_flush(); }
void techroom_close() { fsspeech_stop(); techroom_lists_reset(); Techroom_show_all = 0; if (Tech_background_bitmap) { bm_release(Tech_background_bitmap); } Ui_window.destroy(); common_free_interface_palette(); // restore game palette if (Palette_bmp){ bm_release(Palette_bmp); } }
void RocketRenderingInterface::ReleaseTexture(TextureHandle texture) { GR_DEBUG_SCOPE("libRocket::ReleaseTexture"); Assertion(texture, "Invalid texture handle!"); auto tex = get_texture(texture); bm_release(tex->handle); delete tex; }
void UI_DOT_SLIDER::destroy() { int i; // release ani frames for the dots. for (i=0; i<total_frames; i++){ bm_release(first_frame + i); } UI_GADGET::destroy(); }
void UI_WINDOW::release_bitmaps() { if (mask_bmap_ptr) { // done with the mask bitmap, so unlock it bm_unlock(mask_bmap_id); // unload the bitmaps if (mask_bmap_id >= 0) { bm_release(mask_bmap_id); mask_bmap_id = -1; } mask_data = NULL; mask_bmap_ptr = NULL; } if (foreground_bmap_id >= 0) { bm_release(foreground_bmap_id); foreground_bmap_id = -1; } }
void credits_close() { int i; for (i=0; i<Credits_num_images; i++) { if (Credits_bmps[i] >= 0){ bm_release(Credits_bmps[i]); } } Credits_bmps.clear(); credits_stop_music(true); Credit_text_parts.clear(); if (Background_bitmap){ bm_release(Background_bitmap); } Ui_window.destroy(); common_free_interface_palette(); // restore game palette }
const subtitle &subtitle::operator=(const subtitle &sub) { if (this != &sub) { if (image_id != -1) { if ( bm_release(image_id) ) { image_id = -1; } } clone(sub); } return *this; }
// called once when leaving the gameplay help state void gameplay_help_close() { if ( Gameplay_help_inited ) { if (Background_bitmap >= 0) { bm_release(Background_bitmap); } Ui_window.destroy(); common_free_interface_palette(); // restore game palette game_flush(); } Gameplay_help_inited = 0; }
Cursor::~Cursor() { SCP_vector<SDL_Cursor*>::iterator iter; for (iter = mAnimationFrames.begin(); iter != mAnimationFrames.end(); ++iter) { SDL_FreeCursor(*iter); } mAnimationFrames.clear(); // Free cursor bm_release(mBitmapHandle); mBitmapHandle = -1; }
void gr_opengl_free_screen(int bmp_id) { if (!GL_saved_screen) return; vm_free(GL_saved_screen); GL_saved_screen = NULL; Assert( (bmp_id < 0) || (bmp_id == GL_saved_screen_id) ); if (GL_saved_screen_id < 0) return; bm_release(GL_saved_screen_id); GL_saved_screen_id = -1; }