Beispiel #1
0
/*
================
Con_DrawInput

Draw the editline after a ] prompt
================
*/
void Con_DrawInput ( connstate_t state, int lines ) {
	int		y;

	if ( state != CA_DISCONNECTED && !(trap_Key_GetCatcher( ) & KEYCATCH_CONSOLE ) ) {
		return;
	}

	y = lines - ( SMALLCHAR_HEIGHT * 2 );

	CG_DrawSmallStringColor( con.sideMargin, y, "]", g_color_table[ColorIndex(COLOR_WHITE)] );

	MField_Draw( &g_consoleField, 2 * SMALLCHAR_WIDTH, y, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, g_color_table[ColorIndex(COLOR_WHITE)] );
}
Beispiel #2
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);
	}
}
Beispiel #3
0
/*
================
Con_DrawSolidConsole

Draws the console with the solid background
================
*/
void Con_DrawSolidConsole( connstate_t state, float frac ) {
	int				i;
	int				x, y;
	int				rows;
	char			*text;
	int				row;
	int				lines;
	vec4_t			color;

	if ( frac > 1 )
		frac = 1;

	lines = cgs.glconfig.vidHeight * frac / cgs.screenYScale;
	if (lines <= 0)
		return;

	CG_SetScreenPlacement( PLACE_STRETCH, PLACE_STRETCH );

	// draw the background
	y = frac * SCREEN_HEIGHT;
	if ( y < 1 ) {
		y = 0;
	}
	else {
		CG_DrawPic( 0, 0, SCREEN_WIDTH, y, cgs.media.consoleShader );
	}

	color[0] = 1;
	color[1] = 0;
	color[2] = 0;
	color[3] = 1;
	CG_FillRect( 0, y, SCREEN_WIDTH, 2, color );

	CG_SetScreenPlacement( PLACE_RIGHT, PLACE_TOP );

	// draw the version number
	CG_DrawSmallStringColor( SCREEN_WIDTH - CG_DrawStrlen( con.version ) * SMALLCHAR_WIDTH,
			lines - SMALLCHAR_HEIGHT, con.version, color );

	CG_SetScreenPlacement( PLACE_LEFT, PLACE_TOP );

	// draw the text
	rows = (lines-SMALLCHAR_HEIGHT)/SMALLCHAR_HEIGHT;		// rows of text to draw

	y = lines - (SMALLCHAR_HEIGHT*3);

	// draw from the bottom up
	if (con.display != con.current)
	{
		int linewidth = con.screenFakeWidth / SMALLCHAR_WIDTH;
		// draw arrows to show the buffer is backscrolled
		trap_R_SetColor( color );
		for (x=0 ; x<linewidth ; x+=4)
			CG_DrawChar( (x+1)*SMALLCHAR_WIDTH, y, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, '^' );
		y -= SMALLCHAR_HEIGHT;
		rows--;
		trap_R_SetColor( NULL );
	}
	
	row = con.display;

	if ( con.x == 0 ) {
		row--;
	}

	for (i=0 ; i<rows ; i++, y -= SMALLCHAR_HEIGHT, row--)
	{
		if (row < 0)
			break;
		if (con.current - row >= CON_MAXLINES) {
			// past scrollback wrap point
			continue;
		}

		text = con.lines[row % CON_MAXLINES];
		CG_DrawSmallString( con.sideMargin, y, text, 1.0f );
	}

	// draw the input prompt, user text, and cursor if desired
	Con_DrawInput ( state, lines );
}
Beispiel #4
0
/*
=======================================================================================================================================
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);
	}
}
Beispiel #5
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 );
	}
}
/*
================
CG_DrawStatusBar_MFQ3

================
*/
void CG_DrawStatusBar_MFQ3( void ) {
	int			color;
	centity_t	*cent;
	playerState_t	*ps;
	int			value;
	int			vehicle = cgs.clientinfo[cg.predictedPlayerState.clientNum].vehicle;
	int			w;

	static vec4_t colors[] = { 
//		{ 0.2, 1.0, 0.2, 1.0 } , { 1.0, 0.2, 0.2, 1.0 }, {0.5, 0.5, 0.5, 1} };
		{ 1.0f, 0.89f, 0.0f, 1.0f } ,		// normal, yellow
		{ 1.0f, 0.0f, 0.0f, 1.0f },		// low health, red
		{0.5f, 0.5f, 0.5f, 1.0f},			// weapon firing, grey
		{ 1.0f, 1.0f, 1.0f, 1.0f },		// health > 100, white
		{ 0.3f, 1.0f, 0.3f, 1.0f }		// green
	};

	if ( cg_drawStatus.integer == 0 ) {
		return;
	}

	cent = &cg_entities[cg.snap->ps.clientNum];
	ps = &cg.snap->ps;

	// aiming/targetting reticles
	CG_Draw_Reticles();

	// main background
	CG_DrawPic( 0, 430, 640, 50, cgs.media.HUDmain );
	
	//
	// flag
	//
	if( cg.predictedPlayerState.objectives & OB_REDFLAG ) {
		CG_DrawStatusBarFlag( 640 - ICON_SIZE, ClientBase::TEAM_RED );
	} else if( cg.predictedPlayerState.objectives & OB_BLUEFLAG ) {
		CG_DrawStatusBarFlag( 640 - ICON_SIZE, ClientBase::TEAM_BLUE );
	}

	//
	// RADAR
	//
	if( cent->currentState.ONOFF & OO_RADAR_AIR ) {
		CG_DrawRadarSymbols_AIR(vehicle);
	} else if( cent->currentState.ONOFF & OO_RADAR_GROUND ) {
		CG_DrawRadarSymbols_GROUND(vehicle);
	} else if( availableVehicles[vehicle].radarRange || 
		availableVehicles[vehicle].radarRange2 ) {
		CG_DrawPic( 440, 280, 200, 200, cgs.media.HUDradar );
		CG_DrawSmallString( 595, 320, "OFF", 1.0f);
	}

	//
	// GPS
	//
	if( cg.GPS ) {
		trace_t	tr;
		vec3_t	start, end;
		// main
		CG_DrawPic( -14, 380, 512, 102, cgs.media.HUDgps );
		// heading
		value = 360 - (int)ps->vehicleAngles[1];
		CG_DrawSmallString( 234, 420, va("%i",value), 1.0f );
		// altitude
		VectorCopy( ps->origin, start );
		start[2] += availableVehicles[vehicle].mins[2];
		VectorCopy( start, end );
		end[2] -= 2000;
		CG_Trace( &tr, start, vec3_origin, vec3_origin, end, cg.snap->ps.clientNum, MASK_SOLID|MASK_WATER );
		value = (int)(tr.fraction * 2000);
		if( value > 100 ) color = 3;
		else if( value > 50 ) color = 4;
		else if( value > 25 ) color = 0;
		else color = 1;
		if( value < 2000 ) {
			CG_DrawSmallStringColor( 374, 420, va("%i",value), colors[color] );
		} else {
			CG_DrawSmallStringColor( 374, 420, "XXXX", colors[color] );
		}

		// x coord
		value = (int)ps->origin[0];
		CG_DrawSmallString( 264, 423, va("%i",value), 0.7f );
		// y coord
		value = (int)ps->origin[1];
		CG_DrawSmallString( 320, 423, va("%i",value), 0.7f );
	} 

	//
	// INFO
	//
	if( !cg.INFO ) {	// bit dirty to have NOT but oh well...
		// main
		CG_DrawPic( 0, 330, 150, 150, cgs.media.HUDext );
		if( availableVehicles[vehicle].caps & HC_GEAR ) {
			if( cent->currentState.ONOFF & OO_GEAR ) {
				CG_DrawSmallStringColor( 2, 390, "Gear", colors[4] );
			} else {
				CG_DrawSmallString( 2, 390, "Gear", 1.0f );
			}
		}
		if( availableVehicles[vehicle].caps & HC_SPEEDBRAKE ) {
			if( cent->currentState.ONOFF & OO_SPEEDBRAKE ) {
				CG_DrawSmallStringColor( 2, 410, "Speedbrakes", colors[4] );
			} else {
				CG_DrawSmallString( 2, 410, "Speedbrakes", 1.0f );
			}
		} else {
			if( cent->currentState.ONOFF & OO_SPEEDBRAKE ) {
				CG_DrawSmallStringColor( 2, 410, "Brakes", colors[4] );
			} else {
				CG_DrawSmallString( 2, 410, "Brakes", 1.0f );
			}
		}

		value = ps->stats[STAT_FUEL];
		if ( value > 10 ) {
			color =  3;	// white
		} else if (value > 5) {
			color = 0;	// yellow
		} else {
			color = 1;	// red
		}
		if( (availableVehicles[vehicle].cat & CAT_PLANE) ||
			(availableVehicles[vehicle].cat & CAT_HELO) ||
			(availableVehicles[vehicle].cat & CAT_BOAT) ) {
			value *= 100;
		}
		CG_DrawSmallStringColor( 2, 430, va("Fuel %i", value), colors[color]);
	} 

	//
	// FLARES
	//
	if( ps->ammo[WP_FLARE+8] > 0 ) {
		CG_DrawBigString( 600, 462, va("%i", ps->ammo[WP_FLARE]), 1.0f );
	}

	//
	// speed and throttle
	//
	value = ps->speed/10;
	if ( value > availableVehicles[vehicle].stallspeed * SPEED_GREEN_ARC ) {
		color = 3;		// white
	} else if (value > availableVehicles[vehicle].stallspeed * SPEED_YELLOW_ARC ) {
		color = 4;	// green
	} else if (value >= availableVehicles[vehicle].stallspeed) {
		color = 0;	// yellow
	} else {
		color = 1;	// red
	}

	w = CG_DrawStrlen(va("%i",value)) * BIGCHAR_WIDTH;
	CG_DrawBigStringColor(285-w, 460, va("%i",value), colors[color]);
	
	if( ps->throttle > availableVehicles[vehicle].maxthrottle ) {
		value = ps->throttle - availableVehicles[vehicle].maxthrottle;
	} else {
		value = ps->throttle;
	}
	CG_DrawPic(295, 443, 50, 37, cgs.media.throttle[value]);

	//
	// health
	//
	value = (100*ps->stats[STAT_HEALTH]/ps->stats[STAT_MAX_HEALTH]);
	if( value > 100 ) value = 100;
	if ( value < 10 ) {
		color = 1;
	} else if (value < 25) {
		color = 0;  
	} else {
		color = 3;
	}

	w = CG_DrawStrlen(va("%i",value)) * BIGCHAR_WIDTH;
	CG_DrawBigStringColor( 398-w, 460, va("%i",value), colors[color]);

	//
	// ammo
	//
	if( cent->currentState.weaponNum >= 0 ) {
		value = ps->ammo[cent->currentState.weaponNum];
		w = CG_DrawStrlen(va("%i",value)) * BIGCHAR_WIDTH;
		CG_DrawBigString (500-w, 460, va("%i",value),1.0f);
		CG_DrawPic( 416, 440, 24, 45, 
			availableWeapons[availableVehicles[vehicle].weapons[cent->currentState.weaponNum]].iconHandle );
	}

	//
	// ammo mg
	//
	if( ps->ammo[WP_MACHINEGUN+8] > 0 ) {
		if( cent->currentState.weaponNum >= 0 ) {
			value = ps->ammo[0];
			w = CG_DrawStrlen(va("%i",value)) * BIGCHAR_WIDTH;
			CG_DrawBigString (180-w, 460, va("%i",value),1.0f);
			CG_DrawPic( 200, 440, 24, 45, availableWeapons[availableVehicles[vehicle].weapons[0]].iconHandle );
		}
	}
}
Beispiel #7
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 );
		}
	}
}