summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMegaMech <7255464+MegaMech@users.noreply.github.com>2025-01-04 20:53:13 -0700
committerMegaMech <7255464+MegaMech@users.noreply.github.com>2025-01-04 20:53:13 -0700
commit5ee24ab2aaa451442199bceccf519d9bb9e58dcf (patch)
tree4f4b26b73e32ffebc0f8aa92e4c656d6dae8de5d
parentadaa16b84b45584e1258e93e83f5e14cc562af0d (diff)
Nearly fix finishline on 3P
-rw-r--r--src/render_objects.c70
-rw-r--r--src/render_objects.h4
2 files changed, 72 insertions, 2 deletions
diff --git a/src/render_objects.c b/src/render_objects.c
index 3595863a1..6aed93029 100644
--- a/src/render_objects.c
+++ b/src/render_objects.c
@@ -1648,7 +1648,6 @@ void render_texture_rectangle_wide(s32 x, s32 y, s32 width, s32 height, s32 arg4
switch(gScreenModeSelection) {
case SCREEN_MODE_3P_4P_SPLITSCREEN:
if (gPlayerCount == 3) {
- s32 renderWidth = SCREEN_WIDTH;
// Center item in area of screen
s32 center = (s32)((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + ((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2));
s32 coordX = (s32)(center - (width / 2)) << 2;
@@ -1684,6 +1683,27 @@ void render_texture_rectangle_wide(s32 x, s32 y, s32 width, s32 height, s32 arg4
// 1 << 10);
}
+// Renders the finishline in 3P mode.
+void render_texture_rectangle_3P(s32 x, s32 y, s32 width, s32 height, s32 arg4, s32 arg5, s32 arg6) {
+
+ s32 xh = (((x + width) - 1));
+ s32 yh = (((y + height) - 1) << 2);
+ s32 xl = ((x));
+ s32 yl = y << 2;
+
+ s32 xh2 = (((x + width)));
+ s32 yh2 = ((y + height) << 2);
+
+ // Center item in area of screen
+ s32 center = (s32)((OTRGetDimensionFromRightEdge(SCREEN_WIDTH) - SCREEN_WIDTH) / 2) + ((SCREEN_WIDTH / 4) + (SCREEN_WIDTH / 2));
+ s32 coordX = (s32)(center - (width / 2)) << 2;
+ s32 coordX2 = (s32)(center + (width / 2)) << 2;
+ printf("center %d, width %d, coordX %d\n", center, width, coordX >> 2);
+ gSPWideTextureRectangle(gDisplayListHead++, coordX, yl,
+ coordX2, yh2, G_TX_RENDERTILE, arg4 << 5, (arg5 << 5), 1 << 10,
+ 1 << 10);
+}
+
void render_texture_rectangle_wrap(s32 x, s32 y, s32 width, s32 height, s32 mode) {
// (0, 0) means texture coordinates will be rendered from the top left corner
render_texture_rectangle(x, y, width, height, 0, 0, mode);
@@ -1739,6 +1759,30 @@ void func_8004B97C_wide(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
}
}
+void func_8004B97C_3P(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
+ UNUSED s32 pad[2];
+ s32 sp2C;
+ s32 var_a1;
+ s32 var_v0;
+ s32 var_v1;
+
+ if ((-arg2 < arg0) && (-arg3 < arg1)) {
+ var_v0 = 0;
+ var_v1 = 0;
+ sp2C = arg0;
+ var_a1 = arg1;
+ if (arg0 < 0) {
+ var_v1 = -arg0;
+ sp2C = 0;
+ }
+ if (arg1 < 0) {
+ var_v0 = -arg1;
+ var_a1 = 0;
+ }
+ render_texture_rectangle_3P(sp2C, var_a1, arg2 - var_v1, arg3 - var_v0, var_v1, var_v0, arg4);
+ }
+}
+
void func_8004BA08(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) {
UNUSED s32 pad[2];
s32 sp2C;
@@ -1952,6 +1996,15 @@ void draw_hud_2d_texture_wide(s32 x, s32 y, u32 width, u32 height, u8* texture)
gSPDisplayList(gDisplayListHead++, D_0D007EB8);
}
+void draw_hud_2d_texture_3P(s32 x, s32 y, u32 width, u32 height, u8* texture) {
+ gSPDisplayList(gDisplayListHead++, D_0D008108);
+ gSPDisplayList(gDisplayListHead++, D_0D007EF8);
+ gDPSetAlphaCompare(gDisplayListHead++, G_AC_THRESHOLD);
+ load_texture_block_rgba16_mirror(texture, width, height);
+ func_8004B97C_3P(x - (width >> 1), y - (height >> 1), width, height, 0);
+ gSPDisplayList(gDisplayListHead++, D_0D007EB8);
+}
+
void func_8004C450(s32 arg0, s32 arg1, u32 arg2, u32 arg3, u8* texture) {
gSPDisplayList(gDisplayListHead++, D_0D007F38);
@@ -2049,7 +2102,20 @@ void func_8004CA58(s32 arg0, s32 arg1, f32 arg2, u8* texture, s32 arg4, s32 arg5
}
void draw_hud_2d_texture_8x8(s32 x, s32 y, u8* texture) {
- draw_hud_2d_texture_wide(x, y, 8, 8, texture);
+ switch(gScreenModeSelection) {
+ case SCREEN_MODE_1P:
+ case SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL:
+ case SCREEN_MODE_2P_SPLITSCREEN_VERTICAL:
+ draw_hud_2d_texture_wide(x, y, 8, 8, texture);
+ break;
+ case SCREEN_MODE_3P_4P_SPLITSCREEN:
+ if (gPlayerCount == 3) {
+ draw_hud_2d_texture_3P(x, y, 8, 8, texture);
+ } else {
+ draw_hud_2d_texture(x, y, 8, 8, texture);
+ }
+ break;
+ }
}
UNUSED void draw_hud_2d_texture_8x16(s32 x, s32 y, u8* texture) {
diff --git a/src/render_objects.h b/src/render_objects.h
index 007944706..e3caf217d 100644
--- a/src/render_objects.h
+++ b/src/render_objects.h
@@ -207,6 +207,9 @@ void func_8004B614(s32, s32, s32, s32, s32, s32, s32);
void func_8004B6C4(s32, s32, s32);
void func_8004B72C(s32, s32, s32, s32, s32, s32, s32);
void render_texture_rectangle_wrap(s32, s32, s32, s32, s32);
+void render_texture_rectangle_3P(s32 x, s32 y, s32 width, s32 height, s32 arg4, s32 arg5, s32 arg6);
+void func_8004B97C_3P(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
+void draw_hud_2d_texture_3P(s32 x, s32 y, u32 width, u32 height, u8* texture);
void func_8004BB34(void);
void func_8004BB3C(s32, s32, s32, s32, f32);
void func_8004BD14(s32, s32, u32, u32, s32, u8*, u8*);
@@ -218,6 +221,7 @@ void func_8004C148(s16, s16, s16, u16, u16, u16, u16);
void func_8004C354(void);
void func_8004C35C(void);
void draw_hud_2d_texture_wide(s32, s32, u32, u32, u8*);
+void draw_hud_2d_texture_3P(s32 x, s32 y, u32 width, u32 height, u8* texture);
void func_8004C450(s32, s32, u32, u32, u8*);
void func_8004C53C(s32, s32, u32, u32, u8*);
void func_8004C628(s32, s32, u32, u32, u8*);