thirtyflightsofloving/ui/menu_options_effects.c

357 lines
16 KiB
C
Raw Normal View History

2019-03-13 19:20:07 +00:00
/*
===========================================================================
2019-03-13 19:20:07 +00:00
Copyright (C) 1997-2001 Id Software, Inc.
This file is part of Quake 2 source code.
2019-03-13 19:20:07 +00:00
Quake 2 source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
2019-03-13 19:20:07 +00:00
Quake 2 source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
2019-03-13 19:20:07 +00:00
You should have received a copy of the GNU General Public License
along with Quake 2 source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
2019-03-13 19:20:07 +00:00
*/
// menu_options_effects.c -- the effects options menu
2019-03-13 19:20:07 +00:00
#include <ctype.h>
#ifdef _WIN32
#include <io.h>
#endif
#include "../client/client.h"
#include "ui_local.h"
/*
=======================================================================
EFFECTS MENU
=======================================================================
*/
static menuframework_s s_options_effects_menu;
static menuseparator_s s_options_effects_header;
static menulist_s s_options_effects_blood_box;
static menulist_s s_options_effects_oldexplosions_box;
static menulist_s s_options_effects_plasmaexplosound_box;
static menulist_s s_options_effects_itembob_box;
static menuslider_s s_options_effects_decal_slider;
static menuslider_s s_options_effects_particle_comp_slider;
static menulist_s s_options_effects_railtrail_box;
static menuslider_s s_options_effects_railcolor_slider[3];
static menulist_s s_options_effects_footstep_box;
static menuaction_s s_options_effects_defaults_action;
static menuaction_s s_options_effects_back_action;
//=======================================================================
2019-03-13 19:20:07 +00:00
static void BloodFunc (void *unused)
2019-03-13 19:20:07 +00:00
{
UI_MenuSpinControl_SaveValue (&s_options_effects_blood_box, "cl_blood");
2019-03-13 19:20:07 +00:00
}
static void OldExplosionFunc (void *unused)
2019-03-13 19:20:07 +00:00
{
UI_MenuSpinControl_SaveValue (&s_options_effects_oldexplosions_box, "cl_old_explosions");
2019-03-13 19:20:07 +00:00
}
static void PlasmaExploSoundFunc (void *unused)
2019-03-13 19:20:07 +00:00
{
UI_MenuSpinControl_SaveValue (&s_options_effects_plasmaexplosound_box, "cl_plasma_explo_sound");
2019-03-13 19:20:07 +00:00
}
static void ItemBobFunc (void *unused)
2019-03-13 19:20:07 +00:00
{
UI_MenuSpinControl_SaveValue (&s_options_effects_itembob_box, "cl_item_bobbing");
2019-03-13 19:20:07 +00:00
}
static void ParticleCompFunc (void *unused)
2019-03-13 19:20:07 +00:00
{
UI_MenuSlider_SaveValue (&s_options_effects_particle_comp_slider, "cl_particle_scale");
2019-03-13 19:20:07 +00:00
}
static void DecalCallback (void *unused)
2019-03-13 19:20:07 +00:00
{
UI_MenuSlider_SaveValue (&s_options_effects_decal_slider, "r_decals");
2019-03-13 19:20:07 +00:00
}
// Psychospaz's changeable rail trail
static void RailTrailFunc (void *unused)
2019-03-13 19:20:07 +00:00
{
UI_MenuSpinControl_SaveValue (&s_options_effects_railtrail_box, "cl_railtype");
2019-03-13 19:20:07 +00:00
}
static void RailColorRedFunc (void *unused)
2019-03-13 19:20:07 +00:00
{
UI_MenuSlider_SaveValue (&s_options_effects_railcolor_slider[0], "cl_railred");
2019-03-13 19:20:07 +00:00
}
static void RailColorGreenFunc (void *unused)
2019-03-13 19:20:07 +00:00
{
UI_MenuSlider_SaveValue (&s_options_effects_railcolor_slider[1], "cl_railgreen");
2019-03-13 19:20:07 +00:00
}
static void RailColorBlueFunc (void *unused)
2019-03-13 19:20:07 +00:00
{
UI_MenuSlider_SaveValue (&s_options_effects_railcolor_slider[2], "cl_railblue");
2019-03-13 19:20:07 +00:00
}
// foostep override option
static void FootStepFunc (void *unused)
2019-03-13 19:20:07 +00:00
{
UI_MenuSpinControl_SaveValue (&s_options_effects_footstep_box, "cl_footstep_override");
2019-03-13 19:20:07 +00:00
}
//=======================================================================
static void M_EffectsSetMenuItemValues (void)
2019-03-13 19:20:07 +00:00
{
UI_MenuSpinControl_SetValue (&s_options_effects_blood_box, "cl_blood", 0, 4, true);
2019-03-13 19:20:07 +00:00
UI_MenuSpinControl_SetValue (&s_options_effects_oldexplosions_box, "cl_old_explosions", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_options_effects_plasmaexplosound_box, "cl_plasma_explo_sound", 0, 1, true);
UI_MenuSpinControl_SetValue (&s_options_effects_itembob_box, "cl_item_bobbing", 0, 1, true);
2019-03-13 19:20:07 +00:00
UI_MenuSlider_SetValue (&s_options_effects_decal_slider, "r_decals", 0, 1000, true);
UI_MenuSlider_SetValue (&s_options_effects_particle_comp_slider, "cl_particle_scale", 1, 5, true);
2019-03-13 19:20:07 +00:00
UI_MenuSpinControl_SetValue (&s_options_effects_railtrail_box, "cl_railtype", 0, 2, true);
UI_MenuSlider_SetValue (&s_options_effects_railcolor_slider[0], "cl_railred", 0, 256, true);
UI_MenuSlider_SetValue (&s_options_effects_railcolor_slider[1], "cl_railgreen", 0, 256, true);
UI_MenuSlider_SetValue (&s_options_effects_railcolor_slider[2], "cl_railblue", 0, 256, true);
2019-03-13 19:20:07 +00:00
UI_MenuSpinControl_SetValue (&s_options_effects_footstep_box, "cl_footstep_override", 0, 1, true);
2019-03-13 19:20:07 +00:00
}
static void M_EffectsResetDefaultsFunc (void *unused)
2019-03-13 19:20:07 +00:00
{
Cvar_SetToDefault ("cl_blood");
Cvar_SetToDefault ("cl_old_explosions");
Cvar_SetToDefault ("cl_plasma_explo_sound");
Cvar_SetToDefault ("cl_item_bobbing");
Cvar_SetToDefault ("r_decals");
Cvar_SetToDefault ("cl_particle_scale");
Cvar_SetToDefault ("cl_railtype");
Cvar_SetToDefault ("cl_railred");
Cvar_SetToDefault ("cl_railgreen");
Cvar_SetToDefault ("cl_railblue");
Cvar_SetToDefault ("cl_footstep_override");
M_EffectsSetMenuItemValues ();
2019-03-13 19:20:07 +00:00
}
//=======================================================================
void Options_Effects_MenuInit (void)
2019-03-13 19:20:07 +00:00
{
static const char *yesno_names[] =
{
"no",
"yes",
0
};
static const char *blood_names[] =
{
"none",
"puff",
"splat",
"bleed",
"gore",
0
};
static const char *railtrail_names[] =
{
"colored spiral",
"colored beam", // laser
2019-03-13 19:20:07 +00:00
"colored devrail",
0
};
int y = 3*MENU_LINE_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_menu.x = SCREEN_WIDTH*0.5;
s_options_effects_menu.y = SCREEN_HEIGHT*0.5 - 58;
s_options_effects_menu.nitems = 0;
s_options_effects_header.generic.type = MTYPE_SEPARATOR;
s_options_effects_header.generic.textSize = MENU_HEADER_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_header.generic.name = "Effects";
2020-07-29 10:05:09 +00:00
s_options_effects_header.generic.x = MENU_HEADER_FONT_SIZE/2 * (int)strlen(s_options_effects_header.generic.name);
s_options_effects_header.generic.y = -2*MENU_LINE_SIZE; // 0
2019-03-13 19:20:07 +00:00
s_options_effects_blood_box.generic.type = MTYPE_SPINCONTROL;
s_options_effects_blood_box.generic.textSize = MENU_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_blood_box.generic.x = 0;
s_options_effects_blood_box.generic.y = y;
s_options_effects_blood_box.generic.name = "blood type";
s_options_effects_blood_box.generic.callback = BloodFunc;
s_options_effects_blood_box.itemNames = blood_names;
2019-03-13 19:20:07 +00:00
s_options_effects_blood_box.generic.statusbar = "changes blood effect type";
s_options_effects_oldexplosions_box.generic.type = MTYPE_SPINCONTROL;
s_options_effects_oldexplosions_box.generic.textSize = MENU_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_oldexplosions_box.generic.x = 0;
s_options_effects_oldexplosions_box.generic.y = y += 2*MENU_LINE_SIZE;
s_options_effects_oldexplosions_box.generic.name = "old style explosions";
s_options_effects_oldexplosions_box.generic.callback = OldExplosionFunc;
s_options_effects_oldexplosions_box.itemNames = yesno_names;
2019-03-13 19:20:07 +00:00
s_options_effects_oldexplosions_box.generic.statusbar = "brings back those cheesy model explosions";
s_options_effects_plasmaexplosound_box.generic.type = MTYPE_SPINCONTROL;
s_options_effects_plasmaexplosound_box.generic.textSize = MENU_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_plasmaexplosound_box.generic.x = 0;
s_options_effects_plasmaexplosound_box.generic.y = y += MENU_LINE_SIZE;
s_options_effects_plasmaexplosound_box.generic.name = "unique plasma explode sound";
s_options_effects_plasmaexplosound_box.generic.callback = PlasmaExploSoundFunc;
s_options_effects_plasmaexplosound_box.itemNames = yesno_names;
2019-03-13 19:20:07 +00:00
s_options_effects_plasmaexplosound_box.generic.statusbar = "gives Phalanx Cannon plasma explosions a unique sound";
s_options_effects_itembob_box.generic.type = MTYPE_SPINCONTROL;
s_options_effects_itembob_box.generic.textSize = MENU_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_itembob_box.generic.x = 0;
s_options_effects_itembob_box.generic.y = y += MENU_LINE_SIZE;
s_options_effects_itembob_box.generic.name = "item bobbing";
s_options_effects_itembob_box.generic.callback = ItemBobFunc;
s_options_effects_itembob_box.itemNames = yesno_names;
2019-03-13 19:20:07 +00:00
s_options_effects_itembob_box.generic.statusbar = "adds bobbing effect to rotating items";
s_options_effects_decal_slider.generic.type = MTYPE_SLIDER;
s_options_effects_decal_slider.generic.textSize = MENU_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_decal_slider.generic.x = 0;
s_options_effects_decal_slider.generic.y = y += 2*MENU_LINE_SIZE;
s_options_effects_decal_slider.generic.name = "decal quantity";
s_options_effects_decal_slider.generic.callback = DecalCallback;
s_options_effects_decal_slider.maxPos = 20;
s_options_effects_decal_slider.baseValue = 0.0f;
s_options_effects_decal_slider.increment = 50.0f;
s_options_effects_decal_slider.displayAsPercent = false;
2019-03-13 19:20:07 +00:00
s_options_effects_decal_slider.generic.statusbar = "how many decals to display at once (max = 1000)";
s_options_effects_particle_comp_slider.generic.type = MTYPE_SLIDER;
s_options_effects_particle_comp_slider.generic.textSize = MENU_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_particle_comp_slider.generic.x = 0;
s_options_effects_particle_comp_slider.generic.y = y += MENU_LINE_SIZE;
s_options_effects_particle_comp_slider.generic.name = "particle effect complexity";
s_options_effects_particle_comp_slider.generic.callback = ParticleCompFunc;
s_options_effects_particle_comp_slider.maxPos = 4;
s_options_effects_particle_comp_slider.baseValue = 5.0f;
s_options_effects_particle_comp_slider.increment = -1.0f;
s_options_effects_particle_comp_slider.displayAsPercent = false;
2019-03-13 19:20:07 +00:00
s_options_effects_particle_comp_slider.generic.statusbar = "lower = faster performance";
// Psychospaz's changeable rail trail
s_options_effects_railtrail_box.generic.type = MTYPE_SPINCONTROL;
s_options_effects_railtrail_box.generic.textSize = MENU_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_railtrail_box.generic.x = 0;
s_options_effects_railtrail_box.generic.y = y += 2*MENU_LINE_SIZE;
s_options_effects_railtrail_box.generic.name = "rail trail type";
2019-03-13 19:20:07 +00:00
s_options_effects_railtrail_box.generic.callback = RailTrailFunc;
s_options_effects_railtrail_box.itemNames = railtrail_names;
2019-03-13 19:20:07 +00:00
s_options_effects_railtrail_box.generic.statusbar = "changes railgun particle effect";
s_options_effects_railcolor_slider[0].generic.type = MTYPE_SLIDER;
s_options_effects_railcolor_slider[0].generic.textSize = MENU_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_railcolor_slider[0].generic.x = 0;
s_options_effects_railcolor_slider[0].generic.y = y += MENU_LINE_SIZE;
s_options_effects_railcolor_slider[0].generic.name = "rail trail: red";
2019-03-13 19:20:07 +00:00
s_options_effects_railcolor_slider[0].generic.callback = RailColorRedFunc;
s_options_effects_railcolor_slider[0].maxPos = 64;
s_options_effects_railcolor_slider[0].baseValue = 0.0f;
s_options_effects_railcolor_slider[0].increment = 4.0f;
s_options_effects_railcolor_slider[0].displayAsPercent = false;
s_options_effects_railcolor_slider[0].generic.statusbar = "changes railgun particle effect red component";
2019-03-13 19:20:07 +00:00
s_options_effects_railcolor_slider[1].generic.type = MTYPE_SLIDER;
s_options_effects_railcolor_slider[1].generic.textSize = MENU_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_railcolor_slider[1].generic.x = 0;
s_options_effects_railcolor_slider[1].generic.y = y += MENU_LINE_SIZE;
s_options_effects_railcolor_slider[1].generic.name = "rail trail: green";
2019-03-13 19:20:07 +00:00
s_options_effects_railcolor_slider[1].generic.callback = RailColorGreenFunc;
s_options_effects_railcolor_slider[1].maxPos = 64;
s_options_effects_railcolor_slider[1].baseValue = 0.0f;
s_options_effects_railcolor_slider[1].increment = 4.0f;
s_options_effects_railcolor_slider[1].displayAsPercent = false;
s_options_effects_railcolor_slider[1].generic.statusbar = "changes railgun particle effect green component";
2019-03-13 19:20:07 +00:00
s_options_effects_railcolor_slider[2].generic.type = MTYPE_SLIDER;
s_options_effects_railcolor_slider[2].generic.textSize = MENU_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_railcolor_slider[2].generic.x = 0;
s_options_effects_railcolor_slider[2].generic.y = y += MENU_LINE_SIZE;
s_options_effects_railcolor_slider[2].generic.name = "rail trail: blue";
2019-03-13 19:20:07 +00:00
s_options_effects_railcolor_slider[2].generic.callback = RailColorBlueFunc;
s_options_effects_railcolor_slider[2].maxPos = 64;
s_options_effects_railcolor_slider[2].baseValue = 0.0f;
s_options_effects_railcolor_slider[2].increment = 4.0f;
s_options_effects_railcolor_slider[2].displayAsPercent = false;
s_options_effects_railcolor_slider[2].generic.statusbar = "changes railgun particle effect blue component";
2019-03-13 19:20:07 +00:00
// foostep override option
s_options_effects_footstep_box.generic.type = MTYPE_SPINCONTROL;
s_options_effects_footstep_box.generic.textSize = MENU_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_footstep_box.generic.x = 0;
s_options_effects_footstep_box.generic.y = y += 2*MENU_LINE_SIZE;
s_options_effects_footstep_box.generic.name = "override footstep sounds";
s_options_effects_footstep_box.generic.callback = FootStepFunc;
s_options_effects_footstep_box.itemNames = yesno_names;
2019-03-13 19:20:07 +00:00
s_options_effects_footstep_box.generic.statusbar = "sets footstep sounds with definitions in texsurfs.txt";
s_options_effects_defaults_action.generic.type = MTYPE_ACTION;
s_options_effects_defaults_action.generic.textSize = MENU_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_defaults_action.generic.x = MENU_FONT_SIZE;
s_options_effects_defaults_action.generic.y = y += 2*MENU_LINE_SIZE;
s_options_effects_defaults_action.generic.name = "Reset to Defaults";
s_options_effects_defaults_action.generic.callback = M_EffectsResetDefaultsFunc;
2019-03-13 19:20:07 +00:00
s_options_effects_defaults_action.generic.statusbar = "resets all effects settings to internal defaults";
s_options_effects_back_action.generic.type = MTYPE_ACTION;
s_options_effects_back_action.generic.textSize = MENU_FONT_SIZE;
2019-03-13 19:20:07 +00:00
s_options_effects_back_action.generic.x = MENU_FONT_SIZE;
s_options_effects_back_action.generic.y = y += 2*MENU_LINE_SIZE;
s_options_effects_back_action.generic.name = "Back to Options";
2019-03-13 19:20:07 +00:00
s_options_effects_back_action.generic.callback = UI_BackMenu;
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_header);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_blood_box);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_oldexplosions_box);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_plasmaexplosound_box);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_itembob_box);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_decal_slider);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_particle_comp_slider);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_railtrail_box);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_railcolor_slider[0]);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_railcolor_slider[1]);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_railcolor_slider[2]);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_footstep_box);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_defaults_action);
UI_AddMenuItem (&s_options_effects_menu, (void *) &s_options_effects_back_action);
M_EffectsSetMenuItemValues ();
2019-03-13 19:20:07 +00:00
}
void Menu_Options_Effects_Draw (void)
2019-03-13 19:20:07 +00:00
{
UI_DrawBanner ("m_banner_options");
2019-03-13 19:20:07 +00:00
UI_AdjustMenuCursor (&s_options_effects_menu, 1);
UI_DrawMenu (&s_options_effects_menu);
2019-03-13 19:20:07 +00:00
}
const char *Menu_Options_Effects_Key (int key)
2019-03-13 19:20:07 +00:00
{
return UI_DefaultMenuKey (&s_options_effects_menu, key);
2019-03-13 19:20:07 +00:00
}
void Menu_Options_Effects_f (void)
2019-03-13 19:20:07 +00:00
{
Options_Effects_MenuInit ();
UI_PushMenu (Menu_Options_Effects_Draw, Menu_Options_Effects_Key);
2019-03-13 19:20:07 +00:00
}