From 37856b1b54548b07f4dbac58f0c57b431bfd0319 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Sun, 18 Oct 2020 19:27:14 -0400 Subject: [PATCH] :star: --- .../code_16F740/func_80246B2C_16C8E0.s | 6 --- .../code_16F740/pause_cleanup_16C8E0.s | 6 --- .../code_325070/func_802BD100_325070.s | 8 ---- asm/nonmatchings/code_325070/func_802BD110.s | 19 -------- .../code_325070/func_802BD148_325070.s | 29 ------------ asm/nonmatchings/code_325070/func_802BD1A8.s | 6 --- asm/nonmatchings/code_325070/func_802BD1B0.s | 21 --------- .../code_E21870/func_802B7000_E21870.s | 25 ----------- include/functions.h | 5 +++ src/code_325070.c | 11 ----- src/code_838b0_len_5900.c | 6 +-- src/world_twink.c | 44 +++++++++++++++++++ tools/splat.yaml | 2 +- 13 files changed, 53 insertions(+), 135 deletions(-) delete mode 100644 asm/nonmatchings/code_16F740/func_80246B2C_16C8E0.s delete mode 100644 asm/nonmatchings/code_16F740/pause_cleanup_16C8E0.s delete mode 100644 asm/nonmatchings/code_325070/func_802BD100_325070.s delete mode 100644 asm/nonmatchings/code_325070/func_802BD110.s delete mode 100644 asm/nonmatchings/code_325070/func_802BD148_325070.s delete mode 100644 asm/nonmatchings/code_325070/func_802BD1A8.s delete mode 100644 asm/nonmatchings/code_325070/func_802BD1B0.s delete mode 100644 asm/nonmatchings/code_E21870/func_802B7000_E21870.s delete mode 100644 src/code_325070.c create mode 100644 src/world_twink.c diff --git a/asm/nonmatchings/code_16F740/func_80246B2C_16C8E0.s b/asm/nonmatchings/code_16F740/func_80246B2C_16C8E0.s deleted file mode 100644 index 66860a6696..0000000000 --- a/asm/nonmatchings/code_16F740/func_80246B2C_16C8E0.s +++ /dev/null @@ -1,6 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80246B2C_16C8E0 -/* 17540C 80246B2C 03E00008 */ jr $ra -/* 175410 80246B30 00000000 */ nop diff --git a/asm/nonmatchings/code_16F740/pause_cleanup_16C8E0.s b/asm/nonmatchings/code_16F740/pause_cleanup_16C8E0.s deleted file mode 100644 index f7312b06bb..0000000000 --- a/asm/nonmatchings/code_16F740/pause_cleanup_16C8E0.s +++ /dev/null @@ -1,6 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel pause_cleanup_16C8E0 -/* 172FE8 80244708 03E00008 */ jr $ra -/* 172FEC 8024470C 00000000 */ nop diff --git a/asm/nonmatchings/code_325070/func_802BD100_325070.s b/asm/nonmatchings/code_325070/func_802BD100_325070.s deleted file mode 100644 index cccff73b5e..0000000000 --- a/asm/nonmatchings/code_325070/func_802BD100_325070.s +++ /dev/null @@ -1,8 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802BD100_325070 -/* 325070 802BD100 24020014 */ addiu $v0, $zero, 0x14 -/* 325074 802BD104 A48200A8 */ sh $v0, 0xa8($a0) -/* 325078 802BD108 03E00008 */ jr $ra -/* 32507C 802BD10C A48200A6 */ sh $v0, 0xa6($a0) diff --git a/asm/nonmatchings/code_325070/func_802BD110.s b/asm/nonmatchings/code_325070/func_802BD110.s deleted file mode 100644 index f0ee911ea6..0000000000 --- a/asm/nonmatchings/code_325070/func_802BD110.s +++ /dev/null @@ -1,19 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802BD110 -/* 325080 802BD110 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 325084 802BD114 AFBF0014 */ sw $ra, 0x14($sp) -/* 325088 802BD118 AFB00010 */ sw $s0, 0x10($sp) -/* 32508C 802BD11C 10A00003 */ beqz $a1, .L802BD12C -/* 325090 802BD120 8C90014C */ lw $s0, 0x14c($a0) -/* 325094 802BD124 0C03BB31 */ jal func_800EECC4 -/* 325098 802BD128 0200202D */ daddu $a0, $s0, $zero -.L802BD12C: -/* 32509C 802BD12C 0C03BB3A */ jal func_800EECE8 -/* 3250A0 802BD130 0200202D */ daddu $a0, $s0, $zero -/* 3250A4 802BD134 8FBF0014 */ lw $ra, 0x14($sp) -/* 3250A8 802BD138 8FB00010 */ lw $s0, 0x10($sp) -/* 3250AC 802BD13C 0002102B */ sltu $v0, $zero, $v0 -/* 3250B0 802BD140 03E00008 */ jr $ra -/* 3250B4 802BD144 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/code_325070/func_802BD148_325070.s b/asm/nonmatchings/code_325070/func_802BD148_325070.s deleted file mode 100644 index fa75507479..0000000000 --- a/asm/nonmatchings/code_325070/func_802BD148_325070.s +++ /dev/null @@ -1,29 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802BD148_325070 -/* 3250B8 802BD148 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 3250BC 802BD14C AFB10014 */ sw $s1, 0x14($sp) -/* 3250C0 802BD150 3C118011 */ lui $s1, %hi(gPlayerData) -/* 3250C4 802BD154 2631F290 */ addiu $s1, $s1, %lo(gPlayerData) -/* 3250C8 802BD158 AFBF0018 */ sw $ra, 0x18($sp) -/* 3250CC 802BD15C AFB00010 */ sw $s0, 0x10($sp) -/* 3250D0 802BD160 8C90014C */ lw $s0, 0x14c($a0) -/* 3250D4 802BD164 10A00003 */ beqz $a1, .L802BD174 -/* 3250D8 802BD168 0200202D */ daddu $a0, $s0, $zero -/* 3250DC 802BD16C 0C03B4C4 */ jal enable_partner_flying -/* 3250E0 802BD170 24050001 */ addiu $a1, $zero, 1 -.L802BD174: -/* 3250E4 802BD174 0C03B52E */ jal update_player_move_history -/* 3250E8 802BD178 0200202D */ daddu $a0, $s0, $zero -/* 3250EC 802BD17C 0C03B574 */ jal func_800ED5D0 -/* 3250F0 802BD180 0200202D */ daddu $a0, $s0, $zero -/* 3250F4 802BD184 8E220320 */ lw $v0, 0x320($s1) -/* 3250F8 802BD188 24420001 */ addiu $v0, $v0, 1 -/* 3250FC 802BD18C AE220320 */ sw $v0, 0x320($s1) -/* 325100 802BD190 8FBF0018 */ lw $ra, 0x18($sp) -/* 325104 802BD194 8FB10014 */ lw $s1, 0x14($sp) -/* 325108 802BD198 8FB00010 */ lw $s0, 0x10($sp) -/* 32510C 802BD19C 0000102D */ daddu $v0, $zero, $zero -/* 325110 802BD1A0 03E00008 */ jr $ra -/* 325114 802BD1A4 27BD0020 */ addiu $sp, $sp, 0x20 diff --git a/asm/nonmatchings/code_325070/func_802BD1A8.s b/asm/nonmatchings/code_325070/func_802BD1A8.s deleted file mode 100644 index 5b20d7110d..0000000000 --- a/asm/nonmatchings/code_325070/func_802BD1A8.s +++ /dev/null @@ -1,6 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802BD1A8 -/* 325118 802BD1A8 03E00008 */ jr $ra -/* 32511C 802BD1AC 24020002 */ addiu $v0, $zero, 2 diff --git a/asm/nonmatchings/code_325070/func_802BD1B0.s b/asm/nonmatchings/code_325070/func_802BD1B0.s deleted file mode 100644 index 0810ce5340..0000000000 --- a/asm/nonmatchings/code_325070/func_802BD1B0.s +++ /dev/null @@ -1,21 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802BD1B0 -/* 325120 802BD1B0 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 325124 802BD1B4 AFBF0014 */ sw $ra, 0x14($sp) -/* 325128 802BD1B8 AFB00010 */ sw $s0, 0x10($sp) -/* 32512C 802BD1BC 10A00003 */ beqz $a1, .L802BD1CC -/* 325130 802BD1C0 8C90014C */ lw $s0, 0x14c($a0) -/* 325134 802BD1C4 0C03BA65 */ jal func_800EE994 -/* 325138 802BD1C8 0200202D */ daddu $a0, $s0, $zero -.L802BD1CC: -/* 32513C 802BD1CC 0C03BA6E */ jal func_800EE9B8 -/* 325140 802BD1D0 0200202D */ daddu $a0, $s0, $zero -/* 325144 802BD1D4 8FBF0014 */ lw $ra, 0x14($sp) -/* 325148 802BD1D8 8FB00010 */ lw $s0, 0x10($sp) -/* 32514C 802BD1DC 0002102B */ sltu $v0, $zero, $v0 -/* 325150 802BD1E0 03E00008 */ jr $ra -/* 325154 802BD1E4 27BD0018 */ addiu $sp, $sp, 0x18 -/* 325158 802BD1E8 00000000 */ nop -/* 32515C 802BD1EC 00000000 */ nop diff --git a/asm/nonmatchings/code_E21870/func_802B7000_E21870.s b/asm/nonmatchings/code_E21870/func_802B7000_E21870.s deleted file mode 100644 index bd248070da..0000000000 --- a/asm/nonmatchings/code_E21870/func_802B7000_E21870.s +++ /dev/null @@ -1,25 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_802B7000_E21870 -/* E21870 802B7000 3C048011 */ lui $a0, %hi(D_8010EBB0) -/* E21874 802B7004 2484EBB0 */ addiu $a0, $a0, %lo(D_8010EBB0) -/* E21878 802B7008 3C038011 */ lui $v1, %hi(gPlayerActionState) -/* E2187C 802B700C 8063F07C */ lb $v1, %lo(gPlayerActionState)($v1) -/* E21880 802B7010 2402001F */ addiu $v0, $zero, 0x1f -/* E21884 802B7014 1062000B */ beq $v1, $v0, .L802B7044 -/* E21888 802B7018 24020001 */ addiu $v0, $zero, 1 -/* E2188C 802B701C 80830000 */ lb $v1, ($a0) -/* E21890 802B7020 14620006 */ bne $v1, $v0, .L802B703C -/* E21894 802B7024 24020009 */ addiu $v0, $zero, 9 -/* E21898 802B7028 80830003 */ lb $v1, 3($a0) -/* E2189C 802B702C 10620005 */ beq $v1, $v0, .L802B7044 -/* E218A0 802B7030 24020004 */ addiu $v0, $zero, 4 -/* E218A4 802B7034 10620003 */ beq $v1, $v0, .L802B7044 -/* E218A8 802B7038 00000000 */ nop -.L802B703C: -/* E218AC 802B703C 03E00008 */ jr $ra -/* E218B0 802B7040 0000102D */ daddu $v0, $zero, $zero -.L802B7044: -/* E218B4 802B7044 03E00008 */ jr $ra -/* E218B8 802B7048 24020001 */ addiu $v0, $zero, 1 diff --git a/include/functions.h b/include/functions.h index aa88864b26..7775116e67 100644 --- a/include/functions.h +++ b/include/functions.h @@ -61,6 +61,11 @@ s32 func_800554E8(s32, s32); s32 func_800555E4(s32); s32 osGetId(); +// Partner +void enable_partner_flying(Npc* partner, s32 isFlying); +void update_player_move_history(Npc* partner); +void func_800ED5D0(Npc* partner); + s32 func_800EF394(f32); s32 does_script_exist(s32 id); ScriptInstance* start_script(Bytecode* initialLine, s32 priority, s32 initialState); diff --git a/src/code_325070.c b/src/code_325070.c deleted file mode 100644 index a7f4f7a986..0000000000 --- a/src/code_325070.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "common.h" - -INCLUDE_ASM(s32, "code_325070", func_802BD100_325070); - -INCLUDE_ASM(s32, "code_325070", func_802BD110); - -INCLUDE_ASM(s32, "code_325070", func_802BD148_325070); - -INCLUDE_ASM(s32, "code_325070", func_802BD1A8); - -INCLUDE_ASM(s32, "code_325070", func_802BD1B0); diff --git a/src/code_838b0_len_5900.c b/src/code_838b0_len_5900.c index cd1f1be158..b47e59c015 100644 --- a/src/code_838b0_len_5900.c +++ b/src/code_838b0_len_5900.c @@ -65,11 +65,11 @@ INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EBB40); INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EBC74); -INCLUDE_ASM(s32, "code_838b0_len_5900", enable_partner_flying); +INCLUDE_ASM(void, "code_838b0_len_5900", enable_partner_flying, Npc* partner, s32 isFlying); -INCLUDE_ASM(s32, "code_838b0_len_5900", update_player_move_history); +INCLUDE_ASM(void, "code_838b0_len_5900", update_player_move_history, Npc* partner); -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800ED5D0); +INCLUDE_ASM(void, "code_838b0_len_5900", func_800ED5D0, Npc* partner); INCLUDE_ASM(s32, "code_838b0_len_5900", func_800ED9F8); diff --git a/src/world_twink.c b/src/world_twink.c new file mode 100644 index 0000000000..a4bd2a24cb --- /dev/null +++ b/src/world_twink.c @@ -0,0 +1,44 @@ +#include "common.h" + +// Init +void func_802BD100_325070(Npc* npc) { + npc->collisionHeight = 20; + npc->collisionRadius = 20; +} + +ApiStatus func_802BD110(ScriptInstance* script, s32 isInitialCall) { + s32 ownerID = script->ownerID; + + if (isInitialCall) { + func_800EECC4(ownerID); + } + return func_800EECE8(ownerID) != 0; +} + +ApiStatus func_802BD148_325070(ScriptInstance* script, s32 isInitialCall) { + PlayerData* playerData = &gPlayerData; + s32 ownerID = script->ownerID; + + if (isInitialCall) { + enable_partner_flying(ownerID, TRUE); + } + + update_player_move_history(ownerID); + func_800ED5D0(ownerID); + playerData->unk_2F4[11]++; + + return ApiStatus_BLOCK; +} + +ApiStatus func_802BD1A8(ScriptInstance* script, s32 isInitialCall) { + return ApiStatus_DONE2; +} + +ApiStatus func_802BD1B0(ScriptInstance* script, s32 isInitialCall) { + s32 ownerID = script->ownerID; + + if (isInitialCall) { + func_800EE994(ownerID); + } + return func_800EE9B8(ownerID) != 0; +} diff --git a/tools/splat.yaml b/tools/splat.yaml index b226e66e73..9b4300cc15 100644 --- a/tools/splat.yaml +++ b/tools/splat.yaml @@ -414,7 +414,7 @@ segments: start: 0x325070 vram: 0x802BD100 files: - - [0x325070, "c"] + - [0x325070, "c", "world_twink"] - [0x325160, "bin"] - name: code type: code