Move collision viewer draw to hook and fix empty nametags (#4523)

This commit is contained in:
Archez 2024-11-05 21:50:59 -05:00 committed by GitHub
parent 894d3c00d3
commit dabd0c25bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 7 deletions

View File

@ -8,6 +8,7 @@
#include <libultraship/bridge.h> #include <libultraship/bridge.h>
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#include "soh/OTRGlobals.h" #include "soh/OTRGlobals.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h"
extern "C" { extern "C" {
#include <z64.h> #include <z64.h>
@ -276,11 +277,6 @@ void CreateSphereData() {
sphereGfx.push_back(gsSPEndDisplayList()); sphereGfx.push_back(gsSPEndDisplayList());
} }
void ColViewerWindow::InitElement() {
CreateCylinderData();
CreateSphereData();
}
// Initializes the display list for a ColRenderSetting // Initializes the display list for a ColRenderSetting
void InitGfx(std::vector<Gfx>& gfx, ColRenderSetting setting) { void InitGfx(std::vector<Gfx>& gfx, ColRenderSetting setting) {
uint32_t rm; uint32_t rm;
@ -689,3 +685,10 @@ extern "C" void DrawColViewer() {
CLOSE_DISPS(gPlayState->state.gfxCtx); CLOSE_DISPS(gPlayState->state.gfxCtx);
} }
void ColViewerWindow::InitElement() {
CreateCylinderData();
CreateSphereData();
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnPlayDrawEnd>(DrawColViewer);
}

View File

@ -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) { processedText.erase(std::remove_if(processedText.begin(), processedText.end(), [](const char& c) {
// 172 is max supported texture for the in-game font system, // 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 // 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()); }), processedText.end());
int16_t numChar = processedText.length(); int16_t numChar = processedText.length();

View File

@ -300,7 +300,6 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
GameState_ReqPadData(gameState); GameState_ReqPadData(gameState);
GameState_Update(gameState); GameState_Update(gameState);
DrawColViewer();
OPEN_DISPS(gfxCtx); OPEN_DISPS(gfxCtx);