Pass selection for EVENT_NEWMENU_CHANGED
This commit is contained in:
parent
cc508be34c
commit
81eae187e5
|
@ -58,6 +58,15 @@ struct d_create_event : d_event
|
|||
const void *createdata;
|
||||
};
|
||||
|
||||
struct d_change_event : d_event
|
||||
{
|
||||
int citem;
|
||||
d_change_event(const int c) :
|
||||
d_event{EVENT_NEWMENU_CHANGED}, citem(c)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct d_select_event : d_event
|
||||
{
|
||||
int citem;
|
||||
|
|
|
@ -1062,11 +1062,11 @@ static int opt_ic_usejoy = 0, opt_ic_usemouse = 0, opt_ic_confkey = 0, opt_ic_co
|
|||
static int input_config_menuset(newmenu *menu,const d_event &event, const unused_newmenu_userdata_t *)
|
||||
{
|
||||
newmenu_item *items = newmenu_get_items(menu);
|
||||
int citem = newmenu_get_citem(menu);
|
||||
|
||||
switch (event.type)
|
||||
{
|
||||
case EVENT_NEWMENU_CHANGED:
|
||||
{
|
||||
auto &citem = static_cast<const d_change_event &>(event).citem;
|
||||
if (citem == opt_ic_usejoy)
|
||||
(items[citem].value)?(PlayerCfg.ControlType|=CONTROL_USING_JOYSTICK):(PlayerCfg.ControlType&=~CONTROL_USING_JOYSTICK);
|
||||
if (citem == opt_ic_usemouse)
|
||||
|
@ -1080,7 +1080,7 @@ static int input_config_menuset(newmenu *menu,const d_event &event, const unused
|
|||
if (citem == opt_ic_mousefsgauge)
|
||||
PlayerCfg.MouseFSIndicator = items[citem].value;
|
||||
break;
|
||||
|
||||
}
|
||||
case EVENT_NEWMENU_SELECTED:
|
||||
{
|
||||
auto &citem = static_cast<const d_select_event &>(event).citem;
|
||||
|
@ -1211,17 +1211,23 @@ static void reticle_config()
|
|||
PlayerCfg.ReticleSize = m[opt_ret_size].value;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
int opt_gr_texfilt, opt_gr_brightness, opt_gr_reticlemenu, opt_gr_alphafx, opt_gr_dynlightcolor, opt_gr_vsync, opt_gr_multisample, opt_gr_fpsindi;
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
int opt_gr_movietexfilt;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
static int graphics_config_menuset(newmenu *menu,const d_event &event, const unused_newmenu_userdata_t *)
|
||||
{
|
||||
newmenu_item *items = newmenu_get_items(menu);
|
||||
int citem = newmenu_get_citem(menu);
|
||||
switch (event.type)
|
||||
{
|
||||
case EVENT_NEWMENU_CHANGED:
|
||||
{
|
||||
auto &citem = static_cast<const d_change_event &>(event).citem;
|
||||
if ( citem == opt_gr_texfilt + 3
|
||||
#ifdef OGL
|
||||
&& ogl_maxanisotropy <= 1.0
|
||||
|
@ -1235,7 +1241,7 @@ static int graphics_config_menuset(newmenu *menu,const d_event &event, const unu
|
|||
if ( citem == opt_gr_brightness)
|
||||
gr_palette_set_gamma(items[citem].value);
|
||||
break;
|
||||
|
||||
}
|
||||
case EVENT_NEWMENU_SELECTED:
|
||||
{
|
||||
auto &citem = static_cast<const d_select_event &>(event).citem;
|
||||
|
@ -1602,14 +1608,13 @@ static int get_absolute_path(char *full_path, const char *rel_path)
|
|||
static int sound_menuset(newmenu *menu,const d_event &event, const unused_newmenu_userdata_t *)
|
||||
{
|
||||
newmenu_item *items = newmenu_get_items(menu);
|
||||
int citem = newmenu_get_citem(menu);
|
||||
//int nitems = newmenu_get_nitems(menu);
|
||||
int replay = 0;
|
||||
int rval = 0;
|
||||
|
||||
switch (event.type)
|
||||
{
|
||||
case EVENT_NEWMENU_CHANGED:
|
||||
{
|
||||
auto &citem = static_cast<const d_change_event &>(event).citem;
|
||||
if (citem == opt_sm_digivol)
|
||||
{
|
||||
GameCfg.DigiVolume = items[citem].value;
|
||||
|
@ -1670,7 +1675,7 @@ static int sound_menuset(newmenu *menu,const d_event &event, const unused_newmen
|
|||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
}
|
||||
case EVENT_NEWMENU_SELECTED:
|
||||
{
|
||||
auto &citem = static_cast<const d_select_event &>(event).citem;
|
||||
|
|
|
@ -3229,11 +3229,11 @@ menu:
|
|||
static int net_udp_more_options_handler( newmenu *menu,const d_event &event, const unused_newmenu_userdata_t *)
|
||||
{
|
||||
newmenu_item *menus = newmenu_get_items(menu);
|
||||
int citem = newmenu_get_citem(menu);
|
||||
|
||||
switch (event.type)
|
||||
{
|
||||
case EVENT_NEWMENU_CHANGED:
|
||||
{
|
||||
auto &citem = static_cast<const d_change_event &>(event).citem;
|
||||
if (citem == opt_cinvul)
|
||||
sprintf( menus[opt_cinvul].text, "%s: %d %s", TXT_REACTOR_LIFE, menus[opt_cinvul].value*5, TXT_MINUTES_ABBREV );
|
||||
else if (citem == opt_playtime)
|
||||
|
@ -3261,7 +3261,7 @@ static int net_udp_more_options_handler( newmenu *menu,const d_event &event, con
|
|||
sprintf( menus[opt_killgoal].text, "Kill Goal: %d kills", Netgame.KillGoal*5);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -3280,11 +3280,11 @@ struct param_opt
|
|||
static int net_udp_game_param_handler( newmenu *menu,const d_event &event, param_opt *opt )
|
||||
{
|
||||
newmenu_item *menus = newmenu_get_items(menu);
|
||||
int citem = newmenu_get_citem(menu);
|
||||
|
||||
switch (event.type)
|
||||
{
|
||||
case EVENT_NEWMENU_CHANGED:
|
||||
{
|
||||
auto &citem = static_cast<const d_change_event &>(event).citem;
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
if (citem == opt->team_anarchy)
|
||||
{
|
||||
|
@ -3390,7 +3390,7 @@ static int net_udp_game_param_handler( newmenu *menu,const d_event &event, param
|
|||
Netgame.game_flag.closed = menus[opt->closed].value;
|
||||
Netgame.RefusePlayers=menus[opt->refuse].value;
|
||||
break;
|
||||
|
||||
}
|
||||
case EVENT_NEWMENU_SELECTED:
|
||||
{
|
||||
auto &citem = static_cast<const d_select_event &>(event).citem;
|
||||
|
|
|
@ -842,8 +842,7 @@ static window_event_result newmenu_mouse(window *wind,const d_event &event, newm
|
|||
|
||||
if (changed && menu->subfunction)
|
||||
{
|
||||
d_event changed;
|
||||
changed.type = EVENT_NEWMENU_CHANGED;
|
||||
const d_change_event changed{menu->citem};
|
||||
(*menu->subfunction)(menu, changed, menu->userdata);
|
||||
}
|
||||
break;
|
||||
|
@ -1132,8 +1131,7 @@ static window_event_result newmenu_key_command(window *, const d_event &event, n
|
|||
|
||||
if (changed && menu->subfunction)
|
||||
{
|
||||
d_event changed;
|
||||
changed.type = EVENT_NEWMENU_CHANGED;
|
||||
const d_change_event changed{menu->citem};
|
||||
(*menu->subfunction)(menu, changed, menu->userdata);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue