From cdeb55a660bbefd92d5edff4bd8f76edfc097f2b Mon Sep 17 00:00:00 2001 From: Stephen Giardina <58889675+stephenJohnGiardina@users.noreply.github.com> Date: Mon, 5 Sep 2022 09:18:47 -0400 Subject: [PATCH] Decompile func_802400BC_A4C01C (#759) --- src/world/area_kpa/kpa_04/A4BF60.c | 28 +++++++++- .../kpa_04/A4BF60/func_802400BC_A4C01C.s | 51 ------------------- 2 files changed, 27 insertions(+), 52 deletions(-) delete mode 100644 ver/us/asm/nonmatchings/world/area_kpa/kpa_04/A4BF60/func_802400BC_A4C01C.s diff --git a/src/world/area_kpa/kpa_04/A4BF60.c b/src/world/area_kpa/kpa_04/A4BF60.c index de35650bca..ae42a3c64d 100644 --- a/src/world/area_kpa/kpa_04/A4BF60.c +++ b/src/world/area_kpa/kpa_04/A4BF60.c @@ -5,4 +5,30 @@ static char* N(exit_str_1) = "kpa_81"; #include "world/common/UnkFunc11.inc.c" -INCLUDE_ASM(s32, "world/area_kpa/kpa_04/A4BF60", func_802400BC_A4C01C); +ApiStatus func_802400BC_A4C01C(Evt *script, s32 isInitialCall) { + PlayerStatus* playerstatus = &gPlayerStatus; + f32 dist; + f32 x; + f32 y; + f32 z; + + if (script->varTable[5] == 0) { + playerstatus->position.x = script->varTable[0]; + } else { + playerstatus->position.z = script->varTable[0]; + } + + x = playerstatus->position.x; + y = playerstatus->position.y + 10.0f; + z = playerstatus->position.z; + + dist = 40.0f; + + npc_raycast_down_sides(0, &x, &y, &z, &dist); + + playerstatus->position.x = x; + playerstatus->position.y = y; + playerstatus->position.z = z; + + return ApiStatus_DONE2; +} diff --git a/ver/us/asm/nonmatchings/world/area_kpa/kpa_04/A4BF60/func_802400BC_A4C01C.s b/ver/us/asm/nonmatchings/world/area_kpa/kpa_04/A4BF60/func_802400BC_A4C01C.s deleted file mode 100644 index b367581147..0000000000 --- a/ver/us/asm/nonmatchings/world/area_kpa/kpa_04/A4BF60/func_802400BC_A4C01C.s +++ /dev/null @@ -1,51 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802400BC_A4C01C -/* A4C01C 802400BC 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* A4C020 802400C0 AFBF002C */ sw $ra, 0x2c($sp) -/* A4C024 802400C4 AFB00028 */ sw $s0, 0x28($sp) -/* A4C028 802400C8 8C820098 */ lw $v0, 0x98($a0) -/* A4C02C 802400CC 3C108011 */ lui $s0, %hi(gPlayerStatus) -/* A4C030 802400D0 2610EFC8 */ addiu $s0, $s0, %lo(gPlayerStatus) -/* A4C034 802400D4 14400005 */ bnez $v0, .L802400EC -/* A4C038 802400D8 00000000 */ nop -/* A4C03C 802400DC C4800084 */ lwc1 $f0, 0x84($a0) -/* A4C040 802400E0 46800020 */ cvt.s.w $f0, $f0 -/* A4C044 802400E4 0809003E */ j .L802400F8 -/* A4C048 802400E8 E6000028 */ swc1 $f0, 0x28($s0) -.L802400EC: -/* A4C04C 802400EC C4800084 */ lwc1 $f0, 0x84($a0) -/* A4C050 802400F0 46800020 */ cvt.s.w $f0, $f0 -/* A4C054 802400F4 E6000030 */ swc1 $f0, 0x30($s0) -.L802400F8: -/* A4C058 802400F8 27A20024 */ addiu $v0, $sp, 0x24 -/* A4C05C 802400FC 0000202D */ daddu $a0, $zero, $zero -/* A4C060 80240100 27A50018 */ addiu $a1, $sp, 0x18 -/* A4C064 80240104 27A6001C */ addiu $a2, $sp, 0x1c -/* A4C068 80240108 C6000028 */ lwc1 $f0, 0x28($s0) -/* A4C06C 8024010C 3C014120 */ lui $at, 0x4120 -/* A4C070 80240110 44811000 */ mtc1 $at, $f2 -/* A4C074 80240114 3C014220 */ lui $at, 0x4220 -/* A4C078 80240118 44813000 */ mtc1 $at, $f6 -/* A4C07C 8024011C 27A70020 */ addiu $a3, $sp, 0x20 -/* A4C080 80240120 E7A00018 */ swc1 $f0, 0x18($sp) -/* A4C084 80240124 C600002C */ lwc1 $f0, 0x2c($s0) -/* A4C088 80240128 C6040030 */ lwc1 $f4, 0x30($s0) -/* A4C08C 8024012C 46020000 */ add.s $f0, $f0, $f2 -/* A4C090 80240130 E7A60024 */ swc1 $f6, 0x24($sp) -/* A4C094 80240134 E7A40020 */ swc1 $f4, 0x20($sp) -/* A4C098 80240138 E7A0001C */ swc1 $f0, 0x1c($sp) -/* A4C09C 8024013C 0C0372DF */ jal npc_raycast_down_sides -/* A4C0A0 80240140 AFA20010 */ sw $v0, 0x10($sp) -/* A4C0A4 80240144 C7A00018 */ lwc1 $f0, 0x18($sp) -/* A4C0A8 80240148 C7A2001C */ lwc1 $f2, 0x1c($sp) -/* A4C0AC 8024014C C7A40020 */ lwc1 $f4, 0x20($sp) -/* A4C0B0 80240150 E6000028 */ swc1 $f0, 0x28($s0) -/* A4C0B4 80240154 E602002C */ swc1 $f2, 0x2c($s0) -/* A4C0B8 80240158 E6040030 */ swc1 $f4, 0x30($s0) -/* A4C0BC 8024015C 8FBF002C */ lw $ra, 0x2c($sp) -/* A4C0C0 80240160 8FB00028 */ lw $s0, 0x28($sp) -/* A4C0C4 80240164 24020002 */ addiu $v0, $zero, 2 -/* A4C0C8 80240168 03E00008 */ jr $ra -/* A4C0CC 8024016C 27BD0030 */ addiu $sp, $sp, 0x30