| 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 |
GAME OPTIONS MENU |
| 27 |
|
| 28 |
======================================================================= |
| 29 |
*/ |
| 30 |
|
| 31 |
|
| 32 |
#include "ui_local.h" |
| 33 |
|
| 34 |
|
| 35 |
#define ART_FRAMEL "menu/art_blueish/frame2_l" |
| 36 |
#define ART_FRAMER "menu/art_blueish/frame1_r" |
| 37 |
#define ART_BACK0 "menu/art_blueish/back_0" |
| 38 |
#define ART_BACK1 "menu/art_blueish/back_1" |
| 39 |
|
| 40 |
#define PREFERENCES_X_POS 360 |
| 41 |
|
| 42 |
#define ID_CROSSHAIR 127 |
| 43 |
#define ID_SIMPLEITEMS 128 |
| 44 |
#define ID_HIGHQUALITYSKY 129 |
| 45 |
#define ID_EJECTINGBRASS 130 |
| 46 |
#define ID_WALLMARKS 131 |
| 47 |
#define ID_DYNAMICLIGHTS 132 |
| 48 |
#define ID_IDENTIFYTARGET 133 |
| 49 |
#define ID_SYNCEVERYFRAME 134 |
| 50 |
#define ID_FORCEMODEL 135 |
| 51 |
#define ID_DRAWTEAMOVERLAY 136 |
| 52 |
#define ID_ALLOWDOWNLOAD 137 |
| 53 |
#define ID_BACK 138 |
| 54 |
//Elimination |
| 55 |
#define ID_WEAPONBAR 139 |
| 56 |
#define ID_DELAGHITSCAN 140 |
| 57 |
#define ID_COLORRED 141 |
| 58 |
#define ID_COLORGREEN 142 |
| 59 |
#define ID_COLORBLUE 143 |
| 60 |
#define ID_CROSSHAIRHEALTH 144 |
| 61 |
#define ID_CHATBEEP 145 |
| 62 |
#define ID_TEAMCHATBEEP 146 |
| 63 |
|
| 64 |
#define NUM_CROSSHAIRS 99 |
| 65 |
|
| 66 |
|
| 67 |
typedef struct { |
| 68 |
menuframework_s menu; |
| 69 |
|
| 70 |
menutext_s banner; |
| 71 |
menubitmap_s framel; |
| 72 |
menubitmap_s framer; |
| 73 |
|
| 74 |
menulist_s crosshair; |
| 75 |
menuradiobutton_s crosshairHealth; |
| 76 |
|
| 77 |
//Crosshair colors: |
| 78 |
menuslider_s crosshairColorRed; |
| 79 |
menuslider_s crosshairColorGreen; |
| 80 |
menuslider_s crosshairColorBlue; |
| 81 |
|
| 82 |
menuradiobutton_s simpleitems; |
| 83 |
menuradiobutton_s alwaysweaponbar; |
| 84 |
menuradiobutton_s brass; |
| 85 |
menuradiobutton_s wallmarks; |
| 86 |
menuradiobutton_s dynamiclights; |
| 87 |
menuradiobutton_s identifytarget; |
| 88 |
menuradiobutton_s highqualitysky; |
| 89 |
menuradiobutton_s synceveryframe; |
| 90 |
menuradiobutton_s forcemodel; |
| 91 |
menulist_s drawteamoverlay; |
| 92 |
menuradiobutton_s delaghitscan; |
| 93 |
menuradiobutton_s allowdownload; |
| 94 |
menuradiobutton_s chatbeep; |
| 95 |
menuradiobutton_s teamchatbeep; |
| 96 |
menubitmap_s back; |
| 97 |
|
| 98 |
qhandle_t crosshairShader[NUM_CROSSHAIRS]; |
| 99 |
} preferences_t; |
| 100 |
|
| 101 |
static preferences_t s_preferences; |
| 102 |
|
| 103 |
static const char *teamoverlay_names[] = |
| 104 |
{ |
| 105 |
"off", |
| 106 |
"upper right", |
| 107 |
"lower right", |
| 108 |
"lower left", |
| 109 |
NULL |
| 110 |
}; |
| 111 |
|
| 112 |
static void Preferences_SetMenuItems( void ) { |
| 113 |
s_preferences.crosshair.curvalue = (int)trap_Cvar_VariableValue( "cg_drawCrosshair" ) % NUM_CROSSHAIRS; |
| 114 |
s_preferences.crosshairHealth.curvalue = trap_Cvar_VariableValue( "cg_crosshairHealth") != 0; |
| 115 |
s_preferences.crosshairColorRed.curvalue = trap_Cvar_VariableValue( "cg_crosshairColorRed")*255.0f; |
| 116 |
s_preferences.crosshairColorGreen.curvalue = trap_Cvar_VariableValue( "cg_crosshairColorGreen")*255.0f; |
| 117 |
s_preferences.crosshairColorBlue.curvalue = trap_Cvar_VariableValue( "cg_crosshairColorBlue")*255.0f; |
| 118 |
s_preferences.simpleitems.curvalue = trap_Cvar_VariableValue( "cg_simpleItems" ) != 0; |
| 119 |
s_preferences.alwaysweaponbar.curvalue = trap_Cvar_VariableValue( "cg_alwaysWeaponBar" ) != 0; |
| 120 |
s_preferences.brass.curvalue = trap_Cvar_VariableValue( "cg_brassTime" ) != 0; |
| 121 |
s_preferences.wallmarks.curvalue = trap_Cvar_VariableValue( "cg_marks" ) != 0; |
| 122 |
s_preferences.identifytarget.curvalue = trap_Cvar_VariableValue( "cg_drawCrosshairNames" ) != 0; |
| 123 |
s_preferences.dynamiclights.curvalue = trap_Cvar_VariableValue( "r_dynamiclight" ) != 0; |
| 124 |
s_preferences.highqualitysky.curvalue = trap_Cvar_VariableValue ( "r_fastsky" ) == 0; |
| 125 |
s_preferences.synceveryframe.curvalue = trap_Cvar_VariableValue( "r_finish" ) != 0; |
| 126 |
s_preferences.forcemodel.curvalue = trap_Cvar_VariableValue( "cg_forcemodel" ) != 0; |
| 127 |
s_preferences.drawteamoverlay.curvalue = Com_Clamp( 0, 3, trap_Cvar_VariableValue( "cg_drawTeamOverlay" ) ); |
| 128 |
s_preferences.allowdownload.curvalue = trap_Cvar_VariableValue( "cl_allowDownload" ) != 0; |
| 129 |
s_preferences.delaghitscan.curvalue = trap_Cvar_VariableValue( "cg_delag" ) != 0; |
| 130 |
s_preferences.chatbeep.curvalue = trap_Cvar_VariableValue( "cg_chatBeep" ) != 0; |
| 131 |
s_preferences.teamchatbeep.curvalue = trap_Cvar_VariableValue( "cg_teamChatBeep" ) != 0; |
| 132 |
} |
| 133 |
|
| •134 |
|
| 135 |
static void AutoDownloadAction( qboolean result ) |
| 136 |
{ |
| 137 |
if (result) { |
| 138 |
trap_Cvar_SetValue( "cl_allowDownload", 1 ); |
| 139 |
} else { |
| 140 |
trap_Cvar_SetValue( "cl_allowDownload", 0 ); |
| 141 |
} |
| 142 |
s_preferences.allowdownload.curvalue = result; |
| 143 |
} |
| 144 |
|
| 145 |
static void UI_ConfirmAutoDownload_Draw ( void ) |
| 146 |
{ |
| 147 |
UI_DrawProportionalString( SCREEN_WIDTH/2, 356 + PROP_HEIGHT * 0, |
| 148 |
"WARNING: This is a security risk.", |
| 149 |
UI_CENTER|UI_SMALLFONT, color_yellow ); |
| 150 |
UI_DrawProportionalString( SCREEN_WIDTH/2, 356 + PROP_HEIGHT * 1, |
| 151 |
"More information: <http://deb.li/Q3DL>", |
| 152 |
UI_CENTER|UI_SMALLFONT, color_yellow ); |
| 153 |
} |
| 154 |
|
| 155 |
void UI_ConfirmAutoDownload( void (*action) (qboolean) ) |
| 156 |
{ |
| 157 |
if (trap_Cvar_VariableValue( "cl_allowDownload" ) != 0) { |
| 158 |
/* already set */ |
| 159 |
return; |
| 160 |
} |
| 161 |
|
| 162 |
UI_ConfirmMenu_Style( |
| 163 |
"Auto-download?", |
| 164 |
UI_CENTER|UI_SMALLFONT, |
| 165 |
UI_ConfirmAutoDownload_Draw, |
| 166 |
action); |
| 167 |
} |
| 168 |
|
| 169 |
static void Preferences_Event( void* ptr, int notification ) { |
| 170 |
if( notification != QM_ACTIVATED ) { |
| 171 |
return; |
| 172 |
} |
| 173 |
|
| 174 |
switch( ((menucommon_s*)ptr)->id ) { |
| 175 |
case ID_CROSSHAIR: |
| 176 |
s_preferences.crosshair.curvalue++; |
| 177 |
if( s_preferences.crosshair.curvalue == NUM_CROSSHAIRS || s_preferences.crosshairShader[s_preferences.crosshair.curvalue]==0 ) { |
| 178 |
s_preferences.crosshair.curvalue = 0; |
| 179 |
} |
| 180 |
trap_Cvar_SetValue( "cg_drawCrosshair", s_preferences.crosshair.curvalue ); |
| 181 |
break; |
| 182 |
|
| 183 |
case ID_CROSSHAIRHEALTH: |
| 184 |
trap_Cvar_SetValue( "cg_crosshairHealth", s_preferences.crosshairHealth.curvalue ); |
| 185 |
if(s_preferences.crosshairHealth.curvalue) { |
| 186 |
//If crosshairHealth is on: Don't allow color selection |
| 187 |
s_preferences.crosshairColorRed.generic.flags |= QMF_INACTIVE; |
| 188 |
s_preferences.crosshairColorGreen.generic.flags |= QMF_INACTIVE; |
| 189 |
s_preferences.crosshairColorBlue.generic.flags |= QMF_INACTIVE; |
| 190 |
} else { |
| 191 |
//If crosshairHealth is off: Allow color selection |
| 192 |
s_preferences.crosshairColorRed.generic.flags &= ~QMF_INACTIVE; |
| 193 |
s_preferences.crosshairColorGreen.generic.flags &= ~QMF_INACTIVE; |
| 194 |
s_preferences.crosshairColorBlue.generic.flags &= ~QMF_INACTIVE; |
| 195 |
} |
| 196 |
break; |
| 197 |
|
| 198 |
case ID_COLORRED: |
| 199 |
trap_Cvar_SetValue( "cg_crosshairColorRed", ((float)s_preferences.crosshairColorRed.curvalue)/255.f ); |
| 200 |
break; |
| 201 |
|
| 202 |
case ID_COLORGREEN: |
| 203 |
trap_Cvar_SetValue( "cg_crosshairColorGreen", ((float)s_preferences.crosshairColorGreen.curvalue)/255.f ); |
| 204 |
break; |
| 205 |
|
| 206 |
case ID_COLORBLUE: |
| 207 |
trap_Cvar_SetValue( "cg_crosshairColorBlue", ((float)s_preferences.crosshairColorBlue.curvalue)/255.f ); |
| 208 |
break; |
| 209 |
|
| 210 |
case ID_SIMPLEITEMS: |
| 211 |
trap_Cvar_SetValue( "cg_simpleItems", s_preferences.simpleitems.curvalue ); |
| 212 |
break; |
| 213 |
|
| 214 |
case ID_WEAPONBAR: |
| 215 |
trap_Cvar_SetValue( "cg_alwaysWeaponBar", s_preferences.alwaysweaponbar.curvalue ); |
| 216 |
break; |
| 217 |
|
| 218 |
case ID_HIGHQUALITYSKY: |
| 219 |
trap_Cvar_SetValue( "r_fastsky", !s_preferences.highqualitysky.curvalue ); |
| 220 |
break; |
| 221 |
|
| 222 |
case ID_EJECTINGBRASS: |
| 223 |
if ( s_preferences.brass.curvalue ) |
| 224 |
trap_Cvar_Reset( "cg_brassTime" ); |
| 225 |
else |
| 226 |
trap_Cvar_SetValue( "cg_brassTime", 0 ); |
| 227 |
break; |
| 228 |
|
| 229 |
case ID_WALLMARKS: |
| 230 |
trap_Cvar_SetValue( "cg_marks", s_preferences.wallmarks.curvalue ); |
| 231 |
break; |
| 232 |
|
| 233 |
case ID_DYNAMICLIGHTS: |
| 234 |
trap_Cvar_SetValue( "r_dynamiclight", s_preferences.dynamiclights.curvalue ); |
| 235 |
break; |
| 236 |
|
| 237 |
case ID_IDENTIFYTARGET: |
| 238 |
trap_Cvar_SetValue( "cg_drawCrosshairNames", s_preferences.identifytarget.curvalue ); |
| 239 |
break; |
| 240 |
|
| 241 |
case ID_SYNCEVERYFRAME: |
| 242 |
trap_Cvar_SetValue( "r_finish", s_preferences.synceveryframe.curvalue ); |
| 243 |
break; |
| 244 |
|
| 245 |
case ID_FORCEMODEL: |
| 246 |
trap_Cvar_SetValue( "cg_forcemodel", s_preferences.forcemodel.curvalue ); |
| 247 |
break; |
| 248 |
|
| 249 |
case ID_DRAWTEAMOVERLAY: |
| 250 |
trap_Cvar_SetValue( "cg_drawTeamOverlay", s_preferences.drawteamoverlay.curvalue ); |
| 251 |
break; |
| 252 |
|
| 253 |
case ID_ALLOWDOWNLOAD: |
| 254 |
trap_Cvar_SetValue( "sv_allowDownload", s_preferences.allowdownload.curvalue ); |
| •255 |
if ( s_preferences.allowdownload.curvalue ) |
| 256 |
UI_ConfirmAutoDownload( AutoDownloadAction ); |
| 257 |
else |
| 258 |
trap_Cvar_SetValue( "cl_allowDownload", 0 ); |
| 259 |
break; |
| 260 |
|
| 261 |
case ID_DELAGHITSCAN: |
| 262 |
trap_Cvar_SetValue( "g_delagHitscan", s_preferences.delaghitscan.curvalue ); |
| 263 |
trap_Cvar_SetValue( "cg_delag", s_preferences.delaghitscan.curvalue ); |
| 264 |
break; |
| 265 |
|
| 266 |
case ID_CHATBEEP: |
| 267 |
trap_Cvar_SetValue( "cg_chatBeep", s_preferences.chatbeep.curvalue ); |
| 268 |
break; |
| 269 |
|
| 270 |
case ID_TEAMCHATBEEP: |
| 271 |
trap_Cvar_SetValue( "cg_teamChatBeep", s_preferences.teamchatbeep.curvalue ); |
| 272 |
break; |
| 273 |
|
| 274 |
case ID_BACK: |
| 275 |
UI_PopMenu(); |
| 276 |
break; |
| 277 |
} |
| 278 |
} |
| 279 |
|
| 280 |
|
| 281 |
/* |
| 282 |
================= |
| 283 |
Crosshair_Draw |
| 284 |
================= |
| 285 |
*/ |
| 286 |
static void Crosshair_Draw( void *self ) { |
| 287 |
menulist_s *s; |
| 288 |
float *color; |
| 289 |
int x, y; |
| 290 |
int style; |
| 291 |
qboolean focus; |
| 292 |
vec4_t color4; |
| 293 |
|
| 294 |
s = (menulist_s *)self; |
| 295 |
x = s->generic.x; |
| 296 |
y = s->generic.y; |
| 297 |
|
| 298 |
style = UI_SMALLFONT; |
| 299 |
focus = (s->generic.parent->cursor == s->generic.menuPosition); |
| 300 |
|
| 301 |
if ( s->generic.flags & QMF_GRAYED ) |
| 302 |
color = text_color_disabled; |
| 303 |
else if ( focus ) |
| 304 |
{ |
| 305 |
color = text_color_highlight; |
| 306 |
style |= UI_PULSE; |
| 307 |
} |
| 308 |
else if ( s->generic.flags & QMF_BLINK ) |
| 309 |
{ |
| 310 |
color = text_color_highlight; |
| 311 |
style |= UI_BLINK; |
| 312 |
} |
| 313 |
else |
| 314 |
color = text_color_normal; |
| 315 |
|
| 316 |
if ( focus ) |
| 317 |
{ |
| 318 |
// draw cursor |
| 319 |
UI_FillRect( s->generic.left, s->generic.top, s->generic.right-s->generic.left+1, s->generic.bottom-s->generic.top+1, listbar_color ); |
| 320 |
UI_DrawChar( x, y, 13, UI_CENTER|UI_BLINK|UI_SMALLFONT, color); |
| 321 |
} |
| 322 |
|
| 323 |
UI_DrawString( x - SMALLCHAR_WIDTH, y, s->generic.name, style|UI_RIGHT, color ); |
| 324 |
if( !s->curvalue ) { |
| 325 |
return; |
| 326 |
} |
| 327 |
color4[0]=((float)s_preferences.crosshairColorRed.curvalue)/255.f; |
| 328 |
color4[1]=((float)s_preferences.crosshairColorGreen.curvalue)/255.f; |
| 329 |
color4[2]=((float)s_preferences.crosshairColorBlue.curvalue)/255.f; |
| 330 |
color4[3]=1.0f; |
| 331 |
trap_R_SetColor( color4 ); |
| 332 |
UI_DrawHandlePic( x + SMALLCHAR_WIDTH, y - 4, 24, 24, s_preferences.crosshairShader[s->curvalue] ); |
| 333 |
} |
| 334 |
|
| 335 |
|
| 336 |
static void Preferences_MenuInit( void ) { |
| 337 |
int y; |
| 338 |
|
| 339 |
UI_SetDefaultCvar("cg_crosshairHealth","1"); |
| 340 |
UI_SetDefaultCvar("cg_crosshairColorRed","1"); |
| 341 |
UI_SetDefaultCvar("cg_crosshairColorBlue","1"); |
| 342 |
UI_SetDefaultCvar("cg_crosshairColorGreen","1"); |
| 343 |
|
| 344 |
memset( &s_preferences, 0 ,sizeof(preferences_t) ); |
| 345 |
|
| 346 |
Preferences_Cache(); |
| 347 |
|
| 348 |
s_preferences.menu.wrapAround = qtrue; |
| 349 |
s_preferences.menu.fullscreen = qtrue; |
| 350 |
|
| 351 |
s_preferences.banner.generic.type = MTYPE_BTEXT; |
| 352 |
s_preferences.banner.generic.x = 320; |
| 353 |
s_preferences.banner.generic.y = 16; |
| 354 |
s_preferences.banner.string = "GAME OPTIONS"; |
| 355 |
s_preferences.banner.color = color_white; |
| 356 |
s_preferences.banner.style = UI_CENTER; |
| 357 |
|
| 358 |
s_preferences.framel.generic.type = MTYPE_BITMAP; |
| 359 |
s_preferences.framel.generic.name = ART_FRAMEL; |
| 360 |
s_preferences.framel.generic.flags = QMF_INACTIVE; |
| 361 |
s_preferences.framel.generic.x = 0; |
| 362 |
s_preferences.framel.generic.y = 78; |
| 363 |
s_preferences.framel.width = 256; |
| 364 |
s_preferences.framel.height = 329; |
| 365 |
|
| 366 |
s_preferences.framer.generic.type = MTYPE_BITMAP; |
| 367 |
s_preferences.framer.generic.name = ART_FRAMER; |
| 368 |
s_preferences.framer.generic.flags = QMF_INACTIVE; |
| 369 |
s_preferences.framer.generic.x = 376; |
| 370 |
s_preferences.framer.generic.y = 76; |
| 371 |
s_preferences.framer.width = 256; |
| 372 |
s_preferences.framer.height = 334; |
| 373 |
|
| 374 |
y = 82; |
| 375 |
s_preferences.crosshair.generic.type = MTYPE_TEXT; |
| 376 |
s_preferences.crosshair.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT|QMF_NODEFAULTINIT|QMF_OWNERDRAW; |
| 377 |
s_preferences.crosshair.generic.x = PREFERENCES_X_POS; |
| 378 |
s_preferences.crosshair.generic.y = y; |
| 379 |
s_preferences.crosshair.generic.name = "Crosshair:"; |
| 380 |
s_preferences.crosshair.generic.callback = Preferences_Event; |
| 381 |
s_preferences.crosshair.generic.ownerdraw = Crosshair_Draw; |
| 382 |
s_preferences.crosshair.generic.id = ID_CROSSHAIR; |
| 383 |
s_preferences.crosshair.generic.top = y - 4; |
| 384 |
s_preferences.crosshair.generic.bottom = y + 20; |
| 385 |
s_preferences.crosshair.generic.left = PREFERENCES_X_POS - ( ( strlen(s_preferences.crosshair.generic.name) + 1 ) * SMALLCHAR_WIDTH ); |
| 386 |
s_preferences.crosshair.generic.right = PREFERENCES_X_POS + 48; |
| 387 |
|
| 388 |
y += BIGCHAR_HEIGHT+2; |
| 389 |
s_preferences.crosshairHealth.generic.type = MTYPE_RADIOBUTTON; |
| 390 |
s_preferences.crosshairHealth.generic.name = "Crosshair shows health:"; |
| 391 |
s_preferences.crosshairHealth.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 392 |
s_preferences.crosshairHealth.generic.callback = Preferences_Event; |
| 393 |
s_preferences.crosshairHealth.generic.id = ID_CROSSHAIRHEALTH; |
| 394 |
s_preferences.crosshairHealth.generic.x = PREFERENCES_X_POS; |
| 395 |
s_preferences.crosshairHealth.generic.y = y; |
| 396 |
|
| 397 |
y += BIGCHAR_HEIGHT; |
| 398 |
s_preferences.crosshairColorRed.generic.type = MTYPE_SLIDER; |
| 399 |
s_preferences.crosshairColorRed.generic.name = "Crosshair red:"; |
| 400 |
s_preferences.crosshairColorRed.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 401 |
s_preferences.crosshairColorRed.generic.callback = Preferences_Event; |
| 402 |
s_preferences.crosshairColorRed.generic.id = ID_COLORRED; |
| 403 |
s_preferences.crosshairColorRed.generic.x = PREFERENCES_X_POS; |
| 404 |
s_preferences.crosshairColorRed.generic.y = y; |
| 405 |
s_preferences.crosshairColorRed.minvalue = 0.0f; |
| 406 |
s_preferences.crosshairColorRed.maxvalue = 255.0f; |
| 407 |
|
| 408 |
y += BIGCHAR_HEIGHT+2; |
| 409 |
s_preferences.crosshairColorGreen.generic.type = MTYPE_SLIDER; |
| 410 |
s_preferences.crosshairColorGreen.generic.name = "Crosshair green:"; |
| 411 |
s_preferences.crosshairColorGreen.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 412 |
s_preferences.crosshairColorGreen.generic.callback = Preferences_Event; |
| 413 |
s_preferences.crosshairColorGreen.generic.id = ID_COLORGREEN; |
| 414 |
s_preferences.crosshairColorGreen.generic.x = PREFERENCES_X_POS; |
| 415 |
s_preferences.crosshairColorGreen.generic.y = y; |
| 416 |
s_preferences.crosshairColorGreen.minvalue = 0.0f; |
| 417 |
s_preferences.crosshairColorGreen.maxvalue = 255.0f; |
| 418 |
|
| 419 |
y += BIGCHAR_HEIGHT+2; |
| 420 |
s_preferences.crosshairColorBlue.generic.type = MTYPE_SLIDER; |
| 421 |
s_preferences.crosshairColorBlue.generic.name = "Crosshair blue:"; |
| 422 |
s_preferences.crosshairColorBlue.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 423 |
s_preferences.crosshairColorBlue.generic.callback = Preferences_Event; |
| 424 |
s_preferences.crosshairColorBlue.generic.id = ID_COLORBLUE; |
| 425 |
s_preferences.crosshairColorBlue.generic.x = PREFERENCES_X_POS; |
| 426 |
s_preferences.crosshairColorBlue.generic.y = y; |
| 427 |
s_preferences.crosshairColorBlue.minvalue = 0.0f; |
| 428 |
s_preferences.crosshairColorBlue.maxvalue = 255.0f; |
| 429 |
|
| 430 |
|
| 431 |
if(s_preferences.crosshairHealth.curvalue) { |
| 432 |
s_preferences.crosshairColorRed.generic.flags |= QMF_INACTIVE; |
| 433 |
s_preferences.crosshairColorGreen.generic.flags |= QMF_INACTIVE; |
| 434 |
s_preferences.crosshairColorBlue.generic.flags |= QMF_INACTIVE; |
| 435 |
} |
| 436 |
|
| 437 |
y += BIGCHAR_HEIGHT+2+4; |
| 438 |
s_preferences.simpleitems.generic.type = MTYPE_RADIOBUTTON; |
| 439 |
s_preferences.simpleitems.generic.name = "Simple Items:"; |
| 440 |
s_preferences.simpleitems.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 441 |
s_preferences.simpleitems.generic.callback = Preferences_Event; |
| 442 |
s_preferences.simpleitems.generic.id = ID_SIMPLEITEMS; |
| 443 |
s_preferences.simpleitems.generic.x = PREFERENCES_X_POS; |
| 444 |
s_preferences.simpleitems.generic.y = y; |
| 445 |
|
| 446 |
//Elimination |
| 447 |
y += BIGCHAR_HEIGHT; |
| 448 |
s_preferences.alwaysweaponbar.generic.type = MTYPE_RADIOBUTTON; |
| 449 |
s_preferences.alwaysweaponbar.generic.name = "Always show weapons:"; |
| 450 |
s_preferences.alwaysweaponbar.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 451 |
s_preferences.alwaysweaponbar.generic.callback = Preferences_Event; |
| 452 |
s_preferences.alwaysweaponbar.generic.id = ID_WEAPONBAR; |
| 453 |
s_preferences.alwaysweaponbar.generic.x = PREFERENCES_X_POS; |
| 454 |
s_preferences.alwaysweaponbar.generic.y = y; |
| 455 |
|
| 456 |
y += BIGCHAR_HEIGHT; |
| 457 |
s_preferences.wallmarks.generic.type = MTYPE_RADIOBUTTON; |
| 458 |
s_preferences.wallmarks.generic.name = "Marks on Walls:"; |
| 459 |
s_preferences.wallmarks.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 460 |
s_preferences.wallmarks.generic.callback = Preferences_Event; |
| 461 |
s_preferences.wallmarks.generic.id = ID_WALLMARKS; |
| 462 |
s_preferences.wallmarks.generic.x = PREFERENCES_X_POS; |
| 463 |
s_preferences.wallmarks.generic.y = y; |
| 464 |
|
| 465 |
y += BIGCHAR_HEIGHT+2; |
| 466 |
s_preferences.brass.generic.type = MTYPE_RADIOBUTTON; |
| 467 |
s_preferences.brass.generic.name = "Ejecting Brass:"; |
| 468 |
s_preferences.brass.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 469 |
s_preferences.brass.generic.callback = Preferences_Event; |
| 470 |
s_preferences.brass.generic.id = ID_EJECTINGBRASS; |
| 471 |
s_preferences.brass.generic.x = PREFERENCES_X_POS; |
| 472 |
s_preferences.brass.generic.y = y; |
| 473 |
|
| 474 |
y += BIGCHAR_HEIGHT+2; |
| 475 |
s_preferences.dynamiclights.generic.type = MTYPE_RADIOBUTTON; |
| 476 |
s_preferences.dynamiclights.generic.name = "Dynamic Lights:"; |
| 477 |
s_preferences.dynamiclights.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 478 |
s_preferences.dynamiclights.generic.callback = Preferences_Event; |
| 479 |
s_preferences.dynamiclights.generic.id = ID_DYNAMICLIGHTS; |
| 480 |
s_preferences.dynamiclights.generic.x = PREFERENCES_X_POS; |
| 481 |
s_preferences.dynamiclights.generic.y = y; |
| 482 |
|
| 483 |
y += BIGCHAR_HEIGHT+2; |
| 484 |
s_preferences.identifytarget.generic.type = MTYPE_RADIOBUTTON; |
| 485 |
s_preferences.identifytarget.generic.name = "Identify Target:"; |
| 486 |
s_preferences.identifytarget.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 487 |
s_preferences.identifytarget.generic.callback = Preferences_Event; |
| 488 |
s_preferences.identifytarget.generic.id = ID_IDENTIFYTARGET; |
| 489 |
s_preferences.identifytarget.generic.x = PREFERENCES_X_POS; |
| 490 |
s_preferences.identifytarget.generic.y = y; |
| 491 |
|
| 492 |
y += BIGCHAR_HEIGHT+2; |
| 493 |
s_preferences.highqualitysky.generic.type = MTYPE_RADIOBUTTON; |
| 494 |
s_preferences.highqualitysky.generic.name = "High Quality Sky:"; |
| 495 |
s_preferences.highqualitysky.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 496 |
s_preferences.highqualitysky.generic.callback = Preferences_Event; |
| 497 |
s_preferences.highqualitysky.generic.id = ID_HIGHQUALITYSKY; |
| 498 |
s_preferences.highqualitysky.generic.x = PREFERENCES_X_POS; |
| 499 |
s_preferences.highqualitysky.generic.y = y; |
| 500 |
|
| 501 |
y += BIGCHAR_HEIGHT+2; |
| 502 |
s_preferences.synceveryframe.generic.type = MTYPE_RADIOBUTTON; |
| 503 |
s_preferences.synceveryframe.generic.name = "Sync Every Frame:"; |
| 504 |
s_preferences.synceveryframe.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 505 |
s_preferences.synceveryframe.generic.callback = Preferences_Event; |
| 506 |
s_preferences.synceveryframe.generic.id = ID_SYNCEVERYFRAME; |
| 507 |
s_preferences.synceveryframe.generic.x = PREFERENCES_X_POS; |
| 508 |
s_preferences.synceveryframe.generic.y = y; |
| 509 |
|
| 510 |
y += BIGCHAR_HEIGHT+2; |
| 511 |
s_preferences.forcemodel.generic.type = MTYPE_RADIOBUTTON; |
| 512 |
s_preferences.forcemodel.generic.name = "Force Player Models:"; |
| 513 |
s_preferences.forcemodel.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 514 |
s_preferences.forcemodel.generic.callback = Preferences_Event; |
| 515 |
s_preferences.forcemodel.generic.id = ID_FORCEMODEL; |
| 516 |
s_preferences.forcemodel.generic.x = PREFERENCES_X_POS; |
| 517 |
s_preferences.forcemodel.generic.y = y; |
| 518 |
|
| 519 |
y += BIGCHAR_HEIGHT+2; |
| 520 |
s_preferences.drawteamoverlay.generic.type = MTYPE_SPINCONTROL; |
| 521 |
s_preferences.drawteamoverlay.generic.name = "Draw Team Overlay:"; |
| 522 |
s_preferences.drawteamoverlay.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 523 |
s_preferences.drawteamoverlay.generic.callback = Preferences_Event; |
| 524 |
s_preferences.drawteamoverlay.generic.id = ID_DRAWTEAMOVERLAY; |
| 525 |
s_preferences.drawteamoverlay.generic.x = PREFERENCES_X_POS; |
| 526 |
s_preferences.drawteamoverlay.generic.y = y; |
| 527 |
s_preferences.drawteamoverlay.itemnames = teamoverlay_names; |
| 528 |
|
| 529 |
y += BIGCHAR_HEIGHT+2; |
| 530 |
s_preferences.delaghitscan.generic.type = MTYPE_RADIOBUTTON; |
| 531 |
s_preferences.delaghitscan.generic.name = "Unlag hitscan:"; |
| 532 |
s_preferences.delaghitscan.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 533 |
s_preferences.delaghitscan.generic.callback = Preferences_Event; |
| 534 |
s_preferences.delaghitscan.generic.id = ID_DELAGHITSCAN; |
| 535 |
s_preferences.delaghitscan.generic.x = PREFERENCES_X_POS; |
| 536 |
s_preferences.delaghitscan.generic.y = y; |
| 537 |
|
| 538 |
y += BIGCHAR_HEIGHT+2; |
| 539 |
s_preferences.allowdownload.generic.type = MTYPE_RADIOBUTTON; |
| 540 |
s_preferences.allowdownload.generic.name = "Automatic Downloading:"; |
| 541 |
s_preferences.allowdownload.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 542 |
s_preferences.allowdownload.generic.callback = Preferences_Event; |
| 543 |
s_preferences.allowdownload.generic.id = ID_ALLOWDOWNLOAD; |
| 544 |
s_preferences.allowdownload.generic.x = PREFERENCES_X_POS; |
| 545 |
s_preferences.allowdownload.generic.y = y; |
| 546 |
|
| 547 |
y += BIGCHAR_HEIGHT+2; |
| 548 |
s_preferences.chatbeep.generic.type = MTYPE_RADIOBUTTON; |
| 549 |
s_preferences.chatbeep.generic.name = "Beep on chat:"; |
| 550 |
s_preferences.chatbeep.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 551 |
s_preferences.chatbeep.generic.callback = Preferences_Event; |
| 552 |
s_preferences.chatbeep.generic.id = ID_CHATBEEP; |
| 553 |
s_preferences.chatbeep.generic.x = PREFERENCES_X_POS; |
| 554 |
s_preferences.chatbeep.generic.y = y; |
| 555 |
|
| 556 |
y += BIGCHAR_HEIGHT+2; |
| 557 |
s_preferences.teamchatbeep.generic.type = MTYPE_RADIOBUTTON; |
| 558 |
s_preferences.teamchatbeep.generic.name = "Beep on team chat:"; |
| 559 |
s_preferences.teamchatbeep.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT; |
| 560 |
s_preferences.teamchatbeep.generic.callback = Preferences_Event; |
| 561 |
s_preferences.teamchatbeep.generic.id = ID_TEAMCHATBEEP; |
| 562 |
s_preferences.teamchatbeep.generic.x = PREFERENCES_X_POS; |
| 563 |
s_preferences.teamchatbeep.generic.y = y; |
| 564 |
|
| 565 |
y += BIGCHAR_HEIGHT+2; |
| 566 |
s_preferences.back.generic.type = MTYPE_BITMAP; |
| 567 |
s_preferences.back.generic.name = ART_BACK0; |
| 568 |
s_preferences.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; |
| 569 |
s_preferences.back.generic.callback = Preferences_Event; |
| 570 |
s_preferences.back.generic.id = ID_BACK; |
| 571 |
s_preferences.back.generic.x = 0; |
| 572 |
s_preferences.back.generic.y = 480-64; |
| 573 |
s_preferences.back.width = 128; |
| 574 |
s_preferences.back.height = 64; |
| 575 |
s_preferences.back.focuspic = ART_BACK1; |
| 576 |
|
| 577 |
Menu_AddItem( &s_preferences.menu, &s_preferences.banner ); |
| 578 |
Menu_AddItem( &s_preferences.menu, &s_preferences.framel ); |
| 579 |
Menu_AddItem( &s_preferences.menu, &s_preferences.framer ); |
| 580 |
|
| 581 |
Menu_AddItem( &s_preferences.menu, &s_preferences.crosshair ); |
| 582 |
Menu_AddItem( &s_preferences.menu, &s_preferences.crosshairHealth ); |
| 583 |
Menu_AddItem( &s_preferences.menu, &s_preferences.crosshairColorRed ); |
| 584 |
Menu_AddItem( &s_preferences.menu, &s_preferences.crosshairColorGreen ); |
| 585 |
Menu_AddItem( &s_preferences.menu, &s_preferences.crosshairColorBlue ); |
| 586 |
Menu_AddItem( &s_preferences.menu, &s_preferences.simpleitems ); |
| 587 |
Menu_AddItem( &s_preferences.menu, &s_preferences.alwaysweaponbar ); |
| 588 |
Menu_AddItem( &s_preferences.menu, &s_preferences.wallmarks ); |
| 589 |
Menu_AddItem( &s_preferences.menu, &s_preferences.brass ); |
| 590 |
Menu_AddItem( &s_preferences.menu, &s_preferences.dynamiclights ); |
| 591 |
Menu_AddItem( &s_preferences.menu, &s_preferences.identifytarget ); |
| 592 |
Menu_AddItem( &s_preferences.menu, &s_preferences.highqualitysky ); |
| 593 |
Menu_AddItem( &s_preferences.menu, &s_preferences.synceveryframe ); |
| 594 |
Menu_AddItem( &s_preferences.menu, &s_preferences.forcemodel ); |
| 595 |
Menu_AddItem( &s_preferences.menu, &s_preferences.drawteamoverlay ); |
| 596 |
Menu_AddItem( &s_preferences.menu, &s_preferences.delaghitscan ); |
| 597 |
Menu_AddItem( &s_preferences.menu, &s_preferences.allowdownload ); |
| 598 |
Menu_AddItem( &s_preferences.menu, &s_preferences.teamchatbeep ); |
| 599 |
Menu_AddItem( &s_preferences.menu, &s_preferences.chatbeep ); |
| 600 |
|
| 601 |
Menu_AddItem( &s_preferences.menu, &s_preferences.back ); |
| 602 |
|
| 603 |
Preferences_SetMenuItems(); |
| 604 |
} |
| 605 |
|
| 606 |
|
| 607 |
/* |
| 608 |
=============== |
| 609 |
Preferences_Cache |
| 610 |
=============== |
| 611 |
*/ |
| 612 |
void Preferences_Cache( void ) { |
| 613 |
int n; |
| 614 |
|
| 615 |
trap_R_RegisterShaderNoMip( ART_FRAMEL ); |
| 616 |
trap_R_RegisterShaderNoMip( ART_FRAMER ); |
| 617 |
trap_R_RegisterShaderNoMip( ART_BACK0 ); |
| 618 |
trap_R_RegisterShaderNoMip( ART_BACK1 ); |
| 619 |
for( n = 0; n < NUM_CROSSHAIRS; n++ ) { |
| 620 |
if (n < 10) |
| 621 |
s_preferences.crosshairShader[n] = trap_R_RegisterShaderNoMip( va("gfx/2d/crosshair%c", 'a' + n ) ); |
| 622 |
else |
| 623 |
s_preferences.crosshairShader[n] = trap_R_RegisterShaderNoMip( va("gfx/2d/crosshair%02d", n - 10) ); |
| 624 |
|
| 625 |
} |
| 626 |
} |
| 627 |
|
| 628 |
|
| 629 |
/* |
| 630 |
=============== |
| 631 |
UI_PreferencesMenu |
| 632 |
=============== |
| 633 |
*/ |
| 634 |
void UI_PreferencesMenu( void ) { |
| 635 |
Preferences_MenuInit(); |
| 636 |
UI_PushMenu( &s_preferences.menu ); |
| 637 |
} |