diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 330498c1b..c3cbf8be6 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D2X-Rebirth Changelog +20110505 +-------- +main/gauges.c, main/multi.h, main/net_ipx.c, main/net_udp.c, main/net_udp.h, main/playsave.c: Host can now decide (again) if players are allowed to display enemy names on HUD + 20110504 -------- editor/segment.c, main/fvi.c, main/gameseg.c, main/physics.c, main/segment.h: Since current approach to improve wall collisions prevented the player to enter segments which basically are too small for the player ship, added simple bumping function via object_intersects_wall(); Also when validating segments check for segment degeneration outside the editor build, too and set flag in segment structure for all different purposes but right now helps us to disable bumping when encountering degenerated segments and not break such levels diff --git a/main/gauges.c b/main/gauges.c index e4bf9fc19..2efb7fb93 100644 --- a/main/gauges.c +++ b/main/gauges.c @@ -2598,7 +2598,7 @@ void show_HUD_names() // ridiculusly complex to check if we want to show something... but this is readable at least. is_friend = (Game_mode & GM_MULTI_COOP || (Game_mode & GM_TEAM && get_team(pnum) == get_team(Player_num))); show_friend_name = Show_reticle_name; - show_enemy_name = Show_reticle_name && !(Players[pnum].flags & PLAYER_FLAGS_CLOAKED); + show_enemy_name = Show_reticle_name && Netgame.ShowEnemyNames && !(Players[pnum].flags & PLAYER_FLAGS_CLOAKED); show_name = ((is_friend && show_friend_name) || (!is_friend && show_enemy_name)); show_typing = is_friend || !(Players[pnum].flags & PLAYER_FLAGS_CLOAKED); show_indi = (((Game_mode & ( GM_CAPTURE | GM_HOARD ) && Players[pnum].flags & PLAYER_FLAGS_FLAG) || (Game_mode & GM_BOUNTY && pnum == Bounty_target)) && (is_friend || !(Players[pnum].flags & PLAYER_FLAGS_CLOAKED))); diff --git a/main/multi.h b/main/multi.h index 99b85be3a..1cd8e4094 100644 --- a/main/multi.h +++ b/main/multi.h @@ -457,7 +457,7 @@ typedef struct netgame_info ubyte Game_pkt_type; int Game_Security; ubyte Player_pkt_type; - int Player_Security; + int Player_Security; ubyte protocol_version; ubyte ShortPackets; } ipx; @@ -465,7 +465,7 @@ typedef struct netgame_info #ifdef USE_UDP struct { - struct _sockaddr addr; // IP address of this netgame's host + struct _sockaddr addr; // IP address of this netgame's host short program_iver[3]; // IVER of program for version checking sbyte valid; // Status of Netgame info: -1 = Failed, Wrong version; 0 = No info, yet; 1 = Success fix GameID; @@ -473,9 +473,9 @@ typedef struct netgame_info #endif } protocol; #endif - ubyte version_major; // Game content data version major + ubyte version_major; // Game content data version major ubyte version_minor; // Game content data version minor - struct netplayer_info players[MAX_PLAYERS+4]; + struct netplayer_info players[MAX_PLAYERS+4]; char game_name[NETGAME_NAME_LEN+1]; char mission_title[MISSION_NAME_LEN+1]; char mission_name[9]; @@ -492,21 +492,22 @@ typedef struct netgame_info u_int32_t AllowedItems; short Allow_marker_view; short AlwaysLighting; + short ShowEnemyNames; short BrightPlayers; short InvulAppear; char team_name[2][CALLSIGN_LEN+1]; - int locations[MAX_PLAYERS]; + int locations[MAX_PLAYERS]; short kills[MAX_PLAYERS][MAX_PLAYERS]; ushort segments_checksum; short team_kills[2]; short killed[MAX_PLAYERS]; short player_kills[MAX_PLAYERS]; - int KillGoal; - fix PlayTimeAllowed; - fix level_time; - int control_invul_time; - int monitor_vector; - int player_score[MAX_PLAYERS]; + int KillGoal; + fix PlayTimeAllowed; + fix level_time; + int control_invul_time; + int monitor_vector; + int player_score[MAX_PLAYERS]; ubyte player_flags[MAX_PLAYERS]; short PacketsPerSec; ubyte PacketLossPrevention; diff --git a/main/net_ipx.c b/main/net_ipx.c index 22ce2e408..aa26dac8f 100644 --- a/main/net_ipx.c +++ b/main/net_ipx.c @@ -600,7 +600,7 @@ void send_netgame_packet(ubyte *server, ubyte *node, ubyte *net_address, int lit netpkt.DoHoming = (Netgame.AllowedItems & NETFLAG_DOHOMING); netpkt.DoLaserUpgrade = (Netgame.AllowedItems & NETFLAG_DOLASER); netpkt.DoQuadLasers = (Netgame.AllowedItems & NETFLAG_DOQUAD); - netpkt.ShowAllNames = 1; // Was ShowAllNames - always allow, don't patronize me. :P + netpkt.ShowAllNames = Netgame.ShowEnemyNames; netpkt.BrightPlayers = Netgame.BrightPlayers; netpkt.invul = Netgame.InvulAppear; memcpy(&netpkt.team_name, &Netgame.team_name, 2*(CALLSIGN_LEN+1)); @@ -670,7 +670,6 @@ void receive_netgame_packet(ubyte *data, netgame_info *netgame, int lite_flag) { IPX_netgame_info netpkt; int i, j; - short showallnamesdummy; memcpy(&netpkt, data, sizeof(IPX_netgame_info)); @@ -721,7 +720,7 @@ void receive_netgame_packet(ubyte *data, netgame_info *netgame, int lite_flag) if (netpkt.DoQuadLasers) netgame->AllowedItems |= NETFLAG_DOQUAD; netgame->Allow_marker_view = netpkt.Allow_marker_view; netgame->AlwaysLighting = netpkt.AlwaysLighting; - showallnamesdummy = netpkt.ShowAllNames;// we ignore that, don't patronize me. :P + netgame->ShowEnemyNames = netpkt.ShowAllNames; netgame->BrightPlayers = netpkt.BrightPlayers; netgame->InvulAppear = netpkt.invul; memcpy(netgame->team_name, &netpkt.team_name, 2*(CALLSIGN_LEN+1)); @@ -2817,7 +2816,7 @@ int net_ipx_start_poll( newmenu *menu, d_event *event, void *userdata ) static int opt_cinvul, opt_show_on_map; static int opt_setpower,opt_playtime,opt_killgoal,opt_marker_view,opt_light; -static int opt_difficulty,opt_packets, opt_bright,opt_start_invul, opt_short_packets, opt_socket; +static int opt_difficulty,opt_packets, opt_bright,opt_start_invul, opt_show_names, opt_short_packets, opt_socket; typedef struct param_opt { @@ -4894,7 +4893,7 @@ void net_ipx_more_game_options () { int opt=0,i; char PlayText[80],KillText[80],srinvul[50],packstring[5],socket_string[5]; - newmenu_item m[20]; + newmenu_item m[21]; sprintf (socket_string,"%d",IPX_Socket); sprintf (packstring,"%d",Netgame.PacketsPerSec); @@ -4925,6 +4924,9 @@ void net_ipx_more_game_options () opt_bright = opt; m[opt].type = NM_TYPE_CHECK; m[opt].text = "Bright player ships"; m[opt].value=Netgame.BrightPlayers; opt++; + opt_show_names=opt; + m[opt].type = NM_TYPE_CHECK; m[opt].text = "Show enemy names on HUD"; m[opt].value=Netgame.ShowEnemyNames; opt++; + opt_show_on_map=opt; m[opt].type = NM_TYPE_CHECK; m[opt].text = TXT_SHOW_ON_MAP; m[opt].value=(Netgame.game_flags & NETGAME_FLAG_SHOW_MAP); opt_show_on_map=opt; opt++; @@ -4976,7 +4978,7 @@ menu: Netgame.InvulAppear=m[opt_start_invul].value; Netgame.BrightPlayers=m[opt_bright].value; Netgame.protocol.ipx.ShortPackets=m[opt_short_packets].value; - + Netgame.ShowEnemyNames=m[opt_show_names].value; Netgame.Allow_marker_view=m[opt_marker_view].value; Netgame.AlwaysLighting=m[opt_light].value; Netgame.difficulty=Difficulty_level = m[opt_difficulty].value; @@ -5488,7 +5490,8 @@ static int show_game_rules_handler(window *wind, d_event *event, netgame_info *n gr_printf( FSPACX(155),FSPACY( 41), "Marker camera views:"); gr_printf( FSPACX(155),FSPACY( 47), "Indestructible lights:"); gr_printf( FSPACX(155),FSPACY( 53), "Bright player ships:"); - gr_printf( FSPACX(155),FSPACY( 59), "Show players on automap:"); + gr_printf( FSPACX(155),FSPACY( 59), "Show enemy names on hud:"); + gr_printf( FSPACX(155),FSPACY( 65), "Show players on automap:"); gr_printf( FSPACX( 25),FSPACY( 80), "Allowed Objects"); gr_printf( FSPACX( 25),FSPACY( 90), "Laser Upgrade:"); gr_printf( FSPACX( 25),FSPACY( 96), "Super Laser:"); @@ -5527,7 +5530,8 @@ static int show_game_rules_handler(window *wind, d_event *event, netgame_info *n gr_printf( FSPACX(275),FSPACY( 41), netgame->Allow_marker_view?"ON":"OFF"); gr_printf( FSPACX(275),FSPACY( 47), netgame->AlwaysLighting?"ON":"OFF"); gr_printf( FSPACX(275),FSPACY( 53), netgame->BrightPlayers?"ON":"OFF"); - gr_printf( FSPACX(275),FSPACY( 59), netgame->game_flags & NETGAME_FLAG_SHOW_MAP?"ON":"OFF"); + gr_printf( FSPACX(275),FSPACY( 59), netgame->ShowEnemyNames?"ON":"OFF"); + gr_printf( FSPACX(275),FSPACY( 65), netgame->game_flags & NETGAME_FLAG_SHOW_MAP?"ON":"OFF"); gr_printf( FSPACX(130),FSPACY( 90), netgame->AllowedItems & NETFLAG_DOLASER?"YES":"NO"); gr_printf( FSPACX(130),FSPACY( 96), netgame->AllowedItems & NETFLAG_DOSUPERLASER?"YES":"NO"); gr_printf( FSPACX(130),FSPACY(102), netgame->AllowedItems & NETFLAG_DOQUAD?"YES":"NO"); diff --git a/main/net_udp.c b/main/net_udp.c index f4a84f9bd..07b57fd89 100644 --- a/main/net_udp.c +++ b/main/net_udp.c @@ -2295,6 +2295,7 @@ void net_udp_send_game_info(struct _sockaddr sender_addr, ubyte info_upid) PUT_INTEL_INT(buf + len, Netgame.AllowedItems); len += 4; PUT_INTEL_SHORT(buf + len, Netgame.Allow_marker_view); len += 2; PUT_INTEL_SHORT(buf + len, Netgame.AlwaysLighting); len += 2; + PUT_INTEL_SHORT(buf + len, Netgame.ShowEnemyNames); len += 2; PUT_INTEL_SHORT(buf + len, Netgame.BrightPlayers); len += 2; PUT_INTEL_SHORT(buf + len, Netgame.InvulAppear); len += 2; memcpy(&buf[len], Netgame.team_name, 2*(CALLSIGN_LEN+1)); len += 2*(CALLSIGN_LEN+1); @@ -2486,6 +2487,7 @@ void net_udp_process_game_info(ubyte *data, int data_len, struct _sockaddr game_ Netgame.AllowedItems = GET_INTEL_INT(&(data[len])); len += 4; Netgame.Allow_marker_view = GET_INTEL_SHORT(&(data[len])); len += 2; Netgame.AlwaysLighting = GET_INTEL_SHORT(&(data[len])); len += 2; + Netgame.ShowEnemyNames = GET_INTEL_SHORT(&(data[len])); len += 2; Netgame.BrightPlayers = GET_INTEL_SHORT(&(data[len])); len += 2; Netgame.InvulAppear = GET_INTEL_SHORT(&(data[len])); len += 2; memcpy(Netgame.team_name, &(data[len]), 2*(CALLSIGN_LEN+1)); len += 2*(CALLSIGN_LEN+1); @@ -2925,7 +2927,7 @@ int net_udp_start_poll( newmenu *menu, d_event *event, void *userdata ) static int opt_cinvul, opt_show_on_map; static int opt_setpower,opt_playtime,opt_killgoal,opt_port,opt_marker_view,opt_light; -static int opt_difficulty,opt_packets, opt_bright,opt_start_invul, opt_plp, opt_ffire; +static int opt_difficulty,opt_packets, opt_bright,opt_start_invul, opt_show_names, opt_plp, opt_ffire; #ifdef USE_TRACKER static int opt_tracker; @@ -2957,9 +2959,9 @@ void net_udp_more_game_options () char PlayText[80],KillText[80],srinvul[50],packstring[5]; #ifdef USE_TRACKER - newmenu_item m[17]; + newmenu_item m[18]; #else - newmenu_item m[16]; + newmenu_item m[17]; #endif snprintf(packstring,sizeof(char)*4,"%d",Netgame.PacketsPerSec); @@ -2989,6 +2991,9 @@ void net_udp_more_game_options () opt_bright = opt; m[opt].type = NM_TYPE_CHECK; m[opt].text = "Bright player ships"; m[opt].value=Netgame.BrightPlayers; opt++; + + opt_show_names=opt; + m[opt].type = NM_TYPE_CHECK; m[opt].text = "Show enemy names on HUD"; m[opt].value=Netgame.ShowEnemyNames; opt++; opt_show_on_map=opt; m[opt].type = NM_TYPE_CHECK; m[opt].text = TXT_SHOW_ON_MAP; m[opt].value=(Netgame.game_flags & NETGAME_FLAG_SHOW_MAP); opt_show_on_map=opt; opt++; @@ -3047,7 +3052,7 @@ menu: Netgame.InvulAppear=m[opt_start_invul].value; Netgame.BrightPlayers=m[opt_bright].value; - + Netgame.ShowEnemyNames=m[opt_show_names].value; Netgame.Allow_marker_view=m[opt_marker_view].value; Netgame.AlwaysLighting=m[opt_light].value; Netgame.difficulty=Difficulty_level = m[opt_difficulty].value; @@ -5219,8 +5224,9 @@ static int show_game_rules_handler(window *wind, d_event *event, netgame_info *n gr_printf( FSPACX(155),FSPACY( 41), "Marker camera views:"); gr_printf( FSPACX(155),FSPACY( 47), "Indestructible lights:"); gr_printf( FSPACX(155),FSPACY( 53), "Bright player ships:"); - gr_printf( FSPACX(155),FSPACY( 59), "Show players on automap:"); - gr_printf( FSPACX(155),FSPACY( 65), "No friendly Fire:"); + gr_printf( FSPACX(155),FSPACY( 59), "Show enemy names on hud:"); + gr_printf( FSPACX(155),FSPACY( 65), "Show players on automap:"); + gr_printf( FSPACX(155),FSPACY( 71), "No friendly Fire:"); gr_printf( FSPACX( 25),FSPACY( 80), "Allowed Objects"); gr_printf( FSPACX( 25),FSPACY( 90), "Laser Upgrade:"); gr_printf( FSPACX( 25),FSPACY( 96), "Super Laser:"); @@ -5258,8 +5264,9 @@ static int show_game_rules_handler(window *wind, d_event *event, netgame_info *n gr_printf( FSPACX(275),FSPACY( 41), netgame->Allow_marker_view?"ON":"OFF"); gr_printf( FSPACX(275),FSPACY( 47), netgame->AlwaysLighting?"ON":"OFF"); gr_printf( FSPACX(275),FSPACY( 53), netgame->BrightPlayers?"ON":"OFF"); - gr_printf( FSPACX(275),FSPACY( 59), netgame->game_flags & NETGAME_FLAG_SHOW_MAP?"ON":"OFF"); - gr_printf( FSPACX(275),FSPACY( 65), netgame->NoFriendlyFire?"ON":"OFF"); + gr_printf( FSPACX(275),FSPACY( 59), netgame->ShowEnemyNames?"ON":"OFF"); + gr_printf( FSPACX(275),FSPACY( 65), netgame->game_flags & NETGAME_FLAG_SHOW_MAP?"ON":"OFF"); + gr_printf( FSPACX(275),FSPACY( 71), netgame->NoFriendlyFire?"ON":"OFF"); gr_printf( FSPACX(130),FSPACY( 90), netgame->AllowedItems & NETFLAG_DOLASER?"YES":"NO"); gr_printf( FSPACX(130),FSPACY( 96), netgame->AllowedItems & NETFLAG_DOSUPERLASER?"YES":"NO"); gr_printf( FSPACX(130),FSPACY(102), netgame->AllowedItems & NETFLAG_DOQUAD?"YES":"NO"); diff --git a/main/net_udp.h b/main/net_udp.h index 9f9e0e642..76c1355fc 100644 --- a/main/net_udp.h +++ b/main/net_udp.h @@ -43,7 +43,7 @@ void net_udp_send_netgame_update(); #define UPID_GAME_INFO_REQ 2 // Requesting all info about a netgame. #define UPID_GAME_INFO_REQ_SIZE 11 #define UPID_GAME_INFO 3 // Packet containing all info about a netgame. -#define UPID_GAME_INFO_SIZE 533 +#define UPID_GAME_INFO_SIZE 535 #define UPID_GAME_INFO_LITE_REQ 4 // Requesting lite info about a netgame. Used for discovering games. #define UPID_GAME_INFO_LITE 5 // Packet containing lite netgame info. #define UPID_GAME_INFO_LITE_SIZE 73 diff --git a/main/playsave.c b/main/playsave.c index f8c1f76f0..bbf253f35 100644 --- a/main/playsave.c +++ b/main/playsave.c @@ -894,6 +894,8 @@ void read_netgame_profile(netgame_info *ng) ng->Allow_marker_view = strtol(value, NULL, 10); else if (!strcmp(token, "AlwaysLighting")) ng->AlwaysLighting = strtol(value, NULL, 10); + else if (!strcmp(token, "ShowEnemyNames")) + ng->ShowEnemyNames = strtol(value, NULL, 10); else if (!strcmp(token, "BrightPlayers")) ng->BrightPlayers = strtol(value, NULL, 10); else if (!strcmp(token, "InvulAppear")) @@ -941,6 +943,7 @@ void write_netgame_profile(netgame_info *ng) PHYSFSX_printf(file, "AllowedItems=%i\n", ng->AllowedItems); PHYSFSX_printf(file, "Allow_marker_view=%i\n", ng->Allow_marker_view); PHYSFSX_printf(file, "AlwaysLighting=%i\n", ng->AlwaysLighting); + PHYSFSX_printf(file, "ShowEnemyNames=%i\n", ng->ShowEnemyNames); PHYSFSX_printf(file, "BrightPlayers=%i\n", ng->BrightPlayers); PHYSFSX_printf(file, "InvulAppear=%i\n", ng->InvulAppear); PHYSFSX_printf(file, "KillGoal=%i\n", ng->KillGoal);