diff --git a/Makefile b/Makefile index 483344a684..af2187bd6f 100644 --- a/Makefile +++ b/Makefile @@ -128,7 +128,7 @@ setup: clean submodules tools split $(LD_SCRIPT) # tools/star-rod submodule intentionally omitted submodules: git submodule init tools/n64splat - git submodule update --init --recursive + git submodule update --recursive split: $(SPLAT) --modes ld bin Yay0 PaperMarioMapFS PaperMarioMessages img PaperMarioNpcSprites --new diff --git a/asm/nonmatchings/code_1f580_len_1940/func_80045900.s b/asm/nonmatchings/code_1f580_len_1940/func_80045900.s deleted file mode 100644 index 136b00433c..0000000000 --- a/asm/nonmatchings/code_1f580_len_1940/func_80045900.s +++ /dev/null @@ -1,94 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80045900 -/* 20D00 80045900 27BDFFB0 */ addiu $sp, $sp, -0x50 -/* 20D04 80045904 AFB00040 */ sw $s0, 0x40($sp) -/* 20D08 80045908 0080802D */ daddu $s0, $a0, $zero -/* 20D0C 8004590C AFBF0048 */ sw $ra, 0x48($sp) -/* 20D10 80045910 AFB10044 */ sw $s1, 0x44($sp) -/* 20D14 80045914 8E110148 */ lw $s1, 0x148($s0) -/* 20D18 80045918 0C00EABB */ jal get_npc_unsafe -/* 20D1C 8004591C 86240008 */ lh $a0, 8($s1) -/* 20D20 80045920 8E03000C */ lw $v1, 0xc($s0) -/* 20D24 80045924 0200202D */ daddu $a0, $s0, $zero -/* 20D28 80045928 8C650000 */ lw $a1, ($v1) -/* 20D2C 8004592C 0C0B1EAF */ jal get_variable -/* 20D30 80045930 0040802D */ daddu $s0, $v0, $zero -/* 20D34 80045934 8E2300B0 */ lw $v1, 0xb0($s1) -/* 20D38 80045938 34630004 */ ori $v1, $v1, 4 -/* 20D3C 8004593C 14400040 */ bnez $v0, .L80045A40 -/* 20D40 80045940 AE2300B0 */ sw $v1, 0xb0($s1) -/* 20D44 80045944 30620010 */ andi $v0, $v1, 0x10 -/* 20D48 80045948 14400004 */ bnez $v0, .L8004595C -/* 20D4C 8004594C 00000000 */ nop -/* 20D50 80045950 8E2200CC */ lw $v0, 0xcc($s1) -/* 20D54 80045954 8C420000 */ lw $v0, ($v0) -/* 20D58 80045958 AE020028 */ sw $v0, 0x28($s0) -.L8004595C: -/* 20D5C 8004595C 8E2200B0 */ lw $v0, 0xb0($s1) -/* 20D60 80045960 30420008 */ andi $v0, $v0, 8 -/* 20D64 80045964 14400015 */ bnez $v0, .L800459BC -/* 20D68 80045968 24040002 */ addiu $a0, $zero, 2 -/* 20D6C 8004596C 0200282D */ daddu $a1, $s0, $zero -/* 20D70 80045970 860300A8 */ lh $v1, 0xa8($s0) -/* 20D74 80045974 44800000 */ mtc1 $zero, $f0 -/* 20D78 80045978 3C01C1A0 */ lui $at, 0xc1a0 -/* 20D7C 8004597C 44811000 */ mtc1 $at, $f2 -/* 20D80 80045980 24020028 */ addiu $v0, $zero, 0x28 -/* 20D84 80045984 AFA2001C */ sw $v0, 0x1c($sp) -/* 20D88 80045988 44834000 */ mtc1 $v1, $f8 -/* 20D8C 8004598C 00000000 */ nop -/* 20D90 80045990 46804220 */ cvt.s.w $f8, $f8 -/* 20D94 80045994 44060000 */ mfc1 $a2, $f0 -/* 20D98 80045998 3C013F80 */ lui $at, 0x3f80 -/* 20D9C 8004599C 44810000 */ mtc1 $at, $f0 -/* 20DA0 800459A0 44074000 */ mfc1 $a3, $f8 -/* 20DA4 800459A4 03A21021 */ addu $v0, $sp, $v0 -/* 20DA8 800459A8 AFA20020 */ sw $v0, 0x20($sp) -/* 20DAC 800459AC E7A20018 */ swc1 $f2, 0x18($sp) -/* 20DB0 800459B0 E7A00010 */ swc1 $f0, 0x10($sp) -/* 20DB4 800459B4 0C01BFA4 */ jal fx_emote -/* 20DB8 800459B8 AFA60014 */ sw $a2, 0x14($sp) -.L800459BC: -/* 20DBC 800459BC 8E020000 */ lw $v0, ($s0) -/* 20DC0 800459C0 24030808 */ addiu $v1, $zero, 0x808 -/* 20DC4 800459C4 30420A08 */ andi $v0, $v0, 0xa08 -/* 20DC8 800459C8 1443001D */ bne $v0, $v1, .L80045A40 -/* 20DCC 800459CC 27A5002C */ addiu $a1, $sp, 0x2c -/* 20DD0 800459D0 27A60030 */ addiu $a2, $sp, 0x30 -/* 20DD4 800459D4 C6000038 */ lwc1 $f0, 0x38($s0) -/* 20DD8 800459D8 860200A8 */ lh $v0, 0xa8($s0) -/* 20DDC 800459DC 3C0142C8 */ lui $at, 0x42c8 -/* 20DE0 800459E0 44812000 */ mtc1 $at, $f4 -/* 20DE4 800459E4 44823000 */ mtc1 $v0, $f6 -/* 20DE8 800459E8 00000000 */ nop -/* 20DEC 800459EC 468031A0 */ cvt.s.w $f6, $f6 -/* 20DF0 800459F0 27A20038 */ addiu $v0, $sp, 0x38 -/* 20DF4 800459F4 E7A0002C */ swc1 $f0, 0x2c($sp) -/* 20DF8 800459F8 C600003C */ lwc1 $f0, 0x3c($s0) -/* 20DFC 800459FC C6020040 */ lwc1 $f2, 0x40($s0) -/* 20E00 80045A00 46060000 */ add.s $f0, $f0, $f6 -/* 20E04 80045A04 E7A40038 */ swc1 $f4, 0x38($sp) -/* 20E08 80045A08 E7A20034 */ swc1 $f2, 0x34($sp) -/* 20E0C 80045A0C E7A00030 */ swc1 $f0, 0x30($sp) -/* 20E10 80045A10 AFA20010 */ sw $v0, 0x10($sp) -/* 20E14 80045A14 8E040080 */ lw $a0, 0x80($s0) -/* 20E18 80045A18 0C0372DF */ jal func_800DCB7C -/* 20E1C 80045A1C 27A70034 */ addiu $a3, $sp, 0x34 -/* 20E20 80045A20 10400003 */ beqz $v0, .L80045A30 -/* 20E24 80045A24 00000000 */ nop -/* 20E28 80045A28 C7A00030 */ lwc1 $f0, 0x30($sp) -/* 20E2C 80045A2C E600003C */ swc1 $f0, 0x3c($s0) -.L80045A30: -/* 20E30 80045A30 8E020000 */ lw $v0, ($s0) -/* 20E34 80045A34 2403F7FF */ addiu $v1, $zero, -0x801 -/* 20E38 80045A38 00431024 */ and $v0, $v0, $v1 -/* 20E3C 80045A3C AE020000 */ sw $v0, ($s0) -.L80045A40: -/* 20E40 80045A40 8FBF0048 */ lw $ra, 0x48($sp) -/* 20E44 80045A44 8FB10044 */ lw $s1, 0x44($sp) -/* 20E48 80045A48 8FB00040 */ lw $s0, 0x40($sp) -/* 20E4C 80045A4C 24020002 */ addiu $v0, $zero, 2 -/* 20E50 80045A50 03E00008 */ jr $ra -/* 20E54 80045A54 27BD0050 */ addiu $sp, $sp, 0x50 diff --git a/include/functions.h b/include/functions.h index 48df6e1cbb..79ba43bfc9 100644 --- a/include/functions.h +++ b/include/functions.h @@ -77,7 +77,7 @@ void set_curtain_scale_goal(f32 scale); void set_curtain_fade(f32 scale); void fx_walk_normal(s32 arg0, f32 arg1, f32 arg2, f32 arg3, s32 arg4, s32 arg5); -void fx_emote(s32, Npc*, s32, f32, f32, f32, f32, s32, s32*); +void fx_emote(s32, Npc*, f32, f32, f32, f32, f32, s32, s32*); f32 func_800E0088(f32, f32); void func_800E97B8(void); @@ -90,6 +90,8 @@ PlayerData* get_player_data(void); s32 pause_interp_vertical_scroll(s32 deltaBefore); void pause_draw_rect(s32 ulx, s32 uly, s32 lrx, s32 lry, s32 tileDescriptor, s32 uls, s32 ult, s32 dsdx, s32 dtdy); +s32 func_800DCB7C(s32, f32*, f32*, f32*, f32*); + // Partner void func_800EBA3C(Npc* partner); void func_800EBB40(Npc* partner); diff --git a/src/code_1f580_len_1940.c b/src/code_1f580_len_1940.c index 513b11e991..60522e416e 100644 --- a/src/code_1f580_len_1940.c +++ b/src/code_1f580_len_1940.c @@ -84,11 +84,11 @@ ApiStatus GetOwnerEncounterTrigger(ScriptInstance* script, s32 isInitialCall) { ApiStatus DoNpcDefeat(ScriptInstance* script, s32 isInitialCall) { Enemy* owner = script->owner1.enemy; - Npc* temp_s1 = get_npc_unsafe(owner->npcID); + Npc* npc = get_npc_unsafe(owner->npcID); ScriptInstance* newScript; kill_script(script); - temp_s1->currentAnim = owner->animList[6]; + npc->currentAnim = owner->animList[6]; newScript = start_script(&SCRIPT_NpcDefeat, 10, 0); owner->defeatScript = newScript; owner->defeatScriptID = newScript->id; @@ -523,8 +523,6 @@ ApiStatus func_800458CC(ScriptInstance* script, s32 isInitialCall) { return ApiStatus_DONE2; } -// comments inline, WIP -#ifdef NON_MATCHIING ApiStatus func_80045900(ScriptInstance* script) { Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); @@ -533,26 +531,24 @@ ApiStatus func_80045900(ScriptInstance* script) { enemy->unk_B0 |= 4; if (var0 == 0) { - // idk what these are supposed to be - f32 subroutine_argE; - f32 subroutine_argD; - f32 subroutine_argC; - f32 subroutine_argB; - s32 subroutine_argA; + s32 unk; if (!(enemy->unk_B0 & 0x10)) { npc->currentAnim = *enemy->animList; } if (!(enemy->unk_B0 & 0x8)) { - fx_emote(2, npc, 0, npc->collisionHeight, 1.0f, 0.0f, -20.0f, 40, &subroutine_argA); + fx_emote(2, npc, 0.0f, npc->collisionHeight, 1.0f, 0.0f, -20.0f, 40, &unk); } if ((npc->flags & 0xA08) == 0x808) { - // function decl needed - if (func_800DCB7C(npc->unk_80, &subroutine_argB, &subroutine_argC, &subroutine_argD, &subroutine_argE, npc->pos.x, - npc->pos.y + npc->collisionHeight, npc->pos.z, 100.0f) != 0) { - npc->pos.y = subroutine_argC; + f32 x = npc->pos.x; + f32 y = npc->pos.y + npc->collisionHeight; + f32 z = npc->pos.z; + f32 a = 100.0f; + + if (func_800DCB7C(npc->unk_80, &x, &y, &z, &a) != 0) { + npc->pos.y = y; } npc->flags &= ~0x800; } @@ -560,9 +556,6 @@ ApiStatus func_80045900(ScriptInstance* script) { return ApiStatus_DONE2; } -#else -INCLUDE_ASM(s32, "code_1f580_len_1940", func_80045900); -#endif ApiStatus SetTattleString(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; diff --git a/src/code_759b0_len_61b0.c b/src/code_759b0_len_61b0.c index 2f827e8efb..10be5f6775 100644 --- a/src/code_759b0_len_61b0.c +++ b/src/code_759b0_len_61b0.c @@ -4,7 +4,7 @@ INCLUDE_ASM(s32, "code_759b0_len_61b0", func_800DC500); INCLUDE_ASM(s32, "code_759b0_len_61b0", func_800DC778); -INCLUDE_ASM(s32, "code_759b0_len_61b0", func_800DCB7C); +INCLUDE_ASM(s32, "code_759b0_len_61b0", func_800DCB7C, s32 arg0, f32* arg1, f32* arg2, f32* arg3, f32* arg4); INCLUDE_ASM(s32, "code_759b0_len_61b0", func_800DCE70); diff --git a/src/os/code_4ac90_len_3910.c b/src/os/code_4ac90_len_3910.c index 0e74612759..e5df490a49 100644 --- a/src/os/code_4ac90_len_3910.c +++ b/src/os/code_4ac90_len_3910.c @@ -32,7 +32,7 @@ INCLUDE_ASM(s32, "os/code_4ac90_len_3910", func_8006FDD0); INCLUDE_ASM(s32, "os/code_4ac90_len_3910", func_8006FE30); -INCLUDE_ASM(void, "os/code_4ac90_len_3910", fx_emote, s32 arg0, Npc* arg1, s32 arg2, f32 arg3, f32 arg4, f32 arg5, +INCLUDE_ASM(void, "os/code_4ac90_len_3910", fx_emote, s32 arg0, Npc* arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, s32 arg7, s32* arg8); INCLUDE_ASM(void, "os/code_4ac90_len_3910", func_8006FEF0, s32 a0, f32 a1, f32 a2, f32 a3, f32 a4); diff --git a/src/world/common/UnkNpcAIFunc11.inc.c b/src/world/common/UnkNpcAIFunc11.inc.c index 250c081824..9abc9378ce 100644 --- a/src/world/common/UnkNpcAIFunc11.inc.c +++ b/src/world/common/UnkNpcAIFunc11.inc.c @@ -8,7 +8,7 @@ static void UnkNpcAIFunc11(ScriptInstance* script, NpcAISettings* aiSettings, s3 if (func_800490B4(arg2, enemy, aiSettings->chaseSpeed, aiSettings->unk_1C, 1) == 0) { s32* something; - fx_emote(2, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &something); + fx_emote(2, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &something); npc->currentAnim = enemy->animList[0]; npc->duration = 25; script->functionTemp[0].s = 14; diff --git a/src/world/common/UnkNpcAIFunc8.inc.c b/src/world/common/UnkNpcAIFunc8.inc.c index d79df68192..6bb7eb9049 100644 --- a/src/world/common/UnkNpcAIFunc8.inc.c +++ b/src/world/common/UnkNpcAIFunc8.inc.c @@ -13,7 +13,7 @@ static void UnkNpcAIFunc8(ScriptInstance* script) { if (enemy->varTable[3] >= 8) { s32 something; - fx_emote(3, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, enemy->varTable[3] - 1, &something); + fx_emote(3, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, enemy->varTable[3] - 1, &something); } script->functionTemp[0].s = 33; }