From 300b3a8ffdb852f3da26eff8ad1b7e25e1a864e0 Mon Sep 17 00:00:00 2001 From: cadmic Date: Tue, 6 Feb 2024 21:32:23 -0800 Subject: [PATCH] Match retail z_fbdemo.c and z_fbdemo_fade.c (#1727) * Match retail z_fbdemo.c and z_fbdemo_fade.c * Tweak macro arguments --- src/code/z_fbdemo.c | 31 +++++++++++++++++-------------- src/code/z_fbdemo_fade.c | 2 +- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c index b1ad5a2089..1a3916ffa0 100644 --- a/src/code/z_fbdemo.c +++ b/src/code/z_fbdemo.c @@ -40,6 +40,22 @@ Gfx sTransTileSetupDL[] = { gsSPEndDisplayList(), }; +#define SET_VERTEX(vtx, x, y, z, s, t, nx, ny, nz, alpha) \ + { \ + Vtx_tn* vtxn = &(vtx)->n; \ + vtxn->ob[0] = (x); \ + vtxn->ob[1] = (y); \ + vtxn->ob[2] = (z); \ + vtxn->flag = 0; \ + vtxn->tc[0] = (s); \ + vtxn->tc[1] = (t); \ + vtxn->n[0] = (nx); \ + vtxn->n[1] = (ny); \ + vtxn->n[2] = (nz); \ + vtxn->a = (alpha); \ + } \ + (void)0 + void TransitionTile_InitGraphics(TransitionTile* this) { s32 frame; s32 col; @@ -61,20 +77,7 @@ void TransitionTile_InitGraphics(TransitionTile* this) { for (row = 0; row < this->rows + 1; row++) { colTex = 0; for (col = 0; col < this->cols + 1; col++) { - Vtx_tn* vtxn = &vtx->n; - - vtx++; - vtxn->tc[0] = colTex << 6; - vtxn->ob[0] = col * 0x20; - vtxn->ob[1] = row * 0x20; - vtxn->ob[2] = -5; - vtxn->flag = 0; - vtxn->tc[1] = rowTex << 6; - vtxn->n[0] = 0; - vtxn->n[1] = 0; - vtxn->n[2] = 120; - vtxn->a = 255; - + SET_VERTEX(vtx++, col * 0x20, row * 0x20, -5, colTex << 6, rowTex << 6, 0, 0, 120, 255); colTex += 0x20; } diff --git a/src/code/z_fbdemo_fade.c b/src/code/z_fbdemo_fade.c index 1d76e8ec71..1f0843176d 100644 --- a/src/code/z_fbdemo_fade.c +++ b/src/code/z_fbdemo_fade.c @@ -62,7 +62,7 @@ void TransitionFade_Update(void* thisx, s32 updateRate) { break; case TRANS_FADE_TYPE_ONE_WAY: - this->timer += updateRate; + ((TransitionFade*)thisx)->timer += updateRate; if (this->timer >= gSaveContext.transFadeDuration) { this->timer = gSaveContext.transFadeDuration; this->isDone = true;