From f37344e23627b21764b9fcaca5107516408ec303 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 8 Feb 2020 22:02:05 +1000 Subject: [PATCH] Rename if_fade_complete to if_colour_fade_complete and discover real if_fade_complete --- src/game/chr/chraicommands.c | 6 +++--- src/game/data/data_0083d0.c | 4 ++-- src/game/game_1668e0.c | 19 ++++--------------- src/include/commands.h | 10 +++++----- src/include/game/chr/chraicommands.h | 4 ++-- src/include/game/game_1668e0.h | 2 +- 6 files changed, 17 insertions(+), 28 deletions(-) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 70397cc20..d2649083d 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -7460,7 +7460,7 @@ bool ai00e4(void) /** * @cmd 00e5 */ -bool aiIfFadeComplete(void) +bool aiIfColourFadeComplete(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; bool pass = false; @@ -13624,11 +13624,11 @@ bool aiFadeScreen(void) /** * @cmd 01cc */ -bool ai01cc(void) +bool aiIfFadeComplete(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - if (func0f16889c() == false) { + if (fadeIsActive() == false) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); } else { g_Vars.aioffset += 3; diff --git a/src/game/data/data_0083d0.c b/src/game/data/data_0083d0.c index 9c3ceb9af..bb3e43f40 100644 --- a/src/game/data/data_0083d0.c +++ b/src/game/data/data_0083d0.c @@ -6448,7 +6448,7 @@ bool (*g_CommandPointers[])(void) = { /*0x00e2*/ ai00e2, /*0x00e3*/ ai00e3, /*0x00e4*/ ai00e4, - /*0x00e5*/ aiIfFadeComplete, + /*0x00e5*/ aiIfColourFadeComplete, /*0x00e6*/ NULL, /*0x00e7*/ NULL, /*0x00e8*/ aiSetDoorOpen, @@ -6679,7 +6679,7 @@ bool (*g_CommandPointers[])(void) = { /*0x01c9*/ ai01c9, /*0x01ca*/ aiChrSetCutsceneWeapon, /*0x01cb*/ aiFadeScreen, - /*0x01cc*/ ai01cc, + /*0x01cc*/ aiIfFadeComplete, /*0x01cd*/ aiChrSetHudProjectorVisible, /*0x01ce*/ ai01ce, /*0x01cf*/ aiChrSetFiringInCutscene, diff --git a/src/game/game_1668e0.c b/src/game/game_1668e0.c index ddc057120..d6ab39bca 100644 --- a/src/game/game_1668e0.c +++ b/src/game/game_1668e0.c @@ -2519,21 +2519,10 @@ glabel func0f1685d8 /* f168898: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f16889c -/* f16889c: 3c018008 */ lui $at,0x8008 -/* f1688a0: c4244058 */ lwc1 $f4,0x4058($at) -/* f1688a4: 44803000 */ mtc1 $zero,$f6 -/* f1688a8: 00001025 */ or $v0,$zero,$zero -/* f1688ac: 4604303e */ c.le.s $f6,$f4 -/* f1688b0: 00000000 */ sll $zero,$zero,0x0 -/* f1688b4: 45000002 */ bc1f .L0f1688c0 -/* f1688b8: 00000000 */ sll $zero,$zero,0x0 -/* f1688bc: 24020001 */ addiu $v0,$zero,0x1 -.L0f1688c0: -/* f1688c0: 03e00008 */ jr $ra -/* f1688c4: 00000000 */ sll $zero,$zero,0x0 -); +bool fadeIsActive(void) +{ + return fade80084058 >= 0; +} GLOBAL_ASM( glabel func0f1688c8 diff --git a/src/include/commands.h b/src/include/commands.h index 9ae59dcf4..b3e51e937 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -1994,10 +1994,7 @@ mkshort(0x00e4), \ u1, -/** - * Checks if the screen fade is complete. Follows the label if complete. - */ -#define if_fade_complete(chr, label) \ +#define if_colour_fade_complete(chr, label) \ mkshort(0x00e5), \ chr, \ label, @@ -3609,7 +3606,10 @@ mkword(rgba), \ mkshort(num_frames), -#define cmd01cc(label) \ +/** + * Checks if the screen fade is complete. Follows the label if complete. + */ +#define if_fade_complete(label) \ mkshort(0x01cc), \ label, diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index 171781d45..6e0f71c71 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -231,7 +231,7 @@ /*0x00e2*/ bool ai00e2(void); /*0x00e3*/ bool ai00e3(void); /*0x00e4*/ bool ai00e4(void); -/*0x00e5*/ bool aiIfFadeComplete(void); +/*0x00e5*/ bool aiIfColourFadeComplete(void); /*0x00e8*/ bool aiSetDoorOpen(void); /*0x00e9*/ bool ai00e9(void); /*0x00ea*/ bool aiIfNumPlayersLessThan(void); @@ -423,7 +423,7 @@ /*0x01c9*/ bool ai01c9(void); /*0x01ca*/ bool aiChrSetCutsceneWeapon(void); /*0x01cb*/ bool aiFadeScreen(void); -/*0x01cc*/ bool ai01cc(void); +/*0x01cc*/ bool aiIfFadeComplete(void); /*0x01cd*/ bool aiChrSetHudProjectorVisible(void); /*0x01ce*/ bool ai01ce(void); /*0x01cf*/ bool aiChrSetFiringInCutscene(void); diff --git a/src/include/game/game_1668e0.h b/src/include/game/game_1668e0.h index 16981a71b..1080b1086 100644 --- a/src/include/game/game_1668e0.h +++ b/src/include/game/game_1668e0.h @@ -45,7 +45,7 @@ u32 func0f167b84(void); u32 func0f167c88(void); u32 func0f167e7c(void); u32 func0f1685d8(void); -u32 func0f16889c(void); +bool fadeIsActive(void); u32 func0f1688c8(void); u32 func0f1688fc(void); u32 func0f168b4c(void);