From d3c5ce50f0e973db16fda93552d4c412fe302551 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Tue, 5 Apr 2022 22:56:37 +0300 Subject: [PATCH] Add fade flags enum --- include/fade.h | 8 ++++ include/script.h | 2 +- src/beanstalkSubtask.c | 2 +- src/demo.c | 4 +- src/enemy/enemy64.c | 4 +- src/enemy/gleerok.c | 4 +- src/enemy/vaatiWrath.c | 2 +- src/enterPortalSubtask.c | 4 +- src/fade.c | 24 ++++++------ src/fileselect.c | 4 +- src/game.c | 76 ++++++++++++++++++------------------ src/manager/manager37.c | 4 +- src/menu/figurine_menu.c | 2 +- src/menu/kinstone_menu.c | 2 +- src/menu/pause_menu.c | 2 +- src/npc/simon.c | 4 +- src/object/fourElements.c | 2 +- src/object/greatFairy.c | 2 +- src/object/gyorgBossObject.c | 2 +- src/object/object3D.c | 2 +- src/object/object6A.c | 4 +- src/object/object8E.c | 2 +- src/player.c | 6 +-- src/roomInit.c | 16 ++++---- src/script.c | 42 ++++++++++---------- src/staffroll.c | 18 ++++----- src/sub_08055E08.c | 2 +- src/subtask.c | 70 ++++++++++++++++----------------- src/subtask2.c | 16 ++++---- src/title.c | 12 +++--- 30 files changed, 176 insertions(+), 168 deletions(-) diff --git a/include/fade.h b/include/fade.h index 0de28da9..c9b30e10 100644 --- a/include/fade.h +++ b/include/fade.h @@ -3,6 +3,14 @@ #include "global.h" +typedef enum { + FADE_IN_OUT = 0x1, + FADE_BLACK_WHITE = 0x2, + FADE_INSTANT = 0x4, + FADE_MOSAIC = 0x8, + FADE_IRIS = 0x10, +} FadeFlags; + /** * @struct FadeControl * @brief Controls screen fading effects. diff --git a/include/script.h b/include/script.h index 519af3c3..3c4e5bfe 100644 --- a/include/script.h +++ b/include/script.h @@ -25,7 +25,7 @@ typedef struct { /*0x4*/ u16 commandIndex; /*0x6*/ u8 commandSize; /*0x7*/ u8 flags; - /*0x8*/ u8 unk_08; + /*0x8*/ u8 fadeSpeed; } ActiveScriptInfo; extern ActiveScriptInfo gActiveScriptInfo; diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c index 179c20d9..2f1f1044 100644 --- a/src/beanstalkSubtask.c +++ b/src/beanstalkSubtask.c @@ -69,7 +69,7 @@ void sub_08019698(void) { FlushSprites(); DrawEntities(); CopyOAM(); - SetFade(4, 8); + SetFade(FADE_INSTANT, 8); gUnk_02018EB0.unk_0++; } diff --git a/src/demo.c b/src/demo.c index 9b7b4356..94f2434f 100644 --- a/src/demo.c +++ b/src/demo.c @@ -75,7 +75,7 @@ void sub_080A2E40(void) { sub_080A3198(0, 0); gMain.state = GAMETASK_INIT; SoundReq(BGM_FILE_SELECT); - SetFade(4, 8); + SetFade(FADE_INSTANT, 8); } void sub_080A2F8C(void) { @@ -90,7 +90,7 @@ void sub_080A2F8C(void) { *(u8*)(addr + 6) = 1; } gMain.state = GAMETASK_MAIN; - SetFade(5, 8); + SetFade(FADE_IN_OUT | FADE_INSTANT, 8); break; case GAMEMAIN_CHANGEROOM: SetTask(TASK_GAME); diff --git a/src/enemy/enemy64.c b/src/enemy/enemy64.c index 529bce1e..5017f1b4 100644 --- a/src/enemy/enemy64.c +++ b/src/enemy/enemy64.c @@ -358,7 +358,7 @@ void Enemy64_Action4_SubAction4(Enemy64Entity* this) { sub_08049998(this, ((0x100 - super->direction) & 0xff) << 8); if (--super->timer == 0) { super->subAction = 5; - SetFade(5, 0x10); + SetFade(FADE_IN_OUT | FADE_INSTANT, 0x10); } } @@ -382,7 +382,7 @@ void Enemy64_Action4_SubAction5(Enemy64Entity* this) { entity->y.HALF.HI = gRoomControls.origin_y + 0x80; entity->animationState = 0; sub_080809D4(); - SetFade(4, 4); + SetFade(FADE_INSTANT, 4); } } diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index 0ca18b24..79becc26 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -126,7 +126,7 @@ void Gleerok_OnDeath(GleerokEntity* this) { void sub_0802D158(GleerokEntity* this) { super->action = 1; gPauseMenuOptions.disabled = 1; - SetFade(7, 8); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 8); } void sub_0802D170(GleerokEntity* this) { @@ -143,7 +143,7 @@ void sub_0802D170(GleerokEntity* this) { gPlayerEntity.animationState = 0; RestorePrevTileEntity(COORD_TO_TILE(&gPlayerEntity), 2); gRoomControls.camera_target = super; - SetFade(6, 8); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8); } } else { super->action = 3; diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index 8097dd49..c87d199d 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -666,7 +666,7 @@ void sub_08041D84(Entity* this) { ChangeObjPalette(this->child, gUnk_080D0E80[(this->subtimer - 0xb8) >> 3]); } if (this->subtimer == 0xe6) { - SetFade(7, 4); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 4); } } else { this->subAction = 4; diff --git a/src/enterPortalSubtask.c b/src/enterPortalSubtask.c index c0a1f948..c9f49205 100644 --- a/src/enterPortalSubtask.c +++ b/src/enterPortalSubtask.c @@ -101,7 +101,7 @@ void sub_0804AB70(void) { LoadRoomEntityList((EntityData*)gUnk_080D4110[portalId]); ResetSystemPriority(); gArea.filler3[0]++; - SetFade(4, 8); + SetFade(FADE_INSTANT, 8); } void sub_0804AC1C(void) { @@ -127,7 +127,7 @@ void sub_0804AC1C(void) { CopyOAM(); if ((gUnk_02018EB0.unk_1b != 0) || sub_0804ACA8()) { gArea.filler3[0]++; - SetFade(7, 0x10); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 0x10); } } diff --git a/src/fade.c b/src/fade.c index c245a021..62bd7708 100644 --- a/src/fade.c +++ b/src/fade.c @@ -55,11 +55,11 @@ void ResetFadeMask(void) { static void sub_08050024(void) { sub_0801E104(); - SetFade(5, 256); + SetFade(FADE_IN_OUT | FADE_INSTANT, 256); } void SetFadeProgress(u32 arg0) { - if ((gFadeControl.type & 1) != 0) { + if ((gFadeControl.type & FADE_IN_OUT) != 0) { gFadeControl.sustain = arg0; } else { gFadeControl.progress = arg0; @@ -72,22 +72,22 @@ void SetFade(u32 type, u32 speed) { gFadeControl.active = 1; gFadeControl.progress = 0x100; gFadeControl.sustain = 0; - if (gFadeControl.type & 2) { + if (gFadeControl.type & FADE_BLACK_WHITE) { gFadeControl.color = 0xf8; } else { gFadeControl.color = 0; } - if (type & 8) { + if (type & FADE_MOSAIC) { gOAMControls.spritesOffset = 1; gScreen.bg1.control |= BGCNT_MOSAIC; gScreen.bg2.control |= BGCNT_MOSAIC; gScreen.bg3.control |= BGCNT_MOSAIC; } - if (type & 0x10) { + if (type & FADE_IRIS) { sub_0801E1B8(gFadeControl.win_inside_cnt, gFadeControl.win_outside_cnt); sub_0801E1EC(gFadeControl.iris_x, gFadeControl.iris_y, gFadeControl.iris_size); - if ((type & 1) == 0) { - gFadeControl.type &= ~4; + if ((type & FADE_IN_OUT) == 0) { + gFadeControl.type &= ~FADE_INSTANT; ResetFadeMask(); gUsedPalettes = 0xffffffff; } @@ -96,13 +96,13 @@ void SetFade(u32 type, u32 speed) { void SetFadeInverted(u32 speed) { gFadeControl.speed = speed; - gFadeControl.type ^= 1; + gFadeControl.type ^= FADE_IN_OUT; gFadeControl.active = 1; gFadeControl.progress = 256; } void SetFadeIris(u32 x, u32 y, u32 type, u32 speed) { - if ((type & 1) != 0) { + if ((type & FADE_IN_OUT) != 0) { gFadeControl.iris_size = 0x96; } else { gFadeControl.iris_size = 0; @@ -149,7 +149,7 @@ static u32 sub_080501C0(FadeControl* ctl) { struct_020354C0* v3; u32 i; - if (ctl->type & 1) { + if (ctl->type & FADE_IN_OUT) { v1 = 256 - (s16)ctl->progress; } else { v1 = (s16)ctl->progress; @@ -183,7 +183,7 @@ static u32 sub_08050230(FadeControl* ctl) { // fade is finished gOAMControls.spritesOffset = 0; - if ((type & 1) == 0) { + if ((type & FADE_IN_OUT) == 0) { // reset registers if fading in gScreen.bg0.control &= ~BGCNT_MOSAIC; gScreen.bg1.control &= ~BGCNT_MOSAIC; @@ -194,7 +194,7 @@ static u32 sub_08050230(FadeControl* ctl) { } static u32 sub_080502A4(FadeControl* ctl) { - if (ctl->type & 1) { + if (ctl->type & FADE_IN_OUT) { s32 delta = (u16)gFadeControl.iris_size - gFadeControl.speed; gFadeControl.iris_size -= gFadeControl.speed; if (delta << 16 <= 0) diff --git a/src/fileselect.c b/src/fileselect.c index b0ce954b..ca9feb1a 100644 --- a/src/fileselect.c +++ b/src/fileselect.c @@ -234,7 +234,7 @@ static void HandleFileScreenEnter(void) { gGFXSlots.unk0 = 1; gMain.state = GAMETASK_INIT; SoundReq(BGM_FILE_SELECT); - SetFade(4, 8); + SetFade(FADE_INSTANT, 8); } static void HandleFileScreenActive(void) { @@ -1217,7 +1217,7 @@ void HandleFileStart(void) { gSaveHeader->msg_speed = gSave.msg_speed; gSaveHeader->brightness = gSave.brightness; gMain.state = GAMETASK_MAIN; - SetFade(5, 8); + SetFade(FADE_IN_OUT | FADE_INSTANT, 8); } } diff --git a/src/game.c b/src/game.c index 781f1acf..7257bac0 100644 --- a/src/game.c +++ b/src/game.c @@ -251,7 +251,7 @@ void GameTask(void) { #ifdef DEMO_USA if (gSave.demo_timer != 0) { if (--gSave.demo_timer == 0) { - SetFade(7, 2); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 2); gMain.state = GAMETASK_EXIT; } } @@ -478,7 +478,7 @@ static void GameTask_Exit(void) { if (!gFadeControl.active) DoSoftReset(); #else - SetFade(7, 8); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 8); SetTask(TASK_GAMEOVER); #endif } @@ -716,12 +716,12 @@ static void GameOver_FadeIn(void) { switch_state(GAMETASK_MAIN); #if defined(DEMO_USA) || defined(DEMO_JP) SoundReq(SONG_VOL_FADE_OUT); - SetFade(7, 4); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 4); #else SetPopupState(0, 0); gScreen.lcd.displayControl |= DISPCNT_BG1_ON | DISPCNT_BG2_ON; gFadeControl.mask = 0x0000ffff; - SetFade(4, 16); + SetFade(FADE_INSTANT, 16); #endif } } @@ -839,9 +839,9 @@ static void GameOver_Update(void) { SetMenuType(2); SoundReq(SFX_TEXTBOX_SELECT); if (temp == 0) { - SetFade(5, 8); + SetFade(FADE_IN_OUT | FADE_INSTANT, 8); } else { - SetFade(7, 8); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 8); } break; } @@ -1153,7 +1153,7 @@ static bool32 CheckGameOver(void) { InitFade(); gMain.state = GAMETASK_EXIT; gMain.substate = GAMEMAIN_INITROOM; - SetFade(5, 8); + SetFade(FADE_IN_OUT | FADE_INSTANT, 8); SoundReq(SONG_STOP_BGM); return TRUE; } @@ -1174,29 +1174,29 @@ static bool32 CheckRoomExit(void) { switch (gRoomTransition.type) { case TRANSITION_CUT: - SetFade(13, 8); + SetFade(FADE_IN_OUT | FADE_INSTANT | FADE_MOSAIC, 8); break; case TRANSITION_CUT_FAST: - SetFade(13, 3); + SetFade(FADE_IN_OUT | FADE_INSTANT | FADE_MOSAIC, 3); break; case TRANSITION_FADE_WHITE_SLOW: - SetFade(7, 4); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 4); break; case TRANSITION_FADE_BLACK_SLOW: - SetFade(5, 4); + SetFade(FADE_IN_OUT | FADE_INSTANT, 4); break; case TRANSITION_FADE_BLACK: - SetFade(5, 16); + SetFade(FADE_IN_OUT | FADE_INSTANT, 16); break; case TRANSITION_FADE_BLACK_FAST: - SetFade(5, 256); + SetFade(FADE_IN_OUT | FADE_INSTANT, 256); break; case TRANSITION_7: case TRANSITION_FADE_WHITE_FAST: - SetFade(7, 256); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 256); break; default: - SetFade(7, 16); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 16); break; } RoomExitCallback(); @@ -1243,27 +1243,27 @@ void InitParachuteRoom(void) { static void InitRoomTransition(void) { switch (gRoomTransition.type) { case TRANSITION_CUT: - SetFade(12, 8); + SetFade(FADE_INSTANT | FADE_MOSAIC, 8); break; case TRANSITION_CUT_FAST: - SetFade(12, 3); + SetFade(FADE_INSTANT | FADE_MOSAIC, 3); break; case TRANSITION_FADE_WHITE_SLOW: - SetFade(6, 4); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 4); break; case TRANSITION_3: break; case TRANSITION_FADE_BLACK_FAST: - SetFade(5, 256); + SetFade(FADE_IN_OUT | FADE_INSTANT, 256); break; case TRANSITION_7: - SetFade(7, 256); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 256); break; case TRANSITION_FADE_BLACK: - SetFade(4, 16); + SetFade(FADE_INSTANT, 16); break; case TRANSITION_FADE_WHITE_FAST: - SetFade(6, 8); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8); break; default: SetFadeInverted(16); @@ -1783,7 +1783,7 @@ void sub_080535AC(void) { gUpdateVisibleTiles = 1; gScreen.lcd.displayControl &= 0xfeff; LoadRoomEntityList((EntityData*)gUnk_080FCB94); - SetFade(6, 8); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8); } void sub_080535F4(void) { @@ -1834,7 +1834,7 @@ void sub_080536A8(void) { void sub_080536B8(void) { sub_080A71C4(5, 3, 4, 4); - SetFade(5, 0x100); + SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } void sub_080536D4(void) { @@ -1850,7 +1850,7 @@ void sub_0805370C(void) { gUpdateVisibleTiles = 1; sub_08051FF0(); LoadRoomEntityList((EntityData*)gUnk_080FCC54); - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_0805373C(void) { @@ -1881,7 +1881,7 @@ void sub_08053758(void) { gScreen.bg2.control = 0x1dc1; SoundReq(BGM_STORY); ResetSystemPriority(); - SetFade(5, 0x100); + SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } ASM_FUNC("asm/non_matching/game/sub_08053800.inc", void sub_08053800()) @@ -1897,7 +1897,7 @@ void sub_08053974(void) { SetBGDefaults(); sub_08051F78(); LoadRoomEntityList((EntityData*)&gUnk_080FCBC4); - SetFade(5, 0x100); + SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); gMenu.overlayType++; } } @@ -1930,14 +1930,14 @@ void sub_08053A1C(void) { MessageFromTarget(0xf07); gMessage.textWindowPosX = 1; gMessage.textWindowPosY = 8; - SetFade(4, 8); + SetFade(FADE_INSTANT, 8); } } void sub_08053A5C(void) { if (((gMessage.doTextBox & 0x7f) == 0) && --gMenu.transitionTimer == 0) { gMenu.overlayType++; - SetFade(5, 8); + SetFade(FADE_IN_OUT | FADE_INSTANT, 8); } } @@ -1957,7 +1957,7 @@ void sub_08053ACC(void) { gUpdateVisibleTiles = 1; sub_08051FF0(); LoadRoomEntityList((EntityData*)&gUnk_080FCD84); - SetFade(5, 0x100); + SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } void sub_08053B00(void) { @@ -1968,13 +1968,13 @@ void sub_08053B10(void) { if (CheckRoomFlag(1)) { gMenu.menuType++; DispReset(1); - SetFade(4, 0x100); + SetFade(FADE_INSTANT, 0x100); } } void sub_08053B3C(void) { sub_080A71C4(5, 4, 5, 0x100); - SetFade(5, 0x100); + SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } void sub_08053B58(void) { @@ -1987,7 +1987,7 @@ void sub_08053B74(void) { LoadRoomEntityList((EntityData*)&gUnk_080FCDE0); ResetSystemPriority(); ResetEntityPriority(); - SetFade(5, 0x100); + SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } void sub_08053BAC(void) { @@ -1998,13 +1998,13 @@ void sub_08053BBC(void) { if (CheckRoomFlag(0)) { gMenu.menuType++; DispReset(1); - SetFade(4, 0x100); + SetFade(FADE_INSTANT, 0x100); } } void sub_08053BE8(void) { sub_080A71C4(5, 2, 5, 0x100); - SetFade(5, 0x100); + SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } void sub_08053C04(void) { @@ -2018,7 +2018,7 @@ void sub_08053C20(void) { sub_08051FF0(); sub_0805B4D0(4); LoadRoomEntityList((EntityData*)&gUnk_080FCEBC); - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); SoundReq(BGM_FIGHT_THEME2); } @@ -2026,7 +2026,7 @@ void nullsub_483(void) { } void sub_08053C60(void) { - SetFade(5, 2); + SetFade(FADE_IN_OUT | FADE_INSTANT, 2); SoundReq(SFX_SUMMON); SoundReq(SONG_STOP_BGM); SetTask(3); @@ -2107,7 +2107,7 @@ void sub_08053E74(void) { gScreen.lcd.displayControl &= 0xfeff; gUpdateVisibleTiles = 1; SetMinPriority(1); - SetFade(4, 8); + SetFade(FADE_INSTANT, 8); } void sub_08053EC4(void) { diff --git a/src/manager/manager37.c b/src/manager/manager37.c index fc7a4908..e685a135 100644 --- a/src/manager/manager37.c +++ b/src/manager/manager37.c @@ -89,7 +89,7 @@ void sub_0805DF98(Manager* this) { this->unk_0e -= 1; } else { this->action = 4; - SetFade(7, 4); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 4); SoundReq(SFX_EVAPORATE); } } @@ -120,7 +120,7 @@ void sub_0805E000(Manager* this) { this->action = 1; SetPlayerControl(3); gArea.queued_bgm = 0x80010000; - SetFade(6, 4); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 4); SoundReq(SFX_APPARATE); } } diff --git a/src/menu/figurine_menu.c b/src/menu/figurine_menu.c index 1c9f6557..2ea9ddfd 100644 --- a/src/menu/figurine_menu.c +++ b/src/menu/figurine_menu.c @@ -118,7 +118,7 @@ void FigurineMenu_080A4608(void) { r1 = 1; } gFigurineMenu.figure_idx = r1; - SetFade(4, 8); + SetFade(FADE_INSTANT, 8); } void FigurineMenu_080A46C0(void) { diff --git a/src/menu/kinstone_menu.c b/src/menu/kinstone_menu.c index c0e9f7b6..24547940 100644 --- a/src/menu/kinstone_menu.c +++ b/src/menu/kinstone_menu.c @@ -128,7 +128,7 @@ void KinstoneMenu_Type0(void) { sub_0801E738(0); sub_080A70AC((void*)gUnk_081280DC); SetMenuType(1); - SetFade(6, 8); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8); } const u8 gUnk_081280EE[] = { diff --git a/src/menu/pause_menu.c b/src/menu/pause_menu.c index 4952837d..1c587928 100644 --- a/src/menu/pause_menu.c +++ b/src/menu/pause_menu.c @@ -86,7 +86,7 @@ void PauseMenu_Variant0(void) { gPauseMenuOptions.unk1 = r0; gPauseMenuOptions.unk14 = r0; sub_080A4DB8(r0); - SetFade(4, 0x20); + SetFade(FADE_INSTANT, 0x20); sub_080A4E90(1); } diff --git a/src/npc/simon.c b/src/npc/simon.c index d59d3b16..0dec015f 100644 --- a/src/npc/simon.c +++ b/src/npc/simon.c @@ -45,10 +45,10 @@ void sub_0806C280(void) { void sub_0806C2A0(Entity* this, ScriptExecutionContext* context) { switch (context->intVariable) { case 0: - SetFade(0xd, 4); + SetFade(FADE_IN_OUT | FADE_INSTANT | FADE_MOSAIC, 4); break; case 1: - SetFade(0xc, 4); + SetFade(FADE_INSTANT | FADE_MOSAIC, 4); break; } } diff --git a/src/object/fourElements.c b/src/object/fourElements.c index fb26c54b..24141d89 100644 --- a/src/object/fourElements.c +++ b/src/object/fourElements.c @@ -98,7 +98,7 @@ void FourElements_Action2(FourElementsEntity* this) { gScreen.controls.alphaBlend = 0; InitItemGetSequence(super->type, 0, 1); sub_0808C650(super, 1); - SetFade(6, 2); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 2); SoundReq(SFX_F8); SoundReq(SFX_148); SoundReq(BGM_ELEMENT_GET); diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c index fdc16d3e..b8cf0c60 100644 --- a/src/object/greatFairy.c +++ b/src/object/greatFairy.c @@ -119,7 +119,7 @@ void GreatFairy_SpawningUpdate(Entity* this) { mini = GreatFairy_CreateForm(this, WAKE, 0); //??? if (mini != NULL) { CopyPosition(this, mini); - SetFade(6, 4); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 4); SoundReq(SFX_145); this->action = 4; this->timer = 60; diff --git a/src/object/gyorgBossObject.c b/src/object/gyorgBossObject.c index 047c9a40..910498aa 100644 --- a/src/object/gyorgBossObject.c +++ b/src/object/gyorgBossObject.c @@ -252,7 +252,7 @@ void GyorgBossObject_FightEnd(GyorgBossObjectEntity* this) { return; } if (super->subtimer == 0x3C) { - SetFade(7, 4); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 4); } return; } diff --git a/src/object/object3D.c b/src/object/object3D.c index 79a1aa16..82213ab0 100644 --- a/src/object/object3D.c +++ b/src/object/object3D.c @@ -76,7 +76,7 @@ void Object3D_Action1(Object3DEntity* this) { super->spriteRendering.b0 = 3; SetAffineInfo(super, 0x100, 0x100, 0); gArea.field_0x10 = 1; - SetFade(5, 8); + SetFade(FADE_IN_OUT | FADE_INSTANT, 8); } } diff --git a/src/object/object6A.c b/src/object/object6A.c index 6fdfce59..67ccf719 100644 --- a/src/object/object6A.c +++ b/src/object/object6A.c @@ -1305,11 +1305,11 @@ void sub_0809629C(Object6AEntity* this, u32 type) { } void sub_080962D8(Object6AEntity* this) { - SetFade(6, 0x100); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 0x100); } void sub_080962E8(Object6AEntity* this) { - SetFade(7, 0x100); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 0x100); } void sub_080962F8(Object6AEntity* this, ScriptExecutionContext* ctx) { diff --git a/src/object/object8E.c b/src/object/object8E.c index 5a4956c3..c987b2e8 100644 --- a/src/object/object8E.c +++ b/src/object/object8E.c @@ -253,7 +253,7 @@ void Object8E_Type3(Object8EEntity* this) { if (sub_0809BE78(this)) { if (super->timer != 0) { if (--super->timer == 0) { - SetFade(6, 8); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8); sub_0805AAF0(3); gScreen.lcd.displayControl = (gScreen.lcd.displayControl & 0xbfff) | 0x2800; } diff --git a/src/player.c b/src/player.c index 944138c8..86af3340 100644 --- a/src/player.c +++ b/src/player.c @@ -1022,7 +1022,7 @@ static void PlayerUsePortal(Entity* this) { if (AreaIsDungeon() || gArea.portal_type == 3) { this->subAction = 7; this->timer = 30; - SetFade(7, 16); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 16); SoundReq(SFX_F8); } else { RespawnAsMinish(); @@ -2660,7 +2660,7 @@ static void sub_0807332C(Entity* this) { } else { gMain.substate = GAMEMAIN_CHANGEAREA; gMain.pad = 1; - SetFade(5, 8); + SetFade(FADE_IN_OUT | FADE_INSTANT, 8); } } @@ -3818,7 +3818,7 @@ static void sub_08074C68(Entity* this) { gPlayerState.animation = 1850; else gPlayerState.animation = 1846; - SetFade(5, 0x100); + SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } } diff --git a/src/roomInit.c b/src/roomInit.c index 7f2b8d4e..927e090c 100644 --- a/src/roomInit.c +++ b/src/roomInit.c @@ -407,7 +407,7 @@ extern void* script_PlayerSleepingInn[]; void sub_StateChange_HouseInteriors1_InnWestRoom(void) { if (CheckLocalFlag(YADO_CHECKIN)) { ClearLocalFlag(YADO_CHECKIN); - SetFade(5, 256); + SetFade(FADE_IN_OUT | FADE_INSTANT, 256); gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0x50; gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x38; sub_080751E8(1, 2, &script_PlayerSleepingInn); @@ -433,7 +433,7 @@ u32 sub_unk3_HouseInteriors1_InnMiddleRoom(void) { void sub_StateChange_HouseInteriors1_InnMiddleRoom(void) { if (CheckLocalFlag(YADO_CHECKIN) != 0) { ClearLocalFlag(YADO_CHECKIN); - SetFade(5, 256); + SetFade(FADE_IN_OUT | FADE_INSTANT, 256); gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0x50; gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x38; sub_080751E8(1, 2, &script_PlayerSleepingInn); @@ -459,7 +459,7 @@ u32 sub_unk3_HouseInteriors1_InnEastRoom(void) { void sub_StateChange_HouseInteriors1_InnEastRoom(void) { if (CheckLocalFlag(YADO_CHECKIN)) { ClearLocalFlag(YADO_CHECKIN); - SetFade(5, 256); + SetFade(FADE_IN_OUT | FADE_INSTANT, 256); gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0x60; gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x38; sub_080751E8(1, 2, &script_PlayerSleepingInn); @@ -679,7 +679,7 @@ extern u32 script_PlayerWakingUpInHyruleCastle; void sub_StateChange_HyruleCastle_4(void) { if (!CheckLocalFlag(CASTLE_04_MEZAME)) { - SetFade(5, 256); + SetFade(FADE_IN_OUT | FADE_INSTANT, 256); gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0xb0; gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x40; sub_080751E8(0, 6, &script_PlayerWakingUpInHyruleCastle); @@ -4349,9 +4349,9 @@ u32 sub_unk3_HyruleTown_0(void) { #else if (CheckLocalFlag(0xcd) == 0) { #endif - SetFade(7, 0x100); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 0x100); } else { - SetFade(6, 0x10); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 0x10); } } return 1; @@ -4976,7 +4976,7 @@ void sub_StateChange_HouseInteriors2_LinksHouseBedroom(void) { if (!CheckGlobalFlag(START) && !CheckLocalFlag(0x46)) { sub_080A71C4(5, 1, 4, 4); gUpdateVisibleTiles = 0; - SetFade(5, 256); + SetFade(FADE_IN_OUT | FADE_INSTANT, 256); sub_080751E8(0, 6, &script_PlayerIntro); } if (!CheckGlobalFlag(OUTDOOR)) { @@ -5711,7 +5711,7 @@ u32 sub_unk3_HyruleField_SouthHyruleField(void) { #else if (!CheckLocalFlag(0x6d)) { #endif - SetFade(7, 256); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 256); } SetGlobalFlag(OUTDOOR); return 1; diff --git a/src/script.c b/src/script.c index 92fad99a..fba92017 100644 --- a/src/script.c +++ b/src/script.c @@ -77,9 +77,9 @@ void ScriptCommand_SetFade4(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_SetFade5(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_SetFade6(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_SetFade7(Entity* entity, ScriptExecutionContext* context); -void ScriptCommand_0807E800(Entity* entity, ScriptExecutionContext* context); -void ScriptCommand_0807E80C(Entity* entity, ScriptExecutionContext* context); -void sub_0807E818(u32); +void ScriptCommand_SetFadeIris(Entity* entity, ScriptExecutionContext* context); +void ScriptCommand_SetFadeIrisInOut(Entity* entity, ScriptExecutionContext* context); +void SetFadeIrisForCameraTarget(u32); void ScriptCommand_0807E858(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_SetPlayerIdle(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_EnablePlayerControl(Entity* entity, ScriptExecutionContext* context); @@ -167,7 +167,7 @@ void InitScriptData(void) { MemClear(&gActiveScriptInfo, sizeof(gActiveScriptInfo)); MemClear(&gScriptExecutionContextArray, sizeof(gScriptExecutionContextArray)); MemClear(&gPlayerScriptExecutionContext, sizeof(gPlayerScriptExecutionContext)); - gActiveScriptInfo.unk_08 = 8; + gActiveScriptInfo.fadeSpeed = 8; } ScriptExecutionContext* CreateScriptExecutionContext(void) { @@ -526,8 +526,8 @@ void ExecuteScript(Entity* entity, ScriptExecutionContext* context) { ScriptCommand_SetFade5, ScriptCommand_SetFade6, ScriptCommand_SetFade7, - ScriptCommand_0807E800, - ScriptCommand_0807E80C, + ScriptCommand_SetFadeIris, + ScriptCommand_SetFadeIrisInOut, ScriptCommand_0807E858, ScriptCommand_SetPlayerIdle, ScriptCommand_EnablePlayerControl, @@ -997,7 +997,7 @@ void ScriptCommand_WaitForFadeFinish(Entity* entity, ScriptExecutionContext* con } void ScriptCommand_SetFadeTime(Entity* entity, ScriptExecutionContext* context) { - gActiveScriptInfo.unk_08 = context->scriptInstructionPointer[1]; + gActiveScriptInfo.fadeSpeed = context->scriptInstructionPointer[1]; } void ScriptCommand_SetFadeMask(Entity* entity, ScriptExecutionContext* context) { @@ -1005,47 +1005,47 @@ void ScriptCommand_SetFadeMask(Entity* entity, ScriptExecutionContext* context) } void ScriptCommand_FadeInvert(Entity* entity, ScriptExecutionContext* context) { - SetFadeInverted(gActiveScriptInfo.unk_08); + SetFadeInverted(gActiveScriptInfo.fadeSpeed); } void ScriptCommandNop2(Entity* entity, ScriptExecutionContext* context) { } void ScriptCommand_SetFade4(Entity* entity, ScriptExecutionContext* context) { - SetFade(4, gActiveScriptInfo.unk_08); + SetFade(FADE_INSTANT, gActiveScriptInfo.fadeSpeed); } void ScriptCommand_SetFade5(Entity* entity, ScriptExecutionContext* context) { - SetFade(5, gActiveScriptInfo.unk_08); + SetFade(FADE_IN_OUT | FADE_INSTANT, gActiveScriptInfo.fadeSpeed); } void ScriptCommand_SetFade6(Entity* entity, ScriptExecutionContext* context) { - SetFade(6, gActiveScriptInfo.unk_08); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, gActiveScriptInfo.fadeSpeed); } void ScriptCommand_SetFade7(Entity* entity, ScriptExecutionContext* context) { - SetFade(7, gActiveScriptInfo.unk_08); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, gActiveScriptInfo.fadeSpeed); } -void ScriptCommand_0807E800(Entity* entity, ScriptExecutionContext* context) { - sub_0807E818(0x10); +void ScriptCommand_SetFadeIris(Entity* entity, ScriptExecutionContext* context) { + SetFadeIrisForCameraTarget(FADE_IRIS); } -void ScriptCommand_0807E80C(Entity* entity, ScriptExecutionContext* context) { - sub_0807E818(0x11); +void ScriptCommand_SetFadeIrisInOut(Entity* entity, ScriptExecutionContext* context) { + SetFadeIrisForCameraTarget(FADE_IN_OUT | FADE_IRIS); } -void sub_0807E818(u32 type) { +void SetFadeIrisForCameraTarget(u32 type) { Entity* cameraTarget = gRoomControls.camera_target; u32 x, y; if (cameraTarget) { x = cameraTarget->x.HALF.HI - gRoomControls.scroll_x; y = cameraTarget->y.HALF.HI - gRoomControls.scroll_y; } else { - x = 0x78; - y = 0x50; + x = DISPLAY_WIDTH / 2; + y = DISPLAY_HEIGHT / 2; } - SetFadeIris(x, y, type, gActiveScriptInfo.unk_08); + SetFadeIris(x, y, type, gActiveScriptInfo.fadeSpeed); } void ScriptCommand_0807E858(Entity* entity, ScriptExecutionContext* context) { @@ -1570,7 +1570,7 @@ void SetCollisionLayer2(Entity* entity, ScriptExecutionContext* context) { } void sub_0807F190(Entity* entity, ScriptExecutionContext* context) { - SetFade(4, 256); + SetFade(FADE_INSTANT, 256); } void sub_0807F1A0(Entity* entity, ScriptExecutionContext* context) { diff --git a/src/staffroll.c b/src/staffroll.c index 529f7b51..d31ea833 100644 --- a/src/staffroll.c +++ b/src/staffroll.c @@ -89,7 +89,7 @@ void StaffrollTask_State0(void) { gScreen.bg2.control = 0x1dc3; InitSoundPlayingInfo(); ResetSystemPriority(); - SetFade(5, 0x100); + SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } void StaffrollTask_State1(void) { @@ -116,7 +116,7 @@ void StaffrollTask_State1MenuType1(void) { gStaffrollMenu.bgmMusicStarted = 1; SoundReq(BGM_CREDITS); } - SetFade(4, 8); + SetFade(FADE_INSTANT, 8); } } @@ -172,19 +172,19 @@ void StaffrollTask_State1MenuType3(void) { gMenu.transitionTimer--; if (gMenu.transitionTimer == 0) { sub_080A3954(); - SetFade(5, 8); + SetFade(FADE_IN_OUT | FADE_INSTANT, 8); } } void StaffrollTask_State1MenuType4(void) { gFadeControl.mask = 0xffff7fff; - SetFade(5, 4); + SetFade(FADE_IN_OUT | FADE_INSTANT, 4); SetFadeProgress(gMenu.transitionTimer); sub_080A3954(); } void StaffrollTask_State1MenuType5(void) { - SetFade(4, 4); + SetFade(FADE_INSTANT, 4); SetFadeProgress(gMenu.transitionTimer); sub_080A3954(); } @@ -197,13 +197,13 @@ void StaffrollTask_State1MenuType6(void) { gScreen.bg2.updated = 1; gScreen.controls.alphaBlend = 0x1000; gMenu.menuType = 0; - SetFade(4, 8); + SetFade(FADE_INSTANT, 8); } } void StaffrollTask_State1MenuType7(void) { if (gFadeControl.active == 0) { - SetFade(7, 8); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 8); gMain.state = 2; } } @@ -255,7 +255,7 @@ void StaffrollTask_State2(void) { gScreen.bg1.control = 0x1c01; gScreen.bg2.control = 0x1d05; gScreen.bg2.updated = 1; - SetFade(4, 8); + SetFade(FADE_INSTANT, 8); break; case 1: if (gFadeControl.active == 0) { @@ -317,7 +317,7 @@ void StaffrollTask_State2(void) { default: gScreen.lcd.displayControl &= 0xfdff; sub_08050384(); - SetFade(7, 8); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 8); gMain.state = 3; gStaffrollMenu.base.overlayType = 0; break; diff --git a/src/sub_08055E08.c b/src/sub_08055E08.c index 50d268c4..7f9b9438 100644 --- a/src/sub_08055E08.c +++ b/src/sub_08055E08.c @@ -29,7 +29,7 @@ void sub_08055E24(void) { sub_0804B0B0(gMenu.field_0xc[2], gMenu.field_0xc[3]); LoadRoomEntityList(&gUnk_080FF400); sub_08055B70(gMenu.field_0x4, 0, 0, 0); - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void nullsub_493(void) { diff --git a/src/subtask.c b/src/subtask.c index 9209a2c5..f00b4870 100644 --- a/src/subtask.c +++ b/src/subtask.c @@ -118,12 +118,12 @@ void sub_08054C20(void) { sub_0801876C(gMenu.field_0x4, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_08054C58(void) { if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) { - SetFade(7, 0x10); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 0x10); gMenu.overlayType++; } } @@ -131,7 +131,7 @@ void sub_08054C58(void) { void sub_08054C88(void) { if (gFadeControl.active == 0) { sub_08054974(gMenu.field_0x4, 0); - SetFade(6, 0x10); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 0x10); SoundReq(SFX_SECRET_BIG); gMenu.overlayType++; gMenu.transitionTimer = 0x78; @@ -153,7 +153,7 @@ void sub_08054D04(void) { sub_08055B70(gMenu.field_0x4, 0, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_08054D3C(void) { @@ -183,7 +183,7 @@ void sub_08054DAC(void) { sub_08055B70(gMenu.field_0x4, 0, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void nullsub_484(void) { @@ -200,14 +200,14 @@ void sub_08054E1C(void) { sub_08055B70(gMenu.field_0x4, 0, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_08054E5C(void) { if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) { gMenu.overlayType++; gMenu.transitionTimer = 0xb4; - SetFade(6, 0x10); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 0x10); sub_080553E0(gMenu.field_0x4); sub_0801876C(gMenu.field_0x4, 1); } @@ -278,7 +278,7 @@ void sub_08054FAC(void) { sub_08055B70(gMenu.field_0x4, tmp, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); gMenu.field_0xa = 0; if (CheckLocalFlagByBank(0x400, 0x77) && (ptr[2] == 0x2f)) { gMenu.field_0xa = 1; @@ -301,7 +301,7 @@ void sub_08055054(void) { sub_08055B70(gMenu.field_0x4, 2, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_0805508C(void) { @@ -320,7 +320,7 @@ void sub_080550B0(void) { sub_08055B70(gMenu.field_0x4, 0, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void nullsub_487(void) { @@ -338,7 +338,7 @@ void sub_08055114(void) { sub_08055B70(gMenu.field_0x4, 0, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void nullsub_488(void) { @@ -364,7 +364,7 @@ void sub_08055184(void) { gMenu.transitionTimer = 0x3c; gMenu.field_0xa = 0; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_08055224(void) { @@ -411,12 +411,12 @@ void sub_08055318(void) { sub_0801876C(gMenu.field_0x4, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_08055350(void) { if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) { - SetFade(7, 0x10); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 0x10); gMenu.overlayType++; } } @@ -424,7 +424,7 @@ void sub_08055350(void) { void sub_08055380(void) { if (gFadeControl.active == 0) { sub_08054974(gMenu.field_0x4, 0); - SetFade(6, 0x10); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 0x10); SoundReq(SFX_SECRET_BIG); gMenu.overlayType++; gMenu.transitionTimer = 0x78; @@ -455,12 +455,12 @@ void sub_08055430(void) { sub_08055B70(gMenu.field_0x4, 0, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_08055468(void) { if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) { - SetFade(7, 0x10); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 0x10); gMenu.overlayType++; } } @@ -469,7 +469,7 @@ void sub_08055498(void) { if (gFadeControl.active == 0) { sub_0801876C(gMenu.field_0x4, 1); sub_080553E0(gMenu.field_0x4); - SetFade(6, 0x10); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 0x10); SoundReq(SFX_SECRET_BIG); gMenu.overlayType++; gMenu.transitionTimer = 0x78; @@ -491,7 +491,7 @@ void sub_08055518(void) { sub_08055B70(gMenu.field_0x4, 0, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_08055548(void) { @@ -521,7 +521,7 @@ void sub_080555B8(void) { sub_08055B70(gMenu.field_0x4, 0, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_0805560C(void) { @@ -557,7 +557,7 @@ void sub_080556AC(void) { sub_0804B0B0(gMenu.field_0xc[2], gMenu.field_0xc[3]); LoadRoomEntityList((EntityData*)gUnk_080FF264); sub_08055B70(gMenu.field_0x4, 0, 0, 0); - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void nullsub_489(void) { @@ -580,7 +580,7 @@ void sub_08055710(void) { sub_08055B70(gMenu.field_0x4, 0, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_0805576C(void) { @@ -606,7 +606,7 @@ void sub_080557D0(void) { sub_0804B0B0((u32)gMenu.field_0xc[2], gMenu.field_0xc[3]); LoadRoomEntityList((EntityData*)gUnk_080FF298); sub_08055B70(gMenu.field_0x4, 0, 0, 0); - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void nullsub_490(void) { @@ -624,7 +624,7 @@ void sub_08055834(void) { sub_08055B70(gMenu.field_0x4, 1, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void nullsub_491(void) { @@ -640,7 +640,7 @@ void sub_080558A4(void) { sub_08055B70(gMenu.field_0x4, 0, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void nullsub_492(void) { @@ -657,7 +657,7 @@ void sub_08055908(void) { sub_08055B70(gMenu.field_0x4, 0, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_08055948(void) { @@ -699,12 +699,12 @@ void sub_080559FC(void) { sub_08055B70(gMenu.field_0x4, 0, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_08055A3C(void) { if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) { - SetFade(7, 0x10); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 0x10); gMenu.overlayType++; } } @@ -713,7 +713,7 @@ void sub_08055A6C(void) { if (gFadeControl.active == 0) { sub_0801876C(gMenu.field_0x4, 1); sub_080553E0(gMenu.field_0x4); - SetFade(6, 0x10); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 0x10); SoundReq(SFX_SECRET_BIG); gMenu.overlayType++; gMenu.transitionTimer = 0x78; @@ -739,7 +739,7 @@ void sub_08055AEC(void) { } gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_08055B38(void) { @@ -773,12 +773,12 @@ void sub_08055BCC(void) { sub_0801876C(gMenu.field_0x4, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_08055C04(void) { if ((gFadeControl.active == 0) && CheckRoomFlag(0xff)) { - SetFade(7, 0x10); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 0x10); gMenu.overlayType++; } } @@ -798,7 +798,7 @@ void sub_08055C34(void) { DeleteEntity(entity); } } - SetFade(6, 0x10); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 0x10); SoundReq(SFX_SECRET_BIG); gMenu.overlayType++; gMenu.transitionTimer = 0x78; @@ -821,7 +821,7 @@ void sub_08055CF4(void) { sub_08055B70(gMenu.field_0x4, 0, 0, 0); gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_08055D2C(void) { @@ -846,7 +846,7 @@ void sub_08055D80(void) { void sub_08055D9C(void) { gMenu.overlayType++; gUpdateVisibleTiles = 1; - SetFade(4, 0x10); + SetFade(FADE_INSTANT, 0x10); } void sub_08055DC0(void) { diff --git a/src/subtask2.c b/src/subtask2.c index 27982f1d..b5483b96 100644 --- a/src/subtask2.c +++ b/src/subtask2.c @@ -169,7 +169,7 @@ void sub_080A5BB8(void) { m = &gMain; *(vu8*)&m->sleepStatus; // force a read m->sleepStatus = SLEEP; - SetFade(6, 8); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8); sub_080A4E84(2); gPauseMenuOptions.unk16 = 16; } @@ -504,7 +504,7 @@ void sub_080A6CA8(void) { sub_080A6290(); gMenu.field_0x3 = sub_080A6D74(0); SetMenuType(1); - SetFade(4, 8); + SetFade(FADE_INSTANT, 8); } ASM_FUNC("asm/non_matching/subtask2/sub_080A6CD8.inc", void sub_080A6CD8()) @@ -565,7 +565,7 @@ void sub_080A6DD0(void) { void sub_080A6DF8(void) { if (gMenu.field_0x0 == 2) { SetMenuType(4); - SetFade(5, 8); + SetFade(FADE_IN_OUT | FADE_INSTANT, 8); } else { ResetPlayerAnimationAndAction(); sub_080042D0(&gPlayerEntity, (u32)gPlayerEntity.animIndex, gPlayerEntity.spriteIndex); @@ -642,7 +642,7 @@ void MenuFadeIn(u32 param_1, u32 param_2) { gUI.isLoading = -1; gUI.fadeInTime = 0x20; gMain.substate = GAMEMAIN_SUBTASK; - SetFade(5, 0x20); + SetFade(FADE_IN_OUT | FADE_INSTANT, 0x20); gUnk_02018EB0.unk_0 = 0; gUnk_02018EB0.unk_1 = 0; } @@ -664,7 +664,7 @@ void sub_080A71C4(u32 param_1, u32 param_2, u32 param_3, u32 param_4) { void Subtask_Exit(void) { gUI.nextToLoad = 3; - SetFade(5, 0x20); + SetFade(FADE_IN_OUT | FADE_INSTANT, 0x20); } void sub_080A71F4(ScreenTransitionData* exitTransition) { @@ -694,11 +694,11 @@ ASM_FUNC("asm/non_matching/subtask2/Subtask_FadeIn.inc", void Subtask_FadeIn()) void Subtask_Init(void) { if (gFadeControl.active == 0) { DeleteAllEntities(); - MemClear(&gMenu, 0x30); + MemClear(&gMenu, sizeof(FigurineMenu)); MemClear(&gRoomControls, 0x38); MemClear(gOAMControls.unk, 0x100); - MemClear(&gActiveScriptInfo, 0xc); - gActiveScriptInfo.unk_08 = 8; + MemClear(&gActiveScriptInfo, sizeof(gActiveScriptInfo)); + gActiveScriptInfo.fadeSpeed = 8; DispReset(1); MessageInitialize(); ResetPalettes(); diff --git a/src/title.c b/src/title.c index 5868f50a..d96fdf1d 100644 --- a/src/title.c +++ b/src/title.c @@ -127,7 +127,7 @@ static u32 AdvanceIntroSequence(u32 transition) { gUI.lastState = transition; gMain.state = GAMETASK_MAIN; MemClear(&gIntroState, sizeof(gIntroState)); - SetFade(7, 8); + SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 8); } void TitleTask(void) { @@ -171,7 +171,7 @@ static void HandleNintendoCapcomLogos(void) { LoadPaletteGroup(paletteGroup); gScreen.lcd.displayControl |= DISPCNT_BG2_ON; gScreen.bg1.updated = 1; - SetFade(6, 8); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8); advance = ADVANCE_NONE; #if defined(DEMO_USA) if (gUnk_02000010.listenForKeyPresses == 0) { @@ -246,7 +246,7 @@ static void HandleTitlescreen(void) { } InitSoundPlayingInfo(); SoundReq(BGM_TITLE_SCREEN); - SetFade(6, 8); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8); break; case 1: if (gFadeControl.active) { @@ -355,7 +355,7 @@ static void HandleJapaneseTitlescreenAnimationIntro(void) { gScreen.bg1.yOffset = 0; gScreen.bg1.control = BGCNT_SCREENBASE(12) | BGCNT_PRIORITY(1) | BGCNT_CHARBASE(2); gFadeControl.mask = 0x00000040; - SetFade(6, 0x10); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 0x10); SoundReq(SFX_F8); } } @@ -403,7 +403,7 @@ static void HandleTitlescreenAnimationIntro(void) { gIntroState.swordBgScaleRatio = 0x100; gIntroState.timer = 40; gIntroState.subState++; - SetFade(6, 16); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 16); } UpdateSwordBgAffineData(); break; @@ -416,7 +416,7 @@ static void HandleTitlescreenAnimationIntro(void) { #endif gIntroState.subState++; CreateObject(OBJECT_BD, 0, 0); - SetFade(6, 16); + SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 16); SoundReq(SFX_F8); } break;