papermario/ver/us/asm/nonmatchings/npc/npc_do_player_collision.s
Ethan Roseman 3315d6010f
Splat refactor (#257)
* all non-world rodata migrated

* data disasm

* kinda working

* updated yaml

* bloop

* linker header

* configure 2.0

* bin

* mass rename to remove code_

* pause rename

* battle partner stuff

* whew

* more renames

* more renames

* more renaming

* it builds!

* updates

* remove main prefix

* one more thing

* crc, yay0

* .data, .rodata, .bss

* img

* dead_atan2

* it buildsgit add -A

* split battle/partner/6FAD10

* rm &s on sleepy_sheep syms

* sha1sum ninja rule description

* OK but commented out PaperMarioMapFS and PaperMarioNpcSprites

* uncomment

* fix mapfs

* match func_8003CFB4

* .

* clean up and name npc_iter_no_op

* npc.c

* enable cc warnings

* name npc_find_near

* use singular options.asset_path

* smores

* cc_dsl only when needed

* kinda fix configure for splat refactor2

* ok!

* new msg format

* remove old msg format docs

* slight bug fixes, splat adjustment

* git subrepo pull (merge) --force tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "cfc140bb76"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "cfc140bb76"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* git subrepo pull (merge) --force tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "85349befcd"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "85349befcd"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* Update symbol addrs

* git subrepo pull tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "a44631e194"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "a44631e194"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

Co-authored-by: Alex Bates <hi@imalex.xyz>
2021-04-13 16:47:52 +09:00

254 lines
12 KiB
ArmAsm

.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel npc_do_player_collision
/* 146D8 800392D8 27BDFFA8 */ addiu $sp, $sp, -0x58
/* 146DC 800392DC AFB1001C */ sw $s1, 0x1c($sp)
/* 146E0 800392E0 0080882D */ daddu $s1, $a0, $zero
/* 146E4 800392E4 AFBF0020 */ sw $ra, 0x20($sp)
/* 146E8 800392E8 AFB00018 */ sw $s0, 0x18($sp)
/* 146EC 800392EC F7BE0050 */ sdc1 $f30, 0x50($sp)
/* 146F0 800392F0 F7BC0048 */ sdc1 $f28, 0x48($sp)
/* 146F4 800392F4 F7BA0040 */ sdc1 $f26, 0x40($sp)
/* 146F8 800392F8 F7B80038 */ sdc1 $f24, 0x38($sp)
/* 146FC 800392FC F7B60030 */ sdc1 $f22, 0x30($sp)
/* 14700 80039300 F7B40028 */ sdc1 $f20, 0x28($sp)
/* 14704 80039304 8E230000 */ lw $v1, ($s1)
/* 14708 80039308 3C108011 */ lui $s0, %hi(gPlayerStatus)
/* 1470C 8003930C 2610EFC8 */ addiu $s0, $s0, %lo(gPlayerStatus)
/* 14710 80039310 30620100 */ andi $v0, $v1, 0x100
/* 14714 80039314 144000D1 */ bnez $v0, .L8003965C
/* 14718 80039318 0000102D */ daddu $v0, $zero, $zero
/* 1471C 8003931C 3C020400 */ lui $v0, 0x400
/* 14720 80039320 00621024 */ and $v0, $v1, $v0
/* 14724 80039324 10400003 */ beqz $v0, .L80039334
/* 14728 80039328 00000000 */ nop
.L8003932C:
/* 1472C 8003932C 0800E597 */ j .L8003965C
/* 14730 80039330 0000102D */ daddu $v0, $zero, $zero
.L80039334:
/* 14734 80039334 3C02800A */ lui $v0, %hi(D_800A0B94)
/* 14738 80039338 80420B94 */ lb $v0, %lo(D_800A0B94)($v0)
/* 1473C 8003933C 504000C7 */ beql $v0, $zero, .L8003965C
/* 14740 80039340 0000102D */ daddu $v0, $zero, $zero
/* 14744 80039344 860200B0 */ lh $v0, 0xb0($s0)
/* 14748 80039348 C604002C */ lwc1 $f4, 0x2c($s0)
/* 1474C 8003934C 44820000 */ mtc1 $v0, $f0
/* 14750 80039350 00000000 */ nop
/* 14754 80039354 46800020 */ cvt.s.w $f0, $f0
/* 14758 80039358 46002000 */ add.s $f0, $f4, $f0
/* 1475C 8003935C C622003C */ lwc1 $f2, 0x3c($s1)
/* 14760 80039360 4602003C */ c.lt.s $f0, $f2
/* 14764 80039364 00000000 */ nop
/* 14768 80039368 450100BC */ bc1t .L8003965C
/* 1476C 8003936C 0000102D */ daddu $v0, $zero, $zero
/* 14770 80039370 862200A8 */ lh $v0, 0xa8($s1)
/* 14774 80039374 44820000 */ mtc1 $v0, $f0
/* 14778 80039378 00000000 */ nop
/* 1477C 8003937C 46800020 */ cvt.s.w $f0, $f0
/* 14780 80039380 46001000 */ add.s $f0, $f2, $f0
/* 14784 80039384 4604003C */ c.lt.s $f0, $f4
/* 14788 80039388 00000000 */ nop
/* 1478C 8003938C 450100B3 */ bc1t .L8003965C
/* 14790 80039390 0000102D */ daddu $v0, $zero, $zero
/* 14794 80039394 C63A0038 */ lwc1 $f26, 0x38($s1)
/* 14798 80039398 C61E0028 */ lwc1 $f30, 0x28($s0)
/* 1479C 8003939C C61C0030 */ lwc1 $f28, 0x30($s0)
/* 147A0 800393A0 962200A6 */ lhu $v0, 0xa6($s1)
/* 147A4 800393A4 461AF581 */ sub.s $f22, $f30, $f26
/* 147A8 800393A8 960300B2 */ lhu $v1, 0xb2($s0)
/* 147AC 800393AC 00021400 */ sll $v0, $v0, 0x10
/* 147B0 800393B0 4616B082 */ mul.s $f2, $f22, $f22
/* 147B4 800393B4 00000000 */ nop
/* 147B8 800393B8 00022403 */ sra $a0, $v0, 0x10
/* 147BC 800393BC 000217C2 */ srl $v0, $v0, 0x1f
/* 147C0 800393C0 C6360040 */ lwc1 $f22, 0x40($s1)
/* 147C4 800393C4 00822021 */ addu $a0, $a0, $v0
/* 147C8 800393C8 4616E501 */ sub.s $f20, $f28, $f22
/* 147CC 800393CC 00042043 */ sra $a0, $a0, 1
/* 147D0 800393D0 00031C00 */ sll $v1, $v1, 0x10
/* 147D4 800393D4 4614A002 */ mul.s $f0, $f20, $f20
/* 147D8 800393D8 00000000 */ nop
/* 147DC 800393DC 00031403 */ sra $v0, $v1, 0x10
/* 147E0 800393E0 00031FC2 */ srl $v1, $v1, 0x1f
/* 147E4 800393E4 00431021 */ addu $v0, $v0, $v1
/* 147E8 800393E8 00021043 */ sra $v0, $v0, 1
/* 147EC 800393EC 46001300 */ add.s $f12, $f2, $f0
/* 147F0 800393F0 4484B000 */ mtc1 $a0, $f22
/* 147F4 800393F4 00000000 */ nop
/* 147F8 800393F8 4680B5A0 */ cvt.s.w $f22, $f22
/* 147FC 800393FC 4482A000 */ mtc1 $v0, $f20
/* 14800 80039400 00000000 */ nop
/* 14804 80039404 4680A520 */ cvt.s.w $f20, $f20
/* 14808 80039408 46006004 */ sqrt.s $f0, $f12
/* 1480C 8003940C 46000032 */ c.eq.s $f0, $f0
/* 14810 80039410 00000000 */ nop
/* 14814 80039414 45010003 */ bc1t .L80039424
/* 14818 80039418 4614B580 */ add.s $f22, $f22, $f20
/* 1481C 8003941C 0C0187BC */ jal sqrtf
/* 14820 80039420 00000000 */ nop
.L80039424:
/* 14824 80039424 4600B03C */ c.lt.s $f22, $f0
/* 14828 80039428 00000000 */ nop
/* 1482C 8003942C 4501FFBF */ bc1t .L8003932C
/* 14830 80039430 E7B60010 */ swc1 $f22, 0x10($sp)
/* 14834 80039434 8E020004 */ lw $v0, 4($s0)
/* 14838 80039438 34428000 */ ori $v0, $v0, 0x8000
/* 1483C 8003943C AE020004 */ sw $v0, 4($s0)
/* 14840 80039440 C63A006C */ lwc1 $f26, 0x6c($s1)
/* 14844 80039444 461AF581 */ sub.s $f22, $f30, $f26
/* 14848 80039448 4616B082 */ mul.s $f2, $f22, $f22
/* 1484C 8003944C 00000000 */ nop
/* 14850 80039450 C6360074 */ lwc1 $f22, 0x74($s1)
/* 14854 80039454 4616E501 */ sub.s $f20, $f28, $f22
/* 14858 80039458 4614A002 */ mul.s $f0, $f20, $f20
/* 1485C 8003945C 00000000 */ nop
/* 14860 80039460 46001300 */ add.s $f12, $f2, $f0
/* 14864 80039464 46006004 */ sqrt.s $f0, $f12
/* 14868 80039468 46000032 */ c.eq.s $f0, $f0
/* 1486C 8003946C 00000000 */ nop
/* 14870 80039470 45010004 */ bc1t .L80039484
/* 14874 80039474 46000606 */ mov.s $f24, $f0
/* 14878 80039478 0C0187BC */ jal sqrtf
/* 1487C 8003947C 00000000 */ nop
/* 14880 80039480 46000606 */ mov.s $f24, $f0
.L80039484:
/* 14884 80039484 4600F306 */ mov.s $f12, $f30
/* 14888 80039488 4406D000 */ mfc1 $a2, $f26
/* 1488C 8003948C 4407B000 */ mfc1 $a3, $f22
/* 14890 80039490 0C00A720 */ jal atan2
/* 14894 80039494 4600E386 */ mov.s $f14, $f28
/* 14898 80039498 3C0140C9 */ lui $at, 0x40c9
/* 1489C 8003949C 34210FD0 */ ori $at, $at, 0xfd0
/* 148A0 800394A0 4481A000 */ mtc1 $at, $f20
/* 148A4 800394A4 46000686 */ mov.s $f26, $f0
/* 148A8 800394A8 4614D502 */ mul.s $f20, $f26, $f20
/* 148AC 800394AC 00000000 */ nop
/* 148B0 800394B0 3C0143B4 */ lui $at, 0x43b4
/* 148B4 800394B4 44810000 */ mtc1 $at, $f0
/* 148B8 800394B8 C7A80010 */ lwc1 $f8, 0x10($sp)
/* 148BC 800394BC C61C0080 */ lwc1 $f28, 0x80($s0)
/* 148C0 800394C0 46184601 */ sub.s $f24, $f8, $f24
/* 148C4 800394C4 4600A503 */ div.s $f20, $f20, $f0
/* 148C8 800394C8 0C00A85B */ jal sin_rad
/* 148CC 800394CC 4600A306 */ mov.s $f12, $f20
/* 148D0 800394D0 4600C582 */ mul.s $f22, $f24, $f0
/* 148D4 800394D4 00000000 */ nop
/* 148D8 800394D8 0C00A874 */ jal cos_rad
/* 148DC 800394DC 4600A306 */ mov.s $f12, $f20
/* 148E0 800394E0 3C030040 */ lui $v1, 0x40
/* 148E4 800394E4 8E020004 */ lw $v0, 4($s0)
/* 148E8 800394E8 4600C087 */ neg.s $f2, $f24
/* 148EC 800394EC 46001502 */ mul.s $f20, $f2, $f0
/* 148F0 800394F0 00000000 */ nop
/* 148F4 800394F4 00431024 */ and $v0, $v0, $v1
/* 148F8 800394F8 1040002D */ beqz $v0, .L800395B0
/* 148FC 800394FC 4600D306 */ mov.s $f12, $f26
/* 14900 80039500 0C00A70A */ jal get_clamped_angle_diff
/* 14904 80039504 4600E386 */ mov.s $f14, $f28
/* 14908 80039508 3C014234 */ lui $at, 0x4234
/* 1490C 8003950C 44811000 */ mtc1 $at, $f2
/* 14910 80039510 46000005 */ abs.s $f0, $f0
/* 14914 80039514 4602003C */ c.lt.s $f0, $f2
/* 14918 80039518 00000000 */ nop
/* 1491C 8003951C 4500000E */ bc1f .L80039558
/* 14920 80039520 00000000 */ nop
/* 14924 80039524 C6020028 */ lwc1 $f2, 0x28($s0)
/* 14928 80039528 46161081 */ sub.s $f2, $f2, $f22
/* 1492C 8003952C C6000030 */ lwc1 $f0, 0x30($s0)
/* 14930 80039530 3C028011 */ lui $v0, %hi(wPartnerNpc)
/* 14934 80039534 8C42C930 */ lw $v0, %lo(wPartnerNpc)($v0)
/* 14938 80039538 46140001 */ sub.s $f0, $f0, $f20
/* 1493C 8003953C E6020028 */ swc1 $f2, 0x28($s0)
/* 14940 80039540 E6000030 */ swc1 $f0, 0x30($s0)
/* 14944 80039544 C4420038 */ lwc1 $f2, 0x38($v0)
/* 14948 80039548 46161081 */ sub.s $f2, $f2, $f22
/* 1494C 8003954C C4400040 */ lwc1 $f0, 0x40($v0)
/* 14950 80039550 0800E569 */ j .L800395A4
/* 14954 80039554 46140001 */ sub.s $f0, $f0, $f20
.L80039558:
/* 14958 80039558 3C013F00 */ lui $at, 0x3f00
/* 1495C 8003955C 44812000 */ mtc1 $at, $f4
/* 14960 80039560 00000000 */ nop
/* 14964 80039564 4604B182 */ mul.s $f6, $f22, $f4
/* 14968 80039568 00000000 */ nop
/* 1496C 8003956C 4604A102 */ mul.s $f4, $f20, $f4
/* 14970 80039570 00000000 */ nop
/* 14974 80039574 C6020028 */ lwc1 $f2, 0x28($s0)
/* 14978 80039578 46061081 */ sub.s $f2, $f2, $f6
/* 1497C 8003957C C6000030 */ lwc1 $f0, 0x30($s0)
/* 14980 80039580 3C028011 */ lui $v0, %hi(wPartnerNpc)
/* 14984 80039584 8C42C930 */ lw $v0, %lo(wPartnerNpc)($v0)
/* 14988 80039588 46040001 */ sub.s $f0, $f0, $f4
/* 1498C 8003958C E6020028 */ swc1 $f2, 0x28($s0)
/* 14990 80039590 E6000030 */ swc1 $f0, 0x30($s0)
/* 14994 80039594 C4420038 */ lwc1 $f2, 0x38($v0)
/* 14998 80039598 46061081 */ sub.s $f2, $f2, $f6
/* 1499C 8003959C C4400040 */ lwc1 $f0, 0x40($v0)
/* 149A0 800395A0 46040001 */ sub.s $f0, $f0, $f4
.L800395A4:
/* 149A4 800395A4 E4420038 */ swc1 $f2, 0x38($v0)
/* 149A8 800395A8 0800E590 */ j .L80039640
/* 149AC 800395AC E4400040 */ swc1 $f0, 0x40($v0)
.L800395B0:
/* 149B0 800395B0 8E020000 */ lw $v0, ($s0)
/* 149B4 800395B4 30420006 */ andi $v0, $v0, 6
/* 149B8 800395B8 10400006 */ beqz $v0, .L800395D4
/* 149BC 800395BC 00000000 */ nop
/* 149C0 800395C0 3C013ECC */ lui $at, 0x3ecc
/* 149C4 800395C4 3421CCCD */ ori $at, $at, 0xcccd
/* 149C8 800395C8 44812000 */ mtc1 $at, $f4
/* 149CC 800395CC 0800E586 */ j .L80039618
/* 149D0 800395D0 00000000 */ nop
.L800395D4:
/* 149D4 800395D4 0C00A70A */ jal get_clamped_angle_diff
/* 149D8 800395D8 4600E386 */ mov.s $f14, $f28
/* 149DC 800395DC 3C014234 */ lui $at, 0x4234
/* 149E0 800395E0 44811000 */ mtc1 $at, $f2
/* 149E4 800395E4 46000005 */ abs.s $f0, $f0
/* 149E8 800395E8 4602003C */ c.lt.s $f0, $f2
/* 149EC 800395EC 00000000 */ nop
/* 149F0 800395F0 45000006 */ bc1f .L8003960C
/* 149F4 800395F4 00000000 */ nop
/* 149F8 800395F8 C6020028 */ lwc1 $f2, 0x28($s0)
/* 149FC 800395FC 46161081 */ sub.s $f2, $f2, $f22
/* 14A00 80039600 C6000030 */ lwc1 $f0, 0x30($s0)
/* 14A04 80039604 0800E58E */ j .L80039638
/* 14A08 80039608 46140001 */ sub.s $f0, $f0, $f20
.L8003960C:
/* 14A0C 8003960C 3C013F00 */ lui $at, 0x3f00
/* 14A10 80039610 44812000 */ mtc1 $at, $f4
/* 14A14 80039614 00000000 */ nop
.L80039618:
/* 14A18 80039618 4604B002 */ mul.s $f0, $f22, $f4
/* 14A1C 8003961C 00000000 */ nop
/* 14A20 80039620 4604A102 */ mul.s $f4, $f20, $f4
/* 14A24 80039624 00000000 */ nop
/* 14A28 80039628 C6020028 */ lwc1 $f2, 0x28($s0)
/* 14A2C 8003962C 46001081 */ sub.s $f2, $f2, $f0
/* 14A30 80039630 C6000030 */ lwc1 $f0, 0x30($s0)
/* 14A34 80039634 46040001 */ sub.s $f0, $f0, $f4
.L80039638:
/* 14A38 80039638 E6020028 */ swc1 $f2, 0x28($s0)
/* 14A3C 8003963C E6000030 */ swc1 $f0, 0x30($s0)
.L80039640:
/* 14A40 80039640 C620006C */ lwc1 $f0, 0x6c($s1)
/* 14A44 80039644 C6220070 */ lwc1 $f2, 0x70($s1)
/* 14A48 80039648 C6240074 */ lwc1 $f4, 0x74($s1)
/* 14A4C 8003964C 24020001 */ addiu $v0, $zero, 1
/* 14A50 80039650 E6200038 */ swc1 $f0, 0x38($s1)
/* 14A54 80039654 E622003C */ swc1 $f2, 0x3c($s1)
/* 14A58 80039658 E6240040 */ swc1 $f4, 0x40($s1)
.L8003965C:
/* 14A5C 8003965C 8FBF0020 */ lw $ra, 0x20($sp)
/* 14A60 80039660 8FB1001C */ lw $s1, 0x1c($sp)
/* 14A64 80039664 8FB00018 */ lw $s0, 0x18($sp)
/* 14A68 80039668 D7BE0050 */ ldc1 $f30, 0x50($sp)
/* 14A6C 8003966C D7BC0048 */ ldc1 $f28, 0x48($sp)
/* 14A70 80039670 D7BA0040 */ ldc1 $f26, 0x40($sp)
/* 14A74 80039674 D7B80038 */ ldc1 $f24, 0x38($sp)
/* 14A78 80039678 D7B60030 */ ldc1 $f22, 0x30($sp)
/* 14A7C 8003967C D7B40028 */ ldc1 $f20, 0x28($sp)
/* 14A80 80039680 03E00008 */ jr $ra
/* 14A84 80039684 27BD0058 */ addiu $sp, $sp, 0x58