예제 #1
0
파일: stats.cpp 프로젝트: 1Akula1/gzdoom
void FStat::PrintStat ()
{
	int fontheight = ConFont->GetHeight() + 1;
	int y = SCREENHEIGHT;
	int count = 0;

	for (FStat *stat = FirstStat; stat != NULL; stat = stat->m_Next)
	{
		if (stat->m_Active)
		{
			FString stattext(stat->GetStats());

			if (stattext.Len() > 0)
			{
				y -= fontheight;	// there's at least one line of text
				for (unsigned i = 0; i < stattext.Len()-1; i++)
				{
					// Count number of linefeeds but ignore terminating ones.
					if (stattext[i] == '\n') y -= fontheight;
				}
				screen->DrawText(ConFont, CR_GREEN, 5, y, stattext, TAG_DONE);
				count++;
			}
		}
	}
	if (count)
	{
		ST_SetNeedRefresh();
	}
}
예제 #2
0
void FStat::ToggleStat (const char *name)
{
	FStat *stat = FindStat (name);
	if (stat)
		stat->ToggleStat ();
	else
		Printf ("Unknown stat: %s\n", name);
}
예제 #3
0
void FStat::PrintStat ()
{
	int fontheight = ConFont->GetHeight() + 1;
	// [BC] The server doesn't actually load any fonts.
	int y = ( NETWORK_GetState( ) == NETSTATE_SERVER ) ? 0 : SCREENHEIGHT;
	int count = 0;

	for (FStat *stat = FirstStat; stat != NULL; stat = stat->m_Next)
	{
		if (stat->m_Active)
		{
			FString stattext(stat->GetStats());

			if (stattext.Len() > 0)
			{
				// [BC] In server mode, just display the stats in the console.
				if ( NETWORK_GetState( ) == NETSTATE_SERVER )
					Printf( "%s\n", stattext.GetChars() );
				else
				{
					y -= fontheight;	// there's at least one line of text
					for (unsigned i = 0; i < stattext.Len()-1; i++)
					{
						// Count number of linefeeds but ignore terminating ones.
						if (stattext[i] == '\n') y -= fontheight;
					}
					screen->DrawText(ConFont, CR_GREEN, 5, y, stattext, TAG_DONE);
					count++;
				}
			}
		}
	}
	if (count)
	{
		ST_SetNeedRefresh();
	}
}