/* * UI_SaveConfigMenu_SavenameDraw */ static void UI_SaveConfigMenu_SavenameDraw(void *self) { menufield_s *f; int style; float *color; f = (menufield_s*)self; if(f == Menu_ItemAtCursor(&saveConfig.menu)){ style = UI_LEFT|UI_PULSE|UI_SMALLFONT; color = text_color_highlight; }else{ style = UI_LEFT|UI_SMALLFONT; color = colorRed; } UI_DrawProportionalString(320, 192, "Enter filename:", UI_CENTER| UI_SMALLFONT, color_orange); UI_FillRect(f->generic.x, f->generic.y, f->field.widthInChars* SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, colorBlack); MField_Draw(&f->field, f->generic.x, f->generic.y, style, color); }
/* ================== MenuField_Draw ================== */ void MenuField_Draw( menufield_s *f ) { int x; int y; int w; int h; int style; qboolean focus; float *color; x = f->generic.x; y = f->generic.y; if (f->generic.flags & QMF_SMALLFONT) { w = SMALLCHAR_WIDTH; h = SMALLCHAR_HEIGHT; style = UI_SMALLFONT; } else { w = BIGCHAR_WIDTH; h = BIGCHAR_HEIGHT; style = UI_BIGFONT; } if (Menu_ItemAtCursor( f->generic.parent ) == f) { focus = qtrue; style |= UI_PULSE; } else { focus = qfalse; } if (f->generic.flags & QMF_GRAYED) color = text_color_disabled; else if (focus) color = text_color_highlight; else color = text_color_normal; if ( focus ) { // draw cursor UI_FillRect( f->generic.left, f->generic.top, f->generic.right-f->generic.left+1, f->generic.bottom-f->generic.top+1, listbar_color ); UI_DrawChar( x, y, 13, UI_CENTER|UI_BLINK|style, color); } if ( f->generic.name ) { UI_DrawString( x - w, y, f->generic.name, style|UI_RIGHT, color ); } MField_Draw( &f->field, x + w, y, style, color ); }
/* ================ Con_DrawInput Draw the editline after a ] prompt ================ */ void Con_DrawInput ( connstate_t state, int lines ) { int y; if ( state != CA_DISCONNECTED && !(trap_Key_GetCatcher( ) & KEYCATCH_CONSOLE ) ) { return; } y = lines - ( SMALLCHAR_HEIGHT * 2 ); CG_DrawSmallStringColor( con.sideMargin, y, "]", g_color_table[ColorIndex(COLOR_WHITE)] ); MField_Draw( &g_consoleField, 2 * SMALLCHAR_WIDTH, y, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, g_color_table[ColorIndex(COLOR_WHITE)] ); }
void MenuField_Draw(menufield_s *f) { int x; int y; int w; int style; qboolean focus; float *color; x = f->generic.x; y = f->generic.y; if (f->generic.flags & QMF_SMALLFONT) { w = SMALLCHAR_SIZE; style = FONT_SMALL; } else { w = BIGCHAR_SIZE; style = 0; } if (Menu_ItemAtCursor(f->generic.parent) == f) { focus = qtrue; style |= FONT_PULSE; } else { focus = qfalse; } if (f->generic.flags & QMF_GRAYED) { color = colorTextDisabled; } else if (focus) { color = colorTextHighlight; } else { color = colorTextNormal; } if (focus) { // draw cursor SCR_FillRect(f->generic.left, f->generic.top, f->generic.right-f->generic.left+1, f->generic.bottom-f->generic.top+1, colorListbar); SCR_DrawString(x, y, "\15", w, FONT_CENTER | FONT_BLINK, color); } if (f->generic.name) { SCR_DrawString(x - w, y, f->generic.name, w, FONT_RIGHT, color); } MField_Draw(&f->field, x + w, y, w, style, color); }
/* ======================== UI_DrawConnectScreen This will also be overlaid on the cgame info screen during loading to prevent it from blinking away too rapidly on local or lan games. ======================== */ void UI_DrawConnectScreen( qboolean overlay ) { char *s; uiClientState_t cstate; char info[MAX_INFO_VALUE]; Menu_Cache(); if ( !overlay ) { // draw the dialog background UI_SetColor( color_white ); UI_DrawHandlePic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, uis.connecting ); } // see what information we should display trap_GetClientState( &cstate ); info[0] = '\0'; if( trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) ) ) { UI_DrawProportionalString( 320, 16, va( "Loading %s", Info_ValueForKey( info, "mapname" ) ), UI_BIGFONT|UI_CENTER|UI_DROPSHADOW, 1.0, g_color_table[60] ); } UI_DrawProportionalString( 320, 64, va("Connecting to %s", cstate.servername), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, 0.75, g_color_table[60] ); //UI_DrawProportionalString( 320, 96, "Press Esc to abort", UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, menu_text_color ); // display global MOTD at bottom UI_DrawProportionalString( SCREEN_WIDTH/2, SCREEN_HEIGHT-32, Info_ValueForKey( cstate.updateInfoString, "motd" ), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, 0.75, menu_text_color ); // print any server info (server full, bad version, etc) if ( cstate.connState < CA_CONNECTED ) { UI_DrawProportionalString_AutoWrapped( 320, 192, 630, 20, cstate.messageString, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, menu_text_color ); //Here is what prints the ban message! //Com_Printf("DBG: %s\n", cstate.messageString); } #if 0 // display password field if ( passwordNeeded ) { s_ingame_menu.x = SCREEN_WIDTH * 0.50 - 128; s_ingame_menu.nitems = 0; s_ingame_menu.wrapAround = qtrue; passwordField.generic.type = MTYPE_FIELD; passwordField.generic.name = "Password:"******"password"), sizeof(passwordField.field.buffer) ); Menu_AddItem( &s_ingame_menu, ( void * ) &s_customize_player_action ); MField_Draw( &passwordField ); } #endif if ( lastConnState > cstate.connState ) { lastLoadingText[0] = '\0'; } lastConnState = cstate.connState; switch ( cstate.connState ) { case CA_CONNECTING: s = va("Awaiting challenge...%i", cstate.connectPacketCount); break; case CA_CHALLENGING: s = va("Awaiting connection...%i", cstate.connectPacketCount); break; case CA_CONNECTED: { char downloadName[MAX_INFO_VALUE]; trap_Cvar_VariableStringBuffer( "cl_downloadName", downloadName, sizeof(downloadName) ); if (*downloadName) { UI_DisplayDownloadInfo( downloadName ); return; } } s = "Awaiting gamestate..."; break; case CA_LOADING: return; case CA_PRIMED: return; default: return; } UI_DrawProportionalString( 320, 128, s, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, 0.75, g_color_table[60] ); // password required / connection rejected information goes here }
/* ================= CG_MField_Draw ================= */ void CG_MField_Draw( mfield_t *edit, int x, int y, int style, vec4_t color, qboolean drawCursor ) { MField_Draw( edit, x, y, style, CG_FontForStyle( style ), color, drawCursor ); }