This commit is contained in:
Ethan Roseman 2020-11-19 19:58:41 -05:00
parent 3a2f17b91d
commit 0f530e12aa
11 changed files with 124 additions and 309 deletions

View File

@ -1,59 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel AddGoalPos
/* 199028 8026A748 27BDFFC8 */ addiu $sp, $sp, -0x38
/* 19902C 8026A74C AFB20018 */ sw $s2, 0x18($sp)
/* 199030 8026A750 0080902D */ daddu $s2, $a0, $zero
/* 199034 8026A754 AFBF001C */ sw $ra, 0x1c($sp)
/* 199038 8026A758 AFB10014 */ sw $s1, 0x14($sp)
/* 19903C 8026A75C AFB00010 */ sw $s0, 0x10($sp)
/* 199040 8026A760 F7B80030 */ sdc1 $f24, 0x30($sp)
/* 199044 8026A764 F7B60028 */ sdc1 $f22, 0x28($sp)
/* 199048 8026A768 F7B40020 */ sdc1 $f20, 0x20($sp)
/* 19904C 8026A76C 8E50000C */ lw $s0, 0xc($s2)
/* 199050 8026A770 8E050000 */ lw $a1, ($s0)
/* 199054 8026A774 0C0B1EAF */ jal get_variable
/* 199058 8026A778 26100004 */ addiu $s0, $s0, 4
/* 19905C 8026A77C 0040882D */ daddu $s1, $v0, $zero
/* 199060 8026A780 2402FF81 */ addiu $v0, $zero, -0x7f
/* 199064 8026A784 16220002 */ bne $s1, $v0, .L8026A790
/* 199068 8026A788 00000000 */ nop
/* 19906C 8026A78C 8E510148 */ lw $s1, 0x148($s2)
.L8026A790:
/* 199070 8026A790 8E050000 */ lw $a1, ($s0)
/* 199074 8026A794 26100004 */ addiu $s0, $s0, 4
/* 199078 8026A798 0C0B210B */ jal get_float_variable
/* 19907C 8026A79C 0240202D */ daddu $a0, $s2, $zero
/* 199080 8026A7A0 8E050000 */ lw $a1, ($s0)
/* 199084 8026A7A4 26100004 */ addiu $s0, $s0, 4
/* 199088 8026A7A8 0240202D */ daddu $a0, $s2, $zero
/* 19908C 8026A7AC 0C0B210B */ jal get_float_variable
/* 199090 8026A7B0 46000606 */ mov.s $f24, $f0
/* 199094 8026A7B4 0240202D */ daddu $a0, $s2, $zero
/* 199098 8026A7B8 8E050000 */ lw $a1, ($s0)
/* 19909C 8026A7BC 0C0B210B */ jal get_float_variable
/* 1990A0 8026A7C0 46000506 */ mov.s $f20, $f0
/* 1990A4 8026A7C4 0220202D */ daddu $a0, $s1, $zero
/* 1990A8 8026A7C8 0C09A75B */ jal get_actor
/* 1990AC 8026A7CC 46000586 */ mov.s $f22, $f0
/* 1990B0 8026A7D0 0040182D */ daddu $v1, $v0, $zero
/* 1990B4 8026A7D4 C4640018 */ lwc1 $f4, 0x18($v1)
/* 1990B8 8026A7D8 46182100 */ add.s $f4, $f4, $f24
/* 1990BC 8026A7DC C462001C */ lwc1 $f2, 0x1c($v1)
/* 1990C0 8026A7E0 46141080 */ add.s $f2, $f2, $f20
/* 1990C4 8026A7E4 C4600020 */ lwc1 $f0, 0x20($v1)
/* 1990C8 8026A7E8 46160000 */ add.s $f0, $f0, $f22
/* 1990CC 8026A7EC E4640018 */ swc1 $f4, 0x18($v1)
/* 1990D0 8026A7F0 E462001C */ swc1 $f2, 0x1c($v1)
/* 1990D4 8026A7F4 E4600020 */ swc1 $f0, 0x20($v1)
/* 1990D8 8026A7F8 8FBF001C */ lw $ra, 0x1c($sp)
/* 1990DC 8026A7FC 8FB20018 */ lw $s2, 0x18($sp)
/* 1990E0 8026A800 8FB10014 */ lw $s1, 0x14($sp)
/* 1990E4 8026A804 8FB00010 */ lw $s0, 0x10($sp)
/* 1990E8 8026A808 D7B80030 */ ldc1 $f24, 0x30($sp)
/* 1990EC 8026A80C D7B60028 */ ldc1 $f22, 0x28($sp)
/* 1990F0 8026A810 D7B40020 */ ldc1 $f20, 0x20($sp)
/* 1990F4 8026A814 24020002 */ addiu $v0, $zero, 2
/* 1990F8 8026A818 03E00008 */ jr $ra
/* 1990FC 8026A81C 27BD0038 */ addiu $sp, $sp, 0x38

View File

@ -1,56 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel GetActorPos
/* 199388 8026AAA8 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 19938C 8026AAAC AFB40020 */ sw $s4, 0x20($sp)
/* 199390 8026AAB0 0080A02D */ daddu $s4, $a0, $zero
/* 199394 8026AAB4 AFBF0024 */ sw $ra, 0x24($sp)
/* 199398 8026AAB8 AFB3001C */ sw $s3, 0x1c($sp)
/* 19939C 8026AABC AFB20018 */ sw $s2, 0x18($sp)
/* 1993A0 8026AAC0 AFB10014 */ sw $s1, 0x14($sp)
/* 1993A4 8026AAC4 AFB00010 */ sw $s0, 0x10($sp)
/* 1993A8 8026AAC8 8E92000C */ lw $s2, 0xc($s4)
/* 1993AC 8026AACC 8E450000 */ lw $a1, ($s2)
/* 1993B0 8026AAD0 0C0B1EAF */ jal get_variable
/* 1993B4 8026AAD4 26520004 */ addiu $s2, $s2, 4
/* 1993B8 8026AAD8 0040202D */ daddu $a0, $v0, $zero
/* 1993BC 8026AADC 2402FF81 */ addiu $v0, $zero, -0x7f
/* 1993C0 8026AAE0 14820002 */ bne $a0, $v0, .L8026AAEC
/* 1993C4 8026AAE4 00000000 */ nop
/* 1993C8 8026AAE8 8E840148 */ lw $a0, 0x148($s4)
.L8026AAEC:
/* 1993CC 8026AAEC 0C09A75B */ jal get_actor
/* 1993D0 8026AAF0 00000000 */ nop
/* 1993D4 8026AAF4 8E450000 */ lw $a1, ($s2)
/* 1993D8 8026AAF8 26520004 */ addiu $s2, $s2, 4
/* 1993DC 8026AAFC C4400144 */ lwc1 $f0, 0x144($v0)
/* 1993E0 8026AB00 C442014C */ lwc1 $f2, 0x14c($v0)
/* 1993E4 8026AB04 8E500000 */ lw $s0, ($s2)
/* 1993E8 8026AB08 4600010D */ trunc.w.s $f4, $f0
/* 1993EC 8026AB0C 44062000 */ mfc1 $a2, $f4
/* 1993F0 8026AB10 C4400148 */ lwc1 $f0, 0x148($v0)
/* 1993F4 8026AB14 8E520004 */ lw $s2, 4($s2)
/* 1993F8 8026AB18 4600010D */ trunc.w.s $f4, $f0
/* 1993FC 8026AB1C 44112000 */ mfc1 $s1, $f4
/* 199400 8026AB20 4600110D */ trunc.w.s $f4, $f2
/* 199404 8026AB24 44132000 */ mfc1 $s3, $f4
/* 199408 8026AB28 0C0B2026 */ jal set_variable
/* 19940C 8026AB2C 0280202D */ daddu $a0, $s4, $zero
/* 199410 8026AB30 0280202D */ daddu $a0, $s4, $zero
/* 199414 8026AB34 0200282D */ daddu $a1, $s0, $zero
/* 199418 8026AB38 0C0B2026 */ jal set_variable
/* 19941C 8026AB3C 0220302D */ daddu $a2, $s1, $zero
/* 199420 8026AB40 0280202D */ daddu $a0, $s4, $zero
/* 199424 8026AB44 0240282D */ daddu $a1, $s2, $zero
/* 199428 8026AB48 0C0B2026 */ jal set_variable
/* 19942C 8026AB4C 0260302D */ daddu $a2, $s3, $zero
/* 199430 8026AB50 8FBF0024 */ lw $ra, 0x24($sp)
/* 199434 8026AB54 8FB40020 */ lw $s4, 0x20($sp)
/* 199438 8026AB58 8FB3001C */ lw $s3, 0x1c($sp)
/* 19943C 8026AB5C 8FB20018 */ lw $s2, 0x18($sp)
/* 199440 8026AB60 8FB10014 */ lw $s1, 0x14($sp)
/* 199444 8026AB64 8FB00010 */ lw $s0, 0x10($sp)
/* 199448 8026AB68 24020002 */ addiu $v0, $zero, 2
/* 19944C 8026AB6C 03E00008 */ jr $ra
/* 199450 8026AB70 27BD0028 */ addiu $sp, $sp, 0x28

View File

@ -1,56 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel GetGoalPos
/* 199100 8026A820 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 199104 8026A824 AFB40020 */ sw $s4, 0x20($sp)
/* 199108 8026A828 0080A02D */ daddu $s4, $a0, $zero
/* 19910C 8026A82C AFBF0024 */ sw $ra, 0x24($sp)
/* 199110 8026A830 AFB3001C */ sw $s3, 0x1c($sp)
/* 199114 8026A834 AFB20018 */ sw $s2, 0x18($sp)
/* 199118 8026A838 AFB10014 */ sw $s1, 0x14($sp)
/* 19911C 8026A83C AFB00010 */ sw $s0, 0x10($sp)
/* 199120 8026A840 8E92000C */ lw $s2, 0xc($s4)
/* 199124 8026A844 8E450000 */ lw $a1, ($s2)
/* 199128 8026A848 0C0B1EAF */ jal get_variable
/* 19912C 8026A84C 26520004 */ addiu $s2, $s2, 4
/* 199130 8026A850 0040202D */ daddu $a0, $v0, $zero
/* 199134 8026A854 2402FF81 */ addiu $v0, $zero, -0x7f
/* 199138 8026A858 14820002 */ bne $a0, $v0, .L8026A864
/* 19913C 8026A85C 00000000 */ nop
/* 199140 8026A860 8E840148 */ lw $a0, 0x148($s4)
.L8026A864:
/* 199144 8026A864 0C09A75B */ jal get_actor
/* 199148 8026A868 00000000 */ nop
/* 19914C 8026A86C 8E450000 */ lw $a1, ($s2)
/* 199150 8026A870 26520004 */ addiu $s2, $s2, 4
/* 199154 8026A874 C4400018 */ lwc1 $f0, 0x18($v0)
/* 199158 8026A878 C4420020 */ lwc1 $f2, 0x20($v0)
/* 19915C 8026A87C 8E500000 */ lw $s0, ($s2)
/* 199160 8026A880 4600010D */ trunc.w.s $f4, $f0
/* 199164 8026A884 44062000 */ mfc1 $a2, $f4
/* 199168 8026A888 C440001C */ lwc1 $f0, 0x1c($v0)
/* 19916C 8026A88C 8E520004 */ lw $s2, 4($s2)
/* 199170 8026A890 4600010D */ trunc.w.s $f4, $f0
/* 199174 8026A894 44112000 */ mfc1 $s1, $f4
/* 199178 8026A898 4600110D */ trunc.w.s $f4, $f2
/* 19917C 8026A89C 44132000 */ mfc1 $s3, $f4
/* 199180 8026A8A0 0C0B2026 */ jal set_variable
/* 199184 8026A8A4 0280202D */ daddu $a0, $s4, $zero
/* 199188 8026A8A8 0280202D */ daddu $a0, $s4, $zero
/* 19918C 8026A8AC 0200282D */ daddu $a1, $s0, $zero
/* 199190 8026A8B0 0C0B2026 */ jal set_variable
/* 199194 8026A8B4 0220302D */ daddu $a2, $s1, $zero
/* 199198 8026A8B8 0280202D */ daddu $a0, $s4, $zero
/* 19919C 8026A8BC 0240282D */ daddu $a1, $s2, $zero
/* 1991A0 8026A8C0 0C0B2026 */ jal set_variable
/* 1991A4 8026A8C4 0260302D */ daddu $a2, $s3, $zero
/* 1991A8 8026A8C8 8FBF0024 */ lw $ra, 0x24($sp)
/* 1991AC 8026A8CC 8FB40020 */ lw $s4, 0x20($sp)
/* 1991B0 8026A8D0 8FB3001C */ lw $s3, 0x1c($sp)
/* 1991B4 8026A8D4 8FB20018 */ lw $s2, 0x18($sp)
/* 1991B8 8026A8D8 8FB10014 */ lw $s1, 0x14($sp)
/* 1991BC 8026A8DC 8FB00010 */ lw $s0, 0x10($sp)
/* 1991C0 8026A8E0 24020002 */ addiu $v0, $zero, 2
/* 1991C4 8026A8E4 03E00008 */ jr $ra
/* 1991C8 8026A8E8 27BD0028 */ addiu $sp, $sp, 0x28

View File

@ -1,56 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel GetIdleGoal
/* 1991CC 8026A8EC 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 1991D0 8026A8F0 AFB40020 */ sw $s4, 0x20($sp)
/* 1991D4 8026A8F4 0080A02D */ daddu $s4, $a0, $zero
/* 1991D8 8026A8F8 AFBF0024 */ sw $ra, 0x24($sp)
/* 1991DC 8026A8FC AFB3001C */ sw $s3, 0x1c($sp)
/* 1991E0 8026A900 AFB20018 */ sw $s2, 0x18($sp)
/* 1991E4 8026A904 AFB10014 */ sw $s1, 0x14($sp)
/* 1991E8 8026A908 AFB00010 */ sw $s0, 0x10($sp)
/* 1991EC 8026A90C 8E92000C */ lw $s2, 0xc($s4)
/* 1991F0 8026A910 8E450000 */ lw $a1, ($s2)
/* 1991F4 8026A914 0C0B1EAF */ jal get_variable
/* 1991F8 8026A918 26520004 */ addiu $s2, $s2, 4
/* 1991FC 8026A91C 0040202D */ daddu $a0, $v0, $zero
/* 199200 8026A920 2402FF81 */ addiu $v0, $zero, -0x7f
/* 199204 8026A924 14820002 */ bne $a0, $v0, .L8026A930
/* 199208 8026A928 00000000 */ nop
/* 19920C 8026A92C 8E840148 */ lw $a0, 0x148($s4)
.L8026A930:
/* 199210 8026A930 0C09A75B */ jal get_actor
/* 199214 8026A934 00000000 */ nop
/* 199218 8026A938 8E450000 */ lw $a1, ($s2)
/* 19921C 8026A93C 26520004 */ addiu $s2, $s2, 4
/* 199220 8026A940 C44000D4 */ lwc1 $f0, 0xd4($v0)
/* 199224 8026A944 C44200DC */ lwc1 $f2, 0xdc($v0)
/* 199228 8026A948 8E500000 */ lw $s0, ($s2)
/* 19922C 8026A94C 4600010D */ trunc.w.s $f4, $f0
/* 199230 8026A950 44062000 */ mfc1 $a2, $f4
/* 199234 8026A954 C44000D8 */ lwc1 $f0, 0xd8($v0)
/* 199238 8026A958 8E520004 */ lw $s2, 4($s2)
/* 19923C 8026A95C 4600010D */ trunc.w.s $f4, $f0
/* 199240 8026A960 44112000 */ mfc1 $s1, $f4
/* 199244 8026A964 4600110D */ trunc.w.s $f4, $f2
/* 199248 8026A968 44132000 */ mfc1 $s3, $f4
/* 19924C 8026A96C 0C0B2026 */ jal set_variable
/* 199250 8026A970 0280202D */ daddu $a0, $s4, $zero
/* 199254 8026A974 0280202D */ daddu $a0, $s4, $zero
/* 199258 8026A978 0200282D */ daddu $a1, $s0, $zero
/* 19925C 8026A97C 0C0B2026 */ jal set_variable
/* 199260 8026A980 0220302D */ daddu $a2, $s1, $zero
/* 199264 8026A984 0280202D */ daddu $a0, $s4, $zero
/* 199268 8026A988 0240282D */ daddu $a1, $s2, $zero
/* 19926C 8026A98C 0C0B2026 */ jal set_variable
/* 199270 8026A990 0260302D */ daddu $a2, $s3, $zero
/* 199274 8026A994 8FBF0024 */ lw $ra, 0x24($sp)
/* 199278 8026A998 8FB40020 */ lw $s4, 0x20($sp)
/* 19927C 8026A99C 8FB3001C */ lw $s3, 0x1c($sp)
/* 199280 8026A9A0 8FB20018 */ lw $s2, 0x18($sp)
/* 199284 8026A9A4 8FB10014 */ lw $s1, 0x14($sp)
/* 199288 8026A9A8 8FB00010 */ lw $s0, 0x10($sp)
/* 19928C 8026A9AC 24020002 */ addiu $v0, $zero, 2
/* 199290 8026A9B0 03E00008 */ jr $ra
/* 199294 8026A9B4 27BD0028 */ addiu $sp, $sp, 0x28

View File

@ -1,65 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel GetPartTarget
/* 199298 8026A9B8 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 19929C 8026A9BC AFB40020 */ sw $s4, 0x20($sp)
/* 1992A0 8026A9C0 0080A02D */ daddu $s4, $a0, $zero
/* 1992A4 8026A9C4 AFBF0024 */ sw $ra, 0x24($sp)
/* 1992A8 8026A9C8 AFB3001C */ sw $s3, 0x1c($sp)
/* 1992AC 8026A9CC AFB20018 */ sw $s2, 0x18($sp)
/* 1992B0 8026A9D0 AFB10014 */ sw $s1, 0x14($sp)
/* 1992B4 8026A9D4 AFB00010 */ sw $s0, 0x10($sp)
/* 1992B8 8026A9D8 8E92000C */ lw $s2, 0xc($s4)
/* 1992BC 8026A9DC 8E450000 */ lw $a1, ($s2)
/* 1992C0 8026A9E0 0C0B1EAF */ jal get_variable
/* 1992C4 8026A9E4 26520004 */ addiu $s2, $s2, 4
/* 1992C8 8026A9E8 0040802D */ daddu $s0, $v0, $zero
/* 1992CC 8026A9EC 8E450000 */ lw $a1, ($s2)
/* 1992D0 8026A9F0 26520004 */ addiu $s2, $s2, 4
/* 1992D4 8026A9F4 0C0B1EAF */ jal get_variable
/* 1992D8 8026A9F8 0280202D */ daddu $a0, $s4, $zero
/* 1992DC 8026A9FC 0040882D */ daddu $s1, $v0, $zero
/* 1992E0 8026AA00 2402FF81 */ addiu $v0, $zero, -0x7f
/* 1992E4 8026AA04 16020002 */ bne $s0, $v0, .L8026AA10
/* 1992E8 8026AA08 00000000 */ nop
/* 1992EC 8026AA0C 8E900148 */ lw $s0, 0x148($s4)
.L8026AA10:
/* 1992F0 8026AA10 0C09A75B */ jal get_actor
/* 1992F4 8026AA14 0200202D */ daddu $a0, $s0, $zero
/* 1992F8 8026AA18 0040202D */ daddu $a0, $v0, $zero
/* 1992FC 8026AA1C 0C099117 */ jal get_actor_part
/* 199300 8026AA20 0220282D */ daddu $a1, $s1, $zero
/* 199304 8026AA24 8E450000 */ lw $a1, ($s2)
/* 199308 8026AA28 26520004 */ addiu $s2, $s2, 4
/* 19930C 8026AA2C 8C420010 */ lw $v0, 0x10($v0)
/* 199310 8026AA30 8E500000 */ lw $s0, ($s2)
/* 199314 8026AA34 C440000C */ lwc1 $f0, 0xc($v0)
/* 199318 8026AA38 8E520004 */ lw $s2, 4($s2)
/* 19931C 8026AA3C 4600010D */ trunc.w.s $f4, $f0
/* 199320 8026AA40 44062000 */ mfc1 $a2, $f4
/* 199324 8026AA44 C4400010 */ lwc1 $f0, 0x10($v0)
/* 199328 8026AA48 C4420014 */ lwc1 $f2, 0x14($v0)
/* 19932C 8026AA4C 4600010D */ trunc.w.s $f4, $f0
/* 199330 8026AA50 44112000 */ mfc1 $s1, $f4
/* 199334 8026AA54 4600110D */ trunc.w.s $f4, $f2
/* 199338 8026AA58 44132000 */ mfc1 $s3, $f4
/* 19933C 8026AA5C 0C0B2026 */ jal set_variable
/* 199340 8026AA60 0280202D */ daddu $a0, $s4, $zero
/* 199344 8026AA64 0280202D */ daddu $a0, $s4, $zero
/* 199348 8026AA68 0200282D */ daddu $a1, $s0, $zero
/* 19934C 8026AA6C 0C0B2026 */ jal set_variable
/* 199350 8026AA70 0220302D */ daddu $a2, $s1, $zero
/* 199354 8026AA74 0280202D */ daddu $a0, $s4, $zero
/* 199358 8026AA78 0240282D */ daddu $a1, $s2, $zero
/* 19935C 8026AA7C 0C0B2026 */ jal set_variable
/* 199360 8026AA80 0260302D */ daddu $a2, $s3, $zero
/* 199364 8026AA84 8FBF0024 */ lw $ra, 0x24($sp)
/* 199368 8026AA88 8FB40020 */ lw $s4, 0x20($sp)
/* 19936C 8026AA8C 8FB3001C */ lw $s3, 0x1c($sp)
/* 199370 8026AA90 8FB20018 */ lw $s2, 0x18($sp)
/* 199374 8026AA94 8FB10014 */ lw $s1, 0x14($sp)
/* 199378 8026AA98 8FB00010 */ lw $s0, 0x10($sp)
/* 19937C 8026AA9C 24020002 */ addiu $v0, $zero, 2
/* 199380 8026AAA0 03E00008 */ jr $ra
/* 199384 8026AAA4 27BD0028 */ addiu $sp, $sp, 0x28

View File

@ -1008,7 +1008,7 @@ typedef struct SelectableTarget {
typedef struct ActorPartMovement { typedef struct ActorPartMovement {
/* 0x00 */ char unk_00[12]; /* 0x00 */ char unk_00[12];
/* 0x0C */ f32 goalPos[3]; /* 0x0C */ Vec3f goalPos;
/* 0x18 */ char unk_18[12]; /* 0x18 */ char unk_18[12];
/* 0x24 */ f32 jumpScale; /* 0x24 */ f32 jumpScale;
/* 0x28 */ f32 moveSpeed; /* 0x28 */ f32 moveSpeed;

View File

@ -1,7 +1,7 @@
#include "common.h" #include "common.h"
void get_dpad_input_radial(f32* angle, f32* magnitude) { void get_dpad_input_radial(f32* angle, f32* magnitude) {
BattleStatus* battleStatus = &gBattleStatus; BattleStatus* battleStatus = BATTLE_STATUS;
u16 currentButtonsDown; u16 currentButtonsDown;
f32 stickX; f32 stickX;
f32 stickY; f32 stickY;

View File

@ -40,7 +40,7 @@ HitResult calc_item_check_hit(void) {
INCLUDE_ASM(s32, "code_17FEB0", calc_item_damage_enemy); INCLUDE_ASM(s32, "code_17FEB0", calc_item_damage_enemy);
ApiStatus ItemDamageEnemy(ScriptInstance* script, s32 isInitialCall) { ApiStatus ItemDamageEnemy(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus; BattleStatus* battleStatus = BATTLE_STATUS;
Bytecode* args = script->ptrReadPos; Bytecode* args = script->ptrReadPos;
s32 itemDamageOut = *args++; s32 itemDamageOut = *args++;
s32 a5; s32 a5;
@ -107,7 +107,7 @@ ApiStatus ItemDamageEnemy(ScriptInstance* script, s32 isInitialCall) {
} }
ApiStatus ItemAfflictEnemy(ScriptInstance* script, s32 isInitialCall) { ApiStatus ItemAfflictEnemy(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus; BattleStatus* battleStatus = BATTLE_STATUS;
Bytecode* args = script->ptrReadPos; Bytecode* args = script->ptrReadPos;
s32 itemDamageOut = *args++; s32 itemDamageOut = *args++;
s32 a5; s32 a5;
@ -175,7 +175,7 @@ ApiStatus ItemAfflictEnemy(ScriptInstance* script, s32 isInitialCall) {
} }
ApiStatus func_80252B3C(ScriptInstance* script, s32 isInitialCall) { ApiStatus func_80252B3C(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus; BattleStatus* battleStatus = BATTLE_STATUS;
Bytecode* args = script->ptrReadPos; Bytecode* args = script->ptrReadPos;
s32 itemDamageOut = *args++; s32 itemDamageOut = *args++;
s32 a5; s32 a5;
@ -242,7 +242,7 @@ ApiStatus func_80252B3C(ScriptInstance* script, s32 isInitialCall) {
} }
ApiStatus ItemCheckHit(ScriptInstance* script, s32 isInitialCall) { ApiStatus ItemCheckHit(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus; BattleStatus* battleStatus = BATTLE_STATUS;
Bytecode* args = script->ptrReadPos; Bytecode* args = script->ptrReadPos;
s32 itemDamageOut = *args++; s32 itemDamageOut = *args++;
s32 a5; s32 a5;

View File

@ -358,7 +358,7 @@ void func_80071A50(s32, f32 x, f32 y, f32 z, f32 scale /* maybe */, s32);
void func_80071C30(s32, f32 x, f32 y, f32 z, f32 scale /* maybe */, s32); void func_80071C30(s32, f32 x, f32 y, f32 z, f32 scale /* maybe */, s32);
void remove_player_buffs(PlayerBuff buffs) { void remove_player_buffs(PlayerBuff buffs) {
BattleStatus* battleStatus = &gBattleStatus; BattleStatus* battleStatus = BATTLE_STATUS;
Actor* player = battleStatus->playerActor; Actor* player = battleStatus->playerActor;
Actor* partner = battleStatus->partnerActor; Actor* partner = battleStatus->partnerActor;
ActorPart* playerPartsTable = player->partsTable; ActorPart* playerPartsTable = player->partsTable;
@ -415,7 +415,7 @@ void remove_player_buffs(PlayerBuff buffs) {
} }
if ((partner != NULL) && (buffs & 0x10000)) { if ((partner != NULL) && (buffs & 0x10000)) {
BattleStatus* bs = &gBattleStatus; BattleStatus* bs = BATTLE_STATUS;
partner->isGlowing = FALSE; partner->isGlowing = FALSE;
bs->flags1 &= ~0x40000000; bs->flags1 &= ~0x40000000;

View File

@ -5,7 +5,7 @@ INCLUDE_ASM(s32, "code_1967B0", LoadItemScript);
INCLUDE_ASM(s32, "code_1967B0", LoadFreeItemScript); INCLUDE_ASM(s32, "code_1967B0", LoadFreeItemScript);
ApiStatus LoadMoveScript(ScriptInstance* script, s32 isInitialCall) { ApiStatus LoadMoveScript(ScriptInstance* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus; BattleStatus* battleStatus = BATTLE_STATUS;
s32* moveScript = gMoveScriptTable[battleStatus->selectedMoveID]; s32* moveScript = gMoveScriptTable[battleStatus->selectedMoveID];
dma_copy(moveScript[0], moveScript[1], moveScript[2]); dma_copy(moveScript[0], moveScript[1], moveScript[2]);

View File

@ -1,7 +1,7 @@
#include "common.h" #include "common.h"
s32 count_targets(Actor* actor, s32 targetHomeIndex, s32 targetSelectionFlags) { s32 count_targets(Actor* actor, s32 targetHomeIndex, s32 targetSelectionFlags) {
BattleStatus* battleStatus = &gBattleStatus; BattleStatus* battleStatus = BATTLE_STATUS;
battleStatus->targetHomeIndex = targetHomeIndex; battleStatus->targetHomeIndex = targetHomeIndex;
battleStatus->currentTargetListFlags = targetSelectionFlags; battleStatus->currentTargetListFlags = targetSelectionFlags;
@ -338,7 +338,6 @@ ApiStatus AddGoalPos(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos; Bytecode* args = script->ptrReadPos;
ActorID actorID = get_variable(script, *args++); ActorID actorID = get_variable(script, *args++);
Actor* actor; Actor* actor;
SelectableTarget* target;
f32 x, y, z; f32 x, y, z;
if (actorID == ActorID_SELF) { if (actorID == ActorID_SELF) {
@ -357,13 +356,121 @@ ApiStatus AddGoalPos(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_DONE2; return ApiStatus_DONE2;
} }
INCLUDE_ASM(s32, "code_197F40", GetGoalPos); ApiStatus GetGoalPos(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
ActorID actorID = get_variable(script, *args++);
Actor* actor;
s32 outX, outY, outZ;
s32 x, y, z;
INCLUDE_ASM(s32, "code_197F40", GetIdleGoal); if (actorID == ActorID_SELF) {
actorID = script->owner1.actorID;
}
INCLUDE_ASM(s32, "code_197F40", GetPartTarget); actor = get_actor(actorID);
INCLUDE_ASM(s32, "code_197F40", GetActorPos); outX = *args++;
outY = *args++;
outZ = *args++;
x = actor->movePos.goal.x;
y = actor->movePos.goal.y;
z = actor->movePos.goal.z;
set_variable(script, outX, x);
set_variable(script, outY, y);
set_variable(script, outZ, z);
return ApiStatus_DONE2;
}
// should this be renamed to GetFlyGoal ?
ApiStatus GetIdleGoal(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
ActorID actorID = get_variable(script, *args++);
Actor* actor;
s32 outX, outY, outZ;
s32 x, y, z;
if (actorID == ActorID_SELF) {
actorID = script->owner1.actorID;
}
actor = get_actor(actorID);
outX = *args++;
outY = *args++;
outZ = *args++;
x = actor->flyPos.goal.x;
y = actor->flyPos.goal.y;
z = actor->flyPos.goal.z;
set_variable(script, outX, x);
set_variable(script, outY, y);
set_variable(script, outZ, z);
return ApiStatus_DONE2;
}
ApiStatus GetPartTarget(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
ActorID actorID = get_variable(script, *args++);
s32 partIndex = get_variable(script, *args++);
Actor* actor;
ActorPart* actorPart;
s32 outX, outY, outZ;
s32 x, y, z;
if (actorID == ActorID_SELF) {
actorID = script->owner1.actorID;
}
actor = get_actor(actorID);
actorPart = get_actor_part(actor, partIndex);
outX = *args++;
outY = *args++;
outZ = *args++;
x = actorPart->movement->goalPos.x;
y = actorPart->movement->goalPos.y;
z = actorPart->movement->goalPos.z;
set_variable(script, outX, x);
set_variable(script, outY, y);
set_variable(script, outZ, z);
return ApiStatus_DONE2;
}
ApiStatus GetActorPos(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
ActorID actorID = get_variable(script, *args++);
Actor* actor;
s32 outX, outY, outZ;
s32 x, y, z;
if (actorID == ActorID_SELF) {
actorID = script->owner1.actorID;
}
actor = get_actor(actorID);
outX = *args++;
outY = *args++;
outZ = *args++;
x = actor->currentPos.x;
y = actor->currentPos.y;
z = actor->currentPos.z;
set_variable(script, outX, x);
set_variable(script, outY, y);
set_variable(script, outZ, z);
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_197F40", GetPartOffset); INCLUDE_ASM(s32, "code_197F40", GetPartOffset);
@ -563,7 +670,7 @@ ApiStatus SetBattleInputMask(ScriptInstance* script, s32 isInitialCall) {
ApiStatus SetBattleInputButtons(ScriptInstance* script, s32 isInitialCall) { ApiStatus SetBattleInputButtons(ScriptInstance* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos; Bytecode* args = script->ptrReadPos;
BattleStatus* battleStatus = &gBattleStatus; BattleStatus* battleStatus = BATTLE_STATUS;
s32 currentButtonsDown = *args++; s32 currentButtonsDown = *args++;
s32 currentButtonsPressed = *args++; s32 currentButtonsPressed = *args++;
s32 currentButtonsHeld = *args; s32 currentButtonsHeld = *args;
@ -762,7 +869,7 @@ INCLUDE_ASM(s32, "code_197F40", calc_player_damage_enemy);
INCLUDE_ASM(s32, "code_197F40", dispatch_damage_event_player); INCLUDE_ASM(s32, "code_197F40", dispatch_damage_event_player);
void dispatch_damage_event_player_0(s32 damageAmount, Event event) { void dispatch_damage_event_player_0(s32 damageAmount, Event event) {
BattleStatus* battleStatus = &gBattleStatus; BattleStatus* battleStatus = BATTLE_STATUS;
battleStatus->currentAttackElement = Element_END; battleStatus->currentAttackElement = Element_END;
battleStatus->unk_19A = 0; battleStatus->unk_19A = 0;