Esempio n. 1
0
void notify_show_realism_page (void)
{
    set_ui_object_text (co_pilot_target_option_button, option_cpg_text [get_global_cpg_assist_type ()]);

#if DEBUG_MODULE
    debug_filtered_log ("cpg_assist: %d text: %s",get_global_cpg_assist_type (), option_cpg_text [get_global_cpg_assist_type ()]);
#endif

    set_ui_object_text (co_pilot_ecm_option_button, option_boolean_text [get_global_auto_counter_measures ()]);

#if DEBUG_MODULE
    debug_filtered_log ("acm: %d text: %s", get_global_auto_counter_measures (), option_boolean_text [get_global_auto_counter_measures ()]);
#endif

    set_ui_object_text (avionics_option_button, option_avionics_text [get_global_simple_avionics ()]);

#if DEBUG_MODULE
    debug_filtered_log ("avionics: %d text: %s", get_global_simple_avionics (), option_avionics_text [get_global_simple_avionics ()]);
#endif

    set_ui_object_text (difficulty_option_button, option_difficulty_text [get_global_difficulty_level () - 1]);

#if DEBUG_MODULE
    debug_filtered_log ("diff: %d text: %s", get_global_difficulty_level (), option_difficulty_text [get_global_difficulty_level () - 1]);
#endif

    set_ui_object_text (cpg_report_targets_button, option_cpg_report_targets_text[global_co_pilot_scans_for_targets]);

    display_options_page (OPTIONS_PAGE_REALISM);
#if DEBUG_MODULE
    debug_filtered_log("Inside show_realism_page");
#endif
}
Esempio n. 2
0
void dedicated_server_function (ui_object *obj, void *arg)
{

	char
		buffer [256];

	set_mouse_on ();

	set_mouse_graphic_on ();

	ASSERT (current_game_session);

	//

	if ( get_ui_object_drawable ( obj ) )
	{

		if ( main_screen_texture )
		{
	
			destroy_texture_graphic (dedicated_server_screen_texture);

			dedicated_server_screen_texture = NULL;
		}
	
		dedicated_server_screen_texture = create_texture_graphic ( "graphics\\ui\\cohokum\\demoload.psd" );
	
		set_ui_object_texture_graphic (dedicated_server_screen, dedicated_server_screen_texture);
	
		blit_front_buffer_to_render_buffer ();
	
		ui_set_user_function (NULL);
	}
	else
	{
		if (main_screen_texture)
		{
	
			destroy_texture_graphic (dedicated_server_screen_texture);

			dedicated_server_screen_texture = NULL;
		}
	}
	//

	sprintf (buffer, "Title : %s", current_game_session->title);

	set_ui_object_text (dedicated_server_title_text, buffer);

	sprintf (buffer, "Map : %s", current_game_session->data_path);

	set_ui_object_text (dedicated_server_map_text, buffer);

	sprintf (buffer, "Game : %s", current_game_session->campaign_filename);

	set_ui_object_text (dedicated_server_game_text, buffer);
}
Esempio n. 3
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);
}
Esempio n. 4
0
static void chat_input_function (ui_object *obj, void *arg)
{
	entity 	// Jabberwock 040213 Chat send after Enter
		*target;
		
	const char
		*text;
		
	text = get_ui_object_text (chat_input);

	if (text)
	{
		if (strlen (text) > 0)
		{
			set_ui_object_text (chat_current_text, get_ui_object_text (chat_input));

			// Jabberwock 040213 Chat send after Enter
			target = get_local_entity_safe_ptr (get_ui_object_item_number (chat_send_button));
		
			if (target)
			{
				send_text_message (get_pilot_entity (), target, MESSAGE_TEXT_PILOT_STRING, text);
			}
			// Jabberwock 040202 ends
		}
	}

	set_ui_object_drawable (chat_current_text, TRUE);

	set_ui_object_drawable (chat_input, FALSE);
}
Esempio n. 5
0
void adjust_number_function (event *ev)
{

    char
    new_number [32],
               *str_number;

    int
    number;

    if (*captured_object)
    {

        str_number = get_ui_object_text (*captured_object);

        if (str_number)
        {

            number = atoi (str_number);

            number += (ev->dx / 2) * 10;

            number -= (ev->dy / 2);

            sprintf (new_number, "%d", number);

            set_ui_object_text (*captured_object, new_number);
        }
    }
}
Esempio n. 6
0
void notify_modem_answer_function ( ui_object *obj, void *arg )
{
	char
		text_buffer [256];

	ghost_ui_objects_for_modem (obj, TRUE);

	switch ( modem_state )
	{

		case MODEM_NOT_CONNECTED:
		{

			char
				*modem;

			modem = current_modem->name;

			if ( modem )
			{

				//
				// Have to call create session to get the phone to answer
				//

				if ( direct_play_answer_modem ( modem, GAME_TYPE_INVALID ) )
				{

					direct_play_session_capabilities ();

					direct_play_create_group ();

					direct_play_create_player ();

					set_server_id (direct_play_get_player_id ());

					//
					// Turn off the back button while we connect
					//

//					set_ui_object_drawable ( multi_player_back_button, UI_OBJECT_STATE_OFF );

					sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_WAITING_FOR_CALL"));

					set_ui_object_text (modem_status_text, text_buffer);

					modem_state = MODEM_ANSWERING;

					ui_set_user_function ( multiplayer_modem_answer_update_function );
				}
			}

			break;
		}
	}

	// don't leave text selected

	set_toggle_button_off (obj);
}
Esempio n. 7
0
static void set_input_ui_object_state (ui_object *obj, int flag)
{
	
	input_ui_object
		*input;

	input = obj->data;

	if (input->area.state != flag)
	{
							
		input->area.state = flag;

		if (flag)
		{

			set_alpha_event_functions (input_entry, input_end, input_abort);
		
	  		input_object = obj;

			push_event (set_input_events, "input events");
		}
		else
		{

			set_ui_object_text (obj, "");
		}

		set_ui_object_redraw (obj, TRUE);
	}
}
Esempio n. 8
0
void notify_device_option_button ( ui_object *obj, void *arg )
{
	char
		*name[1];

	if (number_of_joystick_devices > 1)
	{
		if ( get_global_joystick_device_index () < (number_of_joystick_devices - 1) )
		{
			set_global_joystick_device_index (get_global_joystick_device_index () + 1);
		}
		else
		{
			set_global_joystick_device_index (0);
		}

		set_ui_object_text (device_option_button, joystick_devices[get_global_joystick_device_index ()].device_name);

		name[0] = &joystick_devices[get_global_joystick_device_index ()].device_name;

		preprocess_translation_object_size (device_graphic_area, device_option_button, name, 1, RESIZE_OPTION_CYCLE_BUTTON);
	}

	// don't leave text selected

	set_toggle_button_off (obj);

	#if DEBUG_MODULE
		debug_filtered_log ("no. jd's:%d  jd index:%d", number_of_joystick_devices, get_global_joystick_device_index ());
	#endif

}
Esempio n. 9
0
void highlight_russian_medal_info (ui_object *obj, void *arg)
{

	player_log_type
		*player;

	char
		name_text [128],
		info_text [128];

	int
		medal_number,
		medal_count;

	player = get_current_player_log ();

	medal_number = get_ui_object_item_number (obj);

	medal_count = player->side_log [player_log_current_side].medals [medal_number];

	if (	(medal_number != MEDAL_MASTER_AVIATOR) &&
			(medal_number != MEDAL_SENIOR_AVIATOR) &&
			(medal_number != MEDAL_ARMY_AVIATOR) )
	{
		sprintf (name_text, "(%d) %s", medal_count, russian_medal_info_array [medal_number].name);
	}
	else
	{
		sprintf (name_text, "%s", russian_medal_info_array [medal_number].name);
	}

	sprintf (info_text, "%s", russian_medal_info_array [medal_number].info);

	if ((int) arg == BUTTON_STATE_DOWN)
	{
		set_ui_object_text (medals_text_name, name_text);

		set_ui_object_text (medals_text_info, info_text);
	}
	else
	{
		set_ui_object_text (medals_text_name, "");

		set_ui_object_text (medals_text_info, "");
	}

}
Esempio n. 10
0
void set_frontend_slider_graphics (ui_object *parent)
{
	ui_object
		*temp,
		*slider;

	slider = get_ui_object_vslider (parent);

	ASSERT (slider);

	ASSERT (frontend_slider_bar_graphic);
	ASSERT (frontend_slider_bar_highlighted_graphic);
	ASSERT (frontend_slider_bar_selected_graphic);

	ASSERT (frontend_slider_up_graphic);
	ASSERT (frontend_slider_up_highlighted_graphic);
	ASSERT (frontend_slider_up_selected_graphic);

	ASSERT (frontend_slider_down_graphic);
	ASSERT (frontend_slider_down_highlighted_graphic);
	ASSERT (frontend_slider_down_selected_graphic);

	set_ui_object_texture_graphic (slider, frontend_slider_bdrop_graphic);

//	set_ui_object_clear (slider, TRUE);

	// get slider & set graphic
	temp = get_ui_object_child (slider);
	set_ui_object_texture_graphic (temp, frontend_slider_bar_graphic);
	set_ui_object_highlighted_texture_graphic (temp, frontend_slider_bar_highlighted_graphic);
	set_ui_object_selected_texture_graphic (temp, frontend_slider_bar_selected_graphic);
	set_ui_object_text (temp, "");

	// get up button & set graphic
	temp = get_ui_object_next (temp);
	set_ui_object_texture_graphic (temp, frontend_slider_up_graphic);
	set_ui_object_highlighted_texture_graphic (temp, frontend_slider_up_highlighted_graphic);
	set_ui_object_selected_texture_graphic (temp, frontend_slider_up_selected_graphic);
	set_ui_object_text (temp, "");

	// get down button & set graphic
	temp = get_ui_object_next (temp);
	set_ui_object_texture_graphic (temp, frontend_slider_down_graphic);
	set_ui_object_highlighted_texture_graphic (temp, frontend_slider_down_highlighted_graphic);
	set_ui_object_selected_texture_graphic (temp, frontend_slider_down_selected_graphic);
	set_ui_object_text (temp, "");
}
Esempio n. 11
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);
}
Esempio n. 12
0
void notify_cpg_report_targets_option_button ( ui_object *obj, void *arg )
{
    global_co_pilot_scans_for_targets = !global_co_pilot_scans_for_targets;

    set_ui_object_text (obj, option_cpg_report_targets_text [global_co_pilot_scans_for_targets]);

    // don't leave text selected

    set_toggle_button_off (obj);
}
Esempio n. 13
0
void notify_pedal_option_button ( ui_object *obj, void *arg )
{

	if ( (number_of_joystick_devices) && (get_global_pedal_input () == KEYBOARD_INPUT) )
	{
			set_global_pedal_input (RUDDER_INPUT);

			set_ui_object_text (pedal_option_button, option_pedal_text[1]);
	}
	else
	{
		set_global_pedal_input (KEYBOARD_INPUT);

		set_ui_object_text (pedal_option_button, option_pedal_text[0]);
	}

	// don't leave text selected

	set_toggle_button_off (obj);
}
Esempio n. 14
0
void notify_co_pilot_ecm_option_button ( ui_object *obj, void *arg )
{

    set_global_auto_counter_measures (!get_global_auto_counter_measures ());

    set_ui_object_text (obj, option_boolean_text [get_global_auto_counter_measures ()]);

    // don't leave text selected

    set_toggle_button_off (obj);
}
Esempio n. 15
0
void notify_collective_option_button ( ui_object *obj, void *arg )
{

	if ( (number_of_joystick_devices) && (get_global_collective_input () == KEYBOARD_INPUT) )
	{
			set_global_collective_input (THROTTLE_INPUT);

			set_ui_object_text (collective_option_button, option_throttle_text[1]);
	}
	else
	{
		set_global_collective_input (KEYBOARD_INPUT);

		set_ui_object_text (collective_option_button, option_throttle_text[0]);
	}

	// don't leave text selected

	set_toggle_button_off (obj);
}
Esempio n. 16
0
void notify_keyboard_assist_option_button ( ui_object *obj, void *arg )
{
	set_global_dynamics_options_keyboard_assistance (!get_global_dynamics_options_keyboard_assistance ());

	set_ui_object_text (keyboard_assist_option_button, option_boolean_text [get_global_dynamics_options_keyboard_assistance ()]);

	set_current_dynamics_options (DYNAMICS_OPTIONS_KEYBOARD_ASSISTANCE, get_global_dynamics_options_keyboard_assistance());

	// don't leave text selected

	set_toggle_button_off (obj);
}
Esempio n. 17
0
static void set_area_ui_object_add_text (ui_object *obj, char *text)
{

	char
		*temp_text;

	int
		new_length,
		old_length;

	area_ui_object
		*area;

	area = obj->data;

	if ((!area->text) || (strlen (area->text) == 0))
	{

		set_ui_object_text (obj, text);

		return;
	}

	new_length = strlen (text);

	old_length = strlen (area->text);

	temp_text = (char *) safe_malloc (old_length + new_length + 1);

	strcpy (temp_text, area->text);

	strcat (temp_text, text);

	set_ui_object_text (obj, temp_text);

	safe_free (temp_text);
}
Esempio n. 18
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);
}
Esempio n. 19
0
void notify_avionics_option_button ( ui_object *obj, void *arg )
{

    set_global_simple_avionics (!get_global_simple_avionics ());

    set_ui_object_text (obj, option_avionics_text [get_global_simple_avionics ()]);

#if DEBUG_MODULE
    debug_filtered_log ("avionics: %d text: %s", get_global_simple_avionics (), option_avionics_text [get_global_simple_avionics ()]);
#endif

    // don't leave text selected

    set_toggle_button_off (obj);
}
Esempio n. 20
0
void notify_co_pilot_target_option_button ( ui_object *obj, void *arg )
{
    int
    selection;

    selection = (get_global_cpg_assist_type () + 1) % NUM_CPG_ASSISTANCE_TYPES;

    set_global_cpg_assist_type ((cpg_assist_types) selection);

    set_ui_object_text (obj, option_cpg_text [selection]);

    // don't leave text selected

    set_toggle_button_off (obj);

#if DEBUG_MODULE
    debug_filtered_log("selection:%d", selection);
#endif
}
Esempio n. 21
0
void dedicated_screen_update_function (ui_object *obj, void *arg)
{

	float
		time;

	int
		hours,
		minutes,
		seconds;

	char
		s [64];

	ASSERT (command_line_comms_dedicated_server);

	if (get_session_entity ())
	{

		if (get_local_entity_int_value (get_session_entity (), INT_TYPE_SESSION_COMPLETE))
		{

			if (!get_connection_list_head ())
			{

				debug_log ("DEDI_SC: Exiting game as no clients left");

				exit_apache_havoc (NULL);
			}
		}

		time = get_local_entity_float_value (get_session_entity (), FLOAT_TYPE_ELAPSED_TIME);

		get_digital_countdown_values (time, NULL, &hours, &minutes, &seconds);
	
		sprintf (s, "Day %d, %02d:%02d:%02d", get_local_entity_int_value (get_session_entity (), INT_TYPE_DAY), hours, minutes, seconds);

		set_ui_object_text (dedicated_server_time_text, s);

		dedicated_server_build_player_list ();
	}
}
Esempio n. 22
0
static void notify_save_file_list (ui_object *obj, void *arg)
{
	char
		*text;

	text = get_ui_object_text (obj);

	if (text)
	{
		if (strlen (text) > 0)
		{
			parse_filename (text, FILENAME_MAX_LENGTH);

			set_ui_object_text (save_current_filename, text);
		}
	}

	set_ui_object_drawable (save_current_filename, TRUE);

	set_ui_object_drawable (save_filename_input, FALSE);
}
Esempio n. 23
0
void filename_input_function ( ui_object *obj, void *arg )
{
	char
		*text;

	text = get_ui_object_text (save_filename_input);

	if (text)
	{
		if (strlen (text) > 0)
		{
			parse_filename (text, FILENAME_MAX_LENGTH);

			set_ui_object_text (save_current_filename, text);
		}
	}

	set_ui_object_drawable (save_current_filename, TRUE);

	set_ui_object_drawable (save_filename_input, FALSE);
}
Esempio n. 24
0
void notify_difficulty_option_button ( ui_object *obj, void *arg )
{
    int
    selection;

    selection = get_global_difficulty_level ();

    selection--;

    if (selection < GAME_DIFFICULTY_HARD)
    {
        selection = GAME_DIFFICULTY_EASY;
    }

    set_global_difficulty_level ((enum GAME_DIFFICULTY_SETTINGS) selection);

    set_ui_object_text (obj, option_difficulty_text [selection - 1]);

    // don't leave text selected

    set_toggle_button_off (obj);
}
Esempio n. 25
0
void notify_reverse_throttle_option_button ( ui_object *obj, void *arg )
{

	int
		selection;

	selection = !get_global_dynamics_options_reverse_throttle_input ();

	set_global_dynamics_options_reverse_throttle_input (selection);

	set_ui_object_text (reverse_throttle_button, option_boolean_text [selection]);

	set_current_dynamics_options (DYNAMICS_OPTIONS_REVERSE_THROTTLE_INPUT, get_global_dynamics_options_reverse_throttle_input());

	// don't leave text selected

	set_toggle_button_off (obj);

	#ifdef DEBUG_MODULE
		debug_filtered_log ("reverse throttle: %d", get_global_dynamics_options_reverse_throttle_input ());
	#endif
}
Esempio n. 26
0
static void update_base_page_objects (ui_object *obj, void *arg)
{
    char
    s [128];

    entity
    *base;

    entity_sub_types
    sub_type;

    base = get_local_entity_safe_ptr (get_ui_object_item_number (campaign_page [CAMPAIGN_PAGE_BASE]));

    ASSERT (base);

    sub_type = get_local_entity_int_value (base, INT_TYPE_ENTITY_SUB_TYPE);

    //
    // STATUS
    //

    {
        int status;


        status = get_local_entity_int_value (base, INT_TYPE_KEYSITE_USABLE_STATE);

        set_ui_object_text (base_page_status_box, get_trans ((char*) keysite_usable_state_names [status]));

        switch (status)
        {
        case KEYSITE_STATE_UNUSABLE:
        {
            set_ui_object_font_colour (base_page_status_box, ui_colour_red.r, ui_colour_red.g, ui_colour_red.b, ui_colour_red.a);

            break;
        }

        case KEYSITE_STATE_REPAIRING:
        {
            set_ui_object_font_colour (base_page_status_box, ui_colour_yellow.r, ui_colour_yellow.g, ui_colour_yellow.b, ui_colour_yellow.a);

            break;
        }

        default:
        {
            set_ui_object_font_colour (base_page_status_box, ui_colour_yellow.r, ui_colour_yellow.g, ui_colour_yellow.b, ui_colour_yellow.a);

            break;
        }
        }
    }

    //
    // Efficiency
    //

    {
        float
        efficiency;

        if (get_local_entity_float_value (base, FLOAT_TYPE_KEYSITE_MAXIMUM_STRENGTH) > 0.0)
        {
            efficiency = get_local_entity_float_value (base, FLOAT_TYPE_EFFICIENCY) * 100.0;

            sprintf (s, "%.0f%%", efficiency);
        }
        else
        {
            sprintf (s, "N/A", efficiency);
        }

        set_ui_object_text (base_page_efficiency_box, s);
    }

    //
    // Supplies
    //

    {
        float
        supplies;

        if (keysite_database [sub_type].report_ammo_level)
        {
            supplies = get_local_entity_float_value (base, FLOAT_TYPE_AMMO_SUPPLY_LEVEL);

            sprintf (s, "%.0f%%", supplies);

            set_ui_object_text (base_page_ammo_box, s);
        }
        else
        {
            set_ui_object_text (base_page_ammo_box, "");
        }

        if (keysite_database [sub_type].report_fuel_level)
        {
            supplies = get_local_entity_float_value (base, FLOAT_TYPE_FUEL_SUPPLY_LEVEL);

            sprintf (s, "%.0f%%", supplies);

            set_ui_object_text (base_page_fuel_box, s);
        }
        else
        {
            set_ui_object_text (base_page_fuel_box, "");
        }
    }

    //
    // Back Button
    //

    set_ui_object_drawable (page_back_button, get_campaign_history_valid ());
}
Esempio n. 27
0
void show_base_page (entity *base, int force_update)
{
    entity
    *previous;

    vec3d
    *pos;

    int
    x, z;

    char
    s [128];

    ASSERT (base);

    ASSERT (get_local_entity_type (base) == ENTITY_TYPE_KEYSITE);

    if (force_update)
    {
        previous = NULL;
    }
    else
    {
        previous = get_local_entity_safe_ptr (get_ui_object_item_number (campaign_page [CAMPAIGN_PAGE_BASE]));
    }

    pos = get_local_entity_vec3d_ptr (base, VEC3D_TYPE_POSITION);

    ASSERT (pos);

    //
    // NAME
    //

    set_ui_object_text (base_page_title, get_local_entity_string (base, STRING_TYPE_KEYSITE_NAME));

    //
    // TYPE
    //

    set_ui_object_text (base_page_type_box, get_trans (get_local_entity_string (base, STRING_TYPE_FULL_NAME)));

    //
    // LOCATION
    //

    get_x_sector (x, pos->x);
    get_z_sector (z, pos->z);

    sprintf (s, "[%03d, %03d]", x, z);

    set_ui_object_text (base_page_sector_box, s);

    //
    // 3D WINDOW
    //

    set_ui_object_item_number (page_3d_area, get_local_entity_index (base));

    if (base != previous)
    {
        page_3d_heading = 0.0;
        page_3d_pitch = (PI * 0.25);
        page_3d_distance = max (50.0, get_local_entity_float_value (base, FLOAT_TYPE_RECON_DISTANCE));
    }

    //
    // 2D MAP
    //

    set_ui_object_item_number (page_map_area, get_local_entity_index (base));

    if (base != previous)
    {
        page_map_dimensions.x = pos->x;
        page_map_dimensions.z = pos->z;

        page_map_dimensions.subject_entity = base;
    }

    //

    display_campaign_page (CAMPAIGN_PAGE_BASE, get_local_entity_index (base), TRUE);
}
Esempio n. 28
0
void multiplayer_modem_dial_update_function ( void )
{

	char
		text_buffer [256];

	int
		game_update_time;

	static int
		update_ticks = 0;

	game_update_time = TIME_1_SECOND;

	if ( update_ticks < get_system_time () )
	{

		session_table_type
			*this_session;

		connection_data_type
			*this_connection;

		unsigned int
			connection_code;

		connection_code = direct_play_dial_modem_status ();

		if ( connection_code == DP_OK )
		{

			//
			// Need to do the final enumeration
			//

			sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_FINDING_GAMES"));

			if ( direct_play_enumerate_sessions () )
			{

				set_comms_model ( COMMS_MODEL_CLIENT );

				this_session = direct_play_get_session_table ();

				if ( this_session )
				{

					int
						baudrate;

					this_connection = direct_play_get_connection_data ();

					this_connection->this_session.session = this_session->session;

					sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_JOINING_GAMES"));

					direct_play_join_session ();

					direct_play_session_capabilities ();

					if (!direct_play_enumerate_groups ())
					{

						debug_fatal ("SESSION: Client can't enumerate any groups - but connected someway");
					}

					this_connection->this_group = direct_play_get_group_table ();

					direct_play_create_player ();

					direct_play_join_group ();

					baudrate = direct_play_get_connection_baudrate ();

					sprintf (text_buffer, "%s: %s %d", get_trans ("MP_STATUS"), get_trans ("MP_CONNECTED_AT"), baudrate * 100);

					set_ui_object_text (modem_status_text, text_buffer);

//					set_ui_object_drawable ( multi_player_back_button, UI_OBJECT_STATE_ON );

					ghost_ui_objects_for_modem (NULL, FALSE);

					modem_state = MODEM_DIALLED_CONNECTED;

					ui_set_user_function ( multiplayer_modem_connection_update_function );
				}
			}
		}
		else
		{

			if ( connection_code == DPERR_CONNECTING )
			{


				sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_CONNECTING"));

				set_ui_object_text ( modem_status_text, text_buffer );
			}
			else
			{

				sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_UNCONNECTED"));

				set_ui_object_text ( modem_status_text, text_buffer );

				modem_state = MODEM_NOT_CONNECTED;

//				set_ui_object_drawable ( multi_player_back_button, UI_OBJECT_STATE_ON );

				ghost_ui_objects_for_modem (NULL, FALSE);

				ui_set_user_function ( NULL );
			}
		}

		update_ticks = get_system_time () + game_update_time;

		set_delta_time ();
	}
}
Esempio n. 29
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. 30
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);
		}
	}
}