From 62b75469dd3f06af109b18b6bdbff152aaaa80a3 Mon Sep 17 00:00:00 2001 From: zicodxx <> Date: Sun, 29 Nov 2009 16:46:13 +0000 Subject: [PATCH] Adding macros USE_UDP and USE_IPX for the compiler to compile with either UDP- and/or IPX-support and removed the older IPX macros --- CHANGELOG.txt | 1 + SConstruct | 69 ++++++++++++++++++-------------------- arch/carbon/conf.h | 4 +-- arch/linux/ipx.c | 9 ----- main/menu.c | 41 +++++++++++++---------- main/multi.c | 83 +++++++++++++++++++++++++++++++++++++++++++--- main/multi.h | 21 +++++++++--- main/net_udp.c | 6 ++-- 8 files changed, 155 insertions(+), 79 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1e6703aac..383247cc0 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D2X-Rebirth Changelog 20091129 -------- d1x-Info.plist, d1x-rebirth.xcodeproj/project.pbxproj, d1xgl-Info.plist, English.lproj/InfoPlist.strings: Make Mac version numbers consistent, Xcode build settings tidy up +main/net_udp.c, main/multi.c, main/multi.h, main/menu.c, SConstruct, arch/linux/ipx.c, arch/carbon/conf.h: Adding macros for the compiler to compile with either UDP- and/or IPX-support and removed the older IPX macros 20091128 -------- diff --git a/SConstruct b/SConstruct index 6275196c8..4cc4b1caa 100644 --- a/SConstruct +++ b/SConstruct @@ -32,6 +32,11 @@ arm = int(ARGUMENTS.get('arm', 0)) ipv6 = int(ARGUMENTS.get('ipv6', 0)) micro = int(ARGUMENTS.get('micro', 0)) use_svn_as_micro = int(ARGUMENTS.get('svnmicro', 0)) +use_udp = int(ARGUMENTS.get('use_udp', 1)) +use_ipx = int(ARGUMENTS.get('use_ipx', 1)) + +if (sys.platform != 'linux2') and (sys.platform != 'win32'): + use_ipx = 0 if (micro > 0): D2XMICRO = micro @@ -136,8 +141,6 @@ common_sources = [ 'main/movie.c', 'main/multi.c', 'main/multibot.c', -'main/net_ipx.c', -'main/net_udp.c', 'main/newdemo.c', 'main/newmenu.c', 'main/object.c', @@ -237,34 +240,13 @@ editor_sources = [ 'ui/window.c' ] -# for linux -arch_linux_sources = [ -'arch/linux/ipx.c', -'arch/linux/ipx_kali.c', -'arch/linux/ukali.c' -] - # SDL_mixer sound implementation arch_sdlmixer = [ 'misc/hmp2mid.c', 'arch/sdl/digi_mixer.c', 'arch/sdl/digi_mixer_music.c', 'arch/sdl/jukebox.c' -] - -if (sdlmixer == 1): - common_sources += arch_sdlmixer - -# for windows -arch_win32_sources = [ -'arch/win32/hmpfile.c', -'arch/win32/ipx.c', -] - -# for Mac OS X -arch_macosx_sources = [ -'arch/cocoa/SDLMain.m' -] +] # for opengl arch_ogl_sources = [ @@ -317,18 +299,14 @@ env.Append(CPPFLAGS = ['-Wall', '-funsigned-char']) env.Append(CPPDEFINES = [('PROGRAM_NAME', '\\"' + str(PROGRAM_NAME) + '\\"'), ('D2XMAJOR', '\\"' + str(D2XMAJOR) + '\\"'), ('D2XMINOR', '\\"' + str(D2XMINOR) + '\\"')]) #env.Append(CPPDEFINES = [('VERSION', '\\"' + str(VERSION) + '\\"')]) #env.Append(CPPDEFINES = [('USE_SDLMIXER', sdlmixer)]) -env.Append(CPPDEFINES = ['NETWORK', 'HAVE_NETIPX_IPX_H', '_REENTRANT']) +env.Append(CPPDEFINES = ['NETWORK', '_REENTRANT']) env.Append(CPPPATH = ['include', 'main', 'arch/include']) generic_libs = ['SDL', 'physfs'] sdlmixerlib = ['SDL_mixer'] -if sdlmixer: - env.Append(CPPDEFINES = ['USE_SDLMIXER']) - if (D2XMICRO): env.Append(CPPDEFINES = [('D2XMICRO', '\\"' + str(D2XMICRO) + '\\"')]) - # Get traditional compiler environment variables if os.environ.has_key('CC'): env['CC'] = os.environ['CC'] @@ -347,10 +325,12 @@ if sys.platform == 'win32': osdef = '_WIN32' osasmdef = 'win32' sharepath = '' - env.Append(CPPDEFINES = ['_WIN32', 'HAVE_STRUCT_TIMEVAL', 'NATIVE_IPX']) + env.Append(CPPDEFINES = ['_WIN32', 'HAVE_STRUCT_TIMEVAL']) env.Append(CPPPATH = ['arch/win32/include']) ogldefines = ['OGL'] - common_sources += arch_win32_sources + common_sources += ['arch/win32/hmpfile.c'] + if (use_ipx == 1): + common_sources += ['arch/win32/ipx.c'] ogllibs = '' winlibs = ['glu32', 'wsock32', 'winmm', 'mingw32', 'SDLmain'] libs = winlibs + generic_libs @@ -363,7 +343,7 @@ elif sys.platform == 'darwin': asm = 0 env.Append(CPPPATH = ['arch/linux/include']) ogldefines = ['OGL'] - common_sources += arch_macosx_sources + common_sources += 'arch/cocoa/SDLMain.m' ogllibs = '' libs = '' # Ugly way of linking to frameworks, but kreator has seen uglier @@ -385,10 +365,11 @@ else: osdef = '__LINUX__' osasmdef = 'elf' sharepath += '/' - env.Append(CPPDEFINES = ['__LINUX__', 'NATIVE_IPX', 'KALINIX', 'HAVE_STRUCT_TIMESPEC', 'HAVE_STRUCT_TIMEVAL']) + env.Append(CPPDEFINES = ['__LINUX__', 'HAVE_STRUCT_TIMESPEC', 'HAVE_STRUCT_TIMEVAL']) env.Append(CPPPATH = ['arch/linux/include']) ogldefines = ['OGL'] - common_sources += arch_linux_sources + if (use_ipx == 1): + common_sources += ['arch/linux/ipx.c', 'arch/linux/ipx_kali.c', 'arch/linux/ukali.c'] ogllibs = ['GL', 'GLU'] libs = generic_libs lflags = '-L/usr/X11R6/lib' @@ -411,10 +392,13 @@ else: common_sources += arch_ogl_sources libs += ogllibs -# SDL_mixer for sound? (*NIX only) -if (sdlmixer == 1) and (sys.platform != 'darwin'): +# SDL_mixer support? +if (sdlmixer == 1): print "including SDL_mixer" - libs += sdlmixerlib + env.Append(CPPDEFINES = ['USE_SDLMIXER']) + common_sources += arch_sdlmixer + if (sys.platform != 'darwin'): + libs += sdlmixerlib # debug? if (debug == 1): @@ -450,6 +434,16 @@ if (editor == 1): if (ipv6 == 1): env.Append(CPPDEFINES = ['IPv6']) +# UDP support? +if (use_udp == 1): + env.Append(CPPDEFINES = ['USE_UDP']) + common_sources += ['main/net_udp.c'] + +# IPX support? +if (use_ipx == 1): + env.Append(CPPDEFINES = ['USE_IPX']) + common_sources += ['main/net_ipx.c'] + print '\n' env.Append(CPPDEFINES = [('SHAREPATH', '\\"' + str(sharepath) + '\\"')]) @@ -486,6 +480,7 @@ Help(PROGRAM_NAME + ', SConstruct file help:' + 'editor=1' build editor !EXPERIMENTAL! 'arm=1' compile for ARM architecture 'ipv6=1' enables IPv6 copability + 'use_ipx=0' disable IPX support (supported only on Linux and Windows) Default values: """ + ' sharepath = ' + DATA_DIR + """ diff --git a/arch/carbon/conf.h b/arch/carbon/conf.h index 496c8c58a..97ffd196e 100644 --- a/arch/carbon/conf.h +++ b/arch/carbon/conf.h @@ -30,9 +30,6 @@ /* Define to 1 if you have the header file. */ //#define HAVE_MEMORY_H 1 -/* Define to 1 if you have the header file. */ -/* #undef HAVE_NETIPX_IPX_H */ - /* Define to 1 if you have the header file. */ //#define HAVE_STDINT_H 1 @@ -106,6 +103,7 @@ #define __unix__ /* Define if you want a network build */ # define NETWORK +# define UDP /* Define to 1 if the system has the type `struct timespec'. */ #define HAVE_STRUCT_TIMESPEC 1 diff --git a/arch/linux/ipx.c b/arch/linux/ipx.c index 4d7dcb29b..86ed126e4 100644 --- a/arch/linux/ipx.c +++ b/arch/linux/ipx.c @@ -3,16 +3,7 @@ #include #include #include - -#ifdef HAVE_NETIPX_IPX_H #include -#else -# include -# ifndef IPX_TYPE -# define IPX_TYPE 1 -# endif -#endif - #include #include #include diff --git a/main/menu.c b/main/menu.c index b6c2cb611..0303f428c 100644 --- a/main/menu.c +++ b/main/menu.c @@ -61,10 +61,12 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "gauges.h" #include "powerup.h" #include "strutil.h" -#ifdef NETWORK -# include "net_ipx.h" -# include "net_udp.h" -# include "multi.h" +#include "multi.h" +#ifdef USE_IPX +#include "net_ipx.h" +#endif +#ifdef USE_UDP +#include "net_udp.h" #endif #ifdef EDITOR #include "editor/editor.h" @@ -88,9 +90,7 @@ enum MENUS MENU_DIFFICULTY, MENU_HELP, MENU_NEW_PLAYER, - - // Only if networking is enabled... - #ifdef NETWORK + #if defined(USE_UDP) || defined (USE_IPX) MENU_MULTIPLAYER, #endif @@ -98,11 +98,12 @@ enum MENUS MENU_ORDER_INFO, MENU_PLAY_SONG, - // Only if networking is enabled... - #ifdef NETWORK + #ifdef USE_UDP MENU_START_UDP_NETGAME, MENU_JOIN_MANUAL_UDP_NETGAME, MENU_JOIN_LIST_UDP_NETGAME, + #endif + #ifdef USE_IPX MENU_START_IPX_NETGAME, MENU_JOIN_IPX_NETGAME, MENU_START_KALI_NETGAME, // xKali support (not Windows Kali! Windows Kali is over IPX!) @@ -189,7 +190,7 @@ void create_main_menu(newmenu_item *m, int *menu_choice, int *callers_num_option ADD_ITEM(TXT_NEW_GAME,MENU_NEW_GAME,KEY_N); ADD_ITEM(TXT_LOAD_GAME,MENU_LOAD_GAME,KEY_L); -#ifdef NETWORK +#if defined(USE_UDP) || defined(USE_IPX) ADD_ITEM(TXT_MULTIPLAYER_,MENU_MULTIPLAYER,-1); #endif @@ -330,7 +331,7 @@ void do_option ( int select) #endif //ifndef RELEASE -#ifdef NETWORK +#ifdef USE_UDP case MENU_START_UDP_NETGAME: multi_protocol = MULTI_PROTO_UDP; net_udp_start_game(); @@ -343,6 +344,8 @@ void do_option ( int select) multi_protocol = MULTI_PROTO_UDP; //net_udp_list_join_game(); break; +#endif +#ifdef USE_IPX case MENU_START_IPX_NETGAME: multi_protocol = MULTI_PROTO_IPX; ipxdrv_set(NETPROTO_IPX); @@ -363,10 +366,12 @@ void do_option ( int select) ipxdrv_set(NETPROTO_KALINIX); net_ipx_join_game(); break; +#endif +#if defined(USE_UDP) || defined(USE_IPX) case MENU_MULTIPLAYER: do_multi_player_menu(); break; -#endif //NETWORK +#endif case MENU_CONFIG: do_options_menu(); break; @@ -810,7 +815,7 @@ void do_misc_menu() } -#ifdef NETWORK +#if defined(USE_UDP) || defined(USE_IPX) void do_multi_player_menu() { int menu_choice[12]; @@ -822,24 +827,26 @@ void do_multi_player_menu() old_game_mode = Game_mode; num_options = 0; +#ifdef USE_UDP m[num_options].type=NM_TYPE_TEXT; m[num_options].text="UDP:"; num_options++; m[num_options].type=NM_TYPE_MENU; m[num_options].text="HOST GAME"; menu_choice[num_options]=MENU_START_UDP_NETGAME; num_options++; m[num_options].type=NM_TYPE_MENU; m[num_options].text="FIND LAN GAMES"; menu_choice[num_options]=MENU_JOIN_LIST_UDP_NETGAME; num_options++; //m[num_options].type=NM_TYPE_MENU; m[num_options].text="FIND LAN/ONLINE GAMES"; menu_choice[num_options]=MENU_JOIN_LIST_UDP_NETGAME; num_options++; m[num_options].type=NM_TYPE_MENU; m[num_options].text="JOIN GAME MANUALLY"; menu_choice[num_options]=MENU_JOIN_MANUAL_UDP_NETGAME; num_options++; +#endif -#ifdef HAVE_NETIPX_IPX_H +#ifdef USE_IPX m[num_options].type=NM_TYPE_TEXT; m[num_options].text=""; num_options++; m[num_options].type=NM_TYPE_TEXT; m[num_options].text="IPX:"; num_options++; m[num_options].type=NM_TYPE_MENU; m[num_options].text="HOST GAME"; menu_choice[num_options]=MENU_START_IPX_NETGAME; num_options++; m[num_options].type=NM_TYPE_MENU; m[num_options].text="JOIN GAME"; menu_choice[num_options]=MENU_JOIN_IPX_NETGAME; num_options++; -#endif //HAVE_NETIPX_IPX_H #ifdef __LINUX__ m[num_options].type=NM_TYPE_TEXT; m[num_options].text=""; num_options++; m[num_options].type=NM_TYPE_TEXT; m[num_options].text="XKALI:"; num_options++; m[num_options].type=NM_TYPE_MENU; m[num_options].text="HOST GAME"; menu_choice[num_options]=MENU_START_KALI_NETGAME; num_options++; m[num_options].type=NM_TYPE_MENU; m[num_options].text="JOIN GAME"; menu_choice[num_options]=MENU_JOIN_KALI_NETGAME; num_options++; -#endif // __LINUX__ +#endif +#endif choice = newmenu_do1( NULL, TXT_MULTIPLAYER, num_options, m, NULL, choice ); @@ -851,7 +858,7 @@ void do_multi_player_menu() } while( choice > -1 ); } -#endif // NETWORK +#endif void do_options_menu() { diff --git a/main/multi.c b/main/multi.c index 728cf1e4e..f7c26c8ba 100644 --- a/main/multi.c +++ b/main/multi.c @@ -26,8 +26,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "u_mem.h" #include "strutil.h" #include "game.h" -#include "net_ipx.h" -#include "net_udp.h" #include "multi.h" #include "object.h" #include "laser.h" @@ -67,6 +65,12 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "cfile.h" #include "effects.h" #include "iff.h" +#ifdef USE_IPX +#include "net_ipx.h" +#endif +#ifdef USE_UDP +#include "net_udp.h" +#endif void multi_reset_player_object(object *objp); void multi_reset_object_texture(object *objp); @@ -426,12 +430,16 @@ int multi_objnum_is_past(int objnum) { switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: return net_ipx_objnum_is_past(objnum); break; +#endif case MULTI_PROTO_UDP: +#ifdef USE_UDP return net_udp_objnum_is_past(objnum); break; +#endif default: Error("Protocol handling missing in multi_objnum_is_past\n"); break; @@ -859,12 +867,16 @@ void multi_do_protocol_frame(int force, int listen) { switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: net_ipx_do_frame(force, listen); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_do_frame(force, listen); break; +#endif default: Error("Protocol handling missing in multi_do_protocol_frame\n"); break; @@ -926,12 +938,16 @@ multi_send_data(char *buf, int len, int priority) { switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: net_ipx_send_data((unsigned char *)buf, len, priority); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_send_data((unsigned char *)buf, len, priority); break; +#endif default: Error("Protocol handling missing in multi_send_data_real\n"); break; @@ -965,12 +981,16 @@ multi_leave_game(void) { switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: net_ipx_leave_game(); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_leave_game(); break; +#endif default: Error("Protocol handling missing in multi_leave_game\n"); break; @@ -1003,12 +1023,16 @@ multi_endlevel(int *secret) switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: result = net_ipx_endlevel(secret); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: result = net_udp_endlevel(secret); break; +#endif default: Error("Protocol handling missing in multi_endlevel\n"); break; @@ -1021,12 +1045,16 @@ void multi_endlevel_poll1( int nitems, struct newmenu_item * menus, int * key, i { switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: net_ipx_kmatrix_poll1( nitems, menus, key, citem ); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_kmatrix_poll1( nitems, menus, key, citem ); break; +#endif default: Error("Protocol handling missing in multi_endlevel_poll1\n"); break; @@ -1038,11 +1066,15 @@ void multi_endlevel_poll2( int nitems, struct newmenu_item * menus, int * key, i switch (multi_protocol) { case MULTI_PROTO_IPX: +#ifdef USE_IPX net_ipx_kmatrix_poll2( nitems, menus, key, citem ); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_kmatrix_poll2( nitems, menus, key, citem ); break; +#endif default: Error("Protocol handling missing in multi_endlevel_poll2\n"); break; @@ -1053,12 +1085,16 @@ void multi_send_endlevel_packet() { switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: net_ipx_send_endlevel_packet(); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_send_endlevel_packet(); break; +#endif default: Error("Protocol handling missing in multi_send_endlevel_packet\n"); break; @@ -1259,12 +1295,15 @@ void multi_send_message_end() Network_message_reciever = 100; - if (!strnicmp (Network_message,"!Names",6)) +#ifdef USE_IPX + if (!strnicmp (Network_message,"!Names",6) && multi_protocol == MULTI_PROTO_IPX) { NameReturning=1-NameReturning; HUD_init_message ("Name returning is now %s.",NameReturning?"active":"disabled"); } - else if (!strnicmp (Network_message,"Handicap:",9)) + else +#endif + if (!strnicmp (Network_message,"Handicap:",9)) { mytempbuf=&Network_message[9]; StartingShields=atol (mytempbuf); @@ -1324,12 +1363,16 @@ void multi_send_message_end() switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: net_ipx_send_netgame_update(); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_send_netgame_update(); break; +#endif default: Error("Protocol handling missing in multi_send_message_end\n"); break; @@ -1400,12 +1443,16 @@ void multi_send_message_end() kick_player:; switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: net_ipx_dump_player(Netgame.players[i].protocol.ipx.server,Netgame.players[i].protocol.ipx.node, DUMP_KICKED); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_dump_player(Netgame.players[i].protocol.udp.addr, DUMP_KICKED); break; +#endif default: Error("Protocol handling missing in multi_send_message_end\n"); break; @@ -1957,12 +2004,16 @@ multi_do_quit(char *buf) switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: net_ipx_disconnect_player(buf[1]); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_disconnect_player(buf[1]); break; +#endif default: Error("Protocol handling missing in multi_do_quit\n"); break; @@ -2473,12 +2524,16 @@ multi_send_endlevel_start(int secret) Players[Player_num].connected = CONNECT_ESCAPE_TUNNEL; switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: net_ipx_send_endlevel_packet(); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_send_endlevel_packet(); break; +#endif default: Error("Protocol handling missing in multi_send_endlevel_start\n"); break; @@ -2961,12 +3016,16 @@ void multi_send_door_open_specific(int pnum,int segnum, int side,ubyte flag) switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: net_ipx_send_naked_packet(multibuf, 5, pnum); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_send_mdata_direct((ubyte *)multibuf, 5, pnum, 1); break; +#endif default: Error("Protocol handling missing in multi_send_door_open_specific\n"); break; @@ -3409,12 +3468,16 @@ int multi_level_sync(void) { switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: return net_ipx_level_sync(); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: return net_udp_level_sync(); break; +#endif default: Error("Protocol handling missing in multi_level_sync\n"); break; @@ -3867,13 +3930,17 @@ void multi_send_wall_status_specific (int pnum,int wallnum,ubyte type,ubyte flag switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: net_ipx_send_naked_packet(multibuf, count,pnum); // twice, just to be sure net_ipx_send_naked_packet(multibuf, count,pnum); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_send_mdata_direct((ubyte *)multibuf, count, pnum, 1); break; +#endif default: Error("Protocol handling missing in multi_send_wall_status_specific\n"); break; @@ -4037,12 +4104,16 @@ void multi_send_light_specific (int pnum,int segnum,ubyte val) switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: net_ipx_send_naked_packet(multibuf, count, pnum); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_send_mdata_direct((ubyte *)multibuf, count, pnum, 1); break; +#endif default: Error("Protocol handling missing in multi_send_light_specific\n"); break; @@ -4657,12 +4728,16 @@ void multi_send_trigger_specific (char pnum,char trig) switch (multi_protocol) { +#ifdef USE_IPX case MULTI_PROTO_IPX: net_ipx_send_naked_packet(multibuf, 2, pnum); break; +#endif +#ifdef USE_UDP case MULTI_PROTO_UDP: net_udp_send_mdata_direct((ubyte *)multibuf, 2, pnum, 1); break; +#endif default: Error("Protocol handling missing in multi_send_trigger_specific\n"); break; diff --git a/main/multi.h b/main/multi.h index 1dfbb423e..f1210b6be 100644 --- a/main/multi.h +++ b/main/multi.h @@ -25,6 +25,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "piggy.h" #include "vers_id.h" #include "newmenu.h" + +#ifdef USE_UDP #ifdef _WIN32 #include #include @@ -46,6 +48,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define _af AF_INET #define _pf PF_INET #endif +#endif // PROTOCOL VARIABLES AND DEFINES extern int multi_protocol; // set and determinate used protocol @@ -389,8 +392,10 @@ void save_hoard_data(void); */ typedef struct netplayer_info { +#if defined(USE_UDP) || defined(USE_IPX) union { +#ifdef USE_IPX struct { ubyte server[4]; @@ -398,13 +403,16 @@ typedef struct netplayer_info ushort socket; ubyte computer_type; // {DOS,WIN_32,WIN_95,MAC} } ipx; +#endif +#ifdef USE_UDP struct { struct _sockaddr addr; // IP address of this peer ubyte isyou; // This flag is set true while sending info to tell player his designated (re)join position } udp; +#endif } protocol; - +#endif char callsign[CALLSIGN_LEN+1]; ubyte version_major; ubyte version_minor; @@ -422,8 +430,10 @@ typedef struct netplayer_info */ typedef struct netgame_info { +#if defined(USE_UDP) || defined(USE_IPX) union { +#ifdef USE_IPX struct { ubyte Game_pkt_type; @@ -433,14 +443,17 @@ typedef struct netgame_info ubyte protocol_version; ubyte ShortPackets; } ipx; +#endif +#ifdef USE_UDP struct { struct _sockaddr addr; // IP address of this netgame's host int program_iver; // IVER of program for version checking sbyte valid; // Status of Netgame info: -1 = Failed, Wrong version; 0 = No info, yet; 1 = Success } udp; +#endif } protocol; - +#endif ubyte version_major; // Game content data version major ubyte version_minor; // Game content data version minor struct netplayer_info players[MAX_PLAYERS+4]; @@ -478,8 +491,6 @@ typedef struct netgame_info int player_score[MAX_PLAYERS]; ubyte player_flags[MAX_PLAYERS]; short PacketsPerSec; - ubyte PacketLossPrevention; // FIXME: IMPLEMENT ME! + ubyte PacketLossPrevention; } __pack__ netgame_info; - - #endif /* _MULTI_H */ diff --git a/main/net_udp.c b/main/net_udp.c index d50a83c1d..19b5bc755 100644 --- a/main/net_udp.c +++ b/main/net_udp.c @@ -4676,8 +4676,7 @@ void net_udp_show_game_rules() gr_printf( FSPACX( 25),FSPACY( 35), "Reactor Life:"); gr_printf( FSPACX( 25),FSPACY( 41), "Max Time:"); gr_printf( FSPACX( 25),FSPACY( 47), "Kill Goal:"); - gr_printf( FSPACX( 25),FSPACY( 53), "Short Packets:"); - gr_printf( FSPACX( 25),FSPACY( 59), "Pakets per second:"); + gr_printf( FSPACX( 25),FSPACY( 53), "Pakets per second:"); gr_printf( FSPACX(155),FSPACY( 35), "Invul when reappearing:"); gr_printf( FSPACX(155),FSPACY( 41), "Marker camera views:"); gr_printf( FSPACX(155),FSPACY( 47), "Indestructible lights:"); @@ -4716,8 +4715,7 @@ void net_udp_show_game_rules() gr_printf( FSPACX(115),FSPACY( 35), "%i Min", Netgame.control_invul_time/F1_0/60); gr_printf( FSPACX(115),FSPACY( 41), "%i Min", Netgame.PlayTimeAllowed*5); gr_printf( FSPACX(115),FSPACY( 47), "%i", Netgame.KillGoal); - gr_printf( FSPACX(115),FSPACY( 53), "%s", Netgame.protocol.ipx.ShortPackets?"ON":"OFF"); - gr_printf( FSPACX(115),FSPACY( 59), "%i", Netgame.PacketsPerSec); + gr_printf( FSPACX(115),FSPACY( 53), "%i", Netgame.PacketsPerSec); gr_printf( FSPACX(275),FSPACY( 35), Netgame.InvulAppear?"ON":"OFF"); gr_printf( FSPACX(275),FSPACY( 41), Netgame.Allow_marker_view?"ON":"OFF"); gr_printf( FSPACX(275),FSPACY( 47), Netgame.AlwaysLighting?"ON":"OFF");