Skip to content

Commit cffbd65

Browse files
committed
Clean up
1 parent 9595b96 commit cffbd65

2 files changed

Lines changed: 10 additions & 195 deletions

File tree

soh/soh/Enhancements/gameplaystats.cpp

Lines changed: 10 additions & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ uint64_t GetUnixTimestamp();
4040
void Player_Action_Roll(Player* thisx, PlayState* play);
4141
}
4242

43-
// New
4443
#include <fstream>
4544
#include <filesystem>
4645
#include "TimeDisplay/TimeDisplay.h"
@@ -443,16 +442,16 @@ std::unordered_map<uint32_t, std::map<uint32_t, GameplayStatObject>> gameplayCou
443442
{ COUNT_TIME_BUNNY_HOOD, { STAT_TYPE_PLAYER, "Bunny Hood Time", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
444443
{ COUNT_PIECE_OF_HEART, { STAT_TYPE_PLAYER, "Collected - Piece of Heart", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
445444
{ COUNT_HEART_CONTAINER, { STAT_TYPE_PLAYER, "Collected - Heart Container", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
446-
{ COUNT_ICE_TRAPS, { STAT_TYPE_PLAYER, "Ice Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
447-
{ COUNT_BURN_TRAPS, { STAT_TYPE_PLAYER, "Burn Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
448-
{ COUNT_SHOCK_TRAPS, { STAT_TYPE_PLAYER, "Shock Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
449-
{ COUNT_KNOCK_TRAPS, { STAT_TYPE_PLAYER, "Knockback Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
450-
{ COUNT_SPEED_TRAPS, { STAT_TYPE_PLAYER, "Speed Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
451-
{ COUNT_BOMB_TRAPS, { STAT_TYPE_PLAYER, "Bomb Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
452-
{ COUNT_VOID_TRAPS, { STAT_TYPE_PLAYER, "Void Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
453-
{ COUNT_AMMO_TRAPS, { STAT_TYPE_PLAYER, "Ammo Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
454-
{ COUNT_KILL_TRAPS, { STAT_TYPE_PLAYER, "Kill Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
455-
{ COUNT_TELEPORT_TRAPS, { STAT_TYPE_PLAYER, "Teleport Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
445+
{ COUNT_ICE_TRAPS, { STAT_TYPE_PLAYER, "Trap - Ice Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
446+
{ COUNT_BURN_TRAPS, { STAT_TYPE_PLAYER, "Trap - Burn Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
447+
{ COUNT_SHOCK_TRAPS, { STAT_TYPE_PLAYER, "Trap - Shock Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
448+
{ COUNT_KNOCK_TRAPS, { STAT_TYPE_PLAYER, "Trap - Knockback Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
449+
{ COUNT_SPEED_TRAPS, { STAT_TYPE_PLAYER, "Trap - Speed Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
450+
{ COUNT_BOMB_TRAPS, { STAT_TYPE_PLAYER, "Trap - Bomb Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
451+
{ COUNT_VOID_TRAPS, { STAT_TYPE_PLAYER, "Trap - Void Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
452+
{ COUNT_AMMO_TRAPS, { STAT_TYPE_PLAYER, "Trap - Ammo Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
453+
{ COUNT_KILL_TRAPS, { STAT_TYPE_PLAYER, "Trap - Kill Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
454+
{ COUNT_TELEPORT_TRAPS, { STAT_TYPE_PLAYER, "Trap - Teleport Traps", UIWidgets::ColorValues.at(UIWidgets::Colors::White) } },
456455
}
457456
},
458457
};
@@ -498,14 +497,6 @@ static std::unordered_map<u16, u16> enemyIdToStatCount = {
498497
};
499498
// clang-format on
500499

501-
// End
502-
503-
const char* const countMappings[] = {
504-
"Deku Sticks:", "Deku Nuts:", "Bombs:", "Arrows:", "Deku Seeds:", "Bombchus:", "Beans:",
505-
"A:", "B:", "L:", "R:", "Z:", "C-Up:", "C-Right:",
506-
"C-Down:", "C-Left:", "D-Up:", "D-Right:", "D-Down:", "D-Left:", "Start:",
507-
};
508-
509500
std::string formatIntGameplayStat(uint32_t value) {
510501
return fmt::format("{}", value);
511502
}
@@ -529,26 +520,6 @@ void SaveStats(SaveContext* saveContext, int sectionID, bool fullSave) {
529520
SaveManager::Instance->SaveData("playTimer", saveContext->ship.stats.playTimer);
530521
SaveManager::Instance->SaveData("pauseTimer", saveContext->ship.stats.pauseTimer);
531522

532-
// SaveManager::Instance->SaveArray("dungeonKeys", ARRAY_COUNT(saveContext->ship.stats.dungeonKeys), [&](size_t i) {
533-
// SaveManager::Instance->SaveData("", saveContext->ship.stats.dungeonKeys[i]);
534-
// });
535-
// SaveManager::Instance->SaveArray(
536-
// "itemTimestamps", ARRAY_COUNT(saveContext->ship.stats.itemTimestamp),
537-
// [&](size_t i) { SaveManager::Instance->SaveData("", saveContext->ship.stats.itemTimestamp[i]); });
538-
// SaveManager::Instance->SaveArray(
539-
// "sceneTimestamps", ARRAY_COUNT(saveContext->ship.stats.sceneTimestamps), [&](size_t i) {
540-
// if (saveContext->ship.stats.sceneTimestamps[i].scene != 254 &&
541-
// saveContext->ship.stats.sceneTimestamps[i].room != 254) {
542-
// SaveManager::Instance->SaveStruct("", [&]() {
543-
// SaveManager::Instance->SaveData("scene", saveContext->ship.stats.sceneTimestamps[i].scene);
544-
// SaveManager::Instance->SaveData("room", saveContext->ship.stats.sceneTimestamps[i].room);
545-
// SaveManager::Instance->SaveData("sceneTime",
546-
// saveContext->ship.stats.sceneTimestamps[i].sceneTime);
547-
// SaveManager::Instance->SaveData("roomTime", saveContext->ship.stats.sceneTimestamps[i].roomTime);
548-
// SaveManager::Instance->SaveData("isRoom", saveContext->ship.stats.sceneTimestamps[i].isRoom);
549-
// });
550-
// }
551-
// });
552523
SaveManager::Instance->SaveData("tsIdx", saveContext->ship.stats.tsIdx);
553524
SaveManager::Instance->SaveArray("counts", ARRAY_COUNT(saveContext->ship.stats.count), [&](size_t i) {
554525
SaveManager::Instance->SaveData("", saveContext->ship.stats.count[i]);
@@ -565,160 +536,6 @@ void SaveStats(SaveContext* saveContext, int sectionID, bool fullSave) {
565536
// return CVarGetInteger(CVAR_GAMEPLAY_STATS("ReverseTimestamps"), 0) ? a.time > b.time : a.time < b.time;
566537
// }
567538

568-
void DrawGameplayStatsHeader() {
569-
// ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 4.0f, 4.0f });
570-
// ImGui::BeginTable("gameplayStatsHeader", 1, ImGuiTableFlags_BordersOuter);
571-
// ImGui::TableSetupColumn("stat", ImGuiTableColumnFlags_WidthStretch);
572-
//// if tag is empty (not a release build)
573-
// if (gGitCommitTag[0] == 0) {
574-
// GameplayStatsRow("Git Branch:", (char*)gGitBranch);
575-
// GameplayStatsRow("Git Commit Hash:", (char*)gGitCommitHash);
576-
// } else {
577-
// GameplayStatsRow("Build Version:", (char*)gBuildVersion);
578-
// }
579-
// if (gSaveContext.ship.stats.rtaTiming) {
580-
// GameplayStatsRow("Total Time (RTA):", formatTimeDisplay(GAMEPLAYSTAT_TOTAL_TIME),
581-
// gSaveContext.ship.stats.gameComplete ? COLOR_GREEN : COLOR_WHITE);
582-
// } else {
583-
// GameplayStatsRow("Total Game Time:", formatTimeDisplay(GAMEPLAYSTAT_TOTAL_TIME),
584-
// gSaveContext.ship.stats.gameComplete ? COLOR_GREEN : COLOR_WHITE);
585-
// }
586-
// if (CVarGetInteger(CVAR_GAMEPLAY_STATS("ShowAdditionalTimers"), 0)) { // !Only display total game time
587-
// GameplayStatsRow("Gameplay Time:", formatTimeDisplay(gSaveContext.ship.stats.playTimer / 2),
588-
// COLOR_GREY);
589-
// GameplayStatsRow("Pause Menu Time:", formatTimeDisplay(gSaveContext.ship.stats.pauseTimer / 3),
590-
// COLOR_GREY);
591-
// GameplayStatsRow("Time in scene:", formatTimeDisplay(gSaveContext.ship.stats.sceneTimer / 2),
592-
// COLOR_LIGHT_BLUE);
593-
// GameplayStatsRow("Time in room:", formatTimeDisplay(gSaveContext.ship.stats.roomTimer / 2),
594-
// COLOR_LIGHT_BLUE);
595-
// }
596-
// if (gPlayState != NULL && CVarGetInteger(CVAR_GAMEPLAY_STATS("ShowDebugInfo"), 0)) { // && display debug info
597-
// GameplayStatsRow("play->sceneNum:", formatHexGameplayStat(gPlayState->sceneNum), COLOR_YELLOW);
598-
// GameplayStatsRow("gSaveContext.entranceIndex:", formatHexGameplayStat(gSaveContext.entranceIndex),
599-
// COLOR_YELLOW);
600-
// GameplayStatsRow("gSaveContext.cutsceneIndex:", formatHexOnlyGameplayStat(gSaveContext.cutsceneIndex),
601-
// COLOR_YELLOW);
602-
// GameplayStatsRow("play->roomCtx.curRoom.num:", formatIntGameplayStat(gPlayState->roomCtx.curRoom.num),
603-
// COLOR_YELLOW);
604-
// }
605-
// ImGui::EndTable();
606-
// ImGui::PopStyleVar(1);
607-
}
608-
609-
void DrawGameplayStatsTimestampsTab() {
610-
//// Set up the array of item timestamps and then sort it chronologically
611-
// for (int i = 0; i < TIMESTAMP_MAX; i++) {
612-
// strcpy(itemTimestampDisplay[i].name, itemTimestampDisplayName[i]);
613-
// itemTimestampDisplay[i].time = gSaveContext.ship.stats.itemTimestamp[i];
614-
// itemTimestampDisplay[i].color = itemTimestampDisplayColor[i];
615-
// }
616-
//
617-
// std::sort(itemTimestampDisplay, itemTimestampDisplay + TIMESTAMP_MAX, compareTimestampInfoByTime);
618-
//
619-
// ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 4.0f, 4.0f });
620-
// ImGui::BeginTable("gameplayStatsTimestamps", 1, ImGuiTableFlags_BordersOuter);
621-
// ImGui::TableSetupColumn("stat", ImGuiTableColumnFlags_WidthStretch);
622-
// for (int i = 0; i < TIMESTAMP_MAX; i++) {
623-
// // To be shown, the entry must have a non-zero time and a string for its display name
624-
// if (itemTimestampDisplay[i].time > 0 && strnlen(itemTimestampDisplay[i].name, 21) > 1) {
625-
// GameplayStatsRow(itemTimestampDisplay[i].name, formatTimeDisplay(itemTimestampDisplay[i].time),
626-
// itemTimestampDisplay[i].color);
627-
// }
628-
// }
629-
// ImGui::EndTable();
630-
// ImGui::PopStyleVar(1);
631-
}
632-
633-
void DrawGameplayStatsCountsTab() {
634-
// u32 enemiesDefeated = 0;
635-
// u32 ammoUsed = 0;
636-
// u32 buttonPresses = 0;
637-
//
638-
// // Sum of all enemies defeated
639-
// for (int i = COUNT_ENEMIES_DEFEATED_ANUBIS; i <= COUNT_ENEMIES_DEFEATED_WOLFOS; i++) {
640-
// if (i == COUNT_ENEMIES_DEFEATED_FLOORMASTER) {
641-
// // Special case: You must kill 3 mini Floormasters for it count as one defeated Floormaster
642-
// enemiesDefeated += gSaveContext.ship.stats.count[i] / 3;
643-
// } else {
644-
// enemiesDefeated += gSaveContext.ship.stats.count[i];
645-
// }
646-
// }
647-
// // Sum of all ammo used
648-
// for (int i = COUNT_AMMO_USED_STICK; i <= COUNT_AMMO_USED_BEAN; i++) {
649-
// ammoUsed += gSaveContext.ship.stats.count[i];
650-
// }
651-
// // Sum of all button presses
652-
// for (int i = COUNT_BUTTON_PRESSES_A; i <= COUNT_BUTTON_PRESSES_START; i++) {
653-
// buttonPresses += gSaveContext.ship.stats.count[i];
654-
// }
655-
//
656-
// ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 4.0f, 4.0f });
657-
// ImGui::BeginTable("gameplayStatsCounts", 1, ImGuiTableFlags_BordersOuter);
658-
// ImGui::TableSetupColumn("stat", ImGuiTableColumnFlags_WidthStretch);
659-
// GameplayStatsRow("Enemies Defeated:", formatIntGameplayStat(enemiesDefeated));
660-
// if (enemiesDefeated > 0) {
661-
// ImGui::TableNextRow();
662-
// ImGui::TableNextColumn();
663-
// if (ImGui::TreeNodeEx("Enemy Details...", ImGuiTreeNodeFlags_NoTreePushOnOpen)) {
664-
// for (int i = COUNT_ENEMIES_DEFEATED_ANUBIS; i <= COUNT_ENEMIES_DEFEATED_WOLFOS; i++) {
665-
// if (i == COUNT_ENEMIES_DEFEATED_FLOORMASTER) {
666-
// GameplayStatsRow(countMappings[i], formatIntGameplayStat(gSaveContext.ship.stats.count[i] /
667-
// 3));
668-
// } else {
669-
// GameplayStatsRow(countMappings[i], formatIntGameplayStat(gSaveContext.ship.stats.count[i]));
670-
// }
671-
// }
672-
// }
673-
// }
674-
// GameplayStatsRow("Rupees Collected:",
675-
// formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_RUPEES_COLLECTED]),
676-
// COLOR_WHITE, "Includes rupees collected with a full wallet.");
677-
// GameplayStatsRow("Rupees Spent:", formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_RUPEES_SPENT]));
678-
// GameplayStatsRow("Chests Opened:", formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_CHESTS_OPENED]));
679-
// GameplayStatsRow("Ammo Used:", formatIntGameplayStat(ammoUsed));
680-
// if (ammoUsed > 0) {
681-
// ImGui::TableNextRow();
682-
// ImGui::TableNextColumn();
683-
// if (ImGui::TreeNodeEx("Ammo Details...", ImGuiTreeNodeFlags_NoTreePushOnOpen)) {
684-
// for (int i = COUNT_AMMO_USED_STICK; i <= COUNT_AMMO_USED_BEAN; i++) {
685-
// GameplayStatsRow(countMappings[i], formatIntGameplayStat(gSaveContext.ship.stats.count[i]));
686-
// }
687-
// }
688-
// }
689-
// GameplayStatsRow("Damage Taken:", formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_DAMAGE_TAKEN]));
690-
// GameplayStatsRow("Sword Swings:", formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_SWORD_SWINGS]));
691-
// GameplayStatsRow("Steps Taken:", formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_STEPS]));
692-
// // If using MM Bunny Hood enhancement, show how long it's been equipped (not counting pause time)
693-
// if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA ||
694-
// gSaveContext.ship.stats.count[COUNT_TIME_BUNNY_HOOD] > 0) {
695-
// GameplayStatsRow("Bunny Hood Time:",
696-
// formatTimeDisplay(gSaveContext.ship.stats.count[COUNT_TIME_BUNNY_HOOD] / 2));
697-
// }
698-
// GameplayStatsRow("Rolls:", formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_ROLLS]));
699-
// GameplayStatsRow("Bonks:", formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_BONKS]));
700-
// GameplayStatsRow("Sidehops:", formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_SIDEHOPS]));
701-
// GameplayStatsRow("Backflips:", formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_BACKFLIPS]));
702-
// GameplayStatsRow("Ice Traps:", formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_ICE_TRAPS]));
703-
// GameplayStatsRow("Pauses:", formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_PAUSES]));
704-
// GameplayStatsRow("Pots Smashed:", formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_POTS_BROKEN]));
705-
// GameplayStatsRow("Bushes Cut:", formatIntGameplayStat(gSaveContext.ship.stats.count[COUNT_BUSHES_CUT]));
706-
// GameplayStatsRow("Buttons Pressed:", formatIntGameplayStat(buttonPresses));
707-
// if (buttonPresses > 0) {
708-
// ImGui::TableNextRow();
709-
// ImGui::TableNextColumn();
710-
// if (ImGui::TreeNodeEx("Buttons...", ImGuiTreeNodeFlags_NoTreePushOnOpen)) {
711-
// for (int i = COUNT_BUTTON_PRESSES_A; i <= COUNT_BUTTON_PRESSES_START; i++) {
712-
// GameplayStatsRow(countMappings[i], formatIntGameplayStat(gSaveContext.ship.stats.count[i]));
713-
// }
714-
// }
715-
// }
716-
// ImGui::EndTable();
717-
// ImGui::PopStyleVar(1);
718-
}
719-
720-
// NEW REGION
721-
722539
nlohmann::json GameplayStats_ObjectToJson(const GameplayStatObject& entry) {
723540
return nlohmann::json{
724541
{ "entryType", entry.entryType },

soh/soh/Enhancements/gameplaystats.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
#include "soh/cvar_prefixes.h"
44
#include <stdint.h>
5-
#include <string>
6-
#include "imgui.h"
75

86
#ifdef __cplusplus
97
extern "C" {

0 commit comments

Comments
 (0)