diff options
| author | Prakxo <87568477+Prakxo@users.noreply.github.com> | 2024-07-28 16:28:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-28 07:28:07 -0700 |
| commit | c7d98021c3e6105479a2c2429234f3308ba0cbbc (patch) | |
| tree | 2f01460556ef5a93c6ea65512ed5e726b82aeb9b | |
| parent | ed51325ede282c0673adbe41aba0b76f9cab05b3 (diff) | |
m_prenmi OK (#205)
| -rw-r--r-- | include/game.h | 2 | ||||
| -rw-r--r-- | include/viconfig.h | 4 | ||||
| -rw-r--r-- | src/overlays/gamestates/ovl_prenmi/m_prenmi.c | 75 | ||||
| -rw-r--r-- | src/overlays/gamestates/ovl_prenmi/m_prenmi.h | 7 | ||||
| -rw-r--r-- | yamls/jp/overlays.yaml | 4 |
5 files changed, 84 insertions, 8 deletions
diff --git a/include/game.h b/include/game.h index 7251b80..4cb109a 100644 --- a/include/game.h +++ b/include/game.h @@ -59,7 +59,7 @@ typedef struct Game { /* 0x9E */ s8 unk9E; /* 0x9F */ u8 running; /* 0xA0 */ s32 frameCounter; - /* 0xA4 */ UNK_TYPE1 unk_A4[0x4]; + /* 0xA4 */ s32 unk_A4; /* 0xA8 */ Controller controller; } Game; // size = 0xE0 diff --git a/include/viconfig.h b/include/viconfig.h index 60597b4..4504425 100644 --- a/include/viconfig.h +++ b/include/viconfig.h @@ -6,7 +6,7 @@ void ViConfig_UpdateVi(u32 black); void ViConfig_UpdateBlack(void); -u8 gViConfigBlackNext; -u8 gViConfigBlack; +extern u8 gViConfigBlackNext; +extern u8 gViConfigBlack; #endif diff --git a/src/overlays/gamestates/ovl_prenmi/m_prenmi.c b/src/overlays/gamestates/ovl_prenmi/m_prenmi.c new file mode 100644 index 0000000..122e1ef --- /dev/null +++ b/src/overlays/gamestates/ovl_prenmi/m_prenmi.c @@ -0,0 +1,75 @@ +#include "m_prenmi.h" +#include "irqmgr.h" +#include "viconfig.h" +#include "gfx.h" +#include "m_rcp.h" + +void prenmi_move(Game_Prenmi* prenmi) { + if (ResetStatus == 2 || prenmi->timer == 0) { + ViConfig_UpdateVi(TRUE); + STOP_GAMESTATE(&prenmi->state); + SET_NEXT_GAMESTATE(&prenmi->state, NULL, 0); + } else { + prenmi->timer--; + } +} + +void prenmi_draw(Game_Prenmi* prenmi) { + GraphicsContext* graph; + f32 yPos; + f32 time; + + graph = prenmi->state.gfxCtx; + + DisplayList_initialize(graph, 0, 0, 0, NULL); + + OPEN_POLY_OPA_DISP(graph); + + time = OS_CYCLES_TO_USEC(osGetTime() - ResetTime); + + gDPPipeSync(__polyOpa++); + gDPSetOtherMode(__polyOpa++, + G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2); + gDPSetCombineMode(__polyOpa++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); + + // set opacity + yPos = (time / 500000) * -200.0f + 250.0f; + gDPSetPrimColor(__polyOpa++, 0, 0, 0xFF, 0xFF, 0xFF, (s32)yPos); + + // adjust size + yPos = (time / 500000) * -15.0f + 127.0f; + __polyOpa = + gfx_gSPTextureRectangle1(__polyOpa, 0, (u32)(yPos * 4.0f), 0x500, (u32)((yPos + 1.0f) * 4.0f), 0, 0, 0, 0, 0); + + gDPPipeSync(__polyOpa++); + CLOSE_POLY_OPA_DISP(prenmi->state.gfxCtx); +} + +void prenmi_main(Game* game) { + Game_Prenmi* prenmi = (Game_Prenmi*)game; + GraphicsContext* graph; + + prenmi_move(prenmi); + prenmi_draw(prenmi); + + prenmi->state.unk_A4 = 1; + { UNUSED s32 scopedTemp; } + graph = game->gfxCtx; + + game_debug_draw_last(game, graph); + game_draw_last(graph); +} + +void prenmi_cleanup(UNUSED Game* game) { +} + +void prenmi_init(Game* game) { + Game_Prenmi* prenmi = (Game_Prenmi*)game; + + prenmi->state.main = &prenmi_main; + prenmi->state.destroy = &prenmi_cleanup; + prenmi->timer = 30; + SetGameFrame(1); +} diff --git a/src/overlays/gamestates/ovl_prenmi/m_prenmi.h b/src/overlays/gamestates/ovl_prenmi/m_prenmi.h index f0eaf8c..fca7218 100644 --- a/src/overlays/gamestates/ovl_prenmi/m_prenmi.h +++ b/src/overlays/gamestates/ovl_prenmi/m_prenmi.h @@ -7,10 +7,11 @@ typedef struct Game_Prenmi { /* 0x00 */ Game state; - /* 0xE0 */ UNK_TYPE1 unk00[0xE8 - 0xE0]; + /* 0xE0 */ s32 timer; + /* 0xE4 */ UNK_TYPE unk_E4; } Game_Prenmi; // size = 0xE8 -void prenmi_init(Game *thisx); -void prenmi_cleanup(Game *thisx); +void prenmi_init(Game* game); +void prenmi_cleanup(Game* thisx); #endif diff --git a/yamls/jp/overlays.yaml b/yamls/jp/overlays.yaml index f09f55a..2f19531 100644 --- a/yamls/jp/overlays.yaml +++ b/yamls/jp/overlays.yaml @@ -197,8 +197,8 @@ compress: True bss_size: 0x0 subsegments: - - [0x7745B0, asm, overlays/gamestates/ovl_prenmi/m_prenmi] - - [0x774970, rodata, overlays/gamestates/ovl_prenmi/m_prenmi] + - [0x7745B0, c, overlays/gamestates/ovl_prenmi/m_prenmi] + - [0x774970, .rodata, overlays/gamestates/ovl_prenmi/m_prenmi] - name: ovl_prenmi_reloc type: code start: 0x774980 |
