void techroom_select_new_entry() { Assert(Current_list != NULL); if (Current_list == NULL || Current_list_size <= 0) { Cur_entry_index = Cur_entry = -1; techroom_init_desc(NULL,0); return; } Cur_entry_index = Current_list[Cur_entry].index; Assert( Cur_entry_index >= 0 ); // if we are in the ships tab, load the ship model if (Tab == SHIPS_DATA_TAB) { ship_info *sip = &Ship_info[Cur_entry_index]; // little memory management, kinda hacky but it should keep the techroom at around // 100meg rather than the 700+ it can get to with all ships loaded - taylor for (int i=0; i<Current_list_size; i++) { if ((Current_list[i].model_num > -1) && (Current_list[i].textures_loaded)) { // don't unload any spot within 5 of current if ( (i < Cur_entry + 5) && (i > Cur_entry - 5) ) continue; mprintf(("TECH ROOM: Dumping excess ship textures...\n")); model_page_out_textures(Current_list[i].model_num); Current_list[i].textures_loaded = 0; } } Techroom_ship_modelnum = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]); Current_list[Cur_entry].model_num = Techroom_ship_modelnum; // page in ship textures properly (takes care of nondimming pixels) model_page_in_textures(Techroom_ship_modelnum, Cur_entry_index); Current_list[Cur_entry].textures_loaded = 1; } else { Techroom_ship_modelnum = -1; Trackball_mode = 0; // load animation here, we now only have one loaded int stream_result = generic_anim_init_and_stream(&Current_list[Cur_entry].animation, Current_list[Cur_entry].tech_anim_filename, bm_get_type(Tech_background_bitmap), true); if (stream_result >= 0) { Current_list[Cur_entry].has_anim = 1; } else { // we've failed to load any animation // load an image and treat it like a 1 frame animation Current_list[Cur_entry].bitmap = bm_load(Current_list[Cur_entry].tech_anim_filename); } } techroom_init_desc(Current_list[Cur_entry].desc, Tech_desc_coords[gr_screen.res][SHIP_W_COORD]); fsspeech_play(FSSPEECH_FROM_TECHROOM, Current_list[Cur_entry].desc); }
void shockwave_page_in() { uint i; // load in shockwaves for (i = 0; i < Shockwave_info.size(); i++) { if (Shockwave_info[i].bitmap_id >= 0) { bm_page_in_texture( Shockwave_info[i].bitmap_id, Shockwave_info[i].num_frames ); } else if (Shockwave_info[i].model_id >= 0) { // for a model we have to run model_load() on it again to make sure // that it's ref_count is sane for this mission int idx = model_load( Shockwave_info[i].filename, 0, NULL ); Assert( idx == Shockwave_info[i].model_id ); model_page_in_textures( Shockwave_info[i].model_id ); } } }