papermario/ver/jp/asm/nonmatchings/13530/func_8003B274.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

269 lines
13 KiB
ArmAsm

.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_8003B274
/* 16674 8003B274 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 16678 8003B278 AFB00018 */ sw $s0, 0x18($sp)
/* 1667C 8003B27C 0080802D */ daddu $s0, $a0, $zero
/* 16680 8003B280 AFB20020 */ sw $s2, 0x20($sp)
/* 16684 8003B284 00A0902D */ daddu $s2, $a1, $zero
/* 16688 8003B288 AFBF0024 */ sw $ra, 0x24($sp)
/* 1668C 8003B28C AFB1001C */ sw $s1, 0x1c($sp)
/* 16690 8003B290 820200B6 */ lb $v0, 0xb6($s0)
/* 16694 8003B294 10400034 */ beqz $v0, .L8003B368
/* 16698 8003B298 00C0882D */ daddu $s1, $a2, $zero
/* 1669C 8003B29C 96040028 */ lhu $a0, 0x28($s0)
/* 166A0 8003B2A0 0C044964 */ jal func_80112590
/* 166A4 8003B2A4 00000000 */ nop
/* 166A8 8003B2A8 AE0200C4 */ sw $v0, 0xc4($s0)
/* 166AC 8003B2AC 0040202D */ daddu $a0, $v0, $zero
/* 166B0 8003B2B0 A20000C1 */ sb $zero, 0xc1($s0)
/* 166B4 8003B2B4 8C830000 */ lw $v1, ($a0)
/* 166B8 8003B2B8 2402FFFF */ addiu $v0, $zero, -1
/* 166BC 8003B2BC 1062000B */ beq $v1, $v0, .L8003B2EC
/* 166C0 8003B2C0 0080182D */ daddu $v1, $a0, $zero
/* 166C4 8003B2C4 0040202D */ daddu $a0, $v0, $zero
.L8003B2C8:
/* 166C8 8003B2C8 920200C1 */ lbu $v0, 0xc1($s0)
/* 166CC 8003B2CC 24420001 */ addiu $v0, $v0, 1
/* 166D0 8003B2D0 A20200C1 */ sb $v0, 0xc1($s0)
/* 166D4 8003B2D4 00021600 */ sll $v0, $v0, 0x18
/* 166D8 8003B2D8 00021583 */ sra $v0, $v0, 0x16
/* 166DC 8003B2DC 00431021 */ addu $v0, $v0, $v1
/* 166E0 8003B2E0 8C420000 */ lw $v0, ($v0)
/* 166E4 8003B2E4 1444FFF8 */ bne $v0, $a0, .L8003B2C8
/* 166E8 8003B2E8 00000000 */ nop
.L8003B2EC:
/* 166EC 8003B2EC 0C04496F */ jal func_801125BC
/* 166F0 8003B2F0 96040028 */ lhu $a0, 0x28($s0)
/* 166F4 8003B2F4 820300C1 */ lb $v1, 0xc1($s0)
/* 166F8 8003B2F8 0000302D */ daddu $a2, $zero, $zero
/* 166FC 8003B2FC 18600015 */ blez $v1, .L8003B354
/* 16700 8003B300 A20200C0 */ sb $v0, 0xc0($s0)
/* 16704 8003B304 240700C8 */ addiu $a3, $zero, 0xc8
.L8003B308:
/* 16708 8003B308 8E0300C4 */ lw $v1, 0xc4($s0)
/* 1670C 8003B30C 00061080 */ sll $v0, $a2, 2
/* 16710 8003B310 00431021 */ addu $v0, $v0, $v1
/* 16714 8003B314 8C430000 */ lw $v1, ($v0)
/* 16718 8003B318 10600009 */ beqz $v1, .L8003B340
/* 1671C 8003B31C 02072821 */ addu $a1, $s0, $a3
/* 16720 8003B320 0000202D */ daddu $a0, $zero, $zero
.L8003B324:
/* 16724 8003B324 94620000 */ lhu $v0, ($v1)
/* 16728 8003B328 24630002 */ addiu $v1, $v1, 2
/* 1672C 8003B32C 24840001 */ addiu $a0, $a0, 1
/* 16730 8003B330 A4A20000 */ sh $v0, ($a1)
/* 16734 8003B334 28820010 */ slti $v0, $a0, 0x10
/* 16738 8003B338 1440FFFA */ bnez $v0, .L8003B324
/* 1673C 8003B33C 24A50002 */ addiu $a1, $a1, 2
.L8003B340:
/* 16740 8003B340 820200C1 */ lb $v0, 0xc1($s0)
/* 16744 8003B344 24C60001 */ addiu $a2, $a2, 1
/* 16748 8003B348 00C2102A */ slt $v0, $a2, $v0
/* 1674C 8003B34C 1440FFEE */ bnez $v0, .L8003B308
/* 16750 8003B350 24E70020 */ addiu $a3, $a3, 0x20
.L8003B354:
/* 16754 8003B354 2402FFFE */ addiu $v0, $zero, -2
/* 16758 8003B358 A20200B7 */ sb $v0, 0xb7($s0)
/* 1675C 8003B35C A60000BE */ sh $zero, 0xbe($s0)
/* 16760 8003B360 A20000B6 */ sb $zero, 0xb6($s0)
/* 16764 8003B364 A60000BC */ sh $zero, 0xbc($s0)
.L8003B368:
/* 16768 8003B368 860200BC */ lh $v0, 0xbc($s0)
/* 1676C 8003B36C 14400013 */ bnez $v0, .L8003B3BC
/* 16770 8003B370 00000000 */ nop
/* 16774 8003B374 920200B7 */ lbu $v0, 0xb7($s0)
/* 16778 8003B378 3C038007 */ lui $v1, %hi(D_80077BC0)
/* 1677C 8003B37C 24637BC0 */ addiu $v1, $v1, %lo(D_80077BC0)
/* 16780 8003B380 24420002 */ addiu $v0, $v0, 2
/* 16784 8003B384 A20200B7 */ sb $v0, 0xb7($s0)
/* 16788 8003B388 00021600 */ sll $v0, $v0, 0x18
/* 1678C 8003B38C 00021603 */ sra $v0, $v0, 0x18
/* 16790 8003B390 3C048007 */ lui $a0, %hi(D_80077BC0)
/* 16794 8003B394 00822021 */ addu $a0, $a0, $v0
/* 16798 8003B398 90847BC0 */ lbu $a0, %lo(D_80077BC0)($a0)
/* 1679C 8003B39C 240200FF */ addiu $v0, $zero, 0xff
/* 167A0 8003B3A0 50820001 */ beql $a0, $v0, .L8003B3A8
/* 167A4 8003B3A4 A20000B7 */ sb $zero, 0xb7($s0)
.L8003B3A8:
/* 167A8 8003B3A8 820200B7 */ lb $v0, 0xb7($s0)
/* 167AC 8003B3AC 00431021 */ addu $v0, $v0, $v1
/* 167B0 8003B3B0 90420001 */ lbu $v0, 1($v0)
/* 167B4 8003B3B4 00021042 */ srl $v0, $v0, 1
/* 167B8 8003B3B8 A60200BC */ sh $v0, 0xbc($s0)
.L8003B3BC:
/* 167BC 8003B3BC 960300BC */ lhu $v1, 0xbc($s0)
/* 167C0 8003B3C0 820200B7 */ lb $v0, 0xb7($s0)
/* 167C4 8003B3C4 2463FFFF */ addiu $v1, $v1, -1
/* 167C8 8003B3C8 3C048007 */ lui $a0, %hi(D_80077BC0)
/* 167CC 8003B3CC 00822021 */ addu $a0, $a0, $v0
/* 167D0 8003B3D0 90847BC0 */ lbu $a0, %lo(D_80077BC0)($a0)
/* 167D4 8003B3D4 24020001 */ addiu $v0, $zero, 1
/* 167D8 8003B3D8 10820025 */ beq $a0, $v0, .L8003B470
/* 167DC 8003B3DC A60300BC */ sh $v1, 0xbc($s0)
/* 167E0 8003B3E0 28820002 */ slti $v0, $a0, 2
/* 167E4 8003B3E4 10400005 */ beqz $v0, .L8003B3FC
/* 167E8 8003B3E8 24020002 */ addiu $v0, $zero, 2
/* 167EC 8003B3EC 10800007 */ beqz $a0, .L8003B40C
/* 167F0 8003B3F0 00000000 */ nop
/* 167F4 8003B3F4 0800ED5B */ j .L8003B56C
/* 167F8 8003B3F8 00000000 */ nop
.L8003B3FC:
/* 167FC 8003B3FC 1082003C */ beq $a0, $v0, .L8003B4F0
/* 16800 8003B400 00000000 */ nop
/* 16804 8003B404 0800ED5B */ j .L8003B56C
/* 16808 8003B408 00000000 */ nop
.L8003B40C:
/* 1680C 8003B40C 820200C0 */ lb $v0, 0xc0($s0)
/* 16810 8003B410 18400056 */ blez $v0, .L8003B56C
/* 16814 8003B414 0000302D */ daddu $a2, $zero, $zero
/* 16818 8003B418 240700C8 */ addiu $a3, $zero, 0xc8
.L8003B41C:
/* 1681C 8003B41C 8E0300C4 */ lw $v1, 0xc4($s0)
/* 16820 8003B420 00061080 */ sll $v0, $a2, 2
/* 16824 8003B424 00431021 */ addu $v0, $v0, $v1
/* 16828 8003B428 8C430000 */ lw $v1, ($v0)
/* 1682C 8003B42C 10600009 */ beqz $v1, .L8003B454
/* 16830 8003B430 02072821 */ addu $a1, $s0, $a3
/* 16834 8003B434 0000202D */ daddu $a0, $zero, $zero
.L8003B438:
/* 16838 8003B438 94620000 */ lhu $v0, ($v1)
/* 1683C 8003B43C 24630002 */ addiu $v1, $v1, 2
/* 16840 8003B440 24840001 */ addiu $a0, $a0, 1
/* 16844 8003B444 A4A20000 */ sh $v0, ($a1)
/* 16848 8003B448 28820010 */ slti $v0, $a0, 0x10
/* 1684C 8003B44C 1440FFFA */ bnez $v0, .L8003B438
/* 16850 8003B450 24A50002 */ addiu $a1, $a1, 2
.L8003B454:
/* 16854 8003B454 820200C0 */ lb $v0, 0xc0($s0)
/* 16858 8003B458 24C60001 */ addiu $a2, $a2, 1
/* 1685C 8003B45C 00C2102A */ slt $v0, $a2, $v0
/* 16860 8003B460 1440FFEE */ bnez $v0, .L8003B41C
/* 16864 8003B464 24E70020 */ addiu $a3, $a3, 0x20
/* 16868 8003B468 0800ED5B */ j .L8003B56C
/* 1686C 8003B46C 00000000 */ nop
.L8003B470:
/* 16870 8003B470 820200C0 */ lb $v0, 0xc0($s0)
/* 16874 8003B474 920300C0 */ lbu $v1, 0xc0($s0)
/* 16878 8003B478 1840003C */ blez $v0, .L8003B56C
/* 1687C 8003B47C 0000302D */ daddu $a2, $zero, $zero
/* 16880 8003B480 240700C8 */ addiu $a3, $zero, 0xc8
.L8003B484:
/* 16884 8003B484 00031600 */ sll $v0, $v1, 0x18
/* 16888 8003B488 00021603 */ sra $v0, $v0, 0x18
/* 1688C 8003B48C 00021880 */ sll $v1, $v0, 2
/* 16890 8003B490 00621821 */ addu $v1, $v1, $v0
/* 16894 8003B494 00661821 */ addu $v1, $v1, $a2
/* 16898 8003B498 8E0200C4 */ lw $v0, 0xc4($s0)
/* 1689C 8003B49C 00031880 */ sll $v1, $v1, 2
/* 168A0 8003B4A0 00621821 */ addu $v1, $v1, $v0
/* 168A4 8003B4A4 8C630000 */ lw $v1, ($v1)
/* 168A8 8003B4A8 10600009 */ beqz $v1, .L8003B4D0
/* 168AC 8003B4AC 02072821 */ addu $a1, $s0, $a3
/* 168B0 8003B4B0 0000202D */ daddu $a0, $zero, $zero
.L8003B4B4:
/* 168B4 8003B4B4 94620000 */ lhu $v0, ($v1)
/* 168B8 8003B4B8 24630002 */ addiu $v1, $v1, 2
/* 168BC 8003B4BC 24840001 */ addiu $a0, $a0, 1
/* 168C0 8003B4C0 A4A20000 */ sh $v0, ($a1)
/* 168C4 8003B4C4 28820010 */ slti $v0, $a0, 0x10
/* 168C8 8003B4C8 1440FFFA */ bnez $v0, .L8003B4B4
/* 168CC 8003B4CC 24A50002 */ addiu $a1, $a1, 2
.L8003B4D0:
/* 168D0 8003B4D0 24C60001 */ addiu $a2, $a2, 1
/* 168D4 8003B4D4 820200C0 */ lb $v0, 0xc0($s0)
/* 168D8 8003B4D8 920300C0 */ lbu $v1, 0xc0($s0)
/* 168DC 8003B4DC 00C2102A */ slt $v0, $a2, $v0
/* 168E0 8003B4E0 1440FFE8 */ bnez $v0, .L8003B484
/* 168E4 8003B4E4 24E70020 */ addiu $a3, $a3, 0x20
/* 168E8 8003B4E8 0800ED5B */ j .L8003B56C
/* 168EC 8003B4EC 00000000 */ nop
.L8003B4F0:
/* 168F0 8003B4F0 820200C0 */ lb $v0, 0xc0($s0)
/* 168F4 8003B4F4 920300C0 */ lbu $v1, 0xc0($s0)
/* 168F8 8003B4F8 1840001C */ blez $v0, .L8003B56C
/* 168FC 8003B4FC 0000302D */ daddu $a2, $zero, $zero
/* 16900 8003B500 240700C8 */ addiu $a3, $zero, 0xc8
.L8003B504:
/* 16904 8003B504 00031600 */ sll $v0, $v1, 0x18
/* 16908 8003B508 00021603 */ sra $v0, $v0, 0x18
/* 1690C 8003B50C 00021840 */ sll $v1, $v0, 1
/* 16910 8003B510 00621821 */ addu $v1, $v1, $v0
/* 16914 8003B514 00031840 */ sll $v1, $v1, 1
/* 16918 8003B518 00661821 */ addu $v1, $v1, $a2
/* 1691C 8003B51C 8E0200C4 */ lw $v0, 0xc4($s0)
/* 16920 8003B520 00031880 */ sll $v1, $v1, 2
/* 16924 8003B524 00621821 */ addu $v1, $v1, $v0
/* 16928 8003B528 8C630000 */ lw $v1, ($v1)
/* 1692C 8003B52C 10600009 */ beqz $v1, .L8003B554
/* 16930 8003B530 02072821 */ addu $a1, $s0, $a3
/* 16934 8003B534 0000202D */ daddu $a0, $zero, $zero
.L8003B538:
/* 16938 8003B538 94620000 */ lhu $v0, ($v1)
/* 1693C 8003B53C 24630002 */ addiu $v1, $v1, 2
/* 16940 8003B540 24840001 */ addiu $a0, $a0, 1
/* 16944 8003B544 A4A20000 */ sh $v0, ($a1)
/* 16948 8003B548 28820010 */ slti $v0, $a0, 0x10
/* 1694C 8003B54C 1440FFFA */ bnez $v0, .L8003B538
/* 16950 8003B550 24A50002 */ addiu $a1, $a1, 2
.L8003B554:
/* 16954 8003B554 24C60001 */ addiu $a2, $a2, 1
/* 16958 8003B558 820200C0 */ lb $v0, 0xc0($s0)
/* 1695C 8003B55C 920300C0 */ lbu $v1, 0xc0($s0)
/* 16960 8003B560 00C2102A */ slt $v0, $a2, $v0
/* 16964 8003B564 1440FFE7 */ bnez $v0, .L8003B504
/* 16968 8003B568 24E70020 */ addiu $a3, $a3, 0x20
.L8003B56C:
/* 1696C 8003B56C 820200C1 */ lb $v0, 0xc1($s0)
/* 16970 8003B570 1840000B */ blez $v0, .L8003B5A0
/* 16974 8003B574 0000302D */ daddu $a2, $zero, $zero
/* 16978 8003B578 240400C8 */ addiu $a0, $zero, 0xc8
/* 1697C 8003B57C 0200182D */ daddu $v1, $s0, $zero
.L8003B580:
/* 16980 8003B580 02041021 */ addu $v0, $s0, $a0
/* 16984 8003B584 24840020 */ addiu $a0, $a0, 0x20
/* 16988 8003B588 AC6202C8 */ sw $v0, 0x2c8($v1)
/* 1698C 8003B58C 820200C1 */ lb $v0, 0xc1($s0)
/* 16990 8003B590 24C60001 */ addiu $a2, $a2, 1
/* 16994 8003B594 00C2102A */ slt $v0, $a2, $v0
/* 16998 8003B598 1440FFF9 */ bnez $v0, .L8003B580
/* 1699C 8003B59C 24630004 */ addiu $v1, $v1, 4
.L8003B5A0:
/* 169A0 8003B5A0 8E020000 */ lw $v0, ($s0)
/* 169A4 8003B5A4 3C034000 */ lui $v1, 0x4000
/* 169A8 8003B5A8 00431024 */ and $v0, $v0, $v1
/* 169AC 8003B5AC 14400016 */ bnez $v0, .L8003B608
/* 169B0 8003B5B0 0240282D */ daddu $a1, $s2, $zero
/* 169B4 8003B5B4 920200AC */ lbu $v0, 0xac($s0)
/* 169B8 8003B5B8 920300AD */ lbu $v1, 0xad($s0)
/* 169BC 8003B5BC 00430018 */ mult $v0, $v1
/* 169C0 8003B5C0 00001012 */ mflo $v0
/* 169C4 8003B5C4 3C038080 */ lui $v1, 0x8080
/* 169C8 8003B5C8 34638081 */ ori $v1, $v1, 0x8081
/* 169CC 8003B5CC 00430018 */ mult $v0, $v1
/* 169D0 8003B5D0 8E030024 */ lw $v1, 0x24($s0)
/* 169D4 8003B5D4 260702C8 */ addiu $a3, $s0, 0x2c8
/* 169D8 8003B5D8 AFB10010 */ sw $s1, 0x10($sp)
/* 169DC 8003B5DC 00004810 */ mfhi $t1
/* 169E0 8003B5E0 01223021 */ addu $a2, $t1, $v0
/* 169E4 8003B5E4 000631C3 */ sra $a2, $a2, 7
/* 169E8 8003B5E8 000217C3 */ sra $v0, $v0, 0x1f
/* 169EC 8003B5EC 00C23023 */ subu $a2, $a2, $v0
/* 169F0 8003B5F0 28C400FF */ slti $a0, $a2, 0xff
/* 169F4 8003B5F4 000427C0 */ sll $a0, $a0, 0x1f
/* 169F8 8003B5F8 3C022000 */ lui $v0, 0x2000
/* 169FC 8003B5FC 00822025 */ or $a0, $a0, $v0
/* 16A00 8003B600 0C0447CA */ jal func_80111F28
/* 16A04 8003B604 00642025 */ or $a0, $v1, $a0
.L8003B608:
/* 16A08 8003B608 960200BE */ lhu $v0, 0xbe($s0)
/* 16A0C 8003B60C 2442FFFF */ addiu $v0, $v0, -1
/* 16A10 8003B610 A60200BE */ sh $v0, 0xbe($s0)
/* 16A14 8003B614 8FBF0024 */ lw $ra, 0x24($sp)
/* 16A18 8003B618 8FB20020 */ lw $s2, 0x20($sp)
/* 16A1C 8003B61C 8FB1001C */ lw $s1, 0x1c($sp)
/* 16A20 8003B620 8FB00018 */ lw $s0, 0x18($sp)
/* 16A24 8003B624 03E00008 */ jr $ra
/* 16A28 8003B628 27BD0028 */ addiu $sp, $sp, 0x28