这篇教程C++ CG_TranslateString函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CG_TranslateString函数的典型用法代码示例。如果您正苦于以下问题:C++ CG_TranslateString函数的具体用法?C++ CG_TranslateString怎么用?C++ CG_TranslateString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CG_TranslateString函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CG_DrawPlayerNFvoid CG_DrawPlayerNF(panel_button_t *button, int *pageofs){ float y = button->rect.y; const char *str; int i, x; for (i = 0; i < 8; i++) { x = CG_PlayerNFFromPos(i, pageofs); if (x == -1) { break; } if (cg_quickMessageAlt.integer) { str = va("%i. %s", (i + 1) % 10, cgs.clientinfo[x].name); } else { str = va("%c. %s", 'A' + i, cgs.clientinfo[x].name); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } if (*pageofs) { if (cg_quickMessageAlt.integer) { str = va("%i. %s", (8 + 1) % 10, CG_TranslateString("Previous")); } else { str = va("%c. %s", 'P', CG_TranslateString("Previous")); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } if (CG_CountPlayersNF() > (*pageofs + 1) * 8) { if (cg_quickMessageAlt.integer) { str = va("%i. %s", (9 + 1) % 10, CG_TranslateString("Next")); } else { str = va("%c. %s", 'N', CG_TranslateString("Next")); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); //y += button->rect.h; }}
开发者ID:ensiform,项目名称:etlegacy,代码行数:60,
示例2: CG_LimboMessage_fstatic void CG_LimboMessage_f( void ) { char teamStr[80], classStr[80], weapStr[80]; Q_strncpyz( teamStr, CG_TranslateString( CG_Argv( 1 ) ), 80 ); Q_strncpyz( classStr, CG_TranslateString( CG_Argv( 2 ) ), 80 ); Q_strncpyz( weapStr, CG_TranslateString( CG_Argv( 3 ) ), 80 ); CG_PriorityCenterPrint( va( "%s %s %s %s %s.", CG_TranslateString( "You will spawn as an" ), teamStr, classStr, CG_TranslateString( "with a" ), weapStr ), SCREEN_HEIGHT - ( SCREEN_HEIGHT * 0.25 ), SMALLCHAR_WIDTH, -1 );}
开发者ID:chegestar,项目名称:omni-bot,代码行数:10,
示例3: WM_DrawInfoLinestatic int WM_DrawInfoLine( int x, int y, float fade ) { int w, defender, winner; const char *s; vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f }; if ( cg.snap->ps.pm_type != PM_INTERMISSION ) { return y; } w = 360;// CG_DrawPic( 320 - w/2, y, w, INFO_LINE_HEIGHT, trap_R_RegisterShaderNoMip( "ui/assets/mp_line_strip.tga" ) ); s = CG_ConfigString( CS_MULTI_INFO ); defender = atoi( Info_ValueForKey( s, "defender" ) ); s = CG_ConfigString( CS_MULTI_MAPWINNER ); winner = atoi( Info_ValueForKey( s, "winner" ) ); if ( cgs.currentRound ) { // first round s = va( CG_TranslateString( "CLOCK IS NOW SET TO %s!" ), WM_TimeToString( cgs.nextTimeLimit * 60.f * 1000.f ) ); } else { // second round if ( !defender ) { if ( winner != defender ) s = "ALLIES SUCCESSFULLY BEAT THE CLOCK!"; else s = "ALLIES COULDN'T BEAT THE CLOCK!"; } else { if ( winner != defender ) s = "AXIS SUCCESSFULLY BEAT THE CLOCK!"; else s = "AXIS COULDN'T BEAT THE CLOCK!"; } s = CG_TranslateString( s ); } CG_FillRect( 320 - w/2, y, w, 20, clrUiBar ); CG_DrawRect_FixedBorder( 320 - w/2, y, w, 20, 1, colorBlack ); w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ); CG_Text_Paint_Ext( 320 - w*0.5f, y + 15, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 );// CG_DrawSmallString( 320 - w/2, ( y + INFO_LINE_HEIGHT / 2 ) - SMALLCHAR_HEIGHT / 2, s, fade ); return y + INFO_LINE_HEIGHT + 6;}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:49,
示例4: CG_SayPlayerClass_fstatic void CG_SayPlayerClass_f( void ){ int playerType; const char *s; playerType = cgs.clientinfo[ cg.clientNum ].cls; if ( playerType == PC_MEDIC ) s = "IamMedic"; else if ( playerType == PC_ENGINEER ) s = "IamEngineer"; else if ( playerType == PC_FIELDOPS ) s = "IamFieldOps"; else if ( playerType == PC_COVERTOPS ) s = "IamCovertOps"; else s = "IamSoldier"; if ( cg.snap && ( cg.snap->ps.pm_type != PM_INTERMISSION ) ) { if ( cgs.clientinfo[cg.clientNum].team == TEAM_SPECTATOR || cgs.clientinfo[cg.clientNum].team == TEAM_FREE ) { CG_Printf ( CG_TranslateString( "Can't team voice chat as a spectator./n" ) ); return; } } trap_SendConsoleCommand( va( "cmd vsay_team %s/n", s ) );}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:27,
示例5: CG_DrawTimer/*=================CG_DrawTimer=================*/static float CG_DrawTimer(float y){ char *s; int w, w2; vec4_t color = { 0.625f, 0.625f, 0.6f, 1.0f }; int tens; char *rt = (cgs.gametype != GT_WOLF_LMS && (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR || cg.snap->ps.pm_flags & PMF_FOLLOW) && cg_drawReinforcementTime.integer > 0) ? va("^F%d%s", CG_CalculateReinfTime(qfalse), ((cgs.timelimit <= 0.0f) ? "" : " ")) : ""; int x; int msec = (cgs.timelimit * 60.f * 1000.f) - (cg.time - cgs.levelStartTime); int seconds = msec / 1000; int mins = seconds / 60; seconds -= mins * 60; tens = seconds / 10; seconds -= tens * 10; if (cgs.gamestate != GS_PLAYING) { s = va("^7%s", CG_TranslateString("WARMUP")); // don't draw reinforcement time in warmup mode // ^* color[3] = fabs(sin(cg.time * 0.002)); } else if (msec < 0 && cgs.timelimit > 0.0f) { s = "^N0:00"; color[3] = fabs(sin(cg.time * 0.002)); } else { if (cgs.timelimit <= 0.0f) { s = va("%s", rt); } else { s = va("%s^7%i:%i%i", rt, mins, tens, seconds); // ^* } color[3] = 1.f; } // spawntimer seconds = msec / 1000; if (cg_spawnTimer_set.integer != -1 && cg_spawnTimer_period.integer > 0) { s = va("^1%d %s", cg_spawnTimer_period.integer + (seconds - cg_spawnTimer_set.integer) % cg_spawnTimer_period.integer, s); } // end spawntimer w = CG_Text_Width_Ext(s, 0.19f, 0, &cgs.media.limboFont1); w2 = (UPPERRIGHT_W > w) ? UPPERRIGHT_W : w; x = Ccg_WideX(UPPERRIGHT_X) - w2 - 2; CG_FillRect(x, y, w2 + 5, 12 + 2, HUD_Background); CG_DrawRect_FixedBorder(x, y, w2 + 5, 12 + 2, 1, HUD_Border); CG_Text_Paint_Ext(x + ((w2 - w) / 2) + 2, y + 11, 0.19f, 0.19f, color, s, 0, 0, 0, &cgs.media.limboFont1); return y + 12 + 4;}
开发者ID:sxweet,项目名称:etlegacy,代码行数:65,
示例6: memsetconst char* CSyscall::CG_LocalizeServerCommand( const char *buf ) { static char token[MAX_TOKEN_CHARS]; char temp[MAX_TOKEN_CHARS]; qboolean togloc = qtrue; const char *s; int i, prev; memset( token, 0, sizeof( token ) ); s = buf; prev = 0; for ( i = 0; *s; i++, s++ ) { if (*s == '[' && (!strncmp(s, "[lon]", 5) || !strncmp(s, "[lof]", 5))) { if (togloc) { memset(temp, 0, sizeof(temp)); strncpy(temp, buf + prev, i - prev); strcat(token, CG_TranslateString(temp)); } else { strncat(token, buf + prev, i - prev); } if (s[3] == 'n') togloc = qtrue; else togloc = qfalse; i += 5; s += 5; prev = i; } } if (togloc) { memset(temp, 0, sizeof(temp)); strncpy(temp, buf + prev, i - prev); strcat(token, CG_TranslateString(temp)); } else { strncat(token, buf + prev, i - prev); } return token;}
开发者ID:rabb,项目名称:eth32nix-rabbmod,代码行数:46,
示例7: WM_DrawInfoLinestatic int WM_DrawInfoLine( int x, int y, float fade ) { int w, defender, winner; const char *s; if ( cg.snap->ps.pm_type != PM_INTERMISSION ) { return y; } w = 300; CG_DrawPic( 320 - w / 2, y, w, INFO_LINE_HEIGHT, trap_R_RegisterShaderNoMip( "ui_mp/assets/mp_line_strip.tga" ) ); s = CG_ConfigString( CS_MULTI_INFO ); defender = atoi( Info_ValueForKey( s, "defender" ) ); s = CG_ConfigString( CS_MULTI_MAPWINNER ); winner = atoi( Info_ValueForKey( s, "winner" ) ); if ( cgs.currentRound ) { // first round s = va( CG_TranslateString( "Clock is now set to %s!" ), WM_TimeToString( cgs.nextTimeLimit * 60.f * 1000.f ) ); } else { // second round if ( !defender ) { if ( winner != defender ) { s = "Allies sucessfully beat the clock!"; } else { s = "Allies couldn't beat the clock!"; } } else { if ( winner != defender ) { s = "Axis sucessfully beat the clock!"; } else { s = "Axis couldn't beat the clock!"; } } s = CG_TranslateString( s ); } w = CG_DrawStrlen( s ) * SMALLCHAR_WIDTH; CG_DrawSmallString( 320 - w / 2, ( y + INFO_LINE_HEIGHT / 2 ) - SMALLCHAR_HEIGHT / 2, s, fade ); return y + INFO_LINE_HEIGHT + 10;}
开发者ID:chegestar,项目名称:omni-bot,代码行数:44,
示例8: SCR_DrawChallengers/** SCR_DrawChallengers*/static int SCR_DrawChallengers( const char **ptrptr, int x, int y, int panelWidth, struct qfontface_s *font, int pass ){ const char *token; char string[MAX_STRING_CHARS]; int yoffset = 0, xoffset = 0; int playerNum, ping; int height; assert( ptrptr && *ptrptr ); height = trap_SCR_FontHeight( font ); // draw title yoffset = height; if( pass ) { trap_SCR_DrawString( x + xoffset, y + yoffset, ALIGN_CENTER_TOP, CG_TranslateString( "Challengers" ), font, colorCyan ); } yoffset += height; // draw challengers while( *ptrptr ) { if( !SCR_ParseToken( ptrptr, &token ) ) break; // first token is played id playerNum = atoi( token ); if( playerNum < 0 || playerNum >= gs.maxclients ) break; // get a second token if( !SCR_ParseToken( ptrptr, &token ) ) break; // second token is ping ping = atoi( token ); // draw the challenger if( ping < 0 ) Q_snprintfz( string, sizeof( string ), "%s%s ...", cgs.clientInfo[playerNum].name, S_COLOR_WHITE ); else Q_snprintfz( string, sizeof( string ), "%s%s %i", cgs.clientInfo[playerNum].name, S_COLOR_WHITE, ping ); if( pass ) { trap_SCR_DrawString( x + xoffset, y + yoffset, ALIGN_CENTER_TOP, string, font, colorWhite ); } yoffset += height; } yoffset += height; return yoffset;}
开发者ID:DenMSC,项目名称:racemod_2.1,代码行数:56,
示例9: CG_GetBoundKeysStringvoid CG_GetBoundKeysString( const char *cmd, char *keys, size_t keysSize ){ int key; const char *bind; int numKeys = 0; const char *keyNames[2]; char charKeys[2][2]; memset( charKeys, 0, sizeof( charKeys ) ); for( key = 0; key < 256; key++ ) { bind = trap_Key_GetBindingBuf( key ); if( !bind || Q_stricmp( bind, cmd ) ) continue; if( ( key >= 'a' ) && ( key <= 'z' ) ) { charKeys[numKeys][0] = key - ( 'a' - 'A' ); keyNames[numKeys] = charKeys[numKeys]; } else { keyNames[numKeys] = trap_Key_KeynumToString( key ); } numKeys++; if( numKeys == 2 ) break; } if( !numKeys ) keyNames[0] = CG_TranslateString( "UNBOUND" ); if( numKeys == 2 ) Q_snprintfz( keys, keysSize, CG_TranslateString( "%s or %s" ), keyNames[0], keyNames[1] ); else Q_strncpyz( keys, keyNames[0], keysSize );}
开发者ID:MGXRace,项目名称:racesow,代码行数:39,
示例10: CG_DrawDemoControlsvoid CG_DrawDemoControls(int x, int y, int w, vec4_t borderColor, vec4_t bgColor, int tSpacing, vec4_t bgColorTitle, vec4_t borderColorTitle, float hScale, float hScaleY, vec4_t hdrColor, int hStyle, fontHelper_t *hFont){ static panel_button_text_t demoControlTxt; int i; demoControlTxt.scalex = hScale; demoControlTxt.scaley = hScaleY; Vector4Copy(hdrColor, demoControlTxt.colour); demoControlTxt.style = ITEM_ALIGN_CENTER; demoControlTxt.align = 0; demoControlTxt.font = hFont; CG_FillRect(x, y, w, 50, bgColor); CG_DrawRect(x, y, w, 50, 1, borderColor); y += 1; // Header CG_FillRect(x + 1, y, w - 2, tSpacing + 4, bgColorTitle); CG_DrawRect(x + 1, y, w - 2, tSpacing + 4, 1, borderColorTitle); CG_Text_Paint_Ext(x + 4, y + tSpacing, hScale, hScaleY, hdrColor, CG_TranslateString("DEMO STATUS"), 0.0f, 0, hStyle, hFont); for (i = 0; i < 4; i++) { if (i) { RectangleSet(demoControlButtons[i]->rect, (x + (i * (w / 4)) - 15), y + 30, 30, 15); } else { RectangleSet(demoControlButtons[i]->rect, x + 2, y + 15, w - 4, 12); } demoControlButtons[i]->font = &demoControlTxt; } BG_PanelButtonsRender(demoControlButtons); if (cg.time < cgs.cursorUpdate) { // render cursor trap_R_SetColor(NULL); CG_DrawPic(cgDC.cursorx, cgDC.cursory, 32, 32, cgs.media.cursorIcon); }}
开发者ID:belstgut,项目名称:etlegacy,代码行数:44,
示例11: CG_VoiceChat_fstatic void CG_VoiceChat_f( void ) { char chatCmd[64]; if ( trap_Argc() != 2 ) return; // NERVE - SMF - don't let spectators voice chat // NOTE - This cg.snap will be the person you are following, but its just for intermission test if ( cg.snap && ( cg.snap->ps.pm_type != PM_INTERMISSION ) ) { if ( cgs.clientinfo[cg.clientNum].team == TEAM_SPECTATOR || cgs.clientinfo[cg.clientNum].team == TEAM_FREE ) { CG_Printf ( CG_TranslateString( "Can't voice chat as a spectator./n" ) ); return; } } trap_Argv( 1, chatCmd, 64 ); trap_SendConsoleCommand( va( "cmd vsay %s/n", chatCmd ) );}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:19,
示例12: switchconst char *CG_LoadPanel_GameTypeName(gametype_t gt){ switch (gt) { case GT_SINGLE_PLAYER: return CG_TranslateString("Single Player"); case GT_COOP: return CG_TranslateString("Co-op"); case GT_WOLF: return CG_TranslateString("Objective"); case GT_WOLF_STOPWATCH: return CG_TranslateString("Stopwatch"); case GT_WOLF_CAMPAIGN: return CG_TranslateString("Campaign"); case GT_WOLF_LMS: return CG_TranslateString("Last Man Standing"); case GT_WOLF_MAPVOTE: return CG_TranslateString("Map Voting"); default: break; } return "Invalid";}
开发者ID:rafal1137,项目名称:etlegacy,代码行数:24,
示例13: CG_Class_f/** * @brief Sends an class setup message. Enables etpro like classscripts */void CG_Class_f(void){ char cls[64]; const char *classtype, *teamstring; int weapon1, weapon2, playerclass; bg_playerclass_t *classinfo; team_t team; if (cg.demoPlayback) { return; } team = cgs.clientinfo[cg.clientNum].team; if (team == TEAM_SPECTATOR) { return; } if (trap_Argc() < 2) { CG_Printf("Invalid command format./n"); return; } switch (team) { case TEAM_AXIS: classtype = "r"; teamstring = CG_TranslateString("Axis"); break; case TEAM_ALLIES: classtype = "b"; teamstring = CG_TranslateString("Allies"); break; default: CG_Printf("Invalid team./n"); return; } trap_Argv(1, cls, 64); if (!Q_stricmp(cls, "s") || !Q_stricmp(cls, "0")) { playerclass = PC_SOLDIER; } else if (!Q_stricmp(cls, "m") || !Q_stricmp(cls, "1")) { playerclass = PC_MEDIC; } else if (!Q_stricmp(cls, "e") || !Q_stricmp(cls, "2")) { playerclass = PC_ENGINEER; } else if (!Q_stricmp(cls, "f") || !Q_stricmp(cls, "3")) { playerclass = PC_FIELDOPS; } else if (!Q_stricmp(cls, "c") || !Q_stricmp(cls, "4")) { playerclass = PC_COVERTOPS; } else { CG_Printf("Invalid class format./n"); return; } classinfo = BG_GetPlayerClassInfo(team, playerclass); if (trap_Argc() > 2) { trap_Argv(2, cls, 64); weapon1 = atoi(cls); if (weapon1 <= 0 || weapon1 > MAX_WEAPS_PER_CLASS) { weapon1 = classinfo->classWeapons[0]; } else if (!classinfo->classWeapons[weapon1 - 1]) { CG_Printf("Invalid command format for weapon./n"); return; } else { weapon1 = classinfo->classWeapons[weapon1 - 1]; } } else { weapon1 = classinfo->classWeapons[0]; } if (trap_Argc() > 3) { trap_Argv(3, cls, 64);//.........这里部分代码省略.........
开发者ID:Classixz,项目名称:etlegacy,代码行数:101,
示例14: switchconst char *CG_GetPMItemText(centity_t *cent){ switch (cent->currentState.effect1Time) { case PM_DYNAMITE: switch (cent->currentState.effect2Time) { case 0: return va(CG_TranslateString("Planted at %s."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time)); case 1: return va(CG_TranslateString("Defused at %s."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time)); } break; case PM_CONSTRUCTION: switch (cent->currentState.effect2Time) { case -1: return CG_ConfigString(CS_STRINGS + cent->currentState.effect3Time); case 0: return va(CG_TranslateString("%s has been constructed."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time)); } break; case PM_DESTRUCTION: switch (cent->currentState.effect2Time) { case 0: return va(CG_TranslateString("%s has been damaged."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time)); case 1: return va(CG_TranslateString("%s has been destroyed."), CG_ConfigString(CS_OID_TRIGGERS + cent->currentState.effect3Time)); } break; case PM_MINES: // Prevent spectators from being informed when a mine is spotted if (cgs.clientinfo[cg.clientNum].team == TEAM_SPECTATOR) { return NULL; } if (cgs.clientinfo[cg.clientNum].team == cent->currentState.effect2Time) { return NULL; } if (cg_locations.integer & LOC_LANDMINES) { char *locStr = CG_BuildLocationString(-1, cent->currentState.origin, LOC_LANDMINES); if (!locStr || !*locStr) { return va("%sSpotted by ^7%s", TXTCOLOR_OBJ, cgs.clientinfo[cent->currentState.effect3Time].name); } return va(CG_TranslateString("%sSpotted by ^7%s%s at %s"), TXTCOLOR_OBJ, cgs.clientinfo[cent->currentState.effect3Time].name, TXTCOLOR_OBJ, locStr); } else { return va(CG_TranslateString("%sSpotted by ^7%s"), TXTCOLOR_OBJ, cgs.clientinfo[cent->currentState.effect3Time].name); } break; case PM_OBJECTIVE: switch (cent->currentState.density) { case 0: return va(CG_TranslateString("%s have stolen %s!"), cent->currentState.effect2Time == TEAM_ALLIES ? CG_TranslateString("Allies") : CG_TranslateString("Axis"), CG_ConfigString(CS_STRINGS + cent->currentState.effect3Time)); case 1: return va(CG_TranslateString("%s have returned %s!"), cent->currentState.effect2Time == TEAM_ALLIES ? CG_TranslateString("Allies") : CG_TranslateString("Axis"), CG_ConfigString(CS_STRINGS + cent->currentState.effect3Time)); } break; case PM_TEAM: switch (cent->currentState.density) { case 0: // joined { const char *teamstr = NULL; switch (cent->currentState.effect2Time) { case TEAM_AXIS: teamstr = "Axis team"; break; case TEAM_ALLIES: teamstr = "Allied team"; break; default: teamstr = "Spectators"; break; } return va(CG_TranslateString("%s^7 has joined the %s^7!"), cgs.clientinfo[cent->currentState.effect3Time].name, CG_TranslateString(teamstr)); } case 1: return va(CG_TranslateString("%s^7 disconnected"), cgs.clientinfo[cent->currentState.effect3Time].name); } } return NULL;}
开发者ID:MartijnB,项目名称:ETGoldy,代码行数:95,
示例15: WM_TeamScoreboardstatic int WM_TeamScoreboard( int x, int y, team_t team, float fade, int maxrows ) { vec4_t hcolor; float tempx, tempy; int height, width; int i; int count = 0; vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f }; height = SMALLCHAR_HEIGHT * maxrows; width = INFO_PLAYER_WIDTH + INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH; CG_FillRect( x-5, y-2, width+5, 21, clrUiBack ); CG_FillRect( x-5, y-2, width+5, 21, clrUiBar ); Vector4Set( hcolor, 0, 0, 0, fade ); CG_DrawRect_FixedBorder( x-5, y-2, width+5, 21, 1, colorBlack ); // draw header if( cg_gameType.integer == GT_WOLF_LMS ) { char *s; if ( team == TEAM_AXIS ) { s = va( "%s [%d] (%d %s)", CG_TranslateString( "AXIS" ), cg.teamScores[0], cg.teamPlayers[team], CG_TranslateString("PLAYERS") ); s = va( "%s ^3%s", s, cg.teamFirstBlood == TEAM_AXIS ? CG_TranslateString("FIRST BLOOD") : "" ); CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } else if ( team == TEAM_ALLIES ) { s = va( "%s [%d] (%d %s)", CG_TranslateString( "ALLIES" ), cg.teamScores[1], cg.teamPlayers[team], CG_TranslateString("PLAYERS") ); s = va( "%s ^3%s", s, cg.teamFirstBlood == TEAM_ALLIES ? CG_TranslateString("FIRST BLOOD") : "" ); CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } } else { if ( team == TEAM_AXIS ) { CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, va( "%s [%d] (%d %s)", CG_TranslateString( "AXIS" ), cg.teamScores[0], cg.teamPlayers[team], CG_TranslateString("PLAYERS") ), 0, 0, 0, &cgs.media.limboFont1 ); } else if ( team == TEAM_ALLIES ) { CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, va( "%s [%d] (%d %s)", CG_TranslateString( "ALLIES" ), cg.teamScores[1], cg.teamPlayers[team], CG_TranslateString("PLAYERS") ), 0, 0, 0, &cgs.media.limboFont1 ); } } y += SMALLCHAR_HEIGHT + 3; // save off y val tempy = y; // draw color bands for ( i = 0; i <= maxrows; i++ ) { if ( i % 2 == 0 ) VectorSet( hcolor, (80.f/255.f), (80.f/255.f), (80.f/255.f) ); // LIGHT BLUE else VectorSet( hcolor, (0.f/255.f), (0.f/255.f), (0.f/255.f) ); // DARK BLUE hcolor[3] = fade * 0.3; CG_FillRect( x-5, y, width+5, SMALLCHAR_HEIGHT+1, hcolor ); trap_R_SetColor( colorBlack ); CG_DrawTopBottom( x-5, y, width+5, SMALLCHAR_HEIGHT+1, 1 ); trap_R_SetColor( NULL ); y += SMALLCHAR_HEIGHT; } hcolor[3] = 1; y = tempy; tempx = x; CG_FillRect( x-5, y-1, width+5, 18, clrUiBack ); //CG_FillRect( x-5, y-1, width+5, 18, clrUiBar ); trap_R_SetColor( colorBlack ); CG_DrawTopBottom( x-5, y-1, width+5, 18, 1 ); trap_R_SetColor( NULL ); // draw player info headings CG_DrawSmallString( tempx, y, CG_TranslateString( "Name" ), fade ); tempx += INFO_PLAYER_WIDTH; CG_DrawSmallString( tempx, y, CG_TranslateString( "Class" ), fade ); tempx += INFO_CLASS_WIDTH; if( cgs.gametype == GT_WOLF_LMS ) { CG_DrawSmallString( tempx, y, CG_TranslateString( "Score" ), fade ); tempx += INFO_SCORE_WIDTH; } else { CG_DrawSmallString( tempx + 1 * SMALLCHAR_WIDTH, y, CG_TranslateString( "XP" ), fade ); tempx += INFO_XP_WIDTH; } CG_DrawSmallString( tempx, y, CG_TranslateString( "Ping" ), fade ); tempx += INFO_LATENCY_WIDTH; if( cgs.gametype != GT_WOLF_LMS ) { CG_DrawPicST( tempx + 2, y, INFO_LIVES_WIDTH - 4, 16, 0.f, 0.f, 0.5f, 1.f, team == TEAM_ALLIES ? cgs.media.hudAlliedHelmet : cgs.media.hudAxisHelmet ); tempx += INFO_LIVES_WIDTH; } y += SMALLCHAR_HEIGHT; // draw player info VectorSet( hcolor, 1, 1, 1 ); hcolor[3] = fade;//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:101,
示例16: SCR_DrawTeamTab/** SCR_DrawTeamTab*/static int SCR_DrawTeamTab( const char **ptrptr, int *curteam, int x, int y, int panelWidth, struct qfontface_s *font, struct qfontface_s *titleFont, int pass ){ const char *token; const char *layout, *titles; char type; int team, team_score, team_ping; int yoffset = 0, xoffset = 0; int dir = 0, align, width, height; vec4_t teamcolor = { 0.0f, 0.0f, 0.0f, 1.0f }, pingcolor; // team tab is always the same. Sets the current team and draws its score if( !(*ptrptr) || !(*ptrptr[0]) || *ptrptr[0] == '&' ) return yoffset; team = CG_ParseValue( ptrptr ); if( team < TEAM_PLAYERS || team > TEAM_BETA ) CG_Error( "SCR_ParseTeamTab: Invalid team value/n" ); *curteam = team; if( *ptrptr[0] == '&' ) return yoffset; team_score = CG_ParseValue( ptrptr ); if( *ptrptr[0] == '&' ) return yoffset; team_ping = CG_ParseValue( ptrptr ); if( ( team == TEAM_ALPHA ) || ( team == TEAM_BETA ) ) CG_TeamColor( team, teamcolor ); teamcolor[3] = SCB_BACKGROUND_ALPHA; // make transparent if( GS_TeamBasedGametype() ) // we only draw the team tabs in team based gametypes { dir = ( team == TEAM_ALPHA ) ? -1 : 1; align = ( team == TEAM_ALPHA ) ? ALIGN_RIGHT_TOP : ALIGN_LEFT_TOP; // draw the tab xoffset = ( SCB_CENTERMARGIN * dir ); width = ( cgs.vidWidth * 0.5 ) - SCB_CENTERMARGIN; height = trap_SCR_FontHeight( titleFont ) + 2; if( !pass ) { CG_DrawAlignPic( x + xoffset, y + yoffset + SCB_SCORENUMBER_SIZE - height, width, height, align, teamcolor, cgs.shaderWhite ); } if( pass ) { xoffset += ( ( 16 * cgs.vidHeight / 600 ) * dir ); CG_DrawHUDNumeric( x + xoffset, y + yoffset, align, colorWhite, SCB_SCORENUMBER_SIZE, SCB_SCORENUMBER_SIZE, team_score ); xoffset += ( ( SCB_SCORENUMBER_SIZE * strlen(va("%i", team_score)) + ( 16 * cgs.vidHeight / 600 ) ) * dir ); trap_SCR_DrawStringWidth( x + xoffset + ( ( SCB_TINYFIELD_PIXELWIDTH + ( 16 * cgs.vidHeight / 600 ) ) * dir ), y + yoffset + SCB_SCORENUMBER_SIZE - (trap_SCR_FontHeight( titleFont ) + 1), align, GS_TeamName( team ), SCB_TEAMNAME_PIXELWIDTH, titleFont, colorWhite ); CG_PingColor( team_ping, pingcolor ); trap_SCR_DrawStringWidth( x + xoffset, y + yoffset + SCB_SCORENUMBER_SIZE - (trap_SCR_FontHeight( font ) + 1), align, va( "%i", team_ping ), SCB_TINYFIELD_PIXELWIDTH, font, pingcolor ); } yoffset += SCB_SCORENUMBER_SIZE; } else { dir = 0; align = ALIGN_CENTER_TOP; } // draw the player tab column titles layout = cgs.configStrings[CS_SCB_PLAYERTAB_LAYOUT]; titles = cgs.configStrings[CS_SCB_PLAYERTAB_TITLES]; height = trap_SCR_FontHeight( font ); // start from the center again xoffset = CG_HorizontalAlignForWidth( 0, align, panelWidth ); xoffset += ( SCB_CENTERMARGIN * dir ); while( ( token = SCR_GetNextColumnLayout( &layout, &titles, &type, &width, font ) ) != NULL ) { if( SCR_SkipColumn( type ) ) continue; if( width ) { if( pass ) { trap_SCR_DrawClampString( x + xoffset, y + yoffset, CG_TranslateString( token ), x + xoffset, y + yoffset, x + xoffset + width, y + yoffset + height, font, colorWhite );//.........这里部分代码省略.........
开发者ID:DenMSC,项目名称:racemod_2.1,代码行数:101,
示例17: WM_DrawClientScore//.........这里部分代码省略......... CG_FillRect( tempx, y + 1, INFO_SCORE_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_SCORE_WIDTH; } else { CG_FillRect( tempx, y + 1, INFO_XP_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_XP_WIDTH; } CG_FillRect( tempx, y + 1, INFO_LATENCY_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_LATENCY_WIDTH; if( cg_gameType.integer != GT_WOLF_LMS ) { CG_FillRect( tempx, y + 1, INFO_LIVES_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_LIVES_WIDTH; } } } tempx = x; // DHM - Nerve VectorSet( hcolor, 1, 1, 1 ); hcolor[3] = fade; maxchars = 16; offset = 0; if ( ci->team != TEAM_SPECTATOR ) { if ( ci->powerups & ( (1 << PW_REDFLAG) | (1 << PW_BLUEFLAG) ) ) { CG_DrawPic( tempx-4, y, 16, 16, cgs.media.objectiveShader ); offset += 8; tempx += 12; maxchars -= 2; } // draw the skull icon if out of lives if( score->respawnsLeft == -2 || (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == -1 ) ) { CG_DrawPic( tempx, y, 18, 18, cgs.media.scoreEliminatedShader ); offset += 18; tempx += 18; maxchars -= 2; } else if( cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == 0 ) { CG_DrawPic( tempx + 1, y + 1, 16, 16, cgs.media.medicIcon ); offset += 18; tempx += 18; maxchars -= 2; } } // draw name CG_DrawStringExt( tempx, y, ci->name, hcolor, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, maxchars ); maxchars -= CG_DrawStrlen( ci->name ); // draw medals buf[0] = '/0'; for( i = 0; i < SK_NUM_SKILLS; i++ ) { for( j = 0; j < ci->medals[i]; j++ ) Q_strcat( buf, sizeof(buf), va( "^%c%c", COLOR_RED + i, skillNames[i][0] ) ); } maxchars--; CG_DrawStringExt( tempx + (BG_drawStrlen(ci->name) * SMALLCHAR_WIDTH + SMALLCHAR_WIDTH), y, buf, hcolor, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, maxchars ); tempx += INFO_PLAYER_WIDTH - offset; if ( ci->team == TEAM_SPECTATOR ) { const char *s; int w, totalwidth; totalwidth = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH - 8; s = CG_TranslateString( "^3SPECTATOR" ); w = CG_DrawStrlen( s ) * SMALLCHAR_WIDTH; CG_DrawSmallString( tempx + totalwidth - w, y, s, fade ); return; } // OSP - allow MV clients see the class of its merged client's on the scoreboard else if ( cg.snap->ps.persistant[PERS_TEAM] == ci->team || CG_mvMergedClientLocate(score->client) ) { CG_DrawSmallString( tempx, y, CG_TranslateString( BG_ShortClassnameForNumber( score->playerClass ) ), fade ); } tempx += INFO_CLASS_WIDTH; CG_DrawSmallString( tempx, y, va( "%3i", score->score ), fade ); if( cg_gameType.integer == GT_WOLF_LMS ) { tempx += INFO_SCORE_WIDTH; } else { tempx += INFO_XP_WIDTH; } CG_DrawSmallString( tempx, y, va( "%4i", score->ping ), fade ); tempx += INFO_LATENCY_WIDTH; if( cg_gameType.integer != GT_WOLF_LMS ) { if( score->respawnsLeft >= 0 ) { CG_DrawSmallString( tempx, y, va( "%2i", score->respawnsLeft ), fade ); } else { CG_DrawSmallString( tempx, y, va( " -", score->respawnsLeft ), fade ); } tempx += INFO_LIVES_WIDTH; }}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:101,
示例18: WM_DrawClientScore_Small//.........这里部分代码省略......... if(score->respawnsLeft == -2 || (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == -1)) { // CHRUKER: b078 - Medic, death and objective icons on the scoreboard are drawn too big CG_DrawPic( tempx - 1, y + 1, 10, 10, cgs.media.scoreEliminatedShader ); offset += 10; tempx += 10; maxchars -= 2; } else if(cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == 0) { // CHRUKER: b078 - Medic, death and objective icons on the scoreboard are drawn too big CG_DrawPic( tempx - 1, y + 1, 10, 10, cgs.media.medicIcon ); offset += 10; tempx += 10; maxchars -= 2; } } // draw name CG_DrawStringExt(tempx, y, ci->name, hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, maxchars); // CHRUKER: b033 - Added to draw medals maxchars -= CG_DrawStrlen( ci->name ); buf[0] = '/0'; for( i = 0; i < SK_NUM_SKILLS; i++ ) { for( j = 0; j < ci->medals[i]; j++ ) { Q_strcat( buf, sizeof(buf), va( "^%c%c", COLOR_RED + i, skillNames[i][0] ) ); } } maxchars--; if (maxchars > 0) CG_DrawStringExt( tempx + (BG_drawStrlen(ci->name) * MINICHAR_WIDTH + MINICHAR_WIDTH), y, buf, hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, maxchars ); // b033 tempx += INFO_PLAYER_WIDTH - offset; // dhm - nerve if(ci->team == TEAM_SPECTATOR) { const char *s; int w, totalwidth; totalwidth = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH - 8; // CHRUKER: b031 - Show connecting people as connecting if (score->ping == -1) { s = CG_TranslateString( "^1CONNECTING" ); } else { s = CG_TranslateString( "^3SPECTATOR" ); } w = CG_DrawStrlen(s) * MINICHAR_WIDTH; // CHRUKER: b034 - Using the mini char height CG_DrawStringExt( tempx + totalwidth - w, y, s, hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0 ); return; } else if(cg.snap->ps.persistant[PERS_TEAM] == ci->team) { CG_DrawStringExt(tempx, y, CG_TranslateString(BG_ShortClassnameForNumber(score->playerClass)), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0);// CG_DrawSmallString( tempx, y, CG_TranslateString( s ), fade ); } tempx += INFO_CLASS_WIDTH; CG_DrawStringExt(tempx, y, va("%3i", score->score), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); if(cg_gameType.integer == GT_WOLF_LMS) { tempx += INFO_SCORE_WIDTH; } else { tempx += INFO_XP_WIDTH; } CG_DrawStringExt(tempx, y, va("%4i", score->ping), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); tempx += INFO_LATENCY_WIDTH; if(cg_gameType.integer != GT_WOLF_LMS) { if(score->respawnsLeft >= 0) { CG_DrawStringExt(tempx, y, va("%2i", score->respawnsLeft), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); } else { CG_DrawStringExt(tempx, y, " -", hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); } tempx += INFO_LIVES_WIDTH; }}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:101,
示例19: WM_DrawClientScore//.........这里部分代码省略......... // draw the skull icon if out of lives if(score->respawnsLeft == -2 || (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == -1)) { // CHRUKER: b078 - Medic, death and objective icons on the scoreboard are drawn too big CG_DrawPic( tempx - 3, y + 1, 14, 14, cgs.media.scoreEliminatedShader ); offset += 14; tempx += 14; maxchars -= 2; } else if(cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == 0) { // CHRUKER: b078 - Medic, death and objective icons on the scoreboard are drawn too big CG_DrawPic( tempx - 3, y + 1, 14, 14, cgs.media.medicIcon ); offset += 14; tempx += 14; maxchars -= 2; } } // draw name CG_DrawStringExt(tempx, y, ci->name, hcolor, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, maxchars); maxchars -= CG_DrawStrlen(ci->name); // draw medals buf[0] = '/0'; for(i = 0; i < SK_NUM_SKILLS; i++) { for(j = 0; j < ci->medals[i]; j++) Q_strcat(buf, sizeof(buf), va("^%c%c", COLOR_RED + i, skillNames[i][0])); } maxchars--; // CHRUKER: b032 - Medals clipped wrong in scoreboard when you're dead, because CG_DrawStringExt will draw // everything if maxchars <= 0 if (maxchars > 0) { CG_DrawStringExt(tempx + (BG_drawStrlen(ci->name) * SMALLCHAR_WIDTH + SMALLCHAR_WIDTH), y, buf, hcolor, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, maxchars); } tempx += INFO_PLAYER_WIDTH - offset; if(ci->team == TEAM_SPECTATOR) { const char *s; int w, totalwidth; totalwidth = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH - 8; // CHRUKER: b031 - Show connecting people as connecting if (score->ping == -1) { s = CG_TranslateString( "^1CONNECTING" ); } else { s = CG_TranslateString( "^3SPECTATOR" ); } w = CG_DrawStrlen(s) * SMALLCHAR_WIDTH; CG_DrawSmallString(tempx + totalwidth - w, y, s, fade); return; } // OSP - allow MV clients see the class of its merged client's on the scoreboard else if(cg.snap->ps.persistant[PERS_TEAM] == ci->team || CG_mvMergedClientLocate(score->client)) { CG_DrawSmallString(tempx, y, CG_TranslateString(BG_ShortClassnameForNumber(score->playerClass)), fade); } tempx += INFO_CLASS_WIDTH; CG_DrawSmallString(tempx, y, va("%3i", score->score), fade); if(cg_gameType.integer == GT_WOLF_LMS) { tempx += INFO_SCORE_WIDTH; } else { tempx += INFO_XP_WIDTH; } CG_DrawSmallString(tempx, y, va("%4i", score->ping), fade); tempx += INFO_LATENCY_WIDTH; if(cg_gameType.integer != GT_WOLF_LMS) { if(score->respawnsLeft >= 0) { CG_DrawSmallString(tempx, y, va("%2i", score->respawnsLeft), fade); } else { CG_DrawSmallString(tempx, y, " -", fade); } tempx += INFO_LIVES_WIDTH; }}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:101,
示例20: CG_Fireteams_MenuText_Drawvoid CG_Fireteams_MenuText_Draw(panel_button_t *button){ float y = button->rect.y; int i; switch (cgs.ftMenuMode) { case 0: if (cgs.ftMenuPos == -1) { for (i = 0; ftMenuRootStrings[i]; i++) { const char *str; if (i < 5) { if (!CG_FireteamHasClass(i, qtrue)) { continue; } } if (cg_quickMessageAlt.integer) { str = va("%i. %s", (i + 1) % 10, CG_TranslateString(ftMenuRootStrings[i])); } else { str = va("%s. %s", ftMenuRootStringsAlphachars[i], CG_TranslateString(ftMenuRootStrings[i])); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } } else { if (cgs.ftMenuPos < 0 || cgs.ftMenuPos > 4) { return; } else { const char **strings = ftMenuStrings[cgs.ftMenuPos]; for (i = 0; strings[i]; i++) { const char *str; if (cg_quickMessageAlt.integer) { str = va("%i. %s", (i + 1) % 10, strings[i]); } else { str = va("%s. %s", (ftMenuStringsAlphachars[cgs.ftMenuPos])[i], strings[i]); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } } } break; case 1: if (!CG_IsOnFireteam(cg.clientNum)) { for (i = 0; ftOffMenuList[i]; i++) { const char *str; if (i == 0 && !CG_CountFireteamsByTeam(cgs.clientinfo[cg.clientNum].team)) { continue; } if (cg_quickMessageAlt.integer) { str = va("%i. %s", (i + 1) % 10, CG_TranslateString(ftOffMenuList[i])); } else { str = va("%s. %s", ftOffMenuListAlphachars[i], CG_TranslateString(ftOffMenuList[i])); } CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0, 0, button->font->style, button->font->font); y += button->rect.h; } } else { if (!CG_IsFireTeamLeader(cg.clientNum)) { for (i = 0; ftOnMenuList[i]; i++) { const char *str;//.........这里部分代码省略.........
开发者ID:ensiform,项目名称:etlegacy,代码行数:101,
示例21: WM_TeamScoreboard// CHRUKER: b035 - Added absolute maximum rowsstatic int WM_TeamScoreboard(int x, int y, team_t team, float fade, int maxrows, int absmaxrows){ vec4_t hcolor; float tempx, tempy; int height, width; int i; int count = 0; qboolean use_mini_chars = qfalse; // CHRUKER: b035 - Needed to check if using mini chars vec4_t tclr = { 0.6f, 0.6f, 0.6f, 1.0f }; height = SMALLCHAR_HEIGHT * maxrows; width = INFO_PLAYER_WIDTH + INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH; CG_FillRect(x - 5, y - 2, width + 5, 21, clrUiBack); CG_FillRect(x - 5, y - 2, width + 5, 21, clrUiBar); Vector4Set(hcolor, 0, 0, 0, fade); CG_DrawRect_FixedBorder(x - 5, y - 2, width + 5, 21, 1, colorBlack); // draw header if(cg_gameType.integer == GT_WOLF_LMS) { char *s; if(team == TEAM_AXIS) { s = va("%s [%d] (%d %s)", CG_TranslateString("AXIS"), cg.teamScores[0], cg.teamPlayers[team], CG_TranslateString("PLAYERS")); s = va("%s ^3%s", s, cg.teamFirstBlood == TEAM_AXIS ? CG_TranslateString("FIRST BLOOD") : ""); CG_Text_Paint_Ext(x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1); } else if(team == TEAM_ALLIES) { s = va("%s [%d] (%d %s)", CG_TranslateString("ALLIES"), cg.teamScores[1], cg.teamPlayers[team], CG_TranslateString("PLAYERS")); s = va("%s ^3%s", s, cg.teamFirstBlood == TEAM_ALLIES ? CG_TranslateString("FIRST BLOOD") : ""); CG_Text_Paint_Ext(x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1); } } else { if(team == TEAM_AXIS) { CG_Text_Paint_Ext(x, y + 13, 0.25f, 0.25f, tclr, va("%s [%d] (%d %s)", CG_TranslateString("AXIS"), cg.teamScores[0], cg.teamPlayers[team], CG_TranslateString("PLAYERS")), 0, 0, 0, &cgs.media.limboFont1); } else if(team == TEAM_ALLIES) { CG_Text_Paint_Ext(x, y + 13, 0.25f, 0.25f, tclr, va("%s [%d] (%d %s)", CG_TranslateString("ALLIES"), cg.teamScores[1], cg.teamPlayers[team], CG_TranslateString("PLAYERS")), 0, 0, 0, &cgs.media.limboFont1); } } y += SMALLCHAR_HEIGHT + 3; tempx = x; // CHRUKER: b076 - Adjusted y coordinate, and changed to use DrawBottom instead of DrawTopBottom CG_FillRect(x - 5, y, width + 5, 18, clrUiBack); trap_R_SetColor(colorBlack); CG_DrawBottom_NoScale(x - 5, y, width + 5, 18, 1); trap_R_SetColor(NULL); // draw player info headings CG_DrawSmallString(tempx, y, CG_TranslateString("Name"), fade); tempx += INFO_PLAYER_WIDTH; CG_DrawSmallString(tempx, y, CG_TranslateString("Class"), fade); tempx += INFO_CLASS_WIDTH; if(cgs.gametype == GT_WOLF_LMS) { CG_DrawSmallString(tempx, y, CG_TranslateString("Score"), fade); tempx += INFO_SCORE_WIDTH; } else { CG_DrawSmallString(tempx + 1 * SMALLCHAR_WIDTH, y, CG_TranslateString("XP"), fade); tempx += INFO_XP_WIDTH; } CG_DrawSmallString(tempx, y, CG_TranslateString("Ping"), fade); tempx += INFO_LATENCY_WIDTH; if(cgs.gametype != GT_WOLF_LMS) { CG_DrawPicST(tempx + 2, y, INFO_LIVES_WIDTH - 4, 16, 0.f, 0.f, 0.5f, 1.f, team == TEAM_ALLIES ? cgs.media.hudAlliedHelmet : cgs.media.hudAxisHelmet); tempx += INFO_LIVES_WIDTH; } // CHRUKER: b076 - The math says char height + 2 * border width (1 pixel) y += SMALLCHAR_HEIGHT + 2; cg.teamPlayers[team] = 0; // JPW NERVE//.........这里部分代码省略.........
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:101,
示例22: CG_Fireteams_MenuTitleText_Drawvoid CG_Fireteams_MenuTitleText_Draw(panel_button_t *button){ switch (cgs.ftMenuMode) { case 0: CG_Text_Paint_Ext(button->rect.x, button->rect.y + button->data[0], button->font->scalex, button->font->scaley, button->font->colour, CG_TranslateString("MESSAGE"), 0, 0, button->font->style, button->font->font); break; case 1: CG_Text_Paint_Ext(button->rect.x, button->rect.y + button->data[0], button->font->scalex, button->font->scaley, button->font->colour, CG_TranslateString("FIRETEAMS"), 0, 0, button->font->style, button->font->font); break; case 2: CG_Text_Paint_Ext(button->rect.x, button->rect.y + button->data[0], button->font->scalex, button->font->scaley, button->font->colour, CG_TranslateString("JOIN"), 0, 0, button->font->style, button->font->font); break; case 3: CG_Text_Paint_Ext(button->rect.x, button->rect.y + button->data[0], button->font->scalex, button->font->scaley, button->font->colour, CG_TranslateString("PROPOSE"), 0, 0, button->font->style, button->font->font); break; case 4: switch (cgs.ftMenuPos) { case 2: CG_Text_Paint_Ext(button->rect.x, button->rect.y + button->data[0], button->font->scalex, button->font->scaley, button->font->colour, CG_TranslateString("INVITE"), 0, 0, button->font->style, button->font->font); break; case 3: CG_Text_Paint_Ext(button->rect.x, button->rect.y + button->data[0], button->font->scalex, button->font->scaley, button->font->colour, CG_TranslateString("KICK"), 0, 0, button->font->style, button->font->font); break; case 4: CG_Text_Paint_Ext(button->rect.x, button->rect.y + button->data[0], button->font->scalex, button->font->scaley, button->font->colour, CG_TranslateString("WARN"), 0, 0, button->font->style, button->font->font); break; case 6: CG_Text_Paint_Ext(button->rect.x, button->rect.y + button->data[0], button->font->scalex, button->font->scaley, button->font->colour, CG_TranslateString("SET ADMIN"), 0, 0, button->font->style, button->font->font); break; } break; default: CG_Printf("WARNING CG_Fireteams_MenuTitleText_Draw: Unknown ftMenuMode"); break; }}
开发者ID:ensiform,项目名称:etlegacy,代码行数:38,
示例23: CG_DrawFireTeamOverlay//.........这里部分代码省略......... { bestLocWidth = locwidth; } h += 12.f; } boxWidth += bestLocWidth + bestNameWidth; if (cg_fireteamLatchedClass.integer) { boxWidth += 28; } if ((Ccg_WideX(640) - MIN_BORDER_DISTANCE) < (x + boxWidth)) { x = x - ((x + boxWidth) - Ccg_WideX(640)) - MIN_BORDER_DISTANCE; } else if (x < MIN_BORDER_DISTANCE) { x = MIN_BORDER_DISTANCE; } CG_FillRect(x, y, boxWidth, h, FT_bg2); CG_DrawRect(x, y, boxWidth, h, 1, FT_border); x += 1; y += 1; CG_FillRect(x, y, boxWidth - 2, 12, FT_bg); if (f->priv) { Com_sprintf(buffer, 64, CG_TranslateString("Private Fireteam: %s"), bg_fireteamNames[f->ident]); } else { Com_sprintf(buffer, 64, CG_TranslateString("Fireteam: %s"), bg_fireteamNames[f->ident]); } Q_strupr(buffer); CG_Text_Paint_Ext(x + 4, y + FT_BAR_HEIGHT, .19f, .19f, FT_text, buffer, 0, 0, 0, FONT_HEADER); lineX = x; for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++) { x = lineX; y += FT_BAR_HEIGHT + FT_BAR_YSPACING; // grab a pointer to the current player ci = CG_SortedFireTeamPlayerForPosition(i); // make sure it's valid if (!ci) { break; } // hilight selected players if (ci->selected) { CG_FillRect(x, y + FT_BAR_YSPACING, boxWidth - 2, FT_BAR_HEIGHT, FT_select); } else { CG_FillRect(x, y + FT_BAR_YSPACING, boxWidth - 2, FT_BAR_HEIGHT, FT_noselect); }
开发者ID:belstgut,项目名称:etlegacy,代码行数:67,
示例24: WM_DrawObjectives//.........这里部分代码省略......... }*/ } y += SMALLCHAR_HEIGHT * ( ( rows - 2 ) / 2 ); if ( flagshader ) { CG_DrawPic( 100, 10, 210, 136, trap_R_RegisterShaderNoMip( flagshader ) ); CG_DrawPic( 325, 10, 210, 136, trap_R_RegisterShaderNoMip( flagshader ) ); } if ( shader ) CG_DrawPic( 229, 10, 182, 136, trap_R_RegisterShaderNoMip( shader ) ); if ( nameshader ) { CG_DrawPic( 140, 50, 127, 64, trap_R_RegisterShaderNoMip( nameshader ) ); CG_DrawPic( 365, 50, 127, 64, trap_R_RegisterShaderNoMip( "ui/assets/portraits/text_win.tga" ) ); } return y; }// JPW NERVE -- mission time & reinforce time else { tempy = y; rows = 1; CG_FillRect( x-5, y-2, width+5, 21, clrUiBack ); CG_FillRect( x-5, y-2, width+5, 21, clrUiBar ); CG_DrawRect_FixedBorder( x-5, y-2, width+5, 21, 1, colorBlack ); y += SMALLCHAR_HEIGHT * ( rows - 1 ); if( cgs.timelimit > 0.0f ) { msec = ( cgs.timelimit * 60.f * 1000.f ) - ( cg.time - cgs.levelStartTime ); seconds = msec / 1000; mins = seconds / 60; seconds -= mins * 60; tens = seconds / 10; seconds -= tens * 10; } else { mins = tens = seconds = 0; } if( cgs.gamestate != GS_PLAYING ) { s = va("%s %s", CG_TranslateString("MISSION TIME:"), CG_TranslateString("WARMUP")); } else if ( msec < 0 && cgs.timelimit > 0.0f ) { if ( cgs.gamestate == GS_WAITING_FOR_PLAYERS ) s = va( "%s %s", CG_TranslateString( "MISSION TIME:" ), CG_TranslateString( "GAME STOPPED" ) ); else s = va( "%s %s", CG_TranslateString( "MISSION TIME:" ), CG_TranslateString( "SUDDEN DEATH" ) ); } else { s = va( "%s %2.0f:%i%i", CG_TranslateString( "MISSION TIME:" ), (float)mins, tens, seconds ); // float cast to line up with reinforce time } CG_Text_Paint_Ext( x, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); if( cgs.gametype != GT_WOLF_LMS ) { if(cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_AXIS || cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_ALLIES) { msec = CG_CalculateReinfTime( qfalse ) * 1000; } else // no team (spectator mode) msec = 0; if (msec) { seconds = msec / 1000; mins = seconds / 60; seconds -= mins * 60; tens = seconds / 10; seconds -= tens * 10; s = va( "%s %2.0f:%i%i", CG_TranslateString( "REINFORCE TIME:" ), (float)mins, tens, seconds ); CG_Text_Paint_Ext( 640 - 20 - CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ), y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } } // NERVE - SMF if ( cgs.gametype == GT_WOLF_STOPWATCH ) { int w; s = va( "%s %i", CG_TranslateString( "STOPWATCH ROUND" ), cgs.currentRound + 1 ); w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ); CG_Text_Paint_Ext( x + 300 - w*0.5f, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } else if( cgs.gametype == GT_WOLF_LMS ) { int w; s = va( "%s %i %s %i-%i", CG_TranslateString( "ROUND" ), cgs.currentRound + 1, CG_TranslateString( "SCORE" ), cg.teamWonRounds[1], cg.teamWonRounds[0] ); w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ); CG_Text_Paint_Ext( x + 300 - w*0.5f, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } else if( cgs.gametype == GT_WOLF_CAMPAIGN ) { int w; s = va( "MAP %i of %i", cgs.currentCampaignMap + 1, cgs.campaignData.mapCount ); w = CG_Text_Width_Ext( s, 0.25f, 0, &cgs.media.limboFont1 ); CG_Text_Paint_Ext( x + 300 - w*0.5f, y + 13, 0.25f, 0.25f, tclr, s, 0, 0, 0, &cgs.media.limboFont1 ); } y += SMALLCHAR_HEIGHT * 2; }// jpw return y;}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:101,
示例25: SCB_DrawPlayerStats/** SCB_DrawPlayerStats*/static int SCB_DrawPlayerStats( int x, int y, struct qfontface_s *font ){ int xoffset, yoffset, lines; int i, j, num_weapons, weap, xpos, width, done; gsitem_t *it; char string[MAX_STRING_CHARS]; vec4_t color = { 0.5, 0.5, 0.5, 0.5f }; // don't display stats if( !cg_scoreboardStats->integer ) return 0; // total number of weapon num_weapons = WEAP_TOTAL-WEAP_GUNBLADE; width = ( SCB_TINYFIELD_PIXELWIDTH + 2 * SCB_SMALLFIELD_PIXELWIDTH ) * 2 + SCB_SMALLFIELD_PIXELWIDTH; xpos = -width / 2; // Center the box xoffset = xpos; yoffset = trap_SCR_FontHeight( font ); // Room for header, it's actually written later if we have at least one stat yoffset += trap_SCR_FontHeight( font ); lines = 0; for( i = 0; i < num_weapons; ) { xoffset = xpos; // two weapons per line for( j = 0, done = 0; done < 2 && i + j < num_weapons; j++ ) { weap = WEAP_GUNBLADE + i + j; if( scb_player_stats[2*( i+j )] == -1 && scb_player_stats[2*( i+j )+1] == -1 ) continue; it = GS_FindItemByTag( weap ); // short name Q_snprintfz( string, sizeof( string ), "%s%2s", it->color, it->shortname ); trap_SCR_DrawStringWidth( x + xoffset, y + yoffset, ALIGN_LEFT_TOP, string, SCB_TINYFIELD_PIXELWIDTH, font, colorWhite ); Q_snprintfz( string, sizeof( string ), "%2d%c", scb_player_stats[2*( i+j )+1], '%' ); trap_SCR_DrawStringWidth( x + xoffset + 2 * SCB_TINYFIELD_PIXELWIDTH, y + yoffset, ALIGN_CENTER_TOP, string, 2*SCB_SMALLFIELD_PIXELWIDTH, font, colorWhite ); // separator xoffset = 0; done++; } // next line if( done > 0 ) { lines++; yoffset += trap_SCR_FontHeight( font ); } i += j; } if( lines ) { // if we drew anything, draw header and box too xoffset = xpos; yoffset = trap_SCR_FontHeight( font ); // header trap_SCR_DrawStringWidth( x + xoffset, y + yoffset, ALIGN_LEFT_TOP, CG_TranslateString( "Weapon stats" ), width, font, colorMdGrey ); yoffset += trap_SCR_FontHeight( font ); // box trap_R_DrawStretchPic( x + xoffset - SCB_TINYFIELD_PIXELWIDTH/2, y + yoffset, width + SCB_TINYFIELD_PIXELWIDTH, lines * trap_SCR_FontHeight( font ), 0, 0, 1, 1, color, cgs.shaderWhite ); return ( trap_SCR_FontHeight( font ) * ( 2+lines ) ); } return 0;}
开发者ID:DenMSC,项目名称:racemod_2.1,代码行数:86,
示例26: WM_DrawClientScore_Smallstatic void WM_DrawClientScore_Small( int x, int y, score_t *score, float *color, float fade ) { int maxchars, offset; float tempx; vec4_t hcolor; clientInfo_t *ci; if ( y + SMALLCHAR_HEIGHT >= 470 ) return; ci = &cgs.clientinfo[score->client]; if ( score->client == cg.snap->ps.clientNum ) { tempx = x; hcolor[3] = fade * 0.3; VectorSet( hcolor, .5f, .5f, .2f ); // DARK-RED CG_FillRect( tempx, y + 1, INFO_PLAYER_WIDTH - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += INFO_PLAYER_WIDTH; if ( ci->team == TEAM_SPECTATOR ) { int width; width = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH; CG_FillRect( tempx, y + 1, width - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += width; } else { CG_FillRect( tempx, y + 1, INFO_CLASS_WIDTH - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += INFO_CLASS_WIDTH; if( cg_gameType.integer == GT_WOLF_LMS ) { CG_FillRect( tempx, y + 1, INFO_SCORE_WIDTH - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += INFO_SCORE_WIDTH; } else { CG_FillRect( tempx, y + 1, INFO_XP_WIDTH - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += INFO_XP_WIDTH; } CG_FillRect( tempx, y + 1, INFO_LATENCY_WIDTH - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += INFO_LATENCY_WIDTH; if( cg_gameType.integer != GT_WOLF_LMS ) { CG_FillRect( tempx, y + 1, INFO_LIVES_WIDTH - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += INFO_LIVES_WIDTH; } } } tempx = x; // DHM - Nerve VectorSet( hcolor, 1, 1, 1 ); hcolor[3] = fade; maxchars = 17; offset = 0; if ( ci->team != TEAM_SPECTATOR ) { if ( ci->powerups & ( (1 << PW_REDFLAG) | (1 << PW_BLUEFLAG) ) ) { CG_DrawPic( tempx-2, y-4, 20, 20, trap_R_RegisterShader( "models/multiplayer/treasure/treasure" ) ); offset += 14; tempx += 14; maxchars -= 2; } // draw the skull icon if out of lives if ( score->respawnsLeft == -2 || ( cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == -1 ) ) { CG_DrawPic( tempx, y, 12, 12, cgs.media.scoreEliminatedShader ); offset += 14; tempx += 14; maxchars -= 2; } else if( cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == 0 ) { CG_DrawPic( tempx + 1, y + 1, 10, 10, cgs.media.medicIcon ); offset += 14; tempx += 14; maxchars -= 2; } } // draw name CG_DrawStringExt( tempx, y, ci->name, hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, maxchars ); tempx += INFO_PLAYER_WIDTH - offset; // dhm - nerve if ( ci->team == TEAM_SPECTATOR ) { const char *s; int w, totalwidth; totalwidth = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH - 8; s = CG_TranslateString( "^3SPECTATOR" ); w = CG_DrawStrlen( s ) * MINICHAR_WIDTH; CG_DrawSmallString( tempx + totalwidth - w, y, s, fade ); return; } else if ( cg.snap->ps.persistant[PERS_TEAM] == ci->team ) { CG_DrawStringExt( tempx, y, CG_TranslateString( BG_ShortClassnameForNumber( score->playerClass ) ), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0 );// CG_DrawSmallString( tempx, y, CG_TranslateString( s ), fade ); }//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:101,
示例27: SCR_DrawSpectators/** SCR_DrawSpectators*/static int SCR_DrawSpectators( const char **ptrptr, int x, int y, int panelWidth, struct qfontface_s *font, bool havePing, const char *title, vec4_t titleColor, int pass ){ const char *token; char string[MAX_STRING_CHARS]; int yoffset = 0, xoffset = 0; int playerNum, ping; int aligns[3], offsets[3]; int colwidth, fullwidth, count = 0, height; bool titleDrawn = false; fullwidth = panelWidth * 1.5; if( fullwidth > cgs.vidWidth * 0.7 ) fullwidth = cgs.vidWidth * 0.7; colwidth = fullwidth / 3; aligns[0] = ALIGN_CENTER_TOP; aligns[1] = ALIGN_LEFT_TOP; aligns[2] = ALIGN_RIGHT_TOP; offsets[0] = 0; offsets[1] = -fullwidth * 0.5; offsets[2] = fullwidth * 0.5; assert( ptrptr && *ptrptr ); height = trap_SCR_FontHeight( font ); yoffset = height; // draw spectators while( *ptrptr ) { if( !SCR_ParseToken( ptrptr, &token ) ) break; // first token is played id playerNum = atoi( token ); if( playerNum < 0 || playerNum >= gs.maxclients ) break; if( havePing ) { // get a second token if( !SCR_ParseToken( ptrptr, &token ) ) break; // second token is ping ping = atoi( token ); // draw the spectator if( ping < 0 ) Q_snprintfz( string, sizeof( string ), "%s%s ...", cgs.clientInfo[playerNum].name, S_COLOR_WHITE ); else Q_snprintfz( string, sizeof( string ), "%s%s %i", cgs.clientInfo[playerNum].name, S_COLOR_WHITE, ping ); } else { Q_snprintfz( string, sizeof( string ), "%s%s", cgs.clientInfo[playerNum].name, S_COLOR_WHITE ); } // draw title if there are any spectators if( !titleDrawn ) { titleDrawn = true; if( pass ) { trap_SCR_DrawString( x, y + yoffset, ALIGN_CENTER_TOP, CG_TranslateString( title ), font, titleColor ); } yoffset += height; } xoffset = offsets[count] + CG_HorizontalAlignForWidth( 0, aligns[count], trap_SCR_strWidth( string, font, 0 ) ); if ( pass ) { // fixme: the boxes aren't actually correctly aligned trap_SCR_DrawClampString( x + xoffset, y + yoffset, string, x + xoffset, y + yoffset, x + xoffset + colwidth, y + yoffset + height, font, colorWhite ); } count++; if( count > 2 ) { count = 0; yoffset += height; } } if( count ) yoffset += height; return yoffset;}
开发者ID:DenMSC,项目名称:racemod_2.1,代码行数:92,
示例28: CG_ObjectivesDraw//.........这里部分代码省略......... scale = 1.0f - scale; } bgColor[3] *= scale; bgColorTitle[3] *= scale; borderColor[3] *= scale; borderColorTitle[3] *= scale; hdrColor[3] *= scale; tColor[3] *= scale; y += (TS_Y - h) * scale; } else if (cgs.objectives.show == SHOW_SHUTDOWN) { cgs.objectives.show = SHOW_OFF; return; } else { y += TS_Y - h; } CG_FillRect(x, y, OBJ_W, h, bgColor); CG_DrawRect(x, y, OBJ_W, h, 1, borderColor); y += 1; // Header CG_FillRect(x + 1, y, OBJ_W - 2, tSpacing + 4, bgColorTitle); CG_DrawRect(x + 1, y, OBJ_W - 2, tSpacing + 4, 1, borderColorTitle); y += tSpacing; CG_Text_Paint_Ext(x + 4, y, hScale, hScaleY, hdrColor, CG_TranslateString("OBJECTIVES"), 0.0f, 0, hStyle, hFont); y += 4; if (!count) { y += tSpacing; CG_Text_Paint_Ext(x + 4, y, tScale, tScale, tColor, "Unable to load objectives", 0.0f, 0, tStyle, tFont); return; } cs = CG_ConfigString(CS_MULTI_OBJECTIVE); if (cgs.clientinfo[cg.snap->ps.clientNum].team == TEAM_SPECTATOR) { Q_strncpyz(temp, cg.objMapDescription_Neutral, sizeof(temp)); while ((s = strchr(temp, '*'))) { *s = '/n'; } CG_FitTextToWidth_Ext(temp, tScale, OBJ_W - 8, sizeof(temp), FONT_TEXT); s = p = temp; while (*p) { if (*p == '/n') { *p++ = '/0'; y += tSpacing; CG_Text_Paint_Ext(x + 4, y, tScale, tScale, tColor, s, 0.0f, 0, tStyle, tFont); s = p; } else {
开发者ID:belstgut,项目名称:etlegacy,代码行数:67,
示例29: SCR_DrawPlayerTab//.........这里部分代码省略......... if( i < 0 ) // negative numbers toggle transparency on { trans = true; i = -1 - i; } if( i < 0 || i >= gs.maxclients ) Q_strncpyz( string, "invalid", sizeof( string ) ); else Q_strncpyz( string, cgs.clientInfo[i].name, sizeof( string ) ); if( ISVIEWERENTITY( i + 1 ) ) // highlight if it's our own player highlight = true; break; case 'i': // is a integer (negatives are colored in red) i = atoi( token ); Q_snprintfz( string, sizeof( string ), "%i", i ); VectorCopy( i >= 0 ? colorWhite : colorRed, color ); break; case 'f': // is a float Q_snprintfz( string, sizeof( string ), "%.2f", atof( token ) ); break; case 'l': // p is an integer colored in latency style i = atoi( token ); Q_snprintfz( string, sizeof( string ), "%i", i ); CG_PingColor( i, color ); break; case 'b': // is a Y/N boolean i = atoi( token ); Q_snprintfz( string, sizeof( string ), "%s", CG_TranslateString( ( i != 0 ) ? "Yes" : "No" ) ); VectorCopy( i ? colorGreen : colorRed, color ); break; case 'p': // is a picture. It uses height for width to get a square iconnum = atoi( token ); if( ( iconnum > 0 ) && ( iconnum < MAX_IMAGES ) ) icon = cgs.imagePrecache[iconnum]; break; case 't': // is a race time. Convert time into MM:SS:mm { unsigned int milli, min, sec; milli = (unsigned int)( atoi( token ) ); if( !milli ) Q_snprintfz( string, sizeof( string ), CG_TranslateString( "no time" ) ); else { min = milli / 60000; milli -= min * 60000; sec = milli / 1000; milli -= sec * 1000; Q_snprintfz( string, sizeof( string ), va( "%02i:%02i.%03i", min, sec, milli ) ); } } break; case 'r': // is a ready state tick that is hidden when not in warmup if( atoi( token ) ) icon = CG_MediaShader( cgs.media.shaderVSayIcon[VSAY_YES] ); break; }
开发者ID:DenMSC,项目名称:racemod_2.1,代码行数:67,
示例30: CG_Class_f//.........这里部分代码省略......... if (trap_Argc() < 2) { CG_Printf("Invalid command format./n"); return; } switch (team) { case TEAM_AXIS: classtype = "r"; teamstring = "Axis"; break; case TEAM_ALLIES: classtype = "b"; teamstring = "Allies"; break; default: CG_Printf("Invalid team./n"); return; } trap_Argv(1, cls, 64); if (!Q_stricmp(cls, "s")) { playerclass = PC_SOLDIER; } else if (!Q_stricmp(cls, "m")) { playerclass = PC_MEDIC; } else if (!Q_stricmp(cls, "e")) { playerclass = PC_ENGINEER; } else if (!Q_stricmp(cls, "f")) { playerclass = PC_FIELDOPS; } else if (!Q_stricmp(cls, "c")) { playerclass = PC_COVERTOPS; } else { CG_Printf("Invalid class format./n"); return; } classinfo = BG_GetPlayerClassInfo(team, playerclass); if (trap_Argc() > 2) { trap_Argv(2, cls, 64); weapon1 = atoi(cls); if (!classinfo->classWeapons[weapon1 - 1]) { CG_Printf("Invalid command format for weapon./n"); return; } } else { weapon1 = 1; } if (cgs.clientinfo[cg.clientNum].skill[SK_HEAVY_WEAPONS] >= 4 && playerclass == PC_SOLDIER) { weapon2 = (team == TEAM_AXIS) ? WP_MP40 : WP_THOMPSON; } else if (cgs.clientinfo[cg.clientNum].skill[SK_LIGHT_WEAPONS] >= 4) { if (playerclass == PC_COVERTOPS) { weapon2 = (team == TEAM_AXIS) ? WP_AKIMBO_SILENCEDLUGER : WP_AKIMBO_SILENCEDCOLT; } else { weapon2 = (team == TEAM_AXIS) ? WP_AKIMBO_LUGER : WP_AKIMBO_COLT; } } else { if (playerclass == PC_COVERTOPS) { weapon2 = (team == TEAM_AXIS) ? WP_SILENCER : WP_SILENCED_COLT; } else { weapon2 = (team == TEAM_AXIS) ? WP_LUGER : WP_COLT; } } // Print out the selected class and weapon info wt = WM_FindWeaponTypeForWeapon(classinfo->classWeapons[weapon1 - 1]); CG_PriorityCenterPrint(va(CG_TranslateString("You will spawn as a %s %s with a %s."), teamstring, BG_ClassnameForNumber(playerclass), wt ? wt->desc : "^1UNKNOWN WEAPON"), SCREEN_HEIGHT - 88, SMALLCHAR_WIDTH, -1); // Send the switch command to the server trap_SendClientCommand(va("team %s %i %i %i/n", classtype, playerclass, classinfo->classWeapons[weapon1 - 1], weapon2));}
开发者ID:MartijnB,项目名称:ETGoldy,代码行数:101,
注:本文中的CG_TranslateString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CHAR_CHECKINDEX函数代码示例 C++ CG_Text_Width_Ext函数代码示例 |