From 1173f4c681d64b7ad3d664ef3008f575d44a5b3b Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Sat, 7 Nov 2020 14:44:44 -0500 Subject: [PATCH] :island: --- asm/nonmatchings/code_317020/func_802BD174.s | 9 -- .../dgb_00/BFA100/func_80240060_BFA100.s | 24 ----- .../dgb_01/BFD880/func_80240000_BFD880.s | 20 ---- .../dgb_01/BFD9A0/func_802433BC_C00C3C.s | 17 ---- .../dgb_08/C3FDB0/func_80243B6C_C4391C.s | 15 --- .../dgb_15/C4F510/func_80241760_C50C70.s | 16 --- .../dgb_18/C55F40/func_80240E90_C56DD0.s | 15 --- .../kkj_25/B06A50/func_80240050_B06A50.s | 16 --- .../world/script_api/7E0E80/MakeShopOwner.s | 22 ----- .../world/script_api/7E0E80/func_802803C8.s | 24 ----- .../world/script_api/7E2AA0/func_80282594.s | 4 +- .../7E3700/TeleportPartnerToPlayer.s | 41 -------- .../world/script_api/7E3700/func_80282880.s | 27 ----- .../world/script_api/7E3700/func_80283810.s | 33 ------- .../world/script_api/7E3700/func_80283B88.s | 14 --- .../world/script_api/7E3700/func_80283BB0.s | 12 --- .../world/script_api/7E3700/func_80283BD0.s | 30 ------ include/common.h | 1 + include/common_structs.h | 5 +- include/functions.h | 2 + src/code_102610_len_2330.c | 6 +- src/code_317020.c | 5 +- src/code_838b0_len_5900.c | 2 +- src/code_de740_len_23f0.c | 2 +- src/world/area_dgb/dgb_00/BFA100.c | 7 +- src/world/area_dgb/dgb_01/BFD880.c | 5 +- src/world/area_dgb/dgb_01/BFD9A0.c | 2 +- src/world/area_dgb/dgb_08/C3FDB0.c | 2 +- src/world/area_dgb/dgb_15/C4F510.c | 2 +- src/world/area_dgb/dgb_18/C55F40.c | 2 +- src/world/area_kkj/kkj_25/B06A50.c | 2 +- src/world/area_sbk/sbk_00/929270.c | 58 +++++++++++ src/world/area_sbk/sbk_00/9292B0.c | 68 +++++++++++++ src/world/area_sbk/sbk_00/929A00.bin.c | 8 ++ src/world/area_sbk/sbk_00/sbk_00.h | 2 + src/world/common/UnkFunc1.inc.c | 7 ++ src/world/script_api/7E0E80.c | 24 ++++- src/world/script_api/7E3700.c | 98 +++++++++++++++++-- tools/disasm_script.py | 8 +- tools/splat.yaml | 6 +- tools/symbol_addrs.txt | 4 + 41 files changed, 300 insertions(+), 367 deletions(-) delete mode 100644 asm/nonmatchings/code_317020/func_802BD174.s delete mode 100644 asm/nonmatchings/world/area_dgb/dgb_00/BFA100/func_80240060_BFA100.s delete mode 100644 asm/nonmatchings/world/area_dgb/dgb_01/BFD880/func_80240000_BFD880.s delete mode 100644 asm/nonmatchings/world/area_dgb/dgb_01/BFD9A0/func_802433BC_C00C3C.s delete mode 100644 asm/nonmatchings/world/area_dgb/dgb_08/C3FDB0/func_80243B6C_C4391C.s delete mode 100644 asm/nonmatchings/world/area_dgb/dgb_15/C4F510/func_80241760_C50C70.s delete mode 100644 asm/nonmatchings/world/area_dgb/dgb_18/C55F40/func_80240E90_C56DD0.s delete mode 100644 asm/nonmatchings/world/area_kkj/kkj_25/B06A50/func_80240050_B06A50.s delete mode 100644 asm/nonmatchings/world/script_api/7E0E80/MakeShopOwner.s delete mode 100644 asm/nonmatchings/world/script_api/7E0E80/func_802803C8.s delete mode 100644 asm/nonmatchings/world/script_api/7E3700/TeleportPartnerToPlayer.s delete mode 100644 asm/nonmatchings/world/script_api/7E3700/func_80282880.s delete mode 100644 asm/nonmatchings/world/script_api/7E3700/func_80283810.s delete mode 100644 asm/nonmatchings/world/script_api/7E3700/func_80283B88.s delete mode 100644 asm/nonmatchings/world/script_api/7E3700/func_80283BB0.s delete mode 100644 asm/nonmatchings/world/script_api/7E3700/func_80283BD0.s create mode 100644 src/world/area_sbk/sbk_00/929A00.bin.c create mode 100644 src/world/common/UnkFunc1.inc.c diff --git a/asm/nonmatchings/code_317020/func_802BD174.s b/asm/nonmatchings/code_317020/func_802BD174.s deleted file mode 100644 index eaab83f2f5..0000000000 --- a/asm/nonmatchings/code_317020/func_802BD174.s +++ /dev/null @@ -1,9 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802BD174 -/* 317094 802BD174 24020018 */ addiu $v0, $zero, 0x18 -/* 317098 802BD178 A48200A8 */ sh $v0, 0xa8($a0) -/* 31709C 802BD17C 24020014 */ addiu $v0, $zero, 0x14 -/* 3170A0 802BD180 03E00008 */ jr $ra -/* 3170A4 802BD184 A48200A6 */ sh $v0, 0xa6($a0) diff --git a/asm/nonmatchings/world/area_dgb/dgb_00/BFA100/func_80240060_BFA100.s b/asm/nonmatchings/world/area_dgb/dgb_00/BFA100/func_80240060_BFA100.s deleted file mode 100644 index ff23ced951..0000000000 --- a/asm/nonmatchings/world/area_dgb/dgb_00/BFA100/func_80240060_BFA100.s +++ /dev/null @@ -1,24 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80240060_BFA100 -/* BFA100 80240060 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* BFA104 80240064 AFBF0018 */ sw $ra, 0x18($sp) -/* BFA108 80240068 0C00FB3A */ jal get_enemy -/* BFA10C 8024006C 24040006 */ addiu $a0, $zero, 6 -/* BFA110 80240070 84440008 */ lh $a0, 8($v0) -/* BFA114 80240074 0C00EABB */ jal get_npc_unsafe -/* BFA118 80240078 00000000 */ nop -/* BFA11C 8024007C C4400040 */ lwc1 $f0, 0x40($v0) -/* BFA120 80240080 2404032E */ addiu $a0, $zero, 0x32e -/* BFA124 80240084 E7A00010 */ swc1 $f0, 0x10($sp) -/* BFA128 80240088 8C460038 */ lw $a2, 0x38($v0) -/* BFA12C 8024008C 8C47003C */ lw $a3, 0x3c($v0) -/* BFA130 80240090 0C05267B */ jal func_801499EC -/* BFA134 80240094 0000282D */ daddu $a1, $zero, $zero -/* BFA138 80240098 8FBF0018 */ lw $ra, 0x18($sp) -/* BFA13C 8024009C 24020002 */ addiu $v0, $zero, 2 -/* BFA140 802400A0 03E00008 */ jr $ra -/* BFA144 802400A4 27BD0020 */ addiu $sp, $sp, 0x20 -/* BFA148 802400A8 00000000 */ nop -/* BFA14C 802400AC 00000000 */ nop diff --git a/asm/nonmatchings/world/area_dgb/dgb_01/BFD880/func_80240000_BFD880.s b/asm/nonmatchings/world/area_dgb/dgb_01/BFD880/func_80240000_BFD880.s deleted file mode 100644 index 4516098874..0000000000 --- a/asm/nonmatchings/world/area_dgb/dgb_01/BFD880/func_80240000_BFD880.s +++ /dev/null @@ -1,20 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80240000_BFD880 -/* BFD880 80240000 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* BFD884 80240004 3C0400C2 */ lui $a0, 0xc2 -/* BFD888 80240008 24840F40 */ addiu $a0, $a0, 0xf40 -/* BFD88C 8024000C 3C0500C3 */ lui $a1, 0xc3 -/* BFD890 80240010 24A5EBA0 */ addiu $a1, $a1, -0x1460 -/* BFD894 80240014 3C068020 */ lui $a2, %hi(gBackgroundImage) -/* BFD898 80240018 24C60000 */ addiu $a2, $a2, %lo(gBackgroundImage) -/* BFD89C 8024001C AFBF0010 */ sw $ra, 0x10($sp) -/* BFD8A0 80240020 0C00A5CF */ jal dma_copy -/* BFD8A4 80240024 00000000 */ nop -/* BFD8A8 80240028 8FBF0010 */ lw $ra, 0x10($sp) -/* BFD8AC 8024002C 24020002 */ addiu $v0, $zero, 2 -/* BFD8B0 80240030 03E00008 */ jr $ra -/* BFD8B4 80240034 27BD0018 */ addiu $sp, $sp, 0x18 -/* BFD8B8 80240038 00000000 */ nop -/* BFD8BC 8024003C 00000000 */ nop diff --git a/asm/nonmatchings/world/area_dgb/dgb_01/BFD9A0/func_802433BC_C00C3C.s b/asm/nonmatchings/world/area_dgb/dgb_01/BFD9A0/func_802433BC_C00C3C.s deleted file mode 100644 index 779db28dea..0000000000 --- a/asm/nonmatchings/world/area_dgb/dgb_01/BFD9A0/func_802433BC_C00C3C.s +++ /dev/null @@ -1,17 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802433BC_C00C3C -/* C00C3C 802433BC 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* C00C40 802433C0 AFBF0010 */ sw $ra, 0x10($sp) -/* C00C44 802433C4 0C03A6D5 */ jal increment_status_menu_disabled -/* C00C48 802433C8 00000000 */ nop -/* C00C4C 802433CC 3C05437F */ lui $a1, 0x437f -/* C00C50 802433D0 0C04DF69 */ jal func_80137DA4 -/* C00C54 802433D4 0000202D */ daddu $a0, $zero, $zero -/* C00C58 802433D8 8FBF0010 */ lw $ra, 0x10($sp) -/* C00C5C 802433DC 24020002 */ addiu $v0, $zero, 2 -/* C00C60 802433E0 03E00008 */ jr $ra -/* C00C64 802433E4 27BD0018 */ addiu $sp, $sp, 0x18 -/* C00C68 802433E8 00000000 */ nop -/* C00C6C 802433EC 00000000 */ nop diff --git a/asm/nonmatchings/world/area_dgb/dgb_08/C3FDB0/func_80243B6C_C4391C.s b/asm/nonmatchings/world/area_dgb/dgb_08/C3FDB0/func_80243B6C_C4391C.s deleted file mode 100644 index eb87c275e9..0000000000 --- a/asm/nonmatchings/world/area_dgb/dgb_08/C3FDB0/func_80243B6C_C4391C.s +++ /dev/null @@ -1,15 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80243B6C_C4391C -/* C4391C 80243B6C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* C43920 80243B70 AFBF0010 */ sw $ra, 0x10($sp) -/* C43924 80243B74 0C03A6D5 */ jal increment_status_menu_disabled -/* C43928 80243B78 00000000 */ nop -/* C4392C 80243B7C 3C05437F */ lui $a1, 0x437f -/* C43930 80243B80 0C04DF69 */ jal func_80137DA4 -/* C43934 80243B84 0000202D */ daddu $a0, $zero, $zero -/* C43938 80243B88 8FBF0010 */ lw $ra, 0x10($sp) -/* C4393C 80243B8C 24020002 */ addiu $v0, $zero, 2 -/* C43940 80243B90 03E00008 */ jr $ra -/* C43944 80243B94 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/area_dgb/dgb_15/C4F510/func_80241760_C50C70.s b/asm/nonmatchings/world/area_dgb/dgb_15/C4F510/func_80241760_C50C70.s deleted file mode 100644 index 6930360aea..0000000000 --- a/asm/nonmatchings/world/area_dgb/dgb_15/C4F510/func_80241760_C50C70.s +++ /dev/null @@ -1,16 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80241760_C50C70 -/* C50C70 80241760 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* C50C74 80241764 AFBF0010 */ sw $ra, 0x10($sp) -/* C50C78 80241768 0C03A6D5 */ jal increment_status_menu_disabled -/* C50C7C 8024176C 00000000 */ nop -/* C50C80 80241770 3C05437F */ lui $a1, 0x437f -/* C50C84 80241774 0C04DF69 */ jal func_80137DA4 -/* C50C88 80241778 0000202D */ daddu $a0, $zero, $zero -/* C50C8C 8024177C 8FBF0010 */ lw $ra, 0x10($sp) -/* C50C90 80241780 24020002 */ addiu $v0, $zero, 2 -/* C50C94 80241784 03E00008 */ jr $ra -/* C50C98 80241788 27BD0018 */ addiu $sp, $sp, 0x18 -/* C50C9C 8024178C 00000000 */ nop diff --git a/asm/nonmatchings/world/area_dgb/dgb_18/C55F40/func_80240E90_C56DD0.s b/asm/nonmatchings/world/area_dgb/dgb_18/C55F40/func_80240E90_C56DD0.s deleted file mode 100644 index 4c68fcda40..0000000000 --- a/asm/nonmatchings/world/area_dgb/dgb_18/C55F40/func_80240E90_C56DD0.s +++ /dev/null @@ -1,15 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80240E90_C56DD0 -/* C56DD0 80240E90 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* C56DD4 80240E94 AFBF0010 */ sw $ra, 0x10($sp) -/* C56DD8 80240E98 0C03A6D5 */ jal increment_status_menu_disabled -/* C56DDC 80240E9C 00000000 */ nop -/* C56DE0 80240EA0 3C05437F */ lui $a1, 0x437f -/* C56DE4 80240EA4 0C04DF69 */ jal func_80137DA4 -/* C56DE8 80240EA8 0000202D */ daddu $a0, $zero, $zero -/* C56DEC 80240EAC 8FBF0010 */ lw $ra, 0x10($sp) -/* C56DF0 80240EB0 24020002 */ addiu $v0, $zero, 2 -/* C56DF4 80240EB4 03E00008 */ jr $ra -/* C56DF8 80240EB8 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/area_kkj/kkj_25/B06A50/func_80240050_B06A50.s b/asm/nonmatchings/world/area_kkj/kkj_25/B06A50/func_80240050_B06A50.s deleted file mode 100644 index 07fa0e0388..0000000000 --- a/asm/nonmatchings/world/area_kkj/kkj_25/B06A50/func_80240050_B06A50.s +++ /dev/null @@ -1,16 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80240050_B06A50 -/* B06A50 80240050 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* B06A54 80240054 AFBF0010 */ sw $ra, 0x10($sp) -/* B06A58 80240058 0C03A6D5 */ jal increment_status_menu_disabled -/* B06A5C 8024005C 00000000 */ nop -/* B06A60 80240060 3C05437F */ lui $a1, 0x437f -/* B06A64 80240064 0C04DF69 */ jal func_80137DA4 -/* B06A68 80240068 0000202D */ daddu $a0, $zero, $zero -/* B06A6C 8024006C 8FBF0010 */ lw $ra, 0x10($sp) -/* B06A70 80240070 24020002 */ addiu $v0, $zero, 2 -/* B06A74 80240074 03E00008 */ jr $ra -/* B06A78 80240078 27BD0018 */ addiu $sp, $sp, 0x18 -/* B06A7C 8024007C 00000000 */ nop diff --git a/asm/nonmatchings/world/script_api/7E0E80/MakeShopOwner.s b/asm/nonmatchings/world/script_api/7E0E80/MakeShopOwner.s deleted file mode 100644 index f2774454e3..0000000000 --- a/asm/nonmatchings/world/script_api/7E0E80/MakeShopOwner.s +++ /dev/null @@ -1,22 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel MakeShopOwner -/* 7E2A58 80281BD8 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 7E2A5C 80281BDC AFBF0014 */ sw $ra, 0x14($sp) -/* 7E2A60 80281BE0 AFB00010 */ sw $s0, 0x10($sp) -/* 7E2A64 80281BE4 8C82000C */ lw $v0, 0xc($a0) -/* 7E2A68 80281BE8 3C038007 */ lui $v1, %hi(gGameStatusPtr) -/* 7E2A6C 80281BEC 8C63419C */ lw $v1, %lo(gGameStatusPtr)($v1) -/* 7E2A70 80281BF0 8C450000 */ lw $a1, ($v0) -/* 7E2A74 80281BF4 0C0B1EAF */ jal get_variable -/* 7E2A78 80281BF8 8C700144 */ lw $s0, 0x144($v1) -/* 7E2A7C 80281BFC AE020010 */ sw $v0, 0x10($s0) -/* 7E2A80 80281C00 8FBF0014 */ lw $ra, 0x14($sp) -/* 7E2A84 80281C04 8FB00010 */ lw $s0, 0x10($sp) -/* 7E2A88 80281C08 24020002 */ addiu $v0, $zero, 2 -/* 7E2A8C 80281C0C 03E00008 */ jr $ra -/* 7E2A90 80281C10 27BD0018 */ addiu $sp, $sp, 0x18 -/* 7E2A94 80281C14 00000000 */ nop -/* 7E2A98 80281C18 00000000 */ nop -/* 7E2A9C 80281C1C 00000000 */ nop diff --git a/asm/nonmatchings/world/script_api/7E0E80/func_802803C8.s b/asm/nonmatchings/world/script_api/7E0E80/func_802803C8.s deleted file mode 100644 index 64650b0886..0000000000 --- a/asm/nonmatchings/world/script_api/7E0E80/func_802803C8.s +++ /dev/null @@ -1,24 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802803C8 -/* 7E1248 802803C8 3C058011 */ lui $a1, %hi(gPlayerStatus) -/* 7E124C 802803CC 24A5EFC8 */ addiu $a1, $a1, %lo(gPlayerStatus) -/* 7E1250 802803D0 AC80008C */ sw $zero, 0x8c($a0) -/* 7E1254 802803D4 80A300B4 */ lb $v1, 0xb4($a1) -/* 7E1258 802803D8 24020004 */ addiu $v0, $zero, 4 -/* 7E125C 802803DC 10620008 */ beq $v1, $v0, .L80280400 -/* 7E1260 802803E0 24020008 */ addiu $v0, $zero, 8 -/* 7E1264 802803E4 10620006 */ beq $v1, $v0, .L80280400 -/* 7E1268 802803E8 00000000 */ nop -/* 7E126C 802803EC 8CA20000 */ lw $v0, ($a1) -/* 7E1270 802803F0 30420100 */ andi $v0, $v0, 0x100 -/* 7E1274 802803F4 14400004 */ bnez $v0, .L80280408 -/* 7E1278 802803F8 24020001 */ addiu $v0, $zero, 1 -/* 7E127C 802803FC AC82008C */ sw $v0, 0x8c($a0) -.L80280400: -/* 7E1280 80280400 03E00008 */ jr $ra -/* 7E1284 80280404 24020002 */ addiu $v0, $zero, 2 -.L80280408: -/* 7E1288 80280408 03E00008 */ jr $ra -/* 7E128C 8028040C 24020002 */ addiu $v0, $zero, 2 diff --git a/asm/nonmatchings/world/script_api/7E2AA0/func_80282594.s b/asm/nonmatchings/world/script_api/7E2AA0/func_80282594.s index b0c513c697..2663f990ca 100644 --- a/asm/nonmatchings/world/script_api/7E2AA0/func_80282594.s +++ b/asm/nonmatchings/world/script_api/7E2AA0/func_80282594.s @@ -11,9 +11,9 @@ glabel func_80282594 /* 7E342C 802825AC 3C02800B */ lui $v0, %hi(gCameras) /* 7E3430 802825B0 24421D80 */ addiu $v0, $v0, %lo(gCameras) /* 7E3434 802825B4 44800000 */ mtc1 $zero, $f0 -/* 7E3438 802825B8 00000000 */ nop +/* 7E3438 802825B8 00000000 */ nop /* 7E343C 802825BC 4602003E */ c.le.s $f0, $f2 -/* 7E3440 802825C0 00000000 */ nop +/* 7E3440 802825C0 00000000 */ nop /* 7E3444 802825C4 45000006 */ bc1f .L802825E0 /* 7E3448 802825C8 0040182D */ daddu $v1, $v0, $zero /* 7E344C 802825CC C4400490 */ lwc1 $f0, 0x490($v0) diff --git a/asm/nonmatchings/world/script_api/7E3700/TeleportPartnerToPlayer.s b/asm/nonmatchings/world/script_api/7E3700/TeleportPartnerToPlayer.s deleted file mode 100644 index 3af1e3c00a..0000000000 --- a/asm/nonmatchings/world/script_api/7E3700/TeleportPartnerToPlayer.s +++ /dev/null @@ -1,41 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel TeleportPartnerToPlayer -/* 7E46FC 8028387C 3C028011 */ lui $v0, %hi(gPlayerData+0x12) -/* 7E4700 80283880 8042F2A2 */ lb $v0, %lo(gPlayerData+0x12)($v0) -/* 7E4704 80283884 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 7E4708 80283888 AFB10014 */ sw $s1, 0x14($sp) -/* 7E470C 8028388C 3C118011 */ lui $s1, %hi(gPlayerStatus) -/* 7E4710 80283890 2631EFC8 */ addiu $s1, $s1, %lo(gPlayerStatus) -/* 7E4714 80283894 AFB20018 */ sw $s2, 0x18($sp) -/* 7E4718 80283898 0220902D */ daddu $s2, $s1, $zero -/* 7E471C 8028389C AFBF001C */ sw $ra, 0x1c($sp) -/* 7E4720 802838A0 10400012 */ beqz $v0, .L802838EC -/* 7E4724 802838A4 AFB00010 */ sw $s0, 0x10($sp) -/* 7E4728 802838A8 0C00EABB */ jal get_npc_unsafe -/* 7E472C 802838AC 2404FFFC */ addiu $a0, $zero, -4 -/* 7E4730 802838B0 C6200028 */ lwc1 $f0, 0x28($s1) -/* 7E4734 802838B4 0040802D */ daddu $s0, $v0, $zero -/* 7E4738 802838B8 E6000038 */ swc1 $f0, 0x38($s0) -/* 7E473C 802838BC C6200030 */ lwc1 $f0, 0x30($s1) -/* 7E4740 802838C0 0C03A969 */ jal is_current_partner_flying -/* 7E4744 802838C4 E6000040 */ swc1 $f0, 0x40($s0) -/* 7E4748 802838C8 10400003 */ beqz $v0, .L802838D8 -/* 7E474C 802838CC 00000000 */ nop -/* 7E4750 802838D0 C620002C */ lwc1 $f0, 0x2c($s1) -/* 7E4754 802838D4 E600003C */ swc1 $f0, 0x3c($s0) -.L802838D8: -/* 7E4758 802838D8 8E450080 */ lw $a1, 0x80($s2) -/* 7E475C 802838DC 0C00ECD0 */ jal set_npc_yaw -/* 7E4760 802838E0 0200202D */ daddu $a0, $s0, $zero -/* 7E4764 802838E4 0C03BD17 */ jal clear_partner_move_history -/* 7E4768 802838E8 0200202D */ daddu $a0, $s0, $zero -.L802838EC: -/* 7E476C 802838EC 24020002 */ addiu $v0, $zero, 2 -/* 7E4770 802838F0 8FBF001C */ lw $ra, 0x1c($sp) -/* 7E4774 802838F4 8FB20018 */ lw $s2, 0x18($sp) -/* 7E4778 802838F8 8FB10014 */ lw $s1, 0x14($sp) -/* 7E477C 802838FC 8FB00010 */ lw $s0, 0x10($sp) -/* 7E4780 80283900 03E00008 */ jr $ra -/* 7E4784 80283904 27BD0020 */ addiu $sp, $sp, 0x20 diff --git a/asm/nonmatchings/world/script_api/7E3700/func_80282880.s b/asm/nonmatchings/world/script_api/7E3700/func_80282880.s deleted file mode 100644 index f06a66e3ff..0000000000 --- a/asm/nonmatchings/world/script_api/7E3700/func_80282880.s +++ /dev/null @@ -1,27 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80282880 -/* 7E3700 80282880 3C028011 */ lui $v0, %hi(gPlayerStatus) -/* 7E3704 80282884 2442EFC8 */ addiu $v0, $v0, %lo(gPlayerStatus) -/* 7E3708 80282888 C4420028 */ lwc1 $f2, 0x28($v0) -/* 7E370C 8028288C C4800084 */ lwc1 $f0, 0x84($a0) -/* 7E3710 80282890 46800020 */ cvt.s.w $f0, $f0 -/* 7E3714 80282894 46020001 */ sub.s $f0, $f0, $f2 -/* 7E3718 80282898 3C013F00 */ lui $at, 0x3f00 -/* 7E371C 8028289C 44812000 */ mtc1 $at, $f4 -/* 7E3720 802828A0 00000000 */ nop -/* 7E3724 802828A4 46040002 */ mul.s $f0, $f0, $f4 -/* 7E3728 802828A8 00000000 */ nop -/* 7E372C 802828AC 46001080 */ add.s $f2, $f2, $f0 -/* 7E3730 802828B0 E4420028 */ swc1 $f2, 0x28($v0) -/* 7E3734 802828B4 C4420030 */ lwc1 $f2, 0x30($v0) -/* 7E3738 802828B8 C480008C */ lwc1 $f0, 0x8c($a0) -/* 7E373C 802828BC 46800020 */ cvt.s.w $f0, $f0 -/* 7E3740 802828C0 46020001 */ sub.s $f0, $f0, $f2 -/* 7E3744 802828C4 46040002 */ mul.s $f0, $f0, $f4 -/* 7E3748 802828C8 00000000 */ nop -/* 7E374C 802828CC 46001080 */ add.s $f2, $f2, $f0 -/* 7E3750 802828D0 E4420030 */ swc1 $f2, 0x30($v0) -/* 7E3754 802828D4 03E00008 */ jr $ra -/* 7E3758 802828D8 24020002 */ addiu $v0, $zero, 2 diff --git a/asm/nonmatchings/world/script_api/7E3700/func_80283810.s b/asm/nonmatchings/world/script_api/7E3700/func_80283810.s deleted file mode 100644 index 6059f9801d..0000000000 --- a/asm/nonmatchings/world/script_api/7E3700/func_80283810.s +++ /dev/null @@ -1,33 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80283810 -/* 7E4690 80283810 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 7E4694 80283814 AFB00010 */ sw $s0, 0x10($sp) -/* 7E4698 80283818 0080802D */ daddu $s0, $a0, $zero -/* 7E469C 8028381C AFBF0014 */ sw $ra, 0x14($sp) -/* 7E46A0 80283820 0C03AD8E */ jal partner_get_ride_script -/* 7E46A4 80283824 AE0000AC */ sw $zero, 0xac($s0) -/* 7E46A8 80283828 1040000F */ beqz $v0, .L80283868 -/* 7E46AC 8028382C 00000000 */ nop -/* 7E46B0 80283830 3C028011 */ lui $v0, %hi(D_8010EBB0) -/* 7E46B4 80283834 8042EBB0 */ lb $v0, %lo(D_8010EBB0)($v0) -/* 7E46B8 80283838 14400003 */ bnez $v0, .L80283848 -/* 7E46BC 8028383C 24020001 */ addiu $v0, $zero, 1 -/* 7E46C0 80283840 080A0E1A */ j .L80283868 -/* 7E46C4 80283844 AE0000AC */ sw $zero, 0xac($s0) -.L80283848: -/* 7E46C8 80283848 0C03AD8E */ jal partner_get_ride_script -/* 7E46CC 8028384C AE0200AC */ sw $v0, 0xac($s0) -/* 7E46D0 80283850 AE0200B0 */ sw $v0, 0xb0($s0) -/* 7E46D4 80283854 3C028011 */ lui $v0, %hi(gPlayerStatus) -/* 7E46D8 80283858 2442EFC8 */ addiu $v0, $v0, %lo(gPlayerStatus) -/* 7E46DC 8028385C C4400080 */ lwc1 $f0, 0x80($v0) -/* 7E46E0 80283860 4600008D */ trunc.w.s $f2, $f0 -/* 7E46E4 80283864 E60200B8 */ swc1 $f2, 0xb8($s0) -.L80283868: -/* 7E46E8 80283868 8FBF0014 */ lw $ra, 0x14($sp) -/* 7E46EC 8028386C 8FB00010 */ lw $s0, 0x10($sp) -/* 7E46F0 80283870 24020002 */ addiu $v0, $zero, 2 -/* 7E46F4 80283874 03E00008 */ jr $ra -/* 7E46F8 80283878 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/script_api/7E3700/func_80283B88.s b/asm/nonmatchings/world/script_api/7E3700/func_80283B88.s deleted file mode 100644 index 79ef737efa..0000000000 --- a/asm/nonmatchings/world/script_api/7E3700/func_80283B88.s +++ /dev/null @@ -1,14 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80283B88 -/* 7E4A08 80283B88 3C0141A0 */ lui $at, 0x41a0 -/* 7E4A0C 80283B8C 44816000 */ mtc1 $at, $f12 -/* 7E4A10 80283B90 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 7E4A14 80283B94 AFBF0010 */ sw $ra, 0x10($sp) -/* 7E4A18 80283B98 0C03BCE5 */ jal func_800EF394 -/* 7E4A1C 80283B9C 00000000 */ nop -/* 7E4A20 80283BA0 8FBF0010 */ lw $ra, 0x10($sp) -/* 7E4A24 80283BA4 24020002 */ addiu $v0, $zero, 2 -/* 7E4A28 80283BA8 03E00008 */ jr $ra -/* 7E4A2C 80283BAC 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/script_api/7E3700/func_80283BB0.s b/asm/nonmatchings/world/script_api/7E3700/func_80283BB0.s deleted file mode 100644 index ad0f9c2619..0000000000 --- a/asm/nonmatchings/world/script_api/7E3700/func_80283BB0.s +++ /dev/null @@ -1,12 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80283BB0 -/* 7E4A30 80283BB0 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 7E4A34 80283BB4 AFBF0010 */ sw $ra, 0x10($sp) -/* 7E4A38 80283BB8 0C03BCE9 */ jal func_800EF3A4 -/* 7E4A3C 80283BBC 00000000 */ nop -/* 7E4A40 80283BC0 8FBF0010 */ lw $ra, 0x10($sp) -/* 7E4A44 80283BC4 24020002 */ addiu $v0, $zero, 2 -/* 7E4A48 80283BC8 03E00008 */ jr $ra -/* 7E4A4C 80283BCC 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/script_api/7E3700/func_80283BD0.s b/asm/nonmatchings/world/script_api/7E3700/func_80283BD0.s deleted file mode 100644 index 3703e72e46..0000000000 --- a/asm/nonmatchings/world/script_api/7E3700/func_80283BD0.s +++ /dev/null @@ -1,30 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80283BD0 -/* 7E4A50 80283BD0 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 7E4A54 80283BD4 AFB00010 */ sw $s0, 0x10($sp) -/* 7E4A58 80283BD8 0080802D */ daddu $s0, $a0, $zero -/* 7E4A5C 80283BDC AFB10014 */ sw $s1, 0x14($sp) -/* 7E4A60 80283BE0 3C118011 */ lui $s1, %hi(gPlayerStatus) -/* 7E4A64 80283BE4 2631EFC8 */ addiu $s1, $s1, %lo(gPlayerStatus) -/* 7E4A68 80283BE8 AFBF0018 */ sw $ra, 0x18($sp) -/* 7E4A6C 80283BEC 10A00008 */ beqz $a1, .L80283C10 -/* 7E4A70 80283BF0 8E02000C */ lw $v0, 0xc($s0) -/* 7E4A74 80283BF4 0C0B1EAF */ jal get_variable -/* 7E4A78 80283BF8 8C450000 */ lw $a1, ($v0) -/* 7E4A7C 80283BFC AE020070 */ sw $v0, 0x70($s0) -/* 7E4A80 80283C00 8E250080 */ lw $a1, 0x80($s1) -/* 7E4A84 80283C04 8E26005C */ lw $a2, 0x5c($s1) -/* 7E4A88 80283C08 0C0389DE */ jal move_player -/* 7E4A8C 80283C0C 0040202D */ daddu $a0, $v0, $zero -.L80283C10: -/* 7E4A90 80283C10 8E030070 */ lw $v1, 0x70($s0) -/* 7E4A94 80283C14 2463FFFF */ addiu $v1, $v1, -1 -/* 7E4A98 80283C18 AE030070 */ sw $v1, 0x70($s0) -/* 7E4A9C 80283C1C 8FBF0018 */ lw $ra, 0x18($sp) -/* 7E4AA0 80283C20 8FB10014 */ lw $s1, 0x14($sp) -/* 7E4AA4 80283C24 8FB00010 */ lw $s0, 0x10($sp) -/* 7E4AA8 80283C28 000317C2 */ srl $v0, $v1, 0x1f -/* 7E4AAC 80283C2C 03E00008 */ jr $ra -/* 7E4AB0 80283C30 27BD0020 */ addiu $sp, $sp, 0x20 diff --git a/include/common.h b/include/common.h index 0e3f4293aa..8e785491ea 100644 --- a/include/common.h +++ b/include/common.h @@ -10,5 +10,6 @@ #include "enums.h" #include "si.h" #include "messages.h" +#include "ld_addrs.h" #endif diff --git a/include/common_structs.h b/include/common_structs.h index 86b8fcbf08..db4990fc2e 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -934,7 +934,7 @@ typedef struct GameStatus { /* 0x158 */ UNK_PTR backgroundPalette; /* 0x15C */ s16 unk_15C; /* 0x15E */ char unk_15E[0x2]; - /* 0x160 */ s16 savedPos[3]; + /* 0x160 */ Vec3s savedPos; /* 0x166 */ u8 saveSlot; /* 0x167 */ u8 loadType; /* (0 = from map, 1 = from main menu) */ /* 0x168 */ s32 saveCount; @@ -1129,7 +1129,8 @@ typedef struct DecorationTable { } DecorationTable; // size = 0x8E8 typedef struct Shop { - /* 0x000 */ char unk_00[20]; + /* 0x000 */ char unk_00[16]; + /* 0x010 */ UNK_PTR owner; /* 0x014 */ UNK_PTR staticItemPositions; /* 0x018 */ UNK_PTR staticInventory; /* 0x01C */ UNK_PTR staticPriceList; diff --git a/include/functions.h b/include/functions.h index ce4d9e1a7d..72b99e0f04 100644 --- a/include/functions.h +++ b/include/functions.h @@ -84,6 +84,7 @@ void func_800EBB40(Npc* partner); void enable_partner_walking(Npc* partner, s32 val); void enable_partner_flying(Npc* partner, s32 val); void update_player_move_history(Npc* partner); +s32 is_current_partner_flying(void); void func_800ED5D0(Npc* partner); s32 func_800EF394(f32); @@ -121,6 +122,7 @@ f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by); f32 dist3D(f32 ax, f32 ay, f32 az, f32 bx, f32 by, f32 bz); void add_vec2D_polar(f32* x, f32* y, f32 r, f32 theta); +s32 func_801499EC(s32 soundID, s32 arg1, f32 arg2, f32 arg3, f32 arg4); s32 play_sound_at_position(s32 soundID, s32 value2, f32 posX, f32 posY, f32 posZ); s32 set_music_track(s32 playerIndex, s32 songID, s32 variation, s32 fadeOutTime, s16 volume); diff --git a/src/code_102610_len_2330.c b/src/code_102610_len_2330.c index 79b804e965..75e136b1a3 100644 --- a/src/code_102610_len_2330.c +++ b/src/code_102610_len_2330.c @@ -21,9 +21,9 @@ INCLUDE_ASM(s32, "code_102610_len_2330", func_802E117C); void save_game_at_player_position(void) { GameStatus* gameStatus = GAME_STATUS; - gameStatus->savedPos[0] = gPlayerStatusPtr->position.x; - gameStatus->savedPos[1] = gPlayerStatusPtr->position.y; - gameStatus->savedPos[2] = gPlayerStatusPtr->position.z; + gameStatus->savedPos.x = gPlayerStatusPtr->position.x; + gameStatus->savedPos.y = gPlayerStatusPtr->position.y; + gameStatus->savedPos.z = gPlayerStatusPtr->position.z; fio_save_game(gameStatus->saveSlot); } diff --git a/src/code_317020.c b/src/code_317020.c index 4526348b99..0a99d4d0a4 100644 --- a/src/code_317020.c +++ b/src/code_317020.c @@ -2,7 +2,10 @@ INCLUDE_ASM(s32, "code_317020", func_802BD100); -INCLUDE_ASM(s32, "code_317020", func_802BD174); +void func_802BD174(Npc* npc) { + npc->collisionHeight = 24; + npc->collisionRadius = 20; +} INCLUDE_ASM(s32, "code_317020", func_802BD188); diff --git a/src/code_838b0_len_5900.c b/src/code_838b0_len_5900.c index e55f7cbc49..4198a83d81 100644 --- a/src/code_838b0_len_5900.c +++ b/src/code_838b0_len_5900.c @@ -17,7 +17,7 @@ s32 func_800EA524(void) { INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EA52C); -INCLUDE_ASM(s32, "code_838b0_len_5900", is_current_partner_flying); +INCLUDE_ASM(s32, "code_838b0_len_5900", is_current_partner_flying, void); INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EA5B8); diff --git a/src/code_de740_len_23f0.c b/src/code_de740_len_23f0.c index d804b87a6d..be4225e7e3 100644 --- a/src/code_de740_len_23f0.c +++ b/src/code_de740_len_23f0.c @@ -34,7 +34,7 @@ INCLUDE_ASM(s32, "code_de740_len_23f0", func_80149908); INCLUDE_ASM(s32, "code_de740_len_23f0", func_80149974); -INCLUDE_ASM(s32, "code_de740_len_23f0", func_801499EC); +INCLUDE_ASM(s32, "code_de740_len_23f0", func_801499EC, s32 soundID, s32 arg1, f32 arg2, f32 arg3, f32 arg4); INCLUDE_ASM(s32, "code_de740_len_23f0", func_80149A6C); diff --git a/src/world/area_dgb/dgb_00/BFA100.c b/src/world/area_dgb/dgb_00/BFA100.c index 1cb15313c9..d54066c5c2 100644 --- a/src/world/area_dgb/dgb_00/BFA100.c +++ b/src/world/area_dgb/dgb_00/BFA100.c @@ -1,3 +1,8 @@ #include "dgb_00.h" -INCLUDE_ASM(s32, "world/area_dgb/dgb_00/BFA100", func_80240060_BFA100); +ApiStatus func_80240060_BFA100(ScriptInstance* script, s32 isInitialCall) { + Npc* npc = get_npc_unsafe(get_enemy(6)->npcID); + + func_801499EC(0x32E, 0, npc->pos.x, npc->pos.y, npc->pos.z); + return ApiStatus_DONE2; +} diff --git a/src/world/area_dgb/dgb_01/BFD880.c b/src/world/area_dgb/dgb_01/BFD880.c index 4f4d64fdc5..0404168d14 100644 --- a/src/world/area_dgb/dgb_01/BFD880.c +++ b/src/world/area_dgb/dgb_01/BFD880.c @@ -1,3 +1,6 @@ #include "dgb_01.h" -INCLUDE_ASM(s32, "world/area_dgb/dgb_01/BFD880", func_80240000_BFD880); +ApiStatus func_80240000_BFD880(void) { + dma_copy(&data_C20F40_ROM_START, &data_C20F40_ROM_END, &gBackgroundImage); + return ApiStatus_DONE2; +} diff --git a/src/world/area_dgb/dgb_01/BFD9A0.c b/src/world/area_dgb/dgb_01/BFD9A0.c index a87555d06d..eec46265bb 100644 --- a/src/world/area_dgb/dgb_01/BFD9A0.c +++ b/src/world/area_dgb/dgb_01/BFD9A0.c @@ -68,4 +68,4 @@ INCLUDE_ASM(s32, "world/area_dgb/dgb_01/BFD9A0", func_80243000_C00880); INCLUDE_ASM(s32, "world/area_dgb/dgb_01/BFD9A0", func_802430C0_C00940); -INCLUDE_ASM(s32, "world/area_dgb/dgb_01/BFD9A0", func_802433BC_C00C3C); +#include "world/common/UnkFunc1.inc.c" diff --git a/src/world/area_dgb/dgb_08/C3FDB0.c b/src/world/area_dgb/dgb_08/C3FDB0.c index b9eef566fa..fca917271e 100644 --- a/src/world/area_dgb/dgb_08/C3FDB0.c +++ b/src/world/area_dgb/dgb_08/C3FDB0.c @@ -82,7 +82,7 @@ INCLUDE_ASM(s32, "world/area_dgb/dgb_08/C3FDB0", func_802435D8_C43388); INCLUDE_ASM(s32, "world/area_dgb/dgb_08/C3FDB0", func_802438F0_C436A0); -INCLUDE_ASM(s32, "world/area_dgb/dgb_08/C3FDB0", func_80243B6C_C4391C); +#include "world/common/UnkFunc1.inc.c" INCLUDE_ASM(s32, "world/area_dgb/dgb_08/C3FDB0", func_80243B98_C43948); diff --git a/src/world/area_dgb/dgb_15/C4F510.c b/src/world/area_dgb/dgb_15/C4F510.c index 5a24da4b04..b9815b6a64 100644 --- a/src/world/area_dgb/dgb_15/C4F510.c +++ b/src/world/area_dgb/dgb_15/C4F510.c @@ -38,4 +38,4 @@ INCLUDE_ASM(s32, "world/area_dgb/dgb_15/C4F510", func_802413A4_C508B4); INCLUDE_ASM(s32, "world/area_dgb/dgb_15/C4F510", func_80241464_C50974); -INCLUDE_ASM(s32, "world/area_dgb/dgb_15/C4F510", func_80241760_C50C70); +#include "world/common/UnkFunc1.inc.c" diff --git a/src/world/area_dgb/dgb_18/C55F40.c b/src/world/area_dgb/dgb_18/C55F40.c index d31ab0bd06..90666b9955 100644 --- a/src/world/area_dgb/dgb_18/C55F40.c +++ b/src/world/area_dgb/dgb_18/C55F40.c @@ -24,6 +24,6 @@ INCLUDE_ASM(s32, "world/area_dgb/dgb_18/C55F40", func_80240AD4_C56A14); INCLUDE_ASM(s32, "world/area_dgb/dgb_18/C55F40", func_80240B94_C56AD4); -INCLUDE_ASM(s32, "world/area_dgb/dgb_18/C55F40", func_80240E90_C56DD0); +#include "world/common/UnkFunc1.inc.c" INCLUDE_ASM(s32, "world/area_dgb/dgb_18/C55F40", func_80240EBC_C56DFC); diff --git a/src/world/area_kkj/kkj_25/B06A50.c b/src/world/area_kkj/kkj_25/B06A50.c index 97c35f2795..21206915a5 100644 --- a/src/world/area_kkj/kkj_25/B06A50.c +++ b/src/world/area_kkj/kkj_25/B06A50.c @@ -1,3 +1,3 @@ #include "kkj_25.h" -INCLUDE_ASM(s32, "world/area_kkj/kkj_25/B06A50", func_80240050_B06A50); +#include "world/common/UnkFunc1.inc.c" diff --git a/src/world/area_sbk/sbk_00/929270.c b/src/world/area_sbk/sbk_00/929270.c index 4789aeb107..57540c174e 100644 --- a/src/world/area_sbk/sbk_00/929270.c +++ b/src/world/area_sbk/sbk_00/929270.c @@ -1,2 +1,60 @@ #include "sbk_00.h" + #include "world/common/SpawnSunEffect.inc.c" + +Script M(Main); +s32 M(npcGroupList_80240768)[]; + +EntryList M(entryList) = { + { -475.0f, 0.0f, 0.0f, 90.0f }, + { 475.0f, 0.0f, 0.0f, 270.0f }, + { 0.0f, 0.0f, -475.0f, 180.0f }, + { 0.0f, 0.0f, 475.0f, 0.0f }, +}; + +MapConfig M(config) = { + .main = M(Main), + .entryList = M(entryList), + .entryCount = ENTRY_COUNT(M(entryList)), + .background = &gBackgroundImage, + .tattle = 0x190060, +}; + +Script M(ExitWalk_802400E0) = SCRIPT({ + group 27 + UseExitHeading(60, 1) + spawn ExitWalk + GotoMap("sbk_01", 0) + sleep 100 +}); + +Script M(ExitWalk_8024013C) = SCRIPT({ + group 27 + UseExitHeading(60, 3) + spawn ExitWalk + GotoMap("sbk_10", 2) + sleep 100 +}); + +Script M(Script_80240198) = SCRIPT({ + bind M(ExitWalk_802400E0) to 524288 3 + bind M(ExitWalk_8024013C) to 524288 6 +}); + +Script M(Main) = SCRIPT({ + SI_SAVE_VAR(425) = 10 + SetSpriteShading(-1) + if SI_SAVE_VAR(0) == 0xFFFFFFC1 { + DisablePulseStone(0) + } + SetCamPerspective(0, 3, 25, 16, 4096) + SetCamBGColor(0, 0, 0, 0) + SetCamEnabled(0, 1) + SetCamLeadPlayer(0, 0) + MakeNpcs(0, M(npcGroupList_80240768)) + await M(MakeEntities) + SpawnSunEffect() + SetMusicTrack(0, 23, 0, 8) + SI_VAR(0) = M(Script_80240198) + spawn EnterWalk +}); diff --git a/src/world/area_sbk/sbk_00/9292B0.c b/src/world/area_sbk/sbk_00/9292B0.c index d550a00288..fe21eb0d8f 100644 --- a/src/world/area_sbk/sbk_00/9292B0.c +++ b/src/world/area_sbk/sbk_00/9292B0.c @@ -1,2 +1,70 @@ #include "sbk_00.h" + #include "world/common/SetNpcB5_3.inc.c" + +s32 M(aISettings_80240300)[] = { + 0x3FE66666, 0x00000032, 0x0000000A, 0x437A0000, 0x00000000, 0x00000002, 0x40600000, 0x0000002D, + 0x00000006, 0x43960000, 0x00000000, 0x00000001, +}; + +Script M(NpcAI_80240330) = SCRIPT({ + SetNpcB5_3() + DoBasicAI(M(aISettings_80240300)) +}); + +s32 M(npcSettings_8024035C)[] = { + 0x00000000, 0x0048000F, 0x00000000, 0x00000000, M(NpcAI_80240330), 0x80077F70, 0x00000000, 0x8007809C, + 0x00000000, 0x00000000, 0x00090000, +}; + +s32 M(npcGroup_80240388)[] = { + 0x00000000, M(npcSettings_8024035C), 0xC2200000, 0x00000000, 0x43200000, 0x00000800, 0x00000000, 0x00000000, + 0x00000000, 0x0000005A, 0x800F00A8, 0x00090000, 0x00890001, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001999, 0x59980002, + 0x3FFF2666, 0x4CCC0002, 0x3FFF3FFF, 0x3FFF0002, 0x33326665, 0x33320002, 0x33327FFF, 0x26660002, + 0x26660000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001999, 0x3FFF0002, + 0x33322666, 0x33320002, 0x33323FFF, 0x33320002, 0x33326665, 0x33320002, 0x33327FFF, 0x26660002, + 0x33320000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, + 0xFFFFFFD8, 0x00000000, 0x000000A0, 0x00000064, 0x00000000, 0xFFFF8001, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x000003E8, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00310004, 0x00310008, 0x00310008, 0x00310008, 0x00310004, 0x00310004, 0x0031000C, 0x0031000C, + 0x00310008, 0x00310008, 0x00310008, 0x00310008, 0x00310008, 0x00310008, 0x00310008, 0x00310008, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, +}; + +s32 M(npcGroup_80240578)[] = { + 0x00000001, M(npcSettings_8024035C), 0x43750000, 0x00000000, 0x42960000, 0x00000800, 0x00000000, 0x00000000, + 0x00000000, 0x0000010E, 0x800F00A8, 0x00090000, 0x00890001, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001999, 0x59980002, + 0x3FFF2666, 0x4CCC0002, 0x3FFF3FFF, 0x3FFF0002, 0x33326665, 0x33320002, 0x33327FFF, 0x26660002, + 0x26660000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001999, 0x3FFF0002, + 0x33322666, 0x33320002, 0x33323FFF, 0x33320002, 0x33326665, 0x33320002, 0x33327FFF, 0x26660002, + 0x33320000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, + 0x000000F5, 0x00000000, 0x0000004B, 0x00000064, 0x00000000, 0xFFFF8001, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x000003E8, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00310004, 0x00310008, 0x00310008, 0x00310008, 0x00310004, 0x00310004, 0x0031000C, 0x0031000C, + 0x00310008, 0x00310008, 0x00310008, 0x00310008, 0x00310008, 0x00310008, 0x00310008, 0x00310008, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, +}; + +s32 M(npcGroupList_80240768)[] = { + 0x00000001, M(npcGroup_80240388), 0x0A000001, 0x00000001, M(npcGroup_80240578), 0x0A010001, 0x00000000, 0x00000000, + 0x00000000, +}; + +static s32 padding = 0; + +Script M(MakeEntities) = SCRIPT({ + MakeEntity(0x802EA564, 0xFFFFFF1A, 0, 155, 0, 152, 0x80000000) + AssignBlockFlag(SI_SAVE_FLAG(797)) + MakeEntity(0x802EA564, 160, 0, 205, 0, 343, 0x80000000) + AssignBlockFlag(SI_SAVE_FLAG(798)) +}); diff --git a/src/world/area_sbk/sbk_00/929A00.bin.c b/src/world/area_sbk/sbk_00/929A00.bin.c new file mode 100644 index 0000000000..84bf640361 --- /dev/null +++ b/src/world/area_sbk/sbk_00/929A00.bin.c @@ -0,0 +1,8 @@ +#include "sbk_00.h" + +Script M(MakeEntities) = SCRIPT({ + MakeEntity(0x802EA564, 0xFFFFFF1A, 0, 155, 0, 152, 0x80000000) + AssignBlockFlag(SI_SAVE_FLAG(797)) + MakeEntity(0x802EA564, 160, 0, 205, 0, 343, 0x80000000) + AssignBlockFlag(SI_SAVE_FLAG(798)) +}); diff --git a/src/world/area_sbk/sbk_00/sbk_00.h b/src/world/area_sbk/sbk_00/sbk_00.h index 75efd5a290..9d1f153ac5 100644 --- a/src/world/area_sbk/sbk_00/sbk_00.h +++ b/src/world/area_sbk/sbk_00/sbk_00.h @@ -2,3 +2,5 @@ #include "map.h" #define MAP_NAME sbk_00 + +Script M(MakeEntities); diff --git a/src/world/common/UnkFunc1.inc.c b/src/world/common/UnkFunc1.inc.c new file mode 100644 index 0000000000..8290cef1f7 --- /dev/null +++ b/src/world/common/UnkFunc1.inc.c @@ -0,0 +1,7 @@ +#include "common.h" + +static ApiStatus UnkFunc1(ScriptInstance* script, s32 isInitialCall) { + increment_status_menu_disabled(); + func_80137DA4(0, 255.0f); + return ApiStatus_DONE2; +} diff --git a/src/world/script_api/7E0E80.c b/src/world/script_api/7E0E80.c index 2f02eeb2ae..27e0d65082 100644 --- a/src/world/script_api/7E0E80.c +++ b/src/world/script_api/7E0E80.c @@ -12,7 +12,22 @@ INCLUDE_ASM(s32, "world/script_api/7E0E80", func_802802D0); INCLUDE_ASM(s32, "world/script_api/7E0E80", func_8028035C); -INCLUDE_ASM(s32, "world/script_api/7E0E80", func_802803C8); +ApiStatus func_802803C8(ScriptInstance *script, s32 isInitialCall) { + PlayerStatus* playerStatus = PLAYER_STATUS; + + script->varTable[2] = FALSE; + + if (playerStatus->actionState == 4 || playerStatus->actionState == 8) { + return ApiStatus_DONE2; + } + + if ((playerStatus->flags & 0x100)) { + return ApiStatus_DONE2; + } + + script->varTable[2] = TRUE; + return ApiStatus_DONE2; +} INCLUDE_ASM(s32, "world/script_api/7E0E80", func_80280410); @@ -36,4 +51,9 @@ INCLUDE_ASM(s32, "world/script_api/7E0E80", draw_shop_items); INCLUDE_ASM(s32, "world/script_api/7E0E80", MakeShop); -INCLUDE_ASM(s32, "world/script_api/7E0E80", MakeShopOwner); +ApiStatus MakeShopOwner(ScriptInstance *script, s32 isInitialCall) { + Shop* mapShop = GAME_STATUS->mapShop; + + mapShop->owner = get_variable(script, *script->ptrReadPos); + return ApiStatus_DONE2; +} diff --git a/src/world/script_api/7E3700.c b/src/world/script_api/7E3700.c index e0f3b56f63..25139f6c99 100644 --- a/src/world/script_api/7E3700.c +++ b/src/world/script_api/7E3700.c @@ -1,6 +1,13 @@ #include "common.h" -INCLUDE_ASM(s32, "world/script_api/7E3700", func_80282880); +ApiStatus func_80282880(ScriptInstance* script, s32 isInitialCall) { + PlayerStatus* playerStatus = PLAYER_STATUS; + + playerStatus->position.x += (script->varTable[0] - playerStatus->position.x) / 2; + playerStatus->position.z += (script->varTable[2] - playerStatus->position.z) / 2; + + return ApiStatus_DONE2; +} INCLUDE_ASM(s32, "world/script_api/7E3700", func_802828DC); @@ -33,19 +40,98 @@ INCLUDE_ASM(s32, "world/script_api/7E3700", GetGridIndexFromPos); INCLUDE_ASM(s32, "world/script_api/7E3700", SetPushBlockFallEffect); -INCLUDE_ASM(s32, "world/script_api/7E3700", func_80283810); +ApiStatus func_80283810(ScriptInstance* script, s32 isInitialCall) { + PlayerStatus* playerStatus = PLAYER_STATUS; -INCLUDE_ASM(s32, "world/script_api/7E3700", TeleportPartnerToPlayer); + script->varTable[10] = 0; + if (partner_get_ride_script() != NULL) { + if (D_8010EBB0[0] == 0) { + script->varTable[10] = 0; + } else { + script->varTable[10] = 1; + script->varTable[11] = partner_get_ride_script(); + script->varTable[13] = playerStatus->targetYaw; + } + } + return ApiStatus_DONE2; +} + +ApiStatus TeleportPartnerToPlayer(ScriptInstance* script, s32 isInitialCall) { + PlayerStatus* playerStatus = PLAYER_STATUS; + PlayerStatus* playerStatus2 = PLAYER_STATUS; + Npc *partner; + + if (PLAYER_DATA->currentPartner == PartnerId_NONE) { + return ApiStatus_DONE2; + } + + partner = get_npc_unsafe(NpcId_PARTNER); + partner->pos.x = playerStatus->position.x; + partner->pos.z = playerStatus->position.z; + + if (is_current_partner_flying()) { + partner->pos.y = playerStatus->position.y; + } + + set_npc_yaw(partner, playerStatus2->targetYaw); + clear_partner_move_history(partner); + return ApiStatus_DONE2; +} + +#ifdef NON_MATCHING +ApiStatus func_80283908(ScriptInstance* script, s32 isInitialCall) { + PlayerStatus* playerStatus = PLAYER_STATUS; + Camera* camera = CURRENT_CAM; + + playerStatus->position.x = GAME_STATUS->savedPos.x; + playerStatus->position.y = GAME_STATUS->savedPos.y; + playerStatus->position.z = GAME_STATUS->savedPos.z; + + if (PLAYER_DATA->currentPartner != PartnerId_NONE) { + Npc* partner = get_npc_unsafe(NpcId_PARTNER); + f32 angle = clamp_angle(playerStatus->spriteFacingAngle < 180.0f ? 90.0f : -90.0f); + + partner->pos.x = playerStatus->position.x; + partner->pos.y = playerStatus->position.y; + partner->pos.z = playerStatus->position.z; + + add_vec2D_polar(&partner->pos, &partner->pos.z, playerStatus->colliderDiameter + 5, angle); + enable_partner_ai(); + } + + camera->unk_08 = 1; + + return ApiStatus_DONE2; +} +#else INCLUDE_ASM(s32, "world/script_api/7E3700", func_80283908); +#endif INCLUDE_ASM(s32, "world/script_api/7E3700", func_80283A50); -INCLUDE_ASM(s32, "world/script_api/7E3700", func_80283B88); +ApiStatus func_80283B88(ScriptInstance* script, s32 isInitialCall) { + func_800EF394(20.0f); + return ApiStatus_DONE2; +} -INCLUDE_ASM(s32, "world/script_api/7E3700", func_80283BB0); +ApiStatus func_80283BB0(ScriptInstance* script, s32 isInitialCall) { + func_800EF3A4(); + return ApiStatus_DONE2; +} -INCLUDE_ASM(s32, "world/script_api/7E3700", func_80283BD0); +ApiStatus func_80283BD0(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + PlayerStatus* playerStatus = PLAYER_STATUS; + + if (isInitialCall) { + script->functionTemp[0].s = get_variable(script, *args++); + move_player(script->functionTemp[0].s, playerStatus->targetYaw, playerStatus->runSpeed); + } + + script->functionTemp[0].s--; + return script->functionTemp[0].s < 0; +} INCLUDE_ASM(s32, "world/script_api/7E3700", func_80283C34); diff --git a/tools/disasm_script.py b/tools/disasm_script.py index 0c5ffc9ac4..2a789dc408 100755 --- a/tools/disasm_script.py +++ b/tools/disasm_script.py @@ -38,10 +38,10 @@ def script_lib(): # symbol_addrs.txt with open(Path(path.dirname(__file__), "symbol_addrs.txt"), "r") as file: for line in file.readlines(): - s = line.split(";") - name = s[0] - addr = s[1] - _script_lib[int(addr, 16)] = name + s = line.split("=") + name = s[0].strip() + addr = int(s[1].strip()[0:10], 0) + _script_lib[addr] = name return _script_lib diff --git a/tools/splat.yaml b/tools/splat.yaml index 05f6c75512..6f807a6ab2 100644 --- a/tools/splat.yaml +++ b/tools/splat.yaml @@ -1743,9 +1743,9 @@ segments: files: - [0x929270, "c"] - [0x9292B0, "c"] - - [0x9292D0, "bin"] - - [0x929A00, "bin"] - - [0x929A80, "bin"] # rodata + - [0x9292D0, ".data", "world/area_sbk/sbk_00/929270"] + - [0x929A00, ".data", "world/area_sbk/sbk_00/9292B0"] + - [0x929A80, ".rodata", "world/area_sbk/sbk_00/929270"] - name: world/area_sbk/sbk_01/ type: code overlay: True diff --git a/tools/symbol_addrs.txt b/tools/symbol_addrs.txt index 7d8ed28671..f8674c5488 100644 --- a/tools/symbol_addrs.txt +++ b/tools/symbol_addrs.txt @@ -1890,6 +1890,10 @@ gGlobalTimeSpace = 0x802D9CA8; ShakeCam1 = 0x802D9CB0; ShakeCamX = 0x802D9CE8; D_802D9D50 = 0x802D9D50; +gWorldMapFlags = 0x802DBC70; // size:0xC +gWorldMapVars = 0x802DBCA8; // size:0x40 +gBattleMapVars = 0x802DBCE8; // size:0x40 +gBattleMapFlags = 0x802DBD34; // size:0xC spr_appendMDL_component = 0x802DC8F4; spr_transform_point = 0x802DCD00; spr_draw_component = 0x802DCEDC;