Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ui_options.c

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 /*
00023 =======================================================================
00024 
00025 SYSTEM CONFIGURATION MENU
00026 
00027 =======================================================================
00028 */
00029 
00030 #include "ui_local.h"
00031 
00032 
00033 #define ART_FRAMEL          "menu/art/frame2_l"
00034 #define ART_FRAMER          "menu/art/frame1_r"
00035 #define ART_BACK0           "menu/art/back_0"
00036 #define ART_BACK1           "menu/art/back_1"
00037 
00038 #define ID_GRAPHICS         10
00039 #define ID_DISPLAY          11
00040 #define ID_SOUND            12
00041 #define ID_NETWORK          13
00042 #define ID_BACK             14
00043 
00044 #define VERTICAL_SPACING    34
00045 
00046 typedef struct {
00047     menuframework_s menu;
00048 
00049     menutext_s      banner;
00050     menubitmap_s    framel;
00051     menubitmap_s    framer;
00052 
00053     menutext_s      graphics;
00054     menutext_s      display;
00055     menutext_s      sound;
00056     menutext_s      network;
00057     menubitmap_s    back;
00058 } optionsmenu_t;
00059 
00060 static optionsmenu_t    s_options;
00061 
00062 
00063 /*
00064 =================
00065 Options_Event
00066 =================
00067 */
00068 static void Options_Event( void* ptr, int event ) {
00069     if( event != QM_ACTIVATED ) {
00070         return;
00071     }
00072 
00073     switch( ((menucommon_s*)ptr)->id ) {
00074     case ID_GRAPHICS:
00075         UI_GraphicsOptionsMenu();
00076         break;
00077 
00078     case ID_DISPLAY:
00079         UI_DisplayOptionsMenu();
00080         break;
00081 
00082     case ID_SOUND:
00083         UI_SoundOptionsMenu();
00084         break;
00085 
00086     case ID_NETWORK:
00087         UI_NetworkOptionsMenu();
00088         break;
00089 
00090     case ID_BACK:
00091         UI_PopMenu();
00092         break;
00093     }
00094 }
00095 
00096 
00097 /*
00098 ===============
00099 SystemConfig_Cache
00100 ===============
00101 */
00102 void SystemConfig_Cache( void ) {
00103     trap_R_RegisterShaderNoMip( ART_FRAMEL );
00104     trap_R_RegisterShaderNoMip( ART_FRAMER );
00105     trap_R_RegisterShaderNoMip( ART_BACK0 );
00106     trap_R_RegisterShaderNoMip( ART_BACK1 );
00107 }
00108 
00109 /*
00110 ===============
00111 Options_MenuInit
00112 ===============
00113 */
00114 void Options_MenuInit( void ) {
00115     int             y;
00116     uiClientState_t cstate;
00117 
00118     memset( &s_options, 0, sizeof(optionsmenu_t) );
00119 
00120     SystemConfig_Cache();
00121     s_options.menu.wrapAround = qtrue;
00122 
00123     trap_GetClientState( &cstate );
00124     if ( cstate.connState >= CA_CONNECTED ) {
00125         s_options.menu.fullscreen = qfalse;
00126     }
00127     else {
00128         s_options.menu.fullscreen = qtrue;
00129     }
00130 
00131     s_options.banner.generic.type   = MTYPE_BTEXT;
00132     s_options.banner.generic.flags  = QMF_CENTER_JUSTIFY;
00133     s_options.banner.generic.x      = 320;
00134     s_options.banner.generic.y      = 16;
00135     s_options.banner.string         = "SYSTEM SETUP";
00136     s_options.banner.color          = color_white;
00137     s_options.banner.style          = UI_CENTER;
00138 
00139     s_options.framel.generic.type  = MTYPE_BITMAP;
00140     s_options.framel.generic.name  = ART_FRAMEL;
00141     s_options.framel.generic.flags = QMF_INACTIVE;
00142     s_options.framel.generic.x     = 8;  
00143     s_options.framel.generic.y     = 76;
00144     s_options.framel.width         = 256;
00145     s_options.framel.height        = 334;
00146 
00147     s_options.framer.generic.type  = MTYPE_BITMAP;
00148     s_options.framer.generic.name  = ART_FRAMER;
00149     s_options.framer.generic.flags = QMF_INACTIVE;
00150     s_options.framer.generic.x     = 376;
00151     s_options.framer.generic.y     = 76;
00152     s_options.framer.width         = 256;
00153     s_options.framer.height        = 334;
00154 
00155     y = 168;
00156     s_options.graphics.generic.type     = MTYPE_PTEXT;
00157     s_options.graphics.generic.flags    = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
00158     s_options.graphics.generic.callback = Options_Event;
00159     s_options.graphics.generic.id       = ID_GRAPHICS;
00160     s_options.graphics.generic.x        = 320;
00161     s_options.graphics.generic.y        = y;
00162     s_options.graphics.string           = "GRAPHICS";
00163     s_options.graphics.color            = color_red;
00164     s_options.graphics.style            = UI_CENTER;
00165 
00166     y += VERTICAL_SPACING;
00167     s_options.display.generic.type      = MTYPE_PTEXT;
00168     s_options.display.generic.flags     = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
00169     s_options.display.generic.callback  = Options_Event;
00170     s_options.display.generic.id        = ID_DISPLAY;
00171     s_options.display.generic.x         = 320;
00172     s_options.display.generic.y         = y;
00173     s_options.display.string            = "DISPLAY";
00174     s_options.display.color             = color_red;
00175     s_options.display.style             = UI_CENTER;
00176 
00177     y += VERTICAL_SPACING;
00178     s_options.sound.generic.type        = MTYPE_PTEXT;
00179     s_options.sound.generic.flags       = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
00180     s_options.sound.generic.callback    = Options_Event;
00181     s_options.sound.generic.id          = ID_SOUND;
00182     s_options.sound.generic.x           = 320;
00183     s_options.sound.generic.y           = y;
00184     s_options.sound.string              = "SOUND";
00185     s_options.sound.color               = color_red;
00186     s_options.sound.style               = UI_CENTER;
00187 
00188     y += VERTICAL_SPACING;
00189     s_options.network.generic.type      = MTYPE_PTEXT;
00190     s_options.network.generic.flags     = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
00191     s_options.network.generic.callback  = Options_Event;
00192     s_options.network.generic.id        = ID_NETWORK;
00193     s_options.network.generic.x         = 320;
00194     s_options.network.generic.y         = y;
00195     s_options.network.string            = "NETWORK";
00196     s_options.network.color             = color_red;
00197     s_options.network.style             = UI_CENTER;
00198 
00199     s_options.back.generic.type     = MTYPE_BITMAP;
00200     s_options.back.generic.name     = ART_BACK0;
00201     s_options.back.generic.flags    = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
00202     s_options.back.generic.callback = Options_Event;
00203     s_options.back.generic.id       = ID_BACK;
00204     s_options.back.generic.x        = 0;
00205     s_options.back.generic.y        = 480-64;
00206     s_options.back.width            = 128;
00207     s_options.back.height           = 64;
00208     s_options.back.focuspic         = ART_BACK1;
00209 
00210     Menu_AddItem( &s_options.menu, ( void * ) &s_options.banner );
00211     Menu_AddItem( &s_options.menu, ( void * ) &s_options.framel );
00212     Menu_AddItem( &s_options.menu, ( void * ) &s_options.framer );
00213     Menu_AddItem( &s_options.menu, ( void * ) &s_options.graphics );
00214     Menu_AddItem( &s_options.menu, ( void * ) &s_options.display );
00215     Menu_AddItem( &s_options.menu, ( void * ) &s_options.sound );
00216     Menu_AddItem( &s_options.menu, ( void * ) &s_options.network );
00217     Menu_AddItem( &s_options.menu, ( void * ) &s_options.back );
00218 }
00219 
00220 
00221 /*
00222 ===============
00223 UI_SystemConfigMenu
00224 ===============
00225 */
00226 void UI_SystemConfigMenu( void ) {
00227     Options_MenuInit();
00228     UI_PushMenu ( &s_options.menu );
00229 }

Generated on Thu Aug 25 12:37:42 2005 for Quake III Arena by  doxygen 1.3.9.1