MENUBOX_DrawRwdBlueRect

This commit is contained in:
Niko 2023-11-15 14:48:42 -05:00
parent 22f026d7f8
commit 3031339b39
7 changed files with 61 additions and 51 deletions

View File

@ -0,0 +1,26 @@
#include <common.h>
void DECOMP_MENUBOX_DrawRwdBlueRect(RECT *rect, char* metas, u_long *ot, struct PrimMem *primMem)
{
short pos[4];
int gradient[2];
int colors[4];
pos[0] = rect->x;
pos[2] = rect->w;
for (int i = 0; metas[i*4 + 3] != 0x64; i++)
{
char* meta = (int*)&metas[i * 4];
gradient[0] = *(int*)&meta[0];
gradient[1] = *(int*)&meta[4];
colors[0] = gradient[0];
colors[1] = gradient[0];
colors[2] = gradient[1];
colors[3] = gradient[1];
pos[1] = rect->y + (short)(meta[3] * rect->h / 100);
pos[3] = rect->y + (short)(meta[7] * rect->h / 100) - pos[1] + 1;
MENUBOX_DrawRwdBlueRect_Subset(pos, colors, ot, primMem);
}
}

View File

@ -0,0 +1,26 @@
#include <common.h>
void DECOMP_MENUBOX_DrawRwdBlueRect_Subset(short *pos, int *color, u_long *ot, struct PrimMem *primMem)
{
POLY_G4 *p = (POLY_G4 *)primMem->curr;
if (p <= primMem->endMin100)
{
primMem->curr = p + 1;
*(int*)&p->r0 = color[0] & 0xffffff;
*(int*)&p->r1 = color[1] & 0xffffff;
*(int*)&p->r2 = color[2] & 0xffffff;
*(int*)&p->r3 = color[3] & 0xffffff;
p->code = 0x38;
*(int*)&p->x0 = *(int*)&pos[0];
*(int*)&p->x1 = (pos[0] + pos[2]) | (pos[1] << 16);
*(int*)&p->x2 = pos[0] | ((pos[1] + pos[3]) << 16);
*(int*)&p->x3 = (pos[0] + pos[2]) | ((pos[1] + pos[3]) << 16);
*(int*)p = (*(int*)ot & 0xffffff) | 0x8000000;
*(int*)ot = (int)p & 0xffffff;
}
}

View File

@ -1,49 +0,0 @@
#include <common.h>
void DECOMP_MENUBOX_DrawRwdBlueRect_Subset(short *pos, int *color, u_long *ot, struct PrimMem *primMem)
{
POLY_G4 *p = (POLY_G4 *)primMem->curr;
if (p <= primMem->endMin100)
{
primMem->curr = p + 1;
}
if (p != NULL)
{
p->code = 0x38;
p->r0 = color[0] & 0xffffff;
p->r1 = color[1] & 0xffffff;
p->r2 = color[2] & 0xffffff;
p->r3 = color[3] & 0xffffff;
p->x0 = pos[0];
p->x1 = (pos[0] + 1) | (pos[1] << 16);
p->x2 = pos[0] | ((pos[1] + pos[2]) << 16);
p->x3 = (pos[0] + 1) | ((pos[1] + pos[2]) << 16);
AddPrim(ot, p);
}
}
void DECOMP_MENUBOX_DrawRwdBlueRect(RECT *rect, char *metas, u_long *ot, struct PrimMem *primMem)
{
short pos[4];
int gradient[2];
int colors[4];
pos[0] = rect->x;
pos[2] = rect->w;
for (int i = 0; (metas[i * 4] + 3) != 13; i++)
{
int* meta = (int*)&metas[i * 4];
gradient[0] = meta[0];
gradient[1] = meta[1];
colors[0] = gradient[0];
colors[1] = gradient[0];
colors[2] = gradient[1];
colors[3] = gradient[1];
pos[1] = rect->y + (short)(meta[3] * rect->h / 100);
pos[3] = rect->y + (short)(meta[7] * rect->h / 100) - pos[1] + 1;
MenuBox_DrawRwdBlueRect_Subset(&pos, &colors, ot, primMem);
}
}

View File

@ -481,7 +481,9 @@ common, exe, MixRNG_Scramble, 0x0, General/MixRNG/MixRNG_Scramble.c
// skip MENUBOX_DrawPolyGT4
common, exe, MENUBOX_DrawOuterRect_Edge, 0x0, General/MenuBox/MENUBOX_DrawOuterRect_Edge.c
common, exe, MENUBOX_DrawTime, 0x0, General/MenuBox/MENUBOX_DrawTime.c
// skip MENUBOX_RWD
common, exe, MENUBOX_DrawRwdBlueRect_Subset, 0x0, General/MenuBox/MENUBOX_DrawRwdBlueRect_Subset.c
common, exe, MENUBOX_DrawRwdBlueRect, 0x0, General/MenuBox/MENUBOX_DrawRwdBlueRect.c
common, exe, MENUBOX_DrawRwdTriangle, 0x0, General/MenuBox/MENUBOX_DrawRwdTriangle.c
common, exe, MENUBOX_DrawOuterRect_LowLevel, 0x0, General/MenuBox/MENUBOX_DrawOuterRect_LowLevel.c
common, exe, MENUBOX_DrawOuterRect_HighLevel, 0x0, General/MenuBox/MENUBOX_DrawOuterRect_HighLevel.c
// MENUBOX_DrawQuip.c (wip)

View File

@ -139,6 +139,9 @@ void DECOMP_MENUBOX_DrawOuterRect_Edge(RECT* r, u_int* rgb, u_int param_3, u_lon
void DECOMP_MENUBOX_DrawOuterRect_HighLevel(RECT* r, u_int* rgb, short param_3, u_long* otMem);
void DECOMP_MENUBOX_DrawOuterRect_LowLevel(RECT* p, short xOffset, u_short yOffset, u_int* rgb, short param_5, u_long* otMem);
u_char* DECOMP_MENUBOX_DrawTime(int milliseconds);
void DECOMP_MENUBOX_DrawRwdBlueRect_Subset(short *pos, int *color, u_long *ot, struct PrimMem *primMem);
void DECOMP_MENUBOX_DrawRwdBlueRect(RECT *rect, char *metas, u_long *ot, struct PrimMem *primMem);
void DECOMP_MENUBOX_DrawRwdTriangle(short* position,char* color,u_long* otMem,struct PrimMem* primMem);
void DECOMP_MENUBOX_GetHeight(struct MenuBox* m, short* height, int boolCheckSubmenu);
void DECOMP_MENUBOX_GetWidth(struct MenuBox* m, short* width, int boolCheckSubmenu);
void DECOMP_MENUBOX_Hide(struct MenuBox* m);

View File

@ -172,7 +172,9 @@
// skip MENUBOX_DrawPolyGT4
#include "../decompile/General/MenuBox/MENUBOX_DrawOuterRect_Edge.c"
#include "../decompile/General/MenuBox/MENUBOX_DrawTime.c"
// skip MENUBOX_RWD
#include "../decompile/General/MenuBox/MENUBOX_DrawRwdBlueRect_Subset.c"
#include "../decompile/General/MenuBox/MENUBOX_DrawRwdBlueRect.c"
#include "../decompile/General/MenuBox/MENUBOX_DrawRwdTriangle.c"
#include "../decompile/General/MenuBox/MENUBOX_DrawOuterRect_LowLevel.c"
#include "../decompile/General/MenuBox/MENUBOX_DrawOuterRect_HighLevel.c"
// MENUBOX_DrawQuip.c (wip)