From 4052aa9a6d29a72f120ce4c0e13c9cc8ba6cd12b Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 8 Oct 2019 23:26:43 +1000 Subject: [PATCH] Decompile alarmActivate --- src/game/chr/chraicommands.c | 2 +- src/game/game_000000.c | 3 ++- src/game/game_0601b0.c | 24 +++++++++--------------- src/include/game/game_0601b0.h | 2 ++ src/include/setup/setup_000000.h | 2 ++ src/setup/setup_000000.c | 5 ++++- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index ba8bd4d58..ed8fda07e 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -1207,7 +1207,7 @@ bool ai0027(void) */ bool aiActivateAlarm(void) { - func0f0903b0(); + alarmActivate(); g_Vars.aioffset += 2; return false; diff --git a/src/game/game_000000.c b/src/game/game_000000.c index d108d1f13..04826d9fc 100644 --- a/src/game/game_000000.c +++ b/src/game/game_000000.c @@ -2,6 +2,7 @@ #include "constants.h" #include "gvars/gvars.h" #include "game/game_000000.h" +#include "game/game_0601b0.h" #include "library/library.h" GLOBAL_ASM( @@ -70012,7 +70013,7 @@ glabel func0f03e0e4 /* f03e150: 00000000 */ sll $zero,$zero,0x0 /* f03e154: 45000003 */ bc1f .L0f03e164 /* f03e158: 00000000 */ sll $zero,$zero,0x0 -/* f03e15c: 0fc240ec */ jal func0f0903b0 +/* f03e15c: 0fc240ec */ jal alarmActivate /* f03e160: 00000000 */ sll $zero,$zero,0x0 .L0f03e164: /* f03e164: 0c00745f */ jal 0x1d17c diff --git a/src/game/game_0601b0.c b/src/game/game_0601b0.c index c6c3c14da..15d36483f 100644 --- a/src/game/game_0601b0.c +++ b/src/game/game_0601b0.c @@ -3,6 +3,7 @@ #include "gvars/gvars.h" #include "game/game_0601b0.h" #include "library/library.h" +#include "setup/setup_000000.h" GLOBAL_ASM( glabel func0f0601b0 @@ -27595,7 +27596,7 @@ glabel func0f0782ac /* f0786c0: 5420000f */ bnezl $at,.L0f078700 /* f0786c4: c46e00a4 */ lwc1 $f14,0xa4($v1) /* f0786c8: afa3003c */ sw $v1,0x3c($sp) -/* f0786cc: 0fc240ec */ jal func0f0903b0 +/* f0786cc: 0fc240ec */ jal alarmActivate /* f0786d0: e7b20034 */ swc1 $f18,0x34($sp) /* f0786d4: 8fa3003c */ lw $v1,0x3c($sp) /* f0786d8: 3c09800a */ lui $t1,0x800a @@ -44037,7 +44038,7 @@ glabel func0f086f40 /* f0871f8: 10000064 */ beqz $zero,.L0f08738c /* f0871fc: 00000000 */ sll $zero,$zero,0x0 .L0f087200: -/* f087200: 0fc240ec */ jal func0f0903b0 +/* f087200: 0fc240ec */ jal alarmActivate /* f087204: 00000000 */ sll $zero,$zero,0x0 /* f087208: 10000060 */ beqz $zero,.L0f08738c /* f08720c: 00000000 */ sll $zero,$zero,0x0 @@ -54534,19 +54535,12 @@ glabel func0f09018c /* f0903ac: 00001025 */ or $v0,$zero,$zero ); -GLOBAL_ASM( -glabel func0f0903b0 -/* f0903b0: 3c028007 */ lui $v0,0x8007 -/* f0903b4: 244298d4 */ addiu $v0,$v0,-26412 -/* f0903b8: 8c4e0000 */ lw $t6,0x0($v0) -/* f0903bc: 240f0001 */ addiu $t7,$zero,0x1 -/* f0903c0: 1dc00002 */ bgtz $t6,.L0f0903cc -/* f0903c4: 00000000 */ sll $zero,$zero,0x0 -/* f0903c8: ac4f0000 */ sw $t7,0x0($v0) -.L0f0903cc: -/* f0903cc: 03e00008 */ jr $ra -/* f0903d0: 00000000 */ sll $zero,$zero,0x0 -); +void alarmActivate(void) +{ + if (g_AlarmActive < 1) { + g_AlarmActive = 1; + } +} GLOBAL_ASM( glabel func0f0903d4 diff --git a/src/include/game/game_0601b0.h b/src/include/game/game_0601b0.h index 7d5ab0d0c..235190a22 100644 --- a/src/include/game/game_0601b0.h +++ b/src/include/game/game_0601b0.h @@ -3,6 +3,8 @@ #include #include "constants.h" +void alarmActivate(void); + void menudialog000fcd48(void); void menudialog000fcd48(void); void menudialog000fcd48(void); diff --git a/src/include/setup/setup_000000.h b/src/include/setup/setup_000000.h index 24fed0d73..8345f48df 100644 --- a/src/include/setup/setup_000000.h +++ b/src/include/setup/setup_000000.h @@ -18,4 +18,6 @@ extern u32 var0000db98; extern struct coord var0000f00c; +extern s32 g_AlarmActive; + #endif diff --git a/src/setup/setup_000000.c b/src/setup/setup_000000.c index 1668098ee..415ffc6ba 100644 --- a/src/setup/setup_000000.c +++ b/src/setup/setup_000000.c @@ -14936,7 +14936,10 @@ u32 var0000f8e4 = 0x00000000; u32 var0000f8e8 = 0x00000000; u32 var0000f8ec = 0x00000000; u32 var0000f8f0 = 0x00000000; -u32 var0000f8f4 = 0x00000000; + +// f8f4 +s32 g_AlarmActive = 0; + u32 var0000f8f8 = 0x00000000; u32 var0000f8fc = 0x42800000; u32 var0000f900 = 0x3f800000;