From 75af2aa90c90a71a18601e19e44402bfdb43deef Mon Sep 17 00:00:00 2001 From: zicodxx Date: Sat, 28 May 2011 12:07:36 +0200 Subject: [PATCH] Made netgame setup menu more flexible towards (constant or temporary) changes in available game modes --- CHANGELOG.txt | 4 ++++ main/net_ipx.c | 37 +++++++++++++++++++------------------ main/net_udp.c | 41 +++++++++++++++++++++-------------------- 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c1dbf587c..56751f533 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D1X-Rebirth Changelog +20110528 +-------- +main/net_ipx.c, main/net_udp.c: Made netgame setup menu more flexible towards (constant or temporary) changes in available game modes + 20110526 -------- arch/sdl/event.c: In event_process() if a window closes while being drawn and there isn't a previous window we can get the next from just finish processing for this frame diff --git a/main/net_ipx.c b/main/net_ipx.c index 3037256ad..78ce3edcf 100644 --- a/main/net_ipx.c +++ b/main/net_ipx.c @@ -2188,8 +2188,8 @@ static int opt_show_on_map, opt_difficulty, opt_socket; typedef struct param_opt { - int start_game, name, level, mode, moreopts; - int closed, refuse, maxnet, coop, team_anarchy; + int start_game, name, level, mode, mode_end, moreopts; + int closed, refuse, maxnet, anarchy, team_anarchy, robot_anarchy, coop; } param_opt; int net_ipx_start_game(void); @@ -2267,24 +2267,25 @@ int net_ipx_game_param_handler( newmenu *menu, d_event *event, param_opt *opt ) Netgame.max_numplayers=MaxNumNetPlayers; } - if ((citem >= opt->mode) && (citem <= opt->mode + 3)) + if ((citem >= opt->mode) && (citem <= opt->mode_end)) { - if ( menus[opt->mode].value ) + if ( menus[opt->anarchy].value ) Netgame.gamemode = NETGAME_ANARCHY; - else if (menus[opt->mode+1].value) { + else if (menus[opt->team_anarchy].value) { Netgame.gamemode = NETGAME_TEAM_ANARCHY; } - // else if (ANARCHY_ONLY_MISSION) { - // nm_messagebox(NULL, 1, TXT_OK, TXT_ANARCHY_ONLY_MISSION); - // menus[opt->mode+2].value = 0; - // menus[opt->mode+3].value = 0; - // menus[opt->mode].value = 1; - // goto menu; - // } - else if ( menus[opt->mode+2].value ) +// else if (ANARCHY_ONLY_MISSION) { +// int i = 0; +// nm_messagebox(NULL, 1, TXT_OK, TXT_ANARCHY_ONLY_MISSION); +// for (i = opt->mode; i <= opt->mode_end; i++) +// menus[i].value = 0; +// menus[opt->anarchy].value = 1; +// return 0; +// } + else if ( menus[opt->robot_anarchy].value ) Netgame.gamemode = NETGAME_ROBOT_ANARCHY; - else if ( menus[opt->mode+3].value ) + else if ( menus[opt->coop].value ) Netgame.gamemode = NETGAME_COOPERATIVE; else Int3(); // Invalid mode -- see Rob } @@ -2307,7 +2308,7 @@ int net_ipx_game_param_handler( newmenu *menu, d_event *event, param_opt *opt ) if (citem==opt->moreopts) { - if ( menus[opt->mode+3].value ) + if ( menus[opt->coop].value ) Game_mode=GM_MULTI_COOP; net_ipx_more_game_options(); Game_mode=0; @@ -2391,10 +2392,10 @@ int net_ipx_setup_game() m[optnum].type = NM_TYPE_TEXT; m[optnum].text = TXT_OPTIONS; optnum++; opt.mode = optnum; - m[optnum].type = NM_TYPE_RADIO; m[optnum].text = TXT_ANARCHY; m[optnum].value=(Netgame.gamemode == NETGAME_ANARCHY); m[optnum].group=0; optnum++; + m[optnum].type = NM_TYPE_RADIO; m[optnum].text = TXT_ANARCHY; m[optnum].value=(Netgame.gamemode == NETGAME_ANARCHY); m[optnum].group=0; opt.anarchy=optnum; optnum++; m[optnum].type = NM_TYPE_RADIO; m[optnum].text = TXT_TEAM_ANARCHY; m[optnum].value=(Netgame.gamemode == NETGAME_TEAM_ANARCHY); m[optnum].group=0; opt.team_anarchy=optnum; optnum++; - m[optnum].type = NM_TYPE_RADIO; m[optnum].text = TXT_ANARCHY_W_ROBOTS; m[optnum].value=(Netgame.gamemode == NETGAME_ROBOT_ANARCHY); m[optnum].group=0; optnum++; - m[optnum].type = NM_TYPE_RADIO; m[optnum].text = TXT_COOPERATIVE; m[optnum].value=(Netgame.gamemode == NETGAME_COOPERATIVE); m[optnum].group=0; opt.coop=optnum; optnum++; + m[optnum].type = NM_TYPE_RADIO; m[optnum].text = TXT_ANARCHY_W_ROBOTS; m[optnum].value=(Netgame.gamemode == NETGAME_ROBOT_ANARCHY); m[optnum].group=0; opt.robot_anarchy=optnum; optnum++; + m[optnum].type = NM_TYPE_RADIO; m[optnum].text = TXT_COOPERATIVE; m[optnum].value=(Netgame.gamemode == NETGAME_COOPERATIVE); m[optnum].group=0; opt.mode_end=opt.coop=optnum; optnum++; m[optnum].type = NM_TYPE_TEXT; m[optnum].text = ""; optnum++; diff --git a/main/net_udp.c b/main/net_udp.c index a2bf02eab..3a868f74e 100644 --- a/main/net_udp.c +++ b/main/net_udp.c @@ -2949,8 +2949,8 @@ int net_udp_more_options_handler( newmenu *menu, d_event *event, void *userdata typedef struct param_opt { - int start_game, name, level, mode, moreopts; - int closed, refuse, maxnet, coop, team_anarchy; + int start_game, name, level, mode, mode_end, moreopts; + int closed, refuse, maxnet, anarchy, team_anarchy, robot_anarchy, coop, bounty; } param_opt; int net_udp_start_game(void); @@ -3034,26 +3034,27 @@ int net_udp_game_param_handler( newmenu *menu, d_event *event, param_opt *opt ) Netgame.max_numplayers=MaxNumNetPlayers; } - if ((citem >= opt->mode) && (citem <= opt->mode + 4)) + if ((citem >= opt->mode) && (citem <= opt->mode_end)) { - if ( menus[opt->mode].value ) + if ( menus[opt->anarchy].value ) Netgame.gamemode = NETGAME_ANARCHY; - else if (menus[opt->mode+1].value) { + else if (menus[opt->team_anarchy].value) { Netgame.gamemode = NETGAME_TEAM_ANARCHY; } - // else if (ANARCHY_ONLY_MISSION) { - // nm_messagebox(NULL, 1, TXT_OK, TXT_ANARCHY_ONLY_MISSION); - // menus[opt->mode+2].value = 0; - // menus[opt->mode+3].value = 0; - // menus[opt->mode].value = 1; - // goto menu; - // } - else if ( menus[opt->mode+2].value ) +// else if (ANARCHY_ONLY_MISSION) { +// int i = 0; +// nm_messagebox(NULL, 1, TXT_OK, TXT_ANARCHY_ONLY_MISSION); +// for (i = opt->mode; i <= opt->mode_end; i++) +// menus[i].value = 0; +// menus[opt->anarchy].value = 1; +// return 0; +// } + else if ( menus[opt->robot_anarchy].value ) Netgame.gamemode = NETGAME_ROBOT_ANARCHY; - else if ( menus[opt->mode+3].value ) + else if ( menus[opt->coop].value ) Netgame.gamemode = NETGAME_COOPERATIVE; - else if ( menus[opt->mode+4].value ) + else if ( menus[opt->bounty].value ) Netgame.gamemode = NETGAME_BOUNTY; else Int3(); // Invalid mode -- see Rob } @@ -3076,7 +3077,7 @@ int net_udp_game_param_handler( newmenu *menu, d_event *event, param_opt *opt ) if (citem==opt->moreopts) { - if ( menus[opt->mode+3].value ) + if ( menus[opt->coop].value ) Game_mode=GM_MULTI_COOP; net_udp_more_game_options(); Game_mode=0; @@ -3134,7 +3135,7 @@ int net_udp_setup_game() read_netgame_profile(&Netgame); - if (Netgame.gamemode == NETGAME_COOPERATIVE) // did we resotred Coop as default? then fix max players right now! + if (Netgame.gamemode == NETGAME_COOPERATIVE) // did we restore Coop as default? then fix max players right now! Netgame.max_numplayers = MaxNumNetPlayers = 4; strcpy(Netgame.mission_name, Current_mission_filename); @@ -3165,11 +3166,11 @@ int net_udp_setup_game() m[optnum].type = NM_TYPE_TEXT; m[optnum].text = TXT_OPTIONS; optnum++; opt.mode = optnum; - m[optnum].type = NM_TYPE_RADIO; m[optnum].text = TXT_ANARCHY; m[optnum].value=(Netgame.gamemode == NETGAME_ANARCHY); m[optnum].group=0; optnum++; + m[optnum].type = NM_TYPE_RADIO; m[optnum].text = TXT_ANARCHY; m[optnum].value=(Netgame.gamemode == NETGAME_ANARCHY); m[optnum].group=0; opt.anarchy=optnum; optnum++; m[optnum].type = NM_TYPE_RADIO; m[optnum].text = TXT_TEAM_ANARCHY; m[optnum].value=(Netgame.gamemode == NETGAME_TEAM_ANARCHY); m[optnum].group=0; opt.team_anarchy=optnum; optnum++; - m[optnum].type = NM_TYPE_RADIO; m[optnum].text = TXT_ANARCHY_W_ROBOTS; m[optnum].value=(Netgame.gamemode == NETGAME_ROBOT_ANARCHY); m[optnum].group=0; optnum++; + m[optnum].type = NM_TYPE_RADIO; m[optnum].text = TXT_ANARCHY_W_ROBOTS; m[optnum].value=(Netgame.gamemode == NETGAME_ROBOT_ANARCHY); m[optnum].group=0; opt.robot_anarchy=optnum; optnum++; m[optnum].type = NM_TYPE_RADIO; m[optnum].text = TXT_COOPERATIVE; m[optnum].value=(Netgame.gamemode == NETGAME_COOPERATIVE); m[optnum].group=0; opt.coop=optnum; optnum++; - m[optnum].type = NM_TYPE_RADIO; m[optnum].text = "Bounty"; m[optnum].value = ( Netgame.gamemode & NETGAME_BOUNTY ); m[optnum].group = 0; optnum++; + m[optnum].type = NM_TYPE_RADIO; m[optnum].text = "Bounty"; m[optnum].value = ( Netgame.gamemode & NETGAME_BOUNTY ); m[optnum].group = 0; opt.mode_end=opt.bounty=optnum; optnum++; m[optnum].type = NM_TYPE_TEXT; m[optnum].text = ""; optnum++;