ui_controls2.c 51 KB

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