mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 12:41:21 +00:00
Merge pull request #342 from earth-metal/master
Add support for CTF options to "start network server" menu.
This commit is contained in:
commit
bbdd3f1d60
1 changed files with 127 additions and 36 deletions
|
@ -2665,6 +2665,7 @@ static menuaction_s s_startserver_start_action;
|
|||
static menuaction_s s_startserver_dmoptions_action;
|
||||
static menufield_s s_timelimit_field;
|
||||
static menufield_s s_fraglimit_field;
|
||||
static menufield_s s_capturelimit_field;
|
||||
static menufield_s s_maxclients_field;
|
||||
static menufield_s s_hostname_field;
|
||||
static menulist_s s_startmap_list;
|
||||
|
@ -2703,6 +2704,7 @@ StartServerActionFunc(void *self)
|
|||
char startmap[1024];
|
||||
float timelimit;
|
||||
float fraglimit;
|
||||
float capturelimit;
|
||||
float maxclients;
|
||||
char *spot;
|
||||
|
||||
|
@ -2712,6 +2714,12 @@ StartServerActionFunc(void *self)
|
|||
timelimit = (float)strtod(s_timelimit_field.buffer, (char **)NULL);
|
||||
fraglimit = (float)strtod(s_fraglimit_field.buffer, (char **)NULL);
|
||||
|
||||
if (M_IsGame("ctf"))
|
||||
{
|
||||
capturelimit = (float)strtod(s_capturelimit_field.buffer, (char **)NULL);
|
||||
Cvar_SetValue("capturelimit", ClampCvar(0, capturelimit, capturelimit));
|
||||
}
|
||||
|
||||
Cvar_SetValue("maxclients", ClampCvar(0, maxclients, maxclients));
|
||||
Cvar_SetValue("timelimit", ClampCvar(0, timelimit, timelimit));
|
||||
Cvar_SetValue("fraglimit", ClampCvar(0, fraglimit, fraglimit));
|
||||
|
@ -2877,10 +2885,29 @@ StartServer_MenuInit(void)
|
|||
|
||||
s_startmap_list.generic.type = MTYPE_SPINCONTROL;
|
||||
s_startmap_list.generic.x = 0;
|
||||
|
||||
if (M_IsGame("ctf"))
|
||||
s_startmap_list.generic.y = -8;
|
||||
else
|
||||
s_startmap_list.generic.y = 0;
|
||||
|
||||
s_startmap_list.generic.name = "initial map";
|
||||
s_startmap_list.itemnames = (const char **)mapnames;
|
||||
|
||||
if (M_IsGame("ctf"))
|
||||
{
|
||||
s_capturelimit_field.generic.type = MTYPE_FIELD;
|
||||
s_capturelimit_field.generic.name = "capture limit";
|
||||
s_capturelimit_field.generic.flags = QMF_NUMBERSONLY;
|
||||
s_capturelimit_field.generic.x = 0;
|
||||
s_capturelimit_field.generic.y = 18;
|
||||
s_capturelimit_field.generic.statusbar = "0 = no limit";
|
||||
s_capturelimit_field.length = 3;
|
||||
s_capturelimit_field.visible_length = 3;
|
||||
strcpy(s_capturelimit_field.buffer, Cvar_VariableString("capturelimit"));
|
||||
}
|
||||
else
|
||||
{
|
||||
s_rules_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_rules_box.generic.x = 0;
|
||||
s_rules_box.generic.y = 20;
|
||||
|
@ -2906,6 +2933,7 @@ StartServer_MenuInit(void)
|
|||
}
|
||||
|
||||
s_rules_box.generic.callback = RulesChangeFunc;
|
||||
}
|
||||
|
||||
s_timelimit_field.generic.type = MTYPE_FIELD;
|
||||
s_timelimit_field.generic.name = "time limit";
|
||||
|
@ -2975,7 +3003,12 @@ StartServer_MenuInit(void)
|
|||
s_startserver_start_action.generic.callback = StartServerActionFunc;
|
||||
|
||||
Menu_AddItem(&s_startserver_menu, &s_startmap_list);
|
||||
|
||||
if (M_IsGame("ctf"))
|
||||
Menu_AddItem(&s_startserver_menu, &s_capturelimit_field);
|
||||
else
|
||||
Menu_AddItem(&s_startserver_menu, &s_rules_box);
|
||||
|
||||
Menu_AddItem(&s_startserver_menu, &s_timelimit_field);
|
||||
Menu_AddItem(&s_startserver_menu, &s_fraglimit_field);
|
||||
Menu_AddItem(&s_startserver_menu, &s_maxclients_field);
|
||||
|
@ -3189,6 +3222,21 @@ DMFlagCallback(void *self)
|
|||
bit = DF_NO_SPHERES;
|
||||
}
|
||||
}
|
||||
else if (M_IsGame("ctf"))
|
||||
{
|
||||
if (f == &s_no_mines_box)
|
||||
{
|
||||
bit = DF_NO_MINES; /* Equivalent to DF_CTF_FORCEJOIN in CTF */
|
||||
}
|
||||
else if (f == &s_no_nukes_box)
|
||||
{
|
||||
bit = DF_NO_NUKES; /* Equivalent to DF_CTF_NO_TECH in CTF */
|
||||
}
|
||||
else if (f == &s_stack_double_box)
|
||||
{
|
||||
bit = DF_NO_STACK_DOUBLE; /* Equivalent to DF_ARMOR_PROTECT in CTF */
|
||||
}
|
||||
}
|
||||
|
||||
if (f)
|
||||
{
|
||||
|
@ -3299,12 +3347,15 @@ DMOptions_MenuInit(void)
|
|||
s_force_respawn_box.itemnames = yes_no_names;
|
||||
s_force_respawn_box.curvalue = (dmflags & DF_FORCE_RESPAWN) != 0;
|
||||
|
||||
if (!M_IsGame("ctf"))
|
||||
{
|
||||
s_teamplay_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_teamplay_box.generic.x = 0;
|
||||
s_teamplay_box.generic.y = y += 10;
|
||||
s_teamplay_box.generic.name = "teamplay";
|
||||
s_teamplay_box.generic.callback = DMFlagCallback;
|
||||
s_teamplay_box.itemnames = teamplay_names;
|
||||
}
|
||||
|
||||
s_allow_exit_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_allow_exit_box.generic.x = 0;
|
||||
|
@ -3338,6 +3389,8 @@ DMOptions_MenuInit(void)
|
|||
s_quad_drop_box.itemnames = yes_no_names;
|
||||
s_quad_drop_box.curvalue = (dmflags & DF_QUAD_DROP) != 0;
|
||||
|
||||
if (!M_IsGame("ctf"))
|
||||
{
|
||||
s_friendlyfire_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_friendlyfire_box.generic.x = 0;
|
||||
s_friendlyfire_box.generic.y = y += 10;
|
||||
|
@ -3345,6 +3398,7 @@ DMOptions_MenuInit(void)
|
|||
s_friendlyfire_box.generic.callback = DMFlagCallback;
|
||||
s_friendlyfire_box.itemnames = yes_no_names;
|
||||
s_friendlyfire_box.curvalue = (dmflags & DF_NO_FRIENDLY_FIRE) == 0;
|
||||
}
|
||||
|
||||
if (M_IsGame("rogue"))
|
||||
{
|
||||
|
@ -3380,6 +3434,32 @@ DMOptions_MenuInit(void)
|
|||
s_no_spheres_box.itemnames = yes_no_names;
|
||||
s_no_spheres_box.curvalue = (dmflags & DF_NO_SPHERES) != 0;
|
||||
}
|
||||
else if (M_IsGame("ctf"))
|
||||
{
|
||||
s_no_mines_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_no_mines_box.generic.x = 0;
|
||||
s_no_mines_box.generic.y = y += 10;
|
||||
s_no_mines_box.generic.name = "force join";
|
||||
s_no_mines_box.generic.callback = DMFlagCallback;
|
||||
s_no_mines_box.itemnames = yes_no_names;
|
||||
s_no_mines_box.curvalue = (dmflags & DF_NO_MINES) != 0;
|
||||
|
||||
s_stack_double_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_stack_double_box.generic.x = 0;
|
||||
s_stack_double_box.generic.y = y += 10;
|
||||
s_stack_double_box.generic.name = "armor protect";
|
||||
s_stack_double_box.generic.callback = DMFlagCallback;
|
||||
s_stack_double_box.itemnames = yes_no_names;
|
||||
s_stack_double_box.curvalue = (dmflags & DF_NO_STACK_DOUBLE) != 0;
|
||||
|
||||
s_no_nukes_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_no_nukes_box.generic.x = 0;
|
||||
s_no_nukes_box.generic.y = y += 10;
|
||||
s_no_nukes_box.generic.name = "techs off";
|
||||
s_no_nukes_box.generic.callback = DMFlagCallback;
|
||||
s_no_nukes_box.itemnames = yes_no_names;
|
||||
s_no_nukes_box.curvalue = (dmflags & DF_NO_NUKES) != 0;
|
||||
}
|
||||
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_falls_box);
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_weapons_stay_box);
|
||||
|
@ -3390,11 +3470,16 @@ DMOptions_MenuInit(void)
|
|||
Menu_AddItem(&s_dmoptions_menu, &s_spawn_farthest_box);
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_samelevel_box);
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_force_respawn_box);
|
||||
|
||||
if (!M_IsGame("ctf"))
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_teamplay_box);
|
||||
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_allow_exit_box);
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_infinite_ammo_box);
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_fixed_fov_box);
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_quad_drop_box);
|
||||
|
||||
if (!M_IsGame("ctf"))
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_friendlyfire_box);
|
||||
|
||||
if (M_IsGame("rogue"))
|
||||
|
@ -3404,6 +3489,12 @@ DMOptions_MenuInit(void)
|
|||
Menu_AddItem(&s_dmoptions_menu, &s_stack_double_box);
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_no_spheres_box);
|
||||
}
|
||||
else if (M_IsGame("ctf"))
|
||||
{
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_no_mines_box);
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_stack_double_box);
|
||||
Menu_AddItem(&s_dmoptions_menu, &s_no_nukes_box);
|
||||
}
|
||||
|
||||
Menu_Center(&s_dmoptions_menu);
|
||||
|
||||
|
|
Loading…
Reference in a new issue