From 8e104e11476d3eaae53a7c5233f85b2e08891caf Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Mon, 19 Oct 2020 18:47:29 -0400 Subject: [PATCH] AwaitPlayerNearNPC --- .vscode/c_cpp_properties.json | 3 ++- Makefile | 2 +- .../area_arn/arn_03/func_80240B94_BDED90.s | 2 +- .../area_arn/arn_04/func_80240B94_BE37B0.s | 2 +- .../area_arn/arn_05/func_80240B94_BE7BE0.s | 2 +- .../area_dgb/dgb_08/func_80240B94_C3FDB0.s | 2 +- .../area_dgb/dgb_18/func_80240B94_C55F40.s | 2 +- .../world/area_end/end_00/func_80241B34.s | 2 +- .../area_isk/isk_04/func_8024085C_97B630.s | 27 ------------------- .../world/area_isk/isk_08/func_8024081C.s | 27 ------------------- .../area_isk/isk_18/func_8024081C_997F70.s | 27 ------------------- .../area_jan/jan_22/func_80240B94_B84180.s | 2 +- .../area_kkj/kkj_01/func_80240B94_AC5170.s | 2 +- .../world/area_kpa/kpa_01/func_8024097C.s | 27 ------------------- .../area_kpa/kpa_03/func_8024097C_A485C0.s | 27 ------------------- .../world/area_kpa/kpa_113/func_802409CC.s | 27 ------------------- .../world/area_kpa/kpa_91/func_80240B94.s | 2 +- .../world/area_kzn/kzn_03/func_80240B2C.s | 27 ------------------- .../world/area_kzn/kzn_09/func_802431E0.s | 27 ------------------- .../world/area_kzn/kzn_17/func_802424D0.s | 27 ------------------- .../area_mim/mim_04/func_80240DF0_B9D960.s | 2 +- .../world/area_tik/tik_12/func_8024217C.s | 27 ------------------- include/macros.h | 1 + src/world/area_isk/isk_04.c | 2 +- src/world/area_isk/isk_08.c | 2 +- src/world/area_isk/isk_18.c | 2 +- src/world/area_kpa/kpa_01.c | 2 +- src/world/area_kpa/kpa_03.c | 2 +- src/world/area_kpa/kpa_113.c | 2 +- src/world/area_kzn/kzn_03.c | 2 +- src/world/area_kzn/kzn_09.c | 2 +- src/world/area_kzn/kzn_17.c | 2 +- src/world/area_tik/tik_12.c | 2 +- src/world/common/AwaitPlayerNearNPC.c | 11 ++++++++ 34 files changed, 35 insertions(+), 292 deletions(-) delete mode 100644 asm/nonmatchings/world/area_isk/isk_04/func_8024085C_97B630.s delete mode 100644 asm/nonmatchings/world/area_isk/isk_08/func_8024081C.s delete mode 100644 asm/nonmatchings/world/area_isk/isk_18/func_8024081C_997F70.s delete mode 100644 asm/nonmatchings/world/area_kpa/kpa_01/func_8024097C.s delete mode 100644 asm/nonmatchings/world/area_kpa/kpa_03/func_8024097C_A485C0.s delete mode 100644 asm/nonmatchings/world/area_kpa/kpa_113/func_802409CC.s delete mode 100644 asm/nonmatchings/world/area_kzn/kzn_03/func_80240B2C.s delete mode 100644 asm/nonmatchings/world/area_kzn/kzn_09/func_802431E0.s delete mode 100644 asm/nonmatchings/world/area_kzn/kzn_17/func_802424D0.s delete mode 100644 asm/nonmatchings/world/area_tik/tik_12/func_8024217C.s create mode 100644 src/world/common/AwaitPlayerNearNPC.c diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 7c226a0f4e..024a2e0acf 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -4,7 +4,8 @@ { "name": "papermario", "includePath": [ - "${workspaceFolder}/include" + "${workspaceFolder}/include", + "${workspaceFolder}/src" ], "defines": [ "F3DEX_GBI_2", diff --git a/Makefile b/Makefile index 7ff3e45c8f..0e4829721e 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ OBJCOPY = $(CROSS)objcopy TARGET = papermario -CPPFLAGS = -Iinclude -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2 +CPPFLAGS = -Iinclude -Isrc -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2 ASFLAGS = -EB -Iinclude -march=vr4300 -mtune=vr4300 OLDASFLAGS = -EB -Iinclude -G 0 CFLAGS = -O2 -quiet -G 0 -mcpu=vr4300 -mfix4300 -mips3 -mgp32 -mfp32 diff --git a/asm/nonmatchings/world/area_arn/arn_03/func_80240B94_BDED90.s b/asm/nonmatchings/world/area_arn/arn_03/func_80240B94_BDED90.s index b0a0413e29..439f288c28 100644 --- a/asm/nonmatchings/world/area_arn/arn_03/func_80240B94_BDED90.s +++ b/asm/nonmatchings/world/area_arn/arn_03/func_80240B94_BDED90.s @@ -167,7 +167,7 @@ glabel func_80240B94_BDF924 /* BDFB94 80240E04 00000000 */ nop /* BDFB98 80240E08 0280202D */ daddu $a0, $s4, $zero /* BDFB9C 80240E0C 0260282D */ daddu $a1, $s3, $zero -/* BDFBA0 80240E10 0C090207 */ jal func_8024081C +/* BDFBA0 80240E10 0C090207 */ jal func_8024081C_BDED90 /* BDFBA4 80240E14 02A0302D */ daddu $a2, $s5, $zero /* BDFBA8 80240E18 0280202D */ daddu $a0, $s4, $zero /* BDFBAC 80240E1C 0260282D */ daddu $a1, $s3, $zero diff --git a/asm/nonmatchings/world/area_arn/arn_04/func_80240B94_BE37B0.s b/asm/nonmatchings/world/area_arn/arn_04/func_80240B94_BE37B0.s index 2b985e7f92..978603187d 100644 --- a/asm/nonmatchings/world/area_arn/arn_04/func_80240B94_BE37B0.s +++ b/asm/nonmatchings/world/area_arn/arn_04/func_80240B94_BE37B0.s @@ -167,7 +167,7 @@ glabel func_80240B94_BE4344 /* BE45B4 80240E04 00000000 */ nop /* BE45B8 80240E08 0280202D */ daddu $a0, $s4, $zero /* BE45BC 80240E0C 0260282D */ daddu $a1, $s3, $zero -/* BE45C0 80240E10 0C090207 */ jal func_8024081C +/* BE45C0 80240E10 0C090207 */ jal func_8024081C_BE37B0 /* BE45C4 80240E14 02A0302D */ daddu $a2, $s5, $zero /* BE45C8 80240E18 0280202D */ daddu $a0, $s4, $zero /* BE45CC 80240E1C 0260282D */ daddu $a1, $s3, $zero diff --git a/asm/nonmatchings/world/area_arn/arn_05/func_80240B94_BE7BE0.s b/asm/nonmatchings/world/area_arn/arn_05/func_80240B94_BE7BE0.s index 14eb558996..b1485acb16 100644 --- a/asm/nonmatchings/world/area_arn/arn_05/func_80240B94_BE7BE0.s +++ b/asm/nonmatchings/world/area_arn/arn_05/func_80240B94_BE7BE0.s @@ -167,7 +167,7 @@ glabel func_80240B94_BE8774 /* BE89E4 80240E04 00000000 */ nop /* BE89E8 80240E08 0280202D */ daddu $a0, $s4, $zero /* BE89EC 80240E0C 0260282D */ daddu $a1, $s3, $zero -/* BE89F0 80240E10 0C090207 */ jal func_8024081C +/* BE89F0 80240E10 0C090207 */ jal func_8024081C_BE7BE0 /* BE89F4 80240E14 02A0302D */ daddu $a2, $s5, $zero /* BE89F8 80240E18 0280202D */ daddu $a0, $s4, $zero /* BE89FC 80240E1C 0260282D */ daddu $a1, $s3, $zero diff --git a/asm/nonmatchings/world/area_dgb/dgb_08/func_80240B94_C3FDB0.s b/asm/nonmatchings/world/area_dgb/dgb_08/func_80240B94_C3FDB0.s index 58dc824ff1..16dacca668 100644 --- a/asm/nonmatchings/world/area_dgb/dgb_08/func_80240B94_C3FDB0.s +++ b/asm/nonmatchings/world/area_dgb/dgb_08/func_80240B94_C3FDB0.s @@ -167,7 +167,7 @@ glabel func_80240B94_C40944 /* C40BB4 80240E04 00000000 */ nop /* C40BB8 80240E08 0280202D */ daddu $a0, $s4, $zero /* C40BBC 80240E0C 0260282D */ daddu $a1, $s3, $zero -/* C40BC0 80240E10 0C090207 */ jal func_8024081C +/* C40BC0 80240E10 0C090207 */ jal func_8024081C_C3FDB0 /* C40BC4 80240E14 02A0302D */ daddu $a2, $s5, $zero /* C40BC8 80240E18 0280202D */ daddu $a0, $s4, $zero /* C40BCC 80240E1C 0260282D */ daddu $a1, $s3, $zero diff --git a/asm/nonmatchings/world/area_dgb/dgb_18/func_80240B94_C55F40.s b/asm/nonmatchings/world/area_dgb/dgb_18/func_80240B94_C55F40.s index a9965d9d70..19b94b8d25 100644 --- a/asm/nonmatchings/world/area_dgb/dgb_18/func_80240B94_C55F40.s +++ b/asm/nonmatchings/world/area_dgb/dgb_18/func_80240B94_C55F40.s @@ -167,7 +167,7 @@ glabel func_80240B94_C56AD4 /* C56D44 80240E04 00000000 */ nop /* C56D48 80240E08 0280202D */ daddu $a0, $s4, $zero /* C56D4C 80240E0C 0260282D */ daddu $a1, $s3, $zero -/* C56D50 80240E10 0C090207 */ jal func_8024081C +/* C56D50 80240E10 0C090207 */ jal func_8024081C_C55F40 /* C56D54 80240E14 02A0302D */ daddu $a2, $s5, $zero /* C56D58 80240E18 0280202D */ daddu $a0, $s4, $zero /* C56D5C 80240E1C 0260282D */ daddu $a1, $s3, $zero diff --git a/asm/nonmatchings/world/area_end/end_00/func_80241B34.s b/asm/nonmatchings/world/area_end/end_00/func_80241B34.s index d848124240..42d32a168d 100644 --- a/asm/nonmatchings/world/area_end/end_00/func_80241B34.s +++ b/asm/nonmatchings/world/area_end/end_00/func_80241B34.s @@ -264,7 +264,7 @@ glabel func_80241B34 /* DF88F8 80241EF8 0809080C */ j .L80242030 /* DF88FC 80241EFC 26F70001 */ addiu $s7, $s7, 1 /* DF8900 80241F00 0260202D */ daddu $a0, $s3, $zero -/* DF8904 80241F04 0C090207 */ jal func_8024081C +/* DF8904 80241F04 0C090207 */ jal func_8024081C_DF6A00 /* DF8908 80241F08 0200282D */ daddu $a1, $s0, $zero /* DF890C 80241F0C 0809080C */ j .L80242030 /* DF8910 80241F10 26F70001 */ addiu $s7, $s7, 1 diff --git a/asm/nonmatchings/world/area_isk/isk_04/func_8024085C_97B630.s b/asm/nonmatchings/world/area_isk/isk_04/func_8024085C_97B630.s deleted file mode 100644 index a789806b0c..0000000000 --- a/asm/nonmatchings/world/area_isk/isk_04/func_8024085C_97B630.s +++ /dev/null @@ -1,27 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8024085C_97BE8C -/* 97BE8C 8024085C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 97BE90 80240860 AFBF0010 */ sw $ra, 0x10($sp) -/* 97BE94 80240864 0C00EAD2 */ jal get_npc_safe -/* 97BE98 80240868 8C84014C */ lw $a0, 0x14c($a0) -/* 97BE9C 8024086C 3C038011 */ lui $v1, %hi(gPlayerStatus) -/* 97BEA0 80240870 2463EFC8 */ addiu $v1, $v1, %lo(gPlayerStatus) -/* 97BEA4 80240874 C44C0038 */ lwc1 $f12, 0x38($v0) -/* 97BEA8 80240878 C44E0040 */ lwc1 $f14, 0x40($v0) -/* 97BEAC 8024087C 8C660028 */ lw $a2, 0x28($v1) -/* 97BEB0 80240880 0C00A7B5 */ jal dist2D -/* 97BEB4 80240884 8C670030 */ lw $a3, 0x30($v1) -/* 97BEB8 80240888 3C014248 */ lui $at, 0x4248 -/* 97BEBC 8024088C 44811000 */ mtc1 $at, $f2 -/* 97BEC0 80240890 00000000 */ nop -/* 97BEC4 80240894 4602003C */ c.lt.s $f0, $f2 -/* 97BEC8 80240898 00000000 */ nop -/* 97BECC 8024089C 45010002 */ bc1t .L802408A8 -/* 97BED0 802408A0 24020002 */ addiu $v0, $zero, 2 -/* 97BED4 802408A4 0000102D */ daddu $v0, $zero, $zero -.L802408A8: -/* 97BED8 802408A8 8FBF0010 */ lw $ra, 0x10($sp) -/* 97BEDC 802408AC 03E00008 */ jr $ra -/* 97BEE0 802408B0 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/area_isk/isk_08/func_8024081C.s b/asm/nonmatchings/world/area_isk/isk_08/func_8024081C.s deleted file mode 100644 index bc5ffa3fdb..0000000000 --- a/asm/nonmatchings/world/area_isk/isk_08/func_8024081C.s +++ /dev/null @@ -1,27 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8024081C -/* 98564C 8024081C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 985650 80240820 AFBF0010 */ sw $ra, 0x10($sp) -/* 985654 80240824 0C00EAD2 */ jal get_npc_safe -/* 985658 80240828 8C84014C */ lw $a0, 0x14c($a0) -/* 98565C 8024082C 3C038011 */ lui $v1, %hi(gPlayerStatus) -/* 985660 80240830 2463EFC8 */ addiu $v1, $v1, %lo(gPlayerStatus) -/* 985664 80240834 C44C0038 */ lwc1 $f12, 0x38($v0) -/* 985668 80240838 C44E0040 */ lwc1 $f14, 0x40($v0) -/* 98566C 8024083C 8C660028 */ lw $a2, 0x28($v1) -/* 985670 80240840 0C00A7B5 */ jal dist2D -/* 985674 80240844 8C670030 */ lw $a3, 0x30($v1) -/* 985678 80240848 3C014248 */ lui $at, 0x4248 -/* 98567C 8024084C 44811000 */ mtc1 $at, $f2 -/* 985680 80240850 00000000 */ nop -/* 985684 80240854 4602003C */ c.lt.s $f0, $f2 -/* 985688 80240858 00000000 */ nop -/* 98568C 8024085C 45010002 */ bc1t .L80240868 -/* 985690 80240860 24020002 */ addiu $v0, $zero, 2 -/* 985694 80240864 0000102D */ daddu $v0, $zero, $zero -.L80240868: -/* 985698 80240868 8FBF0010 */ lw $ra, 0x10($sp) -/* 98569C 8024086C 03E00008 */ jr $ra -/* 9856A0 80240870 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/area_isk/isk_18/func_8024081C_997F70.s b/asm/nonmatchings/world/area_isk/isk_18/func_8024081C_997F70.s deleted file mode 100644 index 817390b51a..0000000000 --- a/asm/nonmatchings/world/area_isk/isk_18/func_8024081C_997F70.s +++ /dev/null @@ -1,27 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8024081C_99878C -/* 99878C 8024081C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 998790 80240820 AFBF0010 */ sw $ra, 0x10($sp) -/* 998794 80240824 0C00EAD2 */ jal get_npc_safe -/* 998798 80240828 8C84014C */ lw $a0, 0x14c($a0) -/* 99879C 8024082C 3C038011 */ lui $v1, %hi(gPlayerStatus) -/* 9987A0 80240830 2463EFC8 */ addiu $v1, $v1, %lo(gPlayerStatus) -/* 9987A4 80240834 C44C0038 */ lwc1 $f12, 0x38($v0) -/* 9987A8 80240838 C44E0040 */ lwc1 $f14, 0x40($v0) -/* 9987AC 8024083C 8C660028 */ lw $a2, 0x28($v1) -/* 9987B0 80240840 0C00A7B5 */ jal dist2D -/* 9987B4 80240844 8C670030 */ lw $a3, 0x30($v1) -/* 9987B8 80240848 3C014248 */ lui $at, 0x4248 -/* 9987BC 8024084C 44811000 */ mtc1 $at, $f2 -/* 9987C0 80240850 00000000 */ nop -/* 9987C4 80240854 4602003C */ c.lt.s $f0, $f2 -/* 9987C8 80240858 00000000 */ nop -/* 9987CC 8024085C 45010002 */ bc1t .L80240868 -/* 9987D0 80240860 24020002 */ addiu $v0, $zero, 2 -/* 9987D4 80240864 0000102D */ daddu $v0, $zero, $zero -.L80240868: -/* 9987D8 80240868 8FBF0010 */ lw $ra, 0x10($sp) -/* 9987DC 8024086C 03E00008 */ jr $ra -/* 9987E0 80240870 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/area_jan/jan_22/func_80240B94_B84180.s b/asm/nonmatchings/world/area_jan/jan_22/func_80240B94_B84180.s index f3cbeada1b..0f32fb96bb 100644 --- a/asm/nonmatchings/world/area_jan/jan_22/func_80240B94_B84180.s +++ b/asm/nonmatchings/world/area_jan/jan_22/func_80240B94_B84180.s @@ -167,7 +167,7 @@ glabel func_80240B94_B84D14 /* B84F84 80240E04 00000000 */ nop /* B84F88 80240E08 0280202D */ daddu $a0, $s4, $zero /* B84F8C 80240E0C 0260282D */ daddu $a1, $s3, $zero -/* B84F90 80240E10 0C090207 */ jal func_8024081C +/* B84F90 80240E10 0C090207 */ jal func_8024081C_B84180 /* B84F94 80240E14 02A0302D */ daddu $a2, $s5, $zero /* B84F98 80240E18 0280202D */ daddu $a0, $s4, $zero /* B84F9C 80240E1C 0260282D */ daddu $a1, $s3, $zero diff --git a/asm/nonmatchings/world/area_kkj/kkj_01/func_80240B94_AC5170.s b/asm/nonmatchings/world/area_kkj/kkj_01/func_80240B94_AC5170.s index 6af2c285b2..52c1007600 100644 --- a/asm/nonmatchings/world/area_kkj/kkj_01/func_80240B94_AC5170.s +++ b/asm/nonmatchings/world/area_kkj/kkj_01/func_80240B94_AC5170.s @@ -167,7 +167,7 @@ glabel func_80240B94_AC5D04 /* AC5F74 80240E04 00000000 */ nop /* AC5F78 80240E08 0280202D */ daddu $a0, $s4, $zero /* AC5F7C 80240E0C 0260282D */ daddu $a1, $s3, $zero -/* AC5F80 80240E10 0C090207 */ jal func_8024081C +/* AC5F80 80240E10 0C090207 */ jal func_8024081C_AC5170 /* AC5F84 80240E14 02A0302D */ daddu $a2, $s5, $zero /* AC5F88 80240E18 0280202D */ daddu $a0, $s4, $zero /* AC5F8C 80240E1C 0260282D */ daddu $a1, $s3, $zero diff --git a/asm/nonmatchings/world/area_kpa/kpa_01/func_8024097C.s b/asm/nonmatchings/world/area_kpa/kpa_01/func_8024097C.s deleted file mode 100644 index c430607903..0000000000 --- a/asm/nonmatchings/world/area_kpa/kpa_01/func_8024097C.s +++ /dev/null @@ -1,27 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8024097C -/* A478DC 8024097C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* A478E0 80240980 AFBF0010 */ sw $ra, 0x10($sp) -/* A478E4 80240984 0C00EAD2 */ jal get_npc_safe -/* A478E8 80240988 8C84014C */ lw $a0, 0x14c($a0) -/* A478EC 8024098C 3C038011 */ lui $v1, %hi(gPlayerStatus) -/* A478F0 80240990 2463EFC8 */ addiu $v1, $v1, %lo(gPlayerStatus) -/* A478F4 80240994 C44C0038 */ lwc1 $f12, 0x38($v0) -/* A478F8 80240998 C44E0040 */ lwc1 $f14, 0x40($v0) -/* A478FC 8024099C 8C660028 */ lw $a2, 0x28($v1) -/* A47900 802409A0 0C00A7B5 */ jal dist2D -/* A47904 802409A4 8C670030 */ lw $a3, 0x30($v1) -/* A47908 802409A8 3C014248 */ lui $at, 0x4248 -/* A4790C 802409AC 44811000 */ mtc1 $at, $f2 -/* A47910 802409B0 00000000 */ nop -/* A47914 802409B4 4602003C */ c.lt.s $f0, $f2 -/* A47918 802409B8 00000000 */ nop -/* A4791C 802409BC 45010002 */ bc1t .L802409C8 -/* A47920 802409C0 24020002 */ addiu $v0, $zero, 2 -/* A47924 802409C4 0000102D */ daddu $v0, $zero, $zero -.L802409C8: -/* A47928 802409C8 8FBF0010 */ lw $ra, 0x10($sp) -/* A4792C 802409CC 03E00008 */ jr $ra -/* A47930 802409D0 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/area_kpa/kpa_03/func_8024097C_A485C0.s b/asm/nonmatchings/world/area_kpa/kpa_03/func_8024097C_A485C0.s deleted file mode 100644 index 6cda5ce74f..0000000000 --- a/asm/nonmatchings/world/area_kpa/kpa_03/func_8024097C_A485C0.s +++ /dev/null @@ -1,27 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8024097C_A48F3C -/* A48F3C 8024097C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* A48F40 80240980 AFBF0010 */ sw $ra, 0x10($sp) -/* A48F44 80240984 0C00EAD2 */ jal get_npc_safe -/* A48F48 80240988 8C84014C */ lw $a0, 0x14c($a0) -/* A48F4C 8024098C 3C038011 */ lui $v1, %hi(gPlayerStatus) -/* A48F50 80240990 2463EFC8 */ addiu $v1, $v1, %lo(gPlayerStatus) -/* A48F54 80240994 C44C0038 */ lwc1 $f12, 0x38($v0) -/* A48F58 80240998 C44E0040 */ lwc1 $f14, 0x40($v0) -/* A48F5C 8024099C 8C660028 */ lw $a2, 0x28($v1) -/* A48F60 802409A0 0C00A7B5 */ jal dist2D -/* A48F64 802409A4 8C670030 */ lw $a3, 0x30($v1) -/* A48F68 802409A8 3C014248 */ lui $at, 0x4248 -/* A48F6C 802409AC 44811000 */ mtc1 $at, $f2 -/* A48F70 802409B0 00000000 */ nop -/* A48F74 802409B4 4602003C */ c.lt.s $f0, $f2 -/* A48F78 802409B8 00000000 */ nop -/* A48F7C 802409BC 45010002 */ bc1t .L802409C8 -/* A48F80 802409C0 24020002 */ addiu $v0, $zero, 2 -/* A48F84 802409C4 0000102D */ daddu $v0, $zero, $zero -.L802409C8: -/* A48F88 802409C8 8FBF0010 */ lw $ra, 0x10($sp) -/* A48F8C 802409CC 03E00008 */ jr $ra -/* A48F90 802409D0 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/area_kpa/kpa_113/func_802409CC.s b/asm/nonmatchings/world/area_kpa/kpa_113/func_802409CC.s deleted file mode 100644 index 850ba7b900..0000000000 --- a/asm/nonmatchings/world/area_kpa/kpa_113/func_802409CC.s +++ /dev/null @@ -1,27 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802409CC -/* A9D5FC 802409CC 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* A9D600 802409D0 AFBF0010 */ sw $ra, 0x10($sp) -/* A9D604 802409D4 0C00EAD2 */ jal get_npc_safe -/* A9D608 802409D8 8C84014C */ lw $a0, 0x14c($a0) -/* A9D60C 802409DC 3C038011 */ lui $v1, %hi(gPlayerStatus) -/* A9D610 802409E0 2463EFC8 */ addiu $v1, $v1, %lo(gPlayerStatus) -/* A9D614 802409E4 C44C0038 */ lwc1 $f12, 0x38($v0) -/* A9D618 802409E8 C44E0040 */ lwc1 $f14, 0x40($v0) -/* A9D61C 802409EC 8C660028 */ lw $a2, 0x28($v1) -/* A9D620 802409F0 0C00A7B5 */ jal dist2D -/* A9D624 802409F4 8C670030 */ lw $a3, 0x30($v1) -/* A9D628 802409F8 3C014248 */ lui $at, 0x4248 -/* A9D62C 802409FC 44811000 */ mtc1 $at, $f2 -/* A9D630 80240A00 00000000 */ nop -/* A9D634 80240A04 4602003C */ c.lt.s $f0, $f2 -/* A9D638 80240A08 00000000 */ nop -/* A9D63C 80240A0C 45010002 */ bc1t .L80240A18 -/* A9D640 80240A10 24020002 */ addiu $v0, $zero, 2 -/* A9D644 80240A14 0000102D */ daddu $v0, $zero, $zero -.L80240A18: -/* A9D648 80240A18 8FBF0010 */ lw $ra, 0x10($sp) -/* A9D64C 80240A1C 03E00008 */ jr $ra -/* A9D650 80240A20 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/area_kpa/kpa_91/func_80240B94.s b/asm/nonmatchings/world/area_kpa/kpa_91/func_80240B94.s index 5dc45eda25..2ad08c448a 100644 --- a/asm/nonmatchings/world/area_kpa/kpa_91/func_80240B94.s +++ b/asm/nonmatchings/world/area_kpa/kpa_91/func_80240B94.s @@ -167,7 +167,7 @@ glabel func_80240B94 /* A87854 80240E04 00000000 */ nop /* A87858 80240E08 0280202D */ daddu $a0, $s4, $zero /* A8785C 80240E0C 0260282D */ daddu $a1, $s3, $zero -/* A87860 80240E10 0C090207 */ jal func_8024081C +/* A87860 80240E10 0C090207 */ jal func_8024081C_A86A50 /* A87864 80240E14 02A0302D */ daddu $a2, $s5, $zero /* A87868 80240E18 0280202D */ daddu $a0, $s4, $zero /* A8786C 80240E1C 0260282D */ daddu $a1, $s3, $zero diff --git a/asm/nonmatchings/world/area_kzn/kzn_03/func_80240B2C.s b/asm/nonmatchings/world/area_kzn/kzn_03/func_80240B2C.s deleted file mode 100644 index e6ee4ec871..0000000000 --- a/asm/nonmatchings/world/area_kzn/kzn_03/func_80240B2C.s +++ /dev/null @@ -1,27 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80240B2C -/* C6183C 80240B2C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* C61840 80240B30 AFBF0010 */ sw $ra, 0x10($sp) -/* C61844 80240B34 0C00EAD2 */ jal get_npc_safe -/* C61848 80240B38 8C84014C */ lw $a0, 0x14c($a0) -/* C6184C 80240B3C 3C038011 */ lui $v1, %hi(gPlayerStatus) -/* C61850 80240B40 2463EFC8 */ addiu $v1, $v1, %lo(gPlayerStatus) -/* C61854 80240B44 C44C0038 */ lwc1 $f12, 0x38($v0) -/* C61858 80240B48 C44E0040 */ lwc1 $f14, 0x40($v0) -/* C6185C 80240B4C 8C660028 */ lw $a2, 0x28($v1) -/* C61860 80240B50 0C00A7B5 */ jal dist2D -/* C61864 80240B54 8C670030 */ lw $a3, 0x30($v1) -/* C61868 80240B58 3C014248 */ lui $at, 0x4248 -/* C6186C 80240B5C 44811000 */ mtc1 $at, $f2 -/* C61870 80240B60 00000000 */ nop -/* C61874 80240B64 4602003C */ c.lt.s $f0, $f2 -/* C61878 80240B68 00000000 */ nop -/* C6187C 80240B6C 45010002 */ bc1t .L80240B78 -/* C61880 80240B70 24020002 */ addiu $v0, $zero, 2 -/* C61884 80240B74 0000102D */ daddu $v0, $zero, $zero -.L80240B78: -/* C61888 80240B78 8FBF0010 */ lw $ra, 0x10($sp) -/* C6188C 80240B7C 03E00008 */ jr $ra -/* C61890 80240B80 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/area_kzn/kzn_09/func_802431E0.s b/asm/nonmatchings/world/area_kzn/kzn_09/func_802431E0.s deleted file mode 100644 index 15595f32d8..0000000000 --- a/asm/nonmatchings/world/area_kzn/kzn_09/func_802431E0.s +++ /dev/null @@ -1,27 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802431E0 -/* C79EC0 802431E0 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* C79EC4 802431E4 AFBF0010 */ sw $ra, 0x10($sp) -/* C79EC8 802431E8 0C00EAD2 */ jal get_npc_safe -/* C79ECC 802431EC 8C84014C */ lw $a0, 0x14c($a0) -/* C79ED0 802431F0 3C038011 */ lui $v1, %hi(gPlayerStatus) -/* C79ED4 802431F4 2463EFC8 */ addiu $v1, $v1, %lo(gPlayerStatus) -/* C79ED8 802431F8 C44C0038 */ lwc1 $f12, 0x38($v0) -/* C79EDC 802431FC C44E0040 */ lwc1 $f14, 0x40($v0) -/* C79EE0 80243200 8C660028 */ lw $a2, 0x28($v1) -/* C79EE4 80243204 0C00A7B5 */ jal dist2D -/* C79EE8 80243208 8C670030 */ lw $a3, 0x30($v1) -/* C79EEC 8024320C 3C014248 */ lui $at, 0x4248 -/* C79EF0 80243210 44811000 */ mtc1 $at, $f2 -/* C79EF4 80243214 00000000 */ nop -/* C79EF8 80243218 4602003C */ c.lt.s $f0, $f2 -/* C79EFC 8024321C 00000000 */ nop -/* C79F00 80243220 45010002 */ bc1t .L8024322C -/* C79F04 80243224 24020002 */ addiu $v0, $zero, 2 -/* C79F08 80243228 0000102D */ daddu $v0, $zero, $zero -.L8024322C: -/* C79F0C 8024322C 8FBF0010 */ lw $ra, 0x10($sp) -/* C79F10 80243230 03E00008 */ jr $ra -/* C79F14 80243234 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/area_kzn/kzn_17/func_802424D0.s b/asm/nonmatchings/world/area_kzn/kzn_17/func_802424D0.s deleted file mode 100644 index f76e0c54dd..0000000000 --- a/asm/nonmatchings/world/area_kzn/kzn_17/func_802424D0.s +++ /dev/null @@ -1,27 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802424D0 -/* C87F80 802424D0 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* C87F84 802424D4 AFBF0010 */ sw $ra, 0x10($sp) -/* C87F88 802424D8 0C00EAD2 */ jal get_npc_safe -/* C87F8C 802424DC 8C84014C */ lw $a0, 0x14c($a0) -/* C87F90 802424E0 3C038011 */ lui $v1, %hi(gPlayerStatus) -/* C87F94 802424E4 2463EFC8 */ addiu $v1, $v1, %lo(gPlayerStatus) -/* C87F98 802424E8 C44C0038 */ lwc1 $f12, 0x38($v0) -/* C87F9C 802424EC C44E0040 */ lwc1 $f14, 0x40($v0) -/* C87FA0 802424F0 8C660028 */ lw $a2, 0x28($v1) -/* C87FA4 802424F4 0C00A7B5 */ jal dist2D -/* C87FA8 802424F8 8C670030 */ lw $a3, 0x30($v1) -/* C87FAC 802424FC 3C014248 */ lui $at, 0x4248 -/* C87FB0 80242500 44811000 */ mtc1 $at, $f2 -/* C87FB4 80242504 00000000 */ nop -/* C87FB8 80242508 4602003C */ c.lt.s $f0, $f2 -/* C87FBC 8024250C 00000000 */ nop -/* C87FC0 80242510 45010002 */ bc1t .L8024251C -/* C87FC4 80242514 24020002 */ addiu $v0, $zero, 2 -/* C87FC8 80242518 0000102D */ daddu $v0, $zero, $zero -.L8024251C: -/* C87FCC 8024251C 8FBF0010 */ lw $ra, 0x10($sp) -/* C87FD0 80242520 03E00008 */ jr $ra -/* C87FD4 80242524 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/world/area_mim/mim_04/func_80240DF0_B9D960.s b/asm/nonmatchings/world/area_mim/mim_04/func_80240DF0_B9D960.s index c2019d8868..7c5168a793 100644 --- a/asm/nonmatchings/world/area_mim/mim_04/func_80240DF0_B9D960.s +++ b/asm/nonmatchings/world/area_mim/mim_04/func_80240DF0_B9D960.s @@ -119,7 +119,7 @@ glabel func_80240DF0_B9E750 /* B9E910 80240FB0 0000102D */ daddu $v0, $zero, $zero /* B9E914 80240FB4 0260202D */ daddu $a0, $s3, $zero /* B9E918 80240FB8 0280282D */ daddu $a1, $s4, $zero -/* B9E91C 80240FBC 0C090273 */ jal func_802409CC +/* B9E91C 80240FBC 0C090273 */ jal func_802409CC_B9D960 /* B9E920 80240FC0 0200302D */ daddu $a2, $s0, $zero /* B9E924 80240FC4 0260202D */ daddu $a0, $s3, $zero /* B9E928 80240FC8 0280282D */ daddu $a1, $s4, $zero diff --git a/asm/nonmatchings/world/area_tik/tik_12/func_8024217C.s b/asm/nonmatchings/world/area_tik/tik_12/func_8024217C.s deleted file mode 100644 index 98396921b2..0000000000 --- a/asm/nonmatchings/world/area_tik/tik_12/func_8024217C.s +++ /dev/null @@ -1,27 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_8024217C -/* 88AD4C 8024217C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 88AD50 80242180 AFBF0010 */ sw $ra, 0x10($sp) -/* 88AD54 80242184 0C00EAD2 */ jal get_npc_safe -/* 88AD58 80242188 8C84014C */ lw $a0, 0x14c($a0) -/* 88AD5C 8024218C 3C038011 */ lui $v1, %hi(gPlayerStatus) -/* 88AD60 80242190 2463EFC8 */ addiu $v1, $v1, %lo(gPlayerStatus) -/* 88AD64 80242194 C44C0038 */ lwc1 $f12, 0x38($v0) -/* 88AD68 80242198 C44E0040 */ lwc1 $f14, 0x40($v0) -/* 88AD6C 8024219C 8C660028 */ lw $a2, 0x28($v1) -/* 88AD70 802421A0 0C00A7B5 */ jal dist2D -/* 88AD74 802421A4 8C670030 */ lw $a3, 0x30($v1) -/* 88AD78 802421A8 3C014248 */ lui $at, 0x4248 -/* 88AD7C 802421AC 44811000 */ mtc1 $at, $f2 -/* 88AD80 802421B0 00000000 */ nop -/* 88AD84 802421B4 4602003C */ c.lt.s $f0, $f2 -/* 88AD88 802421B8 00000000 */ nop -/* 88AD8C 802421BC 45010002 */ bc1t .L802421C8 -/* 88AD90 802421C0 24020002 */ addiu $v0, $zero, 2 -/* 88AD94 802421C4 0000102D */ daddu $v0, $zero, $zero -.L802421C8: -/* 88AD98 802421C8 8FBF0010 */ lw $ra, 0x10($sp) -/* 88AD9C 802421CC 03E00008 */ jr $ra -/* 88ADA0 802421D0 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/include/macros.h b/include/macros.h index 43e52c1882..cedc4edf5d 100644 --- a/include/macros.h +++ b/include/macros.h @@ -17,6 +17,7 @@ #define PANIC() ASSERT(0) #define GAME_STATUS (*gGameStatusPtr) +#define PLAYER_STATUS (&gPlayerStatus) #define MAX_MAPVARS 16 #define MAX_MAPFLAGS 3 diff --git a/src/world/area_isk/isk_04.c b/src/world/area_isk/isk_04.c index fc5a094cf0..dc553b1dae 100644 --- a/src/world/area_isk/isk_04.c +++ b/src/world/area_isk/isk_04.c @@ -14,7 +14,7 @@ INCLUDE_ASM(s32, "world/area_isk/isk_04", func_802403D4); INCLUDE_ASM(s32, "world/area_isk/isk_04", func_80240814); -INCLUDE_ASM(s32, "world/area_isk/isk_04", func_8024085C_97B630); +#include "world/common/AwaitPlayerNearNPC.c" INCLUDE_ASM(s32, "world/area_isk/isk_04", func_802408B4_97B630); diff --git a/src/world/area_isk/isk_08.c b/src/world/area_isk/isk_08.c index 889c509949..8c9ab80e0e 100644 --- a/src/world/area_isk/isk_08.c +++ b/src/world/area_isk/isk_08.c @@ -12,6 +12,6 @@ INCLUDE_ASM(s32, "world/area_isk/isk_08", func_80240394); INCLUDE_ASM(s32, "world/area_isk/isk_08", func_802407D4); -INCLUDE_ASM(s32, "world/area_isk/isk_08", func_8024081C); +#include "world/common/AwaitPlayerNearNPC.c" INCLUDE_ASM(s32, "world/area_isk/isk_08", func_80240874); diff --git a/src/world/area_isk/isk_18.c b/src/world/area_isk/isk_18.c index 14a4376f8e..5dfb964b02 100644 --- a/src/world/area_isk/isk_18.c +++ b/src/world/area_isk/isk_18.c @@ -12,6 +12,6 @@ INCLUDE_ASM(s32, "world/area_isk/isk_18", func_80240394_997F70); INCLUDE_ASM(s32, "world/area_isk/isk_18", func_802407D4_997F70); -INCLUDE_ASM(s32, "world/area_isk/isk_18", func_8024081C_997F70); +#include "world/common/AwaitPlayerNearNPC.c" INCLUDE_ASM(s32, "world/area_isk/isk_18", func_80240874_997F70); diff --git a/src/world/area_kpa/kpa_01.c b/src/world/area_kpa/kpa_01.c index 31f9308ee2..b24bba69f8 100644 --- a/src/world/area_kpa/kpa_01.c +++ b/src/world/area_kpa/kpa_01.c @@ -14,6 +14,6 @@ INCLUDE_ASM(s32, "world/area_kpa/kpa_01", func_802404F4); INCLUDE_ASM(s32, "world/area_kpa/kpa_01", func_80240934); -INCLUDE_ASM(s32, "world/area_kpa/kpa_01", func_8024097C); +#include "world/common/AwaitPlayerNearNPC.c" INCLUDE_ASM(s32, "world/area_kpa/kpa_01", func_802409D4_A46F60); diff --git a/src/world/area_kpa/kpa_03.c b/src/world/area_kpa/kpa_03.c index 9db228c437..304233ec54 100644 --- a/src/world/area_kpa/kpa_03.c +++ b/src/world/area_kpa/kpa_03.c @@ -14,7 +14,7 @@ INCLUDE_ASM(s32, "world/area_kpa/kpa_03", func_802404F4_A485C0); INCLUDE_ASM(s32, "world/area_kpa/kpa_03", func_80240934_A485C0); -INCLUDE_ASM(s32, "world/area_kpa/kpa_03", func_8024097C_A485C0); +#include "world/common/AwaitPlayerNearNPC.c" INCLUDE_ASM(s32, "world/area_kpa/kpa_03", func_802409D4_A485C0); diff --git a/src/world/area_kpa/kpa_113.c b/src/world/area_kpa/kpa_113.c index 95f56ddee2..af60942984 100644 --- a/src/world/area_kpa/kpa_113.c +++ b/src/world/area_kpa/kpa_113.c @@ -18,6 +18,6 @@ INCLUDE_ASM(s32, "world/area_kpa/kpa_113", func_80240544_A9CC30); INCLUDE_ASM(s32, "world/area_kpa/kpa_113", func_80240984_A9CC30); -INCLUDE_ASM(s32, "world/area_kpa/kpa_113", func_802409CC); +#include "world/common/AwaitPlayerNearNPC.c" INCLUDE_ASM(s32, "world/area_kpa/kpa_113", func_80240A24_A9CC30); diff --git a/src/world/area_kzn/kzn_03.c b/src/world/area_kzn/kzn_03.c index 61d053eb90..d534884004 100644 --- a/src/world/area_kzn/kzn_03.c +++ b/src/world/area_kzn/kzn_03.c @@ -16,7 +16,7 @@ INCLUDE_ASM(s32, "world/area_kzn/kzn_03", func_802406A4_C60D10); INCLUDE_ASM(s32, "world/area_kzn/kzn_03", func_80240AE4_C60D10); -INCLUDE_ASM(s32, "world/area_kzn/kzn_03", func_80240B2C); +#include "world/common/AwaitPlayerNearNPC.c" INCLUDE_ASM(s32, "world/area_kzn/kzn_03", func_80240B84_C60D10); diff --git a/src/world/area_kzn/kzn_09.c b/src/world/area_kzn/kzn_09.c index 5ecb1576f8..e99387c7ff 100644 --- a/src/world/area_kzn/kzn_09.c +++ b/src/world/area_kzn/kzn_09.c @@ -86,7 +86,7 @@ INCLUDE_ASM(s32, "world/area_kzn/kzn_09", func_80242D58); INCLUDE_ASM(s32, "world/area_kzn/kzn_09", func_80243198_C76CE0); -INCLUDE_ASM(s32, "world/area_kzn/kzn_09", func_802431E0); +#include "world/common/AwaitPlayerNearNPC.c" INCLUDE_ASM(s32, "world/area_kzn/kzn_09", func_80243238_C76CE0); diff --git a/src/world/area_kzn/kzn_17.c b/src/world/area_kzn/kzn_17.c index 6b83a929bb..1902349856 100644 --- a/src/world/area_kzn/kzn_17.c +++ b/src/world/area_kzn/kzn_17.c @@ -46,7 +46,7 @@ INCLUDE_ASM(s32, "world/area_kzn/kzn_17", func_80242048); INCLUDE_ASM(s32, "world/area_kzn/kzn_17", func_80242488_C85AB0); -INCLUDE_ASM(s32, "world/area_kzn/kzn_17", func_802424D0); +#include "world/common/AwaitPlayerNearNPC.c" INCLUDE_ASM(s32, "world/area_kzn/kzn_17", func_80242528_C85AB0); diff --git a/src/world/area_tik/tik_12.c b/src/world/area_tik/tik_12.c index de6b7766e2..00546c5213 100644 --- a/src/world/area_tik/tik_12.c +++ b/src/world/area_tik/tik_12.c @@ -74,6 +74,6 @@ INCLUDE_ASM(s32, "world/area_tik/tik_12", func_80241CF4); INCLUDE_ASM(s32, "world/area_tik/tik_12", func_80242134); -INCLUDE_ASM(s32, "world/area_tik/tik_12", func_8024217C); +#include "world/common/AwaitPlayerNearNPC.c" INCLUDE_ASM(s32, "world/area_tik/tik_12", func_802421D4); diff --git a/src/world/common/AwaitPlayerNearNPC.c b/src/world/common/AwaitPlayerNearNPC.c new file mode 100644 index 0000000000..77426813fa --- /dev/null +++ b/src/world/common/AwaitPlayerNearNPC.c @@ -0,0 +1,11 @@ +#include "common.h" + +static ApiStatus AwaitPlayerNearNPC(ScriptInstance* script, s32 isInitialCall) { + PlayerStatus* playerStatus = PLAYER_STATUS; + Npc* npc = get_npc_safe(script->ownerID); + + if (dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z) < 50.0f) { + return ApiStatus_DONE2; + } + return ApiStatus_BLOCK; +}