Merge pull request #32 from JoshW-7/master

More NPC functions
This commit is contained in:
Ethan Roseman 2020-08-19 22:57:22 -04:00 committed by GitHub
commit 703668e3e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 176 additions and 451 deletions

View File

@ -1,55 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_802B7000
/* E20EB0 802B7000 3C014387 */ lui $at, 0x4387
/* E20EB4 802B7004 44810000 */ mtc1 $at, $f0
/* E20EB8 802B7008 00000000 */ nop
/* E20EBC 802B700C 460C003E */ c.le.s $f0, $f12
/* E20EC0 802B7010 00000000 */ nop
/* E20EC4 802B7014 45000009 */ bc1f .L802B703C
/* E20EC8 802B7018 240200FF */ addiu $v0, $zero, 0xff
/* E20ECC 802B701C 3C0143B4 */ lui $at, 0x43b4
/* E20ED0 802B7020 44810000 */ mtc1 $at, $f0
/* E20ED4 802B7024 00000000 */ nop
/* E20ED8 802B7028 460C0001 */ sub.s $f0, $f0, $f12
/* E20EDC 802B702C 4600010D */ trunc.w.s $f4, $f0
/* E20EE0 802B7030 44032000 */ mfc1 $v1, $f4
/* E20EE4 802B7034 080ADC2B */ j .L802B70AC
/* E20EE8 802B7038 00431023 */ subu $v0, $v0, $v1
.L802B703C:
/* E20EEC 802B703C 3C014334 */ lui $at, 0x4334
/* E20EF0 802B7040 44811000 */ mtc1 $at, $f2
/* E20EF4 802B7044 00000000 */ nop
/* E20EF8 802B7048 460C103E */ c.le.s $f2, $f12
/* E20EFC 802B704C 00000000 */ nop
/* E20F00 802B7050 45000006 */ bc1f .L802B706C
/* E20F04 802B7054 00000000 */ nop
/* E20F08 802B7058 46026001 */ sub.s $f0, $f12, $f2
/* E20F0C 802B705C 4600010D */ trunc.w.s $f4, $f0
/* E20F10 802B7060 44032000 */ mfc1 $v1, $f4
/* E20F14 802B7064 080ADC2B */ j .L802B70AC
/* E20F18 802B7068 00431023 */ subu $v0, $v0, $v1
.L802B706C:
/* E20F1C 802B706C 3C0142B4 */ lui $at, 0x42b4
/* E20F20 802B7070 44810000 */ mtc1 $at, $f0
/* E20F24 802B7074 00000000 */ nop
/* E20F28 802B7078 460C003E */ c.le.s $f0, $f12
/* E20F2C 802B707C 00000000 */ nop
/* E20F30 802B7080 45000006 */ bc1f .L802B709C
/* E20F34 802B7084 240200FF */ addiu $v0, $zero, 0xff
/* E20F38 802B7088 460C1001 */ sub.s $f0, $f2, $f12
/* E20F3C 802B708C 4600010D */ trunc.w.s $f4, $f0
/* E20F40 802B7090 44032000 */ mfc1 $v1, $f4
/* E20F44 802B7094 080ADC2B */ j .L802B70AC
/* E20F48 802B7098 00431023 */ subu $v0, $v0, $v1
.L802B709C:
/* E20F4C 802B709C 4600610D */ trunc.w.s $f4, $f12
/* E20F50 802B70A0 44032000 */ mfc1 $v1, $f4
/* E20F54 802B70A4 00000000 */ nop
/* E20F58 802B70A8 00431023 */ subu $v0, $v0, $v1
.L802B70AC:
/* E20F5C 802B70AC 03E00008 */ jr $ra
/* E20F60 802B70B0 00431023 */ subu $v0, $v0, $v1

View File

@ -1,26 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel ClearPartnerMoveHistory
/* 0F3D20 802CF370 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F3D24 802CF374 AFB00010 */ sw $s0, 0x10($sp)
/* 0F3D28 802CF378 0080802D */ daddu $s0, $a0, $zero
/* 0F3D2C 802CF37C AFBF0014 */ sw $ra, 0x14($sp)
/* 0F3D30 802CF380 8E02000C */ lw $v0, 0xc($s0)
/* 0F3D34 802CF384 0C0B1EAF */ jal get_variable
/* 0F3D38 802CF388 8C450000 */ lw $a1, ($v0)
/* 0F3D3C 802CF38C 0200202D */ daddu $a0, $s0, $zero
/* 0F3D40 802CF390 0C0B36B0 */ jal resolve_npc
/* 0F3D44 802CF394 0040282D */ daddu $a1, $v0, $zero
/* 0F3D48 802CF398 50400004 */ beql $v0, $zero, .L802CF3AC
/* 0F3D4C 802CF39C 24020002 */ addiu $v0, $zero, 2
/* 0F3D50 802CF3A0 0C03BD17 */ jal clear_partner_move_history
/* 0F3D54 802CF3A4 0040202D */ daddu $a0, $v0, $zero
/* 0F3D58 802CF3A8 24020002 */ addiu $v0, $zero, 2
.L802CF3AC:
/* 0F3D5C 802CF3AC 8FBF0014 */ lw $ra, 0x14($sp)
/* 0F3D60 802CF3B0 8FB00010 */ lw $s0, 0x10($sp)
/* 0F3D64 802CF3B4 03E00008 */ jr $ra
/* 0F3D68 802CF3B8 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,26 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel DisablePartnerAI
/* 0F3E98 802CF4E8 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F3E9C 802CF4EC AFBF0010 */ sw $ra, 0x10($sp)
/* 0F3EA0 802CF4F0 8C82000C */ lw $v0, 0xc($a0)
/* 0F3EA4 802CF4F4 0C0B1EAF */ jal get_variable
/* 0F3EA8 802CF4F8 8C450000 */ lw $a1, ($v0)
/* 0F3EAC 802CF4FC 14400005 */ bnez $v0, .L802CF514
/* 0F3EB0 802CF500 00000000 */ nop
/* 0F3EB4 802CF504 0C03BCC5 */ jal func_800EF314
/* 0F3EB8 802CF508 00000000 */ nop
/* 0F3EBC 802CF50C 080B3D47 */ j .L802CF51C
/* 0F3EC0 802CF510 00000000 */ nop
.L802CF514:
/* 0F3EC4 802CF514 0C03BCC0 */ jal func_800EF300
/* 0F3EC8 802CF518 00000000 */ nop
.L802CF51C:
/* 0F3ECC 802CF51C 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F3ED0 802CF520 24020002 */ addiu $v0, $zero, 2
/* 0F3ED4 802CF524 03E00008 */ jr $ra
/* 0F3ED8 802CF528 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,42 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel EnableNpcBlur
/* 0F3C9C 802CF2EC 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0F3CA0 802CF2F0 AFB10014 */ sw $s1, 0x14($sp)
/* 0F3CA4 802CF2F4 0080882D */ daddu $s1, $a0, $zero
/* 0F3CA8 802CF2F8 AFBF0018 */ sw $ra, 0x18($sp)
/* 0F3CAC 802CF2FC AFB00010 */ sw $s0, 0x10($sp)
/* 0F3CB0 802CF300 8E30000C */ lw $s0, 0xc($s1)
/* 0F3CB4 802CF304 8E050000 */ lw $a1, ($s0)
/* 0F3CB8 802CF308 0C0B1EAF */ jal get_variable
/* 0F3CBC 802CF30C 26100004 */ addiu $s0, $s0, 4
/* 0F3CC0 802CF310 0220202D */ daddu $a0, $s1, $zero
/* 0F3CC4 802CF314 8E050000 */ lw $a1, ($s0)
/* 0F3CC8 802CF318 0C0B1EAF */ jal get_variable
/* 0F3CCC 802CF31C 0040802D */ daddu $s0, $v0, $zero
/* 0F3CD0 802CF320 0220202D */ daddu $a0, $s1, $zero
/* 0F3CD4 802CF324 0200282D */ daddu $a1, $s0, $zero
/* 0F3CD8 802CF328 0C0B36B0 */ jal resolve_npc
/* 0F3CDC 802CF32C 0040802D */ daddu $s0, $v0, $zero
/* 0F3CE0 802CF330 5040000A */ beql $v0, $zero, .L802CF35C
/* 0F3CE4 802CF334 24020002 */ addiu $v0, $zero, 2
/* 0F3CE8 802CF338 12000005 */ beqz $s0, .L802CF350
/* 0F3CEC 802CF33C 00000000 */ nop
/* 0F3CF0 802CF340 0C00EB49 */ jal enable_npc_blur
/* 0F3CF4 802CF344 0040202D */ daddu $a0, $v0, $zero
/* 0F3CF8 802CF348 080B3CD7 */ j .L802CF35C
/* 0F3CFC 802CF34C 24020002 */ addiu $v0, $zero, 2
.L802CF350:
/* 0F3D00 802CF350 0C00EB6B */ jal disable_npc_blur
/* 0F3D04 802CF354 0040202D */ daddu $a0, $v0, $zero
/* 0F3D08 802CF358 24020002 */ addiu $v0, $zero, 2
.L802CF35C:
/* 0F3D0C 802CF35C 8FBF0018 */ lw $ra, 0x18($sp)
/* 0F3D10 802CF360 8FB10014 */ lw $s1, 0x14($sp)
/* 0F3D14 802CF364 8FB00010 */ lw $s0, 0x10($sp)
/* 0F3D18 802CF368 03E00008 */ jr $ra
/* 0F3D1C 802CF36C 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,42 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel EnableNpcShadow
/* 0F3C18 802CF268 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0F3C1C 802CF26C AFB10014 */ sw $s1, 0x14($sp)
/* 0F3C20 802CF270 0080882D */ daddu $s1, $a0, $zero
/* 0F3C24 802CF274 AFBF0018 */ sw $ra, 0x18($sp)
/* 0F3C28 802CF278 AFB00010 */ sw $s0, 0x10($sp)
/* 0F3C2C 802CF27C 8E30000C */ lw $s0, 0xc($s1)
/* 0F3C30 802CF280 8E050000 */ lw $a1, ($s0)
/* 0F3C34 802CF284 0C0B1EAF */ jal get_variable
/* 0F3C38 802CF288 26100004 */ addiu $s0, $s0, 4
/* 0F3C3C 802CF28C 0220202D */ daddu $a0, $s1, $zero
/* 0F3C40 802CF290 8E050000 */ lw $a1, ($s0)
/* 0F3C44 802CF294 0C0B1EAF */ jal get_variable
/* 0F3C48 802CF298 0040802D */ daddu $s0, $v0, $zero
/* 0F3C4C 802CF29C 0220202D */ daddu $a0, $s1, $zero
/* 0F3C50 802CF2A0 0200282D */ daddu $a1, $s0, $zero
/* 0F3C54 802CF2A4 0C0B36B0 */ jal resolve_npc
/* 0F3C58 802CF2A8 0040802D */ daddu $s0, $v0, $zero
/* 0F3C5C 802CF2AC 5040000A */ beql $v0, $zero, .L802CF2D8
/* 0F3C60 802CF2B0 24020002 */ addiu $v0, $zero, 2
/* 0F3C64 802CF2B4 12000005 */ beqz $s0, .L802CF2CC
/* 0F3C68 802CF2B8 00000000 */ nop
/* 0F3C6C 802CF2BC 0C00EAE8 */ jal enable_npc_shadow
/* 0F3C70 802CF2C0 0040202D */ daddu $a0, $v0, $zero
/* 0F3C74 802CF2C4 080B3CB6 */ j .L802CF2D8
/* 0F3C78 802CF2C8 24020002 */ addiu $v0, $zero, 2
.L802CF2CC:
/* 0F3C7C 802CF2CC 0C00EAFF */ jal disable_npc_shadow
/* 0F3C80 802CF2D0 0040202D */ daddu $a0, $v0, $zero
/* 0F3C84 802CF2D4 24020002 */ addiu $v0, $zero, 2
.L802CF2D8:
/* 0F3C88 802CF2D8 8FBF0018 */ lw $ra, 0x18($sp)
/* 0F3C8C 802CF2DC 8FB10014 */ lw $s1, 0x14($sp)
/* 0F3C90 802CF2E0 8FB00010 */ lw $s0, 0x10($sp)
/* 0F3C94 802CF2E4 03E00008 */ jr $ra
/* 0F3C98 802CF2E8 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,46 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel EnablePartnerAI
/* 0F3EDC 802CF52C 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F3EE0 802CF530 AFBF0010 */ sw $ra, 0x10($sp)
/* 0F3EE4 802CF534 0C03BCCA */ jal enable_partner_ai
/* 0F3EE8 802CF538 00000000 */ nop
/* 0F3EEC 802CF53C 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F3EF0 802CF540 24020002 */ addiu $v0, $zero, 2
/* 0F3EF4 802CF544 03E00008 */ jr $ra
/* 0F3EF8 802CF548 27BD0018 */ addiu $sp, $sp, 0x18
/* 0F3EFC 802CF54C 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F3F00 802CF550 AFBF0010 */ sw $ra, 0x10($sp)
/* 0F3F04 802CF554 0C03BD0F */ jal func_800EF43C
/* 0F3F08 802CF558 00000000 */ nop
/* 0F3F0C 802CF55C 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F3F10 802CF560 24020002 */ addiu $v0, $zero, 2
/* 0F3F14 802CF564 03E00008 */ jr $ra
/* 0F3F18 802CF568 27BD0018 */ addiu $sp, $sp, 0x18
/* 0F3F1C 802CF56C 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0F3F20 802CF570 AFBF0010 */ sw $ra, 0x10($sp)
/* 0F3F24 802CF574 8C82000C */ lw $v0, 0xc($a0)
/* 0F3F28 802CF578 0C0B1EAF */ jal get_variable
/* 0F3F2C 802CF57C 8C450000 */ lw $a1, ($v0)
/* 0F3F30 802CF580 0040202D */ daddu $a0, $v0, $zero
/* 0F3F34 802CF584 24020002 */ addiu $v0, $zero, 2
/* 0F3F38 802CF588 14820005 */ bne $a0, $v0, .L802CF5A0
/* 0F3F3C 802CF58C 00000000 */ nop
/* 0F3F40 802CF590 0C03BCF9 */ jal func_800EF3E4
/* 0F3F44 802CF594 00000000 */ nop
/* 0F3F48 802CF598 080B3D6A */ j .L802CF5A8
/* 0F3F4C 802CF59C 00000000 */ nop
.L802CF5A0:
/* 0F3F50 802CF5A0 0C03BCF5 */ jal func_800EF3D4
/* 0F3F54 802CF5A4 00000000 */ nop
.L802CF5A8:
/* 0F3F58 802CF5A8 8FBF0010 */ lw $ra, 0x10($sp)
/* 0F3F5C 802CF5AC 24020002 */ addiu $v0, $zero, 2
/* 0F3F60 802CF5B0 03E00008 */ jr $ra
/* 0F3F64 802CF5B4 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,51 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel GetPartnerPos
/* 0F3DE8 802CF438 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 0F3DEC 802CF43C AFB10014 */ sw $s1, 0x14($sp)
/* 0F3DF0 802CF440 0080882D */ daddu $s1, $a0, $zero
/* 0F3DF4 802CF444 AFBF0024 */ sw $ra, 0x24($sp)
/* 0F3DF8 802CF448 AFB40020 */ sw $s4, 0x20($sp)
/* 0F3DFC 802CF44C AFB3001C */ sw $s3, 0x1c($sp)
/* 0F3E00 802CF450 AFB20018 */ sw $s2, 0x18($sp)
/* 0F3E04 802CF454 AFB00010 */ sw $s0, 0x10($sp)
/* 0F3E08 802CF458 8E22000C */ lw $v0, 0xc($s1)
/* 0F3E0C 802CF45C 8C520000 */ lw $s2, ($v0)
/* 0F3E10 802CF460 24420004 */ addiu $v0, $v0, 4
/* 0F3E14 802CF464 8C530000 */ lw $s3, ($v0)
/* 0F3E18 802CF468 8C540004 */ lw $s4, 4($v0)
/* 0F3E1C 802CF46C 0C00EABB */ jal get_npc_unsafe
/* 0F3E20 802CF470 2404FFFC */ addiu $a0, $zero, -4
/* 0F3E24 802CF474 0040802D */ daddu $s0, $v0, $zero
/* 0F3E28 802CF478 12000012 */ beqz $s0, .L802CF4C4
/* 0F3E2C 802CF47C 0220202D */ daddu $a0, $s1, $zero
/* 0F3E30 802CF480 C6000038 */ lwc1 $f0, 0x38($s0)
/* 0F3E34 802CF484 4600008D */ trunc.w.s $f2, $f0
/* 0F3E38 802CF488 44061000 */ mfc1 $a2, $f2
/* 0F3E3C 802CF48C 0C0B2026 */ jal set_variable
/* 0F3E40 802CF490 0240282D */ daddu $a1, $s2, $zero
/* 0F3E44 802CF494 0220202D */ daddu $a0, $s1, $zero
/* 0F3E48 802CF498 C600003C */ lwc1 $f0, 0x3c($s0)
/* 0F3E4C 802CF49C 4600008D */ trunc.w.s $f2, $f0
/* 0F3E50 802CF4A0 44061000 */ mfc1 $a2, $f2
/* 0F3E54 802CF4A4 0C0B2026 */ jal set_variable
/* 0F3E58 802CF4A8 0260282D */ daddu $a1, $s3, $zero
/* 0F3E5C 802CF4AC 0220202D */ daddu $a0, $s1, $zero
/* 0F3E60 802CF4B0 C6000040 */ lwc1 $f0, 0x40($s0)
/* 0F3E64 802CF4B4 4600008D */ trunc.w.s $f2, $f0
/* 0F3E68 802CF4B8 44061000 */ mfc1 $a2, $f2
/* 0F3E6C 802CF4BC 0C0B2026 */ jal set_variable
/* 0F3E70 802CF4C0 0280282D */ daddu $a1, $s4, $zero
.L802CF4C4:
/* 0F3E74 802CF4C4 24020002 */ addiu $v0, $zero, 2
/* 0F3E78 802CF4C8 8FBF0024 */ lw $ra, 0x24($sp)
/* 0F3E7C 802CF4CC 8FB40020 */ lw $s4, 0x20($sp)
/* 0F3E80 802CF4D0 8FB3001C */ lw $s3, 0x1c($sp)
/* 0F3E84 802CF4D4 8FB20018 */ lw $s2, 0x18($sp)
/* 0F3E88 802CF4D8 8FB10014 */ lw $s1, 0x14($sp)
/* 0F3E8C 802CF4DC 8FB00010 */ lw $s0, 0x10($sp)
/* 0F3E90 802CF4E0 03E00008 */ jr $ra
/* 0F3E94 802CF4E4 27BD0028 */ addiu $sp, $sp, 0x28

View File

@ -1,75 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel PlaySoundAtNpc
/* 0F4B5C 802D01AC 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 0F4B60 802D01B0 AFB1001C */ sw $s1, 0x1c($sp)
/* 0F4B64 802D01B4 0080882D */ daddu $s1, $a0, $zero
/* 0F4B68 802D01B8 AFBF0024 */ sw $ra, 0x24($sp)
/* 0F4B6C 802D01BC AFB20020 */ sw $s2, 0x20($sp)
/* 0F4B70 802D01C0 AFB00018 */ sw $s0, 0x18($sp)
/* 0F4B74 802D01C4 8E30000C */ lw $s0, 0xc($s1)
/* 0F4B78 802D01C8 8E050000 */ lw $a1, ($s0)
/* 0F4B7C 802D01CC 0C0B1EAF */ jal get_variable
/* 0F4B80 802D01D0 26100004 */ addiu $s0, $s0, 4
/* 0F4B84 802D01D4 8E050000 */ lw $a1, ($s0)
/* 0F4B88 802D01D8 26100004 */ addiu $s0, $s0, 4
/* 0F4B8C 802D01DC 0220202D */ daddu $a0, $s1, $zero
/* 0F4B90 802D01E0 0C0B1EAF */ jal get_variable
/* 0F4B94 802D01E4 0040902D */ daddu $s2, $v0, $zero
/* 0F4B98 802D01E8 0220202D */ daddu $a0, $s1, $zero
/* 0F4B9C 802D01EC 8E050000 */ lw $a1, ($s0)
/* 0F4BA0 802D01F0 0C0B1EAF */ jal get_variable
/* 0F4BA4 802D01F4 0040802D */ daddu $s0, $v0, $zero
/* 0F4BA8 802D01F8 0220202D */ daddu $a0, $s1, $zero
/* 0F4BAC 802D01FC 0240282D */ daddu $a1, $s2, $zero
/* 0F4BB0 802D0200 0C0B36B0 */ jal resolve_npc
/* 0F4BB4 802D0204 0040882D */ daddu $s1, $v0, $zero
/* 0F4BB8 802D0208 10400007 */ beqz $v0, .L802D0228
/* 0F4BBC 802D020C 0200202D */ daddu $a0, $s0, $zero
/* 0F4BC0 802D0210 C4400040 */ lwc1 $f0, 0x40($v0)
/* 0F4BC4 802D0214 E7A00010 */ swc1 $f0, 0x10($sp)
/* 0F4BC8 802D0218 8C460038 */ lw $a2, 0x38($v0)
/* 0F4BCC 802D021C 8C47003C */ lw $a3, 0x3c($v0)
/* 0F4BD0 802D0220 0C052757 */ jal play_sound_at_position
/* 0F4BD4 802D0224 0220282D */ daddu $a1, $s1, $zero
.L802D0228:
/* 0F4BD8 802D0228 24020002 */ addiu $v0, $zero, 2
/* 0F4BDC 802D022C 8FBF0024 */ lw $ra, 0x24($sp)
/* 0F4BE0 802D0230 8FB20020 */ lw $s2, 0x20($sp)
/* 0F4BE4 802D0234 8FB1001C */ lw $s1, 0x1c($sp)
/* 0F4BE8 802D0238 8FB00018 */ lw $s0, 0x18($sp)
/* 0F4BEC 802D023C 03E00008 */ jr $ra
/* 0F4BF0 802D0240 27BD0028 */ addiu $sp, $sp, 0x28
/* 0F4BF4 802D0244 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 0F4BF8 802D0248 AFB10014 */ sw $s1, 0x14($sp)
/* 0F4BFC 802D024C 0080882D */ daddu $s1, $a0, $zero
/* 0F4C00 802D0250 AFBF0018 */ sw $ra, 0x18($sp)
/* 0F4C04 802D0254 AFB00010 */ sw $s0, 0x10($sp)
/* 0F4C08 802D0258 8E30000C */ lw $s0, 0xc($s1)
/* 0F4C0C 802D025C 8E050000 */ lw $a1, ($s0)
/* 0F4C10 802D0260 0C0B1EAF */ jal get_variable
/* 0F4C14 802D0264 26100004 */ addiu $s0, $s0, 4
/* 0F4C18 802D0268 0220202D */ daddu $a0, $s1, $zero
/* 0F4C1C 802D026C 8E050000 */ lw $a1, ($s0)
/* 0F4C20 802D0270 0C0B1EAF */ jal get_variable
/* 0F4C24 802D0274 0040802D */ daddu $s0, $v0, $zero
/* 0F4C28 802D0278 0220202D */ daddu $a0, $s1, $zero
/* 0F4C2C 802D027C 0200282D */ daddu $a1, $s0, $zero
/* 0F4C30 802D0280 0C0B36B0 */ jal resolve_npc
/* 0F4C34 802D0284 0040802D */ daddu $s0, $v0, $zero
/* 0F4C38 802D0288 A05000AA */ sb $s0, 0xaa($v0)
/* 0F4C3C 802D028C 8FBF0018 */ lw $ra, 0x18($sp)
/* 0F4C40 802D0290 8FB10014 */ lw $s1, 0x14($sp)
/* 0F4C44 802D0294 8FB00010 */ lw $s0, 0x10($sp)
/* 0F4C48 802D0298 24020002 */ addiu $v0, $zero, 2
/* 0F4C4C 802D029C 03E00008 */ jr $ra
/* 0F4C50 802D02A0 27BD0020 */ addiu $sp, $sp, 0x20
/* 0F4C54 802D02A4 00000000 */ nop
/* 0F4C58 802D02A8 00000000 */ nop
/* 0F4C5C 802D02AC 00000000 */ nop

View File

@ -1,44 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel SetNpcEffect
/* 0F4AC8 802D0118 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 0F4ACC 802D011C AFB10014 */ sw $s1, 0x14($sp)
/* 0F4AD0 802D0120 0080882D */ daddu $s1, $a0, $zero
/* 0F4AD4 802D0124 AFBF0020 */ sw $ra, 0x20($sp)
/* 0F4AD8 802D0128 AFB3001C */ sw $s3, 0x1c($sp)
/* 0F4ADC 802D012C AFB20018 */ sw $s2, 0x18($sp)
/* 0F4AE0 802D0130 AFB00010 */ sw $s0, 0x10($sp)
/* 0F4AE4 802D0134 8E30000C */ lw $s0, 0xc($s1)
/* 0F4AE8 802D0138 8E050000 */ lw $a1, ($s0)
/* 0F4AEC 802D013C 0C0B1EAF */ jal get_variable
/* 0F4AF0 802D0140 26100004 */ addiu $s0, $s0, 4
/* 0F4AF4 802D0144 8E050000 */ lw $a1, ($s0)
/* 0F4AF8 802D0148 26100004 */ addiu $s0, $s0, 4
/* 0F4AFC 802D014C 0220202D */ daddu $a0, $s1, $zero
/* 0F4B00 802D0150 0C0B1EAF */ jal get_variable
/* 0F4B04 802D0154 0040902D */ daddu $s2, $v0, $zero
/* 0F4B08 802D0158 0220202D */ daddu $a0, $s1, $zero
/* 0F4B0C 802D015C 8E050000 */ lw $a1, ($s0)
/* 0F4B10 802D0160 0C0B1EAF */ jal get_variable
/* 0F4B14 802D0164 0040982D */ daddu $s3, $v0, $zero
/* 0F4B18 802D0168 0220202D */ daddu $a0, $s1, $zero
/* 0F4B1C 802D016C 0240282D */ daddu $a1, $s2, $zero
/* 0F4B20 802D0170 0C0B36B0 */ jal resolve_npc
/* 0F4B24 802D0174 0040802D */ daddu $s0, $v0, $zero
/* 0F4B28 802D0178 10400004 */ beqz $v0, .L802D018C
/* 0F4B2C 802D017C 0040202D */ daddu $a0, $v0, $zero
/* 0F4B30 802D0180 0260282D */ daddu $a1, $s3, $zero
/* 0F4B34 802D0184 0C00F0F6 */ jal func_8003C3D8
/* 0F4B38 802D0188 0200302D */ daddu $a2, $s0, $zero
.L802D018C:
/* 0F4B3C 802D018C 24020002 */ addiu $v0, $zero, 2
/* 0F4B40 802D0190 8FBF0020 */ lw $ra, 0x20($sp)
/* 0F4B44 802D0194 8FB3001C */ lw $s3, 0x1c($sp)
/* 0F4B48 802D0198 8FB20018 */ lw $s2, 0x18($sp)
/* 0F4B4C 802D019C 8FB10014 */ lw $s1, 0x14($sp)
/* 0F4B50 802D01A0 8FB00010 */ lw $s0, 0x10($sp)
/* 0F4B54 802D01A4 03E00008 */ jr $ra
/* 0F4B58 802D01A8 27BD0028 */ addiu $sp, $sp, 0x28

View File

@ -40,6 +40,8 @@ extern Shadow* gWorldShadowList[60];
extern Shadow* gBattleShadowList[60];
extern Shadow** gCurrentShadowListPtr[60];
extern Camera gCameras[4];
extern f32 gGlobalTimeSpace;
extern s8 D_800A0900;

View File

@ -1,6 +1,19 @@
#include "common.h"
INCLUDE_ASM("code_e20eb0", func_802B7000);
s32 func_802B7000(f32 angle) {
s32 angleDiff;
if (angle >= 270.0f) {
angleDiff = 360.0f - angle;
} else if (angle >= 180.0f) {
angleDiff = angle - 180.0f;
} else if (angle >= 90.0f) {
angleDiff = 180.0f - angle;
} else {
angleDiff = angle;
}
return 0xFF - angleDiff - angleDiff;
}
INCLUDE_ASM("code_e20eb0", func_802B70B4);

View File

@ -99,8 +99,8 @@ void set_script_priority(ScriptInstance* script, s8 priority) {
script->priority = priority;
}
void set_script_timescale(ScriptInstance* script, f32 timeScale) {
script->timeScale = timeScale * gGlobalTimeSpace;
void set_script_timescale(ScriptInstance* script, f32 timescale) {
script->timeScale = timescale * gGlobalTimeSpace;
}
INCLUDE_ASM("code_e79b0_len_1920", set_global_timespace);

View File

@ -14,10 +14,10 @@ INCLUDE_ASM("code_f2470_len_27f0", set_npc_animation);
ApiStatus DeleteNpc(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
Npc* npcPtr = get_npc_unsafe(get_variable(script, *ptrReadPos++));
Npc* npc = get_npc_unsafe(get_variable(script, *ptrReadPos++));
if (npcPtr) {
free_npc(npcPtr);
if (npc) {
free_npc(npc);
return ApiStatus_DONE2;
}
return ApiStatus_DONE2;
@ -42,14 +42,14 @@ ApiStatus SetNpcScale(ScriptInstance* script, s32 isInitialCall) {
f32 sizeX = get_float_variable(script, *ptrReadPos++);
f32 sizeY = get_float_variable(script, *ptrReadPos++);
f32 sizeZ = get_float_variable(script, *ptrReadPos++);
Npc* npcPtr = resolve_npc(script, npcID);
Npc* npc = resolve_npc(script, npcID);
if (npcPtr != NULL) {
if (npc != NULL) {
s32 todo = 1; // TODO: Figure out why this variable and subsequent if block is required for matching
if (todo) {
npcPtr->scale.x = sizeX;
npcPtr->scale.y = sizeY;
npcPtr->scale.z = sizeZ;
npc->scale.x = sizeX;
npc->scale.y = sizeY;
npc->scale.z = sizeZ;
}
return ApiStatus_DONE2;
}
@ -61,13 +61,13 @@ ApiStatus SetNpcCollisionSize(ScriptInstance* script, s32 isInitialCall) {
NpcId npcID = get_variable(script, *ptrReadPos++);
s32 height = get_variable(script, *ptrReadPos++);
s32 radius = get_variable(script, *ptrReadPos++);
Npc* npcPtr = resolve_npc(script, npcID);
Npc* npc = resolve_npc(script, npcID);
if (npcPtr != NULL) {
if (npc != NULL) {
s32 todo = 1; // TODO: Figure out why this variable and subsequent if block is required for matching
if (todo) {
npcPtr->collisionHeight = height;
npcPtr->collisionRadius = radius;
npc->collisionHeight = height;
npc->collisionRadius = radius;
}
return ApiStatus_DONE2;
}
@ -78,10 +78,10 @@ ApiStatus SetNpcSpeed(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
f32 speed = get_float_variable(script, *ptrReadPos);
Npc* npcPtr = resolve_npc(script, npcID);
Npc* npc = resolve_npc(script, npcID);
if (npcPtr != NULL) {
npcPtr->moveSpeed = speed;
if (npc != NULL) {
npc->moveSpeed = speed;
return ApiStatus_DONE2;
}
return ApiStatus_DONE2;
@ -91,10 +91,10 @@ ApiStatus SetNpcJumpscale(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
f32 jumpScale = get_float_variable(script, *ptrReadPos);
Npc* npcPtr = resolve_npc(script, npcID);
Npc* npc = resolve_npc(script, npcID);
if (npcPtr != NULL) {
npcPtr->jumpScale = jumpScale;
if (npc != NULL) {
npc->jumpScale = jumpScale;
return ApiStatus_DONE2;
}
return ApiStatus_DONE2;
@ -104,10 +104,10 @@ ApiStatus SetNpcAnimation(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
s32 animation = get_variable(script, *ptrReadPos);
Npc* npcPtr = resolve_npc(script, npcID);
Npc* npc = resolve_npc(script, npcID);
if (npcPtr != NULL) {
set_npc_animation(npcPtr, animation);
if (npc != NULL) {
set_npc_animation(npc, animation);
return ApiStatus_DONE2;
}
return ApiStatus_DONE2;
@ -117,10 +117,10 @@ ApiStatus GetNpcAnimation(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
Bytecode outVar = *ptrReadPos++;
Npc* npcPtr = resolve_npc(script, npcID);
Npc* npc = resolve_npc(script, npcID);
if (npcPtr != NULL) {
set_variable(script, outVar, npcPtr->currentAnim);
if (npc != NULL) {
set_variable(script, outVar, npc->currentAnim);
return ApiStatus_DONE2;
}
return ApiStatus_DONE2;
@ -130,10 +130,10 @@ ApiStatus SetNpcAnimationSpeed(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
f32 animationSpeed = get_float_variable(script, *ptrReadPos++);
Npc* npcPtr = resolve_npc(script, npcID);
Npc* npc = resolve_npc(script, npcID);
if (npcPtr != NULL) {
npcPtr->animationSpeed = animationSpeed;
if (npc != NULL) {
npc->animationSpeed = animationSpeed;
return ApiStatus_DONE2;
}
return ApiStatus_DONE2;
@ -157,12 +157,12 @@ ApiStatus GetNpcYaw(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
Bytecode outVar = *ptrReadPos++;
Npc* npcPtr = resolve_npc(script, npcID);
Npc* npc = resolve_npc(script, npcID);
if (npcPtr != NULL) {
if (npc != NULL) {
s32 todo = 1; // TODO: Figure out why this variable and subsequent if block is required for matching
if (todo) {
set_variable(script, outVar, clamp_angle(npcPtr->yaw));
set_variable(script, outVar, clamp_angle(npc->yaw));
}
return ApiStatus_DONE2;
}
@ -172,10 +172,10 @@ ApiStatus GetNpcYaw(ScriptInstance* script, s32 isInitialCall) {
ApiStatus SetNpcYaw(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
Npc* npcPtr = resolve_npc(script, npcID);
Npc* npc = resolve_npc(script, npcID);
if (npcPtr != NULL) {
set_npc_yaw(npcPtr, get_variable(script, *ptrReadPos++));
if (npc != NULL) {
set_npc_yaw(npc, get_variable(script, *ptrReadPos++));
return ApiStatus_DONE2;
}
return ApiStatus_DONE2;
@ -191,19 +191,100 @@ INCLUDE_API_ASM("code_f2470_len_27f0", SetNpcFlagBits);
INCLUDE_API_ASM("code_f2470_len_27f0", GetNpcPos);
INCLUDE_API_ASM("code_f2470_len_27f0", EnableNpcShadow);
ApiStatus EnableNpcShadow(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
s32 enableShadow = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
INCLUDE_API_ASM("code_f2470_len_27f0", EnableNpcBlur);
if (npc != NULL) {
if (enableShadow) {
enable_npc_shadow(npc);
return ApiStatus_DONE2;
}
disable_npc_shadow(npc);
}
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_f2470_len_27f0", ClearPartnerMoveHistory);
ApiStatus EnableNpcBlur(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
s32 enableBlur = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
if (npc != NULL) {
if (enableBlur) {
enable_npc_blur(npc);
return ApiStatus_DONE2;
}
disable_npc_blur(npc);
}
return ApiStatus_DONE2;
}
ApiStatus ClearPartnerMoveHistory(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
if (npc != NULL) {
clear_partner_move_history(npc);
return ApiStatus_DONE2;
}
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_f2470_len_27f0", NpcSetHomePosToCurrent);
INCLUDE_API_ASM("code_f2470_len_27f0", GetPartnerPos);
ApiStatus GetPartnerPos(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
Bytecode posX = *ptrReadPos++;
Bytecode posY = *ptrReadPos++;
Bytecode posZ = *ptrReadPos++;
Npc* npc = get_npc_unsafe(-4);
INCLUDE_API_ASM("code_f2470_len_27f0", DisablePartnerAI);
if (npc != NULL) {
set_variable(script, posX, npc->pos.x);
set_variable(script, posY, npc->pos.y);
set_variable(script, posZ, npc->pos.z);
return ApiStatus_DONE2;
}
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_f2470_len_27f0", EnablePartnerAI);
ApiStatus DisablePartnerAI(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
if (get_variable(script, *ptrReadPos++) == 0) {
func_800EF314();
} else {
func_800EF300();
}
return ApiStatus_DONE2;
}
ApiStatus EnablePartnerAI(ScriptInstance* script, s32 isInitialCall) {
enable_partner_ai();
return ApiStatus_DONE2;
}
ApiStatus func_802CF54C(ScriptInstance* script, s32 isInitialCall) {
func_800EF43C();
return ApiStatus_DONE2;
}
ApiStatus func_802CF56C(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
s32 value = get_variable(script, *ptrReadPos++);
if (value == 2) {
func_800EF3E4();
} else {
func_800EF3D4(value);
}
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_f2470_len_27f0", BringPartnerOut);
@ -211,6 +292,41 @@ INCLUDE_API_ASM("code_f2470_len_27f0", PutPartnerAway);
INCLUDE_API_ASM("code_f2470_len_27f0", GetCurrentPartnerID);
INCLUDE_API_ASM("code_f2470_len_27f0", SetNpcEffect);
ApiStatus SetNpcEffect(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
s32 value1 = get_variable(script, *ptrReadPos++);
s32 value2 = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
if (npc != NULL) {
func_8003C3D8(npc, value1, value2);
return ApiStatus_DONE2;
}
return ApiStatus_DONE2;
}
ApiStatus PlaySoundAtNpc(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
SoundId soundID = get_variable(script, *ptrReadPos++);
s32 value2 = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
if (npc != NULL) {
play_sound_at_position(soundID, value2, npc->pos.x, npc->pos.y, npc->pos.z);
return ApiStatus_DONE2;
}
return ApiStatus_DONE2;
}
ApiStatus SetNpcRenderMode(ScriptInstance* script, s32 isInitialCall) {
Bytecode* ptrReadPos = script->ptrReadPos;
NpcId npcID = get_variable(script, *ptrReadPos++);
u8 renderMode = get_variable(script, *ptrReadPos++);
Npc* npc = resolve_npc(script, npcID);
npc->renderMode = renderMode;
return ApiStatus_DONE2;
}
INCLUDE_API_ASM("code_f2470_len_27f0", PlaySoundAtNpc);

View File

@ -38,6 +38,7 @@ D_800959D4 = 0x800959D4;
D_8009A5D8 = 0x8009A5D8;
D_8009A650 = 0x8009A650;
D_800A0900 = 0x800A0900;
gCameras = 0x800B1D80;
D_800DC500 = 0x800DC500;
D_8010F6D0 = 0x8010F6D0;
gBackgroundImage = 0x80200000;