diff --git a/decompile/General/MENUBOX/MENUBOX_DrawRwdBlueRect.c b/decompile/General/MENUBOX/MENUBOX_DrawRwdBlueRect.c new file mode 100644 index 00000000..c527b236 --- /dev/null +++ b/decompile/General/MENUBOX/MENUBOX_DrawRwdBlueRect.c @@ -0,0 +1,26 @@ +#include + +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); + } +} diff --git a/decompile/General/MENUBOX/MENUBOX_DrawRwdBlueRect_Subset.c b/decompile/General/MENUBOX/MENUBOX_DrawRwdBlueRect_Subset.c new file mode 100644 index 00000000..c87190e8 --- /dev/null +++ b/decompile/General/MENUBOX/MENUBOX_DrawRwdBlueRect_Subset.c @@ -0,0 +1,26 @@ +#include + +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; + } +} \ No newline at end of file diff --git a/decompile/WorkInProgress/src/MENUBOX/MENUBOX_DrawRwdTriangle.c b/decompile/General/MENUBOX/MENUBOX_DrawRwdTriangle.c similarity index 100% rename from decompile/WorkInProgress/src/MENUBOX/MENUBOX_DrawRwdTriangle.c rename to decompile/General/MENUBOX/MENUBOX_DrawRwdTriangle.c diff --git a/decompile/WorkInProgress/src/MENUBOX/MENUBOX_DrawRwdBlueRect.c b/decompile/WorkInProgress/src/MENUBOX/MENUBOX_DrawRwdBlueRect.c deleted file mode 100644 index 1580cedf..00000000 --- a/decompile/WorkInProgress/src/MENUBOX/MENUBOX_DrawRwdBlueRect.c +++ /dev/null @@ -1,49 +0,0 @@ -#include - -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); - } -} diff --git a/decompile/buildList.txt b/decompile/buildList.txt index 31f184e9..2f9dcc71 100644 --- a/decompile/buildList.txt +++ b/decompile/buildList.txt @@ -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) diff --git a/include/decomp_functions.h b/include/decomp_functions.h index 7e92b2b6..eb8b9cc1 100644 --- a/include/decomp_functions.h +++ b/include/decomp_functions.h @@ -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); diff --git a/rebuild_PS1/main.c b/rebuild_PS1/main.c index 47631df8..ce83012f 100644 --- a/rebuild_PS1/main.c +++ b/rebuild_PS1/main.c @@ -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)