*shakes an angry shambler at ugly codingstyle*

This commit is contained in:
Ragnvald Maartmann-Moe IV 2003-03-03 05:24:45 +00:00
parent 3b99b7366f
commit e472c6b935
7 changed files with 294 additions and 313 deletions

View file

@ -336,11 +336,13 @@ integer () lanconfig_draw =
Draw_String (basex + 9 * 8, lanConfig_cursor_table[0], lanConfig_portname);
if (JoiningGame) {
Draw_String (basex, lanConfig_cursor_table[1], "Search for local games...");
Draw_String (basex, lanConfig_cursor_table[1], "Search for local "
"games...");
Draw_String (basex, 108, "Join game at:");
text_box (basex + 8, lanConfig_cursor_table[2] - 8, 22, 1);
[lanConfig_join_il draw:lanConfig_cursor == 2 && input_active];
Draw_String (basex + 16, lanConfig_cursor_table[2], lanConfig_joinname);
Draw_String (basex + 16, lanConfig_cursor_table[2],
lanConfig_joinname);
} else {
text_box (basex, lanConfig_cursor_table[1] - 8, 2, 1);
Draw_String (basex + 8, lanConfig_cursor_table[1], "OK");

View file

@ -53,12 +53,11 @@ init_binding_hash =
DESIGN NOTES for the Menu:
binding config is loaded into hashes.
the key of the hash is the string, which will
be displayed as binding description.
The first value of the key is the command, which
is bound.
The second valu (loaded later) of the hash
will be the keyname. (see get_hash_keys())
the key of the hash is the string, which will be displayed as binding
description.
The first value of the key is the command, which is bound.
The second value (loaded later) of the hash will be the keyname.
(see get_hash_keys())
*/
// Movement keys
@ -99,18 +98,15 @@ init_binding_hash =
StringHash_Set (weapon_binding_hash, "Grenade L. ", "impulse 6", 0);
StringHash_Set (weapon_binding_hash, "Rocket L. ", "impulse 7", 0);
StringHash_Set (weapon_binding_hash, "Thunderbolt", "impulse 8", 0);
};
/*
get_keyname
Gets the string of the key, which is bound
to a special binding.
Gets the string of the key, which is bound to a special binding.
bindnum is the number of the binding.
As a command/binding can be bound to many keys,
you can get the second, third, etc. key by giving
the bindnum.
As a command/binding can be bound to many keys, you can get the second,
third, etc. key by giving the bindnum.
*/
string (string binding, integer bindnum)
get_keyname =
@ -166,7 +162,6 @@ load_keybindings =
get_hash_keys (weapon_binding_hash);
};
/*******************
* BINDINGS OPTIONS
* Binding settings
@ -175,18 +170,17 @@ load_keybindings =
/*
DESIGN NOTE (by elmex):
Every sub-menu for control bindings
has its own hash for holding the keybindings.
Thats why there are three different functions, which
shadow the CB_MAIN_control_binding() function.
They get the binding from the correct hash.
Every sub-menu for control bindings has its own hash for holding the
keybindings. Thats why there are three different functions, which shadow
the CB_MAIN_control_binding() function. They get the binding from the
correct hash.
*/
/*
CB_MAIN_control_binding
The core function of all control_binding function.
Its taking the binding as argument.
It takes the binding as argument.
This function is called by the real callbacks.
*/
integer (string binding, integer key)
@ -231,7 +225,8 @@ CB_MAIN_control_binding =
integer (string text, integer key)
CB_basic_control_binding =
{
local string binding = StringHash_GetIdx(movement_binding_hash, stoi(text), 0);
local string binding = StringHash_GetIdx (movement_binding_hash,
stoi (text), 0);
local integer ret = CB_MAIN_control_binding (binding, key);
// fetch all keynames (possible to optimize.. but not very neccessary)
@ -239,12 +234,10 @@ CB_basic_control_binding =
return ret;
};
/*
CB_ME_basic_control_binding
Loading basic keynames when entering the
menu
Loading basic keynames when entering the menu
*/
integer ()
CB_ME_basic_control_binding =
@ -260,8 +253,7 @@ CB_ME_basic_control_binding =
integer ()
DRAW_basic_control_binding =
{
local integer cursor_pad = 40, bind_desc_pad;
local integer i, hl;
local integer cursor_pad = 40, bind_desc_pad, hl, i;
bind_desc_pad = 120;
@ -303,7 +295,6 @@ MENU_basic_control_binding =
Menu_End ();
};
/*
CB_misc_control_binding
@ -312,7 +303,8 @@ MENU_basic_control_binding =
integer (string text, integer key)
CB_misc_control_binding =
{
local string binding = StringHash_GetIdx(misc_binding_hash, stoi(text), 0);
local string binding = StringHash_GetIdx (misc_binding_hash, stoi (text),
0);
local integer ret = CB_MAIN_control_binding (binding, key);
// fetch all keynames (possible to optimize.. but not very neccessary)
@ -323,8 +315,7 @@ CB_misc_control_binding =
/*
CB_ME_misc_control_binding
Loading misc keynames when entering the
menu
Loading misc keynames when entering the menu
*/
integer ()
CB_ME_misc_control_binding =
@ -359,8 +350,6 @@ DRAW_misc_control_binding =
return 1;
};
/*
MENU_misc_control_binding
@ -369,7 +358,7 @@ DRAW_misc_control_binding =
void ()
MENU_misc_control_binding =
{
local integer i,hl;
local integer hl, i;
Menu_Begin (54, 50, "Misc bindings");
Menu_FadeScreen (1);
@ -391,7 +380,8 @@ MENU_misc_control_binding =
integer (string text, integer key)
CB_weapon_control_binding =
{
local string binding = StringHash_GetIdx(weapon_binding_hash, stoi(text),0);
local string binding = StringHash_GetIdx (weapon_binding_hash, stoi (text),
0);
local integer ret = CB_MAIN_control_binding (binding, key);
// fetch all keynames (possible to optimize.. but not very neccessary)
@ -419,8 +409,7 @@ CB_ME_weapon_control_binding =
integer ()
DRAW_weapon_control_binding =
{
local integer cursor_pad = 40, bind_desc_pad;
local integer i,hl;
local integer cursor_pad = 40, bind_desc_pad, hl, i;
bind_desc_pad = 120;
@ -439,7 +428,6 @@ DRAW_weapon_control_binding =
return 1;
};
/*
MENU_weapon_control_binding
@ -448,7 +436,7 @@ DRAW_weapon_control_binding =
void ()
MENU_weapon_control_binding =
{
local integer i,hl;
local integer hl, i;
Menu_Begin (54, 60, "Weapon bindings");
Menu_FadeScreen (1);
@ -484,4 +472,3 @@ MENU_control_binding =
Menu_End ();
};

View file

@ -7,12 +7,17 @@
@extern void (integer () func) Menu_EnterHook;
@extern void (integer () func) Menu_LeaveHook;
@extern void (integer x, integer y, string name) Menu_Pic;
@extern void (integer x, integer y, string name, integer srcx, integer srcy, integer width, integer height) Menu_SubPic;
@extern void (integer x, integer y, string name, integer srcx, integer srcy,
integer width, integer height) Menu_SubPic;
@extern void (integer x, integer y, string name) Menu_CenterPic;
@extern void (integer x, integer y, string name, integer srcx, integer srcy, integer width, integer height) Menu_CenterSubPic;
@extern void (integer x, integer y, string text, integer (string text, integer key) func, integer allkeys) Menu_Item;
@extern void (integer x, integer y, string name, integer srcx, integer srcy,
integer width, integer height) Menu_CenterSubPic;
@extern void (integer x, integer y, string text,
integer (string text, integer key) func,
integer allkeys) Menu_Item;
@extern void (void (integer x, integer y) func) Menu_Cursor;
@extern void (integer (integer key, integer unicode, integer down) func) Menu_KeyEvent;
@extern void (integer (integer key, integer unicode, integer down)
func) Menu_KeyEvent;
@extern void () Menu_End;
@extern void (string name) Menu_TopMenu;
@extern void (string name) Menu_SelectMenu;

View file

@ -39,8 +39,7 @@
#include "options_util.h"
/*
some definitions of border values for
different things
some definitions of border values for different things
*/
#define MIN_GAMMA 0.4
#define MAX_GAMMA 3
@ -67,7 +66,6 @@
* Video settings menu code
****************************/
/*
CB_video_options
@ -76,8 +74,8 @@
integer (string text, integer key)
CB_video_options =
{
local integer selected_crosshair;
local float val;
local integer selected_crosshair;
switch (text) {
case "fullscreen":
@ -127,8 +125,7 @@ CB_video_options =
integer ()
DRAW_video_options =
{
local integer spacing = 120;
local integer bar_pad;
local integer bar_pad, spacing = 120;
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_option.lmp", 1));
@ -150,7 +147,8 @@ DRAW_video_options =
Draw_String (70, bar_pad + 20, "Viewsize:");
draw_perc_bar (142, bar_pad + 20, 12,
to_percentage (MIN_VIEWSIZE, MAX_VIEWSIZE, cvar("viewsize")));
to_percentage (MIN_VIEWSIZE, MAX_VIEWSIZE,
cvar ("viewsize")));
Draw_String (142 + (12 + 4) * 8 , bar_pad + 20, ftos (cvar ("viewsize")));
opt_cursor (62, (Menu_GetIndex () * 10) + 60);
@ -217,8 +215,7 @@ integer ()
DRAW_audio_options =
{
local string tmp = ftos (cvar ("crosshair"));
local integer spacing = 120;
local integer bar_pad;
local integer bar_pad, spacing = 120;
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_option.lmp", 1));
@ -335,18 +332,27 @@ DRAW_control_options =
Draw_String (54, 50, "--------");
Draw_String (70, 60, "Bindings");
draw_val_item (70, 70, spacing, "Grab mouse", cvar("in_grab") ? "On" : "Off");
draw_val_item (70, 80, spacing, "Auto run", cvar("cl_forwardspeed") < 400 ? "Off" : "On");
draw_val_item (70, 90, spacing, "Mouse Invert", cvar("m_pitch") < 0 ? "On" : "Off");
draw_val_item (70, 70, spacing, "Grab mouse", cvar ("in_grab") ? "On" :
"Off");
draw_val_item (70, 80, spacing, "Auto run", cvar ("cl_forwardspeed")
< 400 ? "Off" : "On");
draw_val_item (70, 90, spacing, "Mouse Invert", cvar ("m_pitch") < 0 ?
"On" : "Off");
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")));
Draw_String (150 + (12 + 4)*8 , bar_pad + 10, ftos(cvar("in_mouse_amp")));
draw_perc_bar (150, bar_pad + 10, 12,
to_percentage (MIN_MOUSE_AMP, MAX_MOUSE_AMP,
cvar("in_mouse_amp")));
Draw_String (150 + (12 + 4) * 8 , bar_pad + 10,
ftos (cvar ("in_mouse_amp")));
draw_val_item (70, 110, spacing, "Freelook", cvar("freelook") ? "On" : "Off");
draw_val_item (70, 120, spacing, "Lookspring", cvar("lookspring") ? "On" : "Off");
draw_val_item (70, 130, spacing, "Lookstrafe", cvar("lookstrafe") ? "On" : "Off");
draw_val_item (70, 110, spacing, "Freelook", cvar("freelook") ? "On" :
"Off");
draw_val_item (70, 120, spacing, "Lookspring", cvar ("lookspring") ? "On" :
"Off");
draw_val_item (70, 130, spacing, "Lookstrafe", cvar ("lookstrafe") ? "On"
: "Off");
opt_cursor (62, (Menu_GetIndex () * 10) + 60 + cursor_pad);
@ -544,11 +550,9 @@ KEYEV_player_options =
break;
}
return 1;
};
/*
DRAW_player_options
@ -607,7 +611,7 @@ CB_ME_player_options =
playername_cvar = "_cl_name";
}
teamname_cvar = "team"; // FIXME: is this maybe something other in netquake?
teamname_cvar = "team"; // FIXME: is this something else in netquake?
[player_config_plname_il setText:Cvar_GetCvarString (playername_cvar)];
[player_config_tname_il setText:Cvar_GetCvarString (teamname_cvar)];
@ -635,17 +639,16 @@ MENU_player_options =
Menu_End ();
};
/******************************************************************************
/*****************************************************************************
* NETWORK OPTIONS
* Options, which have to do with network stuff (rate, noskins, netgraph, ...)
******************************************************************************/
*****************************************************************************/
// input for playername
InputLine network_config_rate_il;
// this holds active inputline pointer
InputLine network_config_iactive;
integer network_config_cursor;
// Y padding for the player config
@ -707,11 +710,9 @@ KEYEV_network_options =
// switch (network_config_vals[network_config_cursor]) {
// } // none yet
return 1;
};
/*
DRAW_network_options
@ -736,8 +737,6 @@ DRAW_network_options =
return 1;
};
/*
CB_ME_network_options
@ -749,8 +748,6 @@ CB_ME_network_options =
[network_config_rate_il setText:Cvar_GetCvarString("rate")];
};
/*
MENU_network_options

View file

@ -41,13 +41,11 @@ opt_cursor =
Draw_Character (x, y, 12 + (integer) (time * 4) & 1);
};
/*
draw_perc_bar
Draws a percentage bar by giving its size (in
chars), x and y position and the percentage from 0 to 100
Draws a percentage bar by giving its size (in chars),
x and y position and the percentage from 0 to 100
*/
void (integer x, integer y, integer size, integer perc_val)
draw_perc_bar =
@ -72,13 +70,11 @@ draw_perc_bar =
Draw_Character (x + ((ftoi (perc) + 1) * 8), y, 131); // draw slider
};
/*
draw_item
Draws a item with a specific spacing between
label and value to positions x, y.
Draws a item with a specific spacing between label and value to
position x, y.
Used as helper function for draw_val_item.
*/
void (integer x, integer y, integer spacing, string spacechar,
@ -86,6 +82,7 @@ void (integer x, integer y, integer spacing, string spacechar,
draw_item =
{
local integer i;
Draw_String (x, y, label);
for (i = x + String_Len (label) * 8; i < (x+spacing); i += 8) {
Draw_String (i, y, spacechar);
@ -93,7 +90,6 @@ draw_item =
Draw_String (x + spacing, y, valstr);
};
/*
draw_val_item
@ -109,8 +105,6 @@ draw_val_item =
draw_item (x, y, spacing, ".", label, ":" + valstr);
};
/*
to_percentage
@ -120,8 +114,9 @@ draw_val_item =
integer (float min, float max, float val)
to_percentage =
{
local integer perc;
local float max_v = (max - min);
local integer perc;
val -= min;
if (val > max_v) {
@ -135,17 +130,13 @@ to_percentage =
return perc;
};
/*
min_max_cnt
Increases or decreases a value by take
care of the bordervalues.
Increases or decreases a value by take care of the bordervalues.
min, max are the borders.
step is the step by in-/de-creasing.
cntflag should be true for increasing and
false for decreasing
cntflag should be true for increasing and false for decreasing
*/
float (float min, float max, float step, float val, integer cntflag)
min_max_cnt =

View file

@ -106,4 +106,3 @@ void () server_list_menu =
servlist_filter_menu ();
Menu_End ();
};