UI progress

This commit is contained in:
Niko 2023-04-08 18:03:57 -04:00
parent 3bdb6522a4
commit 119a34e7c9
7 changed files with 208 additions and 183 deletions

View File

@ -22,6 +22,8 @@ void DECOMP_UI_JumpMeter_Draw(short posX, short posY, struct Driver* driver)
u_int auStack48 [2];
int jumpMeterHeight;
int whateverThisIs;
gGT = sdata->gGT;
iVar5 = ((int)driver->jumpMeter / 0x3c0) * 0x10000 >> 0x10;
whateverThisIs = (int)driver->jumpMeter + iVar5 * -0x3c0;
@ -41,9 +43,9 @@ void DECOMP_UI_JumpMeter_Draw(short posX, short posY, struct Driver* driver)
box.y = jumpMeter;
memset(auStack64, 0, 4);
CTR_Box_DrawWireBox(&box, auStack64, sdata->gGT->tileView_UI.ptrOT, &sdata->gGT->backBuffer->primMem);
CTR_Box_DrawWireBox(&box, auStack64, gGT->tileView_UI.ptrOT, &gGT->backBuffer->primMem);
backDB = sdata->gGT->backBuffer;
backDB = gGT->backBuffer;
primmemCurr = backDB->primMem.curr;
p = 0;
@ -58,7 +60,6 @@ void DECOMP_UI_JumpMeter_Draw(short posX, short posY, struct Driver* driver)
if (p != 0)
{
*(u_int *)&p->r0 = 0x28ffffff;
gGT = sdata->gGT;
p->x1 = posX + 0xe;
p->x3 = posX + 0xe;
p->x0 = sVar9;
@ -69,7 +70,7 @@ void DECOMP_UI_JumpMeter_Draw(short posX, short posY, struct Driver* driver)
p->y3 = posY - 0x23;
// pointer to OT memory
primmemCurr = sdata->gGT->tileView_UI.ptrOT;
primmemCurr = gGT->tileView_UI.ptrOT;
*(int*)p = *primmemCurr | 0x5000000;
*primmemCurr = (u_int)p & 0xffffff;
@ -80,9 +81,9 @@ void DECOMP_UI_JumpMeter_Draw(short posX, short posY, struct Driver* driver)
box2.x = posX;
memset(auStack48, 0, 4);
CTR_Box_DrawWireBox(&box2, auStack48, sdata->gGT->tileView_UI.ptrOT, &sdata->gGT->backBuffer->primMem);
CTR_Box_DrawWireBox(&box2, auStack48, gGT->tileView_UI.ptrOT, &gGT->backBuffer->primMem);
backDB = sdata->gGT->backBuffer;
backDB = gGT->backBuffer;
primmemCurr = backDB->primMem.curr;
p = 0;
@ -124,7 +125,6 @@ void DECOMP_UI_JumpMeter_Draw(short posX, short posY, struct Driver* driver)
p->y2 = posY;
p->x3 = sVar9;
p->y3 = posY;
gGT = sdata->gGT;
jumpMeter = posY - ((short)(jumpMeterHeight / 0x960) - (short)(jumpMeterHeight / 0x80000000));
p->y0 = jumpMeter;
p->y1 = jumpMeter;
@ -134,7 +134,7 @@ void DECOMP_UI_JumpMeter_Draw(short posX, short posY, struct Driver* driver)
*(int*)p = *primmemCurr | 0x5000000;
*primmemCurr = (u_int)p & 0xffffff;
backDB = sdata->gGT->backBuffer;
backDB = gGT->backBuffer;
primmemCurr = backDB->primMem.curr;
p = 0;
@ -149,7 +149,6 @@ void DECOMP_UI_JumpMeter_Draw(short posX, short posY, struct Driver* driver)
if (p != 0)
{
*(u_int *)&p->r0 = 0x28808080;
gGT = sdata->gGT;
p->x0 = posX;
p->y0 = posY - 0x26;
p->x1 = sVar9;

View File

@ -38,7 +38,7 @@ void DECOMP_UI_RenderFrame_Racing()
u_char bVar3;
int partTimeVariable1;
u_int partTimeVariable4;
u_char **ppuVar5;
int* ptrColor;
u_char *pbVar6;
int i;
struct TileView *tileView;
@ -649,13 +649,13 @@ void DECOMP_UI_RenderFrame_Racing()
backBuffer = gGT->backBuffer;
// Get Color Data
ppuVar5 = (u_char **)&data.ptrColor[sVar17];
ptrColor = data.ptrColor[sVar17];
// Four colors, one for each corner
local_7c = *ppuVar5[0];
local_78 = *ppuVar5[1];
local_74 = *ppuVar5[2];
local_70 = *ppuVar5[3];
local_7c = ptrColor[0];
local_78 = ptrColor[1];
local_74 = ptrColor[2];
local_70 = ptrColor[3];
// icon pointer, specifically for the big rank icons that start at 0x19
iconPtr = gGT->ptrIcons[(int)playerStruct->driverRank + 0x19];
@ -706,13 +706,13 @@ void DECOMP_UI_RenderFrame_Racing()
backBuffer = gGT->backBuffer;
// Get Color Data
ppuVar5 = (u_char **)&data.ptrColor[partTimeVariable5];
ptrColor = data.ptrColor[partTimeVariable5];
// Four colors, one for each corner
local_7c = *ppuVar5[0];
local_78 = *ppuVar5[1];
local_74 = *ppuVar5[2];
local_70 = *ppuVar5[3];
local_7c = ptrColor[0];
local_78 = ptrColor[1];
local_74 = ptrColor[2];
local_70 = ptrColor[3];
// pointer to icon
// get rank icon of each battle team after battle is over

View File

@ -23,8 +23,8 @@ common, exe, TileView_UpdateFrustum, 0x0, src/TileView_UpdateFrustum.c
// note to self, still need UI_DrawRankedDrivers,
// squish 11 functions
// all decompile folder except for: UI_DrawSlideMeter, UI_DrawSpeedBG, UI_DrawSpeedNeedle
common, exe, UI_DrawNumWumpa, 0x0, ../../../Decompile/General/UI/UI_DrawNumWumpa.c ../../../Decompile/General/UI/UI_DrawNumKey.c ../../../Decompile/General/UI/UI_DrawNumRelic.c ../../../Decompile/General/UI/UI_DrawNumTrophy.c ../../../Decompile/General/UI/UI_DrawNumCrystal.c ../../../Decompile/General/UI/UI_DrawNumTimebox.c src/UI_DrawSpeedBG.c src/UI_DrawSpeedNeedle.c ../../../Decompile/General/UI/UI_JumpMeter_Draw.c ../../../Decompile/General/UI/UI_JumpMeter_Update.c src/UI_DrawSlideMeter.c, UI_ElevenFuncs.bin
// all decompile folder except for: UI_DrawSlideMeter, UI_DrawSpeedNeedle
common, exe, UI_DrawNumWumpa, 0x0, ../../../Decompile/General/UI/UI_DrawNumWumpa.c ../../../Decompile/General/UI/UI_DrawNumKey.c ../../../Decompile/General/UI/UI_DrawNumRelic.c ../../../Decompile/General/UI/UI_DrawNumTrophy.c ../../../Decompile/General/UI/UI_DrawNumCrystal.c ../../../Decompile/General/UI/UI_DrawNumTimebox.c ../../../Decompile/General/UI/UI_DrawSpeedBG.c src/UI_DrawSpeedNeedle.c src/UI_JumpMeter_Draw.c ../../../Decompile/General/UI/UI_JumpMeter_Update.c src/UI_DrawSlideMeter.c, UI_ElevenFuncs.bin
// Requierd for relocated 11 UI functions
common, exe, UI_RenderFrame_Racing, 0x0, ../../../Decompile/General/UI/UI_RenderFrame_Racing.c

View File

@ -18,7 +18,6 @@ void DECOMP_UI_DrawSlideMeter(short posX, short posY, struct Driver* driver)
// === widescreen ===
// replace every 0x31 with 37(dec)
// also move everything 0x31/2 pixels left
meterLength = 0;
@ -56,7 +55,7 @@ void DECOMP_UI_DrawSlideMeter(short posX, short posY, struct Driver* driver)
// length of rectangle is currentRoom / maxRoom
meterLength = 37 - (short)(currentRoomRemaining / maxRoom);
}
box.x = posX - 37 - 37/4;
box.x = posX - 37;
box.y = posY - meterHeight;
box.w = 37;
box.h = meterHeight;
@ -98,14 +97,14 @@ void DECOMP_UI_DrawSlideMeter(short posX, short posY, struct Driver* driver)
*(u_int *)&p->r0 = colorAndCode;
gGT = sdata->gGT;
meterHeight = posY - meterHeight;
p->x0 = posX - meterLength - 37/4;
p->x0 = posX - meterLength;
p->y0 = meterHeight;
p->x1 = posX - 37/4;
p->x1 = posX;
p->y1 = meterHeight;
p->y2 = posY;
p->x3 = posX - 37/4;
p->x3 = posX;
p->y3 = posY;
p->x2 = posX - meterLength - 37/4;
p->x2 = posX - meterLength;
// pointer to OT memory
primmemCurr = gGT->tileView_UI.ptrOT;
@ -125,14 +124,14 @@ void DECOMP_UI_DrawSlideMeter(short posX, short posY, struct Driver* driver)
{
*(u_int *)&p->r0 = 0x28808080;
gGT = sdata->gGT;
p->x0 = posX - 37 - 37/4;
p->x0 = posX - 37;
p->y0 = meterHeight;
p->x1 = posX - 37/4;
p->x1 = posX;
p->y1 = meterHeight;
p->y2 = posY;
p->x3 = posX - 37/4;
p->x3 = posX;
p->y3 = posY;
p->x2 = posX - 37 - 37/4;
p->x2 = posX - 37;
// pointer to OT memory
primmemCurr = gGT->tileView_UI.ptrOT;

View File

@ -1,151 +0,0 @@
#include <common.h>
// at bottom of file
extern unsigned short DrawSpeedBG_Colors[6*2];
// speedometer background
void DECOMP_UI_DrawSpeedBG(void)
{
struct GameTracker* gGT;
u_int color_gradient0, color_gradient1;
u_long* ot;
POLY_G4 *p;
short* vertData;
short* upperHalf;
struct DB* backDB;
int i;
gGT = sdata->gGT;
vertData = &data.speedometerBG_vertData;
upperHalf = &vertData[0x1c];
backDB = gGT->backBuffer;
for (i = 0; i < 7; i++)
{
// white
CTR_Box_DrawWirePrims(
upperHalf[0] + 0x1e0, upperHalf[1] + 0xbe,
upperHalf[2] + 0x1e0, upperHalf[3] + 0xbe,
0xff, 0xff, 0xff,
gGT->tileView_UI.ptrOT,
&backDB->primMem);
// black
CTR_Box_DrawWirePrims(
upperHalf[0] + 0x1e1, upperHalf[1] + 0xbf,
upperHalf[2] + 0x1e1, upperHalf[3] + 0xbf,
0, 0, 0,
gGT->tileView_UI.ptrOT,
&backDB->primMem);
upperHalf += 4;
}
for (i = 0; i < 6; i++)
{
// white
CTR_Box_DrawWirePrims(
vertData[0] + 0x1e0, vertData[1] + 0xbe,
vertData[4] + 0x1e0, vertData[5] + 0xbe,
0xff, 0xff, 0xff,
gGT->tileView_UI.ptrOT,
&backDB->primMem);
// white
CTR_Box_DrawWirePrims(
vertData[2] + 0x1e0, vertData[3] + 0xbe,
vertData[6] + 0x1e0, vertData[7] + 0xbe,
0xff, 0xff, 0xff,
gGT->tileView_UI.ptrOT,
&backDB->primMem);
// black
CTR_Box_DrawWirePrims(
vertData[0] + 0x1e1, vertData[1] + 0xbf,
vertData[4] + 0x1e1, vertData[5] + 0xbf,
0, 0, 0,
gGT->tileView_UI.ptrOT,
&backDB->primMem);
// black
CTR_Box_DrawWirePrims(
vertData[2] + 0x1e1, vertData[3] + 0xbf,
vertData[6] + 0x1e1, vertData[7] + 0xbf,
0, 0, 0,
gGT->tileView_UI.ptrOT,
&backDB->primMem);
// reset prim
p = backDB->primMem.curr;
if (p > (u_long *)backDB->primMem.endMin100)
return;
backDB->primMem.curr = p + 1;
color_gradient0 = DrawSpeedBG_Colors[i*2 + 0];
color_gradient1 = DrawSpeedBG_Colors[i*2 + 1];
*(int*)&p->r0 = color_gradient0; // RGB0
*(int*)&p->r1 = color_gradient0; // RGB1
*(int*)&p->r2 = color_gradient1; // RGB2
*(int*)&p->r3 = color_gradient1; // RGB3
setPolyG4(p);
setXY4(p,
vertData[0] + 0x1e0, vertData[1] + 0xbe,
vertData[2] + 0x1e0, vertData[3] + 0xbe,
vertData[4] + 0x1e0, vertData[5] + 0xbe,
vertData[6] + 0x1e0, vertData[7] + 0xbe);
// inline AddPrim
ot = gGT->tileView_UI.ptrOT;
*(int*)p = *ot | 0x8000000;
*ot = (u_int)p & 0xffffff;
vertData += 4;
}
vertData = &data.speedometerBG_vertData;
for (i = 0; i < 6; i++)
{
p = backDB->primMem.curr;
if (p > (u_long *)backDB->primMem.endMin100)
return;
backDB->primMem.curr = p + 1;
setlen(p, 8);
setcode(p, 0xe1);
setRGB0(p, 0, 0xa, 0);
setRGB1(p, 0, 0, 0);
setRGB2(p, 0, 0, 0);
setRGB3(p, 0, 0, 0);
p->pad0 = 0x32;
setXY4(p, 0, 0,
vertData[2] + 0x1e0, vertData[3] + 0xbe,
vertData[6] + 0x1e0, vertData[7] + 0xbe,
data.speedometerBG_vertData[0x1a] + 0x1e0, data.speedometerBG_vertData[3] + 0xbe);
// inline AddPrim
ot = gGT->tileView_UI.ptrOT;
*(int*)p = *ot | 0x8000000;
*ot = (u_int)p & 0xffffff;
vertData += 4;
}
return;
}
#define SPEEDO_GREEN 0xb500
#define SPEEDO_YELLOW 0xd1ff
#define SPEEDO_RED 0xdb
unsigned short DrawSpeedBG_Colors[6*2] =
{
SPEEDO_GREEN, SPEEDO_GREEN,
SPEEDO_GREEN, SPEEDO_GREEN,
SPEEDO_GREEN, SPEEDO_YELLOW,
SPEEDO_YELLOW, SPEEDO_RED,
SPEEDO_RED, SPEEDO_RED,
SPEEDO_RED, SPEEDO_RED
};

View File

@ -0,0 +1,170 @@
#include <common.h>
void DebugFont_DrawNumbers(int param_1, u_int param_2, int param_3);
void CTR_Box_DrawWireBox(RECT* r, int* unk, u_long* ot, struct PrimMem* primMem);
void DECOMP_UI_JumpMeter_Draw(short posX, short posY, struct Driver* driver)
{
struct GameTracker *gGT;
u_int colorAndCode;
short jumpMeter;
struct DB* backDB;
int iVar5;
u_long *primmemCurr;
POLY_F4 *p;
int iVar8;
short sVar9;
int iVar10;
int iVar11;
RECT box;
u_int auStack64 [2];
RECT box2;
u_int auStack48 [2];
int jumpMeterHeight;
int whateverThisIs;
gGT = sdata->gGT;
iVar5 = ((int)driver->jumpMeter / 0x3c0) * 0x10000 >> 0x10;
whateverThisIs = (int)driver->jumpMeter + iVar5 * -0x3c0;
iVar10 = ((whateverThisIs / 6 + (whateverThisIs >> 0x1f) >> 4) - (whateverThisIs >> 0x1f)) * 0x10000 >> 0x10;
iVar11 = (int)posX;
iVar8 = (int)posY + -0x2b;
DebugFont_DrawNumbers(iVar5, iVar11 - 0x10, iVar8);
DebugFont_DrawNumbers(iVar10, iVar11 + -4, iVar8);
DebugFont_DrawNumbers((((whateverThisIs + iVar10 * -0x60) * 100) / 0x3c0) * 0x10000 >> 0x10, iVar11 + 4, iVar8);
sVar9 = posX + -0x14;
jumpMeter = posY + -0x2d;
box.w = 0x22;
box.h = 10;
box.x = sVar9;
box.y = jumpMeter;
memset(auStack64, 0, 4);
CTR_Box_DrawWireBox(&box, auStack64, gGT->tileView_UI.ptrOT, &gGT->backBuffer->primMem);
backDB = gGT->backBuffer;
primmemCurr = backDB->primMem.curr;
p = 0;
// if there is room left for more
if (primmemCurr <= (u_long *)backDB->primMem.endMin100)
{
// add primitives
backDB->primMem.curr = &primmemCurr[6];
p = (POLY_F4 *)primmemCurr;
}
if (p != 0)
{
*(u_int *)&p->r0 = 0x28ffffff;
p->x1 = posX + 0xe;
p->x3 = posX + 0xe;
p->x0 = sVar9;
p->y0 = jumpMeter;
p->y1 = jumpMeter;
p->x2 = sVar9;
p->y2 = posY - 0x23;
p->y3 = posY - 0x23;
// pointer to OT memory
primmemCurr = gGT->tileView_UI.ptrOT;
*(int*)p = *primmemCurr | 0x5000000;
*primmemCurr = (u_int)p & 0xffffff;
box2.y = posY - 0x26;
box2.w = 0xc * 750 / 1000; // === widescreen ===
box2.h = 0x26;
box2.x = posX;
memset(auStack48, 0, 4);
CTR_Box_DrawWireBox(&box2, auStack48, gGT->tileView_UI.ptrOT, &gGT->backBuffer->primMem);
backDB = gGT->backBuffer;
primmemCurr = backDB->primMem.curr;
p = 0;
if (primmemCurr <= (u_long *)backDB->primMem.endMin100)
{
backDB->primMem.curr = &primmemCurr[6];
p = (POLY_F4 *)primmemCurr;
}
if (p != 0)
{
jumpMeter = driver->jumpMeter;
sVar9 = driver->jumpMeter;
colorAndCode = 0x28ff0000;
if (0x27f < jumpMeter)
{
if (jumpMeter < 0x3c0)
{
colorAndCode = 0x2800ff00;
}
else
{
if (jumpMeter < 0x5a0)
{
colorAndCode = 0x2800ffff;
}
else
{
colorAndCode = 0x280000ff;
}
}
}
*(u_int *)&p->r0 = colorAndCode;
jumpMeterHeight = (int)sVar9 * 0x26;
sVar9 = posX + 0xc * 750 / 1000; // === widescreen ===
p->x0 = posX;
p->x1 = sVar9;
p->x2 = posX;
p->y2 = posY;
p->x3 = sVar9;
p->y3 = posY;
jumpMeter = posY - ((short)(jumpMeterHeight / 0x960) - (short)(jumpMeterHeight / 0x80000000));
p->y0 = jumpMeter;
p->y1 = jumpMeter;
primmemCurr = gGT->tileView_UI.ptrOT;
*(int*)p = *primmemCurr | 0x5000000;
*primmemCurr = (u_int)p & 0xffffff;
backDB = gGT->backBuffer;
primmemCurr = backDB->primMem.curr;
p = 0;
// If there is room to add more
if (primmemCurr <= (u_long *)backDB->primMem.endMin100)
{
// Add more primitives
backDB->primMem.curr = &primmemCurr[6];
p = (POLY_F4 *)primmemCurr;
}
if (p != 0)
{
*(u_int *)&p->r0 = 0x28808080;
p->x0 = posX;
p->y0 = posY - 0x26;
p->x1 = sVar9;
p->y1 = posY - 0x26;
p->x2 = posX;
p->y2 = posY;
p->x3 = sVar9;
p->y3 = posY;
// pointer to OT memory
primmemCurr = gGT->tileView_UI.ptrOT;
*(int*)p = *primmemCurr | 0x5000000;
*primmemCurr = (u_int)p & 0xffffff;
}
}
}
return;
}

View File

@ -6,6 +6,14 @@ void DecalMP_03();
void RunEntryHook()
{
int i;
for(i = 0; i < 0x1c; i++)
{
data.speedometerBG_vertData[i*2] =
data.speedometerBG_vertData[i*2] * 750 / 1000;
}
data.font_charPixWidth[0] = 0;
data.font_charPixWidth[1] = 0xD;
data.font_charPixWidth[2] = 0xA;