From dabd0c25bd716a2ec37ec0137881a61045b03c02 Mon Sep 17 00:00:00 2001 From: Archez Date: Tue, 5 Nov 2024 21:50:59 -0500 Subject: [PATCH] Move collision viewer draw to hook and fix empty nametags (#4523) --- soh/soh/Enhancements/debugger/colViewer.cpp | 13 ++++++++----- soh/soh/Enhancements/nametag.cpp | 2 +- soh/src/code/graph.c | 1 - 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/soh/soh/Enhancements/debugger/colViewer.cpp b/soh/soh/Enhancements/debugger/colViewer.cpp index 8ce5f8b50..5139576ce 100644 --- a/soh/soh/Enhancements/debugger/colViewer.cpp +++ b/soh/soh/Enhancements/debugger/colViewer.cpp @@ -8,6 +8,7 @@ #include #include #include "soh/OTRGlobals.h" +#include "soh/Enhancements/game-interactor/GameInteractor.h" extern "C" { #include @@ -276,11 +277,6 @@ void CreateSphereData() { sphereGfx.push_back(gsSPEndDisplayList()); } -void ColViewerWindow::InitElement() { - CreateCylinderData(); - CreateSphereData(); -} - // Initializes the display list for a ColRenderSetting void InitGfx(std::vector& gfx, ColRenderSetting setting) { uint32_t rm; @@ -689,3 +685,10 @@ extern "C" void DrawColViewer() { CLOSE_DISPS(gPlayState->state.gfxCtx); } + +void ColViewerWindow::InitElement() { + CreateCylinderData(); + CreateSphereData(); + + GameInteractor::Instance->RegisterGameHook(DrawColViewer); +} diff --git a/soh/soh/Enhancements/nametag.cpp b/soh/soh/Enhancements/nametag.cpp index 8435b6b26..fa88c9aeb 100644 --- a/soh/soh/Enhancements/nametag.cpp +++ b/soh/soh/Enhancements/nametag.cpp @@ -201,7 +201,7 @@ extern "C" void NameTag_RegisterForActorWithOptions(Actor* actor, const char* te processedText.erase(std::remove_if(processedText.begin(), processedText.end(), [](const char& c) { // 172 is max supported texture for the in-game font system, // and filter anything less than a space but not the newline or nul characters - return c > (s8)172 || (c < ' ' && c != '\n' && c != '\0'); + return (unsigned char)c > 172 || (c < ' ' && c != '\n' && c != '\0'); }), processedText.end()); int16_t numChar = processedText.length(); diff --git a/soh/src/code/graph.c b/soh/src/code/graph.c index 6a49117dd..f691c2619 100644 --- a/soh/src/code/graph.c +++ b/soh/src/code/graph.c @@ -300,7 +300,6 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { GameState_ReqPadData(gameState); GameState_Update(gameState); - DrawColViewer(); OPEN_DISPS(gfxCtx);