Esempio n. 1
0
static void update_weapon_loading_gunship_page (ui_object *obj, void *arg)
{
	entity
		*en;

	gunship_types
		gunship;

	weapon_loading_hardpoint_types
		hardpoint;

	int
		count,
		fixed,
		auw,
		weapon_type;

	float
		mass;

	ui_object
		*button_object;

	rgb_colour
		*col;

	ASSERT (obj);

	en = get_local_entity_safe_ptr (get_ui_object_item_number (obj));

	ASSERT (en);

	gunship = get_local_entity_int_value (en, INT_TYPE_GUNSHIP_TYPE);

	ASSERT (gunship < NUM_GUNSHIP_TYPES);

	if (get_helicopter_allowed_to_rearm (en))
	{
		fixed = FALSE;
	}
	else
	{
		fixed = TRUE;
	}

	//
	// Set button text
	//

	for (hardpoint = 0; hardpoint < NUM_WEAPON_LOADING_HARDPOINT_TYPES; hardpoint ++)
	{
		if (weapon_loading_button_list [gunship][hardpoint].valid)
		{
			button_object = weapon_loading_button_list [gunship][hardpoint].button_ptr;

			weapon_type = weapon_loading_get_current_hardpoint_weapon (gunship, hardpoint);

			//
			// Set Text
			//

			if (weapon_type != ENTITY_SUB_TYPE_WEAPON_NO_WEAPON)
			{
				count = get_weapon_loading_hardpoint_weapon_count (en, hardpoint, weapon_type);

				sprintf (buffer, "%dx %s", count, weapon_database [weapon_type].weapon_loading_list_name);
			}
			else
			{
				sprintf (buffer, "%s", weapon_database [weapon_type].weapon_loading_list_name);
			}

			set_ui_object_text (button_object, buffer);

			//
			// Set Button Attributes
			//

			if ((fixed) || (weapon_loading_get_valid_weapon_count (en, hardpoint) < 2))
			{
				set_ui_object_notify_on (button_object, NOTIFY_TYPE_NONE);

				set_ui_object_highlightable (button_object, FALSE);

				col = &ui_ingame_dead_text_colour;

				set_ui_object_font_colour (button_object, col->r, col->g, col->b, col->a);
			}
			else
			{
				set_ui_object_notify_on (button_object, NOTIFY_TYPE_BUTTON_DOWN);

				set_ingame_ui_object_mouse_over_properties (button_object);
			}
		}
	}

	//
	// All-Up-Weight (player only)
	//

	if (en == get_gunship_entity ())
	{
		mass = set_flight_dynamics_mass ();

		convert_float_to_int (mass, &auw);

		sprintf (buffer, "%s: %dkg", get_trans ("All Up Weight"), auw);

		set_ui_object_text (page_auw_text, buffer);
	}
	else
	{
		set_ui_object_text (page_auw_text, "");
	}

	//
	// Fuel Page (player only)
	//

	if (en == get_gunship_entity ())
	{
		sprintf (buffer, " %.0fkg", get_current_flight_dynamics_fuel_weight ());

		set_ui_object_text (page_fuel_gauge, buffer);

		set_ui_object_drawable (page_fuel_text, TRUE);

		set_ui_object_drawable (page_fuel_gauge, TRUE);

		draw_weapon_loading_gauge (page_fuel_gauge, get_dynamics_normalised_fuel_value ());
	}
	else
	{
		set_ui_object_drawable (page_fuel_text, FALSE);

		set_ui_object_drawable (page_fuel_gauge, FALSE);
	}

	//
	// Damage Page (player only)
	//

	set_ui_object_drawable (page_repairing_text, FALSE);

	set_ui_object_drawable (page_repairing_gauge, FALSE);

	if (en == get_gunship_entity ())
	{
		int
			repair_index;

		float
			level,
			repair_time;

		if (current_flight_dynamics->repairing_damage != DYNAMICS_DAMAGE_NONE)
		{
			repair_index = get_dynamics_damage_currently_repairing_type ();

			repair_time = dynamics_damage_database [repair_index].repair_time;

			if (repair_time == 0.0)
			{
				level = 1.0;
			}
			else
			{
				level = 1.0 - (current_flight_dynamics->damage_repair_time / repair_time);

				level = bound (level, 0.0, 1.0);
			}

			sprintf (buffer, " %s", get_trans (dynamics_damage_database [repair_index].name));

			set_ui_object_text (page_repairing_gauge, buffer);

			set_ui_object_drawable (page_repairing_text, TRUE);

			set_ui_object_drawable (page_repairing_gauge, TRUE);

			draw_weapon_loading_gauge (page_repairing_gauge, level);
		}
	}
}
Esempio n. 2
0
void rebuild_default_payload_list (entity *en)
{
	int
		fixed;

	ui_object
		*new_item;

	ASSERT (en);

	ui_object_destroy_list_items (page_default_payload_list);

	if (get_local_entity_int_value (en, INT_TYPE_GUNSHIP_TYPE) < NUM_GUNSHIP_TYPES)
	{
		fixed = (!get_helicopter_allowed_to_rearm (en));
	}
	else
	{
		fixed = TRUE;
	}

	//

	sprintf (buffer, "%s", get_trans ("Air to Ground"));

	new_item = add_to_pop_up_list (buffer, page_default_payload_list, NULL, INT_TYPE_AIR_TO_SURFACE_WEAPON_CONFIG_TYPE, UI_FONT_ARIAL_14, ui_ingame_dead_text_colour);

	if (!fixed)
	{
		set_ingame_ui_object_mouse_over_properties (new_item);

		set_ui_object_notify_on (new_item, NOTIFY_TYPE_BUTTON_DOWN);
	}
	else
	{
		set_ui_object_notify_on (new_item, NOTIFY_TYPE_NONE);
	}

	//

	sprintf (buffer, "%s", get_trans ("Air to Air"));

	new_item = add_to_pop_up_list (buffer, page_default_payload_list, NULL, INT_TYPE_AIR_TO_AIR_WEAPON_CONFIG_TYPE, UI_FONT_ARIAL_14, ui_ingame_dead_text_colour);

	if (!fixed)
	{
		set_ingame_ui_object_mouse_over_properties (new_item);

		set_ui_object_notify_on (new_item, NOTIFY_TYPE_BUTTON_DOWN);
	}
	else
	{
		set_ui_object_notify_on (new_item, NOTIFY_TYPE_NONE);
	}

	//

	sprintf (buffer, "%s", get_trans ("Scout"));

	new_item = add_to_pop_up_list (buffer, page_default_payload_list, NULL, INT_TYPE_SCOUT_WEAPON_CONFIG_TYPE, UI_FONT_ARIAL_14, ui_ingame_dead_text_colour);

	if (!fixed)
	{
		set_ingame_ui_object_mouse_over_properties (new_item);

		set_ui_object_notify_on (new_item, NOTIFY_TYPE_BUTTON_DOWN);
	}
	else
	{
		set_ui_object_notify_on (new_item, NOTIFY_TYPE_NONE);
	}
}
Esempio n. 3
0
void define_campaign_screen_chat_page_objects (void)
{
	float
		x1,
		y1,
		x2,
		y2;

	ui_object
		*page;

	char
		string [256];

	/////////////////////////////////////////////////////////////////
	// Main Page Area
	/////////////////////////////////////////////////////////////////

	x1 = CAMPAIGN_INSET_PAGE_X1;
	y1 = CAMPAIGN_INSET_PAGE_Y1;
	x2 = CAMPAIGN_INSET_PAGE_X2;
	y2 = CAMPAIGN_INSET_PAGE_Y2;

	campaign_page [CAMPAIGN_PAGE_CHAT] = create_ui_object
		(
			UI_TYPE_AREA,
			UI_ATTR_PARENT (campaign_screen),
			UI_ATTR_TEXT_JUSTIFY (TEXT_JUSTIFY_CENTRE_TOP),
			UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_14),
			UI_ATTR_VIRTUAL_POSITION (x1, y1),
			UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
			UI_ATTR_DRAWABLE (FALSE),
			UI_ATTR_DRAW_FUNCTION (update_chat_page_objects),
			UI_ATTR_CLEAR (TRUE),
			UI_ATTR_END
		);

	page = campaign_page [CAMPAIGN_PAGE_CHAT];

	/////////////////////////////////////////////////////////////////
	// Chat Target/Message Window

	x1 = 0.0;
	y1 = 0.068;
	x2 = 0.502;
	y2 = 0.109;

	chat_window_mode_area = create_ui_object
			(
				UI_TYPE_AREA,
				UI_ATTR_PARENT (page),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_TEXTURE_GRAPHIC (create_texture_graphic ("graphics\\ui\\cohokum\\map\\chattabs.psd")),
				UI_ATTR_END
			);

	x1 = 0.0;
	y1 = 0.0;
	x2 = 0.5;
	y2 = 1.0;

	chat_window_destination_button = create_ui_object
			(
				UI_TYPE_RADIO,
				UI_ATTR_PARENT (chat_window_mode_area),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_16),
				UI_ATTR_TEXT (get_trans ("Destination")),
				UI_ATTR_FUNCTION (notify_show_destinations),
				UI_ATTR_CLEAR (TRUE),
				UI_ATTR_END
			);

	set_ingame_ui_object_mouse_over_properties (chat_window_destination_button);

	x1 = 0.5;
	y1 = 0.0;
	x2 = 1.0;
	y2 = 1.0;

	chat_window_message_button = create_ui_object
			(
				UI_TYPE_RADIO,
				UI_ATTR_PARENT (chat_window_mode_area),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_16),
				UI_ATTR_TEXT (get_trans ("Messages")),
				UI_ATTR_FUNCTION (notify_show_messages),
				UI_ATTR_CLEAR (TRUE),
				UI_ATTR_END
			);

	set_ingame_ui_object_mouse_over_properties (chat_window_message_button);

	x1 = 0.057;
	y1 = 0.152;
	x2 = 0.931;
	y2 = 0.625;

	chat_window_area = create_ui_object
			(
				UI_TYPE_AREA,
				UI_ATTR_PARENT (page),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_CLEAR (TRUE),
				UI_ATTR_END
			);

	/////////////////////////////////////////////////////////////////
	// Target List Area

	x1 = 0.0;
	y1 = 0.0;
	x2 = 1.0;
	y2 = 1.0;

	chat_target_list_area = create_ui_object
			(
				UI_TYPE_AREA,
				UI_ATTR_PARENT (chat_window_area),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_VSLIDER (0, 300, 12),
				UI_ATTR_CLEAR (TRUE),
				UI_ATTR_END
			);

	set_common_slider_graphics (chat_target_list_area);

	// List Box

	x1 = 0.0;
	y1 = 0.0;
	x2 = 0.95;
	y2 = 1.0;

	chat_target_list = create_ui_object
				(
					UI_TYPE_LIST_BOX,
					UI_ATTR_PARENT (chat_target_list_area),
					UI_ATTR_VIRTUAL_POSITION (x1, y1),
					UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
					UI_ATTR_CLEAR (TRUE),
					UI_ATTR_FUNCTION (notify_target_list),
					UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_16),
					UI_ATTR_ITEM_NUMBER (ENTITY_INDEX_DONT_CARE),
					UI_ATTR_END
				);

	/////////////////////////////////////////////////////////////////
	// Message list

	x1 = 0.0;
	y1 = 0.0;
	x2 = 1.0;
	y2 = 1.0;

	chat_message_list_area = create_ui_object
		(
			UI_TYPE_AREA,
			UI_ATTR_PARENT (chat_window_area),
			UI_ATTR_VIRTUAL_POSITION (x1, y1),
			UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
			UI_ATTR_CLEAR (TRUE),
			UI_ATTR_VSLIDER (0, 300, 12),
			UI_ATTR_END
		);

	set_common_slider_graphics (chat_message_list_area);

	x1 = 0.0;
	y1 = 0.0;
	x2 = 0.95;
	y2 = 1.0;

	chat_message_list = create_ui_object
			(
				UI_TYPE_LIST_BOX,
				UI_ATTR_PARENT (chat_message_list_area),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_NOTIFY_ON (NOTIFY_TYPE_NONE),
				UI_ATTR_CLEAR (TRUE),
				UI_ATTR_END
			);

	/////////////////////////////////////////////////////////////////
	// Chat Text area

	x1 = 0.100;
	y1 = 0.720;
	x2 = 0.876;
	y2 = 0.756;

	sprintf (string, "%s:", get_trans ("Enter Message"));

	create_ui_object
			(
				UI_TYPE_AREA,
				UI_ATTR_PARENT (page),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_16),
				UI_ATTR_FONT_COLOUR (ui_ingame_dead_text_colour.r, ui_ingame_dead_text_colour.g, ui_ingame_dead_text_colour.b, ui_ingame_dead_text_colour.a),
				UI_ATTR_TEXT_JUSTIFY (TEXT_JUSTIFY_LEFT_CENTRE),
				UI_ATTR_TEXT (string),
				UI_ATTR_CLEAR (TRUE),
				UI_ATTR_END
			);

	x1 = 0.123;
	y1 = 0.762;
	x2 = 0.876;
	y2 = 0.834;

	chat_text_area = create_ui_object
			(
				UI_TYPE_AREA,
				UI_ATTR_PARENT (page),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_TEXTURE_GRAPHIC (create_texture_graphic ("graphics\\ui\\cohokum\\map\\msgbar.psd")),
				UI_ATTR_FUNCTION (chat_enter_message_function),
				UI_ATTR_END
			);

	// Chat Input

	x1 = 0.04;
	y1 = 0.25;
	x2 = 1.0;
	y2 = 1.0;

   chat_input = create_ui_object
            (
               UI_TYPE_INPUT,
               UI_ATTR_PARENT (chat_text_area),
					UI_ATTR_VIRTUAL_POSITION (x1, y1),
					UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
					UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_16),
					UI_ATTR_FONT_COLOUR (ui_ingame_selected_text_colour.r, ui_ingame_selected_text_colour.g, ui_ingame_selected_text_colour.b, ui_ingame_selected_text_colour.a),
					UI_ATTR_FUNCTION (chat_input_function),
					UI_ATTR_TEXT_JUSTIFY (TEXT_JUSTIFY_LEFT_CENTRE),
					UI_ATTR_TEXT (""),
					UI_ATTR_CLEAR (TRUE),
               UI_ATTR_END
            );

	// Chat Output

	x1 = 0.04;
	y1 = 0.16;
	x2 = 1.0;
	y2 = 1.0;

   chat_current_text = create_ui_object
            (
               UI_TYPE_AREA,
               UI_ATTR_PARENT (chat_text_area),
					UI_ATTR_VIRTUAL_POSITION (x1, y1),
					UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
					UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_16),
					UI_ATTR_FONT_COLOUR (ui_ingame_dead_text_colour.r, ui_ingame_dead_text_colour.g, ui_ingame_dead_text_colour.b, ui_ingame_dead_text_colour.a),
					UI_ATTR_TEXT_JUSTIFY (TEXT_JUSTIFY_LEFT_CENTRE),
					UI_ATTR_TEXT (""),
					UI_ATTR_FUNCTION (chat_enter_message_function),
					UI_ATTR_CLEAR (TRUE),
               UI_ATTR_END
            );

	/////////////////////////////////////////////////////////////////
	// Send Button

	x1 = 0.235;
	y1 = 0.834;
	x2 = 0.763;
	y2 = 0.884;

	chat_send_button = create_ui_object
			(
				UI_TYPE_BUTTON,
            UI_ATTR_PARENT (page),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_16),
				UI_ATTR_TEXT (get_trans ("UI_SEND")),
				UI_ATTR_FUNCTION (notify_send_message),
				UI_ATTR_DRAW_FUNCTION (draw_chat_send_button),
				UI_ATTR_TEXTURE_GRAPHIC (create_texture_graphic ("graphics\\ui\\cohokum\\map\\sendbtn.psd")),
				UI_ATTR_END
			);

	set_ingame_ui_object_mouse_over_properties (chat_send_button);

	/////////////////////////////////////////////////////////////////
	// "Divider" graphics

	x1 = 0.022;
	y1 = 0.109;
	x2 = 0.971;
	y2 = 0.133;

	create_ui_object
			(
				UI_TYPE_AREA,
				UI_ATTR_PARENT (page),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_TEXTURE_GRAPHIC (common_divider_graphic),
				UI_ATTR_END
			);

	x1 = 0.022;
	y1 = 0.644;
	x2 = 0.971;
	y2 = 0.667;

	create_ui_object
			(
				UI_TYPE_AREA,
				UI_ATTR_PARENT (page),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_TEXTURE_GRAPHIC (common_divider_graphic),
				UI_ATTR_END
			);

	/////////////////////////////////////////////////////////////////
	// BACK button

	define_campaign_page_back_button (page, &page_back_button);
}
Esempio n. 4
0
static void draw_chat_send_button (ui_object *obj, void *arg)
{
	entity
		*current_target;

	rgb_colour
		*col;
		
	static const char
		*text;
	static char
		s [256];

	sprintf (s, "%s: ", get_trans ("SEND TO"));

	current_target = get_local_entity_safe_ptr (get_ui_object_item_number (obj));

	if (current_target)
	{
		switch (get_local_entity_type (current_target))
		{
			case ENTITY_TYPE_SESSION:
			{
				strcat (s, get_trans ("CHAT_TARGET_ALL"));

				break;
			}
			case ENTITY_TYPE_FORCE:
			{
				strcat (s, get_local_entity_string (current_target, STRING_TYPE_FORCE_NAME));

				break;
			}
			case ENTITY_TYPE_PILOT:
			{
				strcat (s, get_local_entity_string (current_target, STRING_TYPE_PILOTS_NAME));

				break;
			}
			default:
			{
				current_target = NULL;
			
				build_chat_target_list ();

				break;
			}
		}
	}

	set_ui_object_text (obj, s);

	if (current_target)
	{
		text = get_ui_object_text (chat_current_text);

		if (text)
		{
			if (strlen (text) > 0)
			{
				set_ingame_ui_object_mouse_over_properties (obj);

				set_ui_object_notify_on (obj, NOTIFY_TYPE_BUTTON_DOWN);

				return;
			}
		}
	}

	set_ui_object_notify_on (obj, NOTIFY_TYPE_NONE);

	set_ui_object_highlightable (obj, FALSE);

	col = &ui_ingame_dead_text_colour;

	set_ui_object_font_colour (obj, col->r, col->g, col->b, col->a);
}
Esempio n. 5
0
void build_chat_target_list (void)
{
	ui_object
		*new_item;

	entity
		*force,
		*pilot,
		*current_target;

	static char
		s [128];

	current_target = get_local_entity_safe_ptr (get_ui_object_item_number (chat_send_button));

	ui_object_destroy_list_items (chat_target_list);

	sprintf (s, "%s", get_trans ("Side"));

	new_item = add_to_pop_up_list (s, chat_target_list, NULL, ENTITY_INDEX_DONT_CARE, UI_FONT_ARIAL_16, ui_ingame_dead_text_colour);

	//
	// All 
	//

	ASSERT (get_session_entity ());

	sprintf (s, "%s", get_trans ("CHAT_TARGET_ALL"));

	new_item = add_to_pop_up_list (s, chat_target_list, NULL, get_local_entity_safe_index (get_session_entity ()), UI_FONT_ARIAL_16, ui_ingame_live_text_colour);

	set_ingame_ui_object_mouse_over_properties (new_item);

	if (get_session_entity () == current_target)
	{
		set_ui_object_state (new_item, UI_OBJECT_STATE_ON);
	}

	//
	// Sides
	//

	force = get_local_entity_first_child (get_session_entity (), LIST_TYPE_FORCE);

	while (force)
	{
		sprintf (s, "%s", get_local_entity_string (force, STRING_TYPE_FORCE_NAME));

		new_item = add_to_pop_up_list (s, chat_target_list, NULL, get_local_entity_safe_index (force), UI_FONT_ARIAL_16, ui_ingame_live_text_colour);

		set_ingame_ui_object_mouse_over_properties (new_item);

		if (force == current_target)
		{
			set_ui_object_state (new_item, UI_OBJECT_STATE_ON);
		}

		force = get_local_entity_child_succ (force, LIST_TYPE_FORCE);
	}

	//
	// Sides
	//

	sprintf (s, "%s", get_trans ("UI_PILOTS"));

	new_item = add_to_pop_up_list (s, chat_target_list, NULL, ENTITY_INDEX_DONT_CARE, UI_FONT_ARIAL_16, ui_ingame_dead_text_colour);

	force = get_local_entity_first_child (get_session_entity (), LIST_TYPE_FORCE);

	while (force)
	{
		pilot = get_local_entity_first_child (force, LIST_TYPE_PILOT);

		while (pilot)
		{
			if (pilot != get_pilot_entity ())
			{
				sprintf (s, "%s", get_local_entity_string (pilot, STRING_TYPE_PILOTS_NAME));
	
				new_item = add_to_pop_up_list (s, chat_target_list, NULL, get_local_entity_safe_index (pilot), UI_FONT_ARIAL_16, ui_ingame_live_text_colour);
	
				set_ingame_ui_object_mouse_over_properties (new_item);
	
				if (pilot == current_target)
				{
					set_ui_object_state (new_item, UI_OBJECT_STATE_ON);
				}
			}
			
			pilot = get_local_entity_child_succ (pilot, LIST_TYPE_PILOT);
		}

		force = get_local_entity_child_succ (force, LIST_TYPE_FORCE);
	}
}
Esempio n. 6
0
void define_campaign_screen_save_page_objects (void)
{
	float
		x1,
		y1,
		x2,
		y2;

	ui_object
		*page;

	char
		string [256];

	/////////////////////////////////////////////////////////////////
	// Main Page Area
	/////////////////////////////////////////////////////////////////

	x1 = CAMPAIGN_INSET_PAGE_X1;
	y1 = CAMPAIGN_INSET_PAGE_Y1;
	x2 = CAMPAIGN_INSET_PAGE_X2;
	y2 = CAMPAIGN_INSET_PAGE_Y2;

	campaign_page [CAMPAIGN_PAGE_SAVE] = create_ui_object
		(
			UI_TYPE_AREA,
			UI_ATTR_PARENT (campaign_screen),
			UI_ATTR_TEXT_JUSTIFY (TEXT_JUSTIFY_CENTRE_TOP),
			UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_14),
			UI_ATTR_VIRTUAL_POSITION (x1, y1),
			UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
			UI_ATTR_DRAWABLE (FALSE),
			UI_ATTR_DRAW_FUNCTION (update_save_page_objects),
			UI_ATTR_CLEAR (TRUE),
			UI_ATTR_END
		);

	page = campaign_page [CAMPAIGN_PAGE_SAVE];

	/////////////////////////////////////////////////////////////////
	// Target List Area

	x1 = 0.057;
	y1 = 0.152;
	x2 = 0.931;
	y2 = 0.625;

	save_file_list_area = create_ui_object
			(
				UI_TYPE_AREA,
				UI_ATTR_PARENT (page),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_VSLIDER (0, 300, 12),
				UI_ATTR_CLEAR (TRUE),
				UI_ATTR_END
			);

	set_common_slider_graphics (save_file_list_area);

	// List Box

	x1 = 0.0;
	y1 = 0.0;
	x2 = 0.95;
	y2 = 1.0;

	save_file_list = create_ui_object
				(
					UI_TYPE_LIST_BOX,
					UI_ATTR_PARENT (save_file_list_area),
					UI_ATTR_VIRTUAL_POSITION (x1, y1),
					UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
					UI_ATTR_CLEAR (TRUE),
					UI_ATTR_FUNCTION (notify_save_file_list),
					UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_16),
					UI_ATTR_ITEM_NUMBER (ENTITY_INDEX_DONT_CARE),
					UI_ATTR_END
				);

	/////////////////////////////////////////////////////////////////
	// Save Dialog Box

	x1 = 0.123;
	y1 = 0.762;
	x2 = 0.876;
	y2 = 0.834;

	save_text_area = create_ui_object
			(
				UI_TYPE_AREA,
				UI_ATTR_PARENT (page),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_TEXTURE_GRAPHIC (create_texture_graphic ("graphics//ui//cohokum//map//msgbar.psd")),
				UI_ATTR_FUNCTION (save_enter_filename_function),
				UI_ATTR_END
			);

	/////////////////////////////////////////////////////////////////
	// Filename Input

	x1 = 0.04;
	y1 = 0.18;
	x2 = 1.0;
	y2 = 1.0;

   save_filename_input = create_ui_object
            (
               UI_TYPE_INPUT,
               UI_ATTR_PARENT (save_text_area),
					UI_ATTR_VIRTUAL_POSITION (x1, y1),
					UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
					UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_16),
					UI_ATTR_FONT_COLOUR (ui_ingame_selected_text_colour.r, ui_ingame_selected_text_colour.g, ui_ingame_selected_text_colour.b, ui_ingame_selected_text_colour.a),
					UI_ATTR_FUNCTION (filename_input_function),
					UI_ATTR_TEXT_JUSTIFY (TEXT_JUSTIFY_LEFT_CENTRE),
					UI_ATTR_CLEAR (TRUE),
               UI_ATTR_END
            );

	x1 = 0.04;
	y1 = 0.0;
	x2 = 1.0;
	y2 = 1.0;

   save_current_filename = create_ui_object
            (
               UI_TYPE_AREA,
               UI_ATTR_PARENT (save_text_area),
					UI_ATTR_VIRTUAL_POSITION (x1, y1),
					UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
					UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_16),
					UI_ATTR_FONT_COLOUR (ui_ingame_dead_text_colour.r, ui_ingame_dead_text_colour.g, ui_ingame_dead_text_colour.b, ui_ingame_dead_text_colour.a),
					UI_ATTR_TEXT_JUSTIFY (TEXT_JUSTIFY_LEFT_CENTRE),
					UI_ATTR_TEXT (""),
					UI_ATTR_CLEAR (TRUE),
					UI_ATTR_FUNCTION (save_enter_filename_function),
               UI_ATTR_END
            );

	/////////////////////////////////////////////////////////////////
	// Enter Filename Text

	x1 = 0.100;
	y1 = 0.720;
	x2 = 0.876;
	y2 = 0.756;

	sprintf (string, "%s:", get_trans ("ENTER_SAVE_GAME_FILENAME"));

	create_ui_object
			(
				UI_TYPE_AREA,
				UI_ATTR_PARENT (page),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_16),
				UI_ATTR_FONT_COLOUR (ui_ingame_dead_text_colour.r, ui_ingame_dead_text_colour.g, ui_ingame_dead_text_colour.b, ui_ingame_dead_text_colour.a),
				UI_ATTR_TEXT_JUSTIFY (TEXT_JUSTIFY_LEFT_CENTRE),
				UI_ATTR_TEXT (string),
				UI_ATTR_CLEAR (TRUE),
				UI_ATTR_END
			);

	/////////////////////////////////////////////////////////////////
	// Confirm Button

	x1 = 0.320;
	y1 = 0.834;
	x2 = 0.672;
	y2 = 0.884;

	save_game_confirm_button = create_ui_object
			(
				UI_TYPE_BUTTON,
				UI_ATTR_PARENT (page),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_TEXT (get_trans ("Save")),
				UI_ATTR_FONT_TYPE (UI_FONT_ARIAL_16),
				UI_ATTR_FUNCTION (save_game_function),
				UI_ATTR_TEXTURE_GRAPHIC (create_texture_graphic ("graphics//ui//cohokum//map//cbtn.psd")),
				UI_ATTR_END
			);

	set_ingame_ui_object_mouse_over_properties (save_game_confirm_button);

	/////////////////////////////////////////////////////////////////
	// "Divider" graphics

	x1 = 0.022;
	y1 = 0.109;
	x2 = 0.971;
	y2 = 0.133;

	create_ui_object
			(
				UI_TYPE_AREA,
				UI_ATTR_PARENT (page),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_TEXTURE_GRAPHIC (common_divider_graphic),
				UI_ATTR_END
			);

	x1 = 0.022;
	y1 = 0.644;
	x2 = 0.971;
	y2 = 0.667;

	create_ui_object
			(
				UI_TYPE_AREA,
				UI_ATTR_PARENT (page),
				UI_ATTR_VIRTUAL_POSITION (x1, y1),
				UI_ATTR_VIRTUAL_SIZE (x2 - x1, y2 - y1),
				UI_ATTR_TEXTURE_GRAPHIC (common_divider_graphic),
				UI_ATTR_END
			);

	/////////////////////////////////////////////////////////////////
	// BACK button

	define_campaign_page_back_button (page, &page_back_button);
}
Esempio n. 7
0
void build_save_file_list (void)
{
	session_list_data_type
		*game_session;

	directory_file_list
		*directory_listing;

	ui_object
		*new_item;

	int
		valid_file;

	char
		*p,
		filename [256],
		extension [8];

	ui_object_destroy_list_items (save_file_list);

	game_session = get_current_game_session ();

	ASSERT (game_session);

	sprintf (full_filename, "%s//%s//*.", game_session->data_path, game_session->campaign_directory);

	sprintf (extension, "%s", game_type_extensions [get_game_type ()]);

	extension [2] = extension [1];
	extension [1] = extension [0];
	extension [0] = 'S';

	strcat (full_filename, extension);

	directory_listing = get_first_directory_file (full_filename);

	if (directory_listing)
	{
		valid_file = TRUE;

		while (valid_file)
		{
			if (get_directory_file_type (directory_listing) == DIRECTORY_FILE_TYPE_FILE)
			{
				sprintf (filename, get_directory_file_filename (directory_listing));

				p = strchr (filename, '.');

				if (p)
				{
					*p = '\0';
				}

				new_item = add_to_pop_up_list (filename, save_file_list, NULL, ENTITY_INDEX_DONT_CARE, UI_FONT_ARIAL_16, ui_ingame_live_text_colour);

				set_ingame_ui_object_mouse_over_properties (new_item);
			}

			valid_file = get_next_directory_file (directory_listing);
		}

		destroy_directory_file_list (directory_listing);
	}

	resize_pop_up_list (save_file_list);
}