Ejemplo n.º 1
0
// Reset everything between levels
void particle_init()
{
	int fps;

	Particles_enabled = (Detail.num_particles > 0);

	Num_particles = 0;

	Particles.clear();

	// FIRE!!!
	if ( Anim_bitmap_id_fire == -1 )	{
		Anim_bitmap_id_fire = bm_load_animation( "particleexp01", &Anim_num_frames_fire, &fps, NULL, 0 );
	}

	// Cough, cough
	if ( Anim_bitmap_id_smoke == -1 )	{
		Anim_bitmap_id_smoke = bm_load_animation( "particlesmoke01", &Anim_num_frames_smoke, &fps, NULL, 0 );
	}

	// wheeze
	if ( Anim_bitmap_id_smoke2 == -1 )	{
		Anim_bitmap_id_smoke2 = bm_load_animation( "particlesmoke02", &Anim_num_frames_smoke2, &fps, NULL, 0 );
	}

	// grab a vertex buffer object
	if ( Particle_buffer_object < 0 ) {
		Particle_buffer_object = gr_create_stream_buffer();
	}
}
// mission initializations (called once before a new mission is started)
void training_mission_init()
{
	int i;

	Assert(!Training_num_lines);
	Training_obj_num_lines = 0;
	Training_msg_que_count = 0;
	Training_failure = 0;
	for (i=0; i<TRAINING_OBJ_LINES; i++)
		Training_obj_lines[i] = -1;

	if ( !Directive_frames_loaded ) {
		for ( i = 0; i < NUM_DIRECTIVE_GAUGES; i++ ) {
			Directive_gauge[i].first_frame = bm_load_animation(Directive_fnames[i], &Directive_gauge[i].num_frames);
			if ( Directive_gauge[i].first_frame < 0 ) {
				Warning(LOCATION,"Cannot load hud ani: %s\n", Directive_fnames[i]);
			}
		}

		Directive_frames_loaded = 1;
	}

	// only clear player flags if this is actually a training mission
	if ( The_mission.game_type & MISSION_TYPE_TRAINING ) {
		Player->flags &= ~(PLAYER_FLAGS_MATCH_TARGET | PLAYER_FLAGS_MSG_MODE | PLAYER_FLAGS_AUTO_TARGETING | PLAYER_FLAGS_AUTO_MATCH_SPEED | PLAYER_FLAGS_LINK_PRIMARY | PLAYER_FLAGS_LINK_SECONDARY );
	}
}
Ejemplo n.º 3
0
void hud_init_ets()
{
	if (Hud_ets_inited)
		return;

	Ets_gauge.first_frame = bm_load_animation(Ets_fname[gr_screen.res], &Ets_gauge.num_frames);
	if (Ets_gauge.first_frame < 0)
	{
		Warning(LOCATION, "Cannot load hud ani: Ets_fname[gr_screen.res]\n");
	}

	if (Lcl_gr)
	{
		Ets_gauge_info = Ets_gauge_info_german[gr_screen.res];
	}
	else if (Lcl_fr)
	{
		Ets_gauge_info = Ets_gauge_info_french[gr_screen.res];
	}
	else
	{
		Ets_gauge_info = Ets_gauge_info_english[gr_screen.res];
	}

	Hud_ets_inited = 1;
}
Ejemplo n.º 4
0
void HudGaugeRadarOrb::initBitmaps(char *fname)
{
    Radar_gauge.first_frame = bm_load_animation(fname, &Radar_gauge.num_frames);
    if ( Radar_gauge.first_frame < 0 ) {
        Warning(LOCATION,"Cannot load hud ani: %s\n", fname);
    }
}
void HudGaugeReticle::initBitmaps(char *fname)
{
	crosshair.first_frame = bm_load_animation(fname, &crosshair.num_frames);
	if (crosshair.first_frame < 0) {
		mprintf(("Cannot load hud ani: %s\n", fname));
	}
}
Ejemplo n.º 6
0
void HudGaugeShieldMini::initBitmaps(char *fname)
{
	Shield_mini_gauge.first_frame = bm_load_animation(fname, &Shield_mini_gauge.num_frames);
	if ( Shield_mini_gauge.first_frame == -1 ) {
		Warning(LOCATION, "Could not load in the HUD shield ani: %s\n", fname);
	}
}
Ejemplo n.º 7
0
// called from HUD init, loads the bitmap data in once, and resets any data for each level
void hud_escort_init()
{
#ifndef NEW_HUD
	int i;

	if ( !Escort_gauges_loaded ) {
		for ( i = 0; i < NUM_ESCORT_FRAMES; i++ ) {
			if ( strlen(current_hud->Escort_filename[i]) ) {
				Escort_gauges[i].first_frame = bm_load_animation(current_hud->Escort_filename[i], &Escort_gauges[i].num_frames);

				if (Escort_gauges[i].first_frame == -1) {
					Warning(LOCATION, "Could not load in ani: %s\n", current_hud->Escort_filename[i]);
					return;
				}
			} else {
				Escort_gauges[i].first_frame = -1;
			}
		}

		Escort_gauges_loaded = 1;
	}

	Last_target_index = -1;

	if (Max_escort_ships > MAX_COMPLETE_ESCORT_LIST) {
		Max_escort_ships = MAX_COMPLETE_ESCORT_LIST;
	}
#endif
}
Ejemplo n.º 8
0
void pilot_manage_init(void)
{

	UI_WINDOW *w = &Ui_window;

	// create interface
	Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
	Ui_window.set_mask_bmap(PilotManage_bitmap_mask_fname[gr_screen.res]);

	// load background bitmap
	Background_bitmap = bm_load(PilotManage_bitmap_fname[gr_screen.res]);
	if(Background_bitmap < 0){
		// we failed to load the bitmap - this is very bad
		Int3();
	}

	for (int i=0; i<PM_NUM_BUTTONS; i++) {
		// create the object
		Buttons[gr_screen.res][i].button.create(&Ui_window, "", Buttons[gr_screen.res][i].x, Buttons[gr_screen.res][i].y, 60, 30, Buttons[gr_screen.res][i].repeat, 1);

		// set the sound to play when highlighted
		Buttons[gr_screen.res][i].button.set_highlight_action(common_play_highlight_sound);

		// set the ani for the button
		Buttons[gr_screen.res][i].button.set_bmaps(Buttons[gr_screen.res][i].filename);

		// set the hotspot
		Buttons[gr_screen.res][i].button.link_hotspot(Buttons[gr_screen.res][i].hotspot);
	}
	
	// load in help overlay bitmap	
	// needs to be fixed, taked out to get to compile
	//	help_overlay_load(PILOT_MANAGE_OVERLAY);
//	help_overlay_set_state(PILOT_MANAGE_OVERLAY,0);
	
	
	// button for selecting pilot
	List_region.create(&Ui_window, "", Pilot_manage_list_coords[gr_screen.res][PM_X_COORD], Pilot_manage_list_coords[gr_screen.res][PM_Y_COORD], Pilot_manage_list_coords[gr_screen.res][PM_W_COORD], Pilot_manage_list_coords[gr_screen.res][PM_H_COORD], 0, 1);
	List_region.hide();

	// create input box (for new pilot)
	Inputbox.create(&Ui_window, Pilot_manage_list_coords[gr_screen.res][PM_X_COORD], Pilot_manage_list_coords[gr_screen.res][PM_Y_COORD], Pilot_manage_list_coords[gr_screen.res][PM_W_COORD], CALLSIGN_LEN - 1, "", UI_INPUTBOX_FLAG_INVIS | UI_INPUTBOX_FLAG_KEYTHRU | UI_INPUTBOX_FLAG_LETTER_FIRST);
	Inputbox.set_valid_chars(VALID_PILOT_CHARS);
	Inputbox.disable();
	Inputbox.hide();

	Rank_pips_bitmaps = bm_load_animation("IconRankMini.ani", &Rank_pips_count);	

	pilot_manage_callsign_enter_mode = 0;
	List_scroll_offset = Pic_number = Pic_squad_number;// = Selected_line = 0;

	prev_single_player = -1;
	prev_multi_player = -1;
	
	pilot_manage_init_player_stuff(is_pilot_multi(Player));

	// enable hotkeys from start
	pilot_manage_set_callsign_enter_mode(false);
		
}
Ejemplo n.º 9
0
// called at the start of each level from HUD_init.  Use Hud_shield_init so we only init Shield_gauges[] once.
void hud_shield_level_init()
{
	int i;	

	hud_shield_hit_reset(1);	// reset for the player

	if ( Hud_shield_inited ) {
		return;
	}	

	for ( i = 0; i < MAX_SHIELD_ICONS; i++ ) {
		Shield_gauges[i].first_frame = -1;
		Shield_gauges[i].num_frames  = 0;
	}

	Hud_shield_inited = 1;

	if ( !Shield_mini_loaded ) {
		Shield_mini_gauge.first_frame = bm_load_animation(Shield_mini_fname[gr_screen.res], &Shield_mini_gauge.num_frames);
		if ( Shield_mini_gauge.first_frame == -1 ) {
			Warning(LOCATION, "Could not load in the HUD shield ani: Shield_mini_fname[gr_screen.res]\n");
			return;
		}
		Shield_mini_loaded = 1;
	}
}
Ejemplo n.º 10
0
void HudGaugeEts::initBitmaps(char *fname)
{
	Ets_bar.first_frame = bm_load_animation(fname, &Ets_bar.num_frames);
	if ( Ets_bar.first_frame < 0 ) {
		Warning(LOCATION,"Cannot load hud ani: %s\n", fname);
	}
}
Ejemplo n.º 11
0
void HudGaugeTalkingHead::initBitmaps(const char *fname)
{
    Head_frame.first_frame = bm_load_animation(fname, &Head_frame.num_frames);
    if ( Head_frame.first_frame == -1 ) {
        Warning(LOCATION, "Could not load in ani: %s\n", fname);
    }
}
Ejemplo n.º 12
0
// called at beginning of level to page in all ship icons
// used in this level
void hud_ship_icon_page_in(ship_info *sip)
{
	hud_frames	*sgp;

	if ( sip->shield_icon_index == 255 ) {
		return;
	}

	// load in shield frames if not already loaded
	Assert(sip->shield_icon_index < (ubyte)Hud_shield_filenames.size());
	sgp = &Shield_gauges.at(sip->shield_icon_index);

	if ( sgp->first_frame == -1 ) {
		sgp->first_frame = bm_load_animation(Hud_shield_filenames.at(sip->shield_icon_index).c_str(), &sgp->num_frames);
		if ( sgp->first_frame == -1 ) {
			Warning(LOCATION, "Could not load in the HUD shield ani: %s\n", Hud_shield_filenames.at(sip->shield_icon_index).c_str());
			return;
		}
	}

	int i;
	for (i=0; i<sgp->num_frames; i++ )	{
		bm_page_in_aabitmap(sgp->first_frame+i, 1);
	}

}
void HudGaugeThreatIndicator::initBitmaps(char *fname_arc, char *fname_laser, char *fname_lock)
{
	threat_arc.first_frame = bm_load_animation(fname_arc, &threat_arc.num_frames);
	if (threat_arc.first_frame < 0) {
		mprintf(("Cannot load hud ani: %s\n", fname_arc));
	}
	
	laser_warn.first_frame = bm_load_animation(fname_laser, &laser_warn.num_frames);
	if (laser_warn.first_frame < 0) {
		mprintf(("Cannot load hud ani: %s\n", fname_laser));
	}

	lock_warn.first_frame = bm_load_animation(fname_lock, &lock_warn.num_frames);
	if (lock_warn.first_frame < 0) {
		mprintf(("Cannot load hud ani: %s\n", fname_lock));
	}
}
void HudGaugeDirectives::initBitmaps(char *fname_top, char *fname_middle, char *fname_bottom)
{
	directives_top.first_frame = bm_load_animation(fname_top, &directives_top.num_frames);
	if ( directives_top.first_frame < 0 ) {
		Warning(LOCATION,"Cannot load hud ani: %s\n", fname_top);
	}

	directives_middle.first_frame = bm_load_animation(fname_middle, &directives_middle.num_frames);
	if ( directives_middle.first_frame < 0 ) {
		Warning(LOCATION,"Cannot load hud ani: %s\n", fname_middle);
	}

	directives_bottom.first_frame = bm_load_animation(fname_bottom, &directives_bottom.num_frames);
	if ( directives_bottom.first_frame < 0 ) {
		Warning(LOCATION,"Cannot load hud ani: %s\n", fname_bottom);
	}
}
void HudGaugeThrottle::initBitmaps(char *fname)
{
	throttle_frames.first_frame = bm_load_animation(fname, &throttle_frames.num_frames);

	if (throttle_frames.first_frame < 0) {
		mprintf(("Cannot load hud ani: %s\n", fname));
	}
}
Ejemplo n.º 16
0
void UI_INPUTBOX::init_cursor()
{
	cursor_first_frame = bm_load_animation("cursor1", &cursor_nframes, &cursor_fps);
	if ( cursor_first_frame < 0 ) {
		Warning(LOCATION,"Cannot load input box cursor: cursor1.ani\n");
		return;
	}
	cursor_elapsed_time=0;
	cursor_current_frame=0;
}
Ejemplo n.º 17
0
void HudGaugeEscort::initBitmaps(char *fname_top, char *fname_middle, char *fname_bottom)
{
	Escort_gauges[0].first_frame = bm_load_animation(fname_top, &Escort_gauges[0].num_frames);
	if (Escort_gauges[0].first_frame == -1) {
		Warning(LOCATION, "Could not load in ani: %s\n", fname_top);
		return;
	}

	Escort_gauges[1].first_frame = bm_load_animation(fname_middle, &Escort_gauges[1].num_frames);
	if (Escort_gauges[1].first_frame == -1) {
		Warning(LOCATION, "Could not load in ani: %s\n", fname_middle);
		return;
	}

	Escort_gauges[2].first_frame = bm_load_animation(fname_bottom, &Escort_gauges[2].num_frames);
	if (Escort_gauges[2].first_frame == -1) {
		Warning(LOCATION, "Could not load in ani: %s\n", fname_bottom);
		return;
	}
}
Ejemplo n.º 18
0
// ------------------------------------------------------------------------------------
// shockwave_load()
//
// Call to load a shockwave, or add it and then load it
//
int shockwave_load(char *s_name, bool shock_3D)
{
	uint i;
	int s_index = -1;
	shockwave_info *si = NULL;

	Assert( s_name );

	// make sure that this is, or should be, valid
	if ( !VALID_FNAME(s_name) )
		return -1;

	for (i = 0; i < Shockwave_info.size(); i++) {
		if ( !stricmp(Shockwave_info[i].filename, s_name) ) {
			s_index = i;
			break;
		}
	}

	if (s_index < 0) {
		shockwave_info si_tmp;
	
		strcpy(si_tmp.filename, s_name);

		Shockwave_info.push_back( si_tmp );
		s_index = (int)(Shockwave_info.size() - 1);
	}

	Assert( s_index >= 0 );
	si = &Shockwave_info[s_index];

	// make sure to only try loading the shockwave once
	if ( (si->bitmap_id >= 0) || (si->model_id >= 0) )
		return s_index;

	if (shock_3D) {
		si->model_id = model_load( si->filename, 0, NULL );

		if ( si->model_id < 0 ) {
			Error(LOCATION, "Unable to load 3D shockwave '%s'!\n", si->filename);
			return -1;
		}
	} else {
		si->bitmap_id = bm_load_animation( si->filename, &si->num_frames, &si->fps, 1 );

		if ( si->bitmap_id < 0 ) {
			Error(LOCATION, "Unable to load 2D shockwave '%s'!\n", si->filename);
			return -1;
		}
	}
	
	return s_index;
}
void HudGaugeWingmanStatus::initBitmaps(char *fname_left, char *fname_middle, char *fname_right, char *fname_dots)
{
	Wingman_status_left.first_frame = bm_load_animation(fname_left, &Wingman_status_left.num_frames);
	if ( Wingman_status_left.first_frame == -1 ) {
		Warning(LOCATION, "Error loading %s\n", fname_left);
	}

	Wingman_status_middle.first_frame = bm_load_animation(fname_middle, &Wingman_status_middle.num_frames);
	if ( Wingman_status_middle.first_frame == -1 ) {
		Warning(LOCATION, "Error loading %s\n", fname_middle);
	}

	Wingman_status_right.first_frame = bm_load_animation(fname_right, &Wingman_status_right.num_frames);
	if ( Wingman_status_right.first_frame == -1 ) {
		Warning(LOCATION, "Error loading %s\n", fname_right);
	}

	Wingman_status_dots.first_frame = bm_load_animation(fname_dots, &Wingman_status_dots.num_frames);
	if ( Wingman_status_dots.first_frame == -1 ) {
		Warning(LOCATION, "Error loading %s\n", fname_dots);
	}
}
Ejemplo n.º 20
0
int parseAnimation(bool critical) {
	SCP_string name;
	stuff_string(name, F_FILESPEC);

	auto handle = bm_load_animation(name.c_str());

	if (handle < 0) {
		int level = critical ? 1 : 0;
		error_display(level, "Failed to load effect %s!", name.c_str());
	}

	return handle;
}
Ejemplo n.º 21
0
void hud_shield_mini_load()
{
	Shield_mini_gauge.first_frame = bm_load_animation(current_hud->Shield_mini_fname, &Shield_mini_gauge.num_frames);
	if (Shield_mini_gauge.first_frame == -1)
	{
		Warning(LOCATION, "Could not load in the HUD shield ani: Shield_mini_fname\n");
	}
	else
	{
		bm_page_in_aabitmap(Shield_mini_gauge.first_frame, Shield_mini_gauge.num_frames);
		Shield_mini_loaded = true;
	}
}
Ejemplo n.º 22
0
void radar_init()
{
	int i,j;

	Radar_gauge.first_frame = bm_load_animation(Radar_fname[gr_screen.res], &Radar_gauge.num_frames);
	if ( Radar_gauge.first_frame < 0 ) {
		Warning(LOCATION,"Cannot load hud ani: %s\n", Radar_fname[gr_screen.res]);
	}

	for (i=0; i<MAX_RADAR_LEVELS; i++ )	{
		for (j=0; j<MAX_RADAR_COLORS; j++ )	{
			gr_init_alphacolor( &Radar_colors[i][j], Radar_color_rgb[i][j].r, Radar_color_rgb[i][j].g, Radar_color_rgb[i][j].b, 255, AC_TYPE_HUD);
		}
	}

	Blip_mutate_id	= 1;
}
Ejemplo n.º 23
0
// initialize flak stuff for the level
void flak_level_init()
{
	int num_frames;
	int fps;
	int idx;

	// if the muzzle flash ani is not loaded, do so
	if(Flak_muzzle_flash_ani == -1){
		Flak_muzzle_flash_ani = bm_load_animation(MUZZLE_FLASH_FILE, &num_frames, &fps, 1);
	}

	// zero out flak info
	memset(Flak, 0, sizeof(flak_info) * MAX_FLAK_INFO);
	for(idx=0; idx<MAX_FLAK_INFO; idx++){
		Flak[idx].range = -1.0f;
	}
}
Ejemplo n.º 24
0
void load_shield_hit_bitmap()
{
    size_t i;
    // Check if we've already allocated the shield effect bitmaps
    if ( Shield_bitmaps_loaded )
        return;

    Shield_bitmaps_loaded = 1;

    for (i = 0; i < Species_info.size(); i++ )
    {
        if (Species_info[i].shield_anim.filename[0] != '\0')
        {
            Species_info[i].shield_anim.first_frame = bm_load_animation(Species_info[i].shield_anim.filename, &Species_info[i].shield_anim.num_frames, NULL, NULL, 1);
            Assertion((Species_info[i].shield_anim.first_frame >= 0), "Error while loading shield hit ani: %s for species: %s\n", Species_info[i].shield_anim.filename, Species_info[i].species_name);
        }
    }
}
Ejemplo n.º 25
0
// Goober5000
// load a generic_anim
// return 0 is successful, otherwise return -1
int generic_anim_load(generic_anim *ga)
{
	int fps;

	if ( !VALID_FNAME(ga->filename) )
		return -1;

	ga->first_frame = bm_load_animation(ga->filename, &ga->num_frames, &fps, &ga->keyframe, &ga->total_time);
	//mprintf(("generic_anim_load: %s - keyframe = %d\n", ga->filename, ga->keyframe));

	if (ga->first_frame < 0)
		return -1;

	ga->done_playing = 0;
	ga->anim_time = 0.0f;

	return 0;
}
Ejemplo n.º 26
0
void radar_init_std()
{
	int i,j;

	Radar_gauge.first_frame = bm_load_animation(Current_radar_global->Radar_fname[gr_screen.res], &Radar_gauge.num_frames);
	if ( Radar_gauge.first_frame < 0 ) {
		Warning(LOCATION,"Cannot load hud ani: %s\n", Current_radar_global->Radar_fname[gr_screen.res]);
	}

	for (i=0; i<MAX_RADAR_COLORS; i++ )	{
		for (j=0; j<MAX_RADAR_LEVELS; j++ )	{
			gr_init_alphacolor( &Radar_colors[i][j], Radar_color_rgb[i][j].r, Radar_color_rgb[i][j].g, Radar_color_rgb[i][j].b, 255 );
		}
	}

	Blip_mutate_id	= 1;

	//WMC - Try and get rid of stupid radar list errors.
	radar_null_nblips_std();
}
Ejemplo n.º 27
0
		Cursor* CursorManager::loadCursor(const char* fileName, bool animated)
		{
			int handle;

			if (animated)
			{
				handle = bm_load_animation(fileName, nullptr, nullptr);
			}
			else
			{
				handle = bm_load(fileName);
			}

			if (handle < 0)
			{
				mprintf(("Failed to load cursor bitmap %s!", fileName));
				return nullptr;
			}

			Cursor* cursor = this->loadFromBitmap(handle);

			return cursor;
		}
Ejemplo n.º 28
0
// called at the start of each level from HUD_init.  Use Hud_shield_init so we only init Shield_gauges[] once.
void hud_shield_level_init()
{
	unsigned int i;
	hud_frames temp;

	hud_shield_hit_reset(Player_obj, 1);	// reset for the player

	if ( !Hud_shield_inited ) {
		for ( i = 0; i < Hud_shield_filenames.size(); i++ ) {
			Shield_gauges.push_back(temp);
			Shield_gauges.at(i).first_frame = -1;
			Shield_gauges.at(i).num_frames  = 0;
		}
		
		Hud_shield_inited = 1;
	}

	Shield_mini_gauge.first_frame = bm_load_animation("targhit1", &Shield_mini_gauge.num_frames);
	if ( Shield_mini_gauge.first_frame == -1 ) {
		Warning(LOCATION, "Could not load in the HUD shield ani: targhit1\n");
		return;
	}
	Shield_mini_loaded = 1;
}
void HudGaugeWeaponLinking::initBitmaps(char *fname_arc, 
										char *fname_primary_link_1, 
										char *fname_primary_link_2, 
										char *fname_secondary_link_1, 
										char *fname_secondary_link_2, 
										char *fname_secondary_link_3)
{
	arc.first_frame = bm_load_animation(fname_arc, &arc.num_frames);
	if (arc.first_frame < 0) {
		Warning(LOCATION, "Cannot load hud ani: %s\n", fname_arc);
	}
	
	weapon_linking_modes[LINK_ONE_PRIMARY].first_frame = bm_load_animation(fname_primary_link_1, &weapon_linking_modes[LINK_ONE_PRIMARY].num_frames);
	if (weapon_linking_modes[LINK_ONE_PRIMARY].first_frame < 0) {
		Warning(LOCATION, "Cannot load hud ani: %s\n", fname_primary_link_1);
	}

	weapon_linking_modes[LINK_TWO_PRIMARY].first_frame = bm_load_animation(fname_primary_link_2, &weapon_linking_modes[LINK_TWO_PRIMARY].num_frames);
	if (weapon_linking_modes[LINK_TWO_PRIMARY].first_frame < 0) {
		Warning(LOCATION, "Cannot load hud ani: %s\n", fname_primary_link_2);
	}

	weapon_linking_modes[LINK_ONE_SECONDARY].first_frame = bm_load_animation(fname_secondary_link_1, &weapon_linking_modes[LINK_ONE_SECONDARY].num_frames);
	if (weapon_linking_modes[LINK_ONE_SECONDARY].first_frame < 0) {
		Warning(LOCATION, "Cannot load hud ani: %s\n", fname_secondary_link_1);
	}

	weapon_linking_modes[LINK_TWO_SECONDARY].first_frame = bm_load_animation(fname_secondary_link_2, &weapon_linking_modes[LINK_TWO_SECONDARY].num_frames);
	if (weapon_linking_modes[LINK_TWO_SECONDARY].first_frame < 0) {
		Warning(LOCATION, "Cannot load hud ani: %s\n", fname_secondary_link_2);
	}

	weapon_linking_modes[LINK_THREE_SECONDARY].first_frame = bm_load_animation(fname_secondary_link_3, &weapon_linking_modes[LINK_THREE_SECONDARY].num_frames);
	if (weapon_linking_modes[LINK_THREE_SECONDARY].first_frame < 0) {
		Warning(LOCATION, "Cannot load hud ani: %s\n", fname_secondary_link_3);
	}
}
Ejemplo n.º 30
0
// loads nframes bitmaps, starting at index start_frame.
// anything < start_frame will not be loaded.
// this keeps the loading code from trying to load bitmaps which don't exist
// and taking an unnecessary disk hit.		
int UI_GADGET::set_bmaps(char *ani_fname, int nframes, int start_frame)
{
	int first_frame, i;	
	char full_name[MAX_FILENAME_LEN] = "";
	char tmp[33];
	int idx, s_idx;	
	int num_digits;
	int its_all_good = 0;
	
	// clear out all frames
	for(idx=0; idx<MAX_BMAPS_PER_GADGET; idx++){
		bmap_ids[idx] = -1;
	}
	
	// load all the bitmaps
	bm_filename = ani_fname;

	Assertion(nframes < MAX_BMAPS_PER_GADGET, "Too many frames specified (%d), must be less than MAX_BMAPS_PER_GADGET", nframes);
	m_num_frames = nframes;
	for(idx=start_frame; idx<nframes; idx++){
		// clear the string
		strcpy_s(full_name, "");

		// get the # of digits for this index
		num_digits = (idx < 10) ? 1 : (idx < 100) ? 2 : (idx < 1000) ? 3 : 4;

		// build the actual filename
		strcpy_s(full_name, ani_fname);
		for(s_idx=0; s_idx<(4-num_digits); s_idx++){
			strcat_s(full_name, NOX("0"));
		}
		sprintf(tmp, "%d", idx);
		strcat_s(full_name, tmp);

		// try and load the bitmap				
		bmap_ids[idx] = bm_load(full_name);	
		if(bmap_ids[idx] != -1){		
			
			its_all_good = 1;
		} 
	}

	// done
	if(its_all_good){
		uses_bmaps = 1;		
		return 0;
	}

	// no go, so try and load as an ani. try and load as an .ani	
	first_frame = bm_load_animation(ani_fname, &m_num_frames);	
	if((first_frame >= 0) && (m_num_frames <= MAX_BMAPS_PER_GADGET)){					
		// seems pretty stupid that we didn't just use a variable for the first frame and access all
		// other frames offset from it instead of accessing this bmap_ids[] array, but probably too
		// much trouble to go through and change this anymore.  How sad..
		for ( i=0; i<m_num_frames; i++ ) {
			bmap_ids[i] = first_frame + i;
		}	
	}	

	// flag that this control is using bitmaps for art	
	uses_bmaps = 1;
	return 0;
}