Host can now decide (again) if players are allowed to display enemy names on HUD

This commit is contained in:
zicodxx 2011-05-05 00:16:35 +02:00
parent 5f5b5b415f
commit f2fb5c462a
6 changed files with 36 additions and 20 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20110505
--------
main/gauges.c, main/multi.h, 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

View file

@ -2299,7 +2299,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)));

View file

@ -401,7 +401,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;
@ -409,9 +409,9 @@ typedef struct netgame_info
#endif
} protocol;
#endif
ubyte version_major; // Game content data version major (unused in D1)
ubyte version_major; // Game content data version major (unused in D1)
ubyte version_minor; // Game content data version minor (unused in D1)
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];
@ -428,21 +428,22 @@ typedef struct netgame_info
u_int32_t AllowedItems;
short Allow_marker_view; // (unused in D1 - no markers in game)
short AlwaysLighting; // (unused in D1 - cannot destroy lights after all)
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;

View file

@ -2171,6 +2171,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);
@ -2344,6 +2345,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);
@ -2772,7 +2774,7 @@ int net_udp_start_poll( newmenu *menu, d_event *event, void *userdata )
}
static int opt_cinvul, opt_show_on_map;
static int opt_show_on_map, opt_difficulty, opt_setpower, opt_playtime, opt_killgoal, opt_port, opt_packets, opt_plp, opt_bright, opt_start_invul, opt_ffire;
static int opt_show_on_map, opt_difficulty, opt_setpower, opt_playtime, opt_killgoal, opt_port, opt_packets, opt_show_names, opt_plp, opt_bright, opt_start_invul, opt_ffire;
#ifdef USE_TRACKER
static int opt_tracker;
#endif
@ -2802,9 +2804,9 @@ void net_udp_more_game_options ()
int opt=0,i=0;
char PlayText[80],KillText[80],srinvul[50],packstring[5];
#ifdef USE_TRACKER
newmenu_item m[15];
newmenu_item m[16];
#else
newmenu_item m[14];
newmenu_item m[15];
#endif
snprintf(packstring,sizeof(char)*4,"%d",Netgame.PacketsPerSec);
@ -2833,6 +2835,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_ffire=opt;
m[opt].type = NM_TYPE_CHECK; m[opt].text = "No friendly fire (Team, Coop)"; m[opt].value=Netgame.NoFriendlyFire; opt++;
@ -2886,6 +2891,7 @@ menu:
Netgame.InvulAppear=m[opt_start_invul].value;
Netgame.BrightPlayers=m[opt_bright].value;
Netgame.ShowEnemyNames=m[opt_show_names].value;
Netgame.difficulty=Difficulty_level = m[opt_difficulty].value;
if (m[opt_show_on_map].value)
Netgame.game_flags |= NETGAME_FLAG_SHOW_MAP;
@ -4909,7 +4915,8 @@ static int show_game_rules_handler(window *wind, d_event *event, netgame_info *n
gr_printf( FSPACX(155),FSPACY( 55), "Show Players On Automap:");
gr_printf( FSPACX(155),FSPACY( 61), "Invul when reappearing:");
gr_printf( FSPACX(155),FSPACY( 67), "Bright player ships:");
gr_printf( FSPACX(155),FSPACY( 73), "No friendly Fire:");
gr_printf( FSPACX(155),FSPACY( 73), "Show enemy names on hud:");
gr_printf( FSPACX(155),FSPACY( 79), "No friendly Fire:");
gr_printf( FSPACX( 25),FSPACY(100), "Allowed Objects");
gr_printf( FSPACX( 25),FSPACY(110), "Laser Upgrade:");
@ -4930,10 +4937,11 @@ static int show_game_rules_handler(window *wind, d_event *event, netgame_info *n
gr_printf( FSPACX(115),FSPACY( 61), "%i Min", netgame->PlayTimeAllowed*5);
gr_printf( FSPACX(115),FSPACY( 67), "%i", netgame->KillGoal*5);
gr_printf( FSPACX(115),FSPACY( 73), "%i", netgame->PacketsPerSec);
gr_printf( FSPACX(275),FSPACY( 55), netgame->game_flags&NETGAME_FLAG_SHOW_MAP?"ON":"OFF");
gr_printf( FSPACX(275),FSPACY( 61), netgame->InvulAppear?"ON":"OFF");
gr_printf( FSPACX(275),FSPACY( 67), netgame->BrightPlayers?"ON":"OFF");
gr_printf( FSPACX(275),FSPACY( 73), netgame->NoFriendlyFire?"ON":"OFF");
gr_printf( FSPACX(275),FSPACY( 55), netgame->ShowEnemyNames?"ON":"OFF");
gr_printf( FSPACX(275),FSPACY( 61), netgame->game_flags&NETGAME_FLAG_SHOW_MAP?"ON":"OFF");
gr_printf( FSPACX(275),FSPACY( 67), netgame->InvulAppear?"ON":"OFF");
gr_printf( FSPACX(275),FSPACY( 73), netgame->BrightPlayers?"ON":"OFF");
gr_printf( FSPACX(275),FSPACY( 79), netgame->NoFriendlyFire?"ON":"OFF");
gr_printf( FSPACX(130),FSPACY(110), netgame->AllowedItems&NETFLAG_DOLASER?"YES":"NO");

View file

@ -41,7 +41,7 @@ int net_udp_level_sync();
#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 529
#define UPID_GAME_INFO_SIZE 531
#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 69

View file

@ -1020,6 +1020,8 @@ void read_netgame_profile(netgame_info *ng)
ng->game_flags = strtol(value, NULL, 10);
else if (!strcmp(token, "AllowedItems"))
ng->AllowedItems = 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"))
@ -1065,6 +1067,7 @@ void write_netgame_profile(netgame_info *ng)
PHYSFSX_printf(file, "difficulty=%i\n", ng->difficulty);
PHYSFSX_printf(file, "game_flags=%i\n", ng->game_flags);
PHYSFSX_printf(file, "AllowedItems=%i\n", ng->AllowedItems);
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);