Пример #1
0
void UI_WINDOW::create( int _x, int _y, int _w, int _h, int _flags, int _f_id )
{
	x = _x;
	y = _y;
	w = _w;
	h = _h;
	flags = _flags;
	f_id = font::FontManager::isFontNumberValid(_f_id) ? _f_id : font::FONT1;

	first_gadget = NULL;
	selected_gadget = NULL;
	tooltip_handler = NULL;  // pointer to function to handle custom tooltips
	ignore_gadgets = 0;
	use_hack_to_get_around_stupid_problem_flag = 0;

	if (_x < 0)
		_x = 0;
	if (_x + _w - 1 >= gr_screen.max_w_unscaled)
		_x = gr_screen.max_w_unscaled - _w;
	if (_y < 0)
		_y = 0;
	if (_y + _h - 1 >= gr_screen.max_h_unscaled)
		_y = gr_screen.max_h_unscaled - _h;

	game_flush();
}
// 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;
}
Пример #3
0
void UI_WINDOW::create( int _x, int _y, int _w, int _h, int _flags )
{
	x = _x;
	y = _y;
	w = _w;
	h = _h;
	flags = _flags;
	first_gadget = NULL;
	selected_gadget = NULL;
	tooltip_handler = NULL;  // pointer to function to handle custom tooltips
	ignore_gadgets = 0;
	use_hack_to_get_around_stupid_problem_flag = 0;

	f_id = gr_init_font("font01.vf");

	if (_x < 0)
		_x = 0;
	if (_x + _w - 1 >= gr_screen.max_w_unscaled)
		_x = gr_screen.max_w_unscaled - _w;
	if (_y < 0)
		_y = 0;
	if (_y + _h - 1 >= gr_screen.max_h_unscaled)
		_y = gr_screen.max_h_unscaled - _h;

	game_flush();
}
// 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;
}
Пример #5
0
int credits_screen_button_pressed(int n)
{
	switch (n) {
	case TECH_DATABASE_BUTTON:
		gamesnd_play_iface(SND_SWITCH_SCREENS);
		gameseq_post_event(GS_EVENT_TECH_MENU);
		return 1;

	case SIMULATOR_BUTTON:
		gamesnd_play_iface(SND_SWITCH_SCREENS);
		gameseq_post_event(GS_EVENT_SIMULATOR_ROOM);
		return 1;

	case CUTSCENES_BUTTON:
		gamesnd_play_iface(SND_SWITCH_SCREENS);
		gameseq_post_event(GS_EVENT_GOTO_VIEW_CUTSCENES_SCREEN);
		return 1;

	case EXIT_BUTTON:
		gamesnd_play_iface(SND_COMMIT_PRESSED);
		gameseq_post_event(GS_EVENT_MAIN_MENU);
		game_flush();
		break;
	}

	return 0;
}
Пример #6
0
// -----------------------------------------------------------------------------
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();
}
Пример #7
0
// called when a popup goes away
void popup_close(popup_info *pi, int screen_id)
{
	int i;
	
	gamesnd_play_iface(SND_POPUP_DISAPPEAR); 	// play sound when popup disappears

	for (i=0; i<pi->nchoices; i++ )	{
		if ( pi->button_text[i] != NULL ) {
			vm_free(pi->button_text[i]);
			pi->button_text[i] = NULL;
		}
	}

	if(screen_id >= 0){
		gr_free_screen(screen_id);	
	}
	Popup_window.destroy();
	anim_ignore_next_frametime();					// to avoid skips in animation since next frametime is saturated
	game_flush();

	Popup_is_active = 0;
	Popup_running_state = 0;

	// anytime in single player, and multiplayer, not in mission, go ahead and stop time
	if ( (Game_mode & GM_NORMAL) || ((Game_mode & GM_MULTIPLAYER) && !(Game_mode & GM_IN_MISSION)) )
		game_start_time();
}
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();
}
// debrief
void multi_df_debrief_init()
{
	// no longer is mission
	Game_mode &= ~(GM_IN_MISSION);	
	game_flush();

	// call scoring level close for my stats.  Needed for award_init.  The stats will
	// be backed out if used chooses to replace them.
	scoring_level_close();

	// multiplayer debriefing stuff
	multi_debrief_init();

	// close down any old instances of the chatbox
	chatbox_close();

	// create the new one
	chatbox_create();

	// always play success music
	common_music_init(SCORE_DEBRIEF_SUCCESS);

	// setup kill matrix
	multi_df_setup_kill_matrix();

	UI_WINDOW *w;
	ui_button_info *b;
	int idx;

	// load background bitmap
	Multi_df_background_bitmap = bm_load(Multi_df_background_fname[gr_screen.res]);
	Assert(Multi_df_background_bitmap);

	// create the UI window
	Multi_df_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
	Multi_df_window.set_mask_bmap(Multi_df_mask_fname[gr_screen.res]);
	
	// initialize the control buttons
	for (idx=0; idx<NUM_MULTI_DF_BUTTONS; idx++) {
		b = &Multi_df_buttons[gr_screen.res][idx];

		// create the button
		b->button.create(&Multi_df_window, NULL, b->x, b->y, 60, 30, 1, 1);
		
		// set its highlight action
		b->button.set_highlight_action(common_play_highlight_sound);

		// set its animation bitmaps
		b->button.set_bmaps(b->filename);

		// link the mask hotspot
		b->button.link_hotspot(b->hotspot);
	}		

	// add some text
	w = &Multi_df_window;	
	w->add_XSTR("Accept", 1035, Multi_df_buttons[gr_screen.res][ACCEPT_BUTTON].xt, Multi_df_buttons[gr_screen.res][ACCEPT_BUTTON].yt, &Multi_df_buttons[gr_screen.res][ACCEPT_BUTTON].button, UI_XSTR_COLOR_PINK);
}
Пример #10
0
// called when the screen is exited
void gameplay_help_leave()
{
	// unpause all game sounds
	weapon_unpause_sounds();
	audiostream_unpause_all();

	gameseq_post_event(GS_EVENT_PREVIOUS_STATE);
	game_flush();
}
Пример #11
0
// 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;
}
Пример #12
0
// Close down the dead popup
void popupdead_close()
{
	if ( !Popupdead_active ) {
		return;
	}

	gamesnd_play_iface(SND_POPUP_DISAPPEAR);
	Popupdead_window.destroy();
	game_flush();

	Popupdead_active = 0;
	Popupdead_skip_active = 0;
	Popupdead_skip_already_shown = 0;
}
Пример #13
0
void pilot_manage_close(void)
{
	// destroy window
	Ui_window.destroy();

	// release background bitmap
	if (Background_bitmap >= 0) {
		bm_unload(Background_bitmap);
	}

	// unload the overlay bitmap
// fix it	help_overlay_unload(PILOT_MANAGE_OVERLAY);

	game_flush();
}
// ---------------------------------------------------------------------
// 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();
}
Пример #15
0
// 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();
}
Пример #16
0
void hud_scrollback_close()
{
    ML_objectives_close();
    message_log_shutdown_scrollback();
    if (Background_bitmap >= 0)
        bm_release(Background_bitmap);
    //if (Status_bitmap >= 0)
    //	bm_unload(Status_bitmap);

    Ui_window.destroy();
    common_free_interface_palette();		// restore game palette
    game_flush();

    // unpause all game sounds
    weapon_unpause_sounds();
    audiostream_unpause_all();

}
Пример #17
0
void multi_pause_close(int end_mission)
{
	if ( !Multi_paused )
		return;

	// set the standalonest
	if (Game_mode & GM_STANDALONE_SERVER) {
		std_debug_set_standalone_state_string("Game play");
	} else {
		// free the screen up
		if ( end_mission && (Multi_paused_screen_id >= 0) ) {
			gr_free_screen(Multi_paused_screen_id);
			Multi_paused_screen_id = -1;
		}

		if (Multi_paused_background >= 0) {
			bm_release(Multi_paused_background);
			Multi_paused_background = -1;
		}

		Multi_paused_window.destroy();		
		game_flush();

		// unpause all the music
		audiostream_unpause_all();	
	}

	// unpause beam weapon sounds
	weapon_unpause_sounds();

	// eat keys timestamp
	Multi_pause_eat = f2fl(timer_get_fixed_seconds());
	
	// reset timestamps
	multi_reset_timestamps();

	// clear out control config and keypress info
	control_config_clear_used_status();
	key_flush();

	Multi_paused = 0;
}
Пример #18
0
// ---------------------------------------------------------------------
// 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_unload(Background_bitmap);
	if (Wing_bmp >= 0)
		bm_unload(Wing_bmp);

	// unload the overlay bitmap
//	help_overlay_unload(HOTKEY_OVERLAY);

	// unpause all beam weapon sounds
	beam_unpause_sounds();

	// unpause all game music
	audiostream_unpause_all();

	Ui_window.destroy();
	common_free_interface_palette();		// restore game palette
	game_flush();
}
Пример #19
0
int cutscenes_screen_button_pressed(int n)
{
	switch (n) {
		case TECH_DATABASE_BUTTON:
			gamesnd_play_iface(SND_SWITCH_SCREENS);
			gameseq_post_event(GS_EVENT_TECH_MENU);
			return 1;

		case SIMULATOR_BUTTON:
			gamesnd_play_iface(SND_SWITCH_SCREENS);
			gameseq_post_event(GS_EVENT_SIMULATOR_ROOM);
			return 1;

		case CREDITS_BUTTON:
			gamesnd_play_iface(SND_SWITCH_SCREENS);
			gameseq_post_event(GS_EVENT_CREDITS);
			return 1;

		case SCROLL_UP_BUTTON:
			cutscenes_screen_scroll_screen_up();
			break;

		case SCROLL_DOWN_BUTTON:
			cutscenes_screen_scroll_screen_down();
			break;

		case PLAY_BUTTON:
			cutscenes_screen_play();
			break;

		case EXIT_BUTTON:
			gamesnd_play_iface(SND_COMMIT_PRESSED);
			gameseq_post_event(GS_EVENT_MAIN_MENU);
			game_flush();
			break;
	}

	return 0;
}
Пример #20
0
// Called once when the red alert interface is exited
void red_alert_close()
{
	if (Red_alert_inited) {

		red_alert_voice_stop();
		red_alert_voice_unload();

		weapon_select_close_team();

		if (Background_bitmap >= 0) {
			bm_release(Background_bitmap);
		}
		
		Ui_window.destroy();
		// bm_unload(&Flash_anim);
		common_free_interface_palette();		// restore game palette
		game_flush();
	}

	Red_alert_inited = 0;

	fsspeech_stop();
}
Пример #21
0
void cutscenes_screen_do_frame()
{
	int i, k, y, z;
	int font_height = gr_get_font_height();
	int select_tease_line = -1;

	k = Ui_window.process();
	switch (k) {
		case KEY_DOWN:  // select next line
			cutscenes_screen_scroll_line_down();
			break;

		case KEY_UP:  // select previous line
			cutscenes_screen_scroll_line_up();
			break;

		case KEY_TAB:
		case KEY_CTRLED | KEY_DOWN:
			cutscenes_screen_button_pressed(CREDITS_BUTTON);
			break;

		case KEY_SHIFTED | KEY_TAB:
		case KEY_CTRLED | KEY_UP:
			cutscenes_screen_button_pressed(SIMULATOR_BUTTON);
			break;

		case KEY_ENTER:
			cutscenes_screen_play();
			break;

		case KEY_ESC:  // cancel
			gameseq_post_event(GS_EVENT_MAIN_MENU);
			game_flush();
			break;

		case KEY_F1:  // show help overlay
			break;

		case KEY_F2:  // goto options screen
			gameseq_post_event(GS_EVENT_OPTIONS_MENU);
			break;

		// the "show-all" hotkey
		case KEY_CTRLED | KEY_SHIFTED | KEY_S:
		{
            Cutscene_list.clear();
			size_t size = Cutscenes.size();
			for (size_t t = 0; t < size; t++) {
                Cutscene_list.push_back((int)t);
			}

			break;
		}
	}	// end switch

	for (i=0; i<NUM_BUTTONS; i++){
		if (Buttons[gr_screen.res][i].button.pressed()){
			if (cutscenes_screen_button_pressed(i)){
				return;
			}
		}
	}

	if (List_region.button_down()) {
		List_region.get_mouse_pos(NULL, &y);
		z = Scroll_offset + y / font_height;
		if ((z >= 0) && (z < (int)Cutscene_list.size()))
			select_tease_line = z;
	}
	
	if (List_region.pressed()) {
		List_region.get_mouse_pos(NULL, &y);
		z = Scroll_offset + y / font_height;
		if ((z >= 0) && (z < (int)Cutscene_list.size()))
			Selected_line = z;
	}

	GR_MAYBE_CLEAR_RES(Background_bitmap);
	if (Background_bitmap >= 0) {
		gr_set_bitmap(Background_bitmap);
		gr_bitmap(0, 0);
	} 

	Ui_window.draw();

	for (i=TECH_DATABASE_BUTTON; i<=CREDITS_BUTTON; i++){
		if (Buttons[gr_screen.res][i].button.button_down()){
			break;
		}
	}

	if (i > CREDITS_BUTTON){
		Buttons[gr_screen.res][CUTSCENES_BUTTON].button.draw_forced(2);
	}

	y = 0;
	z = Scroll_offset;
	while (y + font_height <= Cutscene_list_coords[gr_screen.res][3]) {
		if (z >= (int)Cutscene_list.size()){
			break;
		}

		if (z == Selected_line){
			gr_set_color_fast(&Color_text_selected);
		} else if (z == select_tease_line) {
			gr_set_color_fast(&Color_text_subselected);
		} else {
			gr_set_color_fast(&Color_text_normal);
		}

		gr_printf(Cutscene_list_coords[gr_screen.res][0], Cutscene_list_coords[gr_screen.res][1] + y, Cutscenes[Cutscene_list[z]].name);

		y += font_height;
		z++;
	}

	if (Description_index != Selected_line) {
		char *src = NULL;

		Description_index = Selected_line;
		Text_size = 0;
		if ( Description_index < (int)Cutscene_list.size( ) &&
			 (int)Cutscene_list[ Description_index ] < (int)Cutscenes.size( ) ) {
			src = Cutscenes[Cutscene_list[Description_index]].description;
			if (src) {
				Text_size = split_str(src, Cutscene_desc_coords[gr_screen.res][2], Text_line_size, Text_lines, Cutscene_max_text_lines[gr_screen.res]);
				Assert(Text_size >= 0 && Text_size < Cutscene_max_text_lines[gr_screen.res]);
			}
		}
	}

	if (Description_index >= 0) {
		int len;
		char line[MAX_TEXT_LINE_LEN + 1];

		gr_set_color_fast(&Color_text_normal);

		y = 0;
		z = Text_offset;
		while (y + font_height <= Cutscene_desc_coords[gr_screen.res][3]) {
			if (z >= Text_size || z >= MAX_TEXT_LINES-1)
				break;

			len = Text_line_size[z];
			if (len > MAX_TEXT_LINE_LEN)
				len = MAX_TEXT_LINE_LEN;

			strncpy(line, Text_lines[z], len);
			line[len] = 0;
			gr_string(Cutscene_desc_coords[gr_screen.res][0], Cutscene_desc_coords[gr_screen.res][1] + y, line);

			y += font_height;
			z++;
		}
	}

	gr_flip();
}
// debug pause close
void pause_debug_close()
{
	last_single_step = 0;	// Make so single step waits a frame before stepping
	Pause_win.destroy();
	game_flush();
}
Пример #23
0
void snazzy_menu_init()
{
	game_flush();
}
Пример #24
0
void snazzy_menu_close()
{
	game_flush();
}