| 1 |
/* |
| 2 |
=========================================================================== |
| 3 |
Copyright (C) 1999-2005 Id Software, Inc. |
| 4 |
|
| 5 |
This file is part of Quake III Arena source code. |
| 6 |
|
| 7 |
Quake III Arena source code is free software; you can redistribute it |
| 8 |
and/or modify it under the terms of the GNU General Public License as |
| 9 |
published by the Free Software Foundation; either version 2 of the License, |
| 10 |
or (at your option) any later version. |
| 11 |
|
| 12 |
Quake III Arena source code is distributed in the hope that it will be |
| 13 |
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with Quake III Arena source code; if not, write to the Free Software |
| 19 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 |
=========================================================================== |
| 21 |
*/ |
| 22 |
// |
| 23 |
/* |
| 24 |
======================================================================= |
| 25 |
|
| 26 |
CONTROLS MENU |
| 27 |
|
| 28 |
======================================================================= |
| 29 |
*/ |
| 30 |
|
| 31 |
|
| 32 |
#include "ui_local.h" |
| 33 |
|
| 34 |
#define ART_BACK0 "menu/art_blueish/back_0" |
| 35 |
#define ART_BACK1 "menu/art_blueish/back_1" |
| 36 |
#define ART_FRAMEL "menu/art_blueish/frame2_l" |
| 37 |
#define ART_FRAMER "menu/art_blueish/frame1_r" |
| 38 |
|
| 39 |
|
| 40 |
typedef struct { |
| 41 |
char *command; |
| 42 |
char *label; |
| 43 |
int id; |
| 44 |
int anim; |
| 45 |
int defaultbind1; |
| 46 |
int defaultbind2; |
| 47 |
int bind1; |
| 48 |
int bind2; |
| 49 |
} bind_t; |
| 50 |
|
| 51 |
typedef struct |
| 52 |
{ |
| 53 |
char* name; |
| 54 |
float defaultvalue; |
| 55 |
float value; |
| 56 |
} configcvar_t; |
| 57 |
|
| 58 |
#define SAVE_NOOP 0 |
| 59 |
#define SAVE_YES 1 |
| 60 |
#define SAVE_NO 2 |
| 61 |
#define SAVE_CANCEL 3 |
| 62 |
|
| 63 |
// control sections |
| 64 |
#define C_MOVEMENT 0 |
| 65 |
#define C_LOOKING 1 |
| 66 |
#define C_WEAPONS 2 |
| 67 |
#define C_MISC 3 |
| 68 |
#define C_MAX 4 |
| 69 |
|
| 70 |
#define ID_MOVEMENT 100 |
| 71 |
#define ID_LOOKING 101 |
| 72 |
#define ID_WEAPONS 102 |
| 73 |
#define ID_MISC 103 |
| 74 |
#define ID_DEFAULTS 104 |
| 75 |
#define ID_BACK 105 |
| 76 |
#define ID_SAVEANDEXIT 106 |
| 77 |
#define ID_EXIT 107 |
| 78 |
|
| 79 |
// bindable actions |
| 80 |
#define ID_SHOWSCORES 0 |
| 81 |
#define ID_USEITEM 1 |
| 82 |
#define ID_SPEED 2 |
| 83 |
#define ID_FORWARD 3 |
| 84 |
#define ID_BACKPEDAL 4 |
| 85 |
#define ID_MOVELEFT 5 |
| 86 |
#define ID_MOVERIGHT 6 |
| 87 |
#define ID_MOVEUP 7 |
| 88 |
#define ID_MOVEDOWN 8 |
| 89 |
#define ID_LEFT 9 |
| 90 |
#define ID_RIGHT 10 |
| 91 |
#define ID_STRAFE 11 |
| 92 |
#define ID_LOOKUP 12 |
| 93 |
#define ID_LOOKDOWN 13 |
| 94 |
#define ID_MOUSELOOK 14 |
| 95 |
#define ID_CENTERVIEW 15 |
| 96 |
#define ID_ZOOMVIEW 16 |
| 97 |
#define ID_WEAPON1 17 |
| 98 |
#define ID_WEAPON2 18 |
| 99 |
#define ID_WEAPON3 19 |
| 100 |
#define ID_WEAPON4 20 |
| 101 |
#define ID_WEAPON5 21 |
| 102 |
#define ID_WEAPON6 22 |
| 103 |
#define ID_WEAPON7 23 |
| 104 |
#define ID_WEAPON8 24 |
| 105 |
#define ID_WEAPON9 25 |
| 106 |
#define ID_WEAPON10 26 |
| 107 |
#define ID_WEAPON11 27 //Nailgun |
| 108 |
#define ID_WEAPON12 28 //ProxMines |
| 109 |
#define ID_WEAPON13 29 //Chaingun |
| 110 |
#define ID_ATTACK 30 |
| 111 |
#define ID_WEAPPREV 31 |
| 112 |
#define ID_WEAPNEXT 32 |
| 113 |
#define ID_GESTURE 33 |
| 114 |
#define ID_CHAT 34 |
| 115 |
#define ID_CHAT2 35 |
| 116 |
#define ID_CHAT3 36 |
| 117 |
#define ID_CHAT4 37 |
| 118 |
#define ID_VOIP_TALK 38 |
| 119 |
|
| 120 |
// all others |
| 121 |
#define ID_FREELOOK 39 |
| 122 |
#define ID_INVERTMOUSE 40 |
| 123 |
#define ID_ALWAYSRUN 41 |
| 124 |
#define ID_AUTOSWITCH 42 |
| 125 |
#define ID_MOUSESPEED 43 |
| 126 |
#define ID_JOYENABLE 44 |
| 127 |
#define ID_JOYTHRESHOLD 45 |
| 128 |
#define ID_SMOOTHMOUSE 46 |
| 129 |
#define ID_VOIP_TEAMONLY 47 |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
#define ANIM_IDLE 0 |
| 134 |
#define ANIM_RUN 1 |
| 135 |
#define ANIM_WALK 2 |
| 136 |
#define ANIM_BACK 3 |
| 137 |
#define ANIM_JUMP 4 |
| 138 |
#define ANIM_CROUCH 5 |
| 139 |
#define ANIM_STEPLEFT 6 |
| 140 |
#define ANIM_STEPRIGHT 7 |
| 141 |
#define ANIM_TURNLEFT 8 |
| 142 |
#define ANIM_TURNRIGHT 9 |
| 143 |
#define ANIM_LOOKUP 10 |
| 144 |
#define ANIM_LOOKDOWN 11 |
| 145 |
#define ANIM_WEAPON1 12 |
| 146 |
#define ANIM_WEAPON2 13 |
| 147 |
#define ANIM_WEAPON3 14 |
| 148 |
#define ANIM_WEAPON4 15 |
| 149 |
#define ANIM_WEAPON5 16 |
| 150 |
#define ANIM_WEAPON6 17 |
| 151 |
#define ANIM_WEAPON7 18 |
| 152 |
#define ANIM_WEAPON8 19 |
| 153 |
#define ANIM_WEAPON9 20 |
| 154 |
#define ANIM_WEAPON10 21 |
| 155 |
#define ANIM_ATTACK 22 |
| 156 |
#define ANIM_GESTURE 23 |
| 157 |
#define ANIM_DIE 24 |
| 158 |
#define ANIM_CHAT 25 |
| 159 |
|
| 160 |
//New in Beta 23 |
| 161 |
#define ANIM_WEAPON11 26 //Nailgun |
| 162 |
#define ANIM_WEAPON12 27 //ProxMines |
| 163 |
#define ANIM_WEAPON13 28 //Chaingun |
| 164 |
|
| 165 |
typedef struct |
| 166 |
{ |
| 167 |
menuframework_s menu; |
| 168 |
|
| 169 |
menutext_s banner; |
| 170 |
menubitmap_s framel; |
| 171 |
menubitmap_s framer; |
| 172 |
menubitmap_s player; |
| 173 |
|
| 174 |
menutext_s movement; |
| 175 |
menutext_s looking; |
| 176 |
menutext_s weapons; |
| 177 |
menutext_s misc; |
| 178 |
|
| 179 |
menuaction_s walkforward; |
| 180 |
menuaction_s backpedal; |
| 181 |
menuaction_s stepleft; |
| 182 |
menuaction_s stepright; |
| 183 |
menuaction_s moveup; |
| 184 |
menuaction_s movedown; |
| 185 |
menuaction_s turnleft; |
| 186 |
menuaction_s turnright; |
| 187 |
menuaction_s sidestep; |
| 188 |
menuaction_s run; |
| 189 |
menuaction_s machinegun; |
| 190 |
menuaction_s chainsaw; |
| 191 |
menuaction_s shotgun; |
| 192 |
menuaction_s grenadelauncher; |
| 193 |
menuaction_s rocketlauncher; |
| 194 |
menuaction_s lightning; |
| 195 |
menuaction_s railgun; |
| 196 |
menuaction_s plasma; |
| 197 |
menuaction_s bfg; |
| 198 |
menuaction_s grapple; |
| 199 |
//New in Beta 23 |
| 200 |
menuaction_s nailgun; |
| 201 |
menuaction_s proxmine; |
| 202 |
menuaction_s chaingun; |
| 203 |
//New in 23 end |
| 204 |
menuaction_s attack; |
| 205 |
menuaction_s prevweapon; |
| 206 |
menuaction_s nextweapon; |
| 207 |
menuaction_s lookup; |
| 208 |
menuaction_s lookdown; |
| 209 |
menuaction_s mouselook; |
| 210 |
menuradiobutton_s freelook; |
| 211 |
menuaction_s centerview; |
| 212 |
menuaction_s zoomview; |
| 213 |
menuaction_s gesture; |
| 214 |
menuradiobutton_s invertmouse; |
| 215 |
menuslider_s sensitivity; |
| 216 |
menuradiobutton_s smoothmouse; |
| 217 |
menuradiobutton_s alwaysrun; |
| 218 |
menuaction_s showscores; |
| 219 |
menulist_s autoswitch; |
| 220 |
menuaction_s useitem; |
| 221 |
playerInfo_t playerinfo; |
| 222 |
qboolean changesmade; |
| 223 |
menuaction_s chat; |
| 224 |
menuaction_s chat2; |
| 225 |
menuaction_s chat3; |
| 226 |
menuaction_s chat4; |
| 227 |
menuaction_s voip_talk; |
| 228 |
menuradiobutton_s voip_teamonly; |
| 229 |
menuradiobutton_s joyenable; |
| 230 |
menuslider_s joythreshold; |
| 231 |
int section; |
| 232 |
qboolean waitingforkey; |
| 233 |
char playerModel[64]; |
| 234 |
vec3_t playerViewangles; |
| 235 |
vec3_t playerMoveangles; |
| 236 |
int playerLegs; |
| 237 |
int playerTorso; |
| 238 |
int playerWeapon; |
| 239 |
qboolean playerChat; |
| 240 |
|
| 241 |
menubitmap_s back; |
| 242 |
menutext_s name; |
| 243 |
} controls_t; |
| 244 |
|
| 245 |
static controls_t s_controls; |
| 246 |
|
| 247 |
static const char *autoswitch_items[] = { |
| 248 |
"NEVER", |
| 249 |
"ALWAYS", |
| 250 |
"NEW", |
| 251 |
"BETTER", |
| 252 |
"NEW&BETTER", |
| 253 |
NULL |
| 254 |
}; |
| 255 |
|
| 256 |
// OLD |
| 257 |
//static vec4_t controls_binding_color = {1.00f, 0.43f, 0.00f, 1.00f}; // bk: Win32 C4305 |
| 258 |
|
| 259 |
// New! |
| 260 |
static vec4_t controls_binding_color = {0.58f, 0.70f, 0.81f, 1.00f}; |
| 261 |
|
| 262 |
static bind_t g_bindings[] = |
| 263 |
{ |
| 264 |
{"+scores", "show scores", ID_SHOWSCORES, ANIM_IDLE, K_TAB, -1, -1, -1}, |
| 265 |
{"+button2", "use item", ID_USEITEM, ANIM_IDLE, K_ENTER, -1, -1, -1}, |
| 266 |
{"+speed", "run / walk", ID_SPEED, ANIM_RUN, K_SHIFT, -1, -1, -1}, |
| 267 |
{"+forward", "walk forward", ID_FORWARD, ANIM_WALK, K_UPARROW, -1, -1, -1}, |
| 268 |
{"+back", "backpedal", ID_BACKPEDAL, ANIM_BACK, K_DOWNARROW, -1, -1, -1}, |
| 269 |
{"+moveleft", "step left", ID_MOVELEFT, ANIM_STEPLEFT, ',', -1, -1, -1}, |
| 270 |
{"+moveright", "step right", ID_MOVERIGHT, ANIM_STEPRIGHT, '.', -1, -1, -1}, |
| 271 |
{"+moveup", "up / jump", ID_MOVEUP, ANIM_JUMP, K_SPACE, -1, -1, -1}, |
| 272 |
{"+movedown", "down / crouch", ID_MOVEDOWN, ANIM_CROUCH, 'c', -1, -1, -1}, |
| 273 |
{"+left", "turn left", ID_LEFT, ANIM_TURNLEFT, K_LEFTARROW, -1, -1, -1}, |
| 274 |
{"+right", "turn right", ID_RIGHT, ANIM_TURNRIGHT, K_RIGHTARROW, -1, -1, -1}, |
| 275 |
{"+strafe", "sidestep / turn", ID_STRAFE, ANIM_IDLE, K_ALT, -1, -1, -1}, |
| 276 |
{"+lookup", "look up", ID_LOOKUP, ANIM_LOOKUP, K_PGDN, -1, -1, -1}, |
| 277 |
{"+lookdown", "look down", ID_LOOKDOWN, ANIM_LOOKDOWN, K_DEL, -1, -1, -1}, |
| 278 |
{"+mlook", "mouse look", ID_MOUSELOOK, ANIM_IDLE, '/', -1, -1, -1}, |
| 279 |
{"centerview", "center view", ID_CENTERVIEW, ANIM_IDLE, K_END, -1, -1, -1}, |
| 280 |
{"+zoom", "zoom view", ID_ZOOMVIEW, ANIM_IDLE, -1, -1, -1, -1}, |
| 281 |
{"weapon 1", "gauntlet", ID_WEAPON1, ANIM_WEAPON1, '1', -1, -1, -1}, |
| 282 |
{"weapon 2", "machinegun", ID_WEAPON2, ANIM_WEAPON2, '2', -1, -1, -1}, |
| 283 |
{"weapon 3", "shotgun", ID_WEAPON3, ANIM_WEAPON3, '3', -1, -1, -1}, |
| 284 |
{"weapon 4", "grenade launcher", ID_WEAPON4, ANIM_WEAPON4, '4', -1, -1, -1}, |
| 285 |
{"weapon 5", "rocket launcher", ID_WEAPON5, ANIM_WEAPON5, '5', -1, -1, -1}, |
| 286 |
{"weapon 6", "lightning", ID_WEAPON6, ANIM_WEAPON6, '6', -1, -1, -1}, |
| 287 |
{"weapon 7", "railgun", ID_WEAPON7, ANIM_WEAPON7, '7', -1, -1, -1}, |
| 288 |
{"weapon 8", "plasma gun", ID_WEAPON8, ANIM_WEAPON8, '8', -1, -1, -1}, |
| 289 |
{"weapon 9", "BFG", ID_WEAPON9, ANIM_WEAPON9, '9', -1, -1, -1}, |
| 290 |
{"weapon 10", "Grapple", ID_WEAPON10, ANIM_WEAPON10, -1, -1, -1, -1}, |
| 291 |
{"weapon 11", "nailgun", ID_WEAPON11, ANIM_WEAPON11, -1, -1, -1, -1}, |
| 292 |
{"weapon 12", "mine Launcher", ID_WEAPON12, ANIM_WEAPON12, -1, -1, -1, -1}, |
| 293 |
{"weapon 13", "chaingun", ID_WEAPON13, ANIM_WEAPON13, -1, -1, -1, -1}, |
| 294 |
{"+attack", "attack", ID_ATTACK, ANIM_ATTACK, K_CTRL, -1, -1, -1}, |
| 295 |
{"weapprev", "prev weapon", ID_WEAPPREV, ANIM_IDLE, '[', -1, -1, -1}, |
| 296 |
{"weapnext", "next weapon", ID_WEAPNEXT, ANIM_IDLE, ']', -1, -1, -1}, |
| 297 |
{"+button3", "gesture", ID_GESTURE, ANIM_GESTURE, K_MOUSE3, -1, -1, -1}, |
| 298 |
{"messagemode", "chat", ID_CHAT, ANIM_CHAT, 't', -1, -1, -1}, |
| 299 |
{"messagemode2", "chat - team", ID_CHAT2, ANIM_CHAT, -1, -1, -1, -1}, |
| 300 |
{"messagemode3", "chat - target", ID_CHAT3, ANIM_CHAT, -1, -1, -1, -1}, |
| 301 |
{"messagemode4", "chat - attacker", ID_CHAT4, ANIM_CHAT, -1, -1, -1, -1}, |
| 302 |
{"+voiprecord", "voice chat", ID_VOIP_TALK, ANIM_CHAT, 'q', -1, -1, -1}, |
| 303 |
{(char*)NULL, (char*)NULL, 0, 0, -1, -1, -1, -1}, |
| 304 |
}; |
| 305 |
|
| 306 |
static configcvar_t g_configcvars[] = |
| 307 |
{ |
| 308 |
{"cl_run", 0, 0}, |
| 309 |
{"m_pitch", 0, 0}, |
| 310 |
{"cg_autoswitch", 0, 0}, |
| 311 |
{"sensitivity", 0, 0}, |
| 312 |
{"in_joystick", 0, 0}, |
| 313 |
{"joy_threshold", 0, 0}, |
| 314 |
{"m_filter", 0, 0}, |
| 315 |
{"cl_freelook", 0, 0}, |
| 316 |
{"cg_voipTeamOnly", 0, 0}, |
| 317 |
{NULL, 0, 0} |
| 318 |
}; |
| 319 |
|
| 320 |
static menucommon_s *g_movement_controls[] = |
| 321 |
{ |
| 322 |
(menucommon_s *)&s_controls.alwaysrun, |
| 323 |
(menucommon_s *)&s_controls.run, |
| 324 |
(menucommon_s *)&s_controls.walkforward, |
| 325 |
(menucommon_s *)&s_controls.backpedal, |
| 326 |
(menucommon_s *)&s_controls.stepleft, |
| 327 |
(menucommon_s *)&s_controls.stepright, |
| 328 |
(menucommon_s *)&s_controls.moveup, |
| 329 |
(menucommon_s *)&s_controls.movedown, |
| 330 |
(menucommon_s *)&s_controls.turnleft, |
| 331 |
(menucommon_s *)&s_controls.turnright, |
| 332 |
(menucommon_s *)&s_controls.sidestep, |
| 333 |
NULL |
| 334 |
}; |
| 335 |
|
| 336 |
static menucommon_s *g_weapons_controls[] = { |
| 337 |
(menucommon_s *)&s_controls.attack, |
| 338 |
(menucommon_s *)&s_controls.nextweapon, |
| 339 |
(menucommon_s *)&s_controls.prevweapon, |
| 340 |
(menucommon_s *)&s_controls.autoswitch, |
| 341 |
(menucommon_s *)&s_controls.chainsaw, |
| 342 |
(menucommon_s *)&s_controls.machinegun, |
| 343 |
(menucommon_s *)&s_controls.shotgun, |
| 344 |
(menucommon_s *)&s_controls.grenadelauncher, |
| 345 |
(menucommon_s *)&s_controls.rocketlauncher, |
| 346 |
(menucommon_s *)&s_controls.lightning, |
| 347 |
(menucommon_s *)&s_controls.railgun, |
| 348 |
(menucommon_s *)&s_controls.plasma, |
| 349 |
(menucommon_s *)&s_controls.bfg, |
| 350 |
(menucommon_s *)&s_controls.grapple, |
| 351 |
(menucommon_s *)&s_controls.nailgun, |
| 352 |
(menucommon_s *)&s_controls.proxmine, |
| 353 |
(menucommon_s *)&s_controls.chaingun, |
| 354 |
NULL, |
| 355 |
}; |
| 356 |
|
| 357 |
static menucommon_s *g_looking_controls[] = { |
| 358 |
(menucommon_s *)&s_controls.sensitivity, |
| 359 |
(menucommon_s *)&s_controls.smoothmouse, |
| 360 |
(menucommon_s *)&s_controls.invertmouse, |
| 361 |
(menucommon_s *)&s_controls.lookup, |
| 362 |
(menucommon_s *)&s_controls.lookdown, |
| 363 |
(menucommon_s *)&s_controls.mouselook, |
| 364 |
(menucommon_s *)&s_controls.freelook, |
| 365 |
(menucommon_s *)&s_controls.centerview, |
| 366 |
(menucommon_s *)&s_controls.zoomview, |
| 367 |
(menucommon_s *)&s_controls.joyenable, |
| 368 |
(menucommon_s *)&s_controls.joythreshold, |
| 369 |
NULL, |
| 370 |
}; |
| 371 |
|
| 372 |
static menucommon_s *g_misc_controls[] = { |
| 373 |
(menucommon_s *)&s_controls.showscores, |
| 374 |
(menucommon_s *)&s_controls.useitem, |
| 375 |
(menucommon_s *)&s_controls.gesture, |
| 376 |
(menucommon_s *)&s_controls.chat, |
| 377 |
(menucommon_s *)&s_controls.chat2, |
| 378 |
(menucommon_s *)&s_controls.chat3, |
| 379 |
(menucommon_s *)&s_controls.chat4, |
| 380 |
(menucommon_s *)&s_controls.voip_talk, |
| 381 |
(menucommon_s *)&s_controls.voip_teamonly, |
| 382 |
NULL, |
| 383 |
}; |
| 384 |
|
| 385 |
static menucommon_s **g_controls[] = { |
| 386 |
g_movement_controls, |
| 387 |
g_looking_controls, |
| 388 |
g_weapons_controls, |
| 389 |
g_misc_controls, |
| 390 |
}; |
| 391 |
|
| 392 |
/* |
| 393 |
================= |
| 394 |
Controls_InitCvars |
| 395 |
================= |
| 396 |
*/ |
| 397 |
static void Controls_InitCvars( void ) |
| 398 |
{ |
| 399 |
int i; |
| 400 |
configcvar_t* cvarptr; |
| 401 |
|
| 402 |
cvarptr = g_configcvars; |
| 403 |
for (i=0; ;i++,cvarptr++) |
| 404 |
{ |
| 405 |
if (!cvarptr->name) |
| 406 |
break; |
| 407 |
|
| 408 |
// get current value |
| 409 |
cvarptr->value = trap_Cvar_VariableValue( cvarptr->name ); |
| 410 |
|
| 411 |
// get default value |
| 412 |
trap_Cvar_Reset( cvarptr->name ); |
| 413 |
cvarptr->defaultvalue = trap_Cvar_VariableValue( cvarptr->name ); |
| 414 |
|
| 415 |
// restore current value |
| 416 |
trap_Cvar_SetValue( cvarptr->name, cvarptr->value ); |
| 417 |
} |
| 418 |
} |
| 419 |
|
| 420 |
/* |
| 421 |
================= |
| 422 |
Controls_GetCvarDefault |
| 423 |
================= |
| 424 |
*/ |
| 425 |
static float Controls_GetCvarDefault( char* name ) |
| 426 |
{ |
| 427 |
configcvar_t* cvarptr; |
| 428 |
int i; |
| 429 |
|
| 430 |
cvarptr = g_configcvars; |
| 431 |
for (i=0; ;i++,cvarptr++) |
| 432 |
{ |
| 433 |
if (!cvarptr->name) |
| 434 |
return (0); |
| 435 |
|
| 436 |
if (!strcmp(cvarptr->name,name)) |
| 437 |
break; |
| 438 |
} |
| 439 |
|
| 440 |
return (cvarptr->defaultvalue); |
| 441 |
} |
| 442 |
|
| 443 |
/* |
| 444 |
================= |
| 445 |
Controls_GetCvarValue |
| 446 |
================= |
| 447 |
*/ |
| 448 |
static float Controls_GetCvarValue( char* name ) |
| 449 |
{ |
| 450 |
configcvar_t* cvarptr; |
| 451 |
int i; |
| 452 |
|
| 453 |
cvarptr = g_configcvars; |
| 454 |
for (i=0; ;i++,cvarptr++) |
| 455 |
{ |
| 456 |
if (!cvarptr->name) |
| 457 |
return (0); |
| 458 |
|
| 459 |
if (!strcmp(cvarptr->name,name)) |
| 460 |
break; |
| 461 |
} |
| 462 |
|
| 463 |
return (cvarptr->value); |
| 464 |
} |
| 465 |
|
| 466 |
|
| 467 |
/* |
| 468 |
================= |
| 469 |
Controls_UpdateModel |
| 470 |
================= |
| 471 |
*/ |
| 472 |
static void Controls_UpdateModel( int anim ) { |
| 473 |
VectorClear( s_controls.playerViewangles ); |
| 474 |
VectorClear( s_controls.playerMoveangles ); |
| 475 |
s_controls.playerViewangles[YAW] = 180 - 30; |
| 476 |
s_controls.playerMoveangles[YAW] = s_controls.playerViewangles[YAW]; |
| 477 |
s_controls.playerLegs = LEGS_IDLE; |
| 478 |
s_controls.playerTorso = TORSO_STAND; |
| 479 |
s_controls.playerWeapon = -1; |
| 480 |
s_controls.playerChat = qfalse; |
| 481 |
|
| 482 |
switch( anim ) { |
| 483 |
case ANIM_RUN: |
| 484 |
s_controls.playerLegs = LEGS_RUN; |
| 485 |
break; |
| 486 |
|
| 487 |
case ANIM_WALK: |
| 488 |
s_controls.playerLegs = LEGS_WALK; |
| 489 |
break; |
| 490 |
|
| 491 |
case ANIM_BACK: |
| 492 |
s_controls.playerLegs = LEGS_BACK; |
| 493 |
break; |
| 494 |
|
| 495 |
case ANIM_JUMP: |
| 496 |
s_controls.playerLegs = LEGS_JUMP; |
| 497 |
break; |
| 498 |
|
| 499 |
case ANIM_CROUCH: |
| 500 |
s_controls.playerLegs = LEGS_IDLECR; |
| 501 |
break; |
| 502 |
|
| 503 |
case ANIM_TURNLEFT: |
| 504 |
s_controls.playerViewangles[YAW] += 90; |
| 505 |
break; |
| 506 |
|
| 507 |
case ANIM_TURNRIGHT: |
| 508 |
s_controls.playerViewangles[YAW] -= 90; |
| 509 |
break; |
| 510 |
|
| 511 |
case ANIM_STEPLEFT: |
| 512 |
s_controls.playerLegs = LEGS_WALK; |
| 513 |
s_controls.playerMoveangles[YAW] = s_controls.playerViewangles[YAW] + 90; |
| 514 |
break; |
| 515 |
|
| 516 |
case ANIM_STEPRIGHT: |
| 517 |
s_controls.playerLegs = LEGS_WALK; |
| 518 |
s_controls.playerMoveangles[YAW] = s_controls.playerViewangles[YAW] - 90; |
| 519 |
break; |
| 520 |
|
| 521 |
case ANIM_LOOKUP: |
| 522 |
s_controls.playerViewangles[PITCH] = -45; |
| 523 |
break; |
| 524 |
|
| 525 |
case ANIM_LOOKDOWN: |
| 526 |
s_controls.playerViewangles[PITCH] = 45; |
| 527 |
break; |
| 528 |
|
| 529 |
case ANIM_WEAPON1: |
| 530 |
s_controls.playerWeapon = WP_GAUNTLET; |
| 531 |
break; |
| 532 |
|
| 533 |
case ANIM_WEAPON2: |
| 534 |
s_controls.playerWeapon = WP_MACHINEGUN; |
| 535 |
break; |
| 536 |
|
| 537 |
case ANIM_WEAPON3: |
| 538 |
s_controls.playerWeapon = WP_SHOTGUN; |
| 539 |
break; |
| 540 |
|
| 541 |
case ANIM_WEAPON4: |
| 542 |
s_controls.playerWeapon = WP_GRENADE_LAUNCHER; |
| 543 |
break; |
| 544 |
|
| 545 |
case ANIM_WEAPON5: |
| 546 |
s_controls.playerWeapon = WP_ROCKET_LAUNCHER; |
| 547 |
break; |
| 548 |
|
| 549 |
case ANIM_WEAPON6: |
| 550 |
s_controls.playerWeapon = WP_LIGHTNING; |
| 551 |
break; |
| 552 |
|
| 553 |
case ANIM_WEAPON7: |
| 554 |
s_controls.playerWeapon = WP_RAILGUN; |
| 555 |
break; |
| 556 |
|
| 557 |
case ANIM_WEAPON8: |
| 558 |
s_controls.playerWeapon = WP_PLASMAGUN; |
| 559 |
break; |
| 560 |
|
| 561 |
case ANIM_WEAPON9: |
| 562 |
s_controls.playerWeapon = WP_BFG; |
| 563 |
break; |
| 564 |
|
| 565 |
case ANIM_WEAPON10: |
| 566 |
s_controls.playerWeapon = WP_GRAPPLING_HOOK; |
| 567 |
break; |
| 568 |
|
| 569 |
case ANIM_WEAPON11: |
| 570 |
s_controls.playerWeapon = WP_NAILGUN; |
| 571 |
break; |
| 572 |
|
| 573 |
case ANIM_WEAPON12: |
| 574 |
s_controls.playerWeapon = WP_PROX_LAUNCHER; |
| 575 |
break; |
| 576 |
|
| 577 |
case ANIM_WEAPON13: |
| 578 |
s_controls.playerWeapon = WP_CHAINGUN; |
| 579 |
break; |
| 580 |
|
| 581 |
case ANIM_ATTACK: |
| 582 |
s_controls.playerTorso = TORSO_ATTACK; |
| 583 |
break; |
| 584 |
|
| 585 |
case ANIM_GESTURE: |
| 586 |
s_controls.playerTorso = TORSO_GESTURE; |
| 587 |
break; |
| 588 |
|
| 589 |
case ANIM_DIE: |
| 590 |
s_controls.playerLegs = BOTH_DEATH1; |
| 591 |
s_controls.playerTorso = BOTH_DEATH1; |
| 592 |
s_controls.playerWeapon = WP_NONE; |
| 593 |
break; |
| 594 |
|
| 595 |
case ANIM_CHAT: |
| 596 |
s_controls.playerChat = qtrue; |
| 597 |
break; |
| 598 |
|
| 599 |
default: |
| 600 |
break; |
| 601 |
} |
| 602 |
|
| 603 |
UI_PlayerInfo_SetInfo( &s_controls.playerinfo, s_controls.playerLegs, s_controls.playerTorso, s_controls.playerViewangles, s_controls.playerMoveangles, s_controls.playerWeapon, s_controls.playerChat ); |
| 604 |
} |
| 605 |
|
| 606 |
|
| 607 |
/* |
| 608 |
================= |
| 609 |
Controls_Update |
| 610 |
================= |
| 611 |
*/ |
| 612 |
static void Controls_Update( void ) { |
| 613 |
int i; |
| 614 |
int j; |
| 615 |
int y; |
| 616 |
menucommon_s **controls; |
| 617 |
menucommon_s *control; |
| 618 |
|
| 619 |
// disable all controls in all groups |
| 620 |
for( i = 0; i < C_MAX; i++ ) { |
| 621 |
controls = g_controls[i]; |
| 622 |
// bk001204 - parentheses |
| 623 |
for( j = 0; (control = controls[j]) ; j++ ) { |
| 624 |
control->flags |= (QMF_HIDDEN|QMF_INACTIVE); |
| 625 |
} |
| 626 |
} |
| 627 |
|
| 628 |
controls = g_controls[s_controls.section]; |
| 629 |
|
| 630 |
// enable controls in active group (and count number of items for vertical centering) |
| 631 |
// bk001204 - parentheses |
| 632 |
for( j = 0; (control = controls[j]) ; j++ ) { |
| 633 |
control->flags &= ~(QMF_GRAYED|QMF_HIDDEN|QMF_INACTIVE); |
| 634 |
} |
| 635 |
|
| 636 |
// position controls |
| 637 |
y = ( SCREEN_HEIGHT - j * SMALLCHAR_HEIGHT ) / 2; |
| 638 |
// bk001204 - parentheses |
| 639 |
for( j = 0; (control = controls[j]) ; j++, y += SMALLCHAR_HEIGHT ) { |
| 640 |
control->x = 320; |
| 641 |
control->y = y; |
| 642 |
control->left = 320 - 19*SMALLCHAR_WIDTH; |
| 643 |
control->right = 320 + 21*SMALLCHAR_WIDTH; |
| 644 |
control->top = y; |
| 645 |
control->bottom = y + SMALLCHAR_HEIGHT; |
| 646 |
} |
| 647 |
|
| 648 |
if( s_controls.waitingforkey ) { |
| 649 |
// disable everybody |
| 650 |
for( i = 0; i < s_controls.menu.nitems; i++ ) { |
| 651 |
((menucommon_s*)(s_controls.menu.items[i]))->flags |= QMF_GRAYED; |
| 652 |
} |
| 653 |
|
| 654 |
// enable action item |
| 655 |
((menucommon_s*)(s_controls.menu.items[s_controls.menu.cursor]))->flags &= ~QMF_GRAYED; |
| 656 |
|
| 657 |
// don't gray out player's name |
| 658 |
s_controls.name.generic.flags &= ~QMF_GRAYED; |
| 659 |
|
| 660 |
return; |
| 661 |
} |
| 662 |
|
| 663 |
// enable everybody |
| 664 |
for( i = 0; i < s_controls.menu.nitems; i++ ) { |
| 665 |
((menucommon_s*)(s_controls.menu.items[i]))->flags &= ~QMF_GRAYED; |
| 666 |
} |
| 667 |
|
| 668 |
// makes sure flags are right on the group selection controls |
| 669 |
s_controls.looking.generic.flags &= ~(QMF_GRAYED|QMF_HIGHLIGHT|QMF_HIGHLIGHT_IF_FOCUS); |
| 670 |
s_controls.movement.generic.flags &= ~(QMF_GRAYED|QMF_HIGHLIGHT|QMF_HIGHLIGHT_IF_FOCUS); |
| 671 |
s_controls.weapons.generic.flags &= ~(QMF_GRAYED|QMF_HIGHLIGHT|QMF_HIGHLIGHT_IF_FOCUS); |
| 672 |
s_controls.misc.generic.flags &= ~(QMF_GRAYED|QMF_HIGHLIGHT|QMF_HIGHLIGHT_IF_FOCUS); |
| 673 |
|
| 674 |
s_controls.looking.generic.flags |= QMF_PULSEIFFOCUS; |
| 675 |
s_controls.movement.generic.flags |= QMF_PULSEIFFOCUS; |
| 676 |
s_controls.weapons.generic.flags |= QMF_PULSEIFFOCUS; |
| 677 |
s_controls.misc.generic.flags |= QMF_PULSEIFFOCUS; |
| 678 |
|
| 679 |
// set buttons |
| 680 |
switch( s_controls.section ) { |
| 681 |
case C_MOVEMENT: |
| 682 |
s_controls.movement.generic.flags &= ~QMF_PULSEIFFOCUS; |
| 683 |
s_controls.movement.generic.flags |= (QMF_HIGHLIGHT|QMF_HIGHLIGHT_IF_FOCUS); |
| 684 |
break; |
| 685 |
|
| 686 |
case C_LOOKING: |
| 687 |
s_controls.looking.generic.flags &= ~QMF_PULSEIFFOCUS; |
| 688 |
s_controls.looking.generic.flags |= (QMF_HIGHLIGHT|QMF_HIGHLIGHT_IF_FOCUS); |
| 689 |
break; |
| 690 |
|
| 691 |
case C_WEAPONS: |
| 692 |
s_controls.weapons.generic.flags &= ~QMF_PULSEIFFOCUS; |
| 693 |
s_controls.weapons.generic.flags |= (QMF_HIGHLIGHT|QMF_HIGHLIGHT_IF_FOCUS); |
| 694 |
break; |
| 695 |
|
| 696 |
case C_MISC: |
| 697 |
s_controls.misc.generic.flags &= ~QMF_PULSEIFFOCUS; |
| 698 |
s_controls.misc.generic.flags |= (QMF_HIGHLIGHT|QMF_HIGHLIGHT_IF_FOCUS); |
| 699 |
break; |
| 700 |
} |
| 701 |
} |
| 702 |
|
| 703 |
|
| 704 |
/* |
| 705 |
================= |
| 706 |
Controls_DrawKeyBinding |
| 707 |
================= |
| 708 |
*/ |
| 709 |
static void Controls_DrawKeyBinding( void *self ) |
| 710 |
{ |
| 711 |
menuaction_s* a; |
| 712 |
int x; |
| 713 |
int y; |
| 714 |
int b1; |
| 715 |
int b2; |
| 716 |
qboolean c; |
| 717 |
char name[32]; |
| 718 |
char name2[32]; |
| 719 |
|
| 720 |
a = (menuaction_s*) self; |
| 721 |
|
| 722 |
x = a->generic.x; |
| 723 |
y = a->generic.y; |
| 724 |
|
| 725 |
c = (Menu_ItemAtCursor( a->generic.parent ) == a); |
| 726 |
|
| 727 |
b1 = g_bindings[a->generic.id].bind1; |
| 728 |
if (b1 == -1) |
| 729 |
strcpy(name,"???"); |
| 730 |
else |
| 731 |
{ |
| 732 |
trap_Key_KeynumToStringBuf( b1, name, 32 ); |
| 733 |
Q_strupr(name); |
| 734 |
|
| 735 |
b2 = g_bindings[a->generic.id].bind2; |
| 736 |
if (b2 != -1) |
| 737 |
{ |
| 738 |
trap_Key_KeynumToStringBuf( b2, name2, 32 ); |
| 739 |
Q_strupr(name2); |
| 740 |
|
| 741 |
strcat( name, " or " ); |
| 742 |
strcat( name, name2 ); |
| 743 |
} |
| 744 |
} |
| 745 |
|
| 746 |
if (c) |
| 747 |
{ |
| 748 |
UI_FillRect( a->generic.left, a->generic.top, a->generic.right-a->generic.left+1, a->generic.bottom-a->generic.top+1, listbar_color ); |
| 749 |
|
| 750 |
UI_DrawString( x - SMALLCHAR_WIDTH, y, g_bindings[a->generic.id].label, UI_RIGHT|UI_SMALLFONT, text_color_highlight ); |
| 751 |
UI_DrawString( x + SMALLCHAR_WIDTH, y, name, UI_LEFT|UI_SMALLFONT|UI_PULSE, text_color_highlight ); |
| 752 |
|
| 753 |
if (s_controls.waitingforkey) |
| 754 |
{ |
| 755 |
UI_DrawChar( x, y, '=', UI_CENTER|UI_BLINK|UI_SMALLFONT, text_color_highlight); |
| 756 |
UI_DrawString(SCREEN_WIDTH * 0.50, SCREEN_HEIGHT * 0.80, "Waiting for new key ... ESCAPE to cancel", UI_SMALLFONT|UI_CENTER|UI_PULSE, colorWhite ); |
| 757 |
} |
| 758 |
else |
| 759 |
{ |
| 760 |
UI_DrawChar( x, y, 13, UI_CENTER|UI_BLINK|UI_SMALLFONT, text_color_highlight); |
| 761 |
UI_DrawString(SCREEN_WIDTH * 0.50, SCREEN_HEIGHT * 0.78, "Press ENTER or CLICK to change", UI_SMALLFONT|UI_CENTER, colorWhite ); |
| 762 |
UI_DrawString(SCREEN_WIDTH * 0.50, SCREEN_HEIGHT * 0.82, "Press BACKSPACE to clear", UI_SMALLFONT|UI_CENTER, colorWhite ); |
| 763 |
} |
| 764 |
} |
| 765 |
else |
| 766 |
{ |
| 767 |
if (a->generic.flags & QMF_GRAYED) |
| 768 |
{ |
| 769 |
UI_DrawString( x - SMALLCHAR_WIDTH, y, g_bindings[a->generic.id].label, UI_RIGHT|UI_SMALLFONT, text_color_disabled ); |
| 770 |
UI_DrawString( x + SMALLCHAR_WIDTH, y, name, UI_LEFT|UI_SMALLFONT, text_color_disabled ); |
| 771 |
} |
| 772 |
else |
| 773 |
{ |
| 774 |
UI_DrawString( x - SMALLCHAR_WIDTH, y, g_bindings[a->generic.id].label, UI_RIGHT|UI_SMALLFONT, controls_binding_color ); |
| 775 |
UI_DrawString( x + SMALLCHAR_WIDTH, y, name, UI_LEFT|UI_SMALLFONT, controls_binding_color ); |
| 776 |
} |
| 777 |
} |
| 778 |
} |
| 779 |
|
| 780 |
/* |
| 781 |
================= |
| 782 |
Controls_StatusBar |
| 783 |
================= |
| 784 |
*/ |
| 785 |
static void Controls_StatusBar( void *self ) |
| 786 |
{ |
| 787 |
UI_DrawString(SCREEN_WIDTH * 0.50, SCREEN_HEIGHT * 0.80, "Use Arrow Keys or CLICK to change", UI_SMALLFONT|UI_CENTER, colorWhite ); |
| 788 |
} |
| 789 |
|
| 790 |
|
| 791 |
/* |
| 792 |
================= |
| 793 |
Controls_DrawPlayer |
| 794 |
================= |
| 795 |
*/ |
| 796 |
static void Controls_DrawPlayer( void *self ) { |
| 797 |
menubitmap_s *b; |
| 798 |
char buf[MAX_QPATH]; |
| 799 |
|
| 800 |
trap_Cvar_VariableStringBuffer( "model", buf, sizeof( buf ) ); |
| 801 |
if ( strcmp( buf, s_controls.playerModel ) != 0 ) { |
| 802 |
UI_PlayerInfo_SetModel( &s_controls.playerinfo, buf ); |
| 803 |
strcpy( s_controls.playerModel, buf ); |
| 804 |
Controls_UpdateModel( ANIM_IDLE ); |
| 805 |
} |
| 806 |
|
| 807 |
b = (menubitmap_s*) self; |
| 808 |
UI_DrawPlayer( b->generic.x, b->generic.y, b->width, b->height, &s_controls.playerinfo, uis.realtime/2 ); |
| 809 |
} |
| 810 |
|
| 811 |
|
| 812 |
/* |
| 813 |
================= |
| 814 |
Controls_GetKeyAssignment |
| 815 |
================= |
| 816 |
*/ |
| 817 |
static void Controls_GetKeyAssignment (char *command, int *twokeys) |
| 818 |
{ |
| 819 |
int count; |
| 820 |
int j; |
| 821 |
char b[256]; |
| 822 |
|
| 823 |
twokeys[0] = twokeys[1] = -1; |
| 824 |
count = 0; |
| 825 |
|
| 826 |
for ( j = 0; j < 256; j++ ) |
| 827 |
{ |
| 828 |
trap_Key_GetBindingBuf( j, b, 256 ); |
| 829 |
if ( *b == 0 ) { |
| 830 |
continue; |
| 831 |
} |
| 832 |
if ( !Q_stricmp( b, command ) ) { |
| 833 |
twokeys[count] = j; |
| 834 |
count++; |
| 835 |
if (count == 2) |
| 836 |
break; |
| 837 |
} |
| 838 |
} |
| 839 |
} |
| 840 |
|
| 841 |
/* |
| 842 |
================= |
| 843 |
Controls_GetConfig |
| 844 |
================= |
| 845 |
*/ |
| 846 |
static void Controls_GetConfig( void ) |
| 847 |
{ |
| 848 |
int i; |
| 849 |
int twokeys[2]; |
| 850 |
bind_t* bindptr; |
| 851 |
|
| 852 |
// put the bindings into a local store |
| 853 |
bindptr = g_bindings; |
| 854 |
|
| 855 |
// iterate each command, get its numeric binding |
| 856 |
for (i=0; ;i++,bindptr++) |
| 857 |
{ |
| 858 |
if (!bindptr->label) |
| 859 |
break; |
| 860 |
|
| 861 |
Controls_GetKeyAssignment(bindptr->command, twokeys); |
| 862 |
|
| 863 |
bindptr->bind1 = twokeys[0]; |
| 864 |
bindptr->bind2 = twokeys[1]; |
| 865 |
} |
| 866 |
|
| 867 |
s_controls.invertmouse.curvalue = Controls_GetCvarValue( "m_pitch" ) < 0; |
| 868 |
s_controls.smoothmouse.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "m_filter" ) ); |
| 869 |
s_controls.alwaysrun.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cl_run" ) ); |
| 870 |
s_controls.autoswitch.curvalue = UI_ClampCvar( 0, 4, Controls_GetCvarValue( "cg_autoswitch" ) ); |
| 871 |
s_controls.sensitivity.curvalue = UI_ClampCvar( 2, 30, Controls_GetCvarValue( "sensitivity" ) ); |
| 872 |
s_controls.joyenable.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "in_joystick" ) ); |
| 873 |
s_controls.joythreshold.curvalue = UI_ClampCvar( 0.05f, 0.75f, Controls_GetCvarValue( "joy_threshold" ) ); |
| 874 |
s_controls.freelook.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cl_freelook" ) ); |
| 875 |
s_controls.voip_teamonly.curvalue= UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cg_voipTeamOnly" ) ); |
| 876 |
} |
| 877 |
|
| 878 |
/* |
| 879 |
================= |
| 880 |
Controls_SetConfig |
| 881 |
================= |
| 882 |
*/ |
| 883 |
static void Controls_SetConfig( void ) |
| 884 |
{ |
| 885 |
int i; |
| 886 |
bind_t* bindptr; |
| 887 |
|
| 888 |
// set the bindings from the local store |
| 889 |
bindptr = g_bindings; |
| 890 |
|
| 891 |
// iterate each command, get its numeric binding |
| 892 |
for (i=0; ;i++,bindptr++) |
| 893 |
{ |
| 894 |
if (!bindptr->label) |
| 895 |
break; |
| 896 |
|
| 897 |
if (bindptr->bind1 != -1) |
| 898 |
{ |
| 899 |
trap_Key_SetBinding( bindptr->bind1, bindptr->command ); |
| 900 |
|
| 901 |
if (bindptr->bind2 != -1) |
| 902 |
trap_Key_SetBinding( bindptr->bind2, bindptr->command ); |
| 903 |
} |
| 904 |
} |
| 905 |
|
| 906 |
if ( s_controls.invertmouse.curvalue ) |
| 907 |
trap_Cvar_SetValue( "m_pitch", -fabs( trap_Cvar_VariableValue( "m_pitch" ) ) ); |
| 908 |
else |
| 909 |
trap_Cvar_SetValue( "m_pitch", fabs( trap_Cvar_VariableValue( "m_pitch" ) ) ); |
| 910 |
|
| 911 |
trap_Cvar_SetValue( "m_filter", s_controls.smoothmouse.curvalue ); |
| 912 |
trap_Cvar_SetValue( "cl_run", s_controls.alwaysrun.curvalue ); |
| 913 |
trap_Cvar_SetValue( "cg_autoswitch", s_controls.autoswitch.curvalue ); |
| 914 |
trap_Cvar_SetValue( "sensitivity", s_controls.sensitivity.curvalue ); |
| 915 |
trap_Cvar_SetValue( "in_joystick", s_controls.joyenable.curvalue ); |
| 916 |
trap_Cvar_SetValue( "joy_threshold", s_controls.joythreshold.curvalue ); |
| 917 |
trap_Cvar_SetValue( "cl_freelook", s_controls.freelook.curvalue ); |
| 918 |
trap_Cvar_SetValue( "cg_voipTeamOnly", s_controls.voip_teamonly.curvalue); |
| 919 |
trap_Cmd_ExecuteText( EXEC_APPEND, "in_restart\n" ); |
| 920 |
} |
| 921 |
|
| 922 |
/* |
| 923 |
================= |
| 924 |
Controls_SetDefaults |
| 925 |
================= |
| 926 |
*/ |
| 927 |
static void Controls_SetDefaults( void ) |
| 928 |
{ |
| 929 |
int i; |
| 930 |
bind_t* bindptr; |
| 931 |
|
| 932 |
// set the bindings from the local store |
| 933 |
bindptr = g_bindings; |
| 934 |
|
| 935 |
// iterate each command, set its default binding |
| 936 |
for (i=0; ;i++,bindptr++) |
| 937 |
{ |
| 938 |
if (!bindptr->label) |
| 939 |
break; |
| 940 |
|
| 941 |
bindptr->bind1 = bindptr->defaultbind1; |
| 942 |
bindptr->bind2 = bindptr->defaultbind2; |
| 943 |
} |
| 944 |
|
| 945 |
s_controls.invertmouse.curvalue = Controls_GetCvarDefault( "m_pitch" ) < 0; |
| 946 |
s_controls.smoothmouse.curvalue = Controls_GetCvarDefault( "m_filter" ); |
| 947 |
s_controls.alwaysrun.curvalue = Controls_GetCvarDefault( "cl_run" ); |
| 948 |
s_controls.autoswitch.curvalue = Controls_GetCvarDefault( "cg_autoswitch" ); |
| 949 |
s_controls.sensitivity.curvalue = Controls_GetCvarDefault( "sensitivity" ); |
| 950 |
s_controls.joyenable.curvalue = Controls_GetCvarDefault( "in_joystick" ); |
| 951 |
s_controls.joythreshold.curvalue = Controls_GetCvarDefault( "joy_threshold" ); |
| 952 |
s_controls.freelook.curvalue = Controls_GetCvarDefault( "cl_freelook" ); |
| 953 |
s_controls.voip_teamonly.curvalue= Controls_GetCvarDefault( "cg_voipTeamOnly"); |
| 954 |
} |
| 955 |
|
| 956 |
/* |
| 957 |
================= |
| 958 |
Controls_MenuKey |
| 959 |
================= |
| 960 |
*/ |
| 961 |
static sfxHandle_t Controls_MenuKey( int key ) |
| 962 |
{ |
| 963 |
int id; |
| 964 |
int i; |
| 965 |
qboolean found; |
| 966 |
bind_t* bindptr; |
| 967 |
found = qfalse; |
| 968 |
|
| 969 |
if (!s_controls.waitingforkey) |
| 970 |
{ |
| 971 |
switch (key) |
| 972 |
{ |
| 973 |
case K_BACKSPACE: |
| 974 |
case K_DEL: |
| 975 |
case K_KP_DEL: |
| 976 |
key = -1; |
| 977 |
break; |
| 978 |
|
| 979 |
case K_MOUSE2: |
| 980 |
case K_ESCAPE: |
| 981 |
if (s_controls.changesmade) |
| 982 |
Controls_SetConfig(); |
| 983 |
goto ignorekey; |
| 984 |
|
| 985 |
default: |
| 986 |
goto ignorekey; |
| 987 |
} |
| 988 |
} |
| 989 |
else |
| 990 |
{ |
| 991 |
if (key & K_CHAR_FLAG) |
| 992 |
goto ignorekey; |
| 993 |
|
| 994 |
switch (key) |
| 995 |
{ |
| 996 |
case K_ESCAPE: |
| 997 |
s_controls.waitingforkey = qfalse; |
| 998 |
Controls_Update(); |
| 999 |
return (menu_out_sound); |
| 1000 |
|
| 1001 |
case '`': |
| 1002 |
goto ignorekey; |
| 1003 |
} |
| 1004 |
} |
| 1005 |
|
| 1006 |
s_controls.changesmade = qtrue; |
| 1007 |
|
| 1008 |
if (key != -1) |
| 1009 |
{ |
| 1010 |
// remove from any other bind |
| 1011 |
bindptr = g_bindings; |
| 1012 |
for (i=0; ;i++,bindptr++) |
| 1013 |
{ |
| 1014 |
if (!bindptr->label) |
| 1015 |
break; |
| 1016 |
|
| 1017 |
if (bindptr->bind2 == key) |
| 1018 |
bindptr->bind2 = -1; |
| 1019 |
|
| 1020 |
if (bindptr->bind1 == key) |
| 1021 |
{ |
| 1022 |
bindptr->bind1 = bindptr->bind2; |
| 1023 |
bindptr->bind2 = -1; |
| 1024 |
} |
| 1025 |
} |
| 1026 |
} |
| 1027 |
|
| 1028 |
// assign key to local store |
| 1029 |
id = ((menucommon_s*)(s_controls.menu.items[s_controls.menu.cursor]))->id; |
| 1030 |
bindptr = g_bindings; |
| 1031 |
for (i=0; ;i++,bindptr++) |
| 1032 |
{ |
| 1033 |
if (!bindptr->label) |
| 1034 |
break; |
| 1035 |
|
| 1036 |
if (bindptr->id == id) |
| 1037 |
{ |
| 1038 |
found = qtrue; |
| 1039 |
if (key == -1) |
| 1040 |
{ |
| 1041 |
if( bindptr->bind1 != -1 ) { |
| 1042 |
trap_Key_SetBinding( bindptr->bind1, "" ); |
| 1043 |
bindptr->bind1 = -1; |
| 1044 |
} |
| 1045 |
if( bindptr->bind2 != -1 ) { |
| 1046 |
trap_Key_SetBinding( bindptr->bind2, "" ); |
| 1047 |
bindptr->bind2 = -1; |
| 1048 |
} |
| 1049 |
} |
| 1050 |
else if (bindptr->bind1 == -1) { |
| 1051 |
bindptr->bind1 = key; |
| 1052 |
} |
| 1053 |
else if (bindptr->bind1 != key && bindptr->bind2 == -1) { |
| 1054 |
bindptr->bind2 = key; |
| 1055 |
} |
| 1056 |
else |
| 1057 |
{ |
| 1058 |
trap_Key_SetBinding( bindptr->bind1, "" ); |
| 1059 |
trap_Key_SetBinding( bindptr->bind2, "" ); |
| 1060 |
bindptr->bind1 = key; |
| 1061 |
bindptr->bind2 = -1; |
| 1062 |
} |
| 1063 |
break; |
| 1064 |
} |
| 1065 |
} |
| 1066 |
|
| 1067 |
s_controls.waitingforkey = qfalse; |
| 1068 |
|
| 1069 |
if (found) |
| 1070 |
{ |
| 1071 |
Controls_Update(); |
| 1072 |
return (menu_out_sound); |
| 1073 |
} |
| 1074 |
|
| 1075 |
ignorekey: |
| 1076 |
return Menu_DefaultKey( &s_controls.menu, key ); |
| 1077 |
} |
| 1078 |
|
| 1079 |
/* |
| 1080 |
================= |
| 1081 |
Controls_ResetDefaults_Action |
| 1082 |
================= |
| 1083 |
*/ |
| 1084 |
static void Controls_ResetDefaults_Action( qboolean result ) { |
| 1085 |
if( !result ) { |
| 1086 |
return; |
| 1087 |
} |
| 1088 |
|
| 1089 |
s_controls.changesmade = qtrue; |
| 1090 |
Controls_SetDefaults(); |
| 1091 |
Controls_Update(); |
| 1092 |
} |
| 1093 |
|
| 1094 |
/* |
| 1095 |
================= |
| 1096 |
Controls_ResetDefaults_Draw |
| 1097 |
================= |
| 1098 |
*/ |
| 1099 |
static void Controls_ResetDefaults_Draw( void ) { |
| 1100 |
UI_DrawProportionalString( SCREEN_WIDTH/2, 356 + PROP_HEIGHT * 0, "WARNING: This will reset all", UI_CENTER|UI_SMALLFONT, color_yellow ); |
| 1101 |
UI_DrawProportionalString( SCREEN_WIDTH/2, 356 + PROP_HEIGHT * 1, "controls to their default values.", UI_CENTER|UI_SMALLFONT, color_yellow ); |
| 1102 |
} |
| 1103 |
|
| 1104 |
/* |
| 1105 |
================= |
| 1106 |
Controls_MenuEvent |
| 1107 |
================= |
| 1108 |
*/ |
| 1109 |
static void Controls_MenuEvent( void* ptr, int event ) |
| 1110 |
{ |
| 1111 |
switch (((menucommon_s*)ptr)->id) |
| 1112 |
{ |
| 1113 |
case ID_MOVEMENT: |
| 1114 |
if (event == QM_ACTIVATED) |
| 1115 |
{ |
| 1116 |
s_controls.section = C_MOVEMENT; |
| 1117 |
Controls_Update(); |
| 1118 |
} |
| 1119 |
break; |
| 1120 |
|
| 1121 |
case ID_LOOKING: |
| 1122 |
if (event == QM_ACTIVATED) |
| 1123 |
{ |
| 1124 |
s_controls.section = C_LOOKING; |
| 1125 |
Controls_Update(); |
| 1126 |
} |
| 1127 |
break; |
| 1128 |
|
| 1129 |
case ID_WEAPONS: |
| 1130 |
if (event == QM_ACTIVATED) |
| 1131 |
{ |
| 1132 |
s_controls.section = C_WEAPONS; |
| 1133 |
Controls_Update(); |
| 1134 |
} |
| 1135 |
break; |
| 1136 |
|
| 1137 |
case ID_MISC: |
| 1138 |
if (event == QM_ACTIVATED) |
| 1139 |
{ |
| 1140 |
s_controls.section = C_MISC; |
| 1141 |
Controls_Update(); |
| 1142 |
} |
| 1143 |
break; |
| 1144 |
|
| 1145 |
case ID_DEFAULTS: |
| 1146 |
if (event == QM_ACTIVATED) |
| 1147 |
{ |
| 1148 |
UI_ConfirmMenu( "SET TO DEFAULTS?", Controls_ResetDefaults_Draw, Controls_ResetDefaults_Action ); |
| 1149 |
} |
| 1150 |
break; |
| 1151 |
|
| 1152 |
case ID_BACK: |
| 1153 |
if (event == QM_ACTIVATED) |
| 1154 |
{ |
| 1155 |
if (s_controls.changesmade) |
| 1156 |
Controls_SetConfig(); |
| 1157 |
UI_PopMenu(); |
| 1158 |
} |
| 1159 |
break; |
| 1160 |
|
| 1161 |
case ID_SAVEANDEXIT: |
| 1162 |
if (event == QM_ACTIVATED) |
| 1163 |
{ |
| 1164 |
Controls_SetConfig(); |
| 1165 |
UI_PopMenu(); |
| 1166 |
} |
| 1167 |
break; |
| 1168 |
|
| 1169 |
case ID_EXIT: |
| 1170 |
if (event == QM_ACTIVATED) |
| 1171 |
{ |
| 1172 |
UI_PopMenu(); |
| 1173 |
} |
| 1174 |
break; |
| 1175 |
|
| 1176 |
case ID_FREELOOK: |
| 1177 |
case ID_MOUSESPEED: |
| 1178 |
case ID_INVERTMOUSE: |
| 1179 |
case ID_SMOOTHMOUSE: |
| 1180 |
case ID_ALWAYSRUN: |
| 1181 |
case ID_AUTOSWITCH: |
| 1182 |
case ID_VOIP_TEAMONLY: |
| 1183 |
case ID_JOYENABLE: |
| 1184 |
case ID_JOYTHRESHOLD: |
| 1185 |
if (event == QM_ACTIVATED) |
| 1186 |
{ |
| 1187 |
s_controls.changesmade = qtrue; |
| 1188 |
} |
| 1189 |
break; |
| 1190 |
} |
| 1191 |
} |
| 1192 |
|
| 1193 |
/* |
| 1194 |
================= |
| 1195 |
Controls_ActionEvent |
| 1196 |
================= |
| 1197 |
*/ |
| 1198 |
static void Controls_ActionEvent( void* ptr, int event ) |
| 1199 |
{ |
| 1200 |
if (event == QM_LOSTFOCUS) |
| 1201 |
{ |
| 1202 |
Controls_UpdateModel( ANIM_IDLE ); |
| 1203 |
} |
| 1204 |
else if (event == QM_GOTFOCUS) |
| 1205 |
{ |
| 1206 |
Controls_UpdateModel( g_bindings[((menucommon_s*)ptr)->id].anim ); |
| 1207 |
} |
| 1208 |
else if ((event == QM_ACTIVATED) && !s_controls.waitingforkey) |
| 1209 |
{ |
| 1210 |
s_controls.waitingforkey = 1; |
| 1211 |
Controls_Update(); |
| 1212 |
} |
| 1213 |
} |
| 1214 |
|
| 1215 |
/* |
| 1216 |
================= |
| 1217 |
Controls_InitModel |
| 1218 |
================= |
| 1219 |
*/ |
| 1220 |
static void Controls_InitModel( void ) |
| 1221 |
{ |
| 1222 |
memset( &s_controls.playerinfo, 0, sizeof(playerInfo_t) ); |
| 1223 |
|
| 1224 |
UI_PlayerInfo_SetModel( &s_controls.playerinfo, UI_Cvar_VariableString( "model" ) ); |
| 1225 |
|
| 1226 |
Controls_UpdateModel( ANIM_IDLE ); |
| 1227 |
} |
| 1228 |
|
| 1229 |
/* |
| 1230 |
================= |
| 1231 |
Controls_InitWeapons |
| 1232 |
================= |
| 1233 |
*/ |
| 1234 |
static void Controls_InitWeapons( void ) { |
| 1235 |
gitem_t * item; |
| 1236 |
|
| 1237 |
for ( item = bg_itemlist + 1 ; item->classname ; item++ ) { |
| 1238 |
if ( item->giType != IT_WEAPON ) { |
| 1239 |
continue; |
| 1240 |
} |
| 1241 |
trap_R_RegisterModel( item->world_model[0] ); |
| 1242 |
} |
| 1243 |
} |
| 1244 |
|
| 1245 |
/* |
| 1246 |
================= |
| 1247 |
Controls_MenuInit |
| 1248 |
================= |
| 1249 |
*/ |
| 1250 |
static void Controls_MenuInit( void ) |
| 1251 |
{ |
| 1252 |
static char playername[32]; |
| 1253 |
|
| 1254 |
// zero set all our globals |
| 1255 |
memset( &s_controls, 0 ,sizeof(controls_t) ); |
| 1256 |
|
| 1257 |
Controls_Cache(); |
| 1258 |
|
| 1259 |
s_controls.menu.key = Controls_MenuKey; |
| 1260 |
s_controls.menu.wrapAround = qtrue; |
| 1261 |
s_controls.menu.fullscreen = qtrue; |
| 1262 |
|
| 1263 |
s_controls.banner.generic.type = MTYPE_BTEXT; |
| 1264 |
s_controls.banner.generic.flags = QMF_CENTER_JUSTIFY; |
| 1265 |
s_controls.banner.generic.x = 320; |
| 1266 |
s_controls.banner.generic.y = 16; |
| 1267 |
s_controls.banner.string = "CONTROLS"; |
| 1268 |
s_controls.banner.color = color_white; |
| 1269 |
s_controls.banner.style = UI_CENTER; |
| 1270 |
|
| 1271 |
s_controls.framel.generic.type = MTYPE_BITMAP; |
| 1272 |
s_controls.framel.generic.name = ART_FRAMEL; |
| 1273 |
s_controls.framel.generic.flags = QMF_LEFT_JUSTIFY|QMF_INACTIVE; |
| 1274 |
s_controls.framel.generic.x = 0; |
| 1275 |
s_controls.framel.generic.y = 78; |
| 1276 |
s_controls.framel.width = 256; |
| 1277 |
s_controls.framel.height = 329; |
| 1278 |
|
| 1279 |
s_controls.framer.generic.type = MTYPE_BITMAP; |
| 1280 |
s_controls.framer.generic.name = ART_FRAMER; |
| 1281 |
s_controls.framer.generic.flags = QMF_LEFT_JUSTIFY|QMF_INACTIVE; |
| 1282 |
s_controls.framer.generic.x = 376; |
| 1283 |
s_controls.framer.generic.y = 76; |
| 1284 |
s_controls.framer.width = 256; |
| 1285 |
s_controls.framer.height = 334; |
| 1286 |
|
| 1287 |
s_controls.looking.generic.type = MTYPE_PTEXT; |
| 1288 |
s_controls.looking.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS; |
| 1289 |
s_controls.looking.generic.id = ID_LOOKING; |
| 1290 |
s_controls.looking.generic.callback = Controls_MenuEvent; |
| 1291 |
s_controls.looking.generic.x = 152; |
| 1292 |
s_controls.looking.generic.y = 240 - 2 * PROP_HEIGHT; |
| 1293 |
s_controls.looking.string = "LOOK"; |
| 1294 |
s_controls.looking.style = UI_RIGHT; |
| 1295 |
s_controls.looking.color = color_red; |
| 1296 |
|
| 1297 |
s_controls.movement.generic.type = MTYPE_PTEXT; |
| 1298 |
s_controls.movement.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS; |
| 1299 |
s_controls.movement.generic.id = ID_MOVEMENT; |
| 1300 |
s_controls.movement.generic.callback = Controls_MenuEvent; |
| 1301 |
s_controls.movement.generic.x = 152; |
| 1302 |
s_controls.movement.generic.y = 240 - PROP_HEIGHT; |
| 1303 |
s_controls.movement.string = "MOVE"; |
| 1304 |
s_controls.movement.style = UI_RIGHT; |
| 1305 |
s_controls.movement.color = color_red; |
| 1306 |
|
| 1307 |
s_controls.weapons.generic.type = MTYPE_PTEXT; |
| 1308 |
s_controls.weapons.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS; |
| 1309 |
s_controls.weapons.generic.id = ID_WEAPONS; |
| 1310 |
s_controls.weapons.generic.callback = Controls_MenuEvent; |
| 1311 |
s_controls.weapons.generic.x = 152; |
| 1312 |
s_controls.weapons.generic.y = 240; |
| 1313 |
s_controls.weapons.string = "SHOOT"; |
| 1314 |
s_controls.weapons.style = UI_RIGHT; |
| 1315 |
s_controls.weapons.color = color_red; |
| 1316 |
|
| 1317 |
s_controls.misc.generic.type = MTYPE_PTEXT; |
| 1318 |
s_controls.misc.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS; |
| 1319 |
s_controls.misc.generic.id = ID_MISC; |
| 1320 |
s_controls.misc.generic.callback = Controls_MenuEvent; |
| 1321 |
s_controls.misc.generic.x = 152; |
| 1322 |
s_controls.misc.generic.y = 240 + PROP_HEIGHT; |
| 1323 |
s_controls.misc.string = "MISC"; |
| 1324 |
s_controls.misc.style = UI_RIGHT; |
| 1325 |
s_controls.misc.color = color_red; |
| 1326 |
|
| 1327 |
s_controls.back.generic.type = MTYPE_BITMAP; |
| 1328 |
s_controls.back.generic.name = ART_BACK0; |
| 1329 |
s_controls.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; |
| 1330 |
s_controls.back.generic.x = 0; |
| 1331 |
s_controls.back.generic.y = 480-64; |
| 1332 |
s_controls.back.generic.id = ID_BACK; |
| 1333 |
s_controls.back.generic.callback = Controls_MenuEvent; |
| 1334 |
s_controls.back.width = 128; |
| 1335 |
s_controls.back.height = 64; |
| 1336 |
s_controls.back.focuspic = ART_BACK1; |
| 1337 |
|
| 1338 |
s_controls.player.generic.type = MTYPE_BITMAP; |
| 1339 |
s_controls.player.generic.flags = QMF_INACTIVE; |
| 1340 |
s_controls.player.generic.ownerdraw = Controls_DrawPlayer; |
| 1341 |
s_controls.player.generic.x = 400; |
| 1342 |
s_controls.player.generic.y = -40; |
| 1343 |
s_controls.player.width = 32*10; |
| 1344 |
s_controls.player.height = 56*10; |
| 1345 |
|
| 1346 |
s_controls.walkforward.generic.type = MTYPE_ACTION; |
| 1347 |
s_controls.walkforward.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1348 |
s_controls.walkforward.generic.callback = Controls_ActionEvent; |
| 1349 |
s_controls.walkforward.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1350 |
s_controls.walkforward.generic.id = ID_FORWARD; |
| 1351 |
|
| 1352 |
s_controls.backpedal.generic.type = MTYPE_ACTION; |
| 1353 |
s_controls.backpedal.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1354 |
s_controls.backpedal.generic.callback = Controls_ActionEvent; |
| 1355 |
s_controls.backpedal.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1356 |
s_controls.backpedal.generic.id = ID_BACKPEDAL; |
| 1357 |
|
| 1358 |
s_controls.stepleft.generic.type = MTYPE_ACTION; |
| 1359 |
s_controls.stepleft.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1360 |
s_controls.stepleft.generic.callback = Controls_ActionEvent; |
| 1361 |
s_controls.stepleft.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1362 |
s_controls.stepleft.generic.id = ID_MOVELEFT; |
| 1363 |
|
| 1364 |
s_controls.stepright.generic.type = MTYPE_ACTION; |
| 1365 |
s_controls.stepright.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1366 |
s_controls.stepright.generic.callback = Controls_ActionEvent; |
| 1367 |
s_controls.stepright.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1368 |
s_controls.stepright.generic.id = ID_MOVERIGHT; |
| 1369 |
|
| 1370 |
s_controls.moveup.generic.type = MTYPE_ACTION; |
| 1371 |
s_controls.moveup.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1372 |
s_controls.moveup.generic.callback = Controls_ActionEvent; |
| 1373 |
s_controls.moveup.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1374 |
s_controls.moveup.generic.id = ID_MOVEUP; |
| 1375 |
|
| 1376 |
s_controls.movedown.generic.type = MTYPE_ACTION; |
| 1377 |
s_controls.movedown.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1378 |
s_controls.movedown.generic.callback = Controls_ActionEvent; |
| 1379 |
s_controls.movedown.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1380 |
s_controls.movedown.generic.id = ID_MOVEDOWN; |
| 1381 |
|
| 1382 |
s_controls.turnleft.generic.type = MTYPE_ACTION; |
| 1383 |
s_controls.turnleft.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1384 |
s_controls.turnleft.generic.callback = Controls_ActionEvent; |
| 1385 |
s_controls.turnleft.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1386 |
s_controls.turnleft.generic.id = ID_LEFT; |
| 1387 |
|
| 1388 |
s_controls.turnright.generic.type = MTYPE_ACTION; |
| 1389 |
s_controls.turnright.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1390 |
s_controls.turnright.generic.callback = Controls_ActionEvent; |
| 1391 |
s_controls.turnright.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1392 |
s_controls.turnright.generic.id = ID_RIGHT; |
| 1393 |
|
| 1394 |
s_controls.sidestep.generic.type = MTYPE_ACTION; |
| 1395 |
s_controls.sidestep.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1396 |
s_controls.sidestep.generic.callback = Controls_ActionEvent; |
| 1397 |
s_controls.sidestep.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1398 |
s_controls.sidestep.generic.id = ID_STRAFE; |
| 1399 |
|
| 1400 |
s_controls.run.generic.type = MTYPE_ACTION; |
| 1401 |
s_controls.run.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1402 |
s_controls.run.generic.callback = Controls_ActionEvent; |
| 1403 |
s_controls.run.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1404 |
s_controls.run.generic.id = ID_SPEED; |
| 1405 |
|
| 1406 |
s_controls.chainsaw.generic.type = MTYPE_ACTION; |
| 1407 |
s_controls.chainsaw.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1408 |
s_controls.chainsaw.generic.callback = Controls_ActionEvent; |
| 1409 |
s_controls.chainsaw.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1410 |
s_controls.chainsaw.generic.id = ID_WEAPON1; |
| 1411 |
|
| 1412 |
s_controls.machinegun.generic.type = MTYPE_ACTION; |
| 1413 |
s_controls.machinegun.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1414 |
s_controls.machinegun.generic.callback = Controls_ActionEvent; |
| 1415 |
s_controls.machinegun.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1416 |
s_controls.machinegun.generic.id = ID_WEAPON2; |
| 1417 |
|
| 1418 |
s_controls.shotgun.generic.type = MTYPE_ACTION; |
| 1419 |
s_controls.shotgun.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1420 |
s_controls.shotgun.generic.callback = Controls_ActionEvent; |
| 1421 |
s_controls.shotgun.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1422 |
s_controls.shotgun.generic.id = ID_WEAPON3; |
| 1423 |
|
| 1424 |
s_controls.grenadelauncher.generic.type = MTYPE_ACTION; |
| 1425 |
s_controls.grenadelauncher.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1426 |
s_controls.grenadelauncher.generic.callback = Controls_ActionEvent; |
| 1427 |
s_controls.grenadelauncher.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1428 |
s_controls.grenadelauncher.generic.id = ID_WEAPON4; |
| 1429 |
|
| 1430 |
s_controls.rocketlauncher.generic.type = MTYPE_ACTION; |
| 1431 |
s_controls.rocketlauncher.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1432 |
s_controls.rocketlauncher.generic.callback = Controls_ActionEvent; |
| 1433 |
s_controls.rocketlauncher.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1434 |
s_controls.rocketlauncher.generic.id = ID_WEAPON5; |
| 1435 |
|
| 1436 |
s_controls.lightning.generic.type = MTYPE_ACTION; |
| 1437 |
s_controls.lightning.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1438 |
s_controls.lightning.generic.callback = Controls_ActionEvent; |
| 1439 |
s_controls.lightning.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1440 |
s_controls.lightning.generic.id = ID_WEAPON6; |
| 1441 |
|
| 1442 |
s_controls.railgun.generic.type = MTYPE_ACTION; |
| 1443 |
s_controls.railgun.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1444 |
s_controls.railgun.generic.callback = Controls_ActionEvent; |
| 1445 |
s_controls.railgun.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1446 |
s_controls.railgun.generic.id = ID_WEAPON7; |
| 1447 |
|
| 1448 |
s_controls.plasma.generic.type = MTYPE_ACTION; |
| 1449 |
s_controls.plasma.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1450 |
s_controls.plasma.generic.callback = Controls_ActionEvent; |
| 1451 |
s_controls.plasma.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1452 |
s_controls.plasma.generic.id = ID_WEAPON8; |
| 1453 |
|
| 1454 |
s_controls.bfg.generic.type = MTYPE_ACTION; |
| 1455 |
s_controls.bfg.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1456 |
s_controls.bfg.generic.callback = Controls_ActionEvent; |
| 1457 |
s_controls.bfg.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1458 |
s_controls.bfg.generic.id = ID_WEAPON9; |
| 1459 |
|
| 1460 |
s_controls.grapple.generic.type = MTYPE_ACTION; |
| 1461 |
s_controls.grapple.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1462 |
s_controls.grapple.generic.callback = Controls_ActionEvent; |
| 1463 |
s_controls.grapple.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1464 |
s_controls.grapple.generic.id = ID_WEAPON10; |
| 1465 |
|
| 1466 |
s_controls.nailgun.generic.type = MTYPE_ACTION; |
| 1467 |
s_controls.nailgun.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1468 |
s_controls.nailgun.generic.callback = Controls_ActionEvent; |
| 1469 |
s_controls.nailgun.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1470 |
s_controls.nailgun.generic.id = ID_WEAPON11; |
| 1471 |
|
| 1472 |
s_controls.proxmine.generic.type = MTYPE_ACTION; |
| 1473 |
s_controls.proxmine.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1474 |
s_controls.proxmine.generic.callback = Controls_ActionEvent; |
| 1475 |
s_controls.proxmine.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1476 |
s_controls.proxmine.generic.id = ID_WEAPON12; |
| 1477 |
|
| 1478 |
s_controls.chaingun.generic.type = MTYPE_ACTION; |
| 1479 |
s_controls.chaingun.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1480 |
s_controls.chaingun.generic.callback = Controls_ActionEvent; |
| 1481 |
s_controls.chaingun.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1482 |
s_controls.chaingun.generic.id = ID_WEAPON13; |
| 1483 |
|
| 1484 |
s_controls.attack.generic.type = MTYPE_ACTION; |
| 1485 |
s_controls.attack.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1486 |
s_controls.attack.generic.callback = Controls_ActionEvent; |
| 1487 |
s_controls.attack.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1488 |
s_controls.attack.generic.id = ID_ATTACK; |
| 1489 |
|
| 1490 |
s_controls.prevweapon.generic.type = MTYPE_ACTION; |
| 1491 |
s_controls.prevweapon.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1492 |
s_controls.prevweapon.generic.callback = Controls_ActionEvent; |
| 1493 |
s_controls.prevweapon.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1494 |
s_controls.prevweapon.generic.id = ID_WEAPPREV; |
| 1495 |
|
| 1496 |
s_controls.nextweapon.generic.type = MTYPE_ACTION; |
| 1497 |
s_controls.nextweapon.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1498 |
s_controls.nextweapon.generic.callback = Controls_ActionEvent; |
| 1499 |
s_controls.nextweapon.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1500 |
s_controls.nextweapon.generic.id = ID_WEAPNEXT; |
| 1501 |
|
| 1502 |
s_controls.lookup.generic.type = MTYPE_ACTION; |
| 1503 |
s_controls.lookup.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1504 |
s_controls.lookup.generic.callback = Controls_ActionEvent; |
| 1505 |
s_controls.lookup.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1506 |
s_controls.lookup.generic.id = ID_LOOKUP; |
| 1507 |
|
| 1508 |
s_controls.lookdown.generic.type = MTYPE_ACTION; |
| 1509 |
s_controls.lookdown.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1510 |
s_controls.lookdown.generic.callback = Controls_ActionEvent; |
| 1511 |
s_controls.lookdown.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1512 |
s_controls.lookdown.generic.id = ID_LOOKDOWN; |
| 1513 |
|
| 1514 |
s_controls.mouselook.generic.type = MTYPE_ACTION; |
| 1515 |
s_controls.mouselook.generic.flags = QMF_LEFT_JUSTIFY|QMF_HIGHLIGHT_IF_FOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1516 |
s_controls.mouselook.generic.callback = Controls_ActionEvent; |
| 1517 |
s_controls.mouselook.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1518 |
s_controls.mouselook.generic.id = ID_MOUSELOOK; |
| 1519 |
|
| 1520 |
s_controls.freelook.generic.type = MTYPE_RADIOBUTTON; |
| 1521 |
s_controls.freelook.generic.flags = QMF_SMALLFONT; |
| 1522 |
s_controls.freelook.generic.x = SCREEN_WIDTH/2; |
| 1523 |
s_controls.freelook.generic.name = "free look"; |
| 1524 |
s_controls.freelook.generic.id = ID_FREELOOK; |
| 1525 |
s_controls.freelook.generic.callback = Controls_MenuEvent; |
| 1526 |
s_controls.freelook.generic.statusbar = Controls_StatusBar; |
| 1527 |
|
| 1528 |
s_controls.centerview.generic.type = MTYPE_ACTION; |
| 1529 |
s_controls.centerview.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1530 |
s_controls.centerview.generic.callback = Controls_ActionEvent; |
| 1531 |
s_controls.centerview.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1532 |
s_controls.centerview.generic.id = ID_CENTERVIEW; |
| 1533 |
|
| 1534 |
s_controls.zoomview.generic.type = MTYPE_ACTION; |
| 1535 |
s_controls.zoomview.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1536 |
s_controls.zoomview.generic.callback = Controls_ActionEvent; |
| 1537 |
s_controls.zoomview.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1538 |
s_controls.zoomview.generic.id = ID_ZOOMVIEW; |
| 1539 |
|
| 1540 |
s_controls.useitem.generic.type = MTYPE_ACTION; |
| 1541 |
s_controls.useitem.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1542 |
s_controls.useitem.generic.callback = Controls_ActionEvent; |
| 1543 |
s_controls.useitem.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1544 |
s_controls.useitem.generic.id = ID_USEITEM; |
| 1545 |
|
| 1546 |
s_controls.showscores.generic.type = MTYPE_ACTION; |
| 1547 |
s_controls.showscores.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1548 |
s_controls.showscores.generic.callback = Controls_ActionEvent; |
| 1549 |
s_controls.showscores.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1550 |
s_controls.showscores.generic.id = ID_SHOWSCORES; |
| 1551 |
|
| 1552 |
s_controls.invertmouse.generic.type = MTYPE_RADIOBUTTON; |
| 1553 |
s_controls.invertmouse.generic.flags = QMF_SMALLFONT; |
| 1554 |
s_controls.invertmouse.generic.x = SCREEN_WIDTH/2; |
| 1555 |
s_controls.invertmouse.generic.name = "invert mouse"; |
| 1556 |
s_controls.invertmouse.generic.id = ID_INVERTMOUSE; |
| 1557 |
s_controls.invertmouse.generic.callback = Controls_MenuEvent; |
| 1558 |
s_controls.invertmouse.generic.statusbar = Controls_StatusBar; |
| 1559 |
|
| 1560 |
s_controls.smoothmouse.generic.type = MTYPE_RADIOBUTTON; |
| 1561 |
s_controls.smoothmouse.generic.flags = QMF_SMALLFONT; |
| 1562 |
s_controls.smoothmouse.generic.x = SCREEN_WIDTH/2; |
| 1563 |
s_controls.smoothmouse.generic.name = "smooth mouse"; |
| 1564 |
s_controls.smoothmouse.generic.id = ID_SMOOTHMOUSE; |
| 1565 |
s_controls.smoothmouse.generic.callback = Controls_MenuEvent; |
| 1566 |
s_controls.smoothmouse.generic.statusbar = Controls_StatusBar; |
| 1567 |
|
| 1568 |
s_controls.alwaysrun.generic.type = MTYPE_RADIOBUTTON; |
| 1569 |
s_controls.alwaysrun.generic.flags = QMF_SMALLFONT; |
| 1570 |
s_controls.alwaysrun.generic.x = SCREEN_WIDTH/2; |
| 1571 |
s_controls.alwaysrun.generic.name = "always run"; |
| 1572 |
s_controls.alwaysrun.generic.id = ID_ALWAYSRUN; |
| 1573 |
s_controls.alwaysrun.generic.callback = Controls_MenuEvent; |
| 1574 |
s_controls.alwaysrun.generic.statusbar = Controls_StatusBar; |
| 1575 |
|
| 1576 |
s_controls.autoswitch.generic.type = MTYPE_SPINCONTROL; |
| 1577 |
s_controls.autoswitch.generic.flags = QMF_SMALLFONT; |
| 1578 |
s_controls.autoswitch.generic.x = SCREEN_WIDTH/2; |
| 1579 |
s_controls.autoswitch.generic.name = "autoswitch weapons"; |
| 1580 |
s_controls.autoswitch.generic.id = ID_AUTOSWITCH; |
| 1581 |
s_controls.autoswitch.generic.callback = Controls_MenuEvent; |
| 1582 |
s_controls.autoswitch.generic.statusbar = Controls_StatusBar; |
| 1583 |
s_controls.autoswitch.itemnames = autoswitch_items; |
| 1584 |
|
| 1585 |
s_controls.sensitivity.generic.type = MTYPE_SLIDER; |
| 1586 |
s_controls.sensitivity.generic.x = SCREEN_WIDTH/2; |
| 1587 |
s_controls.sensitivity.generic.flags = QMF_SMALLFONT; |
| 1588 |
s_controls.sensitivity.generic.name = "mouse speed"; |
| 1589 |
s_controls.sensitivity.generic.id = ID_MOUSESPEED; |
| 1590 |
s_controls.sensitivity.generic.callback = Controls_MenuEvent; |
| 1591 |
s_controls.sensitivity.minvalue = 2; |
| 1592 |
s_controls.sensitivity.maxvalue = 30; |
| 1593 |
s_controls.sensitivity.generic.statusbar = Controls_StatusBar; |
| 1594 |
|
| 1595 |
s_controls.gesture.generic.type = MTYPE_ACTION; |
| 1596 |
s_controls.gesture.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1597 |
s_controls.gesture.generic.callback = Controls_ActionEvent; |
| 1598 |
s_controls.gesture.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1599 |
s_controls.gesture.generic.id = ID_GESTURE; |
| 1600 |
|
| 1601 |
s_controls.chat.generic.type = MTYPE_ACTION; |
| 1602 |
s_controls.chat.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1603 |
s_controls.chat.generic.callback = Controls_ActionEvent; |
| 1604 |
s_controls.chat.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1605 |
s_controls.chat.generic.id = ID_CHAT; |
| 1606 |
|
| 1607 |
s_controls.chat2.generic.type = MTYPE_ACTION; |
| 1608 |
s_controls.chat2.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1609 |
s_controls.chat2.generic.callback = Controls_ActionEvent; |
| 1610 |
s_controls.chat2.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1611 |
s_controls.chat2.generic.id = ID_CHAT2; |
| 1612 |
|
| 1613 |
s_controls.chat3.generic.type = MTYPE_ACTION; |
| 1614 |
s_controls.chat3.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1615 |
s_controls.chat3.generic.callback = Controls_ActionEvent; |
| 1616 |
s_controls.chat3.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1617 |
s_controls.chat3.generic.id = ID_CHAT3; |
| 1618 |
|
| 1619 |
s_controls.chat4.generic.type = MTYPE_ACTION; |
| 1620 |
s_controls.chat4.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1621 |
s_controls.chat4.generic.callback = Controls_ActionEvent; |
| 1622 |
s_controls.chat4.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1623 |
s_controls.chat4.generic.id = ID_CHAT4; |
| 1624 |
|
| 1625 |
s_controls.voip_talk.generic.type = MTYPE_ACTION; |
| 1626 |
s_controls.voip_talk.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; |
| 1627 |
s_controls.voip_talk.generic.callback = Controls_ActionEvent; |
| 1628 |
s_controls.voip_talk.generic.ownerdraw = Controls_DrawKeyBinding; |
| 1629 |
s_controls.voip_talk.generic.id = ID_VOIP_TALK; |
| 1630 |
|
| 1631 |
s_controls.voip_teamonly.generic.type = MTYPE_RADIOBUTTON; |
| 1632 |
s_controls.voip_teamonly.generic.flags = QMF_SMALLFONT; |
| 1633 |
s_controls.voip_teamonly.generic.x = SCREEN_WIDTH/2; |
| 1634 |
s_controls.voip_teamonly.generic.name = "teamonly voicechat"; |
| 1635 |
s_controls.voip_teamonly.generic.id = ID_VOIP_TEAMONLY; |
| 1636 |
s_controls.voip_teamonly.generic.callback = Controls_MenuEvent; |
| 1637 |
s_controls.voip_teamonly.generic.statusbar = Controls_StatusBar; |
| 1638 |
|
| 1639 |
s_controls.joyenable.generic.type = MTYPE_RADIOBUTTON; |
| 1640 |
s_controls.joyenable.generic.flags = QMF_SMALLFONT; |
| 1641 |
s_controls.joyenable.generic.x = SCREEN_WIDTH/2; |
| 1642 |
s_controls.joyenable.generic.name = "joystick"; |
| 1643 |
s_controls.joyenable.generic.id = ID_JOYENABLE; |
| 1644 |
s_controls.joyenable.generic.callback = Controls_MenuEvent; |
| 1645 |
s_controls.joyenable.generic.statusbar = Controls_StatusBar; |
| 1646 |
|
| 1647 |
s_controls.joythreshold.generic.type = MTYPE_SLIDER; |
| 1648 |
s_controls.joythreshold.generic.x = SCREEN_WIDTH/2; |
| 1649 |
s_controls.joythreshold.generic.flags = QMF_SMALLFONT; |
| 1650 |
s_controls.joythreshold.generic.name = "joystick threshold"; |
| 1651 |
s_controls.joythreshold.generic.id = ID_JOYTHRESHOLD; |
| 1652 |
s_controls.joythreshold.generic.callback = Controls_MenuEvent; |
| 1653 |
s_controls.joythreshold.minvalue = 0.05f; |
| 1654 |
s_controls.joythreshold.maxvalue = 0.75f; |
| 1655 |
s_controls.joythreshold.generic.statusbar = Controls_StatusBar; |
| 1656 |
|
| 1657 |
s_controls.name.generic.type = MTYPE_PTEXT; |
| 1658 |
s_controls.name.generic.flags = QMF_CENTER_JUSTIFY|QMF_INACTIVE; |
| 1659 |
s_controls.name.generic.x = 320; |
| 1660 |
s_controls.name.generic.y = 440; |
| 1661 |
s_controls.name.string = playername; |
| 1662 |
s_controls.name.style = UI_CENTER; |
| 1663 |
s_controls.name.color = text_color_normal; |
| 1664 |
|
| 1665 |
Menu_AddItem( &s_controls.menu, &s_controls.banner ); |
| 1666 |
Menu_AddItem( &s_controls.menu, &s_controls.framel ); |
| 1667 |
Menu_AddItem( &s_controls.menu, &s_controls.framer ); |
| 1668 |
Menu_AddItem( &s_controls.menu, &s_controls.player ); |
| 1669 |
Menu_AddItem( &s_controls.menu, &s_controls.name ); |
| 1670 |
|
| 1671 |
Menu_AddItem( &s_controls.menu, &s_controls.looking ); |
| 1672 |
Menu_AddItem( &s_controls.menu, &s_controls.movement ); |
| 1673 |
Menu_AddItem( &s_controls.menu, &s_controls.weapons ); |
| 1674 |
Menu_AddItem( &s_controls.menu, &s_controls.misc ); |
| 1675 |
|
| 1676 |
Menu_AddItem( &s_controls.menu, &s_controls.sensitivity ); |
| 1677 |
Menu_AddItem( &s_controls.menu, &s_controls.smoothmouse ); |
| 1678 |
Menu_AddItem( &s_controls.menu, &s_controls.invertmouse ); |
| 1679 |
Menu_AddItem( &s_controls.menu, &s_controls.lookup ); |
| 1680 |
Menu_AddItem( &s_controls.menu, &s_controls.lookdown ); |
| 1681 |
Menu_AddItem( &s_controls.menu, &s_controls.mouselook ); |
| 1682 |
Menu_AddItem( &s_controls.menu, &s_controls.freelook ); |
| 1683 |
Menu_AddItem( &s_controls.menu, &s_controls.centerview ); |
| 1684 |
Menu_AddItem( &s_controls.menu, &s_controls.zoomview ); |
| 1685 |
Menu_AddItem( &s_controls.menu, &s_controls.joyenable ); |
| 1686 |
Menu_AddItem( &s_controls.menu, &s_controls.joythreshold ); |
| 1687 |
|
| 1688 |
Menu_AddItem( &s_controls.menu, &s_controls.alwaysrun ); |
| 1689 |
Menu_AddItem( &s_controls.menu, &s_controls.run ); |
| 1690 |
Menu_AddItem( &s_controls.menu, &s_controls.walkforward ); |
| 1691 |
Menu_AddItem( &s_controls.menu, &s_controls.backpedal ); |
| 1692 |
Menu_AddItem( &s_controls.menu, &s_controls.stepleft ); |
| 1693 |
Menu_AddItem( &s_controls.menu, &s_controls.stepright ); |
| 1694 |
Menu_AddItem( &s_controls.menu, &s_controls.moveup ); |
| 1695 |
Menu_AddItem( &s_controls.menu, &s_controls.movedown ); |
| 1696 |
Menu_AddItem( &s_controls.menu, &s_controls.turnleft ); |
| 1697 |
Menu_AddItem( &s_controls.menu, &s_controls.turnright ); |
| 1698 |
Menu_AddItem( &s_controls.menu, &s_controls.sidestep ); |
| 1699 |
|
| 1700 |
Menu_AddItem( &s_controls.menu, &s_controls.attack ); |
| 1701 |
Menu_AddItem( &s_controls.menu, &s_controls.nextweapon ); |
| 1702 |
Menu_AddItem( &s_controls.menu, &s_controls.prevweapon ); |
| 1703 |
Menu_AddItem( &s_controls.menu, &s_controls.autoswitch ); |
| 1704 |
Menu_AddItem( &s_controls.menu, &s_controls.chainsaw ); |
| 1705 |
Menu_AddItem( &s_controls.menu, &s_controls.machinegun ); |
| 1706 |
Menu_AddItem( &s_controls.menu, &s_controls.shotgun ); |
| 1707 |
Menu_AddItem( &s_controls.menu, &s_controls.grenadelauncher ); |
| 1708 |
Menu_AddItem( &s_controls.menu, &s_controls.rocketlauncher ); |
| 1709 |
Menu_AddItem( &s_controls.menu, &s_controls.lightning ); |
| 1710 |
Menu_AddItem( &s_controls.menu, &s_controls.railgun ); |
| 1711 |
Menu_AddItem( &s_controls.menu, &s_controls.plasma ); |
| 1712 |
Menu_AddItem( &s_controls.menu, &s_controls.bfg ); |
| 1713 |
Menu_AddItem( &s_controls.menu, &s_controls.grapple ); |
| 1714 |
Menu_AddItem( &s_controls.menu, &s_controls.nailgun ); |
| 1715 |
Menu_AddItem( &s_controls.menu, &s_controls.proxmine ); |
| 1716 |
Menu_AddItem( &s_controls.menu, &s_controls.chaingun ); |
| 1717 |
|
| 1718 |
Menu_AddItem( &s_controls.menu, &s_controls.showscores ); |
| 1719 |
Menu_AddItem( &s_controls.menu, &s_controls.useitem ); |
| 1720 |
Menu_AddItem( &s_controls.menu, &s_controls.gesture ); |
| 1721 |
Menu_AddItem( &s_controls.menu, &s_controls.chat ); |
| 1722 |
Menu_AddItem( &s_controls.menu, &s_controls.chat2 ); |
| 1723 |
Menu_AddItem( &s_controls.menu, &s_controls.chat3 ); |
| 1724 |
Menu_AddItem( &s_controls.menu, &s_controls.chat4 ); |
| 1725 |
Menu_AddItem( &s_controls.menu, &s_controls.voip_talk ); |
| 1726 |
Menu_AddItem( &s_controls.menu, &s_controls.voip_teamonly ); |
| 1727 |
|
| 1728 |
Menu_AddItem( &s_controls.menu, &s_controls.back ); |
| 1729 |
|
| 1730 |
trap_Cvar_VariableStringBuffer( "name", s_controls.name.string, 16 ); |
| 1731 |
Q_CleanStr( s_controls.name.string ); |
| 1732 |
|
| 1733 |
// initialize the configurable cvars |
| 1734 |
Controls_InitCvars(); |
| 1735 |
|
| 1736 |
// initialize the current config |
| 1737 |
Controls_GetConfig(); |
| 1738 |
|
| 1739 |
// intialize the model |
| 1740 |
Controls_InitModel(); |
| 1741 |
|
| 1742 |
// intialize the weapons |
| 1743 |
Controls_InitWeapons (); |
| 1744 |
|
| 1745 |
// initial default section |
| 1746 |
s_controls.section = C_LOOKING; |
| 1747 |
|
| 1748 |
// update the ui |
| 1749 |
Controls_Update(); |
| 1750 |
} |
| 1751 |
|
| 1752 |
|
| 1753 |
/* |
| 1754 |
================= |
| 1755 |
Controls_Cache |
| 1756 |
================= |
| 1757 |
*/ |
| 1758 |
void Controls_Cache( void ) { |
| 1759 |
trap_R_RegisterShaderNoMip( ART_BACK0 ); |
| 1760 |
trap_R_RegisterShaderNoMip( ART_BACK1 ); |
| 1761 |
trap_R_RegisterShaderNoMip( ART_FRAMEL ); |
| 1762 |
trap_R_RegisterShaderNoMip( ART_FRAMER ); |
| 1763 |
} |
| 1764 |
|
| 1765 |
|
| 1766 |
/* |
| 1767 |
================= |
| 1768 |
UI_ControlsMenu |
| 1769 |
================= |
| 1770 |
*/ |
| 1771 |
void UI_ControlsMenu( void ) { |
| 1772 |
Controls_MenuInit(); |
| 1773 |
UI_PushMenu( &s_controls.menu ); |
| 1774 |
} |