All pastes #438639 Raw Edit

ungamed

public text v1 · immutable
·published 2007-04-13 19:19 UTC
rendered paste body
void idPlayer::UpdateHudTimer( idUserInterface *_hud ) {
	// fastest time
	int ftMinut			= 0;
	int ftSecond		= 0;
	int ftFragments		= 0;
	idStr fastestTime;
	// current time
	int ctMinut			= 0;
	int ctSecond		= 0;
	int ctFragments		= 0;
	idStr currentTime;

	assert( _hud );

	if (this->inventory.fastestTime > 0) {
		ftMinut		= getMinuts(	this->inventory.fastestTime);
		ftSecond	= getSeconds(	this->inventory.fastestTime, ftMinut);
		ftFragments	= getFragments(	this->inventory.fastestTime, ftMinut, ftSecond);
	}
	
	if (this->inventory.timeStamp > 0) {
		ctMinut		= getMinuts(	gameLocal.time	- this->inventory.timeStamp);
		ctSecond	= getSeconds(	gameLocal.time	- this->inventory.timeStamp, ctMinut);
		ctFragments	= getFragments(	gameLocal.time	- this->inventory.timeStamp, ctMinut, ctSecond);
	}

	sprintf(fastestTime, "%i:%i.%i", ftMinut, ftSecond, ftFragments);
	sprintf(currentTime, "%i:%i.%i", ctMinut, ctSecond, ctFragments);

	_hud->SetStateString( "player_current_time", currentTime);
	_hud->SetStateString( "player_fastest_time", fastestTime);
	
	// gameLocal.Printf(currentTime); gameLocal.Printf("\n");
}