Skip to content

Commit

Permalink
fix render mode case order
Browse files Browse the repository at this point in the history
  • Loading branch information
HailSanta authored and HailSanta committed Nov 9, 2023
1 parent f7de6da commit 70a11c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion include/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -3297,7 +3297,7 @@ enum RenderMode {
RENDER_MODE_25_UNUSED = 0x00000025,
RENDER_MODE_INTERSECTING_XLU = 0x00000026,
RENDER_MODE_27_UNUSED = 0x00000027,
RENDER_MODE_PASS_THROUGH = 0x00000028,
RENDER_MODE_PASS_THROUGH = 0x00000028, // no render mode is set, only geometry modes are initialized
RENDER_MODE_SURFACE_XLU_AA_ZB_ZUPD = 0x00000029,
RENDER_MODE_SURFACE_OPA_NO_ZB_BEHIND = 0x0000002A,
RENDER_MODE_ALPHATEST_NO_ZB_BEHIND = 0x0000002B,
Expand Down
31 changes: 16 additions & 15 deletions src/model.c
Original file line number Diff line number Diff line change
Expand Up @@ -1258,9 +1258,9 @@ MATCHING_BSS(0x3A0);

enum {
TILE_MODE_STRIDE = 3,
TILE_MODE_1A = 1,
TILE_MODE_2A = 2, // render modes all have G_RM_PASS for first cycle
TILE_MODE_3A = 3, // render modes all have G_RM_FOG_SHADE_A for first cycle
TILE_MODE_1A = 1, // render modes are single-cycle
TILE_MODE_2A = 2, // render modes are two-cycle, starting with G_RM_PASS
TILE_MODE_3A = 3, // render modes are two-cycle, starting with G_RM_FOG_SHADE_A
TILE_MODE_1B = 4,
TILE_MODE_2B = 5,
TILE_MODE_3B = 6,
Expand Down Expand Up @@ -1522,6 +1522,9 @@ void appendGfx_model(void* data) {
break;
case TILE_MODE_2A:
switch (renderMode) {
case RENDER_MODE_SURFACE_OPA:
renderModeIdx = RENDER_MODE_IDX_10;
break;
case RENDER_MODE_SURFACE_OPA_NO_AA:
renderModeIdx = RENDER_MODE_IDX_11;
break;
Expand Down Expand Up @@ -1575,18 +1578,17 @@ void appendGfx_model(void* data) {
case RENDER_MODE_CLOUD_NO_ZB:
renderModeIdx = RENDER_MODE_IDX_3A;
break;
case RENDER_MODE_SURFACE_OPA:
renderModeIdx = RENDER_MODE_IDX_10;
break;
default:
renderModeIdx = RENDER_MODE_IDX_10;
break;
}
gSPDisplayList((*gfxPos)++, ModelRenderModes[renderModeIdx]);
break;
case TILE_MODE_3A:
temp = RENDER_MODE_IDX_25; // required to match
switch (renderMode) {
case RENDER_MODE_SURFACE_OPA:
renderModeIdx = RENDER_MODE_IDX_1F;
break;
case RENDER_MODE_SURFACE_OPA_NO_AA:
renderModeIdx = RENDER_MODE_IDX_20;
break;
Expand All @@ -1600,7 +1602,7 @@ void appendGfx_model(void* data) {
renderModeIdx = RENDER_MODE_IDX_23;
break;
case RENDER_MODE_ALPHATEST:
renderModeIdx = temp;
renderModeIdx = RENDER_MODE_IDX_25;
break;
case RENDER_MODE_ALPHATEST_ONESIDED:
renderModeIdx = RENDER_MODE_IDX_26;
Expand Down Expand Up @@ -1640,9 +1642,6 @@ void appendGfx_model(void* data) {
case RENDER_MODE_CLOUD_NO_ZB:
renderModeIdx = RENDER_MODE_IDX_3C;
break;
case RENDER_MODE_SURFACE_OPA:
renderModeIdx = RENDER_MODE_IDX_1F;
break;
default:
renderModeIdx = RENDER_MODE_IDX_1F;
break;
Expand Down Expand Up @@ -1731,6 +1730,9 @@ void appendGfx_model(void* data) {
break;
case TILE_MODE_3B:
switch (renderMode) {
case RENDER_MODE_SURFACE_OPA:
renderModeIdx = RENDER_MODE_IDX_1F;
break;
case RENDER_MODE_SURFACE_OPA_NO_AA:
renderModeIdx = RENDER_MODE_IDX_20;
break;
Expand Down Expand Up @@ -1784,9 +1786,6 @@ void appendGfx_model(void* data) {
case RENDER_MODE_CLOUD_NO_ZB:
renderModeIdx = RENDER_MODE_IDX_3C;
break;
case RENDER_MODE_SURFACE_OPA:
renderModeIdx = RENDER_MODE_IDX_1F;
break;
default:
renderModeIdx = RENDER_MODE_IDX_1F;
break;
Expand All @@ -1806,6 +1805,9 @@ void appendGfx_model(void* data) {
case TILE_MODE_1C:
case TILE_MODE_2C:
switch (renderMode) {
case RENDER_MODE_SURFACE_OPA:
renderModeIdx = RENDER_MODE_IDX_1F;
break;
case RENDER_MODE_DECAL_OPA:
renderModeIdx = RENDER_MODE_IDX_21;
break;
Expand All @@ -1821,7 +1823,6 @@ void appendGfx_model(void* data) {
case RENDER_MODE_CLOUD_NO_ZB:
renderModeIdx = RENDER_MODE_IDX_3C;
break;
case RENDER_MODE_SURFACE_OPA:
default:
renderModeIdx = RENDER_MODE_IDX_1F;
break;
Expand Down

0 comments on commit 70a11c5

Please sign in to comment.