Skip to content

Commit

Permalink
port: move prop info to imgui window
Browse files Browse the repository at this point in the history
  • Loading branch information
fgsfdsfgs committed Nov 25, 2023
1 parent 0cf6021 commit 5c152c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 39 deletions.
44 changes: 7 additions & 37 deletions port/src/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,41 +325,6 @@ extern "C" void debuggerUpdatePropInfo(s32 clear)
}
}

extern "C" Gfx *debuggerDrawPropInfo(Gfx *gdl)
{
if (!showPropInfo || !lookatprop) {
return gdl;
}

struct prop *prop = lookatprop;

char text[256] = { 0 };
s32 x = 4;
s32 y = 4;

gSPSetExtraGeometryModeEXT(gdl++, G_ASPECT_LEFT_EXT);
gdl = text0f153628(gdl);
gdl = text0f153838(gdl);

std::snprintf(text, sizeof(text), "looking at\nprop %p: %s (%02x)\n", prop, fmtPropType(prop->type), prop->type);
gdl = textRender(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, viGetWidth(), viGetHeight(), 0, 0);

if (prop->obj) {
std::snprintf(text, sizeof(text), "obj %p: %s (%02x) mdl %04x\n", prop->obj, fmtObjType(prop->obj->type), prop->obj->type, prop->obj->modelnum);
gdl = textRender(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, viGetWidth(), viGetHeight(), 0, 0);
}

if (prop->chr && (prop->type == PROPTYPE_CHR || prop->type == PROPTYPE_PLAYER || prop->type == PROPTYPE_EYESPY)) {
std::snprintf(text, sizeof(text), "chr %p: num %04x\n", prop->chr, prop->chr->chrnum);
gdl = textRender(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, viGetWidth(), viGetHeight(), 0, 0);
}

gdl = text0f153780(gdl);
gSPClearExtraGeometryModeEXT(gdl++, G_ASPECT_MODE_EXT);

return gdl;
}

static inline void debuggerTeleportPlayer(struct coord& crd)
{
sysLogPrintf(LOG_NOTE, "DBG: teleporting player 1 to (%.2f, %.2f, %.2f)", crd.x, crd.y, crd.z);
Expand Down Expand Up @@ -695,8 +660,6 @@ extern "C" void debuggerFrame(void)
}

ImGui::SeparatorText("Other");

ImGui::Checkbox("Show prop info", &showPropInfo);
}

if (ImGui::CollapsingHeader("Time")) {
Expand Down Expand Up @@ -854,6 +817,13 @@ extern "C" void debuggerFrame(void)
}
}

if ((showPropInfo = ImGui::CollapsingHeader("Looking at"))) {
if (lookatprop) {
ImGui::Text("Looking at prop");
describeProp(lookatprop);
}
}

ImGui::End();
}

Expand Down
2 changes: 0 additions & 2 deletions src/game/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -4867,8 +4867,6 @@ Gfx *playerRenderHud(Gfx *gdl)
gdl = playerDrawStoredFade(gdl);
}

gdl = debuggerDrawPropInfo(gdl);

return gdl;
}

Expand Down

0 comments on commit 5c152c1

Please sign in to comment.