diff options
| author | Garrett Cox <garrettjcox@gmail.com> | 2026-01-10 20:58:46 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-10 20:58:46 -0600 |
| commit | d055656237142eae7e1ec7b7bbaa835c69c85240 (patch) | |
| tree | 3e531d62361e9f7d2649b339d4f9e638dfaefba2 /mm/2s2h/DeveloperTools | |
| parent | 458faa34e497d558761594177db2ac952bb20a19 (diff) | |
Add crash handler ext (#1449)
Diffstat (limited to 'mm/2s2h/DeveloperTools')
| -rw-r--r-- | mm/2s2h/DeveloperTools/ActorViewer.cpp | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/mm/2s2h/DeveloperTools/ActorViewer.cpp b/mm/2s2h/DeveloperTools/ActorViewer.cpp index 6366cd013..dc0167ff7 100644 --- a/mm/2s2h/DeveloperTools/ActorViewer.cpp +++ b/mm/2s2h/DeveloperTools/ActorViewer.cpp @@ -7,6 +7,7 @@ #include <string> #include <vector> #include <unordered_map> +#include "2s2h/ShipUtils.h" extern "C" { #include "z64actor.h" @@ -21,44 +22,9 @@ typedef struct ActorInfo { Vec3s rot; } ActorInfo; -std::array<const char*, ACTORCAT_MAX> acMapping = { "Switch", "Background", "Player", "Explosive", "NPC", "Enemy", - "Prop", "Item/Action", "Misc.", "Boss", "Door", "Chest" }; - -#define DEFINE_ACTOR(name, _enumValue, _allocType, _debugName, _humanName) { _enumValue, _humanName }, -#define DEFINE_ACTOR_INTERNAL(_name, _enumValue, _allocType, _debugName, _humanName) { _enumValue, _humanName }, -#define DEFINE_ACTOR_UNSET(_enumValue) { _enumValue, "Unset" }, - -std::unordered_map<s16, const char*> actorDescriptions = { -#include "tables/actor_table.h" -}; - -#undef DEFINE_ACTOR -#undef DEFINE_ACTOR_INTERNAL -#undef DEFINE_ACTOR_UNSET - -#define DEFINE_ACTOR(name, _enumValue, _allocType, _debugName, _humanName) { _enumValue, _debugName }, -#define DEFINE_ACTOR_INTERNAL(_name, _enumValue, _allocType, _debugName, _humanName) { _enumValue, _debugName }, -#define DEFINE_ACTOR_UNSET(_enumValue) { _enumValue, "Unset" }, - -std::unordered_map<s16, const char*> actorDebugNames = { -#include "tables/actor_table.h" -}; - -#undef DEFINE_ACTOR -#undef DEFINE_ACTOR_INTERNAL -#undef DEFINE_ACTOR_UNSET - #define DEBUG_ACTOR_NAMETAG_TAG "debug_actor_viewer" #define CVAR_ACTOR_NAME_TAGS(val) "gDeveloperTools.ActorNameTags." val -std::string GetActorDescription(u16 actorNum) { - return actorDescriptions.contains(actorNum) ? actorDescriptions[actorNum] : "???"; -} - -std::string GetActorDebugName(u16 actorNum) { - return actorDebugNames.contains(actorNum) ? actorDebugNames[actorNum] : "???"; -} - std::vector<Actor*> GetCurrentSceneActors() { if (!gPlayState) { return {}; @@ -119,7 +85,7 @@ void ActorViewer_AddTagForActor(Actor* actor) { parts.push_back(GetActorDescription(actor->id)); } if (CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayCategory"), 0)) { - parts.push_back(acMapping[actor->category]); + parts.push_back(GetActorCategoryName(actor->category)); } if (CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayParams"), 0)) { parts.push_back(fmt::format("0x{:04X} ({})", (u16)actor->params, actor->params)); @@ -251,7 +217,7 @@ void ActorViewerWindow::DrawElement() { u8 count = 0; u8 prev_category = 0xff; for (size_t i = 0; i < list.size(); i++) { - std::string label = acMapping[list[i]->category]; + std::string label = GetActorCategoryName(list[i]->category); if (list[i]->category != prev_category) { prev_category = list[i]->category; count = 1; @@ -274,7 +240,7 @@ void ActorViewerWindow::DrawElement() { ImGui::BeginGroup(); ImGui::Text("ID: %hd", selectedActor->id); ImGui::Text("Description: %s", GetActorDescription(selectedActor->id).c_str()); - ImGui::Text("Category: %s", acMapping[selectedActor->category]); + ImGui::Text("Category: %s", GetActorCategoryName(selectedActor->category).c_str()); ImGui::Text("Params: %hd", selectedActor->params); ImGui::EndGroup(); |
