2002-01-30 20:02:15 +00:00
|
|
|
#define MIN_GAMMA 0.4
|
|
|
|
#define MAX_GAMMA 3
|
|
|
|
#define GAMMA_STEP 0.1
|
2002-01-29 19:04:24 +00:00
|
|
|
|
2002-02-02 12:43:14 +00:00
|
|
|
#define MIN_VIEWSIZE 30
|
|
|
|
#define MAX_VIEWSIZE 120
|
|
|
|
#define VIEWSIZE_STEP 10
|
2002-01-31 21:10:43 +00:00
|
|
|
|
2002-02-02 12:43:14 +00:00
|
|
|
#define MIN_MOUSE_AMP 0
|
|
|
|
#define MAX_MOUSE_AMP 60
|
|
|
|
#define MOUSE_AMP_STEP 2
|
2002-02-02 08:06:50 +00:00
|
|
|
|
2002-02-02 12:43:14 +00:00
|
|
|
#define MIN_VOLUME 0
|
|
|
|
#define MAX_VOLUME 1.5
|
|
|
|
#define VOLUME_STEP 0.1
|
2002-02-02 08:06:50 +00:00
|
|
|
|
2002-02-02 12:43:14 +00:00
|
|
|
//**** VIDEO OPTIONS
|
2002-02-01 17:32:40 +00:00
|
|
|
|
2002-02-02 08:06:50 +00:00
|
|
|
integer (string text, integer key) video_options_f =
|
2002-01-29 19:04:24 +00:00
|
|
|
{
|
2002-02-02 08:06:50 +00:00
|
|
|
local integer selected_crosshair;
|
2002-02-02 12:43:14 +00:00
|
|
|
local float val;
|
2002-02-02 08:06:50 +00:00
|
|
|
|
2002-01-29 19:04:24 +00:00
|
|
|
switch (text) {
|
2002-02-02 08:06:50 +00:00
|
|
|
case "fullscreen":
|
|
|
|
Cbuf_AddText ("toggle vid_fullscreen\n");
|
2002-02-01 17:32:40 +00:00
|
|
|
break;
|
2002-02-02 08:06:50 +00:00
|
|
|
case "crosshair":
|
|
|
|
selected_crosshair = ftoi(cvar("crosshair"));
|
|
|
|
selected_crosshair++;
|
|
|
|
if(selected_crosshair >= 3) {
|
|
|
|
selected_crosshair = 0;
|
2002-01-31 21:10:43 +00:00
|
|
|
}
|
2002-02-02 08:06:50 +00:00
|
|
|
cvar_set("crosshair", itos(selected_crosshair));
|
2002-01-31 21:10:43 +00:00
|
|
|
break;
|
2002-02-02 12:43:14 +00:00
|
|
|
case "fps":
|
|
|
|
Cbuf_AddText ("toggle show_fps\n");
|
|
|
|
break;
|
|
|
|
case "time":
|
|
|
|
Cbuf_AddText ("toggle show_time\n");
|
|
|
|
break;
|
2002-02-02 13:19:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!(key == QFK_RIGHT || key == QFK_LEFT )) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
switch (text) {
|
2002-02-02 12:43:14 +00:00
|
|
|
case "gamma":
|
|
|
|
val = cvar("vid_gamma");
|
2002-02-02 13:19:05 +00:00
|
|
|
val = min_max_cnt(MIN_GAMMA, MAX_GAMMA, GAMMA_STEP, val, (key == QFK_RIGHT) && (key != QFK_LEFT));
|
2002-02-02 12:43:14 +00:00
|
|
|
cvar_set("vid_gamma", ftos(val));
|
|
|
|
break;
|
|
|
|
case "viewsize":
|
|
|
|
val = cvar("viewsize");
|
2002-02-02 13:19:05 +00:00
|
|
|
val = min_max_cnt(MIN_VIEWSIZE, MAX_VIEWSIZE, VIEWSIZE_STEP, val, (key == QFK_RIGHT) && (key != QFK_LEFT));
|
2002-02-02 12:43:14 +00:00
|
|
|
cvar_set("viewsize", ftos(val));
|
|
|
|
break;
|
2002-01-29 19:04:24 +00:00
|
|
|
}
|
2002-02-01 17:32:40 +00:00
|
|
|
return 0;
|
2002-01-29 19:04:24 +00:00
|
|
|
};
|
|
|
|
|
2002-02-02 08:06:50 +00:00
|
|
|
integer () options_video_draw =
|
2002-01-30 20:02:15 +00:00
|
|
|
{
|
2002-02-02 08:06:50 +00:00
|
|
|
local string tmp = ftos(cvar("crosshair"));
|
2002-02-02 09:38:25 +00:00
|
|
|
local integer spacing = 120;
|
2002-02-02 12:43:14 +00:00
|
|
|
local integer bar_pad;
|
2002-02-02 09:38:25 +00:00
|
|
|
|
2002-02-02 08:06:50 +00:00
|
|
|
Draw_Pic (16, 4, "gfx/qplaque.lmp");
|
|
|
|
Draw_CenterPic (160, 4, "gfx/p_option.lmp");
|
|
|
|
Draw_String (54, 40, "Video");
|
|
|
|
Draw_String (54, 50, "-----");
|
2002-02-02 09:38:25 +00:00
|
|
|
draw_val_item (70, 60, spacing, "Fullscreen", get_cvar_state ("vid_fullscreen"));
|
|
|
|
draw_val_item (70, 70, spacing, "Crosshair", tmp);
|
2002-02-02 12:43:14 +00:00
|
|
|
draw_val_item (70, 80, spacing, "Show fps", get_cvar_state ("show_fps"));
|
|
|
|
draw_val_item (70, 90, spacing, "Show time", get_cvar_state ("show_time"));
|
|
|
|
bar_pad = 90;
|
2002-01-30 20:02:15 +00:00
|
|
|
|
2002-02-02 12:43:14 +00:00
|
|
|
Draw_String (70, bar_pad + 10, "Gamma:");
|
|
|
|
draw_perc_bar (118, bar_pad + 10, 15, to_percentage (MIN_GAMMA, MAX_GAMMA, cvar("vid_gamma")));
|
|
|
|
Draw_String (118 + (15 + 4)*8 , bar_pad + 10, ftos(cvar("vid_gamma")));
|
|
|
|
|
|
|
|
Draw_String (70, bar_pad + 20, "Viewsize:");
|
|
|
|
draw_perc_bar (142, bar_pad + 20, 12, to_percentage (MIN_VIEWSIZE, MAX_VIEWSIZE, cvar("viewsize")));
|
|
|
|
Draw_String (142 + (12 + 4)*8 , bar_pad + 20, ftos(cvar("viewsize")));
|
2002-02-02 09:38:25 +00:00
|
|
|
|
2002-02-02 08:06:50 +00:00
|
|
|
opt_cursor (62, (Menu_GetIndex() * 10) + 60);
|
|
|
|
return 1;
|
2002-01-31 21:10:43 +00:00
|
|
|
};
|
|
|
|
|
2002-02-02 08:06:50 +00:00
|
|
|
void () options_video_menu =
|
2002-01-31 21:10:43 +00:00
|
|
|
{
|
2002-02-02 12:43:14 +00:00
|
|
|
local integer bar_pad;
|
|
|
|
|
2002-02-02 08:06:50 +00:00
|
|
|
Menu_Begin (54, 50, "Video");
|
|
|
|
Menu_FadeScreen (1);
|
|
|
|
Menu_Draw (options_video_draw);
|
2002-01-31 21:10:43 +00:00
|
|
|
|
2002-02-02 08:06:50 +00:00
|
|
|
Menu_Item (54, 60, "fullscreen", video_options_f, 0);
|
|
|
|
Menu_Item (54, 70, "crosshair", video_options_f, 0);
|
2002-02-02 12:43:14 +00:00
|
|
|
Menu_Item (54, 80, "fps", video_options_f, 0);
|
|
|
|
Menu_Item (54, 80, "time", video_options_f, 0);
|
|
|
|
bar_pad = 90;
|
|
|
|
|
|
|
|
Menu_Item (54, bar_pad + 10, "gamma", video_options_f, 1);
|
|
|
|
Menu_Item (54, bar_pad + 20, "viewsize", video_options_f, 1);
|
2002-02-02 08:06:50 +00:00
|
|
|
Menu_End ();
|
2002-01-31 21:10:43 +00:00
|
|
|
};
|
|
|
|
|
2002-02-02 12:43:14 +00:00
|
|
|
//**** AUDIO OPTIONS
|
|
|
|
|
|
|
|
integer (string text, integer key) audio_volume_f =
|
|
|
|
{
|
|
|
|
local float volume;
|
|
|
|
|
|
|
|
volume = cvar("volume");
|
|
|
|
if(key == QFK_RIGHT) {
|
|
|
|
volume += VOLUME_STEP;
|
|
|
|
} else if(key == QFK_LEFT) {
|
|
|
|
volume -= VOLUME_STEP;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(volume > MAX_VOLUME) {
|
|
|
|
volume = MIN_VOLUME;
|
|
|
|
} else if(volume < MIN_VOLUME) {
|
|
|
|
volume = MAX_VOLUME;
|
|
|
|
}
|
|
|
|
cvar_set("volume", ftos(volume));
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
integer () options_audio_draw =
|
|
|
|
{
|
|
|
|
local string tmp = ftos(cvar("crosshair"));
|
|
|
|
local integer spacing = 120;
|
|
|
|
local integer bar_pad;
|
|
|
|
|
|
|
|
Draw_Pic (16, 4, "gfx/qplaque.lmp");
|
|
|
|
Draw_CenterPic (160, 4, "gfx/p_option.lmp");
|
|
|
|
Draw_String (54, 40, "Audio");
|
|
|
|
Draw_String (54, 50, "-----");
|
|
|
|
bar_pad = 50;
|
|
|
|
|
|
|
|
Draw_String (70, bar_pad + 10, "Volume:");
|
|
|
|
draw_perc_bar (126, bar_pad + 10, 15, to_percentage (MIN_VOLUME, MAX_VOLUME, cvar("volume")));
|
|
|
|
Draw_String (126 + (15 + 4)*8 , bar_pad + 10, ftos(cvar("volume")));
|
|
|
|
|
|
|
|
opt_cursor (62, (Menu_GetIndex() * 10) + 60);
|
|
|
|
return 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
void () options_audio_menu =
|
|
|
|
{
|
|
|
|
local integer bar_pad;
|
|
|
|
|
|
|
|
Menu_Begin (54, 60, "Audio");
|
|
|
|
Menu_FadeScreen (1);
|
|
|
|
Menu_Draw (options_audio_draw);
|
|
|
|
|
|
|
|
bar_pad = 0;
|
|
|
|
Menu_Item (54, bar_pad + 10, "volume", audio_volume_f, 1);
|
|
|
|
Menu_End ();
|
|
|
|
};
|
2002-01-31 21:10:43 +00:00
|
|
|
|
2002-02-02 08:06:50 +00:00
|
|
|
//**** CONTROL OPTIONS
|
2002-01-31 21:10:43 +00:00
|
|
|
|
2002-02-02 08:06:50 +00:00
|
|
|
integer (string text, integer key) control_options_f =
|
|
|
|
{
|
2002-02-02 12:43:14 +00:00
|
|
|
local float val;
|
|
|
|
|
|
|
|
load_keybindings();
|
|
|
|
|
2002-02-02 08:06:50 +00:00
|
|
|
switch (text) {
|
|
|
|
case "in_grab":
|
|
|
|
Cbuf_AddText ("toggle in_grab\n");
|
2002-02-02 12:43:14 +00:00
|
|
|
break;
|
2002-02-02 08:06:50 +00:00
|
|
|
case "autorun":
|
|
|
|
if(cvar("cl_forwardspeed") < 400) {
|
|
|
|
Cbuf_AddText ("set cl_forwardspeed 400\n");
|
|
|
|
Cbuf_AddText ("set cl_backspeed 400\n");
|
|
|
|
} else {
|
|
|
|
Cbuf_AddText ("set cl_forwardspeed 200\n");
|
|
|
|
Cbuf_AddText ("set cl_backspeed 200\n");
|
|
|
|
}
|
2002-02-02 12:43:14 +00:00
|
|
|
break;
|
|
|
|
case "freelook":
|
|
|
|
Cbuf_AddText ("toggle freelook\n");
|
|
|
|
break;
|
2002-02-25 16:20:43 +00:00
|
|
|
case "m_pitch":
|
|
|
|
if(cvar("m_pitch") < 0) {
|
|
|
|
Cbuf_AddText ("set m_pitch 0.022\n");
|
|
|
|
} else {
|
|
|
|
Cbuf_AddText ("set m_pitch -0.022\n");
|
|
|
|
}
|
|
|
|
break;
|
2002-03-14 18:48:04 +00:00
|
|
|
case "cl_autorecord":
|
2002-03-14 19:41:49 +00:00
|
|
|
Cbuf_AddText ("toggle cl_autorecord\n");
|
|
|
|
break;
|
|
|
|
case "cl_fraglog":
|
|
|
|
Cbuf_AddText ("toggle cl_fraglog\n");
|
|
|
|
break;
|
2002-02-02 13:19:05 +00:00
|
|
|
}
|
|
|
|
if(!(key == QFK_RIGHT || key == QFK_LEFT)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
switch (text) {
|
2002-02-02 12:43:14 +00:00
|
|
|
case "mouseamp":
|
|
|
|
val = cvar("in_mouse_amp");
|
2002-02-02 13:19:05 +00:00
|
|
|
val = min_max_cnt(MIN_MOUSE_AMP, MAX_MOUSE_AMP, MOUSE_AMP_STEP, val, (key == QFK_RIGHT) && (key != QFK_LEFT));
|
2002-02-02 12:43:14 +00:00
|
|
|
cvar_set("in_mouse_amp", ftos(val));
|
|
|
|
break;
|
2002-01-29 19:04:24 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
integer () options_controls_draw =
|
|
|
|
{
|
2002-01-30 20:02:15 +00:00
|
|
|
local string tmp;
|
2002-02-02 12:43:14 +00:00
|
|
|
local integer cursor_pad = 0, spacing = 120, bar_pad;
|
2002-01-31 21:10:43 +00:00
|
|
|
|
2002-01-29 19:04:24 +00:00
|
|
|
|
2002-01-30 20:02:15 +00:00
|
|
|
Draw_Pic (16, 4, "gfx/qplaque.lmp");
|
2002-02-02 09:38:25 +00:00
|
|
|
Draw_CenterPic (160,4, "gfx/p_option.lmp");
|
2002-01-30 20:02:15 +00:00
|
|
|
Draw_String (54, 40, "Controls");
|
|
|
|
Draw_String (54, 50, "--------");
|
2002-02-02 12:43:14 +00:00
|
|
|
Draw_String (70, 60, "Bindings");
|
|
|
|
|
|
|
|
draw_val_item (70, 70, spacing, "Grab mouse", get_cvar_state ("in_grab"));
|
2002-02-25 16:35:01 +00:00
|
|
|
tmp = cvar("cl_forwardspeed") < 400 ? "Off" : "On";
|
2002-02-02 12:43:14 +00:00
|
|
|
draw_val_item (70, 80, spacing, "Auto run", tmp);
|
|
|
|
draw_val_item (70, 90, spacing, "Freelook", get_cvar_state ("freelook"));
|
|
|
|
bar_pad = 90;
|
|
|
|
|
|
|
|
Draw_String (70, bar_pad + 10, "Mouse amp:");
|
|
|
|
draw_perc_bar (150, bar_pad + 10, 12, to_percentage (MIN_MOUSE_AMP, MAX_MOUSE_AMP, cvar("in_mouse_amp")));
|
2002-02-02 13:19:05 +00:00
|
|
|
Draw_String (150 + (12 + 4)*8 , bar_pad + 10, ftos(cvar("in_mouse_amp")));
|
2002-03-14 18:48:04 +00:00
|
|
|
|
2002-02-25 16:35:01 +00:00
|
|
|
tmp = cvar("m_pitch") < 0 ? "On" : "Off";
|
2002-02-25 16:20:43 +00:00
|
|
|
draw_val_item (70, 110, spacing, "Mouse Invert", tmp);
|
2002-01-31 21:10:43 +00:00
|
|
|
|
2002-02-02 09:38:25 +00:00
|
|
|
opt_cursor (62, (Menu_GetIndex() * 10) + 60 + cursor_pad);
|
2002-01-29 19:04:24 +00:00
|
|
|
return 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
void () options_controls_menu =
|
|
|
|
{
|
|
|
|
Menu_Begin (54, 40, "Controls");
|
2002-01-29 22:32:56 +00:00
|
|
|
Menu_FadeScreen (1);
|
2002-01-29 19:04:24 +00:00
|
|
|
Menu_CenterPic (160, 4, "gfx/p_option.lmp");
|
|
|
|
Menu_Draw (options_controls_draw);
|
2002-02-02 08:06:50 +00:00
|
|
|
control_bind_menu ();
|
2002-02-02 12:43:14 +00:00
|
|
|
Menu_Item (54, 70, "in_grab", control_options_f, 0);
|
|
|
|
Menu_Item (54, 80, "autorun", control_options_f, 0);
|
|
|
|
Menu_Item (54, 90, "freelook", control_options_f, 0);
|
|
|
|
Menu_Item (54, 100, "mouseamp", control_options_f, 1);
|
2002-02-25 16:20:43 +00:00
|
|
|
Menu_Item (54, 110, "m_pitch", control_options_f, 0);
|
2002-03-14 18:48:04 +00:00
|
|
|
Menu_Item (54, 120, "cl_autorecord", control_options_f, 0);
|
2002-01-29 19:04:24 +00:00
|
|
|
Menu_End ();
|
|
|
|
};
|
|
|
|
|
2002-03-14 18:48:04 +00:00
|
|
|
integer () options_features_draw =
|
|
|
|
{
|
|
|
|
local string tmp;
|
2002-03-14 18:51:25 +00:00
|
|
|
local integer cursor_pad = 0, spacing = 120;
|
2002-03-14 18:48:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
Draw_Pic (16, 4, "gfx/qplaque.lmp");
|
|
|
|
Draw_CenterPic (160,4, "gfx/p_option.lmp");
|
|
|
|
Draw_String (54, 40, "Features");
|
|
|
|
Draw_String (54, 50, "--------");
|
|
|
|
|
|
|
|
tmp = cvar("cl_autorecord") != 0 ? "On" : "Off";
|
|
|
|
draw_val_item (70, 60, spacing, "Auto Record", tmp);
|
2002-03-14 19:41:49 +00:00
|
|
|
tmp = cvar("cl_fraglog") != 0 ? "On" : "Off";
|
|
|
|
draw_val_item (70, 70, spacing, "Fraglogging", tmp);
|
2002-03-14 18:48:04 +00:00
|
|
|
|
|
|
|
opt_cursor (62, (Menu_GetIndex() * 10) + 60 + cursor_pad);
|
|
|
|
return 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
void () options_features_menu =
|
|
|
|
{
|
|
|
|
Menu_Begin (54, 70, "Features");
|
|
|
|
Menu_FadeScreen (1);
|
|
|
|
Menu_CenterPic (160, 4, "gfx/p_option.lmp");
|
|
|
|
Menu_Draw (options_features_draw);
|
|
|
|
Menu_Item (54, 70, "cl_autorecord", control_options_f, 0);
|
2002-03-14 19:41:49 +00:00
|
|
|
Menu_Item (54, 80, "cl_fraglog", control_options_f, 0);
|
2002-03-14 18:48:04 +00:00
|
|
|
Menu_End ();
|
|
|
|
};
|
2002-01-30 20:02:15 +00:00
|
|
|
|
2002-01-31 21:10:43 +00:00
|
|
|
integer (integer key, integer unicode, integer down) options_keyevent =
|
|
|
|
{
|
2002-02-02 08:06:50 +00:00
|
|
|
// pre-loading of the bindings and set_key_flag == 0
|
|
|
|
load_keybindings();
|
2002-01-31 21:10:43 +00:00
|
|
|
set_key_flag = 0;
|
|
|
|
return 0;
|
|
|
|
};
|
|
|
|
|
2002-02-02 12:43:14 +00:00
|
|
|
//**** MAIN OPTIONS MENU
|
|
|
|
|
2002-01-29 19:04:24 +00:00
|
|
|
void () options_menu =
|
|
|
|
{
|
2002-03-14 18:48:04 +00:00
|
|
|
local integer spacing = 120;
|
|
|
|
|
2002-01-29 19:04:24 +00:00
|
|
|
Menu_Begin (54, 72, "");
|
2002-01-29 22:32:56 +00:00
|
|
|
Menu_FadeScreen (1);
|
2002-01-29 19:04:24 +00:00
|
|
|
Menu_Pic (16, 4, "gfx/qplaque.lmp");
|
|
|
|
Menu_CenterPic (160, 4, "gfx/p_option.lmp");
|
2002-01-31 21:10:43 +00:00
|
|
|
Menu_KeyEvent (options_keyevent);
|
2002-01-29 19:04:24 +00:00
|
|
|
options_controls_menu ();
|
2002-02-02 12:43:14 +00:00
|
|
|
options_video_menu ();
|
|
|
|
options_audio_menu ();
|
2002-03-14 18:48:04 +00:00
|
|
|
options_features_menu ();
|
|
|
|
|
2002-01-29 19:04:24 +00:00
|
|
|
Menu_End ();
|
|
|
|
};
|