Пример #1
0
void display_options_page (options_pages page)
{
	int
		loop;

	//set drawable state of pages depending on chosen page & hilite appropriate button

	for (loop = 0; loop < NUM_OPTIONS_PAGES; loop ++)
	{
		set_ui_object_drawable (options_page [loop], FALSE);

		if (page == loop)
		{
			set_ui_object_state (options_page_buttons [loop], UI_OBJECT_STATE_ON);

			reset_time_values (options_page[loop]);

			current_options_page = loop;

			set_ui_object_drawable (options_page [loop], TRUE);

		}
		else
		{
			set_ui_object_state (options_page_buttons [loop], UI_OBJECT_STATE_OFF);
		}
	}
}
Пример #2
0
void mslider_move_function (event *ev)
{

	float
		mouse_x,
		mouse_y;

	static ui_object
		*obj;

	if (current_object_to_slide)
	{

		mouse_x = get_mouse_x ();

		mouse_y = get_mouse_y ();

		if (mouse_y < get_ui_object_y (current_object_to_slide))
		{

			scroll = max (-1.0f, (get_ui_object_y (current_object_to_slide) - mouse_y) * get_delta_time ());

			set_ui_object_state (current_object_to_slide, UI_OBJECT_STATE_OFF);
		}
		else if (mouse_y > get_ui_object_y (current_object_to_slide) + get_ui_object_y_size (current_object_to_slide))
		{

			scroll = min (1.0f, (get_ui_object_y (current_object_to_slide) + get_ui_object_y_size (current_object_to_slide) - mouse_y) * get_delta_time ());

			set_ui_object_state (current_object_to_slide, UI_OBJECT_STATE_OFF);
		}
		else
		{

			scroll = 0.0;

			obj = check_ui_object_for_selection (current_object_to_slide, mouse_x, mouse_y);

			if (obj)
			{

				set_ui_object_state (obj, UI_OBJECT_STATE_ON);
			}
		}
	}
}
Пример #3
0
static void save_enter_filename_function (ui_object *obj, void *arg)
{
	set_ui_object_text (save_filename_input, get_ui_object_text (save_current_filename));

	set_ui_object_state (save_filename_input, UI_OBJECT_STATE_ON);

	set_ui_object_drawable (save_current_filename, FALSE);
}
Пример #4
0
static void call_text_ui_object_right_function (ui_object *obj, void *arg)
{

	void
		((*function) (ui_object *object, void *arg));
	
	text_ui_object
		*text;

	text = (text_ui_object *) obj->data;

	function = text->area.right_function;

	if (function)
	{

		set_ui_object_redraw (obj, TRUE);

		if ((int) arg == BUTTON_STATE_DOWN)
		{

			set_ui_object_state (obj, UI_OBJECT_STATE_ON);
		}
		else 
		{
			
			set_ui_object_state (obj, UI_OBJECT_STATE_OFF);
		}

		if (
				(get_ui_object_notify_on (obj) == (int) arg) ||
				(get_ui_object_notify_on (obj) == NOTIFY_TYPE_BUTTON_EITHER)
			)
		{

			ui_repaint ();

			function (obj, (void *) arg);
		}
	}
}
Пример #5
0
void initialise_campaign_screen_save_page_objects (void)
{
	set_ui_object_drawable (save_filename_input, FALSE);

	set_ui_object_state (save_filename_input, UI_OBJECT_STATE_OFF);

	set_ui_object_text (save_filename_input, "");

	set_ui_object_text (save_current_filename, "");

	set_ui_object_drawable (save_current_filename, TRUE);
}
Пример #6
0
void ui_object_mslider_function (ui_object *obj, void *arg)
{

	if ((int) arg == BUTTON_STATE_DOWN)
	{

		if (!current_object_to_slide)
		{
	
			current_object_to_slide = obj;
	
			debug_log ("setting current object to slide %d", obj);
	
			// turn off all options
	
			set_ui_object_state (current_object_to_slide, UI_OBJECT_STATE_OFF);
	
			set_event (MOUSE_MOVE_UP, MODIFIER_MOUSE_LEFT_BUTTON, BUTTON_STATE_EITHER, mslider_move_function);
	
			set_event (MOUSE_MOVE_DOWN, MODIFIER_MOUSE_LEFT_BUTTON, BUTTON_STATE_EITHER, mslider_move_function);
	
			mslider_move_function (NULL);
		}
	}
	else if ((int) arg == BUTTON_STATE_UP)
	{

		if (current_object_to_slide)
		{
	
			set_ui_object_state (current_object_to_slide, UI_OBJECT_STATE_OFF);
	
			current_object_to_slide = NULL;
	
			set_event (MOUSE_MOVE_UP, MODIFIER_NONE, BUTTON_STATE_EITHER, NULL);
	
			set_event (MOUSE_MOVE_DOWN, MODIFIER_NONE, BUTTON_STATE_EITHER, NULL);
		}
	}
}
Пример #7
0
void initialise_campaign_screen_chat_page_objects (void)
{
	//
	// Set Window Mode
	//
	
	set_ui_object_drawable (chat_target_list_area, TRUE);

	set_ui_object_drawable (chat_message_list_area, FALSE);

	set_ui_object_state (chat_window_destination_button, UI_OBJECT_STATE_ON);

	//
	// Set Target to ALL
	//
	
	set_ui_object_item_number (chat_send_button, get_local_entity_safe_index (get_session_entity ()));

	//
	// Clear Text Input Area
	//
	
	set_ui_object_drawable (chat_input, FALSE);

	set_ui_object_text (chat_input, "");

	set_ui_object_state (chat_input, UI_OBJECT_STATE_OFF);

	//
	// Clear Current Text Area
	//
	
	set_ui_object_text (chat_current_text, "");

	set_ui_object_drawable (chat_current_text, TRUE);
}
Пример #8
0
void initialise_campaign_screen_base_page_objects (void)
{
    page_map_dimensions.x = MID_MAP_X;
    page_map_dimensions.z = MID_MAP_Z;
    page_map_dimensions.size = 8.0 * KILOMETRE;

    page_map_dimensions.subject_entity = NULL;
    page_map_dimensions.selected_entity = NULL;

    clear_map_mouse_over_object (&page_map_dimensions);

    set_ui_object_item_number (page_3d_area, ENTITY_INDEX_DONT_CARE);

    set_ui_object_item_number (page_map_area, ENTITY_INDEX_DONT_CARE);

    set_ui_object_drawable (page_3d_area, FALSE);

    set_ui_object_drawable (page_map_area, TRUE);

    set_ui_object_state (page_map_toggle, UI_OBJECT_STATE_ON);
}
Пример #9
0
static void call_text_ui_object_function (ui_object *obj, void *arg)
{

	void
		((*function) (ui_object *object, void *arg));
	
	text_ui_object
		*text;

	ui_object
		*notify_obj,
		*list_parent;

	int
		mouse_state,
		mouse_graphic_state;

	text = (text_ui_object *) obj->data;

	function = text->area.function;

	if (function)
	{

		//set_ui_object_redraw (obj, TRUE);
		{

			ui_object
				*temp_obj;
	
			temp_obj = obj;
	
			while (temp_obj)
			{
	
				set_ui_object_redraw (temp_obj, TRUE);

				if (!get_ui_object_clear (temp_obj))
				{
	
					break;
				}
	
				temp_obj = get_ui_object_parent (temp_obj);
			}
		}

		if ((int) arg == BUTTON_STATE_DOWN)
		{

			set_ui_object_state (obj, UI_OBJECT_STATE_ON);
		}
		else 
		{
			
			set_ui_object_state (obj, UI_OBJECT_STATE_OFF);
		}

		//
		// if list text get lists notify type
		//

		list_parent = get_ui_object_parent (obj);

		notify_obj = obj;

		if (list_parent->type == UI_TYPE_LIST_BOX)
		{

			notify_obj = list_parent;
		}

		if
			(
				(get_ui_object_notify_on (notify_obj) == (int) arg) ||
				(get_ui_object_notify_on (notify_obj) == NOTIFY_TYPE_BUTTON_EITHER)
			)
		{

			mouse_state = get_mouse_on ();

			mouse_graphic_state = get_mouse_graphic_on ();

//			set_mouse_off ();

			ui_repaint ();

			function (obj, (void *) arg);
		}

//		if (mouse_state)
//		{
//
//			set_mouse_on ();
//		}
//
//		if (mouse_graphic_state)
//		{
//
//			set_mouse_graphic_on ();
//		}
	}
}
Пример #10
0
void show_weapon_loading_page (entity *group, int force_update)
{
	gunship_types
		type;

	int
		loop;

	entity
		*en,
		*pilot,
		*member;

	ui_object
		*new_item;

	ASSERT (group);

	//
	// Reconstruct List
	//

	if (force_update)
	{
		ui_object_destroy_list_items (page_member_list);

		set_ui_object_vslider_virtual_position (get_ui_object_vslider (page_member_area), 0.0);

		set_ui_object_item_number (page_member_list, ENTITY_INDEX_DONT_CARE);

		member = get_local_entity_first_child (group, LIST_TYPE_MEMBER);

		ASSERT (member);

		while (member)
		{
			sprintf (buffer, "1-%d %s", get_local_entity_int_value (member, INT_TYPE_GROUP_MEMBER_ID), get_local_entity_string (member, STRING_TYPE_SHORT_DISPLAY_NAME));

			pilot = get_local_entity_first_child (member, LIST_TYPE_AIRCREW);

			if (pilot)
			{
				sprintf (buffer, "1-%d %s (%s)",
								get_local_entity_int_value (member, INT_TYPE_GROUP_MEMBER_ID),
								get_local_entity_string (member, STRING_TYPE_SHORT_DISPLAY_NAME),
								get_local_entity_string (pilot, STRING_TYPE_PILOTS_NAME));
			}

			if (get_local_entity_int_value (member, INT_TYPE_GUNSHIP_TYPE) < NUM_GUNSHIP_TYPES)
			{
				new_item = add_to_pop_up_list (buffer, page_member_list, NULL, get_local_entity_safe_index (member), UI_FONT_ARIAL_14, ui_ingame_live_text_colour);

				set_ui_mouse_over_entity_function (new_item);

				set_ui_object_notify_on (new_item, NOTIFY_TYPE_BUTTON_DOWN);
			}
			else
			{
				new_item = add_to_pop_up_list (buffer, page_member_list, NULL, get_local_entity_safe_index (member), UI_FONT_ARIAL_14, ui_ingame_dead_text_colour);

				set_ui_object_notify_on (new_item, NOTIFY_TYPE_NONE);
			}

			if (member == get_gunship_entity ())
			{
				set_ui_object_state (new_item, UI_OBJECT_STATE_ON);

				set_ui_object_item_number (page_member_list, get_local_entity_safe_index (member));
			}

			member = get_local_entity_child_succ (member, LIST_TYPE_MEMBER);
		}

		resize_pop_up_list (page_member_list);
	}

	//
	// Show weapon loading page
	//

	for (loop = 0; loop < NUM_GUNSHIP_TYPES; loop ++)
	{
		set_ui_object_drawable (weapon_loading_page [loop], FALSE);

		set_ui_object_item_number (weapon_loading_page [loop], ENTITY_INDEX_DONT_CARE);
	}

	en = get_local_entity_safe_ptr (get_ui_object_item_number (page_member_list));

	ASSERT (en);

	type = get_local_entity_int_value (en, INT_TYPE_GUNSHIP_TYPE);

	if (get_local_entity_int_value (en, INT_TYPE_GUNSHIP_TYPE) < NUM_GUNSHIP_TYPES)
	{
		weapon_loading_update_currently_selected_weapons (en);

		set_ui_object_drawable (weapon_loading_page [type], TRUE);

		set_ui_object_item_number (weapon_loading_page [type], get_local_entity_safe_index (en));
	}

	//
	// Default payload list
	//

	rebuild_default_payload_list (en);

	display_campaign_page (CAMPAIGN_PAGE_WEAPON_LOADING, get_local_entity_safe_index (group), TRUE);
}
Пример #11
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);
	}
}
Пример #12
0
void chat_enter_message_function (ui_object *obj, void *arg)
{
	set_ui_object_state (chat_input, UI_OBJECT_STATE_ON);

	set_ui_object_drawable (chat_current_text, FALSE);
}