當前位置: 首頁>>代碼示例>>C++>>正文


C++ CG_TranslateString函數代碼示例

本文整理匯總了C++中CG_TranslateString函數的典型用法代碼示例。如果您正苦於以下問題:C++ CG_TranslateString函數的具體用法?C++ CG_TranslateString怎麽用?C++ CG_TranslateString使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CG_TranslateString函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: CG_DrawPlayerNF

void 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,代碼來源:cg_fireteams.c

示例2: CG_LimboMessage_f

static 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,代碼來源:cg_consolecmds.c

示例3: WM_DrawInfoLine

static 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,代碼來源:cg_scoreboard.c

示例4: CG_SayPlayerClass_f

static 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,代碼來源:cg_consolecmds.c

示例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,代碼來源:cg_draw_hud.c

示例6: memset

const 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,代碼來源:CSyscall.cpp

示例7: WM_DrawInfoLine

static 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,代碼來源:cg_scoreboard.c

示例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,代碼來源:cg_scoreboard.cpp

示例9: CG_GetBoundKeysString

void 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,代碼來源:cg_input.cpp

示例10: CG_DrawDemoControls

void 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,代碼來源:cg_info.c

示例11: CG_VoiceChat_f

static 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,代碼來源:cg_consolecmds.c

示例12: switch

const 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,代碼來源:cg_loadpanel.c

示例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,代碼來源:cg_consolecmds.c

示例14: switch

const 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,代碼來源:cg_popupmessages.c

示例15: WM_TeamScoreboard

static 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,代碼來源:cg_scoreboard.c


注:本文中的CG_TranslateString函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。