示例#1
0
void store_multiplayer_options (void)
{

	// Set the tcp/ip address to the one in the text area

	strncpy ( global_options.ip_address, get_ui_object_text ( ip_address_text_obj ), 127 );

	global_options.ip_address[127] = '\0';

	// Set the phone number to the one in the text area

	strncpy ( global_options.phone_number, get_ui_object_text ( phone_number_text_obj ), 127 );

	global_options.phone_number[127] = '\0';

	// Try to give the service provider all the information it needs

	if (!get_current_game_session ())
	{

		initialise_service_provider_connection ();
	}

	ui_set_user_function ( NULL );

	// Save the global options data

	save_global_options_data ();
}
示例#2
0
文件: ca_chat.c 项目: Comanche93/eech
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);
}
示例#3
0
文件: ca_chat.c 项目: Comanche93/eech
static void notify_send_message (ui_object *obj, void *arg)
{
	entity
		*target;
		
	const char
		*text;
		
	target = get_local_entity_safe_ptr (get_ui_object_item_number (chat_send_button));

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

		if (text)
		{
			if (strlen (text) > 0)
			{
				send_text_message (get_pilot_entity (), target, MESSAGE_TEXT_PILOT_STRING, text);

				return;
			}
		}
	}
}
示例#4
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);
        }
    }
}
示例#5
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);
}
示例#6
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);
}
示例#7
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);
}
示例#8
0
static void save_session (ui_object *obj, void *arg)
{
	char
		*filename;

	ASSERT (get_current_game_session ());

	ASSERT (get_session_entity ());

	filename = get_ui_object_text (save_current_filename);

	if (filename)
	{
		if (strlen (filename) > 0)
		{
			store_session (current_session, filename);
		}
	}

	pop_campaign_history (NULL, NULL);
}
示例#9
0
static void update_save_page_objects (ui_object *obj, void *arg)
{
	char
		*text;

	set_ui_object_drawable (page_back_button, get_campaign_history_valid ());

	//
	// Only display save button if valid filename
	//

	set_ui_object_drawable (save_game_confirm_button, FALSE);

	text = get_ui_object_text (save_current_filename);

	if (text)
	{
		if (strlen (text) > 0)
		{
			set_ui_object_drawable (save_game_confirm_button, TRUE);
		}
	}
}
示例#10
0
static void save_game_function (ui_object *obj, void *arg)
{
	char
		*text;

	#if DEBUG_MODULE

	debug_filtered_log("Filename query");

	#endif

	text = get_ui_object_text (save_current_filename);

	if (text)
	{
		if (strlen (text) > 0)
		{
			strcpy (full_filename, current_session->data_path);

			strcat (full_filename, "//Campaign//");

			strcat (full_filename, text);

			strcat (full_filename, ".sav");

			if (file_exist (full_filename))
			{
				save_session (obj, arg);
			}
			else
			{
				save_session (obj, arg);
			}
		}
	}
}
示例#11
0
文件: ar_draw.c 项目: Comanche93/eech
static void draw_area_ui_object (ui_object *obj)
{

	float
		x,
		y,
		x1,
		y1,
		x2,
		y2;

	int
		redraw_flag = FALSE,
		masked,
		width,
		height,
		pitch;

	font_types
		font_id;

	area_ui_object
		*area;

	struct SCREEN
		*old_active_screen,
		*memory_graphic;

	unsigned short int
		*graphic;

	struct ZOOMABLE_GRAPHIC
		*zoomable_graphic;

	unsigned char
		*data;

	ui_object
		*parent;

	if (get_ui_object_redraw (obj))
	{

		area = (area_ui_object *) obj->data;

		//debug_log ("AR_DRAW: drawing area %f, %f  %f, %f", area->x, area->y, area->x_size, area->y_size);

		x1 = area->x;
		y1 = area->y;

		x2 = x1 + area->x_size;
		y2 = y1 + area->y_size;

		old_active_screen = get_active_screen ();

		if (get_ui_object_active_screen (obj))
		{
	
			set_active_screen (get_ui_object_active_screen (obj));
		}
		else
		{

			set_active_screen (video_screen);
		}

		if (lock_screen (active_screen))
		{
	
			switch (get_ui_object_graphic_type (obj))
			{
	
				case UI_OBJECT_GRAPHIC:
				{
		
					if (!get_ui_object_clear (obj))
					{
		
						graphic = get_ui_object_graphic (obj);
	
						ui_draw_graphic (x1, y1, x2, y2, graphic);
	
						redraw_flag = TRUE;
					}
					else
					{
	
						parent = get_ui_object_parent (obj);
	
						if (parent)
						{
	
							graphic = get_ui_object_graphic (parent);
	
							ui_draw_part_graphic (x1, y1, x2, y2, x1, y1, graphic);
	
							redraw_flag = TRUE;
						}
					}
	
					break;
				}
	
				case UI_OBJECT_MEMORY_GRAPHIC:
				{
	
					memory_graphic = get_ui_object_memory_graphic (obj);

					if (lock_screen (memory_graphic))
					{
		
						width = get_screen_width (memory_graphic);
		
						height = get_screen_height (memory_graphic);
		
						data = get_screen_data (memory_graphic);
		
						pitch = get_screen_pitch (memory_graphic);
		
						masked = get_ui_object_clear (obj);
		
						ui_draw_memory_graphic (obj, x1, y1, x2, y2, width, height, pitch, masked);

						unlock_screen (memory_graphic);
					}
	
					redraw_flag = TRUE;
	
					break;
				}
	
				case UI_OBJECT_ALPHA_GRAPHIC:
				{
		
					if (!get_ui_object_clear (obj))
					{
		
						graphic = get_ui_object_graphic (obj);
	
						ui_draw_alpha_graphic (x1, y1, x2, y2, graphic);
	
						redraw_flag = TRUE;
					}
					else
					{
	
						parent = get_ui_object_parent (obj);
	
						if (parent)
						{
	
							graphic = get_ui_object_graphic (parent);
	
							ui_draw_part_alpha_graphic (x1, y1, x2, y2, x1, y1, graphic);
	
							redraw_flag = TRUE;
						}
					}
	
					break;
				}
	
				case UI_OBJECT_ZOOMABLE_PALETTE_GRAPHIC:
				{
		
					if (!get_ui_object_clear (obj))
					{
	
						zoomable_graphic = get_ui_object_zoomable_palette_graphic (obj);
	
						draw_zoomable_graphic (zoomable_graphic, area->cx, area->cy, x1, y1, x2, y2, area->zoom);
	
						redraw_flag = TRUE;
					}
	
					break;
				}
	
				case UI_OBJECT_NO_GRAPHIC:
				default:
				{
	
					if (!get_ui_object_clear (obj))
					{
	
						ui_draw_area (x1, y1, x2, y2);
	
						redraw_flag = TRUE;
					}
				}
			}
	
			// text position
	
			if (get_ui_object_text (obj))
			{
	
				font_id = get_ui_font ();
	
				set_ui_font (get_ui_object_font (obj));
	
				get_text_position (&x, &y, x1, y1, x2, y2, obj);
		
				ui_display_text (get_ui_object_text (obj), x, y);
	
				set_ui_font (font_id);
	
				redraw_flag = TRUE;
			}
	
			if (redraw_flag)
			{
		
				set_ui_repaint_area (x1 + ui_x_origin, y1 + ui_y_origin, x2 + ui_x_origin + 1, y2 + ui_y_origin + 1);
			}
	
			unlock_screen (active_screen);
		}

		set_active_screen (old_active_screen);

		area->redraw --;

		call_ui_object_draw_function (obj, NULL);
	}
}
示例#12
0
文件: ca_chat.c 项目: Comanche93/eech
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);
}
示例#13
0
void notify_modem_dial_function ( ui_object *obj, void *arg )
{
	ghost_ui_objects_for_modem (obj, TRUE);

	switch ( modem_state )
	{

		case MODEM_NOT_CONNECTED:
		{

			char
				*modem,
				*phone;

			modem = current_modem->name;

			phone = NULL;

			if ( modem )
			{

				if ( strlen ( get_ui_object_text ( phone_number_text_obj ) ) > 0 )
				{

					phone = get_ui_object_text ( phone_number_text_obj );

					modem_state = MODEM_DIALING;

					//
					// Have to call enum sessions to get the phone to dial out
					//

					if ( direct_play_dial_modem ( modem, phone ) )
					{

						//
						// Remove the back button while we connect
						//

//						set_ui_object_drawable ( multi_player_back_button, UI_OBJECT_STATE_OFF );

						ui_set_user_function ( multiplayer_modem_dial_update_function );
					}
					else
					{

						//
						// Report connection failed
						//
					}
				}
				else
				{

					//
					// Report no phone number typed in
					//
				}
			}

			break;
		}
	}
}
示例#14
0
文件: bu_draw.c 项目: Comanche93/eech
static void draw_button_ui_object (ui_object *obj)
{

	float
//		px1,
//		py1,
		x,
		//y,
		//vp_x1,
		//vp_y1,
		//vp_x2,
		//vp_y2,
		x_size,
		y_size,
		x_origin,
		y_origin,
		x1,
		y1,
		x2,
		y2;
		//nx1,
		//ny1,
		//nx2,
		//ny2;

	int
		redraw_flag = FALSE;
//		width,
//		height,
//		pitch;

	struct SCREEN
		*old_active_screen;
//		*memory_graphic;

//	unsigned short
//		*graphic;

//	unsigned char
//		*data;

//	ui_object
//		*parent;

	button_ui_object
		*button;

	button = obj->button;

	if (get_ui_object_redraw (obj))
	{

		if (get_ui_object_autosize (obj))
		{

			ui_object_autosize (obj);
		}

		//debug_log ("BU_DRAW: drawing button %f, %f  %f, %f", button->area.x, button->area.y, button->area.x_size, button->area.y_size);

		//x1 = get_ui_object_x (obj);
		//y1 = get_ui_object_y (obj);

		x_size = get_ui_object_x_size (obj);
		y_size = get_ui_object_y_size (obj);
	
		x_origin = get_ui_object_x_origin (obj);
		y_origin = get_ui_object_y_origin (obj);
	
		ui_set_origin (x_origin, y_origin);


		//x2 = x1 + x_size;// - 1;
		//y2 = y1 + y_size;// - 1;

		x1 = get_ui_object_x (obj);
		y1 = get_ui_object_y (obj);

		x1 += x_origin;
		y1 += y_origin;

		x2 = x1 + get_ui_object_x_size (obj);
		y2 = y1 + get_ui_object_y_size (obj);

		old_active_screen = get_active_screen ();

		if (get_ui_object_active_screen (obj))
		{
	
			set_active_screen (get_ui_object_active_screen (obj));
		}
		else
		{

			set_active_screen (video_screen);
		}

		// debug
		set_active_screen (video_screen);
		// debug

//		if (lock_screen (active_screen))
		{

//			memory_graphic = get_ui_object_memory_graphic (obj);
	
			if (!get_ui_object_clear (obj))
			{
	
				switch (get_ui_object_graphic_type (obj))
				{

					case UI_OBJECT_TEXTURE_GRAPHIC:
					{
			
						texture_graphic
							*graphic;
					
						if ((get_ui_object_state (obj) == UI_OBJECT_STATE_ON) && (get_ui_object_selected_texture_graphic (obj)))
						{
					
							graphic = get_ui_object_selected_texture_graphic (obj);
						}
						else if ((get_ui_object_highlighted (obj)) && (get_ui_object_highlighted_texture_graphic (obj)))
						{
					
							graphic = get_ui_object_highlighted_texture_graphic (obj);
						}
						else
						{
					
							graphic = get_ui_object_texture_graphic (obj);
						}
			
						if (graphic)
						{

							rgb_colour
								colour;

							real_colour
								text_colour;

							colour = get_ui_object_colour ( obj );

							text_colour.red = colour.r;
							text_colour.green = colour.g;
							text_colour.blue = colour.b;
							text_colour.alpha = colour.a;

							ui_draw_texture_graphic (x1, y1, x2, y2, graphic, text_colour);
						}
						else
						{
				
							ui_draw_area (0, 0, x2 - x1, y2 - y1, obj);
						}
				
						break;
					}
/*
					case UI_OBJECT_GRAPHIC:
					{
			
						if (get_ui_object_state (obj) == UI_OBJECT_STATE_ON)
						{
		
							graphic = get_ui_object_graphic (obj);
		
							ui_draw_graphic (x1, y1, x2, y2, graphic);
	
							redraw_flag = TRUE;
						}
						else
						{
	
							parent = get_ui_object_parent (obj);
	
							if (parent)
							{
	
								graphic = get_ui_object_graphic (parent);
	
								px1 = get_ui_object_x (parent);
	
								py1 = get_ui_object_y (parent);
	
								x1 -= px1;
								x2 -= px1;
	
								y1 -= py1;
								y2 -= py1;
		
								ui_draw_part_graphic (x1, y1, x2, y2, x1, y1, graphic);
	
								redraw_flag = TRUE;
							}
						}
	
						break;
					}
	
					case UI_OBJECT_MEMORY_GRAPHIC:
					{
		
						memory_graphic = get_ui_object_memory_graphic (obj);
	
						if (lock_screen (memory_graphic))
						{
		
							width = get_screen_width (memory_graphic);
		
							height = get_screen_height (memory_graphic);
		
							data = get_screen_data (memory_graphic);
		
							pitch = get_screen_pitch (memory_graphic);
			
							ui_draw_memory_graphic (obj, x1, y1, x2, y2, width, height, pitch, FALSE);
		
							unlock_screen (memory_graphic);
						}
	
						redraw_flag = TRUE;
	
						break;
					}
	
					case UI_OBJECT_ALPHA_GRAPHIC:
					{
			
						if (!get_ui_object_clear (obj))
						{
			
							graphic = get_ui_object_graphic (obj);
		
							ui_draw_alpha_graphic (x1, y1, x2, y2, graphic);
		
							redraw_flag = TRUE;
						}
						else
						{
		
							parent = get_ui_object_parent (obj);
		
							if (parent)
							{
		
								graphic = get_ui_object_graphic (parent);
		
								ui_draw_part_alpha_graphic (x1, y1, x2, y2, x1, y1, graphic);
		
								redraw_flag = TRUE;
							}
						}
		
						break;
					}
*/
					case UI_OBJECT_NO_GRAPHIC:
					default:
					{

						int
							state;

						state = get_ui_object_state (obj);

						if ((state == UI_OBJECT_STATE_OFF) && (get_ui_object_highlighted (obj)))
						{

							state = UI_OBJECT_STATE_HIGHLIGHTED;
						}

						ui_draw_button (x1, y1, x2, y2, state);
	
						redraw_flag = TRUE;
					}
				}
			}
		
			if (get_ui_object_text (obj))
			{

				const char
					*text_ptr;

				int
					count;

				float
					y3;
	
				ui_save_current_font ();

				ui_set_object_font (obj);

				// count number of lines spanned

				text_ptr = get_ui_object_text (obj);

				count = 0;

				while (text_ptr)
				{

					count ++;

					text_ptr = strchr (text_ptr, '\n');

					// if found, step over it and display the next part of string
					if (text_ptr)
					{

						text_ptr ++;
					}
				}

				// now draw text

				text_ptr = get_ui_object_text (obj);
			
				get_text_y_position (&y3, y1, y2, text_ptr, get_ui_object_text_justify (obj), count);

				while (text_ptr)
				{
			
					get_text_x_position (&x, x1, x2, text_ptr, get_ui_object_text_justify (obj));
			
					ui_display_text (text_ptr, x, y3);

					y3 += ui_get_font_height ();

					// check for carriage return
					text_ptr = strchr (text_ptr, '\n');

					// if found, step over it and display the next part of string
					if (text_ptr)
					{

						text_ptr ++;
					}
				}

				ui_restore_current_font ();
	
				redraw_flag = TRUE;
			}
	
			if (redraw_flag)
			{
	
				set_ui_repaint_area (x1 - 1, y1 - 1, x2 + 1, y2 + 1);
			}
	
//			unlock_screen (active_screen);
		}

		set_active_screen (old_active_screen);

		button->area.redraw --;

		call_ui_object_draw_function (obj, NULL);
	}
}