Updated 'Netgame Rules & Info' screen, added option to toggle it ingame via SHIFT-PAUSE, added hint to netgame help menu

This commit is contained in:
zico 2016-05-10 13:41:13 +02:00
parent 30230a8137
commit 3366658a5b
5 changed files with 144 additions and 166 deletions

View file

@ -765,6 +765,8 @@ void save_hoard_data(void);
}
#endif
extern void show_netgame_info(struct netgame_info *netgame);
//how to encode missiles & flares in weapon packets
#define MISSILE_ADJUST 100
#define FLARE_ADJUST 127

View file

@ -985,6 +985,7 @@ void show_help()
DXX_MENUITEM(VERB, TEXT, "F8\t SEND MESSAGE", NETHELP_SENDMSG) \
DXX_MENUITEM(VERB, TEXT, "(SHIFT-)F9 to F12\t (DEFINE)SEND MACRO", NETHELP_MACRO) \
DXX_MENUITEM(VERB, TEXT, "PAUSE\t SHOW NETGAME INFORMATION", NETHELP_GAME_INFO) \
DXX_MENUITEM(VERB, TEXT, "SHIFT-PAUSE\t SHOW NETGAME INFO & RULES", NETHELP_GAME_INFORULES) \
_DXX_HELP_MENU_HINT_CMD_KEY(VERB, NETHELP) \
DXX_MENUITEM(VERB, TEXT, "", NETHELP_SEP1) \
DXX_MENUITEM(VERB, TEXT, "MULTIPLAYER MESSAGE COMMANDS:", NETHELP_COMMAND_HEADER) \

View file

@ -758,6 +758,11 @@ static window_event_result HandleSystemKey(int key)
switch (key)
{
KEY_MAC( case KEY_COMMAND+KEY_PAUSE+KEY_SHIFTED: )
case KEY_PAUSE+KEY_SHIFTED:
if (Game_mode & GM_MULTI)
show_netgame_info(&Netgame);
break;
KEY_MAC( case KEY_COMMAND+KEY_P: )
case KEY_PAUSE:
do_game_pause(); break;

View file

@ -78,6 +78,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "iff.h"
#include "state.h"
#include "automap.h"
#include "event.h"
#ifdef USE_UDP
#include "net_udp.h"
#endif
@ -5821,3 +5822,137 @@ void multi_object_rw_to_object(object_rw *obj_rw, const vobjptr_t obj)
}
static char *ngii;
static int show_netgame_info_poll( newmenu *menu, const d_event &event, newmenu_item *items )
{
newmenu_item *menus = newmenu_get_items(menu);
switch (event.type)
{
case EVENT_WINDOW_CLOSE:
{
(void)items;
d_free(ngii);
d_free(menus);
return 0;
}
default:
break;
}
return 0;
}
void show_netgame_info(netgame_info *netgame)
{
newmenu_item *m;
int loc=0, ngilen = 50;
#if defined(DXX_BUILD_DESCENT_I)
int nginum = 50;
#elif defined(DXX_BUILD_DESCENT_II)
int nginum = 75;
#endif
CALLOC(m, newmenu_item, nginum);
if (!m)
return;
MALLOC(ngii, char, nginum * ngilen);
if (!ngii)
{
d_free(m);
return;
}
snprintf(ngii+(ngilen*loc),ngilen,"Game Name\t %s",netgame->game_name.data()); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Mission Name\t %s",netgame->mission_title.data()); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Level\t %s%i", (netgame->levelnum<0)?"S":" ", abs(netgame->levelnum)); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Game Mode\t %s", netgame->gamemode < GMNames.size() ? GMNames[netgame->gamemode] : "INVALID"); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Players\t %i/%i", netgame->numplayers, netgame->max_numplayers); loc++;
snprintf(ngii+(ngilen*loc),ngilen," "); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Game Options:"); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Difficulty\t %s", MENU_DIFFICULTY_TEXT(netgame->difficulty)); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Reactor Life\t %i %s", netgame->control_invul_time / F1_0 / 60, TXT_MINUTES_ABBREV); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Max Time\t %i %s", netgame->PlayTimeAllowed * 5, TXT_MINUTES_ABBREV); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Kill Goal\t %i", netgame->KillGoal * 5); loc++;
snprintf(ngii+(ngilen*loc),ngilen," "); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Duplicate Powerups:"); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Primaries\t %i", (int)netgame->DuplicatePowerups.get_primary_count()); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Secondaries\t %i", (int)netgame->DuplicatePowerups.get_secondary_count()); loc++;
#if defined(DXX_BUILD_DESCENT_II)
snprintf(ngii+(ngilen*loc),ngilen,"Accessories\t %i", (int)netgame->DuplicatePowerups.get_accessory_count()); loc++;
#endif
snprintf(ngii+(ngilen*loc),ngilen," "); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Spawn Options:"); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Use * Furthest Spawn Sites\t %i", netgame->SecludedSpawns+1); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Invulnerable Time\t %1.1f sec", static_cast<float>(netgame->InvulAppear) / 2); loc++;
snprintf(ngii+(ngilen*loc),ngilen," "); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Objects Allowed:"); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Laser Upgrade\t %s", (netgame->AllowedItems & NETFLAG_DOLASER)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Quad Lasers\t %s", (netgame->AllowedItems & NETFLAG_DOQUAD)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Vulcan Cannon\t %s", (netgame->AllowedItems & NETFLAG_DOVULCAN)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Spreadfire Cannon\t %s", (netgame->AllowedItems & NETFLAG_DOSPREAD)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Plasma Cannon\t %s", (netgame->AllowedItems & NETFLAG_DOPLASMA)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Fusion Cannon\t %s", (netgame->AllowedItems & NETFLAG_DOFUSION)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Homing Missiles\t %s", (netgame->AllowedItems & NETFLAG_DOHOMING)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Proximity Bombs\t %s", (netgame->AllowedItems & NETFLAG_DOPROXIM)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Smart Missiles\t %s", (netgame->AllowedItems & NETFLAG_DOSMART)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Mega Missiles\t %s", (netgame->AllowedItems & NETFLAG_DOMEGA)?TXT_YES:TXT_NO); loc++;
#if defined(DXX_BUILD_DESCENT_II)
snprintf(ngii+(ngilen*loc),ngilen,"Super Lasers\t %s", (netgame->AllowedItems & NETFLAG_DOSUPERLASER)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Gauss Cannon\t %s", (netgame->AllowedItems & NETFLAG_DOGAUSS)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Helix Cannon\t %s", (netgame->AllowedItems & NETFLAG_DOHELIX)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Phoenix Cannon\t %s", (netgame->AllowedItems & NETFLAG_DOPHOENIX)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Omega Cannon\t %s", (netgame->AllowedItems & NETFLAG_DOOMEGA)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Flash Missiles\t %s", (netgame->AllowedItems & NETFLAG_DOFLASH)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Guides Missiles\t %s", (netgame->AllowedItems & NETFLAG_DOGUIDED)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Smart Mines\t %s", (netgame->AllowedItems & NETFLAG_DOSMARTMINE)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Mercury Missiles\t %s", (netgame->AllowedItems & NETFLAG_DOMERCURY)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Earthshaker Missiles\t %s", (netgame->AllowedItems & NETFLAG_DOSHAKER)?TXT_YES:TXT_NO); loc++;
#endif
snprintf(ngii+(ngilen*loc),ngilen,"Cloaking\t %s", (netgame->AllowedItems & NETFLAG_DOCLOAK)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Invulnerability\t %s", (netgame->AllowedItems & NETFLAG_DOINVUL)?TXT_YES:TXT_NO); loc++;
#if defined(DXX_BUILD_DESCENT_II)
snprintf(ngii+(ngilen*loc),ngilen,"Afterburners\t %s", (netgame->AllowedItems & NETFLAG_DOAFTERBURNER)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Ammo Rack\t %s", (netgame->AllowedItems & NETFLAG_DOAMMORACK)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Enery Converter\t %s", (netgame->AllowedItems & NETFLAG_DOCONVERTER)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Headlight\t %s", (netgame->AllowedItems & NETFLAG_DOHEADLIGHT)?TXT_YES:TXT_NO); loc++;
#endif
snprintf(ngii+(ngilen*loc),ngilen," "); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Objects Granted At Spawn:"); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Laser Level\t %i", map_granted_flags_to_laser_level(netgame->SpawnGrantedItems)+1); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Quad Lasers\t %s", menu_bit_wrapper(netgame->SpawnGrantedItems.mask, NETGRANT_QUAD)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Vulcan Cannon\t %s", menu_bit_wrapper(netgame->SpawnGrantedItems.mask, NETGRANT_VULCAN)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Spreadfire Cannon\t %s", menu_bit_wrapper(netgame->SpawnGrantedItems.mask, NETGRANT_SPREAD)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Plasma Cannon\t %s", menu_bit_wrapper(netgame->SpawnGrantedItems.mask, NETGRANT_PLASMA)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Fusion Cannon\t %s", menu_bit_wrapper(netgame->SpawnGrantedItems.mask, NETGRANT_FUSION)?TXT_YES:TXT_NO); loc++;
#if defined(DXX_BUILD_DESCENT_II)
snprintf(ngii+(ngilen*loc),ngilen,"Gauss Cannon\t %s", menu_bit_wrapper(netgame->SpawnGrantedItems.mask, NETGRANT_GAUSS)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Helix Cannon\t %s", menu_bit_wrapper(netgame->SpawnGrantedItems.mask, NETGRANT_HELIX)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Phoenix Cannon\t %s", menu_bit_wrapper(netgame->SpawnGrantedItems.mask, NETGRANT_PHOENIX)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Omega Cannon\t %s", menu_bit_wrapper(netgame->SpawnGrantedItems.mask, NETGRANT_OMEGA)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Afterburners\t %s", menu_bit_wrapper(netgame->SpawnGrantedItems.mask, NETGRANT_AFTERBURNER)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Ammo Rack\t %s", menu_bit_wrapper(netgame->SpawnGrantedItems.mask, NETGRANT_AMMORACK)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Enery Converter\t %s", menu_bit_wrapper(netgame->SpawnGrantedItems.mask, NETGRANT_CONVERTER)?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Headlight\t %s", menu_bit_wrapper(netgame->SpawnGrantedItems.mask, NETGRANT_HEADLIGHT)?TXT_YES:TXT_NO); loc++;
#endif
snprintf(ngii+(ngilen*loc),ngilen," "); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Misc. Options:"); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Show All Players On Automap\t %s", netgame->game_flag.show_on_map?TXT_YES:TXT_NO); loc++;
#if defined(DXX_BUILD_DESCENT_II)
snprintf(ngii+(ngilen*loc),ngilen,"Allow Marker Camera Views\t %s", netgame->Allow_marker_view?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Indestructable Lights\t %s", netgame->AlwaysLighting?TXT_YES:TXT_NO); loc++;
#endif
snprintf(ngii+(ngilen*loc),ngilen,"Bright Player Ships\t %s", netgame->BrightPlayers?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Enemy Names On Hud\t %s", netgame->ShowEnemyNames?TXT_YES:TXT_NO); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Friendly Fire (Team, Coop)\t %s", netgame->NoFriendlyFire?TXT_NO:TXT_YES); loc++;
snprintf(ngii+(ngilen*loc),ngilen," "); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Network Options:"); loc++;
snprintf(ngii+(ngilen*loc),ngilen,"Packets Per Second\t %i", netgame->PacketsPerSec); loc++;
Assert(loc == nginum);
for (int i = 0; i < nginum; i++) {
m[i].type = NM_TYPE_TEXT;
m[i].text = ngii+(i*ngilen);
}
newmenu_dotiny(NULL, "Netgame Info & Rules", nginum, m, 0, show_netgame_info_poll, m);
}

View file

@ -5686,171 +5686,6 @@ void net_udp_send_extras ()
Player_joining_extras=-1;
}
template <typename F>
static void draw_game_rules(F f, const netgame_info &netgame)
{
#if defined(DXX_BUILD_DESCENT_I)
constexpr int base_y = 35;
#elif defined(DXX_BUILD_DESCENT_II)
constexpr int base_y = 15;
#endif
const auto &&fspacx = FSPACX();
const auto &&fspacy = FSPACY();
const auto &&fspacx25 = fspacx(25);
const auto &&fspacx130 = fspacx(130);
const auto &&fspacx155 = fspacx(155);
const auto &&fspacx170 = fspacx(170);
const auto &&fspacx275 = fspacx(275);
const auto &&fspacy6 = fspacy(6);
auto x25y = fspacy(base_y + 69), x155y = fspacy(base_y + 20), x170y = x25y;
const auto AllowedItems = netgame.AllowedItems;
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Laser Upgrade:", AllowedItems, NETFLAG_DOLASER);
#if defined(DXX_BUILD_DESCENT_I)
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Quad Laser:", AllowedItems, NETFLAG_DOQUAD);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Vulcan Cannon:", AllowedItems, NETFLAG_DOVULCAN);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Spreadfire Cannon:", AllowedItems, NETFLAG_DOSPREAD);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Plasma Cannon:", AllowedItems, NETFLAG_DOPLASMA);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Fusion Cannon:", AllowedItems, NETFLAG_DOFUSION);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Invulnerability:", AllowedItems, NETFLAG_DOINVUL);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Cloak:", AllowedItems, NETFLAG_DOCLOAK);
f.show_bool_oo(fspacx155,x155y += fspacy6, fspacx275, "Bright player ships:", netgame.BrightPlayers);
f.show_bool_oo(fspacx155,x155y += fspacy6, fspacx275, "Show enemy names on hud:", netgame.ShowEnemyNames);
f.show_bool_oo(fspacx155,x155y += fspacy6, fspacx275, "Show players on automap:", netgame.game_flag.show_on_map);
f.show_bool_oo(fspacx155,x155y += fspacy6, fspacx275, "Invul vs allies:", netgame.NoFriendlyFire);
f.show_mask_yn(fspacx170,x170y += fspacy6, fspacx275, "Homing Missile:", AllowedItems, NETFLAG_DOHOMING);
f.show_mask_yn(fspacx170,x170y += fspacy6, fspacx275, "Proximity Bomb:", AllowedItems, NETFLAG_DOPROXIM);
f.show_mask_yn(fspacx170,x170y += fspacy6, fspacx275, "Smart Missile:", AllowedItems, NETFLAG_DOSMART);
f.show_mask_yn(fspacx170,x170y += fspacy6, fspacx275, "Mega Missile:", AllowedItems, NETFLAG_DOMEGA);
#elif defined(DXX_BUILD_DESCENT_II)
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Super Laser:", AllowedItems, NETFLAG_DOSUPERLASER);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Quad Laser:", AllowedItems, NETFLAG_DOQUAD);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Vulcan Cannon:", AllowedItems, NETFLAG_DOVULCAN);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Gauss Cannon:", AllowedItems, NETFLAG_DOGAUSS);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Spreadfire Cannon:", AllowedItems, NETFLAG_DOSPREAD);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Helix Cannon:", AllowedItems, NETFLAG_DOHELIX);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Plasma Cannon:", AllowedItems, NETFLAG_DOPLASMA);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Phoenix Cannon:", AllowedItems, NETFLAG_DOPHOENIX);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Fusion Cannon:", AllowedItems, NETFLAG_DOFUSION);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Omega Cannon:", AllowedItems, NETFLAG_DOOMEGA);
f.show_bool_oo(fspacx155, x155y += fspacy6, fspacx275, "Marker camera views:", netgame.Allow_marker_view);
f.show_bool_oo(fspacx155, x155y += fspacy6, fspacx275, "Indestructible lights:", netgame.AlwaysLighting);
f.show_bool_oo(fspacx155, x155y += fspacy6, fspacx275, "Bright player ships:", netgame.BrightPlayers);
f.show_bool_oo(fspacx155, x155y += fspacy6, fspacx275, "Show enemy names on hud:", netgame.ShowEnemyNames);
f.show_bool_oo(fspacx155, x155y += fspacy6, fspacx275, "Show players on automap:", netgame.game_flag.show_on_map);
f.show_bool_oo(fspacx155, x155y += fspacy6, fspacx275, "Invul vs allies:", netgame.NoFriendlyFire);
f.show_mask_yn(fspacx170, x170y += fspacy6, fspacx275, "Flash Missile:", AllowedItems, NETFLAG_DOFLASH);
f.show_mask_yn(fspacx170, x170y += fspacy6, fspacx275, "Homing Missile:", AllowedItems, NETFLAG_DOHOMING);
f.show_mask_yn(fspacx170, x170y += fspacy6, fspacx275, "Guided Missile:", AllowedItems, NETFLAG_DOGUIDED);
f.show_mask_yn(fspacx170, x170y += fspacy6, fspacx275, "Proximity Bomb:", AllowedItems, NETFLAG_DOPROXIM);
f.show_mask_yn(fspacx170, x170y += fspacy6, fspacx275, "Smart Mine:", AllowedItems, NETFLAG_DOSMARTMINE);
f.show_mask_yn(fspacx170, x170y += fspacy6, fspacx275, "Smart Missile:", AllowedItems, NETFLAG_DOSMART);
f.show_mask_yn(fspacx170, x170y += fspacy6, fspacx275, "Mercury Missile:", AllowedItems, NETFLAG_DOMERCURY);
f.show_mask_yn(fspacx170, x170y += fspacy6, fspacx275, "Mega Missile:", AllowedItems, NETFLAG_DOMEGA);
f.show_mask_yn(fspacx170, x170y += fspacy6, fspacx275, "Earthshaker Missile:", AllowedItems, NETFLAG_DOSHAKER);
x25y = x170y = fspacy(base_y + 139);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Afterburner:", AllowedItems, NETFLAG_DOAFTERBURNER);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Headlight:", AllowedItems, NETFLAG_DOHEADLIGHT);
f.show_mask_yn(fspacx25, x25y += fspacy6, fspacx130, "Energy->Shield Conv:", AllowedItems, NETFLAG_DOCONVERTER);
f.show_mask_yn(fspacx170, x170y += fspacy6, fspacx275, "Invulnerability:", AllowedItems, NETFLAG_DOINVUL);
f.show_mask_yn(fspacx170, x170y += fspacy6, fspacx275, "Cloaking Device:", AllowedItems, NETFLAG_DOCLOAK);
f.show_mask_yn(fspacx170, x170y += fspacy6, fspacx275, "Ammo Rack:", AllowedItems, NETFLAG_DOAMMORACK);
#endif
}
static window_event_result show_game_rules_handler(window *wind,const d_event &event, netgame_info *netgame)
{
int k;
const auto &&fspacx = FSPACX();
const auto &&fspacy = FSPACY();
#if defined(DXX_BUILD_DESCENT_I)
int w = fspacx(280), h = fspacy(130);
#elif defined(DXX_BUILD_DESCENT_II)
int w = fspacx(280), h = fspacy(170);
#endif
switch (event.type)
{
case EVENT_WINDOW_ACTIVATED:
game_flush_inputs();
break;
case EVENT_KEY_COMMAND:
k = event_key_get(event);
switch (k)
{
case KEY_ENTER:
case KEY_SPACEBAR:
case KEY_ESC:
return window_event_result::close;
}
break;
case EVENT_WINDOW_DRAW:
{
timer_delay2(50);
gr_set_current_canvas(NULL);
nm_draw_background(((SWIDTH-w)/2)-BORDERX,((SHEIGHT-h)/2)-BORDERY,((SWIDTH-w)/2)+w+BORDERX,((SHEIGHT-h)/2)+h+BORDERY);
#define SHOW_INVULNERABLE_APPEAR_STRING(X,Y) \
if (netgame->InvulAppear) \
gr_printf(X, Y, "%1.1f sec", static_cast<float>(netgame->InvulAppear) / 2); \
else \
gr_string(X, Y, "OFF");
gr_set_current_canvas(window_get_canvas(*wind));
gr_set_curfont(MEDIUM3_FONT);
gr_set_fontcolor(gr_find_closest_color_current(29,29,47),-1);
const auto &&fspacx25 = fspacx(25);
const auto &&fspacx115 = fspacx(115);
const auto &&fspacx155 = fspacx(155);
const auto &&fspacx275 = fspacx(275);
#if defined(DXX_BUILD_DESCENT_I)
constexpr int base_y = 35;
#elif defined(DXX_BUILD_DESCENT_II)
constexpr int base_y = 15;
#endif
gr_string(0x8000, fspacy(base_y), "NETGAME INFO");
gr_set_curfont(GAME_FONT);
gr_string(fspacx25, fspacy(base_y + 20), "Reactor Life:");
gr_string(fspacx25, fspacy(base_y + 26), "Max Time:");
gr_string(fspacx25, fspacy(base_y + 32), "Kill Goal:");
gr_string(fspacx25, fspacy(base_y + 38), "Packets per sec.:");
gr_string(fspacx155, fspacy(base_y + 20), "Invul when reappearing:");
gr_string(fspacx25, fspacy(base_y + 65), "Allowed Objects");
draw_game_rules(show_rule_label(), *netgame);
#if defined(DXX_BUILD_DESCENT_I)
gr_set_fontcolor(gr_find_closest_color_current(255,255,255),-1);
#elif defined(DXX_BUILD_DESCENT_II)
gr_set_fontcolor(BM_XRGB(255,255,255),-1);
#endif
draw_game_rules(show_rule_value(), *netgame);
gr_printf(fspacx115, fspacy(base_y + 20), "%i Min", netgame->control_invul_time / reactor_invul_time_mini_scale);
gr_printf(fspacx115, fspacy(base_y + 26), "%i Min", netgame->PlayTimeAllowed * 5);
gr_printf(fspacx115, fspacy(base_y + 32), "%i", netgame->KillGoal * 5);
gr_printf(fspacx115, fspacy(base_y + 38), "%i", netgame->PacketsPerSec);
SHOW_INVULNERABLE_APPEAR_STRING(fspacx275, fspacy(base_y + 20));
gr_set_current_canvas(NULL);
break;
}
default:
break;
}
return window_event_result::ignored;
}
static void net_udp_show_game_rules(netgame_info *netgame)
{
gr_set_current_canvas(NULL);
const auto &&fspacx = FSPACX();
const auto &&fspacy = FSPACY();
window_create(&grd_curscreen->sc_canvas, (SWIDTH - fspacx(320)) / 2, (SHEIGHT - fspacy(200)) / 2, fspacx(320), fspacy(200),
show_game_rules_handler, netgame);
}
static int show_game_info_handler(newmenu *, const d_event &event, netgame_info *netgame)
{
switch (event.type)
@ -5860,7 +5695,7 @@ static int show_game_info_handler(newmenu *, const d_event &event, netgame_info
auto &citem = static_cast<const d_select_event &>(event).citem;
if (citem != 1)
return 0;
net_udp_show_game_rules(netgame);
show_netgame_info(netgame);
return 1;
}
default: