ui_video.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. #include "../client/client.h"
  2. #include "../client/ui_local.h"
  3. extern void UI_ForceMenuOff( void );
  4. static const char *s_driver_names[] =
  5. {
  6. "[default OpenGL]",
  7. "[Voodoo OpenGL]",
  8. "[Custom ]",
  9. 0
  10. };
  11. static const char *s_drivers[] =
  12. {
  13. OPENGL_DRIVER_NAME,
  14. _3DFX_DRIVER_NAME,
  15. "",
  16. 0
  17. };
  18. /*
  19. ====================================================================
  20. MENU INTERACTION
  21. ====================================================================
  22. */
  23. static menuframework_s s_menu;
  24. static menulist_s s_graphics_options_list;
  25. static menulist_s s_mode_list;
  26. static menulist_s s_driver_list;
  27. static menuslider_s s_tq_slider;
  28. static menulist_s s_fs_box;
  29. static menulist_s s_lighting_box;
  30. static menulist_s s_allow_extensions_box;
  31. static menulist_s s_texturebits_box;
  32. static menulist_s s_colordepth_list;
  33. static menulist_s s_geometry_box;
  34. static menulist_s s_filter_box;
  35. static menuaction_s s_driverinfo_action;
  36. static menuaction_s s_apply_action;
  37. static menuaction_s s_defaults_action;
  38. typedef struct
  39. {
  40. int mode;
  41. qboolean fullscreen;
  42. int tq;
  43. int lighting;
  44. int colordepth;
  45. int texturebits;
  46. int geometry;
  47. int filter;
  48. int driver;
  49. qboolean extensions;
  50. } InitialVideoOptions_s;
  51. static InitialVideoOptions_s s_ivo;
  52. static InitialVideoOptions_s s_ivo_templates[] =
  53. {
  54. {
  55. 4, qtrue, 2, 0, 2, 2, 1, 1, 0, qtrue // JDC: this was tq 3
  56. },
  57. {
  58. 3, qtrue, 2, 0, 0, 0, 1, 0, 0, qtrue
  59. },
  60. {
  61. 2, qtrue, 1, 0, 1, 0, 0, 0, 0, qtrue
  62. },
  63. {
  64. 1, qtrue, 1, 1, 1, 0, 0, 0, 0, qtrue
  65. },
  66. {
  67. 3, qtrue, 1, 0, 0, 0, 1, 0, 0, qtrue
  68. }
  69. };
  70. #define NUM_IVO_TEMPLATES ( sizeof( s_ivo_templates ) / sizeof( s_ivo_templates[0] ) )
  71. static void DrvInfo_MenuDraw( void );
  72. static const char * DrvInfo_MenuKey( int key );
  73. static void GetInitialVideoVars( void )
  74. {
  75. s_ivo.colordepth = s_colordepth_list.curvalue;
  76. s_ivo.driver = s_driver_list.curvalue;
  77. s_ivo.mode = s_mode_list.curvalue;
  78. s_ivo.fullscreen = s_fs_box.curvalue;
  79. s_ivo.extensions = s_allow_extensions_box.curvalue;
  80. s_ivo.tq = s_tq_slider.curvalue;
  81. s_ivo.lighting = s_lighting_box.curvalue;
  82. s_ivo.geometry = s_geometry_box.curvalue;
  83. s_ivo.filter = s_filter_box.curvalue;
  84. s_ivo.texturebits = s_texturebits_box.curvalue;
  85. }
  86. static void CheckConfigVsTemplates( void )
  87. {
  88. int i;
  89. for ( i = 0; i < NUM_IVO_TEMPLATES; i++ )
  90. {
  91. if ( s_driver_list.curvalue != 1 )
  92. if ( s_ivo_templates[i].colordepth != s_colordepth_list.curvalue )
  93. continue;
  94. #if 0
  95. if ( s_ivo_templates[i].driver != s_driver_list.curvalue )
  96. continue;
  97. #endif
  98. if ( s_ivo_templates[i].mode != s_mode_list.curvalue )
  99. continue;
  100. if ( s_driver_list.curvalue != 1 )
  101. if ( s_ivo_templates[i].fullscreen != s_fs_box.curvalue )
  102. continue;
  103. if ( s_ivo_templates[i].tq != s_tq_slider.curvalue )
  104. continue;
  105. if ( s_ivo_templates[i].lighting != s_lighting_box.curvalue )
  106. continue;
  107. if ( s_ivo_templates[i].geometry != s_geometry_box.curvalue )
  108. continue;
  109. if ( s_ivo_templates[i].filter != s_filter_box.curvalue )
  110. continue;
  111. // if ( s_ivo_templates[i].texturebits != s_texturebits_box.curvalue )
  112. // continue;
  113. s_graphics_options_list.curvalue = i;
  114. return;
  115. }
  116. s_graphics_options_list.curvalue = 4;
  117. }
  118. static void UpdateMenuItemValues( void )
  119. {
  120. if ( s_driver_list.curvalue == 1 )
  121. {
  122. s_fs_box.curvalue = 1;
  123. s_fs_box.generic.flags = QMF_GRAYED;
  124. s_colordepth_list.curvalue = 1;
  125. }
  126. else
  127. {
  128. s_fs_box.generic.flags = 0;
  129. }
  130. if ( s_fs_box.curvalue == 0 || s_driver_list.curvalue == 1 )
  131. {
  132. s_colordepth_list.curvalue = 0;
  133. s_colordepth_list.generic.flags = QMF_GRAYED;
  134. }
  135. else
  136. {
  137. s_colordepth_list.generic.flags = 0;
  138. }
  139. if ( s_allow_extensions_box.curvalue == 0 )
  140. {
  141. if ( s_texturebits_box.curvalue == 0 )
  142. {
  143. s_texturebits_box.curvalue = 1;
  144. }
  145. }
  146. s_apply_action.generic.flags = QMF_GRAYED;
  147. if ( s_ivo.mode != s_mode_list.curvalue )
  148. {
  149. s_apply_action.generic.flags = QMF_BLINK;
  150. }
  151. if ( s_ivo.fullscreen != s_fs_box.curvalue )
  152. {
  153. s_apply_action.generic.flags = QMF_BLINK;
  154. }
  155. if ( s_ivo.extensions != s_allow_extensions_box.curvalue )
  156. {
  157. s_apply_action.generic.flags = QMF_BLINK;
  158. }
  159. if ( s_ivo.tq != s_tq_slider.curvalue )
  160. {
  161. s_apply_action.generic.flags = QMF_BLINK;
  162. }
  163. if ( s_ivo.lighting != s_lighting_box.curvalue )
  164. {
  165. s_apply_action.generic.flags = QMF_BLINK;
  166. }
  167. if ( s_ivo.colordepth != s_colordepth_list.curvalue )
  168. {
  169. s_apply_action.generic.flags = QMF_BLINK;
  170. }
  171. if ( s_ivo.driver != s_driver_list.curvalue )
  172. {
  173. s_apply_action.generic.flags = QMF_BLINK;
  174. }
  175. if ( s_ivo.texturebits != s_texturebits_box.curvalue )
  176. {
  177. s_apply_action.generic.flags = QMF_BLINK;
  178. }
  179. if ( s_ivo.geometry != s_geometry_box.curvalue )
  180. {
  181. s_apply_action.generic.flags = QMF_BLINK;
  182. }
  183. if ( s_ivo.filter != s_filter_box.curvalue )
  184. {
  185. s_apply_action.generic.flags = QMF_BLINK;
  186. }
  187. CheckConfigVsTemplates();
  188. }
  189. static void SetMenuItemValues( void )
  190. {
  191. s_mode_list.curvalue = Cvar_VariableValue( "r_mode" );
  192. s_fs_box.curvalue = Cvar_VariableValue("r_fullscreen");
  193. s_allow_extensions_box.curvalue = Cvar_VariableValue("r_allowExtensions");
  194. s_tq_slider.curvalue = 3-Cvar_VariableValue( "r_picmip");
  195. if ( s_tq_slider.curvalue < 0 )
  196. {
  197. s_tq_slider.curvalue = 0;
  198. }
  199. else if ( s_tq_slider.curvalue > 3 )
  200. {
  201. s_tq_slider.curvalue = 3;
  202. }
  203. s_lighting_box.curvalue = Cvar_VariableValue( "r_vertexLight" ) != 0;
  204. switch ( ( int ) Cvar_VariableValue( "r_texturebits" ) )
  205. {
  206. case 0:
  207. default:
  208. s_texturebits_box.curvalue = 0;
  209. break;
  210. case 16:
  211. s_texturebits_box.curvalue = 1;
  212. break;
  213. case 32:
  214. s_texturebits_box.curvalue = 2;
  215. break;
  216. }
  217. if ( !Q_stricmp( Cvar_VariableString( "r_textureMode" ), "GL_LINEAR_MIPMAP_NEAREST" ) )
  218. {
  219. s_filter_box.curvalue = 0;
  220. }
  221. else
  222. {
  223. s_filter_box.curvalue = 1;
  224. }
  225. if ( Cvar_VariableValue( "r_subdivisions" ) == 999 ||
  226. Cvar_VariableValue( "r_lodBias" ) > 0 )
  227. {
  228. s_geometry_box.curvalue = 0;
  229. }
  230. else
  231. {
  232. s_geometry_box.curvalue = 1;
  233. }
  234. switch ( ( int ) Cvar_VariableValue( "r_colorbits" ) )
  235. {
  236. default:
  237. case 0:
  238. s_colordepth_list.curvalue = 0;
  239. break;
  240. case 16:
  241. s_colordepth_list.curvalue = 1;
  242. break;
  243. case 32:
  244. s_colordepth_list.curvalue = 2;
  245. break;
  246. }
  247. if ( s_fs_box.curvalue == 0 )
  248. {
  249. s_colordepth_list.curvalue = 0;
  250. }
  251. if ( s_driver_list.curvalue == 1 )
  252. {
  253. s_colordepth_list.curvalue = 1;
  254. }
  255. }
  256. static void FullscreenCallback( void *s )
  257. {
  258. }
  259. static void ModeCallback( void *s )
  260. {
  261. // clamp 3dfx video modes
  262. if ( s_driver_list.curvalue == 1 )
  263. {
  264. if ( s_mode_list.curvalue < 2 )
  265. {
  266. s_mode_list.curvalue = 2;
  267. }
  268. else if ( s_mode_list.curvalue > 6 )
  269. {
  270. s_mode_list.curvalue = 6;
  271. }
  272. }
  273. }
  274. static void GraphicsOptionsCallback( void *s )
  275. {
  276. InitialVideoOptions_s *ivo = &s_ivo_templates[s_graphics_options_list.curvalue];
  277. s_mode_list.curvalue = ivo->mode;
  278. s_tq_slider.curvalue = ivo->tq;
  279. s_lighting_box.curvalue = ivo->lighting;
  280. s_colordepth_list.curvalue = ivo->colordepth;
  281. s_texturebits_box.curvalue = ivo->texturebits;
  282. s_geometry_box.curvalue = ivo->geometry;
  283. s_filter_box.curvalue = ivo->filter;
  284. s_fs_box.curvalue = ivo->fullscreen;
  285. }
  286. static void TextureDetailCallback( void *s )
  287. {
  288. }
  289. static void TextureQualityCallback( void *s )
  290. {
  291. }
  292. static void ExtensionsCallback( void *s )
  293. {
  294. }
  295. static void ColorDepthCallback( void *s )
  296. {
  297. }
  298. static void DriverInfoCallback( void *s )
  299. {
  300. UI_PushMenu( DrvInfo_MenuDraw, DrvInfo_MenuKey );
  301. }
  302. static void LightingCallback( void * s )
  303. {
  304. }
  305. static void ApplyChanges( void *unused )
  306. {
  307. switch ( s_texturebits_box.curvalue )
  308. {
  309. case 0:
  310. Cvar_SetValue( "r_texturebits", 0 );
  311. Cvar_SetValue( "r_ext_compress_textures", 1 );
  312. break;
  313. case 1:
  314. Cvar_SetValue( "r_texturebits", 16 );
  315. Cvar_SetValue( "r_ext_compress_textures", 0 );
  316. break;
  317. case 2:
  318. Cvar_SetValue( "r_texturebits", 32 );
  319. Cvar_SetValue( "r_ext_compress_textures", 0 );
  320. break;
  321. }
  322. Cvar_SetValue( "r_picmip", 3 - s_tq_slider.curvalue );
  323. Cvar_SetValue( "r_allowExtensions", s_allow_extensions_box.curvalue );
  324. Cvar_SetValue( "r_mode", s_mode_list.curvalue );
  325. Cvar_SetValue( "r_fullscreen", s_fs_box.curvalue );
  326. if (*s_drivers[s_driver_list.curvalue] )
  327. Cvar_Set( "r_glDriver", ( char * ) s_drivers[s_driver_list.curvalue] );
  328. switch ( s_colordepth_list.curvalue )
  329. {
  330. case 0:
  331. Cvar_SetValue( "r_colorbits", 0 );
  332. Cvar_SetValue( "r_depthbits", 0 );
  333. Cvar_SetValue( "r_stencilbits", 0 );
  334. break;
  335. case 1:
  336. Cvar_SetValue( "r_colorbits", 16 );
  337. Cvar_SetValue( "r_depthbits", 16 );
  338. Cvar_SetValue( "r_stencilbits", 0 );
  339. break;
  340. case 2:
  341. Cvar_SetValue( "r_colorbits", 32 );
  342. Cvar_SetValue( "r_depthbits", 24 );
  343. break;
  344. }
  345. Cvar_SetValue( "r_vertexLight", s_lighting_box.curvalue );
  346. if ( s_geometry_box.curvalue )
  347. {
  348. Cvar_SetValue( "r_lodBias", 0 );
  349. Cvar_SetValue( "r_subdivisions", 4 );
  350. }
  351. else
  352. {
  353. Cvar_SetValue( "r_lodBias", 1 );
  354. Cvar_SetValue( "r_subdivisions", 999 );
  355. }
  356. if ( s_filter_box.curvalue )
  357. {
  358. Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR" );
  359. }
  360. else
  361. {
  362. Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_NEAREST" );
  363. }
  364. UI_ForceMenuOff();
  365. CL_Vid_Restart_f();
  366. VID_MenuInit();
  367. // s_fs_box.curvalue = Cvar_VariableValue( "r_fullscreen" );
  368. }
  369. /*
  370. ** VID_MenuInit
  371. */
  372. void VID_MenuInit( void )
  373. {
  374. static const char *tq_names[] =
  375. {
  376. "compressed",
  377. "16-bit",
  378. "32-bit",
  379. 0
  380. };
  381. static const char *s_graphics_options_names[] =
  382. {
  383. "high quality",
  384. "normal",
  385. "fast",
  386. "fastest",
  387. "custom",
  388. 0
  389. };
  390. static const char *lighting_names[] =
  391. {
  392. "lightmap",
  393. "vertex",
  394. 0
  395. };
  396. static const char *colordepth_names[] =
  397. {
  398. "default",
  399. "16-bit",
  400. "32-bit",
  401. 0
  402. };
  403. static const char *resolutions[] =
  404. {
  405. "[320 240 ]",
  406. "[400 300 ]",
  407. "[512 384 ]",
  408. "[640 480 ]",
  409. "[800 600 ]",
  410. "[960 720 ]",
  411. "[1024 768 ]",
  412. "[1152 864 ]",
  413. "[1280 960 ]",
  414. "[1600 1200]",
  415. "[2048 1536]",
  416. "[856 480 W]",
  417. 0
  418. };
  419. static const char *filter_names[] =
  420. {
  421. "bilinear",
  422. "trilinear",
  423. 0
  424. };
  425. static const char *quality_names[] =
  426. {
  427. "low",
  428. "high",
  429. 0
  430. };
  431. static const char *enabled_names[] =
  432. {
  433. "disabled",
  434. "enabled",
  435. 0
  436. };
  437. int y = 0;
  438. int i;
  439. char *p;
  440. s_menu.x = SCREEN_WIDTH * 0.50;
  441. s_menu.nitems = 0;
  442. s_menu.wrapAround = qtrue;
  443. s_graphics_options_list.generic.type = MTYPE_SPINCONTROL;
  444. s_graphics_options_list.generic.name = "graphics mode";
  445. s_graphics_options_list.generic.x = 0;
  446. s_graphics_options_list.generic.y = y;
  447. s_graphics_options_list.generic.callback = GraphicsOptionsCallback;
  448. s_graphics_options_list.itemnames = s_graphics_options_names;
  449. s_driver_list.generic.type = MTYPE_SPINCONTROL;
  450. s_driver_list.generic.name = "driver";
  451. s_driver_list.generic.x = 0;
  452. s_driver_list.generic.y = y += 18;
  453. p = Cvar_VariableString( "r_glDriver" );
  454. for (i = 0; s_drivers[i]; i++) {
  455. if (strcmp(s_drivers[i], p) == 0)
  456. break;
  457. }
  458. if (!s_drivers[i])
  459. i--; // go back one, to default 'custom'
  460. s_driver_list.curvalue = i;
  461. s_driver_list.itemnames = s_driver_names;
  462. // references/modifies "r_allowExtensions"
  463. s_allow_extensions_box.generic.type = MTYPE_SPINCONTROL;
  464. s_allow_extensions_box.generic.x = 0;
  465. s_allow_extensions_box.generic.y = y += 18;
  466. s_allow_extensions_box.generic.name = "OpenGL extensions";
  467. s_allow_extensions_box.generic.callback = ExtensionsCallback;
  468. s_allow_extensions_box.itemnames = enabled_names;
  469. // references/modifies "r_mode"
  470. s_mode_list.generic.type = MTYPE_SPINCONTROL;
  471. s_mode_list.generic.name = "video mode";
  472. s_mode_list.generic.x = 0;
  473. s_mode_list.generic.y = y += 36;
  474. s_mode_list.itemnames = resolutions;
  475. s_mode_list.generic.callback = ModeCallback;
  476. // references "r_colorbits"
  477. s_colordepth_list.generic.type = MTYPE_SPINCONTROL;
  478. s_colordepth_list.generic.name = "color depth";
  479. s_colordepth_list.generic.x = 0;
  480. s_colordepth_list.generic.y = y += 18;
  481. s_colordepth_list.itemnames = colordepth_names;
  482. s_colordepth_list.generic.callback = ColorDepthCallback;
  483. // references/modifies "r_fullscreen"
  484. s_fs_box.generic.type = MTYPE_RADIOBUTTON;
  485. s_fs_box.generic.x = 0;
  486. s_fs_box.generic.y = y += 18;
  487. s_fs_box.generic.name = "fullscreen";
  488. s_fs_box.generic.callback = FullscreenCallback;
  489. // references/modifies "r_vertexLight"
  490. s_lighting_box.generic.type = MTYPE_SPINCONTROL;
  491. s_lighting_box.generic.x = 0;
  492. s_lighting_box.generic.y = y += 18;
  493. s_lighting_box.generic.name = "lighting";
  494. s_lighting_box.itemnames = lighting_names;
  495. s_lighting_box.generic.callback = LightingCallback;
  496. // references/modifies "r_lodBias" & "subdivisions"
  497. s_geometry_box.generic.type = MTYPE_SPINCONTROL;
  498. s_geometry_box.generic.x = 0;
  499. s_geometry_box.generic.y = y += 18;
  500. s_geometry_box.generic.name = "geometric detail";
  501. s_geometry_box.itemnames = quality_names;
  502. // references/modifies "r_picmip"
  503. s_tq_slider.generic.type = MTYPE_SLIDER;
  504. s_tq_slider.generic.x = 0;
  505. s_tq_slider.generic.y = y += 18;
  506. s_tq_slider.generic.name = "texture detail";
  507. s_tq_slider.generic.callback = TextureDetailCallback;
  508. s_tq_slider.minvalue = 0;
  509. s_tq_slider.maxvalue = 3;
  510. // references/modifies "r_textureBits"
  511. s_texturebits_box.generic.type = MTYPE_SPINCONTROL;
  512. s_texturebits_box.generic.x = 0;
  513. s_texturebits_box.generic.y = y += 18;
  514. s_texturebits_box.generic.name = "texture quality";
  515. s_texturebits_box.generic.callback = TextureQualityCallback;
  516. s_texturebits_box.itemnames = tq_names;
  517. // references/modifies "r_textureMode"
  518. s_filter_box.generic.type = MTYPE_SPINCONTROL;
  519. s_filter_box.generic.x = 0;
  520. s_filter_box.generic.y = y += 18;
  521. s_filter_box.generic.name = "texture filter";
  522. s_filter_box.itemnames = filter_names;
  523. s_driverinfo_action.generic.type = MTYPE_ACTION;
  524. s_driverinfo_action.generic.name = "driver information";
  525. s_driverinfo_action.generic.x = 0;
  526. s_driverinfo_action.generic.y = y += 36;
  527. s_driverinfo_action.generic.callback = DriverInfoCallback;
  528. s_apply_action.generic.type = MTYPE_ACTION;
  529. s_apply_action.generic.name = "apply";
  530. s_apply_action.generic.x = 0;
  531. s_apply_action.generic.y = y += 36;
  532. s_apply_action.generic.callback = ApplyChanges;
  533. s_apply_action.generic.flags = QMF_GRAYED;
  534. SetMenuItemValues();
  535. GetInitialVideoVars();
  536. Menu_AddItem( &s_menu, ( void * ) &s_graphics_options_list );
  537. Menu_AddItem( &s_menu, ( void * ) &s_driver_list );
  538. Menu_AddItem( &s_menu, ( void * ) &s_allow_extensions_box );
  539. Menu_AddItem( &s_menu, ( void * ) &s_mode_list );
  540. Menu_AddItem( &s_menu, ( void * ) &s_colordepth_list );
  541. Menu_AddItem( &s_menu, ( void * ) &s_fs_box );
  542. Menu_AddItem( &s_menu, ( void * ) &s_lighting_box );
  543. Menu_AddItem( &s_menu, ( void * ) &s_geometry_box );
  544. Menu_AddItem( &s_menu, ( void * ) &s_tq_slider );
  545. Menu_AddItem( &s_menu, ( void * ) &s_texturebits_box );
  546. Menu_AddItem( &s_menu, ( void * ) &s_filter_box );
  547. Menu_AddItem( &s_menu, ( void * ) &s_driverinfo_action );
  548. Menu_AddItem( &s_menu, ( void * ) &s_apply_action );
  549. Menu_Center( &s_menu );
  550. s_menu.y -= 6;
  551. }
  552. /*
  553. ================
  554. VID_MenuDraw
  555. ================
  556. */
  557. void VID_MenuDraw (void)
  558. {
  559. UpdateMenuItemValues();
  560. Menu_AdjustCursor( &s_menu, 1 );
  561. Menu_Draw( &s_menu );
  562. }
  563. /*
  564. ================
  565. VID_MenuKey
  566. ================
  567. */
  568. const char *VID_MenuKey( int key )
  569. {
  570. menuframework_s *m = &s_menu;
  571. static const char *sound = "sound/misc/menu1.wav";
  572. if ( key == K_ENTER )
  573. {
  574. if ( !Menu_SelectItem( m ) )
  575. ApplyChanges( NULL );
  576. return NULL;
  577. }
  578. return Default_MenuKey( m, key );
  579. }
  580. static void DrvInfo_MenuDraw( void )
  581. {
  582. float labelColor[] = { 0, 1.0, 0, 1.0 };
  583. float textColor[] = { 1, 1, 1, 1 };
  584. int i = 14;
  585. char extensionsString[1024], *eptr = extensionsString;
  586. SCR_DrawBigStringColor( BIGCHAR_WIDTH * 4, BIGCHAR_HEIGHT * 3, "VENDOR:", labelColor );
  587. SCR_DrawBigStringColor( BIGCHAR_WIDTH * 4, BIGCHAR_HEIGHT * 4, Cvar_VariableString( "gl_vendor" ), textColor );
  588. SCR_DrawBigStringColor( BIGCHAR_WIDTH * 4, BIGCHAR_HEIGHT * 5.5, "VERSION:", labelColor );
  589. SCR_DrawBigStringColor( BIGCHAR_WIDTH * 4, BIGCHAR_HEIGHT * 6.5, Cvar_VariableString( "gl_version" ), textColor );
  590. SCR_DrawBigStringColor( BIGCHAR_WIDTH * 4, BIGCHAR_HEIGHT * 8, "RENDERER:", labelColor );
  591. SCR_DrawBigStringColor( BIGCHAR_WIDTH * 4, BIGCHAR_HEIGHT * 9, Cvar_VariableString( "gl_renderer" ), textColor );
  592. SCR_DrawBigStringColor( BIGCHAR_WIDTH * 4, BIGCHAR_HEIGHT * 10.5, "PIXELFORMAT:", labelColor );
  593. SCR_DrawBigStringColor( BIGCHAR_WIDTH * 4, BIGCHAR_HEIGHT * 11.5, Cvar_VariableString( "gl_pixelformat" ), textColor );
  594. SCR_DrawBigStringColor( BIGCHAR_WIDTH * 4, BIGCHAR_HEIGHT * 13, "EXTENSIONS:", labelColor );
  595. strcpy( extensionsString, Cvar_VariableString( "gl_extensions" ) );
  596. while ( i < 25 && *eptr )
  597. {
  598. while ( *eptr )
  599. {
  600. char buf[2] = " ";
  601. int j = BIGCHAR_WIDTH * 6;
  602. while ( *eptr && *eptr != ' ' )
  603. {
  604. buf[0] = *eptr;
  605. SCR_DrawBigStringColor( j, i * BIGCHAR_HEIGHT, buf, textColor );
  606. j += BIGCHAR_WIDTH;
  607. eptr++;
  608. }
  609. i++;
  610. while ( *eptr && *eptr == ' ' )
  611. eptr++;
  612. }
  613. }
  614. }
  615. static const char * DrvInfo_MenuKey( int key )
  616. {
  617. if ( key == K_ESCAPE )
  618. UI_PopMenu();
  619. return NULL;
  620. }