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

ui_spreset.c File Reference

#include "ui_local.h"

Include dependency graph for ui_spreset.c:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  resetMenu_t

Defines

#define ART_FRAME   "menu/art/cut_frame"
#define ID_NO   100
#define ID_YES   101

Functions

void Reset_Cache (void)
void Reset_MenuDraw (void)
void Reset_MenuEvent (void *ptr, int event)
sfxHandle_t Reset_MenuKey (int key)
void UI_ResetMenu (void)

Variables

resetMenu_t s_reset


Define Documentation

#define ART_FRAME   "menu/art/cut_frame"
 

Definition at line 33 of file ui_spreset.c.

#define ID_NO   100
 

Definition at line 35 of file ui_spreset.c.

#define ID_YES   101
 

Definition at line 36 of file ui_spreset.c.


Function Documentation

void Reset_Cache void   ) 
 

Definition at line 125 of file ui_spreset.c.

References ART_FRAME, and trap_R_RegisterShaderNoMip().

Referenced by UI_ResetMenu().

00125                          {
00126     trap_R_RegisterShaderNoMip( ART_FRAME );
00127 }

Here is the call graph for this function:

void Reset_MenuDraw void   )  [static]
 

Definition at line 107 of file ui_spreset.c.

References ART_FRAME, color_red, color_yellow, resetMenu_t::menu, Menu_Draw(), PROP_HEIGHT, s_reset, SCREEN_WIDTH, resetMenu_t::slashX, UI_CENTER, UI_DrawNamedPic(), UI_DrawProportionalString(), UI_INVERSE, UI_LEFT, and UI_SMALLFONT.

00107                                    {
00108     UI_DrawNamedPic( 142, 118, 359, 256, ART_FRAME );
00109     UI_DrawProportionalString( 320, 194 + 10, "RESET GAME?", UI_CENTER|UI_INVERSE, color_red );
00110     UI_DrawProportionalString( s_reset.slashX, 265, "/", UI_LEFT|UI_INVERSE, color_red );
00111     Menu_Draw( &s_reset.menu );
00112 
00113     UI_DrawProportionalString( SCREEN_WIDTH/2, 356 + PROP_HEIGHT * 0, "WARNING: This resets all of the", UI_CENTER|UI_SMALLFONT, color_yellow );
00114     UI_DrawProportionalString( SCREEN_WIDTH/2, 356 + PROP_HEIGHT * 1, "single player game variables.", UI_CENTER|UI_SMALLFONT, color_yellow );
00115     UI_DrawProportionalString( SCREEN_WIDTH/2, 356 + PROP_HEIGHT * 2, "Do this only if you want to", UI_CENTER|UI_SMALLFONT, color_yellow );
00116     UI_DrawProportionalString( SCREEN_WIDTH/2, 356 + PROP_HEIGHT * 3, "start over from the beginning.", UI_CENTER|UI_SMALLFONT, color_yellow );
00117 }

Here is the call graph for this function:

void Reset_MenuEvent void *  ptr,
int  event
 

Definition at line 54 of file ui_spreset.c.

References trap_Cvar_SetValue(), UI_NewGame(), UI_PopMenu(), and UI_SPLevelMenu().

Referenced by Reset_MenuKey().

00054                                            {
00055     if( event != QM_ACTIVATED ) {
00056         return;
00057     }
00058 
00059     UI_PopMenu();
00060 
00061     if( ((menucommon_s*)ptr)->id == ID_NO ) {
00062         return;
00063     }
00064 
00065     // reset the game, pop the level menu and restart it so it updates
00066     UI_NewGame();
00067     trap_Cvar_SetValue( "ui_spSelection", 0 );
00068     UI_PopMenu();
00069     UI_SPLevelMenu();
00070 }

Here is the call graph for this function:

sfxHandle_t Reset_MenuKey int  key  )  [static]
 

Definition at line 78 of file ui_spreset.c.

References K_KP_LEFTARROW, K_KP_RIGHTARROW, K_LEFTARROW, K_RIGHTARROW, resetMenu_t::menu, Menu_DefaultKey(), resetMenu_t::no, QM_ACTIVATED, Reset_MenuEvent(), s_reset, sfxHandle_t, and resetMenu_t::yes.

00078                                             {
00079     switch ( key ) {
00080     case K_KP_LEFTARROW:
00081     case K_LEFTARROW:
00082     case K_KP_RIGHTARROW:
00083     case K_RIGHTARROW:
00084         key = K_TAB;
00085         break;
00086 
00087     case 'n':
00088     case 'N':
00089         Reset_MenuEvent( &s_reset.no, QM_ACTIVATED );
00090         break;
00091 
00092     case 'y':
00093     case 'Y':
00094         Reset_MenuEvent( &s_reset.yes, QM_ACTIVATED );
00095         break;
00096     }
00097 
00098     return Menu_DefaultKey( &s_reset.menu, key );
00099 }

Here is the call graph for this function:

void UI_ResetMenu void   ) 
 

Definition at line 135 of file ui_spreset.c.

References menucommon_s::callback, menutext_s::color, uiClientState_t::connState, _tag_menuframework::draw, menucommon_s::flags, _tag_menuframework::fullscreen, menutext_s::generic, menucommon_s::id, _tag_menuframework::key, memset(), resetMenu_t::menu, Menu_AddItem(), Menu_SetCursorToItem(), resetMenu_t::no, QMF_LEFT_JUSTIFY, Reset_Cache(), s_reset, resetMenu_t::slashX, menutext_s::string, menutext_s::style, trap_GetClientState(), menucommon_s::type, UI_ProportionalStringWidth(), UI_PushMenu(), _tag_menuframework::wrapAround, menucommon_s::x, menucommon_s::y, and resetMenu_t::yes.

00135                         {
00136     uiClientState_t cstate;
00137     int n1, n2, n3;
00138     int l1, l2, l3;
00139 
00140     // zero set all our globals
00141     memset( &s_reset, 0, sizeof(s_reset) );
00142 
00143     Reset_Cache();
00144 
00145     n1 = UI_ProportionalStringWidth( "YES/NO" );
00146     n2 = UI_ProportionalStringWidth( "YES" ) + PROP_GAP_WIDTH;
00147     n3 = UI_ProportionalStringWidth( "/" )  + PROP_GAP_WIDTH;
00148     l1 = 320 - ( n1 / 2 );
00149     l2 = l1 + n2;
00150     l3 = l2 + n3;
00151     s_reset.slashX = l2;
00152 
00153     s_reset.menu.draw       = Reset_MenuDraw;
00154     s_reset.menu.key        = Reset_MenuKey;
00155     s_reset.menu.wrapAround = qtrue;
00156 
00157     trap_GetClientState( &cstate );
00158 
00159     if ( cstate.connState >= CA_CONNECTED ) {
00160         // float on top of running game
00161         s_reset.menu.fullscreen = qfalse;
00162     }
00163     else {
00164         // game not running
00165         s_reset.menu.fullscreen = qtrue;
00166     }
00167 
00168     s_reset.yes.generic.type        = MTYPE_PTEXT;      
00169     s_reset.yes.generic.flags       = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; 
00170     s_reset.yes.generic.callback    = Reset_MenuEvent;
00171     s_reset.yes.generic.id          = ID_YES;
00172     s_reset.yes.generic.x           = l1;
00173     s_reset.yes.generic.y           = 264;
00174     s_reset.yes.string              = "YES";
00175     s_reset.yes.color               = color_red;
00176     s_reset.yes.style               = UI_LEFT;
00177 
00178     s_reset.no.generic.type         = MTYPE_PTEXT;      
00179     s_reset.no.generic.flags        = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; 
00180     s_reset.no.generic.callback     = Reset_MenuEvent;
00181     s_reset.no.generic.id           = ID_NO;
00182     s_reset.no.generic.x            = l3;
00183     s_reset.no.generic.y            = 264;
00184     s_reset.no.string               = "NO";
00185     s_reset.no.color                = color_red;
00186     s_reset.no.style                = UI_LEFT;
00187 
00188     Menu_AddItem( &s_reset.menu,    &s_reset.yes );             
00189     Menu_AddItem( &s_reset.menu,    &s_reset.no );
00190 
00191     UI_PushMenu( &s_reset.menu );
00192 
00193     Menu_SetCursorToItem( &s_reset.menu, &s_reset.no );
00194 }

Here is the call graph for this function:


Variable Documentation

resetMenu_t s_reset [static]
 

Definition at line 46 of file ui_spreset.c.

Referenced by Reset_MenuDraw(), Reset_MenuKey(), and UI_ResetMenu().


Generated on Thu Aug 25 14:35:20 2005 for Quake III Arena by  doxygen 1.3.9.1