コード例 #1
0
ファイル: mult_fn.c プロジェクト: DexterWard/comanche
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);
}
コード例 #2
0
ファイル: mult_fn.c プロジェクト: DexterWard/comanche
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 ();
}
コード例 #3
0
ファイル: dedi_sc.c プロジェクト: Comanche93/eech
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);
}
コード例 #4
0
ファイル: mult_fn.c プロジェクト: DexterWard/comanche
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 ();
	}
}
コード例 #5
0
ファイル: mult_fn.c プロジェクト: DexterWard/comanche
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;
		}
	}
}
コード例 #6
0
ファイル: mult_fn.c プロジェクト: DexterWard/comanche
void break_modem_connection ( void )
{

	char
		text_buffer [256];

	connection_data_type
		*this_connection;

	ui_set_user_function ( NULL );

	switch ( modem_state )
	{

		case MODEM_DIALING:
		case MODEM_DIALLED_CONNECTED:
		{

			//
			// We can't destroy groups, or sessions.
			//

			direct_play_leave_group ();

			direct_play_destroy_player ();

			direct_play_close_session ();

			break;
		}

		case MODEM_ANSWERING:
		case MODEM_ANSWERED_CONNECTED:
		{

			direct_play_leave_group ();

			direct_play_destroy_player ();

			direct_play_destroy_group ();

			direct_play_close_session ();

			break;
		}
	}

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

	set_ui_object_text (modem_status_text, text_buffer);

//	set_ui_object_drawable ( multi_player_back_button, UI_OBJECT_STATE_ON );

	direct_play_destroy_modem ();

	this_connection = direct_play_get_connection_data ();

	if ( this_connection )
	{

		this_connection->one_way_hosting_setup = TRUE;
		this_connection->is_initialised = FALSE;
		this_connection->is_hosting = FALSE;
	}

	modem_state = MODEM_NOT_CONNECTED;
}
コード例 #7
0
ファイル: init_sc.c プロジェクト: Comanche93/eech
void init_function (ui_object *obj, void *arg)
{

	set_mouse_off ();

	if ( get_ui_object_drawable ( obj ) )
	{

		if ( main_screen_texture )
		{
	
			destroy_texture_graphic (init_screen_texture);

			init_screen_texture = NULL;
		}
	
		init_screen_texture = create_texture_graphic ( "graphics\\ui\\cohokum\\title.psd" );
	
		set_ui_object_texture_graphic (init_screen, init_screen_texture);
	
		blit_front_buffer_to_render_buffer ();
	
		ui_set_user_function (NULL);
	}
	else
	{
		if (main_screen_texture)
		{
	
			destroy_texture_graphic (init_screen_texture);

			init_screen_texture = NULL;
		}
	}
	
	ui_force_update ();

	full_initialise_game ();

	set_mouse_on ();

	switch (command_line_run_mode)
	{
/*
		case RUN_MODE_AITOOL:
		{

			initialise_aitool ();

			push_ui_screen (aitool_select_map_screen);

			break;
		}
*/
		case RUN_MODE_NORMAL:
		default:
		{

			if (command_line_comms_dedicated_server)
			{

				process_game_initialisation_phases ();
			}
			else
			{
	
				play_cd_music ( CD_MUSIC_TYPE_INTRO );

				#if DEMO_VERSION
					push_ui_screen (advert_screen);
				#else
					push_ui_screen (main_screen);
				#endif
			}

			break;
		}
	}
}
コード例 #8
0
ファイル: main_fn.c プロジェクト: DexterWard/comanche
void notify_main_screen (ui_object *obj, void *arg)
{

	obj;
	arg;

	if ( get_ui_object_drawable ( obj ) )
	{

		if ( main_screen_texture )
		{

			destroy_texture_graphic ( main_screen_texture );

			main_screen_texture = NULL;
		}

		main_screen_texture = create_texture_graphic ( "graphics//ui//cohokum//main.psd" );

		set_ui_object_texture_graphic ( main_screen, main_screen_texture );

		blit_front_buffer_to_render_buffer ();

		leave_mission ();

		ui_set_user_function (NULL);

		reset_time_values ( main_screen );
	}
	else
	{

		if ( main_screen_texture )
		{

			destroy_texture_graphic ( main_screen_texture );

			main_screen_texture = NULL;
		}
	}

	#if DEMO_VERSION

		set_ui_object_highlightable (pilots_button, FALSE);

		set_ui_object_font_colour_end (pilots_button, ui_option_text_default_colour.r, ui_option_text_default_colour.g, ui_option_text_default_colour.b, 127);

		set_ui_object_notify_on (pilots_button, NOTIFY_TYPE_NONE);

		set_ui_object_drawable (ghost_pilots_button, TRUE);

		set_ui_object_highlightable (credits_button, FALSE);

		set_ui_object_font_colour_end (credits_button, ui_option_text_default_colour.r, ui_option_text_default_colour.g, ui_option_text_default_colour.b, 127);

		set_ui_object_drawable (ghost_credits_button, TRUE);

		set_ui_object_notify_on (credits_button, NOTIFY_TYPE_NONE);

	#endif
}
コード例 #9
0
ファイル: uisession.c プロジェクト: Comanche93/eech
void start_campaign (void)
{

	//
	// Check mission data has arrived...
	//

	ASSERT (current_game_session);

	switch (current_game_session->type)
	{

		case SESSION_LIST_TYPE_RESTORE:
		{

			create_campaign (get_current_game_session ());

			process_restore_session_setup_options ();

			break;
		}
		case SESSION_LIST_TYPE_HOST:
		{

			create_campaign (get_current_game_session ());

			process_host_session_setup_options ();

			break;
		}
		case SESSION_LIST_TYPE_JOIN:
		{

			if (!get_session_entity ())
			{

				return;
			}

			break;
		}
		case SESSION_LIST_TYPE_MASTER:
		{
			current_game_session->type = SESSION_LIST_TYPE_JOIN;

			//TODO: Setup dplay connection, then get first active session.

			if (!get_session_entity ())
			{

				return;
			}

			break;
		}
		// Jabberwock 031210 Session filter
		case SESSION_LIST_TYPE_FILTER:
		{
			if (!get_session_entity ())
			{

				return;
			}

			break;
		}
		// Jabberwock 031210 ends
		case SESSION_LIST_TYPE_INVALID:
		default:
		{

			debug_fatal ("GUNS_SC: unknown game type");
		}
	}

	ui_set_user_function (NULL);

	switch ( get_global_gunship_type () )
	{

		case GUNSHIP_TYPE_APACHE:
		case GUNSHIP_TYPE_COMANCHE:
		{

			//play_cd_music ( CD_MUSIC_TRACK_INGAME );

			break;
		}
		case GUNSHIP_TYPE_HAVOC:
		case GUNSHIP_TYPE_HOKUM:
		{

			//play_cd_music ( CD_MUSIC_TRACK_INGAME );

			break;
		}
	}
}