Exemple #1
0
static void CG_DrawRedFlagHead(rectDef_t *rect) {
	int i;
	for ( i = 0 ; i < cgs.maxclients ; i++ ) {
		if ( cgs.clientinfo[i].infoValid && cgs.clientinfo[i].team == TEAM_BLUE  && cgs.clientinfo[i].powerups & ( 1<< PW_REDFLAG )) {
			vector3 angles;
			VectorClear( &angles );
			angles.yaw = 180 + 20 * sinf( cg.time / 650.0f );
			CG_DrawHead( rect->x, rect->y, rect->w, rect->h, 0, &angles );
			return;
		}
	}
}
Exemple #2
0
static void CG_DrawStatusBarHead( float x ) {
	vec3_t		angles;
	float		size, stretch;
	float		frac;

	VectorClear( angles );

	if ( cg.damageTime && cg.time - cg.damageTime < DAMAGE_TIME ) {
		frac = ((cg.time - cg.damageTime ) + cg.timeFraction) / DAMAGE_TIME;
		size = ICON_SIZE * 1.25 * ( 1.5 - frac * 0.5 );

		stretch = size - ICON_SIZE * 1.25;
		// kick in the direction of damage
		x -= stretch * 0.5 + cg.damageX * stretch * 0.5;

		cg.headStartYaw = 180 + cg.damageX * 45;

		cg.headEndYaw = 180 + 20 * cos( crandom()*M_PI );
		cg.headEndPitch = 5 * cos( crandom()*M_PI );

		cg.headStartTime = cg.time;
		cg.headEndTime = cg.time + 100 + random() * 2000;
	} else {
		if ( cg.time >= cg.headEndTime ) {
			// select a new head angle
			cg.headStartYaw = cg.headEndYaw;
			cg.headStartPitch = cg.headEndPitch;
			cg.headStartTime = cg.headEndTime;
			cg.headEndTime = cg.time + 100 + random() * 2000;

			cg.headEndYaw = 180 + 20 * cos( crandom()*M_PI );
			cg.headEndPitch = 5 * cos( crandom()*M_PI );
		}

		size = ICON_SIZE * 1.25;
	}

	// if the server was frozen for a while we may have a bad head start time
	if ( cg.headStartTime > cg.time ) {
		cg.headStartTime = cg.time;
	}

	frac = ( ( cg.time - cg.headStartTime ) + cg.timeFraction ) / (float)( cg.headEndTime - cg.headStartTime );
	frac = frac * frac * ( 3 - 2 * frac );
	angles[YAW] = cg.headStartYaw + ( cg.headEndYaw - cg.headStartYaw ) * frac;
	angles[PITCH] = cg.headStartPitch + ( cg.headEndPitch - cg.headStartPitch ) * frac;

	CG_DrawHead( x, 480 - size, size*cgs.widthRatioCoef, size, 
				cg.snap->ps.clientNum, angles );
}
Exemple #3
0
static void CG_DrawPlayerHead(rectDef_t *rect, qboolean draw2D) {
	vector3		angles;
	float		size, stretch;
	float		frac;
	float		x = rect->x;

	VectorClear( &angles );

	if ( cg.damageTime && cg.time - cg.damageTime < DAMAGE_TIME ) {
		frac = (float)(cg.time - cg.damageTime ) / DAMAGE_TIME;
		size = rect->w * 1.25f * ( 1.5f - frac * 0.5f );

		stretch = size - rect->w * 1.25f;
		// kick in the direction of damage
		x -= stretch * 0.5f + cg.damageX * stretch * 0.5f;

		cg.headStartYaw = 180 + cg.damageX * 45;

		cg.headEndYaw = 180 + 20 * cosf( crandom()*M_PI );
		cg.headEndPitch = 5 * cosf( crandom()*M_PI );

		cg.headStartTime = cg.time;
		cg.headEndTime = cg.time + 100 + (int)(random() * 2000);
	} else {
		if ( cg.time >= cg.headEndTime ) {
			// select a new head angle
			cg.headStartYaw = cg.headEndYaw;
			cg.headStartPitch = cg.headEndPitch;
			cg.headStartTime = cg.headEndTime;
			cg.headEndTime = cg.time + 100 + (int)(random() * 2000);

			cg.headEndYaw = 180 + 20 * cosf( crandom()*M_PI );
			cg.headEndPitch = 5 * cosf( crandom()*M_PI );
		}

		size = rect->w * 1.25f;
	}

	// if the server was frozen for a while we may have a bad head start time
	if ( cg.headStartTime > cg.time ) {
		cg.headStartTime = cg.time;
	}

	frac = ( cg.time - cg.headStartTime ) / (float)( cg.headEndTime - cg.headStartTime );
	frac = frac * frac * ( 3 - 2 * frac );
	angles.yaw = cg.headStartYaw + ( cg.headEndYaw - cg.headStartYaw ) * frac;
	angles.pitch = cg.headStartPitch + ( cg.headEndPitch - cg.headStartPitch ) * frac;

	CG_DrawHead( x, rect->y, rect->w, rect->h, cg.snap->ps.clientNum, &angles );
}
							 /*
=================
CG_DrawPlayerScore
=================
*/
static void CG_DrawPlayerScore( int y, score_t *score, float *color, float fade, qboolean largeFormat ) {
	char	string[1024];
	vec3_t	headAngles;
	playerInfo_t	*pi;
	int iconx, headx;
	playerState_t *ps;

	if ( score->playerNum < 0 || score->playerNum >= cgs.maxplayers ) {
		Com_Printf( "Bad score->playerNum: %i\n", score->playerNum );
		return;
	}
	
	pi = &cgs.playerinfo[score->playerNum];

	iconx = SB_BOTICON_X + (SB_RATING_WIDTH / 2);
	headx = SB_HEAD_X + (SB_RATING_WIDTH / 2);

	// draw the handicap or bot skill marker (unless player has flag)
	if ( pi->powerups & ( 1 << PW_NEUTRALFLAG ) ) {
		if( largeFormat ) {
			CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_FREE, qfalse );
		}
		else {
			CG_DrawFlagModel( iconx, y, 16, 16, TEAM_FREE, qfalse );
		}
	} else if ( pi->powerups & ( 1 << PW_REDFLAG ) ) {
		if( largeFormat ) {
			CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_RED, qfalse );
		}
		else {
			CG_DrawFlagModel( iconx, y, 16, 16, TEAM_RED, qfalse );
		}
	} else if ( pi->powerups & ( 1 << PW_BLUEFLAG ) ) {
		if( largeFormat ) {
			CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_BLUE, qfalse );
		}
		else {
			CG_DrawFlagModel( iconx, y, 16, 16, TEAM_BLUE, qfalse );
		}
	} else {
		if ( pi->botSkill > 0 && pi->botSkill <= 5 ) {
			if ( cg_drawIcons.integer ) {
				if( largeFormat ) {
					CG_DrawPic( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, cgs.media.botSkillShaders[ pi->botSkill - 1 ] );
				}
				else {
					CG_DrawPic( iconx, y, 16, 16, cgs.media.botSkillShaders[ pi->botSkill - 1 ] );
				}
			}
		} else if ( pi->handicap < 100 ) {
			Com_sprintf( string, sizeof( string ), "%i", pi->handicap );
			if ( cgs.gametype == GT_TOURNAMENT ) {
				CG_DrawString( iconx, y - SMALLCHAR_HEIGHT/2, string, UI_SMALLFONT|UI_NOSCALE, color );
			}
			else {
				CG_DrawString( iconx, y, string, UI_SMALLFONT|UI_NOSCALE, color );
			}
		}

		// draw the wins / losses
		if ( cgs.gametype == GT_TOURNAMENT ) {
			Com_sprintf( string, sizeof( string ), "%i/%i", pi->wins, pi->losses );
			if( pi->handicap < 100 && !pi->botSkill ) {
				CG_DrawString( iconx, y + SMALLCHAR_HEIGHT/2, string, UI_SMALLFONT|UI_NOSCALE, color );
			}
			else {
				CG_DrawString( iconx, y, string, UI_SMALLFONT|UI_NOSCALE, color );
			}
		}
	}

	// draw the face
	VectorClear( headAngles );
	headAngles[YAW] = 180;
	if( largeFormat ) {
		CG_DrawHead( headx, y - ( ICON_SIZE - BIGCHAR_HEIGHT ) / 2, ICON_SIZE, ICON_SIZE, 
			score->playerNum, headAngles );
	}
	else {
		CG_DrawHead( headx, y, 16, 16, score->playerNum, headAngles );
	}

#ifdef MISSIONPACK
	// draw the team task
	switch ( pi->teamTask ) {
		case TEAMTASK_OFFENSE:
			CG_DrawPic( headx + 48, y, 16, 16, cgs.media.assaultShader );
			break;
		case TEAMTASK_DEFENSE:
			CG_DrawPic( headx + 48, y, 16, 16, cgs.media.defendShader );
			break;
		case TEAMTASK_PATROL:
			CG_DrawPic( headx + 48, y, 16, 16, cgs.media.patrolShader );
			break;
		case TEAMTASK_FOLLOW:
			CG_DrawPic( headx + 48, y, 16, 16, cgs.media.followShader );
			break;
		case TEAMTASK_CAMP:
			CG_DrawPic( headx + 48, y, 16, 16, cgs.media.campShader );
			break;
		case TEAMTASK_RETRIEVE:
			CG_DrawPic( headx + 48, y, 16, 16, cgs.media.retrieveShader );
			break;
		case TEAMTASK_ESCORT:
			CG_DrawPic( headx + 48, y, 16, 16, cgs.media.escortShader );
			break;
		default:
			break;
	}
#endif

	if (cg.cur_ps) {
		if (score->playerNum == cg.cur_ps->playerNum) {
			ps = cg.cur_ps;
		} else {
			ps = NULL;
		}
	} else {
		ps = CG_LocalPlayerState(score->playerNum);
	}

	// highlight your position
	if ( ps ) {
		float	hcolor[4];
		int		rank;

		localPlayer = qtrue;

		if ( ps->persistant[PERS_TEAM] == TEAM_SPECTATOR || cgs.gametype >= GT_TEAM ) {
			rank = -1;
		} else {
			rank = ps->persistant[PERS_RANK] & ~RANK_TIED_FLAG;
		}
		if ( rank == 0 ) {
			hcolor[0] = 0;
			hcolor[1] = 0;
			hcolor[2] = 0.7f;
		} else if ( rank == 1 ) {
			hcolor[0] = 0.7f;
			hcolor[1] = 0;
			hcolor[2] = 0;
		} else if ( rank == 2 ) {
			hcolor[0] = 0.7f;
			hcolor[1] = 0.7f;
			hcolor[2] = 0;
		} else {
			hcolor[0] = 0.7f;
			hcolor[1] = 0.7f;
			hcolor[2] = 0.7f;
		}

		hcolor[3] = fade * 0.7;
		CG_FillRect( SB_SCORELINE_X + BIGCHAR_WIDTH + (SB_RATING_WIDTH / 2), y, 
			640 - SB_SCORELINE_X - BIGCHAR_WIDTH - (SB_RATING_WIDTH / 2), BIGCHAR_HEIGHT+1, hcolor );
	}

	// draw the score line
	if ( score->ping == -1 ) {
		Com_sprintf(string, sizeof(string), "connecting");
	} else if ( pi->team == TEAM_SPECTATOR ) {
		Com_sprintf(string, sizeof(string), "SPECT");
	} else {
		Com_sprintf(string, sizeof(string), "%5i", score->score);
	}
	CG_DrawString( SB_SCORE_X + (SB_RATING_WIDTH / 2) + 4*BIGCHAR_WIDTH, y, string, UI_RIGHT|UI_DROPSHADOW|UI_BIGFONT|UI_NOSCALE, color );

	if ( score->ping != -1 ) {
		Com_sprintf(string, sizeof(string), "%4i", score->ping);
		CG_DrawString( SB_PING_X - (SB_RATING_WIDTH / 2) + 4*BIGCHAR_WIDTH, y, string, UI_RIGHT|UI_DROPSHADOW|UI_BIGFONT|UI_NOSCALE, color );

		Com_sprintf(string, sizeof(string), "%4i", score->time);
		CG_DrawString( SB_TIME_X - (SB_RATING_WIDTH / 2) + 4*BIGCHAR_WIDTH, y, string, UI_RIGHT|UI_DROPSHADOW|UI_BIGFONT|UI_NOSCALE, color );
	}

	CG_DrawString( SB_NAME_X - (SB_RATING_WIDTH / 2), y, pi->name, UI_LEFT|UI_DROPSHADOW|UI_BIGFONT|UI_NOSCALE, color );

	// add the "ready" marker for intermission exiting
	if ( Com_ClientListContains( &cg.readyPlayers, score->playerNum ) ) {
		CG_DrawString( iconx, y, "READY", UI_LEFT|UI_DROPSHADOW|UI_BIGFONT|UI_NOSCALE, color );
	}
}
Exemple #5
0
/*
=======================================================================================================================================
CG_DrawClientScore
=======================================================================================================================================
*/
static void CG_DrawClientScore(int y, score_t *score, float *color, float fade, qboolean largeFormat) {
	char string[1024];
	vec3_t headAngles;
	clientInfo_t *ci;
	int iconx, headx;

	if (score->client < 0 || score->client >= cgs.maxclients) {
		Com_Printf("Bad score->client: %i\n", score->client);
		return;
	}

	ci = &cgs.clientinfo[score->client];
	iconx = SB_BOTICON_X + (SB_RATING_WIDTH / 2);
	headx = SB_HEAD_X + (SB_RATING_WIDTH / 2);
	// draw the handicap or bot skill marker (unless player has flag)
	if (ci->powerups & (1 << PW_NEUTRALFLAG)) {
		if (largeFormat) {
			CG_DrawFlagModel(iconx, y - (32 - BIGCHAR_HEIGHT) / 2, 32, 32, TEAM_FREE, qfalse);
		} else {
			CG_DrawFlagModel(iconx, y, 16, 16, TEAM_FREE, qfalse);
		}
	} else if (ci->powerups & (1 << PW_REDFLAG)) {
		if (largeFormat) {
			CG_DrawFlagModel(iconx, y - (32 - BIGCHAR_HEIGHT) / 2, 32, 32, TEAM_RED, qfalse);
		} else {
			CG_DrawFlagModel(iconx, y, 16, 16, TEAM_RED, qfalse);
		}
	} else if (ci->powerups & (1 << PW_BLUEFLAG)) {
		if (largeFormat) {
			CG_DrawFlagModel(iconx, y - (32 - BIGCHAR_HEIGHT) / 2, 32, 32, TEAM_BLUE, qfalse);
		} else {
			CG_DrawFlagModel(iconx, y, 16, 16, TEAM_BLUE, qfalse);
		}
	} else {
		if (ci->botSkill > 0 && ci->botSkill <= 5) {
			if (cg_drawIcons.integer) {
				if (largeFormat) {
					CG_DrawPic(iconx, y - (32 - BIGCHAR_HEIGHT) / 2, 32, 32, cgs.media.botSkillShaders[ci->botSkill - 1]);
				} else {
					CG_DrawPic(iconx, y, 16, 16, cgs.media.botSkillShaders[ci->botSkill - 1]);
				}
			}
		} else if (ci->handicap < 100) {
			Com_sprintf(string, sizeof(string), "%i", ci->handicap);

			if (cgs.gametype == GT_TOURNAMENT) {
				CG_DrawSmallStringColor(iconx, y - SMALLCHAR_HEIGHT / 2, string, color);
			} else {
				CG_DrawSmallStringColor(iconx, y, string, color);
			}
		}
		// draw the wins / losses
		if (cgs.gametype == GT_TOURNAMENT) {
			Com_sprintf(string, sizeof(string), "%i/%i", ci->wins, ci->losses);

			if (ci->handicap < 100 && !ci->botSkill) {
				CG_DrawSmallStringColor(iconx, y + SMALLCHAR_HEIGHT / 2, string, color);
			} else {
				CG_DrawSmallStringColor(iconx, y, string, color);
			}
		}
	}
	// draw the face
	VectorClear(headAngles);
	headAngles[YAW] = 180;

	if (largeFormat) {
		CG_DrawHead(headx, y - (ICON_SIZE - BIGCHAR_HEIGHT) / 2, ICON_SIZE, ICON_SIZE, score->client, headAngles);
	} else {
		CG_DrawHead(headx, y, 16, 16, score->client, headAngles);
	}
#ifdef MISSIONPACK
	// draw the team task
	if (ci->teamTask != TEAMTASK_NONE) {
		if (ci->teamTask == TEAMTASK_OFFENSE) {
			CG_DrawPic(headx + 48, y, 16, 16, cgs.media.assaultShader);
		} else if (ci->teamTask == TEAMTASK_DEFENSE) {
			CG_DrawPic(headx + 48, y, 16, 16, cgs.media.defendShader);
		}
	}
#endif
	// draw the score line
	if (score->ping == -1) {
		Com_sprintf(string, sizeof(string), " connecting    %s", ci->name);
	} else if (ci->team == TEAM_SPECTATOR) {
		Com_sprintf(string, sizeof(string), " SPECT %3i %4i %s", score->ping, score->time, ci->name);
	} else {
		Com_sprintf(string, sizeof(string), "%5i %4i %4i %s", score->score, score->ping, score->time, ci->name);
	}
	// highlight your position
	if (score->client == cg.snap->ps.clientNum) {
		float hcolor[4];
		int rank;

		localClient = qtrue;

		if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR || cgs.gametype >= GT_TEAM) {
			rank = -1;
		} else {
			rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG;
		}

		if (rank == 0) {
			hcolor[0] = 0;
			hcolor[1] = 0;
			hcolor[2] = 0.7f;
		} else if (rank == 1) {
			hcolor[0] = 0.7f;
			hcolor[1] = 0;
			hcolor[2] = 0;
		} else if (rank == 2) {
			hcolor[0] = 0.7f;
			hcolor[1] = 0.7f;
			hcolor[2] = 0;
		} else {
			hcolor[0] = 0.7f;
			hcolor[1] = 0.7f;
			hcolor[2] = 0.7f;
		}

		hcolor[3] = fade * 0.7;

		CG_FillRect(SB_SCORELINE_X + BIGCHAR_WIDTH + (SB_RATING_WIDTH / 2), y, 640 - SB_SCORELINE_X - BIGCHAR_WIDTH, BIGCHAR_HEIGHT + 1, hcolor);
	}

	CG_DrawBigString(SB_SCORELINE_X + (SB_RATING_WIDTH / 2), y, string, fade);
	// add the "ready" marker for intermission exiting
	if (cg.snap->ps.stats[STAT_CLIENTS_READY] & (1 << score->client)) {
		CG_DrawBigStringColor(iconx, y, "READY", color);
	}
}
/*
=======================================================================================================================================
CG_DrawScoreboard
=======================================================================================================================================
*/
static void CG_DrawClientScore(int x, int y, score_t *score, float *color, float fade) {
	char string[1024];
	vec3_t headAngles;
	clientInfo_t *ci;

	if (score->client < 0 || score->client >= cgs.maxclients) {
		Com_Printf("Bad score->client: %i\n", score->client);
		return;
	}

	ci = &cgs.clientinfo[score->client];
	// draw the handicap or bot skill marker
	if (ci->botSkill > 0 && ci->botSkill <= 5) {
		CG_DrawPic(0, y - 8, 32, 32, cgs.media.botSkillShaders[ci->botSkill - 1]);
	} else if (ci->handicap < 100) {
		Com_sprintf(string, sizeof(string), "%i", ci->handicap);
		CG_DrawSmallStringColor(8, y, string, color);
	}
	// draw the wins / losses
	if (cgs.gametype == GT_TOURNAMENT) {
		Com_sprintf(string, sizeof(string), "%i/%i", ci->wins, ci->losses);
		CG_DrawSmallStringColor(x + SCOREBOARD_WIDTH + 2, y, string, color);
	}
	// draw the face
	VectorClear(headAngles);
	headAngles[YAW] = 180;

	CG_DrawHead(x - ICON_SIZE, y - (ICON_SIZE - BIGCHAR_HEIGHT) / 2, ICON_SIZE, ICON_SIZE, score->client, headAngles);

	if (ci->powerups & (1 << PW_REDFLAG)) {
		CG_DrawFlagModel(x - ICON_SIZE - ICON_SIZE / 2, y - (ICON_SIZE - BIGCHAR_HEIGHT) / 2, ICON_SIZE, ICON_SIZE, TEAM_RED);
	} else if (ci->powerups & (1 << PW_BLUEFLAG)) {
		CG_DrawFlagModel(x - ICON_SIZE - ICON_SIZE / 2, y - (ICON_SIZE - BIGCHAR_HEIGHT) / 2, ICON_SIZE, ICON_SIZE, TEAM_BLUE);
	}
	// draw the score line
	if (score->ping == -1) {
		Com_sprintf(string, sizeof(string), "connecting     %s", ci->name);
	} else if (ci->team == TEAM_SPECTATOR) {
		Com_sprintf(string, sizeof(string), "SPECT %4i %4i %s", score->ping, score->time, ci->name);
	} else {
		Com_sprintf(string, sizeof(string), "%5i %4i %4i %s", score->score, score->ping, score->time, ci->name);
	}
	// highlight your position
	if (score->client == cg.snap->ps.clientNum) {
		float hcolor[4];
		int rank;

		if (cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR
			 || cgs.gametype >= GT_TEAM) {
			rank = -1;
		} else {
			rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG;
		}

		if (rank == 0) {
			hcolor[0] = 0;
			hcolor[1] = 0;
			hcolor[2] = 0.7;
		} else if (rank == 1) {
			hcolor[0] = 0.7;
			hcolor[1] = 0;
			hcolor[2] = 0;
		} else if (rank == 2) {
			hcolor[0] = 0.7;
			hcolor[1] = 0.7;
			hcolor[2] = 0;
		} else {
			hcolor[0] = 0.7;
			hcolor[1] = 0.7;
			hcolor[2] = 0.7;
		}

		hcolor[3] = fade * 0.7;
		CG_FillRect(x - 2, y, SCOREBOARD_WIDTH, BIGCHAR_HEIGHT + 1, hcolor);
	}

	CG_DrawBigString(x, y, string, fade);
	// add the "ready" marker for intermission exiting
	if (cg.snap->ps.stats[STAT_CLIENTS_READY] & (1 << score->client)) {
		CG_DrawBigStringColor(0, y, "READY", color);
	}
}
Exemple #7
0
static void CG_DrawClientScore( int y, const score_t *score, const float *color, float fade, qboolean largeFormat ) {
	char	string[1024];
	vec3_t	headAngles;
	const clientInfo_t *ci;
	int iconx, headx;

#if 0
	Com_Printf("----  CG_DrawClientScore()  ------\n");
		Com_Printf("  client: %d\n", score->client);
		Com_Printf("  score: %d\n", score->score);
		Com_Printf("  ping:  %d\n", score->ping);
		Com_Printf("  time: %d\n", score->time);
		Com_Printf("  scoreFlags: %d\n", score->scoreFlags);
		Com_Printf("  powerUps:  %d\n", score->powerUps);
		Com_Printf("  accuracy:  %d\n", score->accuracy);
		//		Com_Printf("  ...\n");
		Com_Printf("  impressiveCount:  %d\n", score->impressiveCount);
		Com_Printf("  excellentCount:  %d\n", score->excellentCount);
		Com_Printf("  gauntletCount:  %d\n", score->gauntletCount);
		Com_Printf("  defendCount:  %d\n", score->defendCount);
		Com_Printf("  assistCount:  %d\n", score->assistCount);
		Com_Printf("  perfect:  %d\n", score->perfect);
		Com_Printf("  team:  %d\n", score->team);
#endif

	if ( score->client < 0 || score->client >= cgs.maxclients ) {
		Com_Printf( "Bad score->client: %i\n", score->client );
		return;
	}

	ci = &cgs.clientinfo[score->client];

	iconx = SB_BOTICON_X + (SB_RATING_WIDTH / 2);
	headx = SB_HEAD_X + (SB_RATING_WIDTH / 2);

	// draw the handicap or bot skill marker (unless player has flag)
	if ( ci->powerups & ( 1 << PW_NEUTRALFLAG ) ) {
		if( largeFormat ) {
			CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_FREE, qfalse );
		}
		else {
			CG_DrawFlagModel( iconx, y, 16, 16, TEAM_FREE, qfalse );
		}
	} else if ( ci->powerups & ( 1 << PW_REDFLAG ) ) {
		if( largeFormat ) {
			CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_RED, qfalse );
		}
		else {
			CG_DrawFlagModel( iconx, y, 16, 16, TEAM_RED, qfalse );
		}
	} else if ( ci->powerups & ( 1 << PW_BLUEFLAG ) ) {
		if( largeFormat ) {
			CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_BLUE, qfalse );
		}
		else {
			CG_DrawFlagModel( iconx, y, 16, 16, TEAM_BLUE, qfalse );
		}
	} else {
		if ( ci->botSkill > 0 && ci->botSkill <= 5 ) {
			if ( cg_drawIcons.integer ) {
				if( largeFormat ) {
					CG_DrawPic( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, cgs.media.botSkillShaders[ ci->botSkill - 1 ] );
				}
				else {
					CG_DrawPic( iconx, y, 16, 16, cgs.media.botSkillShaders[ ci->botSkill - 1 ] );
				}
			}
		} else if ( ci->handicap < 100 ) {
			Com_sprintf( string, sizeof( string ), "%i", ci->handicap );
			if ( CG_IsDuelGame(cgs.gametype) )
				CG_DrawSmallStringColor( iconx, y - SMALLCHAR_HEIGHT/2, string, color );
			else
				CG_DrawSmallStringColor( iconx, y, string, color );
		}

		// draw the wins / losses
		if ( CG_IsDuelGame(cgs.gametype) ) {
			Com_sprintf( string, sizeof( string ), "%i/%i", ci->wins, ci->losses );
			if( ci->handicap < 100 && !ci->botSkill ) {
				CG_DrawSmallStringColor( iconx, y + SMALLCHAR_HEIGHT/2, string, color );
			}
			else {
				CG_DrawSmallStringColor( iconx, y, string, color );
			}
		}
	}

	// draw the face
	VectorClear( headAngles );
	headAngles[YAW] = 180;
	if( largeFormat ) {
		CG_DrawHead( headx, y - ( ICON_SIZE - BIGCHAR_HEIGHT ) / 2, ICON_SIZE, ICON_SIZE, 
					 score->client, headAngles, qtrue );
	}
	else {
		CG_DrawHead( headx, y, 16, 16, score->client, headAngles, qtrue );
	}

#ifdef MISSIONPACK
	// draw the team task
	if ( ci->teamTask != TEAMTASK_NONE ) {
		if ( ci->teamTask == TEAMTASK_OFFENSE ) {
			CG_DrawPic( headx + 48, y, 16, 16, cgs.media.assaultShader );
		}
		else if ( ci->teamTask == TEAMTASK_DEFENSE ) {
			CG_DrawPic( headx + 48, y, 16, 16, cgs.media.defendShader );
		}
	}
#endif
	// draw the score line
	if ( score->ping == -1 ) {
		Com_sprintf(string, sizeof(string),
			" connecting    %s", ci->name);
	//} else if ( ci->team == TEAM_SPECTATOR   &&  cg.numScores > 0) {
	} else if ( score->team == TEAM_SPECTATOR   &&  cg.numScores > 0) {
		Com_sprintf(string, sizeof(string),
			"^3%5i %4i %4i ^7%s", score->score, score->ping, score->time, ci->name);
	} else if (cg.numScores > 0) {
#if 1
		Com_sprintf(string, sizeof(string),
			"%5i %4i %4i %s", score->score, score->ping, score->time, ci->name);
#endif
#if 0
		Com_sprintf(string, sizeof(string),
			"%5i %4i %4i %i %i %i %i %s %s", score->score, score->ping, score->time, score->alive, score->frags, score->deaths, score->accuracy, weapNames[score->bestWeapon], ci->name);
#endif
#if 0
		Com_sprintf(string, sizeof(string),
					"%5i %4i %4i %d %s %s", score->score, score->ping, score->time, score->accuracy, weapNames[score->bestWeapon], ci->name);
#endif
	} else if (cg.demoPlayback) {
		Com_sprintf(string, sizeof(string),
					"               %s", ci->name);
	}

	//FIXME wolfcam
	// highlight your position
	if ( score->client == cg.snap->ps.clientNum ) {
		float	hcolor[4];
		int		rank;

		localClient = qtrue;

		if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR 
			|| cgs.gametype >= GT_TEAM ) {
			rank = -1;
		} else {
			rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG;
		}
		if ( rank == 0 ) {
			hcolor[0] = 0;
			hcolor[1] = 0;
			hcolor[2] = 0.7f;
		} else if ( rank == 1 ) {
			hcolor[0] = 0.7f;
			hcolor[1] = 0;
			hcolor[2] = 0;
		} else if ( rank == 2 ) {
			hcolor[0] = 0.7f;
			hcolor[1] = 0.7f;
			hcolor[2] = 0;
		} else {
			hcolor[0] = 0.7f;
			hcolor[1] = 0.7f;
			hcolor[2] = 0.7f;
		}

		hcolor[3] = fade * 0.7;
		CG_FillRect( SB_SCORELINE_X + BIGCHAR_WIDTH + (SB_RATING_WIDTH / 2), y, 
			640 - SB_SCORELINE_X - BIGCHAR_WIDTH, BIGCHAR_HEIGHT+1, hcolor );
	}

	CG_DrawBigString( SB_SCORELINE_X + (SB_RATING_WIDTH / 2), y, string, fade );

	// add the "ready" marker for intermission exiting
	if ( cg.snap->ps.stats[ STAT_CLIENTS_READY ] & ( 1 << score->client ) ) {
		CG_DrawBigStringColor( iconx, y, "READY", color );
	}
}
Exemple #8
0
/*
=================
CG_DrawScoreboard
=================
*/
static void CG_DrawClientScore( int y, score_t *score, float *color, float fade, qboolean largeFormat ) {
	char			string[1024];
	vec3_t			headAngles;
	clientInfo_t	*ci;
	int				iconx, headx;
	float			scale = 0.35;
	int				h = CG_Text_Height( "Tj", scale, 0 );
	//int				ty;

	if ( score->client < 0 || score->client >= cgs.maxclients ) {
		Com_Printf( "Bad score->client: %i\n", score->client );
		return;
	}
	color[3] = fade;
	
	ci = &cgs.clientinfo[score->client];

	iconx = SB_BOTICON_X + (SB_RATING_WIDTH / 2);
	headx = SB_HEAD_X + (SB_RATING_WIDTH / 2);

	// draw the handicap or bot skill marker (unless player has flag)
	if ( ci->powerups & ( 1 << PW_NEUTRALFLAG ) ) {
		if( largeFormat ) {
			CG_DrawFlagModel( iconx, y - SB_LARGE_SPACER, SB_LARGE_ICON, SB_LARGE_ICON, TEAM_FREE, qfalse, SCR_CENTER );
		} else {
			CG_DrawFlagModel( iconx, y - SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, TEAM_FREE, qfalse, SCR_CENTER );
		}
	} else if ( ci->powerups & ( 1 << PW_REDFLAG ) ) {
		if( largeFormat ) {
			CG_DrawFlagModel( iconx, y - SB_LARGE_SPACER, SB_LARGE_ICON, SB_LARGE_ICON, TEAM_RED, qfalse, SCR_CENTER );
		} else {
			CG_DrawFlagModel( iconx, y - SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, TEAM_RED, qfalse, SCR_CENTER );
		}
	} else if ( ci->powerups & ( 1 << PW_BLUEFLAG ) ) {
		if( largeFormat ) {
			CG_DrawFlagModel( iconx, y - SB_LARGE_SPACER, SB_LARGE_ICON, SB_LARGE_ICON, TEAM_BLUE, qfalse, SCR_CENTER );
		} else {
			CG_DrawFlagModel( iconx, y - SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, TEAM_BLUE, qfalse, SCR_CENTER );
		}
	} else {
		if ( ci->botSkill > 0 && ci->botSkill <= 5 ) {
			if ( cg_drawIcons.integer ) {
				if( largeFormat ) {
					CG_DrawColorPic( iconx, y - SB_LARGE_SPACER, SB_LARGE_ICON, SB_LARGE_ICON, cgs.media.botSkillShaders[ci->botSkill - 1], SCR_CENTER, color );
				} else {
					CG_DrawColorPic( iconx, y - SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, cgs.media.botSkillShaders[ci->botSkill - 1], SCR_CENTER, color );
				}
			}
		} else if ( ci->handicap < 100 ) {
			Com_sprintf( string, sizeof( string ), "%i", ci->handicap );
			if ( gt[cgs.gametype].duel ) {
				if ( cg_highResFonts.integer ) {
					CG_Text_Paint( iconx, y + h + ((float)h/2), scale, color, string, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER );
				} else {
					CG_DrawSmallStringColor( iconx, y - SMALLCHAR_HEIGHT/2, string, color, SCR_CENTER );
				}
			} else {
				if ( cg_highResFonts.integer ) {
					//w = CG_Text_Width(s, scale, 0);
					h = CG_Text_Height(string, scale, 0);
					CG_Text_Paint( iconx, y + h, scale, color, string, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER );
				} else {
					CG_DrawSmallStringColor( iconx, y, string, color, SCR_CENTER );
				}
			}
		}

		// draw the wins / losses
		if ( gt[cgs.gametype].duel ) {
			Com_sprintf( string, sizeof( string ), "%i/%i", ci->wins, ci->losses );
			if ( ci->handicap < 100 && !ci->botSkill ) {
				if ( cg_highResFonts.integer ) {
					CG_Text_Paint( iconx, y + h + ((float)h/2), scale, color, string, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER );
				} else {
					CG_DrawSmallStringColor( iconx, y + SMALLCHAR_HEIGHT/2, string, color, SCR_CENTER );
				}
			} else {
				if ( cg_highResFonts.integer ) {
					CG_Text_Paint( iconx, y + h, scale, color, string, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER );
				} else {
					CG_DrawSmallStringColor( iconx, y, string, color, SCR_CENTER );
				}
			}
		}
	}

	// draw the face
	VectorClear( headAngles );
	headAngles[YAW] = 180;
	if ( largeFormat ) {
		CG_DrawHead( headx, y - SB_LARGE_SPACER*2, ICON_SIZE, ICON_SIZE, 
			score->client, headAngles, SCR_CENTER, color );
	} else {
		CG_DrawHead( headx, y + SB_SMALL_SPACER, SB_SMALL_ICON, SB_SMALL_ICON, score->client, headAngles, SCR_CENTER, color );
	}

	// draw the score line

	// highlight your position
	if ( score->client == cg.snap->ps.clientNum ) {
		float	hcolor[4];
		int		rank;

		localClient = qtrue;

		if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ) {
			rank = -1;
		} else {
			rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG;
		}
		if ( rank == 0 ) {
			hcolor[0] = 0;
			hcolor[1] = 0;
			hcolor[2] = 0.7f;
		} else if ( rank == 1 ) {
			hcolor[0] = 0.7f;
			hcolor[1] = 0;
			hcolor[2] = 0;
		} else if ( rank == 2 ) {
			hcolor[0] = 0.7f;
			hcolor[1] = 0.7f;
			hcolor[2] = 0;
		} else {
			hcolor[0] = 0.4f;
			hcolor[1] = 0.4f;
			hcolor[2] = 0.4f;
		}

		hcolor[3] = fade * 0.7;
/*
		CG_DrawTeamBackground( SB_SCORELINE_X + BIGCHAR_WIDTH + (SB_RATING_WIDTH / 2), y, 
			SCREEN_WIDTH - SB_SCORELINE_X - BIGCHAR_WIDTH, BIGCHAR_HEIGHT+1, 1, gt[cgs.gametype].teams ? cg.snap->ps.persistant[PERS_TEAM] : hcolor, SCR_CENTER );
*/		
		CG_FillRect( SB_SCORELINE_X + BIGCHAR_WIDTH + (SB_RATING_WIDTH / 2), y, 
			SCREEN_WIDTH - SB_SCORELINE_X - BIGCHAR_WIDTH, BIGCHAR_HEIGHT+2, gt[cgs.gametype].teams ? CG_TeamColorDark(cg.snap->ps.persistant[PERS_TEAM], fade) : hcolor, SCR_CENTER );
	}


	// draw client score strings
	if ( cg_highResFonts.integer ) {
		qboolean spec = ci->team == TEAM_SPECTATOR;
		int		w;
		char	*s;

		// score
		s = (score->ping == -1) ? "CONN" : spec ? "SPEC" : cg.warmup ? "-" : va("%i", score->score);
		w = CG_Text_Width( s, scale, 0 );
		CG_Text_Paint( SB_SCORE_X + (SB_RATING_WIDTH / 2) + 64-w, y + h, scale, color, s, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER );
		// ping
		s = va( "%i", score->ping );
		w = CG_Text_Width( s, scale, 0 );
		CG_Text_Paint( SB_PING_X - (SB_RATING_WIDTH + BIGCHAR_WIDTH )/2 + 64-w, y + h, scale, color, s, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER );
		// time
		s = va( "%i", score->time );	//CG_IntToTime( score->time*1000, qtrue, qfalse );
		w = CG_Text_Width( s, scale, 0 );
		CG_Text_Paint( SB_TIME_X - (SB_RATING_WIDTH + BIGCHAR_WIDTH )/2 + 64-w, y + h, scale, color, s, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER );
		// name
		CG_Text_Paint( SB_NAME_X - (SB_RATING_WIDTH / 2), y + h, scale, color, ci->name, 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER );
	} else {
		if ( score->ping == -1 ) {
			Com_sprintf(string, sizeof(string),
				" connecting    %s", ci->name);
		} else if ( ci->team == TEAM_SPECTATOR ) {
			Com_sprintf(string, sizeof(string),
				" SPECT %3i %4i %s", score->ping, score->time, ci->name);
		} else {
			Com_sprintf(string, sizeof(string),
				"%5i %4i %4i %s", score->score, score->ping, score->time, ci->name);
		}
		CG_DrawBigString( SB_SCORELINE_X + (SB_RATING_WIDTH / 2), y, string, fade, SCR_CENTER );
	}

	// add the "ready" marker for intermission exiting
	if ( cg.snap->ps.stats[STAT_CLIENTS_READY] & ( 1 << score->client ) ) {
		if ( cg_highResFonts.integer ) {
			CG_Text_Paint( iconx, y + h, scale, color, "READY", 0, 0, ITEM_TEXTSTYLE_SHADOWED, SCR_CENTER );
		} else {
			CG_DrawBigStringColor( iconx, y, "READY", color, SCR_CENTER );
		}
	}
}