/* ================= UI_DrawProportionalString ================= */ void UI_DrawProportionalString(int x, int y, const char* str, int style, vec4_t color) { vec4_t drawcolor; int width; float sizeScale; sizeScale = UI_ProportionalSizeScale(style); switch (style & UI_FORMATMASK) { case UI_CENTER: width = UI_ProportionalStringWidth(str) * sizeScale; x -= width / 2; break; case UI_RIGHT: width = UI_ProportionalStringWidth(str) * sizeScale; x -= width; break; case UI_LEFT: default: break; } if (style & UI_DROPSHADOW) { drawcolor[0] = drawcolor[1] = drawcolor[2] = 0; drawcolor[3] = color[3]; UI_DrawProportionalString2(x+2, y+2, str, drawcolor, sizeScale, uis.charsetProp); } if (style & UI_INVERSE) { drawcolor[0] = color[0] * 0.7; drawcolor[1] = color[1] * 0.7; drawcolor[2] = color[2] * 0.7; drawcolor[3] = color[3]; UI_DrawProportionalString2(x, y, str, drawcolor, sizeScale, uis.charsetProp); return; } if (style & UI_PULSE) { drawcolor[0] = color[0] * 0.7; drawcolor[1] = color[1] * 0.7; drawcolor[2] = color[2] * 0.7; drawcolor[3] = color[3]; UI_DrawProportionalString2(x, y, str, color, sizeScale, uis.charsetProp); drawcolor[0] = color[0]; drawcolor[1] = color[1]; drawcolor[2] = color[2]; drawcolor[3] = 0.5 + 0.5 * sin(uis.realtime / PULSE_DIVISOR); UI_DrawProportionalString2(x, y, str, drawcolor, sizeScale, uis.charsetPropGlow); return; } UI_DrawProportionalString2(x, y, str, color, sizeScale, uis.charsetProp); }
/* ================= UI_ResetMenu ================= */ void UI_ResetMenu(void) { uiClientState_t cstate; int n1, n2, n3; int l1, l2, l3; // zero set all our globals memset( &s_reset, 0, sizeof(s_reset) ); Reset_Cache(); n1 = UI_ProportionalStringWidth( "YES/NO" ); n2 = UI_ProportionalStringWidth( "YES" ) + PROP_GAP_WIDTH; n3 = UI_ProportionalStringWidth( "/" ) + PROP_GAP_WIDTH; l1 = 320 - ( n1 / 2 ); l2 = l1 + n2; l3 = l2 + n3; s_reset.slashX = l2; s_reset.menu.draw = Reset_MenuDraw; s_reset.menu.key = Reset_MenuKey; s_reset.menu.wrapAround = qtrue; trap_GetClientState( &cstate ); if ( cstate.connState >= CA_CONNECTED ) { // float on top of running game s_reset.menu.fullscreen = qfalse; } else { // game not running s_reset.menu.fullscreen = qtrue; } s_reset.yes.generic.type = MTYPE_PTEXT; s_reset.yes.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; s_reset.yes.generic.callback = Reset_MenuEvent; s_reset.yes.generic.id = ID_YES; s_reset.yes.generic.x = l1; s_reset.yes.generic.y = 264; s_reset.yes.string = "YES"; s_reset.yes.color = color_red; s_reset.yes.style = UI_LEFT; s_reset.no.generic.type = MTYPE_PTEXT; s_reset.no.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; s_reset.no.generic.callback = Reset_MenuEvent; s_reset.no.generic.id = ID_NO; s_reset.no.generic.x = l3; s_reset.no.generic.y = 264; s_reset.no.string = "NO"; s_reset.no.color = color_red; s_reset.no.style = UI_LEFT; Menu_AddItem( &s_reset.menu, &s_reset.yes ); Menu_AddItem( &s_reset.menu, &s_reset.no ); UI_PushMenu( &s_reset.menu ); Menu_SetCursorToItem( &s_reset.menu, &s_reset.no ); }
/* ================= PText_Init ================= */ static void PText_Init( menutext_s *t ) { int x; int y; int w; int h; float sizeScale; sizeScale = UI_ProportionalSizeScale( t->style ); x = t->generic.x; y = t->generic.y; w = UI_ProportionalStringWidth( t->string ) * sizeScale; h = PROP_HEIGHT * sizeScale; if( t->generic.flags & QMF_RIGHT_JUSTIFY ) { x -= w; } else if( t->generic.flags & QMF_CENTER_JUSTIFY ) { x -= w / 2; } t->generic.left = x - PROP_GAP_WIDTH * sizeScale; t->generic.right = x + w + PROP_GAP_WIDTH * sizeScale; t->generic.top = y; t->generic.bottom = y + h; }
/* ================= UI_DrawProportionalString_Wrapped ================= */ void UI_DrawProportionalString_AutoWrapped( int x, int y, int xmax, int ystep, const char* str, int style, vec4_t color ) { int width; char *s1,*s2,*s3; char c_bcp; char buf[1024]; float sizeScale; if (!str || str[0]=='\0') return; sizeScale = UI_ProportionalSizeScale( style ); Q_strncpyz(buf, str, sizeof(buf)); s1 = s2 = s3 = buf; while (1) { do { s3++; } while (*s3!=' ' && *s3!='\0'); c_bcp = *s3; *s3 = '\0'; width = UI_ProportionalStringWidth(s1) * sizeScale; *s3 = c_bcp; if (width > xmax) { if (s1==s2) { // f**k, don't have a clean cut, we'll overflow s2 = s3; } *s2 = '\0'; UI_DrawProportionalString(x, y, s1, style, color); y += ystep; if (c_bcp == '\0') { // that was the last word // we could start a new loop, but that wouldn't be much use // even if the word is too long, we would overflow it (see above) // so just print it now if needed s2++; if (*s2 != '\0') // if we are printing an overflowing line we have s2 == s3 UI_DrawProportionalString(x, y, s2, style, color); break; } s2++; s1 = s2; s3 = s2; } else { s2 = s3; if (c_bcp == '\0') // we reached the end { UI_DrawProportionalString(x, y, s1, style, color); break; } } } }
/* ================= CG_DrawMotd ================= */ void CG_DrawMotd() { const char *s; s = CG_ConfigString( CS_MOTD ); if ( s[0] ) { vec4_t color = { 0.5f, 0.5f, 0.5f, 0.3f }; int len = (int)( (float)UI_ProportionalStringWidth( s ) * UI_ProportionalSizeScale( UI_EXSMALLFONT ) / 2 ); CG_FillRect( 0, 448, 640, 14, color ); CG_DrawStringExt( 320 - len, 445, s, colorWhite, qfalse, qtrue, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0 ); } }
static void Prepname( int index ) { int len; char name[64]; char info[MAX_INFO_STRING]; trap_GetConfigString( CS_PLAYERS + postgameMenuInfo.clientNums[index], info, MAX_INFO_STRING ); Q_strncpyz( name, Info_ValueForKey( info, "n" ), sizeof(name) ); Q_CleanStr( name ); len = strlen( name ); while( len && UI_ProportionalStringWidth( name ) > 256 ) { len--; name[len] = 0; } Q_strncpyz( postgameMenuInfo.placeNames[index], name, sizeof(postgameMenuInfo.placeNames[index]) ); }
/* ================= UI_Message hacked over from Confirm stuff ================= */ void UI_Message( const char **lines ) { uiClientState_t cstate; int n1, l1; // zero set all our globals memset( &s_confirm, 0, sizeof(s_confirm) ); ConfirmMenu_Cache(); n1 = UI_ProportionalStringWidth( "OK" ); l1 = 320 - ( n1 / 2 ); s_confirm.lines = lines; s_confirm.style = UI_CENTER|UI_INVERSE|UI_SMALLFONT; s_confirm.menu.draw = MessageMenu_Draw; s_confirm.menu.key = ConfirmMenu_Key; s_confirm.menu.wrapAround = qtrue; trap_GetClientState( &cstate ); if ( cstate.connState >= CA_CONNECTED ) { s_confirm.menu.fullscreen = qfalse; } else { s_confirm.menu.fullscreen = qtrue; } s_confirm.yes.generic.type = MTYPE_PTEXT; s_confirm.yes.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; s_confirm.yes.generic.callback = ConfirmMenu_Event; s_confirm.yes.generic.id = ID_CONFIRM_YES; s_confirm.yes.generic.x = l1; s_confirm.yes.generic.y = 280; s_confirm.yes.string = "OK"; s_confirm.yes.color = color_red; s_confirm.yes.style = UI_LEFT; Menu_AddItem( &s_confirm.menu, &s_confirm.yes ); UI_PushMenu( &s_confirm.menu ); Menu_SetCursorToItem( &s_confirm.menu, &s_confirm.yes ); }
static void UI_DisplayDownloadInfo( const char *downloadName ) { static char dlText[] = "Downloading:"; static char etaText[] = "Estimated time left:"; static char xferText[] = "Transfer rate:"; int downloadSize, downloadCount, downloadTime; char dlSizeBuf[64], totalSizeBuf[64], xferRateBuf[64], dlTimeBuf[64]; int xferRate; int width, leftWidth; int style = UI_LEFT|UI_SMALLFONT|UI_DROPSHADOW; const char *s; downloadSize = trap_Cvar_VariableValue( "cl_downloadSize" ); downloadCount = trap_Cvar_VariableValue( "cl_downloadCount" ); downloadTime = trap_Cvar_VariableValue( "cl_downloadTime" ); #if 0 // bk010104 fprintf( stderr, "\n\n-----------------------------------------------\n"); fprintf( stderr, "DB: downloadSize: %16d\n", downloadSize ); fprintf( stderr, "DB: downloadCount: %16d\n", downloadCount ); fprintf( stderr, "DB: downloadTime: %16d\n", downloadTime ); fprintf( stderr, "DB: UI realtime: %16d\n", uis.realtime ); // bk fprintf( stderr, "DB: UI frametime: %16d\n", uis.frametime ); // bk #endif leftWidth = width = UI_ProportionalStringWidth( dlText ) * UI_ProportionalSizeScale( style ); width = UI_ProportionalStringWidth( etaText ) * UI_ProportionalSizeScale( style ); if (width > leftWidth) leftWidth = width; width = UI_ProportionalStringWidth( xferText ) * UI_ProportionalSizeScale( style ); if (width > leftWidth) leftWidth = width; leftWidth += 16; UI_DrawProportionalString( 8, 128, dlText, style, UI_ProportionalSizeScale( style ), color_white ); UI_DrawProportionalString( 8, 160, etaText, style, UI_ProportionalSizeScale( style ), color_white ); UI_DrawProportionalString( 8, 224, xferText, style, UI_ProportionalSizeScale( style ), color_white ); if (downloadSize > 0) { s = va( "%s (%d%%)", downloadName, downloadCount * 100 / downloadSize ); } else { s = downloadName; } UI_DrawProportionalString( leftWidth, 128, s, style, UI_ProportionalSizeScale( style ), color_white ); UI_ReadableSize( dlSizeBuf, sizeof dlSizeBuf, downloadCount ); UI_ReadableSize( totalSizeBuf, sizeof totalSizeBuf, downloadSize ); if (downloadCount < 4096 || !downloadTime) { UI_DrawProportionalString( leftWidth, 160, "estimating", style, UI_ProportionalSizeScale( style ), color_white ); UI_DrawProportionalString( leftWidth, 192, va("(%s of %s copied)", dlSizeBuf, totalSizeBuf), style, UI_ProportionalSizeScale( style ), color_white ); } else { // bk010108 //float elapsedTime = (float)(uis.realtime - downloadTime); // current - start (msecs) //elapsedTime = elapsedTime * 0.001f; // in seconds //if ( elapsedTime <= 0.0f ) elapsedTime == 0.0f; if ( (uis.realtime - downloadTime) / 1000) { xferRate = downloadCount / ((uis.realtime - downloadTime) / 1000); //xferRate = (int)( ((float)downloadCount) / elapsedTime); } else { xferRate = 0; } //fprintf( stderr, "DB: elapsedTime: %16.8f\n", elapsedTime ); // bk //fprintf( stderr, "DB: xferRate: %16d\n", xferRate ); // bk UI_ReadableSize( xferRateBuf, sizeof xferRateBuf, xferRate ); // Extrapolate estimated completion time if (downloadSize && xferRate) { int n = downloadSize / xferRate; // estimated time for entire d/l in secs // We do it in K (/1024) because we'd overflow around 4MB n = (n - (((downloadCount/1024) * n) / (downloadSize/1024))) * 1000; UI_PrintTime ( dlTimeBuf, sizeof dlTimeBuf, n ); // bk010104 //(n - (((downloadCount/1024) * n) / (downloadSize/1024))) * 1000); UI_DrawProportionalString( leftWidth, 160, dlTimeBuf, style, UI_ProportionalSizeScale( style ), color_white ); UI_DrawProportionalString( leftWidth, 192, va("(%s of %s copied)", dlSizeBuf, totalSizeBuf), style, UI_ProportionalSizeScale( style ), color_white ); } else { UI_DrawProportionalString( leftWidth, 160, "estimating", style, UI_ProportionalSizeScale( style ), color_white ); if (downloadSize) { UI_DrawProportionalString( leftWidth, 192, va("(%s of %s copied)", dlSizeBuf, totalSizeBuf), style, UI_ProportionalSizeScale( style ), color_white ); } else { UI_DrawProportionalString( leftWidth, 192, va("(%s copied)", dlSizeBuf), style, UI_ProportionalSizeScale( style ), color_white ); } } if (xferRate) { UI_DrawProportionalString( leftWidth, 224, va("%s/Sec", xferRateBuf), style, UI_ProportionalSizeScale( style ), color_white ); } } }
/* ================= UI_ConfirmMenu_Stlye ================= */ void UI_ConfirmMenu_Style( const char *question, int style, void (*draw)( void ), void (*action)( qboolean result ) ) { uiClientState_t cstate; int n1, n2, n3; int l1, l2, l3; // zero set all our globals memset( &s_confirm, 0, sizeof(s_confirm) ); ConfirmMenu_Cache(); n1 = UI_ProportionalStringWidth( "YES/NO" ); n2 = UI_ProportionalStringWidth( "YES" ) + PROP_GAP_WIDTH; n3 = UI_ProportionalStringWidth( "/" ) + PROP_GAP_WIDTH; l1 = 320 - ( n1 / 2 ); l2 = l1 + n2; l3 = l2 + n3; s_confirm.slashX = l2; s_confirm.question = question; s_confirm.draw = draw; s_confirm.action = action; s_confirm.style = style; s_confirm.menu.draw = ConfirmMenu_Draw; s_confirm.menu.key = ConfirmMenu_Key; s_confirm.menu.wrapAround = qtrue; trap_GetClientState( &cstate ); if ( cstate.connState >= CA_CONNECTED ) { s_confirm.menu.fullscreen = qfalse; } else { s_confirm.menu.fullscreen = qtrue; } s_confirm.yes.generic.type = MTYPE_PTEXT; s_confirm.yes.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; s_confirm.yes.generic.callback = ConfirmMenu_Event; s_confirm.yes.generic.id = ID_CONFIRM_YES; s_confirm.yes.generic.x = l1; s_confirm.yes.generic.y = 264; s_confirm.yes.string = "YES"; s_confirm.yes.color = color_red; s_confirm.yes.style = UI_LEFT; s_confirm.no.generic.type = MTYPE_PTEXT; s_confirm.no.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; s_confirm.no.generic.callback = ConfirmMenu_Event; s_confirm.no.generic.id = ID_CONFIRM_NO; s_confirm.no.generic.x = l3; s_confirm.no.generic.y = 264; s_confirm.no.string = "NO"; s_confirm.no.color = color_red; s_confirm.no.style = UI_LEFT; Menu_AddItem( &s_confirm.menu, &s_confirm.yes ); Menu_AddItem( &s_confirm.menu, &s_confirm.no ); UI_PushMenu( &s_confirm.menu ); Menu_SetCursorToItem( &s_confirm.menu, &s_confirm.no ); }
static int Objective_LineCnt(int strIndex,centity_t *cent) { char *str,*strBegin; int pixelLen,charLen; char holdText[1024], holdText2[2]; char finalText[MAX_OBJ_LENGTH]; int len, maxPixLength; int lineCnt; assert(cgs.objectives[strIndex].text); str = cgs.objectives[strIndex].text; len = strlen(str); len++; Q_strncpyz(finalText,str,len); pixelLen = UI_ProportionalStringWidth(finalText,UI_SMALLFONT); lineCnt = 0; maxPixLength = SCREEN_WIDTH - (OBJ_TEXT_XPOS + OBJ_TEXT_X_BORDER_RIGHT + OBJ_CIRCLE_SIZE + OBJ_CIRCLE_TEXT_MARGIN); str = finalText; if (pixelLen < maxPixLength) // One shot - small enough to print entirely on one line { lineCnt = 1; } // Text is too long, break into lines. else { pixelLen = 0; charLen = 0; holdText2[1] = '\0'; strBegin = str; while( *str ) { holdText2[0] = *str; pixelLen += UI_ProportionalStringWidth(holdText2,UI_SMALLFONT); pixelLen += 2; // For kerning ++charLen; if (pixelLen > maxPixLength ) { //Reached max length of this line //step back until we find a space while ((charLen) && (*str != ' ' )) { --str; --charLen; } if (*str==' ') { ++str; // To get past space } Q_strncpyz( holdText, strBegin, charLen); holdText[charLen] = '\0'; strBegin = str; pixelLen = 0; charLen = 1; lineCnt++; } else if (*(str+1) == '\0') { ++charLen; lineCnt++; break; } ++str; } } return (lineCnt); }
/* ==================== ObjectivePrint_Line ==================== */ static void ObjectivePrint_Line(int strIndex,int color,centity_t *cent) { char *str,*strBegin; int y,pixelLen,charLen; char holdText[1024], holdText2[2]; char finalText[MAX_OBJ_LENGTH]; int len, maxPixLength, charHeight; assert(cgs.objectives[strIndex].text); str = cgs.objectives[strIndex].text; len = strlen(str); len++; Q_strncpyz(finalText,str,len); pixelLen = UI_ProportionalStringWidth(finalText,UI_SMALLFONT); str = finalText; maxPixLength = SCREEN_WIDTH - (OBJ_TEXT_XPOS + OBJ_TEXT_X_BORDER_RIGHT + OBJ_CIRCLE_SIZE + OBJ_CIRCLE_TEXT_MARGIN); charHeight = OBJ_NORMAL_LINE_HEIGHT; if (missionYcnt) // Not the very first objective to be printed? { missionYpos += (PROP_HEIGHT * OBJ_ADDITIONAL_LINE_HEIGHT); // Add a little space between objective lines } y =missionYpos + (charHeight * (missionYcnt)); trap_R_SetColor( colorTable[color]); if (cgs.objectives[strIndex].complete) { CG_DrawPic( OBJ_TEXT_XPOS,y, OBJ_CIRCLE_SIZE, OBJ_CIRCLE_SIZE,cgs.media.circle); } else { CG_DrawPic( OBJ_TEXT_XPOS,y, OBJ_CIRCLE_SIZE, OBJ_CIRCLE_SIZE,cgs.media.circle2); } if (pixelLen < maxPixLength) // One shot - small enough to print entirely on one line { UI_DrawProportionalString(OBJ_TEXT_XPOS + OBJ_CIRCLE_SIZE + OBJ_CIRCLE_TEXT_MARGIN, y,str, UI_SMALLFONT, colorTable[color] ); ++missionYcnt; } // Text is too long, break into lines. else { pixelLen = 0; charLen = 0; holdText2[1] = '\0'; strBegin = str; while( *str ) { holdText2[0] = *str; pixelLen += UI_ProportionalStringWidth(holdText2,UI_SMALLFONT); pixelLen += 2; // For kerning ++charLen; if (pixelLen > maxPixLength ) { //Reached max length of this line //step back until we find a space while ((charLen) && (*str != ' ' )) { --str; --charLen; } if (*str==' ') { ++str; // To get past space } Q_strncpyz( holdText, strBegin, charLen); holdText[charLen] = '\0'; strBegin = str; pixelLen = 0; charLen = 1; y = missionYpos + (charHeight * missionYcnt); UI_DrawProportionalString(OBJ_TEXT_XPOS + OBJ_CIRCLE_SIZE + OBJ_CIRCLE_TEXT_MARGIN, y, holdText, UI_SMALLFONT, colorTable[color] ); ++missionYcnt; } else if (*(str+1) == '\0') { ++charLen; y = missionYpos + (charHeight * missionYcnt); Q_strncpyz( holdText, strBegin, charLen); UI_DrawProportionalString(OBJ_TEXT_XPOS + OBJ_CIRCLE_SIZE + OBJ_CIRCLE_TEXT_MARGIN, y, holdText, UI_SMALLFONT, colorTable[color] ); ++missionYcnt; break; } ++str; } } }
void CG_DrawInformation( void ) { const char *s; const char *info; const char *sysInfo; int y,x; // int value; qhandle_t levelshot; // qhandle_t detail; char buf[1024]; int strlength,length; //trap_Cvar_Set ("rpg_playIntro", "1"); info = CG_ConfigString( CS_SERVERINFO ); sysInfo = CG_ConfigString( CS_SYSTEMINFO ); s = Info_ValueForKey( info, "mapname" ); levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s.tga", s ) ); if ( !levelshot ) { levelshot = trap_R_RegisterShaderNoMip( "levelshots/unknownmap" ); } cgs.widescreen.state = WIDESCREEN_NONE; trap_R_SetColor( colorTable[CT_BLACK] ); CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, cgs.media.whiteShader ); cgs.widescreen.state = WIDESCREEN_CENTER; trap_R_SetColor( colorTable[CT_DKGREY] ); CG_DrawPic( 11, 60, 260, 196, cgs.media.whiteShader ); trap_R_SetColor( NULL ); CG_DrawPic( 13, 62, 256, 192, levelshot ); //correct aspect // trap_R_SetColor( colorTable[CT_LTGREY] ); // CG_DrawPic( 418, 82, 132, 132, cgs.media.whiteShader ); // trap_R_SetColor( NULL ); // CG_DrawPic( 420, 84, 128, 128, levelshot ); // blend a detail texture over it // detail = trap_R_RegisterShader( "levelShotDetail" ); // trap_R_DrawStretchPic( 0, 0, cgs.glconfig.vidWidth, cgs.glconfig.vidHeight, 0, 0, 1, 1, detail ); UI_DrawProportionalString( 10, 10, ingame_text[IGT_HOLODECKSIMULATION], UI_BIGFONT, colorTable[CT_LTORANGE] ); strlength = UI_ProportionalStringWidth(ingame_text[IGT_HOLODECKSIMULATION],UI_BIGFONT); length = 582 - (strlength + 6); trap_R_SetColor( colorTable[CT_DKORANGE]); CG_DrawPic( 10 + strlength + 6, 11, length, 22,cgs.media.whiteShader); // CG_DrawPic( 224, 11, 368, 22,cgs.media.whiteShader); CG_DrawPic( 595, 11, 32, 32,cgs.media.halfroundr_22); // Right End trap_R_SetColor( colorTable[CT_DKPURPLE1]); CG_DrawPic( 274+333, 232, -32, 32,cgs.media.corner_12_18); // LR CG_DrawPic( 274+333, 84, -32, -32,cgs.media.corner_12_18); // UR CG_DrawPic( 274, 60, 314, 18,cgs.media.whiteShader); // Top CG_DrawPic( 274, 238, 314, 18,cgs.media.whiteShader); //Bottom CG_DrawPic( 274, 75, 10, 170,cgs.media.whiteShader); // Left CG_DrawPic( 274+321, 78, 12, 162,cgs.media.whiteShader); // Right CG_LoadBar(); // draw the icons of thiings as they are loaded CG_DrawLoadingIcons(); // the first 150 rows are reserved for the client connection // screen to write into if ( cg.infoScreenText[0] ) { UI_DrawProportionalString( 320, 442, va("%s ... %s", ingame_text[IGT_LOADING], cg.infoScreenText), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_LTGOLD1]); } else { UI_DrawProportionalString( 320, 442, va("%s...", ingame_text[IGT_SNAPSHOT]), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_LTGOLD1] ); } // draw info string information y = 107; x = 288; // don't print server lines if playing a local game trap_Cvar_VariableStringBuffer( "sv_running", buf, sizeof( buf ) ); if ( !atoi( buf ) ) { // server hostname Q_strncpyz(buf, Info_ValueForKey( info, "sv_hostname" ), 1024); Q_CleanStr(buf); UI_DrawProportionalString( x, y, buf, UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] ); y += PROP_HEIGHT; // pure server s = Info_ValueForKey( sysInfo, "sv_pure" ); if ( s[0] == '1' ) { UI_DrawProportionalString( x, y, ingame_text[IGT_PURESERVER], UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] ); y += PROP_HEIGHT; } // server-specific message of the day s = CG_ConfigString( CS_MOTD ); if ( s[0] ) { UI_DrawProportionalString(320, y, s, UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] ); y += PROP_HEIGHT; } // some extra space after hostname and motd y += 10; } // map-specific message (long map name) s = CG_ConfigString( CS_MESSAGE ); if ( s[0] ) { UI_DrawProportionalString( x, y, s, UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] ); y += PROP_HEIGHT; } // cheats warning s = Info_ValueForKey( sysInfo, "sv_cheats" ); if ( s[0] == '1' ) { UI_DrawProportionalString( x, y, ingame_text[IGT_CHEATSAREENABLED], UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] ); y += PROP_HEIGHT; } // RPG-X | Marcin | 24/12/2008 // privacy thing :p // translate later s = Info_ValueForKey( info, "rpg_respectPrivacy" ); if ( atoi( s ) != 0 ) { UI_DrawProportionalString( x, y, "PRIVACY MODE ^5ON", UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] ); y += PROP_HEIGHT; } else { UI_DrawProportionalString( x, y, "PRIVACY MODE ^1OFF", UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] ); y += PROP_HEIGHT; } s = ingame_text[IGT_GAME_FREEFORALL]; char gamename[1024]; Q_strncpyz( gamename, s, sizeof(gamename) ); CG_AddGameModNameToGameName( gamename ); UI_DrawProportionalString( x, y, gamename, UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] ); y += PROP_HEIGHT; cgs.widescreen.state = WIDESCREEN_NONE; }
/* ================= M_TurboliftMenu_Graphics ================= */ static void M_TurboliftMenu_Graphics (void) { menubitmap_s *holdDeck; int i,length,xTurboStart; int numColor,roundColor; // Draw the basic screen frame // Upper corners trap_R_SetColor( colorTable[CT_DKPURPLE1]); UI_DrawHandlePic( 20, 24, 64, 32, corner_ul_24_60); // Upper corner UI_DrawHandlePic( 20, 353, 64, 16, corner_ll_12_60); // Lower Corner trap_R_SetColor( colorTable[CT_LTPURPLE1] ); //colorTable[CT_LTBLUE1] //[CT_DKGOLD1] //colorTable[CT_VDKPURPLE2] UI_DrawHandlePic( 100, 86, 128, 128, turbolift); // Turbolift graphic // Lower corners trap_R_SetColor( colorTable[CT_DKPURPLE3]); //colorTable[CT_VDKPURPLE2] UI_DrawHandlePic( 20, 375, 64, -16, corner_ll_12_60); // UI_DrawHandlePic( 20, 440, 64, 16, corner_ll_12_60); // xTurboStart = 604; length = UI_ProportionalStringWidth( menu_normal_text[MNT_TURBOLIFT],UI_BIGFONT); length += 4; // Upper half trap_R_SetColor( colorTable[CT_DKPURPLE1]); //DKGOLD1 UI_DrawHandlePic( 79, 24, xTurboStart - (79 + length), PROP_BIG_HEIGHT, uis.whiteShader); // Top left line UI_DrawHandlePic( 20, 60, 60, 40, uis.whiteShader); // trap_R_SetColor( colorTable[CT_DKPURPLE3]); UI_DrawHandlePic( 20, 106, 60, 11, uis.whiteShader); // trap_R_SetColor( colorTable[CT_DKPURPLE1]); //DKGOLD1 UI_DrawHandlePic( 20, 123, 60, 240, uis.whiteShader); // Left hand column UI_DrawHandlePic( 69, 356, 245, 12, uis.whiteShader); // trap_R_SetColor( colorTable[CT_DKPURPLE3] ); //colorTable[CT_DKPURPLE1] UI_DrawHandlePic(319, 356, 93, 5, uis.whiteShader); // UI_DrawHandlePic(319, 360, 31, 8, uis.whiteShader); // UI_DrawHandlePic(381, 360, 31, 8, uis.whiteShader); // trap_R_SetColor( colorTable[CT_DKPURPLE1]); UI_DrawHandlePic(417, 356, 93, 12, uis.whiteShader); // UI_DrawHandlePic(510, 356,114, 12, uis.whiteShader); // // Lower half trap_R_SetColor( colorTable[CT_DKPURPLE3] ); //colorTable[CT_VDKPURPLE2] UI_DrawHandlePic( 20, 380, 60, 70, uis.whiteShader); // Left Column trap_R_SetColor( colorTable[CT_DKPURPLE3] ); //colorTable[CT_VDKPURPLE2] UI_DrawHandlePic( 69, 376, 158, 12, uis.whiteShader); // Top line UI_DrawHandlePic(232, 376, 82, 12, uis.whiteShader); // Top line UI_DrawHandlePic(417, 376, 12, 12, uis.whiteShader); // UI_DrawHandlePic(434, 376, 190, 12, uis.whiteShader); // // Funky indent trap_R_SetColor( colorTable[CT_DKPURPLE1] ); //colorTable[CT_DKGOLD1] UI_DrawHandlePic(319, 383, 93, 5, uis.whiteShader); // UI_DrawHandlePic(319, 376, 31, 8, uis.whiteShader); // UI_DrawHandlePic(381, 376, 31, 8, uis.whiteShader); // // Bottom line trap_R_SetColor( colorTable[CT_DKPURPLE3] ); //colorTable[CT_VDKPURPLE2] UI_DrawHandlePic( 69, 443, 287, 12, uis.whiteShader); // trap_R_SetColor( colorTable[CT_DKPURPLE1]); //colorTable[CT_DKGOLD1] UI_DrawHandlePic(364, 443, 260, 12, uis.whiteShader); // Bottom line UI_DrawProportionalString( xTurboStart, 24, menu_normal_text[MNT_TURBOLIFT], UI_BIGFONT | UI_RIGHT, colorTable[CT_WHITE]); trap_R_SetColor( colorTable[CT_DKPURPLE1]); //DKGOLD1 UI_DrawHandlePic( 607, 24,-16, 32, leftRound); holdDeck = &s_turbolift.deck1; // Print deck buttons for (i=0;i<s_turbolift.maxDecks;i++) { if (s_turbolift.deckData[i].deckNum ) { if (s_turbolift.chosenDeck == i) // This deck was chosen { numColor = CT_WHITE;//CT_LTGOLD1; roundColor = CT_LTPURPLE1;//CT_LTGOLD1; } else // This deck was not chosen { numColor = CT_WHITE; roundColor = CT_DKPURPLE1;//CT_DKGOLD1; } UI_DrawProportionalString( holdDeck->generic.x - 6, holdDeck->generic.y, va("%d",s_turbolift.deckData[i].deckNum), UI_BIGFONT|UI_RIGHT, colorTable[numColor]); //i+1 trap_R_SetColor( colorTable[roundColor]); UI_DrawHandlePic( holdDeck->generic.x - 45, holdDeck->generic.y, 16, 32, leftRound); } holdDeck++; } if ( s_turbolift.highLightedDeck >= 0 ) { UI_DrawProportionalString( 353, 409, s_turbolift.deckData[s_turbolift.highLightedDeck].deckDesc, UI_SMALLFONT|UI_CENTER, colorTable[CT_WHITE]); } else { UI_DrawProportionalString( 353, 409, menu_normal_text[MNT_SPECFICYDECK], UI_SMALLFONT|UI_CENTER, colorTable[CT_WHITE]); } // Round graphic on left of engage & quit button trap_R_SetColor( colorTable[s_turbolift.quitmenu.color]); UI_DrawHandlePic(s_turbolift.engage.generic.x - 14, s_turbolift.engage.generic.y, MENU_BUTTON_MED_HEIGHT, s_turbolift.engage.height, uis.graphicButtonLeftEnd); UI_DrawHandlePic(s_turbolift.quitmenu.generic.x - 14, s_turbolift.quitmenu.generic.y, MENU_BUTTON_MED_HEIGHT, s_turbolift.quitmenu.height, uis.graphicButtonLeftEnd); }
void UI_ConfirmMenu( const char *question, void (*draw)( void ), void (*action)( qboolean result ) ) { // uiClientState_t cstate; int n1, n2, n3; int l1, l2, l3; // zero set all our globals memset( &s_confirm, 0, sizeof(s_confirm) ); ConfirmMenu_Cache(); Mouse_Show(); n1 = UI_ProportionalStringWidth( "YES/NO",UI_SMALLFONT ); n2 = UI_ProportionalStringWidth( "YES",UI_SMALLFONT ) + PROP_GAP_WIDTH; n3 = UI_ProportionalStringWidth( "/",UI_SMALLFONT ) + PROP_GAP_WIDTH; l1 = 320 - ( n1 / 2 ); l2 = l1 + n2; l3 = l2 + n3; s_confirm.slashX = l2; s_confirm.question = question; s_confirm.draw = draw; s_confirm.action = action; s_confirm.menu.draw = ConfirmMenu_Draw; s_confirm.menu.key = ConfirmMenu_Key; s_confirm.menu.wrapAround = qtrue; s_confirm.menu.fullscreen = qtrue; s_confirm.menu.descX = MENU_DESC_X; s_confirm.menu.descY = MENU_DESC_Y; s_confirm.menu.titleX = MENU_TITLE_X; s_confirm.menu.titleY = MENU_TITLE_Y; s_confirm.menu.titleI = MNT_CONFIRMATIONMENU_TITLE; s_confirm.menu.footNoteEnum = MNT_CONFIRMATION; s_confirm.yes.generic.type = MTYPE_BITMAP; s_confirm.yes.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; s_confirm.yes.generic.x = 215; s_confirm.yes.generic.y = 365; s_confirm.yes.generic.callback = ConfirmMenu_Event; s_confirm.yes.generic.id = ID_CONFIRM_YES; s_confirm.yes.generic.name = GRAPHIC_SQUARE; s_confirm.yes.width = MENU_BUTTON_MED_WIDTH; s_confirm.yes.height = MENU_BUTTON_MED_HEIGHT; s_confirm.yes.color = CT_DKPURPLE1; s_confirm.yes.color2 = CT_LTPURPLE1; s_confirm.yes.textX = MENU_BUTTON_TEXT_X; s_confirm.yes.textY = MENU_BUTTON_TEXT_Y; s_confirm.yes.textEnum = MBT_GENERIC_YES; s_confirm.yes.textcolor = CT_BLACK; s_confirm.yes.textcolor2 = CT_WHITE; s_confirm.no.generic.type = MTYPE_BITMAP; s_confirm.no.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; s_confirm.no.generic.x = 371; s_confirm.no.generic.y = 365; s_confirm.no.generic.callback = ConfirmMenu_Event; s_confirm.no.generic.id = ID_CONFIRM_NO; s_confirm.no.generic.name = GRAPHIC_SQUARE; s_confirm.no.width = 103; s_confirm.no.height = MENU_BUTTON_MED_HEIGHT; s_confirm.no.color = CT_DKPURPLE1; s_confirm.no.color2 = CT_LTPURPLE1; s_confirm.no.textX = MENU_BUTTON_TEXT_X; s_confirm.no.textY = MENU_BUTTON_TEXT_Y; s_confirm.no.textEnum = MBT_GENERIC_NO; s_confirm.no.textcolor = CT_BLACK; s_confirm.no.textcolor2 = CT_WHITE; Menu_AddItem( &s_confirm.menu, &s_confirm.yes ); Menu_AddItem( &s_confirm.menu, &s_confirm.no ); UI_PushMenu( &s_confirm.menu ); // Menu_SetCursorToItem( &s_confirm.menu, &s_confirm.no ); }