| 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 |
SYSTEM CONFIGURATION MENU |
| 26 |
|
| 27 |
======================================================================= |
| 28 |
*/ |
| 29 |
|
| 30 |
#include "ui_local.h" |
| 31 |
|
| 32 |
|
| 33 |
#define ART_FRAMEL "menu/art_blueish/frame2_l" |
| 34 |
#define ART_FRAMER "menu/art_blueish/frame1_r" |
| 35 |
#define ART_BACK0 "menu/art_blueish/back_0" |
| 36 |
#define ART_BACK1 "menu/art_blueish/back_1" |
| 37 |
|
| 38 |
#define ID_GRAPHICS 10 |
| 39 |
#define ID_DISPLAY 11 |
| 40 |
#define ID_SOUND 12 |
| 41 |
#define ID_NETWORK 13 |
| 42 |
#define ID_BACK 14 |
| 43 |
|
| 44 |
#define VERTICAL_SPACING 34 |
| 45 |
|
| 46 |
typedef struct { |
| 47 |
menuframework_s menu; |
| 48 |
|
| 49 |
menutext_s banner; |
| 50 |
menubitmap_s framel; |
| 51 |
menubitmap_s framer; |
| 52 |
|
| 53 |
menutext_s graphics; |
| 54 |
menutext_s display; |
| 55 |
menutext_s sound; |
| 56 |
menutext_s network; |
| 57 |
menubitmap_s back; |
| 58 |
} optionsmenu_t; |
| 59 |
|
| 60 |
static optionsmenu_t s_options; |
| 61 |
|
| 62 |
|
| 63 |
/* |
| 64 |
================= |
| 65 |
Options_Event |
| 66 |
================= |
| 67 |
*/ |
| 68 |
static void Options_Event( void* ptr, int event ) { |
| 69 |
if( event != QM_ACTIVATED ) { |
| 70 |
return; |
| 71 |
} |
| 72 |
|
| 73 |
switch( ((menucommon_s*)ptr)->id ) { |
| 74 |
case ID_GRAPHICS: |
| 75 |
UI_GraphicsOptionsMenu(); |
| 76 |
break; |
| 77 |
|
| 78 |
case ID_DISPLAY: |
| 79 |
UI_DisplayOptionsMenu(); |
| 80 |
break; |
| 81 |
|
| 82 |
case ID_SOUND: |
| 83 |
UI_SoundOptionsMenu(); |
| 84 |
break; |
| 85 |
|
| 86 |
case ID_NETWORK: |
| 87 |
UI_NetworkOptionsMenu(); |
| 88 |
break; |
| 89 |
|
| 90 |
case ID_BACK: |
| 91 |
UI_PopMenu(); |
| 92 |
break; |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
/* |
| 98 |
=============== |
| 99 |
SystemConfig_Cache |
| 100 |
=============== |
| 101 |
*/ |
| 102 |
void SystemConfig_Cache( void ) { |
| 103 |
trap_R_RegisterShaderNoMip( ART_FRAMEL ); |
| 104 |
trap_R_RegisterShaderNoMip( ART_FRAMER ); |
| 105 |
trap_R_RegisterShaderNoMip( ART_BACK0 ); |
| 106 |
trap_R_RegisterShaderNoMip( ART_BACK1 ); |
| 107 |
} |
| 108 |
|
| 109 |
/* |
| 110 |
=============== |
| 111 |
Options_MenuInit |
| 112 |
=============== |
| 113 |
*/ |
| 114 |
void Options_MenuInit( void ) { |
| 115 |
int y; |
| 116 |
uiClientState_t cstate; |
| 117 |
|
| 118 |
memset( &s_options, 0, sizeof(optionsmenu_t) ); |
| 119 |
|
| 120 |
SystemConfig_Cache(); |
| 121 |
s_options.menu.wrapAround = qtrue; |
| 122 |
|
| 123 |
trap_GetClientState( &cstate ); |
| 124 |
if ( cstate.connState >= CA_CONNECTED ) { |
| 125 |
s_options.menu.fullscreen = qfalse; |
| 126 |
} |
| 127 |
else { |
| 128 |
s_options.menu.fullscreen = qtrue; |
| 129 |
} |
| 130 |
|
| 131 |
s_options.banner.generic.type = MTYPE_BTEXT; |
| 132 |
s_options.banner.generic.flags = QMF_CENTER_JUSTIFY; |
| 133 |
s_options.banner.generic.x = 320; |
| 134 |
s_options.banner.generic.y = 16; |
| 135 |
s_options.banner.string = "SYSTEM SETUP"; |
| 136 |
s_options.banner.color = color_white; |
| 137 |
s_options.banner.style = UI_CENTER; |
| 138 |
|
| 139 |
s_options.framel.generic.type = MTYPE_BITMAP; |
| 140 |
s_options.framel.generic.name = ART_FRAMEL; |
| 141 |
s_options.framel.generic.flags = QMF_INACTIVE; |
| 142 |
s_options.framel.generic.x = 8; |
| 143 |
s_options.framel.generic.y = 76; |
| 144 |
s_options.framel.width = 256; |
| 145 |
s_options.framel.height = 334; |
| 146 |
|
| 147 |
s_options.framer.generic.type = MTYPE_BITMAP; |
| 148 |
s_options.framer.generic.name = ART_FRAMER; |
| 149 |
s_options.framer.generic.flags = QMF_INACTIVE; |
| 150 |
s_options.framer.generic.x = 376; |
| 151 |
s_options.framer.generic.y = 76; |
| 152 |
s_options.framer.width = 256; |
| 153 |
s_options.framer.height = 334; |
| 154 |
|
| 155 |
y = 168; |
| 156 |
s_options.graphics.generic.type = MTYPE_PTEXT; |
| 157 |
s_options.graphics.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS; |
| 158 |
s_options.graphics.generic.callback = Options_Event; |
| 159 |
s_options.graphics.generic.id = ID_GRAPHICS; |
| 160 |
s_options.graphics.generic.x = 320; |
| 161 |
s_options.graphics.generic.y = y; |
| 162 |
s_options.graphics.string = "GRAPHICS"; |
| 163 |
s_options.graphics.color = color_red; |
| 164 |
s_options.graphics.style = UI_CENTER; |
| 165 |
|
| 166 |
y += VERTICAL_SPACING; |
| 167 |
s_options.display.generic.type = MTYPE_PTEXT; |
| 168 |
s_options.display.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS; |
| 169 |
s_options.display.generic.callback = Options_Event; |
| 170 |
s_options.display.generic.id = ID_DISPLAY; |
| 171 |
s_options.display.generic.x = 320; |
| 172 |
s_options.display.generic.y = y; |
| 173 |
s_options.display.string = "DISPLAY"; |
| 174 |
s_options.display.color = color_red; |
| 175 |
s_options.display.style = UI_CENTER; |
| 176 |
|
| 177 |
y += VERTICAL_SPACING; |
| 178 |
s_options.sound.generic.type = MTYPE_PTEXT; |
| 179 |
s_options.sound.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS; |
| 180 |
s_options.sound.generic.callback = Options_Event; |
| 181 |
s_options.sound.generic.id = ID_SOUND; |
| 182 |
s_options.sound.generic.x = 320; |
| 183 |
s_options.sound.generic.y = y; |
| 184 |
s_options.sound.string = "SOUND"; |
| 185 |
s_options.sound.color = color_red; |
| 186 |
s_options.sound.style = UI_CENTER; |
| 187 |
|
| 188 |
y += VERTICAL_SPACING; |
| 189 |
s_options.network.generic.type = MTYPE_PTEXT; |
| 190 |
s_options.network.generic.flags = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS; |
| 191 |
s_options.network.generic.callback = Options_Event; |
| 192 |
s_options.network.generic.id = ID_NETWORK; |
| 193 |
s_options.network.generic.x = 320; |
| 194 |
s_options.network.generic.y = y; |
| 195 |
s_options.network.string = "NETWORK"; |
| 196 |
s_options.network.color = color_red; |
| 197 |
s_options.network.style = UI_CENTER; |
| 198 |
|
| 199 |
s_options.back.generic.type = MTYPE_BITMAP; |
| 200 |
s_options.back.generic.name = ART_BACK0; |
| 201 |
s_options.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; |
| 202 |
s_options.back.generic.callback = Options_Event; |
| 203 |
s_options.back.generic.id = ID_BACK; |
| 204 |
s_options.back.generic.x = 0; |
| 205 |
s_options.back.generic.y = 480-64; |
| 206 |
s_options.back.width = 128; |
| 207 |
s_options.back.height = 64; |
| 208 |
s_options.back.focuspic = ART_BACK1; |
| 209 |
|
| 210 |
Menu_AddItem( &s_options.menu, ( void * ) &s_options.banner ); |
| 211 |
Menu_AddItem( &s_options.menu, ( void * ) &s_options.framel ); |
| 212 |
Menu_AddItem( &s_options.menu, ( void * ) &s_options.framer ); |
| 213 |
Menu_AddItem( &s_options.menu, ( void * ) &s_options.graphics ); |
| 214 |
Menu_AddItem( &s_options.menu, ( void * ) &s_options.display ); |
| 215 |
Menu_AddItem( &s_options.menu, ( void * ) &s_options.sound ); |
| 216 |
Menu_AddItem( &s_options.menu, ( void * ) &s_options.network ); |
| 217 |
Menu_AddItem( &s_options.menu, ( void * ) &s_options.back ); |
| 218 |
} |
| 219 |
|
| 220 |
|
| 221 |
/* |
| 222 |
=============== |
| 223 |
UI_SystemConfigMenu |
| 224 |
=============== |
| 225 |
*/ |
| 226 |
void UI_SystemConfigMenu( void ) { |
| 227 |
Options_MenuInit(); |
| 228 |
UI_PushMenu ( &s_options.menu ); |
| 229 |
} |