DebugFont_DrawNumbers with POLY_FT4

This commit is contained in:
Niko 2023-04-09 10:45:53 -04:00
parent 1b91dbfddb
commit f60ad651bf

View File

@ -3,32 +3,26 @@
void DECOMP_DebugFont_DrawNumbers(int index, int screenPosX, int screenPosY)
{
unsigned short uVar1;
unsigned int *puVar2;
unsigned int *puVar3;
POLY_FT4* p;
unsigned int *ot;
unsigned int uVar4;
unsigned int uVar5;
unsigned int uVar6;
struct GameTracker* gGT = sdata->gGT;
int letterX = 6;
uVar6 = screenPosX + 7 & 0xffff;
uVar6 = screenPosX + 7;
uVar4 = (screenPosY + 7) * 0x10000;
// primitive memory
puVar2 = (unsigned int*)gGT->backBuffer->primMem.curr;
p = (POLY_FT4*)gGT->backBuffer->primMem.curr;
ot = (unsigned int*)gGT->tileView_UI.ptrOT;
gGT->backBuffer->primMem.curr = p + 1;
// OT memory
puVar3 = (unsigned int*)gGT->tileView_UI.ptrOT;
// append memory, so that future polygons draw after
// what we are about to add in this function
gGT->backBuffer->primMem.curr = puVar2 + 10;
puVar2[1] = 0x2e000000;
puVar2[2] = screenPosX & 0xffff | screenPosY << 0x10;
puVar2[8] = uVar6 | uVar4;
puVar2[4] = uVar6 | screenPosY << 0x10;
puVar2[6] = screenPosX & 0xffff | uVar4;
*(int*)&p->r0 = 0x2e000000;
*(int*)&p->x0 = screenPosX | screenPosY << 0x10;
*(int*)&p->x3 = uVar6 | uVar4;
*(int*)&p->x1 = uVar6 | screenPosY << 0x10;
*(int*)&p->x2 = screenPosX | uVar4;
// each character is 7 pixels wide
// and 7 pixels tall
@ -46,30 +40,14 @@ void DECOMP_DebugFont_DrawNumbers(int index, int screenPosX, int screenPosY)
// bit shift to top byte
uVar5 = uVar6 + 7 * 0x100;
// Top Left corner
puVar2[3] = uVar4 | uVar6;
*(int*)&p->u0 = uVar4 | uVar6;
*(int*)&p->u1 = uVar4 + 7 | uVar6;
*(int*)&p->u2 = uVar4 | uVar5;
*(int*)&p->u3 = uVar4 + 7 | uVar5;
// Top Right corner
puVar2[5] = uVar4 + 7 | uVar6;
p->clut = sdata->debugFont.clut;
p->tpage = sdata->debugFont.tpage;
// Bottom Left corner
puVar2[7] = uVar4 | uVar5;
// Bottom Right corner
puVar2[9] = uVar4 + 7 | uVar5;
// texture page
uVar1 = sdata->debugFont.tpage;
// color palette
*(unsigned short *)((int)puVar2 + 0xe) = sdata->debugFont.clut;
// optional: (I forget what this does, change color each frame?)
//*(unsigned short *)((int)puVar2 + 0xe) = gGT->timer >> 6;
// texture page
*(unsigned short *)((int)puVar2 + 0x16) = uVar1;
*puVar2 = *puVar3 | 0x9000000;
*puVar3 = (unsigned int)puVar2 & 0xffffff;
*(int*)p = *ot | 0x9000000;
*ot = (unsigned int)p & 0xffffff;
}