MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / DrawStatistics

Method DrawStatistics

TombEngine/Renderer/RendererDrawMenu.cpp:709–768  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

707 }
708
709 void Renderer::DrawStatistics()
710 {
711 char buffer[40];
712
713 auto* lvl = g_GameFlow->GetLevel(CurrentLevel);
714 auto y = MenuVerticalStatisticsTitle;
715 auto plainColor = g_GameFlow->GetSettings()->UI.PlainTextColor;
716
717 // Title
718 AddString(MenuCenterEntry, y, g_GameFlow->GetString(STRING_STATISTICS), g_GameFlow->GetSettings()->UI.HeaderTextColor, SF_Center());
719 GetNextBlockPosition(&y);
720
721 // Level name
722 AddString(MenuCenterEntry, y, g_GameFlow->GetString(lvl->NameStringKey.c_str()), plainColor, SF_Center());
723 GetNextBlockPosition(&y);
724
725 // Time taken
726 auto& gameTime = SaveGame::Statistics.Game.TimeTaken;
727 sprintf(buffer, "%02d:%02d:%02d", gameTime.GetHours(), gameTime.GetMinutes(), gameTime.GetSeconds());
728 AddString(MenuRightSideEntry, y, buffer, plainColor, SF());
729 AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_TIME_TAKEN), plainColor, SF());
730 GetNextLinePosition(&y);
731
732 // Distance travelled
733 sprintf(buffer, "%dm", SaveGame::Statistics.Game.Distance / UnitsToMeters);
734 AddString(MenuRightSideEntry, y, buffer, plainColor, SF());
735 AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_DISTANCE_TRAVELLED), plainColor, SF());
736 GetNextLinePosition(&y);
737
738 // Ammo used
739 sprintf(buffer, "%d", SaveGame::Statistics.Game.AmmoUsed);
740 AddString(MenuRightSideEntry, y, buffer, plainColor, SF());
741 AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_AMMO_USED), plainColor, SF());
742 GetNextLinePosition(&y);
743
744 // Medipacks used
745 sprintf(buffer, "%d", SaveGame::Statistics.Game.HealthUsed);
746 AddString(MenuRightSideEntry, y, buffer, plainColor, SF());
747 AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_USED_MEDIPACKS), plainColor, SF());
748 GetNextLinePosition(&y);
749
750 // Secrets found in Level
751 if (g_GameFlow->GetLevel(CurrentLevel)->GetSecrets() > 0)
752 {
753 sprintf(buffer, "%d / %d", SaveGame::Statistics.Level.Secrets, g_GameFlow->GetLevel(CurrentLevel)->GetSecrets());
754 AddString(MenuRightSideEntry, y, buffer, plainColor, SF());
755 AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_LEVEL_SECRETS_FOUND), plainColor, SF());
756 GetNextLinePosition(&y);
757 }
758
759 // Secrets found total
760 if (g_GameFlow->TotalNumberOfSecrets > 0)
761 {
762 sprintf(buffer, "%d / %d", SaveGame::Statistics.Game.Secrets, g_GameFlow->TotalNumberOfSecrets);
763 AddString(MenuRightSideEntry, y, buffer, plainColor, SF());
764 AddString(MenuLeftSideEntry, y, g_GameFlow->GetString(STRING_TOTAL_SECRETS_FOUND), plainColor, SF());
765 }
766

Callers

nothing calls this directly

Calls 13

SF_CenterFunction · 0.85
GetNextBlockPositionFunction · 0.85
sprintfFunction · 0.85
SFFunction · 0.85
GetNextLinePositionFunction · 0.85
GetLevelMethod · 0.80
GetSettingsMethod · 0.80
GetStringMethod · 0.80
GetHoursMethod · 0.80
GetMinutesMethod · 0.80
GetSecondsMethod · 0.80
GetSecretsMethod · 0.80

Tested by

no test coverage detected