diff options
| author | Prakxo <87568477+Prakxo@users.noreply.github.com> | 2024-10-21 16:57:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-21 07:57:26 -0700 |
| commit | 943287ddfa1bc36685c541eab209b01f75078c52 (patch) | |
| tree | e4c57bfdc61c6a1f452fd6e8f999e3cb533a30ab /src/code/m_fbdemo_wipe1.c | |
| parent | 78d0c294c50f9ade86f9e60cb2bea6479b56357a (diff) | |
m_fbdemo* OK (#223)
* m_fbdemo OK
* m_fbdemo_wipe1 OK
* fix play
* m_fbdemo_triforce OK
* link triforce
* m_fbdemo_fade OK
* typo
* newline
* format
Diffstat (limited to 'src/code/m_fbdemo_wipe1.c')
| -rw-r--r-- | src/code/m_fbdemo_wipe1.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/src/code/m_fbdemo_wipe1.c b/src/code/m_fbdemo_wipe1.c new file mode 100644 index 0000000..3fc67f2 --- /dev/null +++ b/src/code/m_fbdemo_wipe1.c @@ -0,0 +1,94 @@ +#include "m_fbdemo_wipe1.h" +#include "m_common_data.h" +#include "m_rcp.h" + +extern Gfx wipe1_modelT[]; // TODO: extract + +fbDemoWipe1* fbdemo_wipe1_init(fbDemoWipe1* this) { + bzero(this, sizeof(fbDemoWipe1)); + return this; +} + +void fbdemo_wipe1_move(fbDemoWipe1* this, s32 rate) { + if (this->direction != 0) { + this->texY += (common_data.wipeRate * 3) / rate; + if (this->texY >= (s32)(153.0f * (1 << 2))) { + this->texY = (s32)(153.0f * (1 << 2)); + this->finished = TRUE; + } + } else { + this->texY -= (common_data.wipeRate * 3) / rate; + if (this->texY <= (s32)(83.25f * (1 << 2))) { + this->texY = (s32)(83.25f * (1 << 2)); + this->finished = TRUE; + } + } +} + +void fbdemo_wipe1_draw(fbDemoWipe1* this, Gfx** gfxP) { + Gfx* gfx = *gfxP; + Mtx* modelView; + UNUSED s32 pad[5]; + + Gfx* texScroll; + + modelView = this->modelView[this->frame]; + this->frame ^= 1; + + guScale(&modelView[0], 0.56f, 0.56f, 1.0f); + guRotate(&modelView[1], 0.0f, 0.0f, 0.0f, 1.0f); + guTranslate(&modelView[2], 0.0f, 0.0f, 0.0f); + gDPPipeSync(gfx++); + + texScroll = gfx_tex_scroll2(&gfx, this->texX, this->texY, 0, 0); + gSPSegment(gfx++, 8, texScroll); + + gDPSetPrimColor(gfx++, 0, 0x80, this->color.r, this->color.g, this->color.b, 255); + + gSPMatrix(gfx++, &this->projection, G_MTX_LOAD | G_MTX_PROJECTION); + gSPPerspNormalize(gfx++, this->normal); + + gSPMatrix(gfx++, &this->lookAt, G_MTX_MUL | G_MTX_PROJECTION); + gSPMatrix(gfx++, &modelView[0], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(gfx++, &modelView[1], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); + gSPMatrix(gfx++, &modelView[2], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); + + gSPDisplayList(gfx++, wipe1_modelT); + gDPPipeSync(gfx++); + *gfxP = gfx; +} + +void fbdemo_wipe1_startup(fbDemoWipe1* this) { + this->finished = 0; + + if (this->direction != 0) { + this->texY = (s32)(83.25f * (1 << 2)); + } else { + this->texY = (s32)(153.0f * (1 << 2)); + } + + guPerspective(&this->projection, &this->normal, 60.0f, 4.0f / 3.0f, 10.0f, 12800.0f, 1.0f); + guLookAt(&this->lookAt, 0.0f, 0.0f, 400.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); +} + +void fbdemo_wipe1_settype(fbDemoWipe1* this, s32 type) { + if (type == 1) { + this->direction = 1; + this->texY = 0x14D; + return; + } + this->direction = 0; + this->texY = 0x264; +} + +void fbdemo_wipe1_setcolor_rgba8888(fbDemoWipe1* this, u32 color) { + this->color.rgba = color; +} + +void fbdemo_wipe1_setaltcolor_rgba8888(fbDemoWipe1* this, u32 color) { + this->altColor.rgba = color; +} + +u8 fbdemo_wipe1_is_finish(fbDemoWipe1* this) { + return this->finished; +} |
