mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-23 21:19:55 +00:00
Dedupe SetTexturedPrimRect (#921)
config/symbols.us.ric.txt change unrelated
This commit is contained in:
parent
437a970d6e
commit
a46a70b251
@ -5,6 +5,7 @@ g_StreamWidth = 0x8018B2FC;
|
||||
g_StreamHeight = 0x8018B300;
|
||||
PrintFileSelectPlaceName = 0x801AD134;
|
||||
Update = 0x801AEED8;
|
||||
SetTexturedPrimRect = 0x801B26A0;
|
||||
DrawString16x16 = 0x801B29C0;
|
||||
DrawImages8x8 = 0x801B2AFC;
|
||||
HydrateSaveSummaryEntry = 0x801B2F50;
|
||||
|
@ -1058,33 +1058,4 @@ void func_801072FC(POLY_G4* poly) {
|
||||
setRGB3(poly, 0, 0, 0);
|
||||
}
|
||||
|
||||
void SetPrimRect(Primitive* poly, s32 x, s32 y, s32 width, s32 height) {
|
||||
poly->x0 = x;
|
||||
poly->y0 = y;
|
||||
poly->x1 = x + width;
|
||||
poly->y1 = y;
|
||||
poly->x2 = x;
|
||||
poly->x3 = x + width;
|
||||
poly->y2 = y + height;
|
||||
poly->y3 = y + height;
|
||||
}
|
||||
|
||||
void SetTexturedPrimRect(
|
||||
Primitive* poly, s32 x, s32 y, s32 width, s32 height, s32 u, s32 v) {
|
||||
poly->x0 = x;
|
||||
poly->y0 = y;
|
||||
poly->x1 = x + width;
|
||||
poly->y1 = y;
|
||||
poly->x2 = x;
|
||||
poly->y2 = y + height;
|
||||
poly->x3 = x + width;
|
||||
poly->y3 = y + height;
|
||||
poly->v0 = v;
|
||||
poly->v1 = v;
|
||||
poly->u0 = u;
|
||||
poly->u1 = u + width;
|
||||
poly->u2 = u;
|
||||
poly->v2 = v + height;
|
||||
poly->u3 = u + width;
|
||||
poly->v3 = v + height;
|
||||
}
|
||||
#include "../set_prim_rect.h"
|
||||
|
30
src/set_prim_rect.h
Normal file
30
src/set_prim_rect.h
Normal file
@ -0,0 +1,30 @@
|
||||
void SetPrimRect(Primitive* poly, s32 x, s32 y, s32 width, s32 height) {
|
||||
poly->x0 = x;
|
||||
poly->y0 = y;
|
||||
poly->x1 = x + width;
|
||||
poly->y1 = y;
|
||||
poly->x2 = x;
|
||||
poly->x3 = x + width;
|
||||
poly->y2 = y + height;
|
||||
poly->y3 = y + height;
|
||||
}
|
||||
|
||||
void SetTexturedPrimRect(
|
||||
Primitive* poly, s32 x, s32 y, s32 width, s32 height, s32 u, s32 v) {
|
||||
poly->x0 = x;
|
||||
poly->y0 = y;
|
||||
poly->x1 = x + width;
|
||||
poly->y1 = y;
|
||||
poly->x2 = x;
|
||||
poly->y2 = y + height;
|
||||
poly->x3 = x + width;
|
||||
poly->y3 = y + height;
|
||||
poly->v0 = v;
|
||||
poly->v1 = v;
|
||||
poly->u0 = u;
|
||||
poly->u1 = u + width;
|
||||
poly->u2 = u;
|
||||
poly->v2 = v + height;
|
||||
poly->u3 = u + width;
|
||||
poly->v3 = v + height;
|
||||
}
|
@ -180,7 +180,7 @@ void InitMainMenuGraphics(void) {
|
||||
y = 0;
|
||||
x = -0x20;
|
||||
prim = &g_PrimBuf[D_801BAF18[GFX_UNK_0][0]];
|
||||
func_801B26A0(prim, 216, 16, 144, 72, 0, 0);
|
||||
SetTexturedPrimRect(prim, 216, 16, 144, 72, 0, 0);
|
||||
func_801B1D88(prim);
|
||||
prim->tpage = 0xD;
|
||||
prim->clut = 0x201;
|
||||
@ -190,7 +190,7 @@ void InitMainMenuGraphics(void) {
|
||||
for (; i < NUM_MENU_OPTIONS; i++) {
|
||||
D_801BAF18[i + 1][0] = g_api.AllocPrimitives(PRIM_GT4, 1);
|
||||
prim = &g_PrimBuf[D_801BAF18[i + 1][0]];
|
||||
func_801B26A0(
|
||||
SetTexturedPrimRect(
|
||||
prim, x, y, 127, 31, g_MenuHeadGfxU[i], g_MenuHeadGfxV[i]);
|
||||
func_801B1D88(prim);
|
||||
prim->tpage = 0xC;
|
||||
@ -207,7 +207,7 @@ void InitMainMenuGraphics(void) {
|
||||
|
||||
D_801BAF18[6][0] = g_api.AllocPrimitives(PRIM_GT4, 4);
|
||||
prim = &g_PrimBuf[D_801BAF18[6][0]];
|
||||
func_801B26A0(prim, 32, 176, 16, 16, 0xA0, 0x50);
|
||||
SetTexturedPrimRect(prim, 32, 176, 16, 16, 0xA0, 0x50);
|
||||
func_801B1D88(prim);
|
||||
prim->tpage = 0xC;
|
||||
prim->clut = 0x200;
|
||||
@ -215,7 +215,7 @@ void InitMainMenuGraphics(void) {
|
||||
prim->blendMode = 0;
|
||||
|
||||
prim = prim->next;
|
||||
func_801B26A0(prim, 32, 176, 16, 16, 0xA0, 0x70);
|
||||
SetTexturedPrimRect(prim, 32, 176, 16, 16, 0xA0, 0x70);
|
||||
func_801B1D88(prim);
|
||||
prim->tpage = 0xC;
|
||||
prim->clut = 0x200;
|
||||
@ -223,7 +223,7 @@ void InitMainMenuGraphics(void) {
|
||||
prim->blendMode = 0;
|
||||
|
||||
prim = prim->next;
|
||||
func_801B26A0(prim, 32, 176, 16, 16, 0xA0, 0x60);
|
||||
SetTexturedPrimRect(prim, 32, 176, 16, 16, 0xA0, 0x60);
|
||||
func_801B1D88(prim);
|
||||
prim->tpage = 0xC;
|
||||
prim->clut = 0x202;
|
||||
@ -231,7 +231,7 @@ void InitMainMenuGraphics(void) {
|
||||
prim->blendMode = 0;
|
||||
|
||||
prim = prim->next;
|
||||
func_801B26A0(prim, 32, 176, 16, 16, 0xA0, 0x80);
|
||||
SetTexturedPrimRect(prim, 32, 176, 16, 16, 0xA0, 0x80);
|
||||
func_801B1D88(prim);
|
||||
prim->tpage = 0xC;
|
||||
prim->clut = 0x200;
|
||||
@ -240,7 +240,7 @@ void InitMainMenuGraphics(void) {
|
||||
|
||||
D_801BAF18[7][0] = g_api.AllocPrimitives(PRIM_GT4, 1);
|
||||
prim = &g_PrimBuf[D_801BAF18[7][0]];
|
||||
func_801B26A0(prim, 112, 48, 160, 48, 0, 0x50);
|
||||
SetTexturedPrimRect(prim, 112, 48, 160, 48, 0, 0x50);
|
||||
func_801B1D88(prim);
|
||||
prim->tpage = 0xC;
|
||||
prim->clut = 0x202;
|
||||
@ -249,7 +249,7 @@ void InitMainMenuGraphics(void) {
|
||||
|
||||
D_801BAF18[8][0] = g_api.AllocPrimitives(PRIM_GT4, 1);
|
||||
prim = &g_PrimBuf[D_801BAF18[8][0]];
|
||||
func_801B26A0(prim, 128, 72, 15, 15, 0xF0, 0xF0);
|
||||
SetTexturedPrimRect(prim, 128, 72, 15, 15, 0xF0, 0xF0);
|
||||
func_801B1D88(prim);
|
||||
prim->tpage = 0xC;
|
||||
prim->clut = 0x200;
|
||||
@ -279,7 +279,7 @@ void InitMainMenuGraphics(void) {
|
||||
|
||||
D_801BAF18[10][0] = g_api.AllocPrimitives(PRIM_GT4, 1);
|
||||
prim = &g_PrimBuf[D_801BAF18[10][0]];
|
||||
func_801B26A0(prim, 64, 104, 32, 32, 0, 0x48);
|
||||
SetTexturedPrimRect(prim, 64, 104, 32, 32, 0, 0x48);
|
||||
func_801B1D88(prim);
|
||||
prim->tpage = 0xD;
|
||||
prim->clut = 0x204;
|
||||
@ -288,7 +288,7 @@ void InitMainMenuGraphics(void) {
|
||||
|
||||
D_801BAF18[GFX_WND_SAVE_SUMMARY][0] = g_api.AllocPrimitives(PRIM_GT4, 1);
|
||||
prim = &g_PrimBuf[D_801BAF18[11][0]];
|
||||
func_801B26A0(prim, 104, 88, 176, 80, 0, 0);
|
||||
SetTexturedPrimRect(prim, 104, 88, 176, 80, 0, 0);
|
||||
func_801B1D88(prim);
|
||||
prim->tpage = 0xC;
|
||||
prim->clut = 0x202;
|
||||
@ -370,14 +370,14 @@ void InitMainMenuGraphics(void) {
|
||||
|
||||
D_801BAF18[18][0] = g_api.AllocPrimitives(PRIM_GT4, 2);
|
||||
prim = &g_PrimBuf[D_801BAF18[18][0]];
|
||||
func_801B26A0(prim, 104, 48, 176, 80, 0, 0);
|
||||
SetTexturedPrimRect(prim, 104, 48, 176, 80, 0, 0);
|
||||
func_801B1D88(prim);
|
||||
prim->tpage = 0xC;
|
||||
prim->clut = 0x202;
|
||||
prim->priority = 0x10;
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
prim = prim->next;
|
||||
func_801B26A0(prim, 168, 128, 48, 16, 0xB0, 0x80);
|
||||
SetTexturedPrimRect(prim, 168, 128, 48, 16, 0xB0, 0x80);
|
||||
func_801B1D88(prim);
|
||||
prim->tpage = 0xC;
|
||||
prim->clut = 0x200;
|
||||
@ -427,7 +427,7 @@ void func_801ACC7C(void) {
|
||||
D_801BAFC0 = primIndex;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
func_801B26A0(poly, i << 7, 0, 128, 240, 0, 0);
|
||||
SetTexturedPrimRect(poly, i << 7, 0, 128, 240, 0, 0);
|
||||
func_801B1D88(poly);
|
||||
poly->tpage = i + 137;
|
||||
poly->clut = 0x210;
|
||||
|
@ -22,37 +22,37 @@ void DrawNavigationTips(NavigationTips mode) {
|
||||
|
||||
switch (mode) {
|
||||
case Tips_Generic:
|
||||
func_801B2670(poly, 32, 176, 16, 16);
|
||||
SetPrimRect(poly, 32, 176, 16, 16);
|
||||
poly->pad3 = 0;
|
||||
poly = poly->tag;
|
||||
func_801B2670(poly, 32, 192, 16, 16);
|
||||
SetPrimRect(poly, 32, 192, 16, 16);
|
||||
poly->pad3 = 0;
|
||||
poly = poly->tag;
|
||||
func_801B2670(poly, 32, 208, 16, 16);
|
||||
SetPrimRect(poly, 32, 208, 16, 16);
|
||||
poly->pad3 = 0;
|
||||
break;
|
||||
|
||||
case Tips_Input:
|
||||
func_801B2670(poly, 288, 32, 16, 16);
|
||||
SetPrimRect(poly, 288, 32, 16, 16);
|
||||
poly->pad3 = 0;
|
||||
poly = poly->tag;
|
||||
func_801B2670(poly, 288, 48, 16, 16);
|
||||
SetPrimRect(poly, 288, 48, 16, 16);
|
||||
poly->pad3 = 0;
|
||||
poly = poly->tag;
|
||||
func_801B2670(poly, 288, 64, 16, 16);
|
||||
SetPrimRect(poly, 288, 64, 16, 16);
|
||||
poly->pad3 = 0;
|
||||
poly = poly->tag;
|
||||
func_801B2670(poly, 288, 80, 16, 16);
|
||||
SetPrimRect(poly, 288, 80, 16, 16);
|
||||
poly->pad3 = 0;
|
||||
break;
|
||||
|
||||
case Tips_YesNo:
|
||||
case Tips_NoYes:
|
||||
poly = poly->tag;
|
||||
func_801B2670(poly, 32, 192, 16, 16);
|
||||
SetPrimRect(poly, 32, 192, 16, 16);
|
||||
poly->pad3 = 0;
|
||||
poly = (POLY_GT4*)poly->tag;
|
||||
func_801B2670(poly, 32, 208, 16, 16);
|
||||
SetPrimRect(poly, 32, 208, 16, 16);
|
||||
poly->pad3 = 0;
|
||||
if (mode == Tips_YesNo) {
|
||||
func_801AD1D0();
|
||||
@ -63,16 +63,16 @@ void DrawNavigationTips(NavigationTips mode) {
|
||||
|
||||
case Tips_Confirm:
|
||||
poly = poly->tag;
|
||||
func_801B2670(poly, 32, 192, 16, 16);
|
||||
SetPrimRect(poly, 32, 192, 16, 16);
|
||||
poly->pad3 = 0;
|
||||
DrawImages8x8(*imgs, 52, 196, 1);
|
||||
break;
|
||||
|
||||
case Tips_MenuNavigation:
|
||||
func_801B2670(poly, 32, 184, 16, 16);
|
||||
SetPrimRect(poly, 32, 184, 16, 16);
|
||||
poly->pad3 = 0;
|
||||
poly = (POLY_GT4*)poly->tag;
|
||||
func_801B2670(poly, 32, 200, 16, 16);
|
||||
SetPrimRect(poly, 32, 200, 16, 16);
|
||||
poly->pad3 = 0;
|
||||
break;
|
||||
}
|
||||
@ -175,10 +175,11 @@ void func_801AD78C(void) {
|
||||
DrawString16x16(D_801A7770, 0x48, 0x88, 1);
|
||||
DrawString16x16(D_801A7780, 0x48, 0xA0, 1);
|
||||
DrawString16x16(D_801A7790, 0x48, 0xB8, 1);
|
||||
func_801B26A0(&g_PrimBuf[D_801BAF58], (g_InputCursorPos * 0x10) + 0x80,
|
||||
0x48, 0x0F, 0x0F, 0xF0, 0xF0);
|
||||
func_801B26A0(&g_PrimBuf[D_801BAF68], ((D_801BC3E0 & 7) << 5) + 0x40,
|
||||
(D_801BC3E0 & 0x18) * 3 + 0x68, 0x20, 0x20, 0, 0x48);
|
||||
SetTexturedPrimRect(
|
||||
&g_PrimBuf[D_801BAF58], (g_InputCursorPos * 0x10) + 0x80, 0x48, 0x0F,
|
||||
0x0F, 0xF0, 0xF0);
|
||||
SetTexturedPrimRect(&g_PrimBuf[D_801BAF68], ((D_801BC3E0 & 7) << 5) + 0x40,
|
||||
(D_801BC3E0 & 0x18) * 3 + 0x68, 0x20, 0x20, 0, 0x48);
|
||||
if (g_Timer & 8) {
|
||||
func_801ACBE4(8, 0);
|
||||
} else {
|
||||
@ -300,7 +301,7 @@ void func_801AE6D0(void) {
|
||||
s = &g_SaveSummary[port];
|
||||
func_801ACBE4(0x12, 0x11);
|
||||
prim = g_PrimBuf[D_801BAF18[18][0]].next;
|
||||
func_801B26A0(prim, 168, (D_801BAF08 % 3) + 127, 48, 16, 0xB0, 0x80);
|
||||
SetTexturedPrimRect(prim, 168, (D_801BAF08 % 3) + 127, 48, 16, 0xB0, 0x80);
|
||||
prim->blendMode = 0;
|
||||
func_801ACBE4(0x13, 0);
|
||||
func_801ACBE4(0x14, 0);
|
||||
@ -331,7 +332,7 @@ void func_801AE9A8(void) {
|
||||
|
||||
for (i = 1; i < NUM_MENU_OPTIONS; i++) {
|
||||
func_801ACBE4(i + 1, 4);
|
||||
func_801B26A0(
|
||||
SetTexturedPrimRect(
|
||||
&g_PrimBuf[D_801BAF18[i + 1][0]], (i * 64) - 32, (i * 5) * 8, 127,
|
||||
31, g_MenuHeadGfxU[i], g_MenuHeadGfxV[i]);
|
||||
}
|
||||
@ -351,10 +352,10 @@ void func_801AEA8C(s32 arg0) {
|
||||
|
||||
if (arg0 == 0) {
|
||||
func_801ACBE4(1, 0);
|
||||
func_801B2670(&g_PrimBuf[D_801BAF20], 24, 24, 127, 31);
|
||||
SetPrimRect(&g_PrimBuf[D_801BAF20], 24, 24, 127, 31);
|
||||
} else {
|
||||
func_801ACBE4(3, 0);
|
||||
func_801B2670(&g_PrimBuf[D_801BAF30], 24, 24, 127, 31);
|
||||
SetPrimRect(&g_PrimBuf[D_801BAF30], 24, 24, 127, 31);
|
||||
}
|
||||
|
||||
DrawNavigationTips(1);
|
||||
@ -390,7 +391,7 @@ void SelectMainMenuOption(MainMenuCursor cursor) {
|
||||
|
||||
// Relocate the graphics at the top-left of the screen
|
||||
prim = &g_PrimBuf[D_801BAF18[gfxId][0]];
|
||||
func_801B2670(prim, 16, 16, 127, 31);
|
||||
SetPrimRect(prim, 16, 16, 127, 31);
|
||||
prim->clut = 0x200;
|
||||
}
|
||||
|
||||
|
@ -1208,36 +1208,7 @@ void func_801B263C(const char* str, s32 id) {
|
||||
func_801B1FD8(str, id);
|
||||
}
|
||||
|
||||
void func_801B2670(POLY_GT4* poly, s32 x, s32 y, s32 width, s32 height) {
|
||||
poly->x0 = x;
|
||||
poly->y0 = y;
|
||||
poly->x1 = x + width;
|
||||
poly->y1 = y;
|
||||
poly->x2 = x;
|
||||
poly->x3 = x + width;
|
||||
poly->y2 = y + height;
|
||||
poly->y3 = y + height;
|
||||
}
|
||||
|
||||
void func_801B26A0(
|
||||
POLY_GT4* poly, s32 x, s32 y, s32 width, s32 height, s32 u, s32 v) {
|
||||
poly->x0 = x;
|
||||
poly->y0 = y;
|
||||
poly->x1 = x + width;
|
||||
poly->y1 = y;
|
||||
poly->x2 = x;
|
||||
poly->y2 = y + height;
|
||||
poly->x3 = x + width;
|
||||
poly->y3 = y + height;
|
||||
poly->v0 = v;
|
||||
poly->v1 = v;
|
||||
poly->u0 = u;
|
||||
poly->u1 = u + width;
|
||||
poly->u2 = u;
|
||||
poly->v2 = v + height;
|
||||
poly->u3 = u + width;
|
||||
poly->v3 = v + height;
|
||||
}
|
||||
#include "../../set_prim_rect.h"
|
||||
|
||||
void func_801B2700(s32 tpage, s32 otIdx) {
|
||||
DR_MODE* drawMode = &g_CurrentBuffer->drawModes[g_GpuUsage.drawModes];
|
||||
|
@ -208,7 +208,7 @@ void HandleMainMenu(void);
|
||||
void func_801ACBE4(s32 arg0, u16 arg1);
|
||||
void func_801AD1D0(void);
|
||||
void func_801AD218(void);
|
||||
void func_801B2670(POLY_GT4* poly, s32 x, s32 y, s32 width, s32 height);
|
||||
void SetPrimRect(Primitive* poly, s32 x, s32 y, s32 width, s32 height);
|
||||
void DrawString16x16(const char* str, s32 x, s32 y, s32 tga);
|
||||
void DrawImages8x8(u8* imgs, s32 x, s32 y, s32 tge);
|
||||
void func_801B9C80(void);
|
||||
@ -216,8 +216,8 @@ void InitRoomEntities(s32 objLayoutId);
|
||||
void func_801B60D4(void);
|
||||
void func_801B17C8(void);
|
||||
void func_801B1CFC(POLY_GT4* poly, s32 colorIntensity);
|
||||
void func_801B26A0(
|
||||
POLY_GT4* poly, s32 x, s32 y, s32 width, s32 height, s32 u, s32 v);
|
||||
void SetTexturedPrimRect(
|
||||
Primitive* poly, s32 x, s32 y, s32 width, s32 height, s32 u, s32 v);
|
||||
void func_801B1ED0();
|
||||
void func_801B3A54(s32, s32);
|
||||
s32 func_801B3A94(s32);
|
||||
|
Loading…
Reference in New Issue
Block a user