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

Method AddSecret

TombEngine/Scripting/Internal/TEN/Flow/FlowHandler.cpp:677–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

675}
676
677void FlowHandler::AddSecret(int levelSecretIndex)
678{
679 static constexpr unsigned int maxSecretIndex = CHAR_BIT * sizeof(unsigned int);
680
681 if (levelSecretIndex >= maxSecretIndex)
682 {
683 TENLog("Current maximum amount of secrets per level is " + std::to_string(maxSecretIndex) + ".", LogLevel::Warning);
684 return;
685 }
686
687 if (SaveGame::Statistics.SecretBits & (1 << levelSecretIndex))
688 return;
689
690 if (SaveGame::Statistics.Game.Secrets >= UINT_MAX)
691 {
692 TENLog("Maximum amount of level secrets is already reached!", LogLevel::Warning);
693 return;
694 }
695
696 PlaySecretTrack();
697 SaveGame::Statistics.SecretBits |= 1 << levelSecretIndex;
698 SaveGame::Statistics.Level.Secrets++;
699 SaveGame::Statistics.Game.Secrets++;
700}
701
702sol::table FlowHandler::GetSaveHeaders(sol::this_state state)
703{

Callers

nothing calls this directly

Calls 3

TENLogFunction · 0.85
to_stringFunction · 0.85
PlaySecretTrackFunction · 0.85

Tested by

no test coverage detected