From 3a2f17b91d8fd581f694e64ffe674da8682a148d Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Thu, 19 Nov 2020 19:41:49 -0500 Subject: [PATCH] a few more --- asm/nonmatchings/code_181810/ActorSpeak.s | 38 ++-- asm/nonmatchings/code_181810/EndActorSpeech.s | 24 +-- .../code_197F40/SetActorIdleJumpGravity.s | 2 +- .../code_197F40/SetActorIdleSpeed.s | 2 +- asm/nonmatchings/code_197F40/SetGoalPos.s | 82 -------- .../code_197F40/SetGoalToFirstTarget.s | 34 ---- asm/nonmatchings/code_197F40/SetIdleGoal.s | 82 -------- .../code_197F40/SetPartGoalToTarget.s | 43 ---- include/common_structs.h | 12 +- include/enums.h | 56 +++--- src/code_181810.c | 6 +- src/code_197F40.c | 185 +++++++++++++++--- src/code_1A5830.c | 92 ++++----- src/code_1AC760.c | 4 +- 14 files changed, 275 insertions(+), 387 deletions(-) delete mode 100644 asm/nonmatchings/code_197F40/SetGoalPos.s delete mode 100644 asm/nonmatchings/code_197F40/SetGoalToFirstTarget.s delete mode 100644 asm/nonmatchings/code_197F40/SetIdleGoal.s delete mode 100644 asm/nonmatchings/code_197F40/SetPartGoalToTarget.s diff --git a/asm/nonmatchings/code_181810/ActorSpeak.s b/asm/nonmatchings/code_181810/ActorSpeak.s index 663721bebb..4aef8a79f6 100644 --- a/asm/nonmatchings/code_181810/ActorSpeak.s +++ b/asm/nonmatchings/code_181810/ActorSpeak.s @@ -39,7 +39,7 @@ glabel ActorSpeak /* 181898 80252FB8 AC22FA70 */ sw $v0, %lo(gSpeakingActorIdleAnim)($at) /* 18189C 80252FBC 2402FF81 */ addiu $v0, $zero, -0x7f /* 1818A0 80252FC0 16420002 */ bne $s2, $v0, .L80252FCC -/* 1818A4 80252FC4 00000000 */ nop +/* 1818A4 80252FC4 00000000 */ nop /* 1818A8 80252FC8 8E720148 */ lw $s2, 0x148($s3) .L80252FCC: /* 1818AC 80252FCC 0C09A75B */ jal get_actor @@ -57,7 +57,7 @@ glabel ActorSpeak /* 1818DC 80252FFC 3C01802A */ lui $at, %hi(gSpeakingActorPart) /* 1818E0 80253000 AC32FA78 */ sw $s2, %lo(gSpeakingActorPart)($at) /* 1818E4 80253004 44831000 */ mtc1 $v1, $f2 -/* 1818E8 80253008 00000000 */ nop +/* 1818E8 80253008 00000000 */ nop /* 1818EC 8025300C 468010A0 */ cvt.s.w $f2, $f2 /* 1818F0 80253010 30428000 */ andi $v0, $v0, 0x8000 /* 1818F4 80253014 1440000D */ bnez $v0, .L8025304C @@ -65,12 +65,12 @@ glabel ActorSpeak /* 1818FC 8025301C 86220152 */ lh $v0, 0x152($s1) /* 181900 80253020 C6200148 */ lwc1 $f0, 0x148($s1) /* 181904 80253024 44821000 */ mtc1 $v0, $f2 -/* 181908 80253028 00000000 */ nop +/* 181908 80253028 00000000 */ nop /* 18190C 8025302C 468010A0 */ cvt.s.w $f2, $f2 /* 181910 80253030 92220191 */ lbu $v0, 0x191($s1) /* 181914 80253034 46020000 */ add.s $f0, $f0, $f2 /* 181918 80253038 44821000 */ mtc1 $v0, $f2 -/* 18191C 8025303C 00000000 */ nop +/* 18191C 8025303C 00000000 */ nop /* 181920 80253040 468010A0 */ cvt.s.w $f2, $f2 /* 181924 80253044 08094C1F */ j .L8025307C /* 181928 80253048 46001000 */ add.s $f0, $f2, $f0 @@ -78,13 +78,13 @@ glabel ActorSpeak /* 18192C 8025304C 86220152 */ lh $v0, 0x152($s1) /* 181930 80253050 C6220148 */ lwc1 $f2, 0x148($s1) /* 181934 80253054 44820000 */ mtc1 $v0, $f0 -/* 181938 80253058 00000000 */ nop +/* 181938 80253058 00000000 */ nop /* 18193C 8025305C 46800020 */ cvt.s.w $f0, $f0 /* 181940 80253060 92220191 */ lbu $v0, 0x191($s1) /* 181944 80253064 46001080 */ add.s $f2, $f2, $f0 /* 181948 80253068 00021042 */ srl $v0, $v0, 1 /* 18194C 8025306C 44820000 */ mtc1 $v0, $f0 -/* 181950 80253070 00000000 */ nop +/* 181950 80253070 00000000 */ nop /* 181954 80253074 46800020 */ cvt.s.w $f0, $f0 /* 181958 80253078 46001000 */ add.s $f0, $f2, $f0 .L8025307C: @@ -96,7 +96,7 @@ glabel ActorSpeak /* 181970 80253090 27A20020 */ addiu $v0, $sp, 0x20 /* 181974 80253094 AFA20010 */ sw $v0, 0x10($sp) /* 181978 80253098 44830000 */ mtc1 $v1, $f0 -/* 18197C 8025309C 00000000 */ nop +/* 18197C 8025309C 00000000 */ nop /* 181980 802530A0 46800020 */ cvt.s.w $f0, $f0 /* 181984 802530A4 46001080 */ add.s $f2, $f2, $f0 /* 181988 802530A8 27A20024 */ addiu $v0, $sp, 0x24 @@ -116,7 +116,7 @@ glabel ActorSpeak /* 1819C0 802530E0 3C01802A */ lui $at, %hi(gSpeakingActorPrintCtx) /* 1819C4 802530E4 AC24FA60 */ sw $a0, %lo(gSpeakingActorPrintCtx)($at) /* 1819C8 802530E8 0C0496AE */ jal clamp_printer_coords -/* 1819CC 802530EC 00000000 */ nop +/* 1819CC 802530EC 00000000 */ nop /* 1819D0 802530F0 3C03800A */ lui $v1, %hi(D_8009A650) /* 1819D4 802530F4 2463A650 */ addiu $v1, $v1, %lo(D_8009A650) /* 1819D8 802530F8 AE600070 */ sw $zero, 0x70($s3) @@ -131,7 +131,7 @@ glabel ActorSpeak /* 1819FC 8025311C 0240282D */ daddu $a1, $s2, $zero .L80253120: /* 181A00 80253120 0C03A6D5 */ jal increment_status_menu_disabled -/* 181A04 80253124 00000000 */ nop +/* 181A04 80253124 00000000 */ nop .L80253128: /* 181A08 80253128 8E620070 */ lw $v0, 0x70($s3) /* 181A0C 8025312C 14400060 */ bnez $v0, .L802532B0 @@ -143,7 +143,7 @@ glabel ActorSpeak /* 181A24 80253144 86220150 */ lh $v0, 0x150($s1) /* 181A28 80253148 C6200144 */ lwc1 $f0, 0x144($s1) /* 181A2C 8025314C 44821000 */ mtc1 $v0, $f2 -/* 181A30 80253150 00000000 */ nop +/* 181A30 80253150 00000000 */ nop /* 181A34 80253154 468010A0 */ cvt.s.w $f2, $f2 /* 181A38 80253158 8E220000 */ lw $v0, ($s1) /* 181A3C 8025315C 30428000 */ andi $v0, $v0, 0x8000 @@ -152,12 +152,12 @@ glabel ActorSpeak /* 181A48 80253168 86220152 */ lh $v0, 0x152($s1) /* 181A4C 8025316C C6200148 */ lwc1 $f0, 0x148($s1) /* 181A50 80253170 44821000 */ mtc1 $v0, $f2 -/* 181A54 80253174 00000000 */ nop +/* 181A54 80253174 00000000 */ nop /* 181A58 80253178 468010A0 */ cvt.s.w $f2, $f2 /* 181A5C 8025317C 92220191 */ lbu $v0, 0x191($s1) /* 181A60 80253180 46020000 */ add.s $f0, $f0, $f2 /* 181A64 80253184 44821000 */ mtc1 $v0, $f2 -/* 181A68 80253188 00000000 */ nop +/* 181A68 80253188 00000000 */ nop /* 181A6C 8025318C 468010A0 */ cvt.s.w $f2, $f2 /* 181A70 80253190 08094C72 */ j .L802531C8 /* 181A74 80253194 46001000 */ add.s $f0, $f2, $f0 @@ -165,13 +165,13 @@ glabel ActorSpeak /* 181A78 80253198 86220152 */ lh $v0, 0x152($s1) /* 181A7C 8025319C C6220148 */ lwc1 $f2, 0x148($s1) /* 181A80 802531A0 44820000 */ mtc1 $v0, $f0 -/* 181A84 802531A4 00000000 */ nop +/* 181A84 802531A4 00000000 */ nop /* 181A88 802531A8 46800020 */ cvt.s.w $f0, $f0 /* 181A8C 802531AC 92220191 */ lbu $v0, 0x191($s1) /* 181A90 802531B0 46001080 */ add.s $f2, $f2, $f0 /* 181A94 802531B4 00021042 */ srl $v0, $v0, 1 /* 181A98 802531B8 44820000 */ mtc1 $v0, $f0 -/* 181A9C 802531BC 00000000 */ nop +/* 181A9C 802531BC 00000000 */ nop /* 181AA0 802531C0 46800020 */ cvt.s.w $f0, $f0 /* 181AA4 802531C4 46001000 */ add.s $f0, $f2, $f0 .L802531C8: @@ -183,7 +183,7 @@ glabel ActorSpeak /* 181ABC 802531DC 27A20020 */ addiu $v0, $sp, 0x20 /* 181AC0 802531E0 AFA20010 */ sw $v0, 0x10($sp) /* 181AC4 802531E4 44830000 */ mtc1 $v1, $f0 -/* 181AC8 802531E8 00000000 */ nop +/* 181AC8 802531E8 00000000 */ nop /* 181ACC 802531EC 46800020 */ cvt.s.w $f0, $f0 /* 181AD0 802531F0 46001080 */ add.s $f2, $f2, $f0 /* 181AD4 802531F4 27A20024 */ addiu $v0, $sp, 0x24 @@ -204,16 +204,16 @@ glabel ActorSpeak /* 181B10 80253230 10400005 */ beqz $v0, .L80253248 /* 181B14 80253234 30620080 */ andi $v0, $v1, 0x80 /* 181B18 80253238 0C03A6CC */ jal decrement_status_menu_disabled -/* 181B1C 8025323C 00000000 */ nop +/* 181B1C 8025323C 00000000 */ nop /* 181B20 80253240 08094CAC */ j .L802532B0 /* 181B24 80253244 24020001 */ addiu $v0, $zero, 1 .L80253248: /* 181B28 80253248 10400005 */ beqz $v0, .L80253260 -/* 181B2C 8025324C 00000000 */ nop +/* 181B2C 8025324C 00000000 */ nop /* 181B30 80253250 3C06802A */ lui $a2, %hi(gSpeakingActorTalkAnim) /* 181B34 80253254 8CC6FA6C */ lw $a2, %lo(gSpeakingActorTalkAnim)($a2) /* 181B38 80253258 08094C9A */ j .L80253268 -/* 181B3C 8025325C 00000000 */ nop +/* 181B3C 8025325C 00000000 */ nop .L80253260: /* 181B40 80253260 3C06802A */ lui $a2, %hi(gSpeakingActorIdleAnim) /* 181B44 80253264 8CC6FA70 */ lw $a2, %lo(gSpeakingActorIdleAnim)($a2) @@ -229,7 +229,7 @@ glabel ActorSpeak /* 181B64 80253284 1462000A */ bne $v1, $v0, .L802532B0 /* 181B68 80253288 0000102D */ daddu $v0, $zero, $zero /* 181B6C 8025328C 0C03A6CC */ jal decrement_status_menu_disabled -/* 181B70 80253290 00000000 */ nop +/* 181B70 80253290 00000000 */ nop /* 181B74 80253294 24020001 */ addiu $v0, $zero, 1 /* 181B78 80253298 3C03800A */ lui $v1, %hi(D_8009A650) /* 181B7C 8025329C 2463A650 */ addiu $v1, $v1, %lo(D_8009A650) diff --git a/asm/nonmatchings/code_181810/EndActorSpeech.s b/asm/nonmatchings/code_181810/EndActorSpeech.s index 722d351baf..59ad1f59ea 100644 --- a/asm/nonmatchings/code_181810/EndActorSpeech.s +++ b/asm/nonmatchings/code_181810/EndActorSpeech.s @@ -33,7 +33,7 @@ glabel EndActorSpeech /* 181C20 80253340 AC22FA70 */ sw $v0, %lo(gSpeakingActorIdleAnim)($at) /* 181C24 80253344 2402FF81 */ addiu $v0, $zero, -0x7f /* 181C28 80253348 16220002 */ bne $s1, $v0, .L80253354 -/* 181C2C 8025334C 00000000 */ nop +/* 181C2C 8025334C 00000000 */ nop /* 181C30 80253350 8E510148 */ lw $s1, 0x148($s2) .L80253354: /* 181C34 80253354 0C09A75B */ jal get_actor @@ -49,7 +49,7 @@ glabel EndActorSpeech /* 181C5C 8025337C 3C01802A */ lui $at, %hi(gSpeakingActorPart) /* 181C60 80253380 AC22FA78 */ sw $v0, %lo(gSpeakingActorPart)($at) /* 181C64 80253384 0C04971C */ jal close_message -/* 181C68 80253388 00000000 */ nop +/* 181C68 80253388 00000000 */ nop /* 181C6C 8025338C 0C03A6D5 */ jal increment_status_menu_disabled /* 181C70 80253390 AE400070 */ sw $zero, 0x70($s2) .L80253394: @@ -63,7 +63,7 @@ glabel EndActorSpeech /* 181C90 802533B0 86220150 */ lh $v0, 0x150($s1) /* 181C94 802533B4 C6200144 */ lwc1 $f0, 0x144($s1) /* 181C98 802533B8 44821000 */ mtc1 $v0, $f2 -/* 181C9C 802533BC 00000000 */ nop +/* 181C9C 802533BC 00000000 */ nop /* 181CA0 802533C0 468010A0 */ cvt.s.w $f2, $f2 /* 181CA4 802533C4 8E220000 */ lw $v0, ($s1) /* 181CA8 802533C8 30428000 */ andi $v0, $v0, 0x8000 @@ -72,12 +72,12 @@ glabel EndActorSpeech /* 181CB4 802533D4 86220152 */ lh $v0, 0x152($s1) /* 181CB8 802533D8 C6200148 */ lwc1 $f0, 0x148($s1) /* 181CBC 802533DC 44821000 */ mtc1 $v0, $f2 -/* 181CC0 802533E0 00000000 */ nop +/* 181CC0 802533E0 00000000 */ nop /* 181CC4 802533E4 468010A0 */ cvt.s.w $f2, $f2 /* 181CC8 802533E8 92220191 */ lbu $v0, 0x191($s1) /* 181CCC 802533EC 46020000 */ add.s $f0, $f0, $f2 /* 181CD0 802533F0 44821000 */ mtc1 $v0, $f2 -/* 181CD4 802533F4 00000000 */ nop +/* 181CD4 802533F4 00000000 */ nop /* 181CD8 802533F8 468010A0 */ cvt.s.w $f2, $f2 /* 181CDC 802533FC 08094D0D */ j .L80253434 /* 181CE0 80253400 46001000 */ add.s $f0, $f2, $f0 @@ -85,13 +85,13 @@ glabel EndActorSpeech /* 181CE4 80253404 86220152 */ lh $v0, 0x152($s1) /* 181CE8 80253408 C6220148 */ lwc1 $f2, 0x148($s1) /* 181CEC 8025340C 44820000 */ mtc1 $v0, $f0 -/* 181CF0 80253410 00000000 */ nop +/* 181CF0 80253410 00000000 */ nop /* 181CF4 80253414 46800020 */ cvt.s.w $f0, $f0 /* 181CF8 80253418 92220191 */ lbu $v0, 0x191($s1) /* 181CFC 8025341C 46001080 */ add.s $f2, $f2, $f0 /* 181D00 80253420 00021042 */ srl $v0, $v0, 1 /* 181D04 80253424 44820000 */ mtc1 $v0, $f0 -/* 181D08 80253428 00000000 */ nop +/* 181D08 80253428 00000000 */ nop /* 181D0C 8025342C 46800020 */ cvt.s.w $f0, $f0 /* 181D10 80253430 46001000 */ add.s $f0, $f2, $f0 .L80253434: @@ -103,7 +103,7 @@ glabel EndActorSpeech /* 181D28 80253448 27A20020 */ addiu $v0, $sp, 0x20 /* 181D2C 8025344C AFA20010 */ sw $v0, 0x10($sp) /* 181D30 80253450 44830000 */ mtc1 $v1, $f0 -/* 181D34 80253454 00000000 */ nop +/* 181D34 80253454 00000000 */ nop /* 181D38 80253458 46800020 */ cvt.s.w $f0, $f0 /* 181D3C 8025345C 46001080 */ add.s $f2, $f2, $f0 /* 181D40 80253460 27A20024 */ addiu $v0, $sp, 0x24 @@ -124,16 +124,16 @@ glabel EndActorSpeech /* 181D7C 8025349C 10400005 */ beqz $v0, .L802534B4 /* 181D80 802534A0 30620080 */ andi $v0, $v1, 0x80 /* 181D84 802534A4 0C03A6CC */ jal decrement_status_menu_disabled -/* 181D88 802534A8 00000000 */ nop +/* 181D88 802534A8 00000000 */ nop /* 181D8C 802534AC 08094D47 */ j .L8025351C /* 181D90 802534B0 24020001 */ addiu $v0, $zero, 1 .L802534B4: /* 181D94 802534B4 10400005 */ beqz $v0, .L802534CC -/* 181D98 802534B8 00000000 */ nop +/* 181D98 802534B8 00000000 */ nop /* 181D9C 802534BC 3C06802A */ lui $a2, %hi(gSpeakingActorTalkAnim) /* 181DA0 802534C0 8CC6FA6C */ lw $a2, %lo(gSpeakingActorTalkAnim)($a2) /* 181DA4 802534C4 08094D35 */ j .L802534D4 -/* 181DA8 802534C8 00000000 */ nop +/* 181DA8 802534C8 00000000 */ nop .L802534CC: /* 181DAC 802534CC 3C06802A */ lui $a2, %hi(gSpeakingActorIdleAnim) /* 181DB0 802534D0 8CC6FA70 */ lw $a2, %lo(gSpeakingActorIdleAnim)($a2) @@ -149,7 +149,7 @@ glabel EndActorSpeech /* 181DD0 802534F0 1462000A */ bne $v1, $v0, .L8025351C /* 181DD4 802534F4 0000102D */ daddu $v0, $zero, $zero /* 181DD8 802534F8 0C03A6CC */ jal decrement_status_menu_disabled -/* 181DDC 802534FC 00000000 */ nop +/* 181DDC 802534FC 00000000 */ nop /* 181DE0 80253500 24020001 */ addiu $v0, $zero, 1 /* 181DE4 80253504 3C03800A */ lui $v1, %hi(D_8009A650) /* 181DE8 80253508 2463A650 */ addiu $v1, $v1, %lo(D_8009A650) diff --git a/asm/nonmatchings/code_197F40/SetActorIdleJumpGravity.s b/asm/nonmatchings/code_197F40/SetActorIdleJumpGravity.s index 663aed6d84..b5cd7e9ab7 100644 --- a/asm/nonmatchings/code_197F40/SetActorIdleJumpGravity.s +++ b/asm/nonmatchings/code_197F40/SetActorIdleJumpGravity.s @@ -16,7 +16,7 @@ glabel SetActorIdleJumpGravity /* 199EE4 8026B604 0040802D */ daddu $s0, $v0, $zero /* 199EE8 8026B608 2402FF81 */ addiu $v0, $zero, -0x7f /* 199EEC 8026B60C 16020002 */ bne $s0, $v0, .L8026B618 -/* 199EF0 8026B610 00000000 */ nop +/* 199EF0 8026B610 00000000 */ nop /* 199EF4 8026B614 8E500148 */ lw $s0, 0x148($s2) .L8026B618: /* 199EF8 8026B618 8E250000 */ lw $a1, ($s1) diff --git a/asm/nonmatchings/code_197F40/SetActorIdleSpeed.s b/asm/nonmatchings/code_197F40/SetActorIdleSpeed.s index 92610077cf..4dc9b81b40 100644 --- a/asm/nonmatchings/code_197F40/SetActorIdleSpeed.s +++ b/asm/nonmatchings/code_197F40/SetActorIdleSpeed.s @@ -16,7 +16,7 @@ glabel SetActorIdleSpeed /* 199FDC 8026B6FC 0040802D */ daddu $s0, $v0, $zero /* 199FE0 8026B700 2402FF81 */ addiu $v0, $zero, -0x7f /* 199FE4 8026B704 16020002 */ bne $s0, $v0, .L8026B710 -/* 199FE8 8026B708 00000000 */ nop +/* 199FE8 8026B708 00000000 */ nop /* 199FEC 8026B70C 8E500148 */ lw $s0, 0x148($s2) .L8026B710: /* 199FF0 8026B710 8E250000 */ lw $a1, ($s1) diff --git a/asm/nonmatchings/code_197F40/SetGoalPos.s b/asm/nonmatchings/code_197F40/SetGoalPos.s deleted file mode 100644 index a4ecdd6896..0000000000 --- a/asm/nonmatchings/code_197F40/SetGoalPos.s +++ /dev/null @@ -1,82 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel SetGoalPos -/* 198DF0 8026A510 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* 198DF4 8026A514 AFB20018 */ sw $s2, 0x18($sp) -/* 198DF8 8026A518 0080902D */ daddu $s2, $a0, $zero -/* 198DFC 8026A51C AFBF001C */ sw $ra, 0x1c($sp) -/* 198E00 8026A520 AFB10014 */ sw $s1, 0x14($sp) -/* 198E04 8026A524 AFB00010 */ sw $s0, 0x10($sp) -/* 198E08 8026A528 F7B60028 */ sdc1 $f22, 0x28($sp) -/* 198E0C 8026A52C F7B40020 */ sdc1 $f20, 0x20($sp) -/* 198E10 8026A530 8E50000C */ lw $s0, 0xc($s2) -/* 198E14 8026A534 8E050000 */ lw $a1, ($s0) -/* 198E18 8026A538 0C0B1EAF */ jal get_variable -/* 198E1C 8026A53C 26100004 */ addiu $s0, $s0, 4 -/* 198E20 8026A540 0040202D */ daddu $a0, $v0, $zero -/* 198E24 8026A544 2402FF81 */ addiu $v0, $zero, -0x7f -/* 198E28 8026A548 14820002 */ bne $a0, $v0, .L8026A554 -/* 198E2C 8026A54C 00000000 */ nop -/* 198E30 8026A550 8E440148 */ lw $a0, 0x148($s2) -.L8026A554: -/* 198E34 8026A554 0C09A75B */ jal get_actor -/* 198E38 8026A558 00000000 */ nop -/* 198E3C 8026A55C 3C03FF43 */ lui $v1, 0xff43 -/* 198E40 8026A560 34639EB2 */ ori $v1, $v1, 0x9eb2 -/* 198E44 8026A564 8E050000 */ lw $a1, ($s0) -/* 198E48 8026A568 14A30004 */ bne $a1, $v1, .L8026A57C -/* 198E4C 8026A56C 2451000C */ addiu $s1, $v0, 0xc -/* 198E50 8026A570 C4560018 */ lwc1 $f22, 0x18($v0) -/* 198E54 8026A574 0809A965 */ j .L8026A594 -/* 198E58 8026A578 26100004 */ addiu $s0, $s0, 4 -.L8026A57C: -/* 198E5C 8026A57C 0C0B1EAF */ jal get_variable -/* 198E60 8026A580 0240202D */ daddu $a0, $s2, $zero -/* 198E64 8026A584 4482B000 */ mtc1 $v0, $f22 -/* 198E68 8026A588 00000000 */ nop -/* 198E6C 8026A58C 4680B5A0 */ cvt.s.w $f22, $f22 -/* 198E70 8026A590 26100004 */ addiu $s0, $s0, 4 -.L8026A594: -/* 198E74 8026A594 3C02FF43 */ lui $v0, 0xff43 -/* 198E78 8026A598 8E050000 */ lw $a1, ($s0) -/* 198E7C 8026A59C 34429EB2 */ ori $v0, $v0, 0x9eb2 -/* 198E80 8026A5A0 14A20004 */ bne $a1, $v0, .L8026A5B4 -/* 198E84 8026A5A4 3C02FF43 */ lui $v0, 0xff43 -/* 198E88 8026A5A8 C6340010 */ lwc1 $f20, 0x10($s1) -/* 198E8C 8026A5AC 0809A973 */ j .L8026A5CC -/* 198E90 8026A5B0 00000000 */ nop -.L8026A5B4: -/* 198E94 8026A5B4 0C0B1EAF */ jal get_variable -/* 198E98 8026A5B8 0240202D */ daddu $a0, $s2, $zero -/* 198E9C 8026A5BC 4482A000 */ mtc1 $v0, $f20 -/* 198EA0 8026A5C0 00000000 */ nop -/* 198EA4 8026A5C4 4680A520 */ cvt.s.w $f20, $f20 -/* 198EA8 8026A5C8 3C02FF43 */ lui $v0, 0xff43 -.L8026A5CC: -/* 198EAC 8026A5CC 8E050004 */ lw $a1, 4($s0) -/* 198EB0 8026A5D0 34429EB2 */ ori $v0, $v0, 0x9eb2 -/* 198EB4 8026A5D4 14A20004 */ bne $a1, $v0, .L8026A5E8 -/* 198EB8 8026A5D8 00000000 */ nop -/* 198EBC 8026A5DC C6200014 */ lwc1 $f0, 0x14($s1) -/* 198EC0 8026A5E0 0809A980 */ j .L8026A600 -/* 198EC4 8026A5E4 E636000C */ swc1 $f22, 0xc($s1) -.L8026A5E8: -/* 198EC8 8026A5E8 0C0B1EAF */ jal get_variable -/* 198ECC 8026A5EC 0240202D */ daddu $a0, $s2, $zero -/* 198ED0 8026A5F0 44820000 */ mtc1 $v0, $f0 -/* 198ED4 8026A5F4 00000000 */ nop -/* 198ED8 8026A5F8 46800020 */ cvt.s.w $f0, $f0 -/* 198EDC 8026A5FC E636000C */ swc1 $f22, 0xc($s1) -.L8026A600: -/* 198EE0 8026A600 E6340010 */ swc1 $f20, 0x10($s1) -/* 198EE4 8026A604 E6200014 */ swc1 $f0, 0x14($s1) -/* 198EE8 8026A608 8FBF001C */ lw $ra, 0x1c($sp) -/* 198EEC 8026A60C 8FB20018 */ lw $s2, 0x18($sp) -/* 198EF0 8026A610 8FB10014 */ lw $s1, 0x14($sp) -/* 198EF4 8026A614 8FB00010 */ lw $s0, 0x10($sp) -/* 198EF8 8026A618 D7B60028 */ ldc1 $f22, 0x28($sp) -/* 198EFC 8026A61C D7B40020 */ ldc1 $f20, 0x20($sp) -/* 198F00 8026A620 24020002 */ addiu $v0, $zero, 2 -/* 198F04 8026A624 03E00008 */ jr $ra -/* 198F08 8026A628 27BD0030 */ addiu $sp, $sp, 0x30 diff --git a/asm/nonmatchings/code_197F40/SetGoalToFirstTarget.s b/asm/nonmatchings/code_197F40/SetGoalToFirstTarget.s deleted file mode 100644 index 21d695f2bd..0000000000 --- a/asm/nonmatchings/code_197F40/SetGoalToFirstTarget.s +++ /dev/null @@ -1,34 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel SetGoalToFirstTarget -/* 198D7C 8026A49C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 198D80 8026A4A0 AFB00010 */ sw $s0, 0x10($sp) -/* 198D84 8026A4A4 0080802D */ daddu $s0, $a0, $zero -/* 198D88 8026A4A8 AFBF0014 */ sw $ra, 0x14($sp) -/* 198D8C 8026A4AC 8E02000C */ lw $v0, 0xc($s0) -/* 198D90 8026A4B0 0C0B1EAF */ jal get_variable -/* 198D94 8026A4B4 8C450000 */ lw $a1, ($v0) -/* 198D98 8026A4B8 0040202D */ daddu $a0, $v0, $zero -/* 198D9C 8026A4BC 2402FF81 */ addiu $v0, $zero, -0x7f -/* 198DA0 8026A4C0 14820002 */ bne $a0, $v0, .L8026A4CC -/* 198DA4 8026A4C4 00000000 */ nop -/* 198DA8 8026A4C8 8E040148 */ lw $a0, 0x148($s0) -.L8026A4CC: -/* 198DAC 8026A4CC 0C09A75B */ jal get_actor -/* 198DB0 8026A4D0 00000000 */ nop -/* 198DB4 8026A4D4 8044040D */ lb $a0, 0x40d($v0) -/* 198DB8 8026A4D8 00041880 */ sll $v1, $a0, 2 -/* 198DBC 8026A4DC 00641821 */ addu $v1, $v1, $a0 -/* 198DC0 8026A4E0 00031880 */ sll $v1, $v1, 2 -/* 198DC4 8026A4E4 2463022C */ addiu $v1, $v1, 0x22c -/* 198DC8 8026A4E8 00431821 */ addu $v1, $v0, $v1 -/* 198DCC 8026A4EC 84650000 */ lh $a1, ($v1) -/* 198DD0 8026A4F0 84660002 */ lh $a2, 2($v1) -/* 198DD4 8026A4F4 0C09A5D5 */ jal set_goal_pos_to_part -/* 198DD8 8026A4F8 2444000C */ addiu $a0, $v0, 0xc -/* 198DDC 8026A4FC 8FBF0014 */ lw $ra, 0x14($sp) -/* 198DE0 8026A500 8FB00010 */ lw $s0, 0x10($sp) -/* 198DE4 8026A504 24020002 */ addiu $v0, $zero, 2 -/* 198DE8 8026A508 03E00008 */ jr $ra -/* 198DEC 8026A50C 27BD0018 */ addiu $sp, $sp, 0x18 diff --git a/asm/nonmatchings/code_197F40/SetIdleGoal.s b/asm/nonmatchings/code_197F40/SetIdleGoal.s deleted file mode 100644 index d6056cda76..0000000000 --- a/asm/nonmatchings/code_197F40/SetIdleGoal.s +++ /dev/null @@ -1,82 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel SetIdleGoal -/* 198F0C 8026A62C 27BDFFD0 */ addiu $sp, $sp, -0x30 -/* 198F10 8026A630 AFB20018 */ sw $s2, 0x18($sp) -/* 198F14 8026A634 0080902D */ daddu $s2, $a0, $zero -/* 198F18 8026A638 AFBF001C */ sw $ra, 0x1c($sp) -/* 198F1C 8026A63C AFB10014 */ sw $s1, 0x14($sp) -/* 198F20 8026A640 AFB00010 */ sw $s0, 0x10($sp) -/* 198F24 8026A644 F7B60028 */ sdc1 $f22, 0x28($sp) -/* 198F28 8026A648 F7B40020 */ sdc1 $f20, 0x20($sp) -/* 198F2C 8026A64C 8E50000C */ lw $s0, 0xc($s2) -/* 198F30 8026A650 8E050000 */ lw $a1, ($s0) -/* 198F34 8026A654 0C0B1EAF */ jal get_variable -/* 198F38 8026A658 26100004 */ addiu $s0, $s0, 4 -/* 198F3C 8026A65C 0040202D */ daddu $a0, $v0, $zero -/* 198F40 8026A660 2402FF81 */ addiu $v0, $zero, -0x7f -/* 198F44 8026A664 14820002 */ bne $a0, $v0, .L8026A670 -/* 198F48 8026A668 00000000 */ nop -/* 198F4C 8026A66C 8E440148 */ lw $a0, 0x148($s2) -.L8026A670: -/* 198F50 8026A670 0C09A75B */ jal get_actor -/* 198F54 8026A674 00000000 */ nop -/* 198F58 8026A678 3C03FF43 */ lui $v1, 0xff43 -/* 198F5C 8026A67C 34639EB2 */ ori $v1, $v1, 0x9eb2 -/* 198F60 8026A680 8E050000 */ lw $a1, ($s0) -/* 198F64 8026A684 14A30004 */ bne $a1, $v1, .L8026A698 -/* 198F68 8026A688 245100C8 */ addiu $s1, $v0, 0xc8 -/* 198F6C 8026A68C C45600D4 */ lwc1 $f22, 0xd4($v0) -/* 198F70 8026A690 0809A9AC */ j .L8026A6B0 -/* 198F74 8026A694 26100004 */ addiu $s0, $s0, 4 -.L8026A698: -/* 198F78 8026A698 0C0B1EAF */ jal get_variable -/* 198F7C 8026A69C 0240202D */ daddu $a0, $s2, $zero -/* 198F80 8026A6A0 4482B000 */ mtc1 $v0, $f22 -/* 198F84 8026A6A4 00000000 */ nop -/* 198F88 8026A6A8 4680B5A0 */ cvt.s.w $f22, $f22 -/* 198F8C 8026A6AC 26100004 */ addiu $s0, $s0, 4 -.L8026A6B0: -/* 198F90 8026A6B0 3C02FF43 */ lui $v0, 0xff43 -/* 198F94 8026A6B4 8E050000 */ lw $a1, ($s0) -/* 198F98 8026A6B8 34429EB2 */ ori $v0, $v0, 0x9eb2 -/* 198F9C 8026A6BC 14A20004 */ bne $a1, $v0, .L8026A6D0 -/* 198FA0 8026A6C0 3C02FF43 */ lui $v0, 0xff43 -/* 198FA4 8026A6C4 C6340010 */ lwc1 $f20, 0x10($s1) -/* 198FA8 8026A6C8 0809A9BA */ j .L8026A6E8 -/* 198FAC 8026A6CC 00000000 */ nop -.L8026A6D0: -/* 198FB0 8026A6D0 0C0B1EAF */ jal get_variable -/* 198FB4 8026A6D4 0240202D */ daddu $a0, $s2, $zero -/* 198FB8 8026A6D8 4482A000 */ mtc1 $v0, $f20 -/* 198FBC 8026A6DC 00000000 */ nop -/* 198FC0 8026A6E0 4680A520 */ cvt.s.w $f20, $f20 -/* 198FC4 8026A6E4 3C02FF43 */ lui $v0, 0xff43 -.L8026A6E8: -/* 198FC8 8026A6E8 8E050004 */ lw $a1, 4($s0) -/* 198FCC 8026A6EC 34429EB2 */ ori $v0, $v0, 0x9eb2 -/* 198FD0 8026A6F0 14A20004 */ bne $a1, $v0, .L8026A704 -/* 198FD4 8026A6F4 00000000 */ nop -/* 198FD8 8026A6F8 C6200014 */ lwc1 $f0, 0x14($s1) -/* 198FDC 8026A6FC 0809A9C7 */ j .L8026A71C -/* 198FE0 8026A700 E636000C */ swc1 $f22, 0xc($s1) -.L8026A704: -/* 198FE4 8026A704 0C0B1EAF */ jal get_variable -/* 198FE8 8026A708 0240202D */ daddu $a0, $s2, $zero -/* 198FEC 8026A70C 44820000 */ mtc1 $v0, $f0 -/* 198FF0 8026A710 00000000 */ nop -/* 198FF4 8026A714 46800020 */ cvt.s.w $f0, $f0 -/* 198FF8 8026A718 E636000C */ swc1 $f22, 0xc($s1) -.L8026A71C: -/* 198FFC 8026A71C E6340010 */ swc1 $f20, 0x10($s1) -/* 199000 8026A720 E6200014 */ swc1 $f0, 0x14($s1) -/* 199004 8026A724 8FBF001C */ lw $ra, 0x1c($sp) -/* 199008 8026A728 8FB20018 */ lw $s2, 0x18($sp) -/* 19900C 8026A72C 8FB10014 */ lw $s1, 0x14($sp) -/* 199010 8026A730 8FB00010 */ lw $s0, 0x10($sp) -/* 199014 8026A734 D7B60028 */ ldc1 $f22, 0x28($sp) -/* 199018 8026A738 D7B40020 */ ldc1 $f20, 0x20($sp) -/* 19901C 8026A73C 24020002 */ addiu $v0, $zero, 2 -/* 199020 8026A740 03E00008 */ jr $ra -/* 199024 8026A744 27BD0030 */ addiu $sp, $sp, 0x30 diff --git a/asm/nonmatchings/code_197F40/SetPartGoalToTarget.s b/asm/nonmatchings/code_197F40/SetPartGoalToTarget.s deleted file mode 100644 index cebc8f3fa5..0000000000 --- a/asm/nonmatchings/code_197F40/SetPartGoalToTarget.s +++ /dev/null @@ -1,43 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel SetPartGoalToTarget -/* 198CE4 8026A404 27BDFFD8 */ addiu $sp, $sp, -0x28 -/* 198CE8 8026A408 AFB20018 */ sw $s2, 0x18($sp) -/* 198CEC 8026A40C 0080902D */ daddu $s2, $a0, $zero -/* 198CF0 8026A410 AFBF0020 */ sw $ra, 0x20($sp) -/* 198CF4 8026A414 AFB3001C */ sw $s3, 0x1c($sp) -/* 198CF8 8026A418 AFB10014 */ sw $s1, 0x14($sp) -/* 198CFC 8026A41C AFB00010 */ sw $s0, 0x10($sp) -/* 198D00 8026A420 8E50000C */ lw $s0, 0xc($s2) -/* 198D04 8026A424 8E050000 */ lw $a1, ($s0) -/* 198D08 8026A428 0C0B1EAF */ jal get_variable -/* 198D0C 8026A42C 26100004 */ addiu $s0, $s0, 4 -/* 198D10 8026A430 0040882D */ daddu $s1, $v0, $zero -/* 198D14 8026A434 8E050000 */ lw $a1, ($s0) -/* 198D18 8026A438 0C0B1EAF */ jal get_variable -/* 198D1C 8026A43C 0240202D */ daddu $a0, $s2, $zero -/* 198D20 8026A440 0040982D */ daddu $s3, $v0, $zero -/* 198D24 8026A444 2402FF81 */ addiu $v0, $zero, -0x7f -/* 198D28 8026A448 16220002 */ bne $s1, $v0, .L8026A454 -/* 198D2C 8026A44C 00000000 */ nop -/* 198D30 8026A450 8E510148 */ lw $s1, 0x148($s2) -.L8026A454: -/* 198D34 8026A454 0C09A75B */ jal get_actor -/* 198D38 8026A458 0220202D */ daddu $a0, $s1, $zero -/* 198D3C 8026A45C 0040802D */ daddu $s0, $v0, $zero -/* 198D40 8026A460 0200202D */ daddu $a0, $s0, $zero -/* 198D44 8026A464 0C099117 */ jal get_actor_part -/* 198D48 8026A468 0260282D */ daddu $a1, $s3, $zero -/* 198D4C 8026A46C 8C440010 */ lw $a0, 0x10($v0) -/* 198D50 8026A470 86050428 */ lh $a1, 0x428($s0) -/* 198D54 8026A474 0C09A676 */ jal set_part_goal_to_actor_part -/* 198D58 8026A478 82060426 */ lb $a2, 0x426($s0) -/* 198D5C 8026A47C 8FBF0020 */ lw $ra, 0x20($sp) -/* 198D60 8026A480 8FB3001C */ lw $s3, 0x1c($sp) -/* 198D64 8026A484 8FB20018 */ lw $s2, 0x18($sp) -/* 198D68 8026A488 8FB10014 */ lw $s1, 0x14($sp) -/* 198D6C 8026A48C 8FB00010 */ lw $s0, 0x10($sp) -/* 198D70 8026A490 24020002 */ addiu $v0, $zero, 2 -/* 198D74 8026A494 03E00008 */ jr $ra -/* 198D78 8026A498 27BD0028 */ addiu $sp, $sp, 0x28 diff --git a/include/common_structs.h b/include/common_structs.h index 344e60e75d..d1ac4a3bb8 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -1204,6 +1204,12 @@ typedef struct ActorMovePos { /* 0x18 */ Vec3f end; } ActorMovePos; // size = 0x20; +typedef struct ActorFlyPos { + /* 0x00 */ Vec3f current; + /* 0x0C */ Vec3f goal; + /* 0x18 */ Vec3f temp; /* used for start in fly functions, end in flyrun functions */ +} ActorFlyPos; // size = 0x20; + typedef struct Actor { /* 0x000 */ s32 flags; /* 0x004 */ char unk_04[4]; @@ -1226,9 +1232,7 @@ typedef struct Actor { /* 0x077 */ u8 jumpPartIndex; /* 0x078 */ char unk_78[16]; /* 0x088 */ s32 varTable[16]; - /* 0x0C8 */ Vec3f flyCurrentPos; - /* 0x0D4 */ Vec3f flyGoalPos; - /* 0x0E0 */ Vec3f flyTempPos; /* used for start in fly functions, end in flyrun functions */ + /* 0x0C8 */ ActorFlyPos flyPos; /* 0x0EC */ char unk_EC[24]; /* 0x104 */ f32 flyJumpAccel; /* 0x108 */ f32 flySpeed; @@ -1312,7 +1316,7 @@ typedef struct Actor { /* 0x225 */ char unk_225[7]; /* 0x22C */ struct SelectableTarget targetData[24]; /* 0x40C */ s8 targetListLength; - /* 0x40D */ u8 targetIndexList[24]; /* into targetData */ + /* 0x40D */ s8 targetIndexList[24]; /* into targetData */ /* 0x425 */ u8 selectedTargetIndex; /* into target index list */ /* 0x426 */ s8 targetPartIndex; /* 0x427 */ char unk_427; diff --git a/include/enums.h b/include/enums.h index 4669f119bf..070b02f311 100644 --- a/include/enums.h +++ b/include/enums.h @@ -1031,34 +1031,34 @@ typedef UNK_TYPE Phase; #define Phase_MERLEE_EXP_BONUS 0x00000016 #define Phase_PLAYER_HAPPY 0x0000001E -typedef UNK_TYPE ActorId; -#define ActorId_SELF 0xFFFFFF81 -#define ActorId_PLAYER 0x00000000 -#define ActorId_PARTNER 0x00000100 -#define ActorId_ENEMY0 0x00000200 -#define ActorId_ENEMY1 0x00000201 -#define ActorId_ENEMY2 0x00000202 -#define ActorId_ENEMY3 0x00000203 -#define ActorId_ENEMY4 0x00000204 -#define ActorId_ENEMY5 0x00000205 -#define ActorId_ENEMY6 0x00000206 -#define ActorId_ENEMY7 0x00000207 -#define ActorId_ENEMY8 0x00000208 -#define ActorId_ENEMY9 0x00000209 -#define ActorId_ENEMY10 0x0000020A -#define ActorId_ENEMY11 0x0000020B -#define ActorId_ENEMY12 0x0000020C -#define ActorId_ENEMY13 0x0000020D -#define ActorId_ENEMY14 0x0000020E -#define ActorId_ENEMY15 0x0000020F -#define ActorId_ENEMY16 0x00000210 -#define ActorId_ENEMY17 0x00000211 -#define ActorId_ENEMY18 0x00000212 -#define ActorId_ENEMY19 0x00000213 -#define ActorId_ENEMY20 0x00000214 -#define ActorId_ENEMY21 0x00000215 -#define ActorId_ENEMY22 0x00000216 -#define ActorId_ENEMY23 0x00000217 +typedef UNK_TYPE ActorID; +#define ActorID_SELF 0xFFFFFF81 +#define ActorID_PLAYER 0x00000000 +#define ActorID_PARTNER 0x00000100 +#define ActorID_ENEMY0 0x00000200 +#define ActorID_ENEMY1 0x00000201 +#define ActorID_ENEMY2 0x00000202 +#define ActorID_ENEMY3 0x00000203 +#define ActorID_ENEMY4 0x00000204 +#define ActorID_ENEMY5 0x00000205 +#define ActorID_ENEMY6 0x00000206 +#define ActorID_ENEMY7 0x00000207 +#define ActorID_ENEMY8 0x00000208 +#define ActorID_ENEMY9 0x00000209 +#define ActorID_ENEMY10 0x0000020A +#define ActorID_ENEMY11 0x0000020B +#define ActorID_ENEMY12 0x0000020C +#define ActorID_ENEMY13 0x0000020D +#define ActorID_ENEMY14 0x0000020E +#define ActorID_ENEMY15 0x0000020F +#define ActorID_ENEMY16 0x00000210 +#define ActorID_ENEMY17 0x00000211 +#define ActorID_ENEMY18 0x00000212 +#define ActorID_ENEMY19 0x00000213 +#define ActorID_ENEMY20 0x00000214 +#define ActorID_ENEMY21 0x00000215 +#define ActorID_ENEMY22 0x00000216 +#define ActorID_ENEMY23 0x00000217 typedef UNK_TYPE Element; #define Element_NORMAL 0x00000001 diff --git a/src/code_181810.c b/src/code_181810.c index f84e9b98cf..d9139af077 100644 --- a/src/code_181810.c +++ b/src/code_181810.c @@ -33,7 +33,7 @@ ApiStatus ActorSpeak(ScriptInstance* script, s32 isInitialCall) { gSpeakingActorIdleAnim = get_variable(script, *args++); stringID2 = stringID; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -140,11 +140,11 @@ INCLUDE_ASM(s32, "code_181810", func_802537C0); ApiStatus PlaySoundAtActor(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); Bytecode soundID = *args++; Actor* actor; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } diff --git a/src/code_197F40.c b/src/code_197F40.c index 6c10f62b35..565fe8e82f 100644 --- a/src/code_197F40.c +++ b/src/code_197F40.c @@ -36,11 +36,11 @@ s32 get_nearest_home_index(f32 x, f32 y, f32 z) { return yVal | (xVal << 2); } -INCLUDE_ASM(void, "code_197F40", set_goal_pos_to_part, f32* goalPos, ActorId target, s32 partIndex); +INCLUDE_ASM(void, "code_197F40", set_goal_pos_to_part, f32* goalPos, ActorID target, s32 partIndex); INCLUDE_ASM(s32, "code_197F40", set_part_goal_to_actor_part); -void set_actor_current_position(ActorId actorID, f32 x, f32 y, f32 z) { +void set_actor_current_position(ActorID actorID, f32 x, f32 y, f32 z) { Actor* actor = get_actor(actorID); actor->currentPos.x = x; @@ -50,7 +50,7 @@ void set_actor_current_position(ActorId actorID, f32 x, f32 y, f32 z) { INCLUDE_ASM(s32, "code_197F40", set_part_absolute_position); -void set_actor_home_position(ActorId actorID, f32 x, f32 y, f32 z) { +void set_actor_home_position(ActorID actorID, f32 x, f32 y, f32 z) { Actor* actor = get_actor(actorID); actor->homePos.x = x; @@ -77,10 +77,10 @@ INCLUDE_ASM(s32, "code_197F40", func_80269E80); INCLUDE_ASM(s32, "code_197F40", func_80269EAC); ApiStatus SetGoalToHome(ScriptInstance* script, s32 isInitialCall) { - ActorId actorID = get_variable(script, *script->ptrReadPos); + ActorID actorID = get_variable(script, *script->ptrReadPos); Actor* actor; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -93,17 +93,17 @@ ApiStatus SetGoalToHome(ScriptInstance* script, s32 isInitialCall) { } ApiStatus SetIdleGoalToHome(ScriptInstance* script, s32 isInitialCall) { - ActorId actorID = get_variable(script, *script->ptrReadPos); + ActorID actorID = get_variable(script, *script->ptrReadPos); Actor* actor; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } actor = get_actor(actorID); - actor->flyGoalPos.x = actor->homePos.x; - actor->flyGoalPos.y = actor->homePos.y; - actor->flyGoalPos.z = actor->homePos.z; + actor->flyPos.goal.x = actor->homePos.x; + actor->flyPos.goal.y = actor->homePos.y; + actor->flyPos.goal.z = actor->homePos.z; return ApiStatus_DONE2; } @@ -112,11 +112,11 @@ INCLUDE_ASM(s32, "code_197F40", SetGoalToIndex); ApiStatus GetIndexFromPos(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 a1 = *args++; Actor* actor; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -128,11 +128,11 @@ ApiStatus GetIndexFromPos(ScriptInstance* script, s32 isInitialCall) { ApiStatus GetIndexFromHome(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 a1 = *args++; Actor* actor; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -144,12 +144,12 @@ ApiStatus GetIndexFromHome(ScriptInstance* script, s32 isInitialCall) { ApiStatus CountPlayerTargets(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 targetSelectionFlags = *args++; s32 outVar = *args++; Actor* actor; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -162,11 +162,11 @@ ApiStatus CountPlayerTargets(ScriptInstance* script, s32 isInitialCall) { ApiStatus ForceHomePos(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); f32 x, y, z; Actor* actor; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -187,11 +187,11 @@ ApiStatus ForceHomePos(ScriptInstance* script, s32 isInitialCall) { ApiStatus SetHomePos(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); f32 x, y, z; Actor* actor; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -209,10 +209,10 @@ ApiStatus SetHomePos(ScriptInstance* script, s32 isInitialCall) { ApiStatus SetGoalToTarget(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); Actor* actor; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } actor = get_actor(actorID); @@ -222,15 +222,140 @@ ApiStatus SetGoalToTarget(ScriptInstance* script, s32 isInitialCall) { return ApiStatus_DONE2; } -INCLUDE_ASM(s32, "code_197F40", SetPartGoalToTarget); +ApiStatus SetPartGoalToTarget(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + ActorID actorID = get_variable(script, *args++); + s32 partIndex = get_variable(script, *args++); + Actor* actor; -INCLUDE_ASM(s32, "code_197F40", SetGoalToFirstTarget); + if (actorID == ActorID_SELF) { + actorID = script->owner1.actorID; + } + actor = get_actor(actorID); -INCLUDE_ASM(s32, "code_197F40", SetGoalPos); + set_part_goal_to_actor_part(get_actor_part(actor, partIndex)->movement, actor->targetActorID, actor->targetPartIndex); -INCLUDE_ASM(s32, "code_197F40", SetIdleGoal); + return ApiStatus_DONE2; +} -INCLUDE_ASM(s32, "code_197F40", AddGoalPos); +ApiStatus SetGoalToFirstTarget(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + ActorID actorID = get_variable(script, *args++); + Actor* actor; + SelectableTarget* target; + + if (actorID == ActorID_SELF) { + actorID = script->owner1.actorID; + } + actor = get_actor(actorID); + + target = &actor->targetData[actor->targetIndexList[0]]; + set_goal_pos_to_part(&actor->movePos, target->actorID, target->partID); + + return ApiStatus_DONE2; +} + +ApiStatus SetGoalPos(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + ActorID actorID = get_variable(script, *args++); + Actor* actor; + ActorMovePos* movePos; + f32 x, y, z; + + if (actorID == ActorID_SELF) { + actorID = script->owner1.actorID; + } + actor = get_actor(actorID); + movePos = &actor->movePos; + + if (*args == -12345678) { + x = actor->movePos.goal.x; + } else { + x = get_variable(script, *args); + } + + *args++; + if (*args == -12345678) { + y = movePos->goal.y; + } else { + y = get_variable(script, *args); + } + + *args++; + if (*args == -12345678) { + z = movePos->goal.z; + } else { + z = get_variable(script, *args); + } + + movePos->goal.x = x; + movePos->goal.y = y; + movePos->goal.z = z; + + return ApiStatus_DONE2; +} + +ApiStatus SetIdleGoal(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + ActorID actorID = get_variable(script, *args++); + Actor* actor; + ActorFlyPos* flyPos; + f32 x, y, z; + + if (actorID == ActorID_SELF) { + actorID = script->owner1.actorID; + } + actor = get_actor(actorID); + flyPos = &actor->flyPos; + + if (*args == -12345678) { + x = actor->flyPos.goal.x; + } else { + x = get_variable(script, *args); + } + + *args++; + if (*args == -12345678) { + y = flyPos->goal.y; + } else { + y = get_variable(script, *args); + } + + *args++; + if (*args == -12345678) { + z = flyPos->goal.z; + } else { + z = get_variable(script, *args); + } + + flyPos->goal.x = x; + flyPos->goal.y = y; + flyPos->goal.z = z; + return ApiStatus_DONE2; +} + +ApiStatus AddGoalPos(ScriptInstance* script, s32 isInitialCall) { + Bytecode* args = script->ptrReadPos; + ActorID actorID = get_variable(script, *args++); + Actor* actor; + SelectableTarget* target; + f32 x, y, z; + + if (actorID == ActorID_SELF) { + actorID = script->owner1.actorID; + } + + x = get_float_variable(script, *args++); + y = get_float_variable(script, *args++); + z = get_float_variable(script, *args++); + + actor = get_actor(actorID); + actor->movePos.goal.x += x; + actor->movePos.goal.y += y; + actor->movePos.goal.z += z; + + return ApiStatus_DONE2; +} INCLUDE_ASM(s32, "code_197F40", GetGoalPos); @@ -405,14 +530,14 @@ ApiStatus ActorExists(ScriptInstance* script, s32 isInitialCall) { Bytecode isExist; Actor* partner = gBattleStatus.partnerActor; Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } isExist = get_actor(actorID) != NULL; - if ((actorID == ActorId_PARTNER) && (partner == NULL)) { + if ((actorID == ActorID_PARTNER) && (partner == NULL)) { isExist = FALSE; } diff --git a/src/code_1A5830.c b/src/code_1A5830.c index 11280144be..76e9a13165 100644 --- a/src/code_1A5830.c +++ b/src/code_1A5830.c @@ -60,10 +60,10 @@ INCLUDE_ASM(s32, "code_1A5830", dispatch_damage_event_actor_1); ApiStatus BindTakeTurn(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 var1; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -74,9 +74,9 @@ ApiStatus BindTakeTurn(ScriptInstance* script, s32 isInitialCall) { ApiStatus PauseTakeTurn(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -87,9 +87,9 @@ ApiStatus PauseTakeTurn(ScriptInstance* script, s32 isInitialCall) { ApiStatus ResumeTakeTurn(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -104,10 +104,10 @@ INCLUDE_ASM(s32, "code_1A5830", EnableIdleScript); ApiStatus BindHandleEvent(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 var1; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -118,10 +118,10 @@ ApiStatus BindHandleEvent(ScriptInstance* script, s32 isInitialCall) { ApiStatus BindNextTurn(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 var1; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -164,10 +164,10 @@ INCLUDE_ASM(s32, "code_1A5830", FlyPartTo); ApiStatus GetLastEvent(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 outVar; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -178,11 +178,11 @@ ApiStatus GetLastEvent(ScriptInstance* script, s32 isInitialCall) { ApiStatus SetTargetActor(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 targetActorID; Actor* actor; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -199,10 +199,10 @@ INCLUDE_ASM(s32, "code_1A5830", GetActorHP); ApiStatus GetEnemyMaxHP(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 outVar; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -217,11 +217,11 @@ INCLUDE_ASM(s32, "code_1A5830", DropStarPoints); ApiStatus SetDefenseTable(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 var1; s32 var2; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -233,10 +233,10 @@ ApiStatus SetDefenseTable(ScriptInstance* script, s32 isInitialCall) { ApiStatus SetStatusTable(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 var1; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -247,11 +247,11 @@ ApiStatus SetStatusTable(ScriptInstance* script, s32 isInitialCall) { ApiStatus SetIdleAnimations(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 var1; s32 var2; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -271,12 +271,12 @@ INCLUDE_ASM(s32, "code_1A5830", EnemyTestTarget); ApiStatus DispatchDamageEvent(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); Actor* actor; s32 damageAmount; s32 scriptExists; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -293,9 +293,9 @@ ApiStatus DispatchDamageEvent(ScriptInstance* script, s32 isInitialCall) { ApiStatus DispatchEvent(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -304,9 +304,9 @@ ApiStatus DispatchEvent(ScriptInstance* script, s32 isInitialCall) { } ApiStatus func_8027D2D8(ScriptInstance* script, s32 isInitialCall) { - ActorId actorID = get_variable(script, *script->ptrReadPos); + ActorID actorID = get_variable(script, *script->ptrReadPos); - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -315,9 +315,9 @@ ApiStatus func_8027D2D8(ScriptInstance* script, s32 isInitialCall) { } ApiStatus func_8027D32C(ScriptInstance* script, s32 isInitialCall) { - ActorId actorID = get_variable(script, *script->ptrReadPos); + ActorID actorID = get_variable(script, *script->ptrReadPos); - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -329,11 +329,11 @@ INCLUDE_ASM(s32, "code_1A5830", SetTargetOffset); ApiStatus func_8027D434(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 partIndex; ActorPart* part; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -347,11 +347,11 @@ INCLUDE_ASM(s32, "code_1A5830", func_8027D4C8); ApiStatus EnableActorBlur(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 enable = get_variable(script, *args++); Actor* actor; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -368,9 +368,9 @@ ApiStatus EnableActorBlur(ScriptInstance* script, s32 isInitialCall) { } ApiStatus func_8027D628(ScriptInstance* script, s32 isInitialCall) { - ActorId actorID = get_variable(script, *script->ptrReadPos); + ActorID actorID = get_variable(script, *script->ptrReadPos); - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -382,10 +382,10 @@ INCLUDE_ASM(s32, "code_1A5830", AfflictActor); ApiStatus func_8027D75C(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 outVar = *args++; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -407,12 +407,12 @@ INCLUDE_ASM(s32, "code_1A5830", SetActorSize); ApiStatus GetActorSize(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 outY = *args++; s32 outX = *args++; Actor* actor; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -426,10 +426,10 @@ INCLUDE_ASM(s32, "code_1A5830", SetPartSize); ApiStatus GetOriginalActorType(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 outVar = *args++; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -439,10 +439,10 @@ ApiStatus GetOriginalActorType(ScriptInstance* script, s32 isInitialCall) { ApiStatus GetCurrentActorType(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 outVar = *args++; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } @@ -452,10 +452,10 @@ ApiStatus GetCurrentActorType(ScriptInstance* script, s32 isInitialCall) { ApiStatus GetLastDamage(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - ActorId actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); s32 outVar; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.actorID; } outVar = *args++; diff --git a/src/code_1AC760.c b/src/code_1AC760.c index 6697da5fff..4a27ff9f56 100644 --- a/src/code_1AC760.c +++ b/src/code_1AC760.c @@ -20,10 +20,10 @@ INCLUDE_ASM(s32, "code_1AC760", func_8027FC90); ApiStatus GetActorLevel(ScriptInstance* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - s32 actorID = get_variable(script, *args++); + ActorID actorID = get_variable(script, *args++); Bytecode* outVar; - if (actorID == ActorId_SELF) { + if (actorID == ActorID_SELF) { actorID = script->owner1.enemyID; }