コード例 #1
0
ファイル: uisession.c プロジェクト: Comanche93/eech
void compile_single_session_list (session_list_data_type **list)
{

	connection_data_type
		*this_connection;

	this_connection = direct_play_get_connection_data ();

	if ( ( this_connection ) && ( this_connection->is_initialised ) )
	{

		if ( ( this_connection->one_way_hosting_setup ) && ( !this_connection->is_hosting ) )
		{

			return;
		}
	}

// Jabberwock 040201 Session filter
	if (!command_line_session_filter || (strcmp (session_filter_value, "root") == 0))
	{
		recursive_check_campaign_files ("..\\common\\maps", list, game_type_extensions [get_game_type ()]);
	}
	else
	{
		if ((strcmp (session_filter_value, "-Multiplayer-") != 0))
		{
			recursive_check_campaign_files (session_filter_value, list, game_type_extensions [get_game_type ()]);
		}
	}
}
コード例 #2
0
ファイル: comm_man.c プロジェクト: DexterWard/comanche
void receive_comms_data (void)
{

	connection_data_type
		*this_connection;

	this_connection = direct_play_get_connection_data ();

	if ( ( this_connection ) && ( this_connection->is_initialised ) )
	{

		//
		// receive all packets waiting
		//

		receive_packets ();

		#if COMMS_STATS

		//debug_comms_stats ();

		#endif

		//
		// process all data received this frame
		//

		comms_process_data ();
	}
}
コード例 #3
0
ファイル: commsserver.c プロジェクト: Comanche93/eech
int server_create_session (void)
{

	int
		connection_created;

   connection_data_type
      *comms_connection;

	comms_connection = direct_play_get_connection_data ();

	if ( ( comms_connection ) && ( comms_connection->is_initialised ) )
	{

		if ( !comms_connection->one_way_hosting_setup )
		{
		
			direct_play_close_session ();

			connection_created = FALSE;

			if ( direct_play_create_session (get_game_type ()) )
			{
			
				if ( direct_play_session_capabilities () )
				{
				// Jabberwock 050303 Remove DP groups
				//	if ( direct_play_create_group () )
					{
					
						if ( direct_play_create_player () )
						{
						
							set_server_id (direct_play_get_player_id ());

							connection_created = TRUE;
						}
					}
				}
			}

			if ( !connection_created )
			{

				comms_connection->is_initialised = FALSE;
			}
		}
		else
		{

			direct_play_set_session_type_and_name ( get_game_type () );
		}
	}

	return ( TRUE );
}
コード例 #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 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;
}
コード例 #6
0
ファイル: mult_fn.c プロジェクト: DexterWard/comanche
void notify_multi_player_setup (void)
{

	connection_data_type
		*this_connection;

	char
		text [10];

//	if ( get_ui_object_drawable ( obj ) )
//	{

		this_connection = direct_play_get_connection_data ();

		blit_front_buffer_to_render_buffer ();


		// Setup the service provider cycle button
#ifdef _WIN32
		if ( this_connection->service_provider.name )
		{
			if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_TCPIP, sizeof ( GUID ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_INTERNET"));
			}
			else if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_SERIAL, sizeof ( GUID ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_SERIAL"));
			}
			else if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_MODEM, sizeof ( GUID ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_MODEM"));
			}
			else if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_IPX, sizeof ( GUID ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_IPX"));
			}
        }
		else
		{
			set_ui_object_text (connection_type_button, get_trans ("MP_NO_SERVICE_PROVIDER"));
		}
#elif defined __unix__
if ( this_connection->service_provider.name )
		{
/*ö			if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_TCPIP, sizeof ( int ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_INTERNET"));
			}
			else if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_SERIAL, sizeof ( int ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_SERIAL"));
			}
			else if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_MODEM, sizeof ( int ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_MODEM"));
			}
			else if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_IPX, sizeof ( int ) ) == TRUE )
			{
				set_ui_object_text (connection_type_button, get_trans("MP_IPX"));
			}*/
        }
		else
		{
			set_ui_object_text (connection_type_button, get_trans ("MP_NO_SERVICE_PROVIDER"));
		}
#endif
		preprocess_translation_object_size (connection_type_bdrop, connection_type_button, NULL, 0, RESIZE_OPTION_BOX_TITLE);

		// initialise modem to first in list (? Shouldn't we store the current modem elsewhere - ie globally ?)

		current_modem = modem_name_list;

		if (!current_modem)
		{
			set_ui_object_text (modem_type_button, "No Modem Installed");
		}
		else
		{
			set_ui_object_text (modem_type_button, current_modem->name);
		}

		// Com port button

		sprintf (text, "%d", get_global_comms_port ());

		set_ui_object_text (com_port_button, text);

		// Baud rate

		set_ui_object_text (baud_rate_button, baud_rate_text [get_global_baud_rate () - 1]);

		// Stop bits

		set_ui_object_text (stop_bits_button, stop_bits_text [get_global_stop_bits () - 1]);

		// Parity

		set_ui_object_text (parity_button, parity_text [get_global_parity () - 1]);

		// Flow

		set_ui_object_text (flow_button, flow_text [get_global_flow () - 1]);

		// Phone Number

		set_ui_object_text (phone_number_text_obj, global_options.phone_number);

		// IP Address

		set_ui_object_text (ip_address_text_obj, global_options.ip_address);


		// Now setup the connection type areas

		set_multiplayer_options_display ();


		// Lastly load in the stuff for the screen
/*
		if ( multiplayer_screen_graphic )
		{

			destroy_texture_graphic ( multiplayer_screen_graphic );

			multiplayer_screen_graphic = NULL;
		}

		multiplayer_screen_graphic = create_texture_graphic ( "graphics\\ui\\cohokum\\multi.psd" );

		set_ui_object_texture_graphic ( multi_player_setup_area, multiplayer_screen_graphic );

		blit_front_buffer_to_render_buffer ();

		reset_time_values ( options_screen );
*/
//	}
//	else
//	{
/*
		if ( multiplayer_screen_graphic )
		{

			destroy_texture_graphic ( multiplayer_screen_graphic );

			multiplayer_screen_graphic = NULL;
		}
*/
//	}

	display_options_page (OPTIONS_PAGE_MULTIPLAYER);
}
コード例 #7
0
ファイル: mult_fn.c プロジェクト: DexterWard/comanche
void set_serial_connection_status ( void )
{

	char
		text_buffer [256];

	connection_data_type
		*this_connection;

	this_connection = direct_play_get_connection_data ();
#ifdef _WIN32
	if ( ( this_connection ) && ( this_connection->service_provider.guid ) )
	{

		if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_SERIAL, sizeof ( GUID ) ) == TRUE )
		{

			set_direct_play_serial_address ( get_global_comms_port (), get_global_baud_rate (), get_global_stop_bits (), get_global_parity (), get_global_flow () );

			if ( direct_play_create_session ( 0 ) )
			{

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

				set_ui_object_text (serial_status_text, text_buffer);

				direct_play_close_session ();

				this_connection->is_initialised = TRUE;
			}
			else
			{

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

				set_ui_object_text (serial_status_text, text_buffer);

				this_connection->is_initialised = FALSE;
			}
		}
	}
#elif defined __unix__
if ( ( this_connection ) && ( this_connection->service_provider.guid ) )
	{

		if (1)//ö memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_SERIAL, sizeof ( GUID ) ) == TRUE )
		{

			set_direct_play_serial_address ( get_global_comms_port (), get_global_baud_rate (), get_global_stop_bits (), get_global_parity (), get_global_flow () );

			if ( direct_play_create_session ( 0 ) )
			{

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

				set_ui_object_text (serial_status_text, text_buffer);

				direct_play_close_session ();

				this_connection->is_initialised = TRUE;
			}
			else
			{

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

				set_ui_object_text (serial_status_text, text_buffer);

				this_connection->is_initialised = FALSE;
			}
		}
	}
}
コード例 #8
0
ファイル: uisession.c プロジェクト: Comanche93/eech
void compile_multi_session_list (session_list_data_type **list)
{
	#if !DEMO_VERSION

	int
		session_number = 0;

	session_table_type
		*this_session;

	connection_data_type
		*this_connection;

	char
		text [128];

	this_connection = direct_play_get_connection_data ();

	if ( ( this_connection ) && ( this_connection->is_initialised ) )
	{

		int number_of_sessions;
		int currentServer;

		// Jabberwock 040201 Session filter
		if (command_line_session_filter)
		{
			if ((strcmp(session_filter_value, "root") == 0) || (strcmp(session_filter_value, "-Multiplayer-") == 0))
			{
				add_session ("-Multiplayer-", SESSION_LIST_TYPE_FILTER, 1, NULL, "-Multiplayer-", NULL, NULL, "-Multiplayer-", list, NULL, SESSION_SEASON_INVALID);
			}
		}

		if ( !this_connection->one_way_hosting_setup )
		{

			number_of_sessions =  direct_play_enumerate_sessions ();
		}
		else
		{

			validate_modem_connection ();

			if ( this_connection->is_initialised )
			{

				number_of_sessions = direct_play_refresh_modem_session ();
			}
		}

		if ( number_of_sessions )
		{

			this_session = direct_play_get_session_table ();

			while (this_session)
			{

				//if (this_session->session->dwUser1 == get_game_type ()) // Jabberwock 031118 MP - campaigns shows in skirmishes and vice versa
				{

					if ((!command_line_session_filter) || (strcmp ("-Multiplayer-", session_filter_value) == 0)) // Jabberwock 031210 Session filter
					{
						sprintf (text, "%s", this_session->session->lpszSessionNameA);

						session_number ++;

						add_session (text, SESSION_LIST_TYPE_JOIN, session_number, this_session, NULL, NULL, NULL, "-Multiplayer-", list, NULL, SESSION_SEASON_INVALID); // Jabberwock 031210 Session filter
					}
				}

				this_session = this_session->next_session;
			}
		}

		//Werewolf 14 May 2003
		//Fetch active servers from masterserver
		net_getServerList();
		for (currentServer=0; currentServer<numServers; currentServer++)
		{
			if ((!command_line_session_filter) || (strcmp ("-Multiplayer-", session_filter_value) == 0)) // Jabberwock 031210 Session filter
			{
				sprintf (text, "%s (%i/%i) %s", Servers[currentServer].Name, Servers[currentServer].CurClients, Servers[currentServer].MaxClients, Servers[currentServer].Version);

				session_number ++;

				add_session (text, SESSION_LIST_TYPE_MASTER, session_number, NULL, NULL, NULL, NULL, "-Multiplayer-", list, Servers[currentServer].Adress, SESSION_SEASON_INVALID); // Jabberwock 031210 Session filter
			}
		}
	}

	#endif
}
コード例 #9
0
ファイル: comm_man.c プロジェクト: DexterWard/comanche
void data_exchange (void)
{

	int
		packet_data_size;

	connection_data_type
		*this_connection;

	this_connection = direct_play_get_connection_data ();

	if ((this_connection) && (this_connection->is_initialised))
	{

		#if DEBUG_MODULE >= 2

		debug_log ("COMMS MAN: Data exchange");

		#endif

		if (get_current_pack_buffer_bit_size () > 0)
		{

			transmit_entity_comms_message (ENTITY_COMMS_END, NULL);
		}

		ASSERT (!get_pack_buffer_overflow ());

		#if DEBUG_MODULE >= 2

		debug_log ("COMM_MAN: closing pack buffer line.216");

		#endif

		packet_data_size = close_pack_buffer ();

		if (packet_data_size > 0)
		{

			comms_record_data (tx_pack_buffer, packet_data_size);
		}

		#if DEBUG_MODULE >= 2

		debug_log ("COMM_MAN: opening pack buffer line.224");

		#endif

		open_pack_buffer (tx_pack_buffer, command_line_comms_pack_buffer_size);

		//
		// receive all packets waiting
		//

		receive_packets ();

		#if COMMS_STATS

		debug_comms_stats ();

		#endif

		//
		// process all data received this frame
		//

		comms_process_data ();

		//
		// send all data for this frame
		//

		comms_send_data ();

		//
		// reset the data record for next frame
		//

		comms_clear_data_record ();

		//
		// check resend list
		//

		update_resend_packet_list (command_line_comms_resend_list_size);
	}
}