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

ui_cdkey.c File Reference

#include "ui_local.h"

Include dependency graph for ui_cdkey.c:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  cdkeyMenuInfo_t

Defines

#define ART_ACCEPT0   "menu/art/accept_0"
#define ART_ACCEPT1   "menu/art/accept_1"
#define ART_BACK0   "menu/art/back_0"
#define ART_BACK1   "menu/art/back_1"
#define ART_FRAME   "menu/art/cut_frame"
#define ID_ACCEPT   11
#define ID_BACK   12
#define ID_CDKEY   10

Functions

void UI_CDKeyMenu (void)
void UI_CDKeyMenu_Cache (void)
void UI_CDKeyMenu_DrawKey (void *self)
void UI_CDKeyMenu_Event (void *ptr, int event)
void UI_CDKeyMenu_f (void)
void UI_CDKeyMenu_Init (void)
int UI_CDKeyMenu_PreValidateKey (const char *key)

Variables

cdkeyMenuInfo_t cdkeyMenuInfo


Define Documentation

#define ART_ACCEPT0   "menu/art/accept_0"
 

Definition at line 36 of file ui_cdkey.c.

Referenced by UI_CDKeyMenu_Cache().

#define ART_ACCEPT1   "menu/art/accept_1"
 

Definition at line 37 of file ui_cdkey.c.

Referenced by UI_CDKeyMenu_Cache().

#define ART_BACK0   "menu/art/back_0"
 

Definition at line 38 of file ui_cdkey.c.

#define ART_BACK1   "menu/art/back_1"
 

Definition at line 39 of file ui_cdkey.c.

#define ART_FRAME   "menu/art/cut_frame"
 

Definition at line 35 of file ui_cdkey.c.

Referenced by Reset_Cache(), Reset_MenuDraw(), UI_CDKeyMenu_Cache(), UI_SPSkillMenu_Cache(), and UI_TeamOrdersMenu_Cache().

#define ID_ACCEPT   11
 

Definition at line 42 of file ui_cdkey.c.

Referenced by UI_CDKeyMenu_Event().

#define ID_BACK   12
 

Definition at line 43 of file ui_cdkey.c.

#define ID_CDKEY   10
 

Definition at line 41 of file ui_cdkey.c.

Referenced by UI_SetupMenu_Event().


Function Documentation

void UI_CDKeyMenu void   ) 
 

Definition at line 278 of file ui_cdkey.c.

References cdkeyMenuInfo, cdkeyMenuInfo_t::menu, UI_CDKeyMenu_Init(), and UI_PushMenu().

Referenced by UI_CDKeyMenu_f(), UI_MainMenu(), and UI_SetupMenu_Event().

00278                           {
00279     UI_CDKeyMenu_Init();
00280     UI_PushMenu( &cdkeyMenuInfo.menu );
00281 }

Here is the call graph for this function:

void UI_CDKeyMenu_Cache void   ) 
 

Definition at line 264 of file ui_cdkey.c.

References ART_ACCEPT0, ART_ACCEPT1, ART_BACK0, ART_BACK1, ART_FRAME, and trap_R_RegisterShaderNoMip().

Referenced by UI_Cache_f(), and UI_CDKeyMenu_Init().

00264                                 {
00265     trap_R_RegisterShaderNoMip( ART_ACCEPT0 );
00266     trap_R_RegisterShaderNoMip( ART_ACCEPT1 );
00267     trap_R_RegisterShaderNoMip( ART_BACK0 );
00268     trap_R_RegisterShaderNoMip( ART_BACK1 );
00269     trap_R_RegisterShaderNoMip( ART_FRAME );
00270 }

Here is the call graph for this function:

void UI_CDKeyMenu_DrawKey void *  self  )  [static]
 

Definition at line 131 of file ui_cdkey.c.

References BIGCHAR_HEIGHT, BIGCHAR_WIDTH, mfield_t::buffer, c, color_red, color_white, color_yellow, mfield_t::cursor, _tag_menuframework::cursor, f, menufield_s::field, menufield_s::generic, listbar_color, menucommon_s::menuPosition, menucommon_s::parent, qboolean, trap_Key_GetOverstrikeMode(), UI_CDKeyMenu_PreValidateKey(), UI_CENTER, UI_DrawChar(), UI_DrawProportionalString(), UI_DrawString(), UI_FillRect(), UI_SMALLFONT, x, and y.

00131                                                {
00132     menufield_s     *f;
00133     qboolean        focus;
00134     int             style;
00135     char            c;
00136     float           *color;
00137     int             x, y;
00138     int             val;
00139 
00140     f = (menufield_s *)self;
00141 
00142     focus = (f->generic.parent->cursor == f->generic.menuPosition);
00143 
00144     style = UI_LEFT;
00145     if( focus ) {
00146         color = color_yellow;
00147     }
00148     else {
00149         color = color_orange;
00150     }
00151 
00152     x = 320 - 8 * BIGCHAR_WIDTH;
00153     y = 240 - BIGCHAR_HEIGHT / 2;
00154     UI_FillRect( x, y, 16 * BIGCHAR_WIDTH, BIGCHAR_HEIGHT, listbar_color );
00155     UI_DrawString( x, y, f->field.buffer, style, color );
00156 
00157     // draw cursor if we have focus
00158     if( focus ) {
00159         if ( trap_Key_GetOverstrikeMode() ) {
00160             c = 11;
00161         } else {
00162             c = 10;
00163         }
00164 
00165         style &= ~UI_PULSE;
00166         style |= UI_BLINK;
00167 
00168         UI_DrawChar( x + f->field.cursor * BIGCHAR_WIDTH, y, c, style, color_white );
00169     }
00170 
00171     val = UI_CDKeyMenu_PreValidateKey( f->field.buffer );
00172     if( val == 1 ) {
00173         UI_DrawProportionalString( 320, 376, "Please enter your CD Key", UI_CENTER|UI_SMALLFONT, color_yellow );
00174     }
00175     else if ( val == 0 ) {
00176         UI_DrawProportionalString( 320, 376, "The CD Key appears to be valid, thank you", UI_CENTER|UI_SMALLFONT, color_white );
00177     }
00178     else {
00179         UI_DrawProportionalString( 320, 376, "The CD Key is not valid", UI_CENTER|UI_SMALLFONT, color_red );
00180     }
00181 }

Here is the call graph for this function:

void UI_CDKeyMenu_Event void *  ptr,
int  event
[static]
 

Definition at line 66 of file ui_cdkey.c.

References mfield_t::buffer, cdkeyMenuInfo_t::cdkey, cdkeyMenuInfo, menufield_s::field, ID_ACCEPT, ID_BACK, trap_SetCDKey(), and UI_PopMenu().

00066                                                        {
00067     if( event != QM_ACTIVATED ) {
00068         return;
00069     }
00070 
00071     switch( ((menucommon_s*)ptr)->id ) {
00072     case ID_ACCEPT:
00073         if( cdkeyMenuInfo.cdkey.field.buffer[0] ) {
00074             trap_SetCDKey( cdkeyMenuInfo.cdkey.field.buffer );
00075         }
00076         UI_PopMenu();
00077         break;
00078 
00079     case ID_BACK:
00080         UI_PopMenu();
00081         break;
00082     }
00083 }

Here is the call graph for this function:

void UI_CDKeyMenu_f void   ) 
 

Definition at line 289 of file ui_cdkey.c.

References UI_CDKeyMenu().

Referenced by UI_ConsoleCommand().

00289                             {
00290     UI_CDKeyMenu();
00291 }

Here is the call graph for this function:

void UI_CDKeyMenu_Init void   )  [static]
 

Definition at line 189 of file ui_cdkey.c.

References cdkeyMenuInfo_t::accept, cdkeyMenuInfo_t::back, cdkeyMenuInfo_t::banner, BIGCHAR_HEIGHT, BIGCHAR_WIDTH, mfield_t::buffer, menucommon_s::callback, cdkeyMenuInfo_t::cdkey, cdkeyMenuInfo, menutext_s::color, menufield_s::field, menucommon_s::flags, menubitmap_s::focuspic, cdkeyMenuInfo_t::frame, _tag_menuframework::fullscreen, menufield_s::generic, menubitmap_s::generic, menutext_s::generic, menubitmap_s::height, menucommon_s::id, mfield_t::maxchars, memset(), cdkeyMenuInfo_t::menu, Menu_AddItem(), uiStatic_t::menusp, menucommon_s::name, NULL, menucommon_s::ownerdraw, QMF_LEFT_JUSTIFY, QMF_RIGHT_JUSTIFY, menutext_s::string, menutext_s::style, trap_Cvar_Set(), trap_GetCDKey(), trap_VerifyCDKey(), menucommon_s::type, UI_CDKeyMenu_Cache(), uis, menubitmap_s::width, mfield_t::widthInChars, _tag_menuframework::wrapAround, menucommon_s::x, and menucommon_s::y.

Referenced by UI_CDKeyMenu().

00189                                       {
00190     trap_Cvar_Set( "ui_cdkeychecked", "1" );
00191 
00192     UI_CDKeyMenu_Cache();
00193 
00194     memset( &cdkeyMenuInfo, 0, sizeof(cdkeyMenuInfo) );
00195     cdkeyMenuInfo.menu.wrapAround = qtrue;
00196     cdkeyMenuInfo.menu.fullscreen = qtrue;
00197 
00198     cdkeyMenuInfo.banner.generic.type               = MTYPE_BTEXT;
00199     cdkeyMenuInfo.banner.generic.x                  = 320;
00200     cdkeyMenuInfo.banner.generic.y                  = 16;
00201     cdkeyMenuInfo.banner.string                     = "CD KEY";
00202     cdkeyMenuInfo.banner.color                      = color_white;
00203     cdkeyMenuInfo.banner.style                      = UI_CENTER;
00204 
00205     cdkeyMenuInfo.frame.generic.type                = MTYPE_BITMAP;
00206     cdkeyMenuInfo.frame.generic.name                = ART_FRAME;
00207     cdkeyMenuInfo.frame.generic.flags               = QMF_INACTIVE;
00208     cdkeyMenuInfo.frame.generic.x                   = 142;
00209     cdkeyMenuInfo.frame.generic.y                   = 118;
00210     cdkeyMenuInfo.frame.width                       = 359;
00211     cdkeyMenuInfo.frame.height                      = 256;
00212 
00213     cdkeyMenuInfo.cdkey.generic.type                = MTYPE_FIELD;
00214     cdkeyMenuInfo.cdkey.generic.name                = "CD Key:";
00215     cdkeyMenuInfo.cdkey.generic.flags               = QMF_LOWERCASE;
00216     cdkeyMenuInfo.cdkey.generic.x                   = 320 - BIGCHAR_WIDTH * 2.5;
00217     cdkeyMenuInfo.cdkey.generic.y                   = 240 - BIGCHAR_HEIGHT / 2;
00218     cdkeyMenuInfo.cdkey.field.widthInChars          = 16;
00219     cdkeyMenuInfo.cdkey.field.maxchars              = 16;
00220     cdkeyMenuInfo.cdkey.generic.ownerdraw           = UI_CDKeyMenu_DrawKey;
00221 
00222     cdkeyMenuInfo.accept.generic.type               = MTYPE_BITMAP;
00223     cdkeyMenuInfo.accept.generic.name               = ART_ACCEPT0;
00224     cdkeyMenuInfo.accept.generic.flags              = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
00225     cdkeyMenuInfo.accept.generic.id                 = ID_ACCEPT;
00226     cdkeyMenuInfo.accept.generic.callback           = UI_CDKeyMenu_Event;
00227     cdkeyMenuInfo.accept.generic.x                  = 640;
00228     cdkeyMenuInfo.accept.generic.y                  = 480-64;
00229     cdkeyMenuInfo.accept.width                      = 128;
00230     cdkeyMenuInfo.accept.height                     = 64;
00231     cdkeyMenuInfo.accept.focuspic                   = ART_ACCEPT1;
00232 
00233     cdkeyMenuInfo.back.generic.type                 = MTYPE_BITMAP;
00234     cdkeyMenuInfo.back.generic.name                 = ART_BACK0;
00235     cdkeyMenuInfo.back.generic.flags                = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
00236     cdkeyMenuInfo.back.generic.id                   = ID_BACK;
00237     cdkeyMenuInfo.back.generic.callback             = UI_CDKeyMenu_Event;
00238     cdkeyMenuInfo.back.generic.x                    = 0;
00239     cdkeyMenuInfo.back.generic.y                    = 480-64;
00240     cdkeyMenuInfo.back.width                        = 128;
00241     cdkeyMenuInfo.back.height                       = 64;
00242     cdkeyMenuInfo.back.focuspic                     = ART_BACK1;
00243 
00244     Menu_AddItem( &cdkeyMenuInfo.menu, &cdkeyMenuInfo.banner );
00245     Menu_AddItem( &cdkeyMenuInfo.menu, &cdkeyMenuInfo.frame );
00246     Menu_AddItem( &cdkeyMenuInfo.menu, &cdkeyMenuInfo.cdkey );
00247     Menu_AddItem( &cdkeyMenuInfo.menu, &cdkeyMenuInfo.accept );
00248     if( uis.menusp ) {
00249         Menu_AddItem( &cdkeyMenuInfo.menu, &cdkeyMenuInfo.back );
00250     }
00251 
00252     trap_GetCDKey( cdkeyMenuInfo.cdkey.field.buffer, cdkeyMenuInfo.cdkey.field.maxchars + 1 );
00253     if( trap_VerifyCDKey( cdkeyMenuInfo.cdkey.field.buffer, NULL ) == qfalse ) {
00254         cdkeyMenuInfo.cdkey.field.buffer[0] = 0;
00255     }
00256 }

Here is the call graph for this function:

int UI_CDKeyMenu_PreValidateKey const char *  key  )  [static]
 

Definition at line 91 of file ui_cdkey.c.

References ch, and strlen().

Referenced by UI_CDKeyMenu_DrawKey().

00091                                                           {
00092     char    ch;
00093 
00094     if( strlen( key ) != 16 ) {
00095         return 1;
00096     }
00097 
00098     while( ( ch = *key++ ) ) {
00099         switch( ch ) {
00100         case '2':
00101         case '3':
00102         case '7':
00103         case 'a':
00104         case 'b':
00105         case 'c':
00106         case 'd':
00107         case 'g':
00108         case 'h':
00109         case 'j':
00110         case 'l':
00111         case 'p':
00112         case 'r':
00113         case 's':
00114         case 't':
00115         case 'w':
00116             continue;
00117         default:
00118             return -1;
00119         }
00120     }
00121 
00122     return 0;
00123 }

Here is the call graph for this function:


Variable Documentation

cdkeyMenuInfo_t cdkeyMenuInfo [static]
 

Definition at line 58 of file ui_cdkey.c.

Referenced by UI_CDKeyMenu(), UI_CDKeyMenu_Event(), and UI_CDKeyMenu_Init().


Generated on Thu Aug 25 14:27:51 2005 for Quake III Arena by  doxygen 1.3.9.1