*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

@ -21,18 +21,18 @@ entity self;
.void () think;
string [6] dot_name = {
"gfx/menudot1.lmp",
"gfx/menudot2.lmp",
"gfx/menudot3.lmp",
"gfx/menudot4.lmp",
"gfx/menudot5.lmp",
"gfx/menudot6.lmp",
"gfx/menudot1.lmp",
"gfx/menudot2.lmp",
"gfx/menudot3.lmp",
"gfx/menudot4.lmp",
"gfx/menudot5.lmp",
"gfx/menudot6.lmp",
};
void (integer x, integer y) spinner =
{
local integer i = (integer) (time * 10) % 6;
local qpic_t p = Draw_CachePic (dot_name[i], 1);
local integer i = (integer) (time * 10) % 6;
local qpic_t p = Draw_CachePic (dot_name[i], 1);
Draw_Pic (x, y, p);
};
@ -93,8 +93,8 @@ integer save_cursor;
void () scan_saves =
{
local integer i;
local QFile f;
local integer i;
local QFile f;
for (i = 0; i < MAX_SAVEGAMES; i++) {
loadable[i] = 0;
filenames[i] = "--- UNUSED SLOT ---";
@ -251,10 +251,10 @@ integer (integer key, integer unicode, integer down) quit_keyevent =
integer () quit_draw =
{
text_box (56, 76, 24, 4);
Draw_String (64, 84, quitMessage[quit_index *4 + 0]);
Draw_String (64, 92, quitMessage[quit_index *4 + 1]);
Draw_String (64, 100, quitMessage[quit_index *4 + 2]);
Draw_String (64, 108, quitMessage[quit_index *4 + 3]);
Draw_String (64, 84, quitMessage[quit_index * 4 + 0]);
Draw_String (64, 92, quitMessage[quit_index * 4 + 1]);
Draw_String (64, 100, quitMessage[quit_index * 4 + 2]);
Draw_String (64, 108, quitMessage[quit_index * 4 + 3]);
return 1;
};
@ -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

@ -9,7 +9,7 @@ string status_bar;
void ()
Con_ClearNotify =
{
local integer i;
local integer i;
for (i = 0; i < NUM_CON_TIMES; i++)
con_times[i] = 0;

View file

@ -53,64 +53,60 @@ 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
movement_binding_hash = StringHash_Create();
StringHash_Set(movement_binding_hash, "Jump/Swin up", "+jump", 0);
StringHash_Set(movement_binding_hash, "Walk forward", "+forward", 0);
StringHash_Set(movement_binding_hash, "Backpedal", "+back", 0);
StringHash_Set(movement_binding_hash, "Turn left", "+left", 0);
StringHash_Set(movement_binding_hash, "Turn right", "+right", 0);
StringHash_Set(movement_binding_hash, "Run", "+speed", 0);
StringHash_Set(movement_binding_hash, "Step left", "+moveleft", 0);
StringHash_Set(movement_binding_hash, "Step right", "+moveright", 0);
StringHash_Set(movement_binding_hash, "Sidestep", "+strafe", 0);
StringHash_Set(movement_binding_hash, "Look up", "+lookup", 0);
StringHash_Set(movement_binding_hash, "Look down", "+lookdown", 0);
StringHash_Set(movement_binding_hash, "Center view", "centerview", 0);
StringHash_Set(movement_binding_hash, "Mouse look", "+mlook", 0);
StringHash_Set(movement_binding_hash, "Keyboard look", "+klook", 0);
StringHash_Set(movement_binding_hash, "Swim up", "+moveup", 0);
StringHash_Set(movement_binding_hash, "Swim down", "+movedown", 0);
movement_binding_hash = StringHash_Create ();
StringHash_Set (movement_binding_hash, "Jump/Swin up", "+jump", 0);
StringHash_Set (movement_binding_hash, "Walk forward", "+forward", 0);
StringHash_Set (movement_binding_hash, "Backpedal", "+back", 0);
StringHash_Set (movement_binding_hash, "Turn left", "+left", 0);
StringHash_Set (movement_binding_hash, "Turn right", "+right", 0);
StringHash_Set (movement_binding_hash, "Run", "+speed", 0);
StringHash_Set (movement_binding_hash, "Step left", "+moveleft", 0);
StringHash_Set (movement_binding_hash, "Step right", "+moveright", 0);
StringHash_Set (movement_binding_hash, "Sidestep", "+strafe", 0);
StringHash_Set (movement_binding_hash, "Look up", "+lookup", 0);
StringHash_Set (movement_binding_hash, "Look down", "+lookdown", 0);
StringHash_Set (movement_binding_hash, "Center view", "centerview", 0);
StringHash_Set (movement_binding_hash, "Mouse look", "+mlook", 0);
StringHash_Set (movement_binding_hash, "Keyboard look", "+klook", 0);
StringHash_Set (movement_binding_hash, "Swim up", "+moveup", 0);
StringHash_Set (movement_binding_hash, "Swim down", "+movedown", 0);
// Misc keys
misc_binding_hash = StringHash_Create();
StringHash_Set(misc_binding_hash, "Pause game", "pause", 0);
StringHash_Set(misc_binding_hash, "Tog. m.-grab", "toggle in_grab", 0);
StringHash_Set(misc_binding_hash, "Messagemode", "messagemode", 0);
StringHash_Set(misc_binding_hash, "Screenshot", "screenshot", 0);
misc_binding_hash = StringHash_Create ();
StringHash_Set (misc_binding_hash, "Pause game", "pause", 0);
StringHash_Set (misc_binding_hash, "Tog. m.-grab", "toggle in_grab", 0);
StringHash_Set (misc_binding_hash, "Messagemode", "messagemode", 0);
StringHash_Set (misc_binding_hash, "Screenshot", "screenshot", 0);
// Weapon keys
weapon_binding_hash = StringHash_Create();
StringHash_Set(weapon_binding_hash, "Attack", "+attack", 0);
StringHash_Set(weapon_binding_hash, "Next weapon", "impulse 10", 0);
StringHash_Set(weapon_binding_hash, "Axe", "impulse 1", 0);
StringHash_Set(weapon_binding_hash, "Shotgun", "impulse 2", 0);
StringHash_Set(weapon_binding_hash, "Super Shotgun", "impulse 3", 0);
StringHash_Set(weapon_binding_hash, "Nailgun", "impulse 4", 0);
StringHash_Set(weapon_binding_hash, "Super Nailgun", "impulse 5", 0);
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);
weapon_binding_hash = StringHash_Create ();
StringHash_Set (weapon_binding_hash, "Attack", "+attack", 0);
StringHash_Set (weapon_binding_hash, "Next weapon", "impulse 10", 0);
StringHash_Set (weapon_binding_hash, "Axe", "impulse 1", 0);
StringHash_Set (weapon_binding_hash, "Shotgun", "impulse 2", 0);
StringHash_Set (weapon_binding_hash, "Super Shotgun", "impulse 3", 0);
StringHash_Set (weapon_binding_hash, "Nailgun", "impulse 4", 0);
StringHash_Set (weapon_binding_hash, "Super Nailgun", "impulse 5", 0);
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 =
@ -141,15 +137,15 @@ get_hash_keys =
local string binding, desc1 = "", desc2 = "";
hlen = StringHash_Length(hash_id);
for(i = 0;i < hlen; i++) {
for(i = 0; i < hlen; i++) {
binding = StringHash_GetIdx(hash_id, i, 0);
desc1 = get_keyname(binding, 1); // first key bound to
desc2 = get_keyname(binding, 2); // second key bound to
desc1 = get_keyname (binding, 1); // first key bound to
desc2 = get_keyname (binding, 2); // second key bound to
if(desc2 != "") {
if (desc2 != "") {
desc1 += ", " + desc2;
}
StringHash_SetIdx(hash_id, i, desc1, 1);
StringHash_SetIdx (hash_id, i, desc1, 1);
}
};
@ -161,12 +157,11 @@ get_hash_keys =
void ()
load_keybindings =
{
get_hash_keys(movement_binding_hash);
get_hash_keys(misc_binding_hash);
get_hash_keys(weapon_binding_hash);
get_hash_keys (movement_binding_hash);
get_hash_keys (misc_binding_hash);
get_hash_keys (weapon_binding_hash);
};
/*******************
* BINDINGS OPTIONS
* Binding settings
@ -175,24 +170,23 @@ 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)
CB_MAIN_control_binding =
{
local integer retval = 0, bindcnt = 0;
local integer retval = 0, bindcnt = 0;
if(set_key_flag) {
bindcnt = Key_CountBinding(IMT_0, binding);
@ -231,25 +225,24 @@ 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 integer ret = CB_MAIN_control_binding(binding, key);
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)
get_hash_keys(movement_binding_hash);
get_hash_keys (movement_binding_hash);
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 =
{
get_hash_keys(movement_binding_hash);
get_hash_keys (movement_binding_hash);
};
/*
@ -260,23 +253,22 @@ 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;
Draw_String (20, 10, "Backspace/Delete: Del binding");
Draw_String (20, 20, "Enter: New binding");
Draw_String (20, 10, "Backspace/Delete: Del binding");
Draw_String (20, 20, "Enter: New binding");
hl = StringHash_Length(movement_binding_hash);
for(i=0;i < hl; i++) {
draw_val_item (20, 40+(i*10), bind_desc_pad,
StringHash_GetIdx(movement_binding_hash, i, -1),
StringHash_GetIdx(movement_binding_hash, i, 1));
hl = StringHash_Length (movement_binding_hash);
for(i = 0; i < hl; i++) {
draw_val_item (20, 40 + ( i * 10), bind_desc_pad,
StringHash_GetIdx (movement_binding_hash, i, -1),
StringHash_GetIdx (movement_binding_hash, i, 1));
}
opt_cursor (12, (Menu_GetIndex() * 10) + cursor_pad);
opt_cursor (12, (Menu_GetIndex () * 10) + cursor_pad);
return 1;
};
@ -293,17 +285,16 @@ MENU_basic_control_binding =
Menu_Begin (54, 40, "Movement bindings");
Menu_FadeScreen (1);
Menu_EnterHook(CB_ME_basic_control_binding);
Menu_EnterHook (CB_ME_basic_control_binding);
Menu_Draw (DRAW_basic_control_binding);
hl = StringHash_Length(movement_binding_hash);
hl = StringHash_Length (movement_binding_hash);
for (i = 0; i < hl; i++) {
Menu_Item (20, 40 + i*10, itos(i), CB_basic_control_binding, 1);
Menu_Item (20, 40 + i * 10, itos (i), CB_basic_control_binding, 1);
}
Menu_End ();
};
/*
CB_misc_control_binding
@ -312,19 +303,19 @@ 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 integer ret = CB_MAIN_control_binding(binding, key);
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)
get_hash_keys(misc_binding_hash);
get_hash_keys (misc_binding_hash);
return ret;
};
/*
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,16 +358,16 @@ 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);
Menu_EnterHook(CB_ME_misc_control_binding);
Menu_EnterHook (CB_ME_misc_control_binding);
Menu_Draw (DRAW_misc_control_binding);
hl = StringHash_Length(movement_binding_hash);
for (i = 0; i < hl; i++) {
Menu_Item (20, 40 + i*10, itos(i), CB_misc_control_binding, 1);
Menu_Item (20, 40 + i * 10, itos (i), CB_misc_control_binding, 1);
}
Menu_End ();
};
@ -388,14 +377,15 @@ MENU_misc_control_binding =
Callback function for the weapons control bindings
*/
integer (string text, integer key)
integer (string text, integer key)
CB_weapon_control_binding =
{
local string binding = StringHash_GetIdx(weapon_binding_hash, stoi(text),0);
local integer ret = CB_MAIN_control_binding(binding, key);
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)
get_hash_keys(weapon_binding_hash);
get_hash_keys (weapon_binding_hash);
return ret;
};
@ -419,27 +409,25 @@ 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;
Draw_String (20, 10, "Backspace/Delete: Del binding");
Draw_String (20, 20, "Enter: New binding");
Draw_String (20, 10, "Backspace/Delete: Del binding");
Draw_String (20, 20, "Enter: New binding");
hl = StringHash_Length(weapon_binding_hash);
for(i=0;i < hl; i++) {
draw_val_item (20, 40+(i*10), bind_desc_pad,
StringHash_GetIdx(weapon_binding_hash, i, -1),
StringHash_GetIdx(weapon_binding_hash, i, 1));
hl = StringHash_Length (weapon_binding_hash);
for(i = 0; i < hl; i++) {
draw_val_item (20, 40 + (i * 10), bind_desc_pad,
StringHash_GetIdx (weapon_binding_hash, i, -1),
StringHash_GetIdx (weapon_binding_hash, i, 1));
}
opt_cursor (12, (Menu_GetIndex() * 10) + cursor_pad);
opt_cursor (12, (Menu_GetIndex () * 10) + cursor_pad);
return 1;
};
/*
MENU_weapon_control_binding
@ -448,16 +436,16 @@ 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);
Menu_EnterHook(CB_ME_weapon_control_binding);
Menu_EnterHook (CB_ME_weapon_control_binding);
Menu_Draw (DRAW_weapon_control_binding);
hl = StringHash_Length(movement_binding_hash);
hl = StringHash_Length (movement_binding_hash);
for (i = 0; i < hl; i++) {
Menu_Item (20, 40 + i*10, itos(i), CB_weapon_control_binding, 1);
Menu_Item (20, 40 + i * 10, itos (i), CB_weapon_control_binding, 1);
}
Menu_End ();
};
@ -479,9 +467,8 @@ MENU_control_binding =
Menu_FadeScreen (1);
MENU_basic_control_binding ();
MENU_misc_control_binding ();
MENU_misc_control_binding ();
MENU_weapon_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

@ -38,9 +38,8 @@
#include "controls_o.h"
#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,20 +74,20 @@
integer (string text, integer key)
CB_video_options =
{
local integer selected_crosshair;
local float val;
local float val;
local integer selected_crosshair;
switch (text) {
case "fullscreen":
Cbuf_AddText ("toggle vid_fullscreen\n");
break;
case "crosshair":
selected_crosshair = ftoi(cvar("crosshair"));
selected_crosshair = ftoi (cvar ("crosshair"));
selected_crosshair++;
if(selected_crosshair >= 3) {
if (selected_crosshair >= 3) {
selected_crosshair = 0;
}
cvar_set("crosshair", itos(selected_crosshair));
cvar_set ("crosshair", itos (selected_crosshair));
break;
case "fps":
Cbuf_AddText ("toggle show_fps\n");
@ -104,16 +102,16 @@ CB_video_options =
}
switch (text) {
case "gamma":
val = cvar("vid_gamma");
val = min_max_cnt(MIN_GAMMA, MAX_GAMMA, GAMMA_STEP, val,
(key == QFK_RIGHT) && (key != QFK_LEFT));
cvar_set("vid_gamma", ftos(val));
val = cvar ("vid_gamma");
val = min_max_cnt (MIN_GAMMA, MAX_GAMMA, GAMMA_STEP, val,
(key == QFK_RIGHT) && (key != QFK_LEFT));
cvar_set("vid_gamma", ftos (val));
break;
case "viewsize":
val = cvar("viewsize");
val = min_max_cnt(MIN_VIEWSIZE, MAX_VIEWSIZE, VIEWSIZE_STEP, val,
(key == QFK_RIGHT) && (key != QFK_LEFT));
cvar_set("viewsize", ftos(val));
val = cvar ("viewsize");
val = min_max_cnt (MIN_VIEWSIZE, MAX_VIEWSIZE, VIEWSIZE_STEP, val,
(key == QFK_RIGHT) && (key != QFK_LEFT));
cvar_set ("viewsize", ftos (val));
break;
}
return 0;
@ -127,33 +125,33 @@ 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));
Draw_String (54, 40, "Video");
Draw_String (54, 50, "-----");
draw_val_item (70, 60, spacing, "Fullscreen",
cvar("vid_fullscreen") ? "On" : "Off");
draw_val_item (70, 70, spacing, "Crosshair", ftos(cvar("crosshair")));
draw_val_item (70, 80, spacing, "Show fps",
cvar("show_fps") ? "On" : "Off");
draw_val_item (70, 90, spacing, "Show time",
cvar("show_time") ? "On" : "Off");
Draw_String (54, 40, "Video");
Draw_String (54, 50, "-----");
draw_val_item (70, 60, spacing, "Fullscreen",
cvar ("vid_fullscreen") ? "On" : "Off");
draw_val_item (70, 70, spacing, "Crosshair", ftos (cvar ("crosshair")));
draw_val_item (70, 80, spacing, "Show fps",
cvar ("show_fps") ? "On" : "Off");
draw_val_item (70, 90, spacing, "Show time",
cvar ("show_time") ? "On" : "Off");
bar_pad = 90;
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_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")));
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")));
opt_cursor (62, (Menu_GetIndex() * 10) + 60);
opt_cursor (62, (Menu_GetIndex () * 10) + 60);
return 1;
};
@ -165,7 +163,7 @@ DRAW_video_options =
void ()
MENU_video_options =
{
local integer bar_pad;
local integer bar_pad;
Menu_Begin (54, 50, "Video");
Menu_FadeScreen (1);
@ -195,15 +193,15 @@ MENU_video_options =
integer (string text, integer key)
CB_audio_options =
{
local float volume;
local float volume;
if(!(key == QFK_RIGHT || key == QFK_LEFT )) {
return 0;
}
volume = cvar("volume");
volume = min_max_cnt(MIN_VOLUME, MAX_VOLUME, VOLUME_STEP, volume,
(key == QFK_RIGHT) && (key != QFK_LEFT));
cvar_set("volume", ftos(volume));
volume = cvar ("volume");
volume = min_max_cnt (MIN_VOLUME, MAX_VOLUME, VOLUME_STEP, volume,
(key == QFK_RIGHT) && (key != QFK_LEFT));
cvar_set ("volume", ftos (volume));
return 0;
};
@ -216,14 +214,13 @@ CB_audio_options =
integer ()
DRAW_audio_options =
{
local string tmp = ftos(cvar("crosshair"));
local integer spacing = 120;
local integer bar_pad;
local string tmp = ftos (cvar ("crosshair"));
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));
Draw_String (54, 40, "Audio");
Draw_String (54, 50, "-----");
Draw_String (54, 40, "Audio");
Draw_String (54, 50, "-----");
bar_pad = 50;
Draw_String (70, bar_pad + 10, "Volume:");
@ -327,28 +324,37 @@ CB_control_options =
integer ()
DRAW_control_options =
{
local integer cursor_pad = 0, spacing = 120, bar_pad;
local integer cursor_pad = 0, spacing = 120, bar_pad;
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_option.lmp", 1));
Draw_String (54, 40, "Controls");
Draw_String (54, 50, "--------");
Draw_String (70, 60, "Bindings");
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_option.lmp", 1));
Draw_String (54, 40, "Controls");
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_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_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);
opt_cursor (62, (Menu_GetIndex () * 10) + 60 + cursor_pad);
return 1;
};
@ -414,17 +420,17 @@ DRAW_feature_options =
{
local integer cursor_pad = 0, spacing = 120;
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_CenterPic (160,4, Draw_CachePic ("gfx/p_option.lmp", 1));
Draw_String (54, 40, "Features");
Draw_String (54, 50, "--------");
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_CenterPic (160,4, Draw_CachePic ("gfx/p_option.lmp", 1));
Draw_String (54, 40, "Features");
Draw_String (54, 50, "--------");
draw_val_item (70, 60, spacing, "Auto Record",
cvar("cl_autorecord") != 0 ? "On" : "Off");
cvar ("cl_autorecord") != 0 ? "On" : "Off");
draw_val_item (70, 70, spacing, "Fraglogging",
cvar("cl_fraglog") != 0 ? "On" : "Off");
cvar ("cl_fraglog") != 0 ? "On" : "Off");
opt_cursor (62, (Menu_GetIndex() * 10) + 60 + cursor_pad);
opt_cursor (62, (Menu_GetIndex () * 10) + 60 + cursor_pad);
return 1;
};
@ -467,10 +473,10 @@ InputLine player_config_iactive;
// table for cursor-positions
#define NUM_PLAYERCONFIG_CMDS 4
integer [NUM_PLAYERCONFIG_CMDS] player_config_cursor_tbl = {
PLAYER_CONF_Y_PAD + 8,
PLAYER_CONF_Y_PAD + 20 + 8,
PLAYER_CONF_Y_PAD + 45,
PLAYER_CONF_Y_PAD + 60
PLAYER_CONF_Y_PAD + 8,
PLAYER_CONF_Y_PAD + 20 + 8,
PLAYER_CONF_Y_PAD + 45,
PLAYER_CONF_Y_PAD + 60
};
integer player_config_cursor;
@ -487,7 +493,7 @@ string [NUM_PLAYERCONFIG_CMDS] player_config_vals = {
integer (integer key, integer unicode, integer down)
KEYEV_player_options =
{
local float colortmp;
local float colortmp;
switch (key) {
case QFK_DOWN:
@ -506,16 +512,16 @@ KEYEV_player_options =
break;
case QFK_RETURN:
if (player_config_iactive) {
if(player_config_iactive == player_config_plname_il) {
cvar_set(playername_cvar, [player_config_plname_il text]);
} else if(player_config_iactive == player_config_tname_il) {
cvar_set(teamname_cvar, [player_config_tname_il text]);
if (player_config_iactive == player_config_plname_il) {
cvar_set (playername_cvar, [player_config_plname_il text]);
} else if (player_config_iactive == player_config_tname_il) {
cvar_set (teamname_cvar, [player_config_tname_il text]);
}
player_config_iactive = NIL;
} else {
if (player_config_cursor == 0) {
player_config_iactive = player_config_plname_il;
} else if(player_config_cursor == 1) {
} else if (player_config_cursor == 1) {
player_config_iactive = player_config_tname_il;
}
}
@ -531,24 +537,22 @@ KEYEV_player_options =
switch (player_config_vals[player_config_cursor]) {
case "topcolor":
colortmp = cvar("topcolor");
colortmp = min_max_cnt(MIN_COLOR, MAX_COLOR, COLOR_STEP, colortmp,
(key == QFK_RIGHT) && (key != QFK_LEFT));
cvar_set("topcolor", ftos(colortmp));
colortmp = cvar ("topcolor");
colortmp = min_max_cnt (MIN_COLOR, MAX_COLOR, COLOR_STEP, colortmp,
(key == QFK_RIGHT) && (key != QFK_LEFT));
cvar_set ("topcolor", ftos (colortmp));
break;
case "bottomcolor":
colortmp = cvar("bottomcolor");
colortmp = min_max_cnt(MIN_COLOR, MAX_COLOR, COLOR_STEP, colortmp,
(key == QFK_RIGHT) && (key != QFK_LEFT));
cvar_set("bottomcolor", ftos(colortmp));
colortmp = cvar ("bottomcolor");
colortmp = min_max_cnt (MIN_COLOR, MAX_COLOR, COLOR_STEP, colortmp,
(key == QFK_RIGHT) && (key != QFK_LEFT));
cvar_set ("bottomcolor", ftos (colortmp));
break;
}
return 1;
};
/*
DRAW_player_options
@ -557,36 +561,36 @@ KEYEV_player_options =
integer ()
DRAW_player_options =
{
local integer cursor_pad = 0, spacing = 120;
local integer cursor_pad = 0, spacing = 120;
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_CenterPic (160,4, Draw_CachePic ("gfx/p_option.lmp", 1));
Draw_String (54, 40, "Player");
Draw_String (54, 50, "--------");
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_CenterPic (160,4, Draw_CachePic ("gfx/p_option.lmp", 1));
Draw_String (54, 40, "Player");
Draw_String (54, 50, "--------");
Draw_String(70, PLAYER_CONF_Y_PAD + 8, "Name..:");
text_box(120, PLAYER_CONF_Y_PAD, 17, 1);
Draw_String (70, PLAYER_CONF_Y_PAD + 8, "Name..:");
text_box (120, PLAYER_CONF_Y_PAD, 17, 1);
[player_config_plname_il draw: player_config_iactive == player_config_plname_il];
Draw_String(70, PLAYER_CONF_Y_PAD + 20 + 8, "Team..:");
text_box(120, PLAYER_CONF_Y_PAD + 20, 5, 1);
Draw_String (70, PLAYER_CONF_Y_PAD + 20 + 8, "Team..:");
text_box (120, PLAYER_CONF_Y_PAD + 20, 5, 1);
[player_config_tname_il draw:player_config_iactive == player_config_tname_il];
draw_val_item (70, PLAYER_CONF_Y_PAD + 45, spacing, "Top color",
" " + ftos(cvar("topcolor")));
" " + ftos (cvar ("topcolor")));
draw_val_item (70, PLAYER_CONF_Y_PAD + 60, spacing, "Bottom color",
" " + ftos(cvar("bottomcolor")));
" " + ftos (cvar ("bottomcolor")));
// Draw nice color boxes
text_box(192, PLAYER_CONF_Y_PAD + 45 - 8, 1, 1);
text_box (192, PLAYER_CONF_Y_PAD + 45 - 8, 1, 1);
Draw_Fill (200, PLAYER_CONF_Y_PAD + 45, 16, 8,
ftoi(cvar("topcolor"))*16+8);
ftoi (cvar ("topcolor")) * 16 + 8);
text_box(192, PLAYER_CONF_Y_PAD + 60 - 8, 1, 1);
text_box (192, PLAYER_CONF_Y_PAD + 60 - 8, 1, 1);
Draw_Fill (200, PLAYER_CONF_Y_PAD + 60, 16, 8,
ftoi(cvar("bottomcolor"))*16+8);
ftoi (cvar ("bottomcolor")) * 16 + 8);
opt_cursor (62, player_config_cursor_tbl[player_config_cursor]);
return 1;
@ -601,16 +605,16 @@ DRAW_player_options =
integer ()
CB_ME_player_options =
{
if(gametype() == "quakeworld") {
if (gametype () == "quakeworld") {
playername_cvar = "name";
} else {
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)];
[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
@ -696,22 +699,20 @@ KEYEV_network_options =
}
break;
}
if(key != QFK_RETURN && network_config_iactive) {
if (key != QFK_RETURN && network_config_iactive) {
[network_config_iactive processInput:(key >= 256 ? key : unicode)];
}
if(!(key == QFK_RIGHT || key == QFK_LEFT )) {
if (!(key == QFK_RIGHT || key == QFK_LEFT )) {
return 1;
}
// switch (network_config_vals[network_config_cursor]) {
// } // none yet
return 1;
};
/*
DRAW_network_options
@ -720,24 +721,22 @@ KEYEV_network_options =
integer ()
DRAW_network_options =
{
local integer cursor_pad = 0, spacing = 120;
local integer cursor_pad = 0, spacing = 120;
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_CenterPic (160,4, Draw_CachePic ("gfx/p_option.lmp", 1));
Draw_String (54, 40, "Network");
Draw_String (54, 50, "--------");
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_option.lmp", 1));
Draw_String (54, 40, "Network");
Draw_String (54, 50, "--------");
Draw_String(70, NETWORK_CONF_Y_PAD + 8, "Rate..:");
text_box(120, NETWORK_CONF_Y_PAD, 9, 1);
Draw_String (70, NETWORK_CONF_Y_PAD + 8, "Rate..:");
text_box (120, NETWORK_CONF_Y_PAD, 9, 1);
[network_config_rate_il draw: network_config_iactive == network_config_rate_il];
opt_cursor (62, player_config_cursor_tbl[player_config_cursor]);
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
@ -790,7 +787,7 @@ op_goto_console =
void ()
MENU_options =
{
local integer spacing = 120;
local integer spacing = 120;
Menu_Begin (54, 72, "");
Menu_FadeScreen (1);
@ -799,10 +796,10 @@ MENU_options =
Menu_Item (54, 32, "Go to Console", op_goto_console, 0);
MENU_control_options ();
MENU_video_options ();
MENU_audio_options ();
MENU_video_options ();
MENU_audio_options ();
MENU_feature_options ();
MENU_player_options ();
MENU_player_options ();
MENU_network_options ();
Menu_End ();

View file

@ -34,66 +34,62 @@
function for drawing the cursor
*/
void (integer x, integer y)
void (integer x, integer y)
opt_cursor =
{
// use time becaus we want a nice rotaing 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)
void (integer x, integer y, integer size, integer perc_val)
draw_perc_bar =
{
local float perc;
local integer i;
local float perc;
local integer i;
if(perc_val > 100) {
if (perc_val > 100) {
perc_val = 100;
} else if(perc_val < 0) {
} else if (perc_val < 0) {
perc_val = 0;
}
perc = itof(perc_val) / ( 100 / itof(size) );
perc = itof (perc_val) / (100 / itof (size));
/* 128, 129, 130 and 131 are special characters for scrollbars */
Draw_Character (x, y, 128); // draw beginning
Draw_Character (x, y, 128); // draw beginning
for (i = 0; i <= size; i++) {
Draw_Character (x + ((i+1)*8), y, 129); // draw the borders
Draw_Character (x + ((i + 1) * 8), y, 129); // draw the borders
}
Draw_Character (x + ((i+1)*8), y, 130); // draw last char
Draw_Character (x + ((ftoi(perc) + 1) * 8), y, 131); // draw slider
Draw_Character (x + ((i + 1) * 8), y, 130); // draw last char
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,
string label, string valstr)
void (integer x, integer y, integer spacing, string spacechar,
string label, string valstr)
draw_item =
{
local integer i;
local integer i;
Draw_String (x, y, label);
for (i = x + String_Len(label)*8; i < (x+spacing); i+=8) {
for (i = x + String_Len (label) * 8; i < (x+spacing); i += 8) {
Draw_String (i, y, spacechar);
}
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,45 +114,42 @@ draw_val_item =
integer (float min, float max, float val)
to_percentage =
{
local integer perc;
local float max_v = (max-min);
local float max_v = (max - min);
local integer perc;
val -= min;
if(val > max_v) {
if (val > max_v) {
val = max_v;
}
if(val < 0) {
if (val < 0) {
val = 0;
}
perc = ftoi((val/max_v) * 100);
perc = ftoi ((val / max_v) * 100);
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)
float (float min, float max, float step, float val, integer cntflag)
min_max_cnt =
{
if(cntflag) {
if (cntflag) {
val += step;
} else {
val -= step;
}
if(val > max) {
if (val > max) {
val = max;
} else if(val < min) {
} else if (val < min) {
val = min;
}
return val;

View file

@ -8,17 +8,17 @@
integer () servlist_favorates_draw =
{
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_multi.lmp", 1));
Draw_String (54, 40, "Under Construction");
Draw_String (54, 40, "Under Construction");
return 1;
};
integer () servlist_all_draw =
{
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_Pic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", 1));
Draw_CenterPic (160, 4, Draw_CachePic ("gfx/p_multi.lmp", 1));
Draw_String (54, 40, "Under Construction");
Draw_String (54, 40, "Under Construction");
return 1;
};
@ -37,11 +37,11 @@ integer () servlist_filter_draw =
Draw_String (62, 56, "Game Contains...:");
text_box (206, 48, 8, 1);
Draw_String (62, 72, "Server Not Full.:");
Draw_String (206, 72, ((serv_nfull == 0)?"No":"Yes"));
Draw_String (206, 72, ((serv_nfull == 0) ? "No" : "Yes"));
Draw_String (62, 88, "Server Not Empty:");
Draw_String (206, 88, ((serv_nempty == 0)?"No":"Yes"));
Draw_String (206, 88, ((serv_nempty == 0) ? "No" : "Yes"));
Draw_String (62, 96, "Under Construction");
opt_cursor (54, (Menu_GetIndex() * 16) + 40);
opt_cursor (54, (Menu_GetIndex () * 16) + 40);
return 1;
};
@ -106,4 +106,3 @@ void () server_list_menu =
servlist_filter_menu ();
Menu_End ();
};