Esempio n. 1
0
void HUD::on_render()
{
	if(!gameclient.snap.gameobj)
		return;
		
	width = 300*gfx_screenaspect();

	bool spectate = false;
	if(gameclient.snap.local_info && gameclient.snap.local_info->team == -1)
		spectate = true;
	
	if(!config.cl_clear_hud && !config.cl_clear_all && gameclient.snap.local_character && !spectate && !(gameclient.snap.gameobj && gameclient.snap.gameobj->game_over))
	{
		render_healthandammo();
		render_speed();
	}

	render_goals();
	render_fps();
	if(client_state() != CLIENTSTATE_DEMOPLAYBACK)
		render_connectionwarning();
	render_teambalancewarning();
	if(config.cl_render_vote && !config.cl_clear_all)	
		render_voting();
	if(config.cl_render_crosshair && !config.cl_clear_hud && !config.cl_clear_all)
		render_cursor();
	if(config.cl_render_viewmode && !config.cl_clear_hud && !config.cl_clear_all && spectate && !(gameclient.snap.gameobj && gameclient.snap.gameobj->game_over))
		render_spectate();
}
Esempio n. 2
0
void SCOREBOARD::on_render()
{
	bool do_scoreboard = false;

	// if we activly wanna look on the scoreboard	
	if(active)
		do_scoreboard = true;
		
	if(gameclient.snap.local_info && gameclient.snap.local_info->team != -1)
	{
		// we are not a spectator, check if we are ead
		if(!gameclient.snap.local_character || gameclient.snap.local_character->health < 0)
			do_scoreboard = true;
	}

	// if we the game is over
	if(gameclient.snap.gameobj && gameclient.snap.gameobj->game_over)
		do_scoreboard = true;
		
	// we're looking at the stats, don't show the scoreboard
	if(gameclient.teecomp_stats->is_active())
		do_scoreboard = false;

	if(!do_scoreboard)
		return;
		
	// if the score board is active, then we should clear the motd message aswell
	if(active)
		gameclient.motd->clear();
	

	float width = 400*3.0f*gfx_screenaspect();
	float height = 400*3.0f;
	
	gfx_mapscreen(0, 0, width, height);

	float w = 650.0f;

	if(gameclient.snap.gameobj && !(gameclient.snap.gameobj->flags&GAMEFLAG_TEAMS))
	{
		render_scoreboard(width/2-w/2, 150.0f, w, 0, 0);
		//render_scoreboard(gameobj, 0, 0, -1, 0);
	}
	else
	{
			
		char text[32];
		if(gameclient.snap.gameobj && gameclient.snap.gameobj->game_over)
		{
			str_copy(text, "DRAW!", sizeof(text));
			if(gameclient.snap.gameobj->teamscore_red > gameclient.snap.gameobj->teamscore_blue)
			{
				if(gameclient.snap.local_info->team == 1 && config.tc_colored_tees_method == 1)
					str_format(text, sizeof(text), "%s Team Wins!", TeecompUtils::rgb_to_name(config.tc_colored_tees_team2));
				else
					str_format(text, sizeof(text), "%s Team Wins!", TeecompUtils::rgb_to_name(config.tc_colored_tees_team1));
			}
			else if(gameclient.snap.gameobj->teamscore_blue > gameclient.snap.gameobj->teamscore_red)
			{
				if(gameclient.snap.local_info->team == 1 && config.tc_colored_tees_method == 1)
					str_format(text, sizeof(text), "%s Team Wins!", TeecompUtils::rgb_to_name(config.tc_colored_tees_team1));
				else
					str_format(text, sizeof(text), "%s Team Wins!", TeecompUtils::rgb_to_name(config.tc_colored_tees_team2));
			}
				
			float w = gfx_text_width(0, 92.0f, text, -1);
			gfx_text(0, width/2-w/2, 45, 92.0f, text, -1);
		}
		
		if(gameclient.snap.local_info && gameclient.snap.local_info->team == 1 && config.tc_colored_tees_method == 1)
			str_format(text, sizeof(text), "%s Team", TeecompUtils::rgb_to_name(config.tc_colored_tees_team2));
		else
			str_format(text, sizeof(text), "%s Team", TeecompUtils::rgb_to_name(config.tc_colored_tees_team1));
		render_scoreboard(width/2-w-20, 150.0f, w, 0, text);
		if(gameclient.snap.local_info && gameclient.snap.local_info->team == 1 && config.tc_colored_tees_method == 1)
			str_format(text, sizeof(text), "%s Team", TeecompUtils::rgb_to_name(config.tc_colored_tees_team1));
		else
			str_format(text, sizeof(text), "%s Team", TeecompUtils::rgb_to_name(config.tc_colored_tees_team2));
		render_scoreboard(width/2 + 20, 150.0f, w, 1, text);
	}

	render_goals(width/2-w/2, 150+750+25, w);
	render_spectators(width/2-w/2, 150+750+25+50+25, w);
}