2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 05:47:42 +00:00

Massive fmtlib refactor

This commit is contained in:
Jack Andersen
2019-07-19 18:27:21 -10:00
parent e38a3ece89
commit 7a3da1f7a6
228 changed files with 2071 additions and 2116 deletions

View File

@@ -402,12 +402,13 @@ void CMain::Give(hecl::Console* console, const std::vector<std::string>& args) {
} else {
CPlayerState::EItemType eType = CPlayerState::ItemNameToType(type);
if (eType == CPlayerState::EItemType::Invalid) {
console->report(hecl::Console::Level::Info, "Invalid item %s", type.c_str());
console->report(hecl::Console::Level::Info, fmt("Invalid item {}"), type);
return;
}
if (eType == CPlayerState::EItemType::HealthRefill) {
pState->IncrPickup(eType, 9999);
console->report(hecl::Console::Level::Info, "Cheater....., Greatly increasing Metroid encounters, have fun!");
console->report(hecl::Console::Level::Info,
fmt("Cheater....., Greatly increasing Metroid encounters, have fun!"));
if (g_StateManager)
g_StateManager->Player()->AsyncLoadSuit(*g_StateManager);
return;
@@ -437,7 +438,7 @@ void CMain::Give(hecl::Console* console, const std::vector<std::string>& args) {
}
if (g_StateManager)
g_StateManager->Player()->AsyncLoadSuit(*g_StateManager);
console->report(hecl::Console::Level::Info, "Cheater....., Greatly increasing Metroid encounters, have fun!");
console->report(hecl::Console::Level::Info, fmt("Cheater....., Greatly increasing Metroid encounters, have fun!"));
}
void CMain::Remove(hecl::Console*, const std::vector<std::string>& args) {
@@ -459,9 +460,9 @@ void CMain::God(hecl::Console* con, const std::vector<std::string>&) {
if (g_GameState && g_GameState->GetPlayerState()) {
g_GameState->GetPlayerState()->SetCanTakeDamage(!g_GameState->GetPlayerState()->CanTakeDamage());
if (!g_GameState->GetPlayerState()->CanTakeDamage())
con->report(hecl::Console::Level::Info, "God Mode Enabled");
con->report(hecl::Console::Level::Info, fmt("God Mode Enabled"));
else
con->report(hecl::Console::Level::Info, "God Mode Disabled");
con->report(hecl::Console::Level::Info, fmt("God Mode Disabled"));
}
}
@@ -492,7 +493,7 @@ void CMain::ListWorlds(hecl::Console* con, const std::vector<std::string>&) {
if (pak->IsWorldPak()) {
for (const auto& named : pak->GetNameList())
if (named.second.type == SBIG('MLVL')) {
con->report(hecl::Console::Level::Info, "%s '%08X'", named.first.c_str(), named.second.id.Value());
con->report(hecl::Console::Level::Info, fmt("{} '{}'"), named.first, named.second.id);
}
}
}
@@ -610,7 +611,7 @@ void CMain::UpdateDiscordPresence(CAssetId worldSTRG) {
u32 itemPercent = pState->CalculateItemCollectionRate() * 100 / pState->GetPickupTotal();
if (DiscordItemPercent != itemPercent) {
DiscordItemPercent = itemPercent;
DiscordState = hecl::Format("%d%%", itemPercent);
DiscordState = fmt::format(fmt("{}%"), itemPercent);
updated = true;
}
}
@@ -626,14 +627,14 @@ void CMain::UpdateDiscordPresence(CAssetId worldSTRG) {
}
}
void CMain::HandleDiscordReady(const DiscordUser* request) { DiscordLog.report(logvisor::Info, "Discord Ready"); }
void CMain::HandleDiscordReady(const DiscordUser* request) { DiscordLog.report(logvisor::Info, fmt("Discord Ready")); }
void CMain::HandleDiscordDisconnected(int errorCode, const char* message) {
DiscordLog.report(logvisor::Warning, "Discord Disconnected: %s", message);
DiscordLog.report(logvisor::Warning, fmt("Discord Disconnected: {}"), message);
}
void CMain::HandleDiscordErrored(int errorCode, const char* message) {
DiscordLog.report(logvisor::Error, "Discord Error: %s", message);
DiscordLog.report(logvisor::Error, fmt("Discord Error: {}"), message);
}
void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr, hecl::CVarManager* cvarMgr, boo::IWindow* window,
@@ -754,7 +755,7 @@ void CMain::WarmupShaders() {
m_warmupIt = m_warmupTags.begin();
WarmupLog.report(logvisor::Info, "Began warmup of %" PRISize " objects", m_warmupTags.size());
WarmupLog.report(logvisor::Info, fmt("Began warmup of {} objects"), m_warmupTags.size());
}
bool CMain::Proc() {
@@ -799,8 +800,8 @@ void CMain::Draw() {
}
auto startTime = std::chrono::steady_clock::now();
while (m_warmupIt != m_warmupTags.end()) {
WarmupLog.report(logvisor::Info, "[%d / %d] Warming %.4s %08X", int(m_warmupIt - m_warmupTags.begin() + 1),
int(m_warmupTags.size()), m_warmupIt->type.getChars(), m_warmupIt->id.Value());
WarmupLog.report(logvisor::Info, fmt("[{} / {}] Warming {}"), int(m_warmupIt - m_warmupTags.begin() + 1),
int(m_warmupTags.size()), *m_warmupIt);
if (m_warmupIt->type == FOURCC('CMDL'))
CModel::WarmupShaders(*m_warmupIt);
@@ -815,7 +816,7 @@ void CMain::Draw() {
}
if (m_warmupIt == m_warmupTags.end()) {
m_warmupTags = std::vector<SObjectTag>();
WarmupLog.report(logvisor::Info, "Finished warmup");
WarmupLog.report(logvisor::Info, fmt("Finished warmup"));
}
return;
}