From 56156d5577fd041a2ae7d05a6dec1b945f4204c8 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Fri, 24 Jul 2020 17:37:44 -0400 Subject: [PATCH] Decompiled ovl_Obj_Makeoshihiki (#285) * Decompiled ovl_Obj_Makeoshihiki * typo * PR comments * oops * Update src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * Update src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * Update src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * Update src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * Update src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * Update src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * Update src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * Fixing dumb thing * oops Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> --- .../ObjMakeoshihiki_Draw.s | 150 ----------------- .../ObjMakeoshihiki_Init.s | 152 ------------------ .../overlays/actors/z_obj_makeoshihiki.data.s | 24 --- .../actors/z_obj_makeoshihiki.reloc.s | 13 -- spec | 3 +- .../ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c | 131 +++++++++++++-- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h | 4 +- 7 files changed, 122 insertions(+), 355 deletions(-) delete mode 100644 asm/non_matchings/overlays/actors/ovl_Obj_Makeoshihiki/ObjMakeoshihiki_Draw.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Obj_Makeoshihiki/ObjMakeoshihiki_Init.s delete mode 100644 data/overlays/actors/z_obj_makeoshihiki.data.s delete mode 100644 data/overlays/actors/z_obj_makeoshihiki.reloc.s diff --git a/asm/non_matchings/overlays/actors/ovl_Obj_Makeoshihiki/ObjMakeoshihiki_Draw.s b/asm/non_matchings/overlays/actors/ovl_Obj_Makeoshihiki/ObjMakeoshihiki_Draw.s deleted file mode 100644 index 1bba011b80..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Obj_Makeoshihiki/ObjMakeoshihiki_Draw.s +++ /dev/null @@ -1,150 +0,0 @@ -.late_rodata -glabel D_80B98A04 - .float 0.001 - -.text -glabel ObjMakeoshihiki_Draw -/* 001BC 80B986CC 27BDFFB0 */ addiu $sp, $sp, 0xFFB0 ## $sp = FFFFFFB0 -/* 001C0 80B986D0 AFBF002C */ sw $ra, 0x002C($sp) -/* 001C4 80B986D4 AFB30028 */ sw $s3, 0x0028($sp) -/* 001C8 80B986D8 AFB20024 */ sw $s2, 0x0024($sp) -/* 001CC 80B986DC AFB10020 */ sw $s1, 0x0020($sp) -/* 001D0 80B986E0 AFB0001C */ sw $s0, 0x001C($sp) -/* 001D4 80B986E4 F7B40010 */ sdc1 $f20, 0x0010($sp) -/* 001D8 80B986E8 AFA50054 */ sw $a1, 0x0054($sp) -/* 001DC 80B986EC 848E0018 */ lh $t6, 0x0018($a0) ## 00000018 -/* 001E0 80B986F0 3C1980BA */ lui $t9, %hi(D_80B988F0) ## $t9 = 80BA0000 -/* 001E4 80B986F4 273988F0 */ addiu $t9, $t9, %lo(D_80B988F0) ## $t9 = 80B988F0 -/* 001E8 80B986F8 31CF0001 */ andi $t7, $t6, 0x0001 ## $t7 = 00000000 -/* 001EC 80B986FC 000FC080 */ sll $t8, $t7, 2 -/* 001F0 80B98700 030FC023 */ subu $t8, $t8, $t7 -/* 001F4 80B98704 0018C080 */ sll $t8, $t8, 2 -/* 001F8 80B98708 030FC023 */ subu $t8, $t8, $t7 -/* 001FC 80B9870C 0018C080 */ sll $t8, $t8, 2 -/* 00200 80B98710 03198021 */ addu $s0, $t8, $t9 -/* 00204 80B98714 3C0180BA */ lui $at, %hi(D_80B98A04) ## $at = 80BA0000 -/* 00208 80B98718 00809825 */ or $s3, $a0, $zero ## $s3 = 00000000 -/* 0020C 80B9871C C4348A04 */ lwc1 $f20, %lo(D_80B98A04)($at) -/* 00210 80B98720 AFB0004C */ sw $s0, 0x004C($sp) -/* 00214 80B98724 00008825 */ or $s1, $zero, $zero ## $s1 = 00000000 -/* 00218 80B98728 24120003 */ addiu $s2, $zero, 0x0003 ## $s2 = 00000003 -.L80B9872C: -/* 0021C 80B9872C 8E64011C */ lw $a0, 0x011C($s3) ## 0000011C -/* 00220 80B98730 02002825 */ or $a1, $s0, $zero ## $a1 = 00000000 -/* 00224 80B98734 0C032D94 */ jal func_800CB650 -/* 00228 80B98738 24840024 */ addiu $a0, $a0, 0x0024 ## $a0 = 00000024 -/* 0022C 80B9873C 4614003C */ c.lt.s $f0, $f20 -/* 00230 80B98740 00000000 */ nop -/* 00234 80B98744 45020057 */ bc1fl .L80B988A4 -/* 00238 80B98748 26310001 */ addiu $s1, $s1, 0x0001 ## $s1 = 00000001 -/* 0023C 80B9874C 8FA8004C */ lw $t0, 0x004C($sp) -/* 00240 80B98750 01114821 */ addu $t1, $t0, $s1 -/* 00244 80B98754 AFA90034 */ sw $t1, 0x0034($sp) -/* 00248 80B98758 912A0024 */ lbu $t2, 0x0024($t1) ## 00000024 -/* 0024C 80B9875C 314B0001 */ andi $t3, $t2, 0x0001 ## $t3 = 00000000 -/* 00250 80B98760 1160002E */ beq $t3, $zero, .L80B9881C -/* 00254 80B98764 00000000 */ nop -/* 00258 80B98768 8662001C */ lh $v0, 0x001C($s3) ## 0000001C -/* 0025C 80B9876C 8FA40054 */ lw $a0, 0x0054($sp) -/* 00260 80B98770 00026183 */ sra $t4, $v0, 6 -/* 00264 80B98774 318D0001 */ andi $t5, $t4, 0x0001 ## $t5 = 00000000 -/* 00268 80B98778 11A00003 */ beq $t5, $zero, .L80B98788 -/* 0026C 80B9877C 00000000 */ nop -/* 00270 80B98780 1000000D */ beq $zero, $zero, .L80B987B8 -/* 00274 80B98784 00009025 */ or $s2, $zero, $zero ## $s2 = 00000000 -.L80B98788: -/* 00278 80B98788 0C00B2D0 */ jal Flags_GetSwitch - -/* 0027C 80B9878C 3045003F */ andi $a1, $v0, 0x003F ## $a1 = 00000000 -/* 00280 80B98790 10400003 */ beq $v0, $zero, .L80B987A0 -/* 00284 80B98794 001170C0 */ sll $t6, $s1, 3 -/* 00288 80B98798 10000002 */ beq $zero, $zero, .L80B987A4 -/* 0028C 80B9879C 24030001 */ addiu $v1, $zero, 0x0001 ## $v1 = 00000001 -.L80B987A0: -/* 00290 80B987A0 00001825 */ or $v1, $zero, $zero ## $v1 = 00000000 -.L80B987A4: -/* 00294 80B987A4 3C0F80BA */ lui $t7, %hi(D_80B98948) ## $t7 = 80BA0000 -/* 00298 80B987A8 01EE7821 */ addu $t7, $t7, $t6 -/* 0029C 80B987AC 8DEF8948 */ lw $t7, %lo(D_80B98948)($t7) -/* 002A0 80B987B0 8662001C */ lh $v0, 0x001C($s3) ## 0000001C -/* 002A4 80B987B4 01E39026 */ xor $s2, $t7, $v1 -.L80B987B8: -/* 002A8 80B987B8 0002C383 */ sra $t8, $v0, 14 -/* 002AC 80B987BC 33190001 */ andi $t9, $t8, 0x0001 ## $t9 = 00000000 -/* 002B0 80B987C0 13200003 */ beq $t9, $zero, .L80B987D0 -/* 002B4 80B987C4 8FA40054 */ lw $a0, 0x0054($sp) -/* 002B8 80B987C8 1000000E */ beq $zero, $zero, .L80B98804 -/* 002BC 80B987CC 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000 -.L80B987D0: -/* 002C0 80B987D0 3C0980BA */ lui $t1, %hi(D_80B98948) ## $t1 = 80BA0000 -/* 002C4 80B987D4 25298948 */ addiu $t1, $t1, %lo(D_80B98948) ## $t1 = 80B98948 -/* 002C8 80B987D8 00022A03 */ sra $a1, $v0, 8 -/* 002CC 80B987DC 001140C0 */ sll $t0, $s1, 3 -/* 002D0 80B987E0 01098021 */ addu $s0, $t0, $t1 -/* 002D4 80B987E4 0C00B2D0 */ jal Flags_GetSwitch - -/* 002D8 80B987E8 30A5003F */ andi $a1, $a1, 0x003F ## $a1 = 00000000 -/* 002DC 80B987EC 10400003 */ beq $v0, $zero, .L80B987FC -/* 002E0 80B987F0 00001825 */ or $v1, $zero, $zero ## $v1 = 00000000 -/* 002E4 80B987F4 10000001 */ beq $zero, $zero, .L80B987FC -/* 002E8 80B987F8 24030001 */ addiu $v1, $zero, 0x0001 ## $v1 = 00000001 -.L80B987FC: -/* 002EC 80B987FC 8E0A0004 */ lw $t2, 0x0004($s0) ## 00000004 -/* 002F0 80B98800 01431026 */ xor $v0, $t2, $v1 -.L80B98804: -/* 002F4 80B98804 16400003 */ bne $s2, $zero, .L80B98814 -/* 002F8 80B98808 00000000 */ nop -/* 002FC 80B9880C 10400003 */ beq $v0, $zero, .L80B9881C -/* 00300 80B98810 00000000 */ nop -.L80B98814: -/* 00304 80B98814 0C01E221 */ jal func_80078884 -/* 00308 80B98818 24044807 */ addiu $a0, $zero, 0x4807 ## $a0 = 00004807 -.L80B9881C: -/* 0030C 80B9881C 3C0C80BA */ lui $t4, %hi(D_80B98948) ## $t4 = 80BA0000 -/* 00310 80B98820 258C8948 */ addiu $t4, $t4, %lo(D_80B98948) ## $t4 = 80B98948 -/* 00314 80B98824 001158C0 */ sll $t3, $s1, 3 -/* 00318 80B98828 016C8021 */ addu $s0, $t3, $t4 -/* 0031C 80B9882C 8E0D0000 */ lw $t5, 0x0000($s0) ## 00000000 -/* 00320 80B98830 3C1280BA */ lui $s2, %hi(D_80B98960) ## $s2 = 80BA0000 -/* 00324 80B98834 26528960 */ addiu $s2, $s2, %lo(D_80B98960) ## $s2 = 80B98960 -/* 00328 80B98838 000D7080 */ sll $t6, $t5, 2 -/* 0032C 80B9883C 024E7821 */ addu $t7, $s2, $t6 -/* 00330 80B98840 8DF90000 */ lw $t9, 0x0000($t7) ## 00000000 -/* 00334 80B98844 8665001C */ lh $a1, 0x001C($s3) ## 0000001C -/* 00338 80B98848 8FA40054 */ lw $a0, 0x0054($sp) -/* 0033C 80B9884C 0320F809 */ jalr $ra, $t9 -/* 00340 80B98850 30A5003F */ andi $a1, $a1, 0x003F ## $a1 = 00000000 -/* 00344 80B98854 8E180004 */ lw $t8, 0x0004($s0) ## 00000004 -/* 00348 80B98858 8665001C */ lh $a1, 0x001C($s3) ## 0000001C -/* 0034C 80B9885C 8FA40054 */ lw $a0, 0x0054($sp) -/* 00350 80B98860 00184080 */ sll $t0, $t8, 2 -/* 00354 80B98864 02484821 */ addu $t1, $s2, $t0 -/* 00358 80B98868 8D390000 */ lw $t9, 0x0000($t1) ## 00000000 -/* 0035C 80B9886C 00052A03 */ sra $a1, $a1, 8 -/* 00360 80B98870 30A5003F */ andi $a1, $a1, 0x003F ## $a1 = 00000000 -/* 00364 80B98874 0320F809 */ jalr $ra, $t9 -/* 00368 80B98878 00000000 */ nop -/* 0036C 80B9887C 8FAA0034 */ lw $t2, 0x0034($sp) -/* 00370 80B98880 914B0024 */ lbu $t3, 0x0024($t2) ## 00000024 -/* 00374 80B98884 316C0002 */ andi $t4, $t3, 0x0002 ## $t4 = 00000000 -/* 00378 80B98888 51800009 */ beql $t4, $zero, .L80B988B0 -/* 0037C 80B9888C 8FBF002C */ lw $ra, 0x002C($sp) -/* 00380 80B98890 8E6E011C */ lw $t6, 0x011C($s3) ## 0000011C -/* 00384 80B98894 240D0001 */ addiu $t5, $zero, 0x0001 ## $t5 = 00000001 -/* 00388 80B98898 10000004 */ beq $zero, $zero, .L80B988AC -/* 0038C 80B9889C A1CD01BE */ sb $t5, 0x01BE($t6) ## 000001BE -/* 00390 80B988A0 26310001 */ addiu $s1, $s1, 0x0001 ## $s1 = 00000002 -.L80B988A4: -/* 00394 80B988A4 1632FFA1 */ bne $s1, $s2, .L80B9872C -/* 00398 80B988A8 2610000C */ addiu $s0, $s0, 0x000C ## $s0 = 0000000C -.L80B988AC: -/* 0039C 80B988AC 8FBF002C */ lw $ra, 0x002C($sp) -.L80B988B0: -/* 003A0 80B988B0 D7B40010 */ ldc1 $f20, 0x0010($sp) -/* 003A4 80B988B4 8FB0001C */ lw $s0, 0x001C($sp) -/* 003A8 80B988B8 8FB10020 */ lw $s1, 0x0020($sp) -/* 003AC 80B988BC 8FB20024 */ lw $s2, 0x0024($sp) -/* 003B0 80B988C0 8FB30028 */ lw $s3, 0x0028($sp) -/* 003B4 80B988C4 03E00008 */ jr $ra -/* 003B8 80B988C8 27BD0050 */ addiu $sp, $sp, 0x0050 ## $sp = 00000000 -/* 003BC 80B988CC 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Obj_Makeoshihiki/ObjMakeoshihiki_Init.s b/asm/non_matchings/overlays/actors/ovl_Obj_Makeoshihiki/ObjMakeoshihiki_Init.s deleted file mode 100644 index 224b6b21ed..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Obj_Makeoshihiki/ObjMakeoshihiki_Init.s +++ /dev/null @@ -1,152 +0,0 @@ -.rdata -glabel D_80B98970 - .asciz "\x1b[41;37m" - .balign 4 - -glabel D_80B9897C - .asciz "Error : 押し引きブロック発生失敗(%s %d)\n" - .balign 4 - -glabel D_80B989AC - .asciz "../z_obj_makeoshihiki.c" - .balign 4 - -glabel D_80B989C4 - .asciz "\x1b[m" - .balign 4 - -glabel D_80B989C8 - .asciz "(%s)(arg_data %04xF)(angleZ %d)\n" - .balign 4 - -glabel D_80B989EC - .asciz "../z_obj_makeoshihiki.c" - .balign 4 - -.text -glabel ObjMakeoshihiki_Init -/* 00000 80B98510 27BDFFB8 */ addiu $sp, $sp, 0xFFB8 ## $sp = FFFFFFB8 -/* 00004 80B98514 AFBF003C */ sw $ra, 0x003C($sp) -/* 00008 80B98518 AFB00038 */ sw $s0, 0x0038($sp) -/* 0000C 80B9851C AFA5004C */ sw $a1, 0x004C($sp) -/* 00010 80B98520 848E0018 */ lh $t6, 0x0018($a0) ## 00000018 -/* 00014 80B98524 8482001C */ lh $v0, 0x001C($a0) ## 0000001C -/* 00018 80B98528 3C1980BA */ lui $t9, %hi(D_80B988F0) ## $t9 = 80BA0000 -/* 0001C 80B9852C 31CF0001 */ andi $t7, $t6, 0x0001 ## $t7 = 00000000 -/* 00020 80B98530 000FC080 */ sll $t8, $t7, 2 -/* 00024 80B98534 030FC023 */ subu $t8, $t8, $t7 -/* 00028 80B98538 0018C080 */ sll $t8, $t8, 2 -/* 0002C 80B9853C 030FC023 */ subu $t8, $t8, $t7 -/* 00030 80B98540 00024983 */ sra $t1, $v0, 6 -/* 00034 80B98544 0018C080 */ sll $t8, $t8, 2 -/* 00038 80B98548 273988F0 */ addiu $t9, $t9, %lo(D_80B988F0) ## $t9 = 80B988F0 -/* 0003C 80B9854C 312A0001 */ andi $t2, $t1, 0x0001 ## $t2 = 00000000 -/* 00040 80B98550 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 00044 80B98554 15400009 */ bne $t2, $zero, .L80B9857C -/* 00048 80B98558 03194021 */ addu $t0, $t8, $t9 -/* 0004C 80B9855C 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 00050 80B98560 3045003F */ andi $a1, $v0, 0x003F ## $a1 = 00000000 -/* 00054 80B98564 0C00B2D0 */ jal Flags_GetSwitch - -/* 00058 80B98568 AFA80044 */ sw $t0, 0x0044($sp) -/* 0005C 80B9856C 10400003 */ beq $v0, $zero, .L80B9857C -/* 00060 80B98570 8FA80044 */ lw $t0, 0x0044($sp) -/* 00064 80B98574 1000000F */ beq $zero, $zero, .L80B985B4 -/* 00068 80B98578 24030001 */ addiu $v1, $zero, 0x0001 ## $v1 = 00000001 -.L80B9857C: -/* 0006C 80B9857C 8602001C */ lh $v0, 0x001C($s0) ## 0000001C -/* 00070 80B98580 8FA4004C */ lw $a0, 0x004C($sp) -/* 00074 80B98584 00025B83 */ sra $t3, $v0, 14 -/* 00078 80B98588 316C0001 */ andi $t4, $t3, 0x0001 ## $t4 = 00000000 -/* 0007C 80B9858C 15800008 */ bne $t4, $zero, .L80B985B0 -/* 00080 80B98590 00022A03 */ sra $a1, $v0, 8 -/* 00084 80B98594 30A5003F */ andi $a1, $a1, 0x003F ## $a1 = 00000000 -/* 00088 80B98598 0C00B2D0 */ jal Flags_GetSwitch - -/* 0008C 80B9859C AFA80044 */ sw $t0, 0x0044($sp) -/* 00090 80B985A0 10400003 */ beq $v0, $zero, .L80B985B0 -/* 00094 80B985A4 8FA80044 */ lw $t0, 0x0044($sp) -/* 00098 80B985A8 10000002 */ beq $zero, $zero, .L80B985B4 -/* 0009C 80B985AC 24030002 */ addiu $v1, $zero, 0x0002 ## $v1 = 00000002 -.L80B985B0: -/* 000A0 80B985B0 00001825 */ or $v1, $zero, $zero ## $v1 = 00000000 -.L80B985B4: -/* 000A4 80B985B4 00037080 */ sll $t6, $v1, 2 -/* 000A8 80B985B8 01C37023 */ subu $t6, $t6, $v1 -/* 000AC 80B985BC 000E7080 */ sll $t6, $t6, 2 -/* 000B0 80B985C0 010E1021 */ addu $v0, $t0, $t6 -/* 000B4 80B985C4 C4440000 */ lwc1 $f4, 0x0000($v0) ## 00000000 -/* 000B8 80B985C8 8FA6004C */ lw $a2, 0x004C($sp) -/* 000BC 80B985CC 02002825 */ or $a1, $s0, $zero ## $a1 = 00000000 -/* 000C0 80B985D0 E7A40010 */ swc1 $f4, 0x0010($sp) -/* 000C4 80B985D4 C4460004 */ lwc1 $f6, 0x0004($v0) ## 00000004 -/* 000C8 80B985D8 240700FF */ addiu $a3, $zero, 0x00FF ## $a3 = 000000FF -/* 000CC 80B985DC 24C41C24 */ addiu $a0, $a2, 0x1C24 ## $a0 = 00001C24 -/* 000D0 80B985E0 E7A60014 */ swc1 $f6, 0x0014($sp) -/* 000D4 80B985E4 C4480008 */ lwc1 $f8, 0x0008($v0) ## 00000008 -/* 000D8 80B985E8 AFA0001C */ sw $zero, 0x001C($sp) -/* 000DC 80B985EC E7A80018 */ swc1 $f8, 0x0018($sp) -/* 000E0 80B985F0 850F002A */ lh $t7, 0x002A($t0) ## 0000002A -/* 000E4 80B985F4 AFA00024 */ sw $zero, 0x0024($sp) -/* 000E8 80B985F8 AFAF0020 */ sw $t7, 0x0020($sp) -/* 000EC 80B985FC 91180027 */ lbu $t8, 0x0027($t0) ## 00000027 -/* 000F0 80B98600 910A0028 */ lbu $t2, 0x0028($t0) ## 00000028 -/* 000F4 80B98604 AFA80044 */ sw $t0, 0x0044($sp) -/* 000F8 80B98608 0018C980 */ sll $t9, $t8, 6 -/* 000FC 80B9860C 332900C0 */ andi $t1, $t9, 0x00C0 ## $t1 = 00000000 -/* 00100 80B98610 314B000F */ andi $t3, $t2, 0x000F ## $t3 = 00000000 -/* 00104 80B98614 012B6025 */ or $t4, $t1, $t3 ## $t4 = 00000000 -/* 00108 80B98618 358DFF00 */ ori $t5, $t4, 0xFF00 ## $t5 = 0000FF00 -/* 0010C 80B9861C AFAD0028 */ sw $t5, 0x0028($sp) -/* 00110 80B98620 0C00C916 */ jal Actor_SpawnAttached - -/* 00114 80B98624 AFA30040 */ sw $v1, 0x0040($sp) -/* 00118 80B98628 8FA30040 */ lw $v1, 0x0040($sp) -/* 0011C 80B9862C 14400011 */ bne $v0, $zero, .L80B98674 -/* 00120 80B98630 8FA80044 */ lw $t0, 0x0044($sp) -/* 00124 80B98634 3C0480BA */ lui $a0, %hi(D_80B98970) ## $a0 = 80BA0000 -/* 00128 80B98638 0C00084C */ jal osSyncPrintf - -/* 0012C 80B9863C 24848970 */ addiu $a0, $a0, %lo(D_80B98970) ## $a0 = 80B98970 -/* 00130 80B98640 3C0480BA */ lui $a0, %hi(D_80B9897C) ## $a0 = 80BA0000 -/* 00134 80B98644 3C0580BA */ lui $a1, %hi(D_80B989AC) ## $a1 = 80BA0000 -/* 00138 80B98648 24A589AC */ addiu $a1, $a1, %lo(D_80B989AC) ## $a1 = 80B989AC -/* 0013C 80B9864C 2484897C */ addiu $a0, $a0, %lo(D_80B9897C) ## $a0 = 80B9897C -/* 00140 80B98650 0C00084C */ jal osSyncPrintf - -/* 00144 80B98654 240600C2 */ addiu $a2, $zero, 0x00C2 ## $a2 = 000000C2 -/* 00148 80B98658 3C0480BA */ lui $a0, %hi(D_80B989C4) ## $a0 = 80BA0000 -/* 0014C 80B9865C 0C00084C */ jal osSyncPrintf - -/* 00150 80B98660 248489C4 */ addiu $a0, $a0, %lo(D_80B989C4) ## $a0 = 80B989C4 -/* 00154 80B98664 0C00B55C */ jal Actor_Kill - -/* 00158 80B98668 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 0015C 80B9866C 10000013 */ beq $zero, $zero, .L80B986BC -/* 00160 80B98670 8FBF003C */ lw $ra, 0x003C($sp) -.L80B98674: -/* 00164 80B98674 01037021 */ addu $t6, $t0, $v1 -/* 00168 80B98678 91CF0024 */ lbu $t7, 0x0024($t6) ## 00000024 -/* 0016C 80B9867C 3C0480BA */ lui $a0, %hi(D_80B989C8) ## $a0 = 80BA0000 -/* 00170 80B98680 248489C8 */ addiu $a0, $a0, %lo(D_80B989C8) ## $a0 = 80B989C8 -/* 00174 80B98684 31F80002 */ andi $t8, $t7, 0x0002 ## $t8 = 00000000 -/* 00178 80B98688 13000004 */ beq $t8, $zero, .L80B9869C -/* 0017C 80B9868C 3C0580BA */ lui $a1, %hi(D_80B989EC) ## $a1 = 80BA0000 -/* 00180 80B98690 8E0A011C */ lw $t2, 0x011C($s0) ## 0000011C -/* 00184 80B98694 24190001 */ addiu $t9, $zero, 0x0001 ## $t9 = 00000001 -/* 00188 80B98698 A15901BE */ sb $t9, 0x01BE($t2) ## 000001BE -.L80B9869C: -/* 0018C 80B9869C A60000B8 */ sh $zero, 0x00B8($s0) ## 000000B8 -/* 00190 80B986A0 860900B8 */ lh $t1, 0x00B8($s0) ## 000000B8 -/* 00194 80B986A4 24A589EC */ addiu $a1, $a1, %lo(D_80B989EC) ## $a1 = 80B989EC -/* 00198 80B986A8 8606001C */ lh $a2, 0x001C($s0) ## 0000001C -/* 0019C 80B986AC 86070018 */ lh $a3, 0x0018($s0) ## 00000018 -/* 001A0 80B986B0 0C00084C */ jal osSyncPrintf - -/* 001A4 80B986B4 A6090034 */ sh $t1, 0x0034($s0) ## 00000034 -/* 001A8 80B986B8 8FBF003C */ lw $ra, 0x003C($sp) -.L80B986BC: -/* 001AC 80B986BC 8FB00038 */ lw $s0, 0x0038($sp) -/* 001B0 80B986C0 27BD0048 */ addiu $sp, $sp, 0x0048 ## $sp = 00000000 -/* 001B4 80B986C4 03E00008 */ jr $ra -/* 001B8 80B986C8 00000000 */ nop diff --git a/data/overlays/actors/z_obj_makeoshihiki.data.s b/data/overlays/actors/z_obj_makeoshihiki.data.s deleted file mode 100644 index 680b414049..0000000000 --- a/data/overlays/actors/z_obj_makeoshihiki.data.s +++ /dev/null @@ -1,24 +0,0 @@ -.include "macro.inc" - - # assembler directives - .set noat # allow manual use of $at - .set noreorder # don't insert nops after branches - .set gp=64 # allow use of 64-bit general purpose registers - -.section .data - -.balign 16 - -glabel Obj_Makeoshihiki_InitVars - .word 0x017D0600, 0x00000020, 0x00030000, 0x0000014C -.word ObjMakeoshihiki_Init -.word Actor_Noop -.word Actor_Noop -.word ObjMakeoshihiki_Draw -glabel D_80B988F0 - .word 0x44250000, 0x43E60000, 0x44250000, 0x44250000, 0x43E48000, 0x44070000, 0x44430000, 0x43E30000, 0x44070000, 0x000003FF, 0x02000000, 0xC4174000, 0xC44D0000, 0xC3910000, 0xC3B68000, 0xC4624000, 0xC3910000, 0xC3B68000, 0xC4624000, 0xC3910000, 0x000300FF, 0x00000000 -glabel D_80B98948 - .word 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000001 -glabel D_80B98960 - .word Flags_UnsetSwitch, Flags_SetSwitch, 0x00000000, 0x00000000 - diff --git a/data/overlays/actors/z_obj_makeoshihiki.reloc.s b/data/overlays/actors/z_obj_makeoshihiki.reloc.s deleted file mode 100644 index 4faa6ebc6f..0000000000 --- a/data/overlays/actors/z_obj_makeoshihiki.reloc.s +++ /dev/null @@ -1,13 +0,0 @@ -.include "macro.inc" - - # assembler directives - .set noat # allow manual use of $at - .set noreorder # don't insert nops after branches - .set gp=64 # allow use of 64-bit general purpose registers - -.section .rodata - -.balign 16 - -glabel D_80B98A10 - .incbin "baserom/ovl_Obj_Makeoshihiki", 0x500, 0x00000090 diff --git a/spec b/spec index aa687c367c..b467d79e96 100644 --- a/spec +++ b/spec @@ -3644,8 +3644,7 @@ endseg beginseg name "ovl_Obj_Makeoshihiki" include "build/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.o" - include "build/data/overlays/actors/z_obj_makeoshihiki.data.o" - include "build/data/overlays/actors/z_obj_makeoshihiki.reloc.o" + include "build/src/overlays/actors/ovl_Obj_Makeoshihiki/ovl_Obj_Makeoshihiki_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c index 3950223c6d..6728b33a22 100644 --- a/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c +++ b/src/overlays/actors/ovl_Obj_Makeoshihiki/z_obj_makeoshihiki.c @@ -6,6 +6,10 @@ #include "z_obj_makeoshihiki.h" +#include "overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h" + +#include + #define FLAGS 0x00000020 #define THIS ((ObjMakeoshihiki*)thisx) @@ -13,19 +17,120 @@ void ObjMakeoshihiki_Init(Actor* thisx, GlobalContext* globalCtx); void ObjMakeoshihiki_Draw(Actor* thisx, GlobalContext* globalCtx); -/* const ActorInit Obj_Makeoshihiki_InitVars = { - ACTOR_OBJ_MAKEOSHIHIKI, - ACTORTYPE_PROP, - FLAGS, - OBJECT_GAMEPLAY_DANGEON_KEEP, - sizeof(ObjMakeoshihiki), - (ActorFunc)ObjMakeoshihiki_Init, - (ActorFunc)Actor_Noop, - (ActorFunc)Actor_Noop, - (ActorFunc)ObjMakeoshihiki_Draw, + ACTOR_OBJ_MAKEOSHIHIKI, ACTORTYPE_PROP, FLAGS, + OBJECT_GAMEPLAY_DANGEON_KEEP, sizeof(ObjMakeoshihiki), (ActorFunc)ObjMakeoshihiki_Init, + (ActorFunc)Actor_Noop, (ActorFunc)Actor_Noop, (ActorFunc)ObjMakeoshihiki_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Makeoshihiki/ObjMakeoshihiki_Init.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Makeoshihiki/ObjMakeoshihiki_Draw.s") +typedef struct { + /* 0x00 */ Vec3f posVecs[3]; + /* 0x24 */ u8 unk_24[3]; + /* 0x27 */ u8 paramVal1; + /* 0x28 */ u8 paramVal2; + /* 0x2A */ s16 rotY; +} BlockConfig; // size = 0x2C + +static BlockConfig sBlocks[] = { + { { { 660.0f, 460.0f, 660.0f }, { 660.0f, 457.0f, 540.0f }, { 780.0f, 454.0f, 540.0f } }, + 0x00, + 0x00, + 0x03, + 0xFF, + 0x02, + 0x0000 }, + { { { -605.0f, -820.0f, -290.0f }, { -365.0f, -905.0f, -290.0f }, { -365.0f, -905.0f, -290.0f } }, + 0x00, + 0x03, + 0x00, + 0xFF, + 0x00, + 0x0000 } +}; + +static u32 sFlags[3][2] = { { 0, 0 }, { 1, 0 }, { 0, 1 } }; + +static void (*sFlagSwitchFuncs[])(GlobalContext* globalCtx, s32 flag) = { Flags_UnsetSwitch, Flags_SetSwitch }; + +void ObjMakeoshihiki_Init(Actor* thisx, GlobalContext* globalCtx) { + BlockConfig* block = &sBlocks[thisx->initPosRot.rot.z & 1]; + s32 typeIdx; + Vec3f* spawnPos; + + if (!((thisx->params >> 6) & 1) && Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + typeIdx = 1; + } else if (!((thisx->params >> 0xE) & 1) && Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { + typeIdx = 2; + } else { + typeIdx = 0; + } + + spawnPos = &block->posVecs[typeIdx]; + + if (Actor_SpawnAttached(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_OBJ_OSHIHIKI, spawnPos->x, spawnPos->y, + spawnPos->z, 0, block->rotY, 0, + ((block->paramVal1 << 6) & 0xC0) | (block->paramVal2 & 0xF) | 0xFF00) == NULL) { + // Push-pull block failure + osSyncPrintf(VT_COL(RED, WHITE)); + osSyncPrintf("Error : 押し引きブロック発生失敗(%s %d)\n", "../z_obj_makeoshihiki.c", 194); + osSyncPrintf(VT_RST); + Actor_Kill(thisx); + return; + } + if (block->unk_24[typeIdx] & 2) { + ((ObjOshihiki*)thisx->attachedB)->unk_1BE = 1; + } + thisx->posRot.rot.z = thisx->shape.rot.z = 0; + osSyncPrintf("(%s)(arg_data %04xF)(angleZ %d)\n", "../z_obj_makeoshihiki.c", thisx->params, + thisx->initPosRot.rot.z); +} + +void ObjMakeoshihiki_Draw(Actor* thisx, GlobalContext* globalCtx) { + BlockConfig* block = &sBlocks[thisx->initPosRot.rot.z & 1]; + s32 i; + s32 sfxCond1; + s32 sfxCond2; + s32 cond; + s32 cond2; + + for (i = 0; i < 3; i++) { + if (func_800CB650(&thisx->attachedB->posRot.pos, &block->posVecs[i]) < 0.001f) { + if (block->unk_24[i] & 1) { + if ((thisx->params >> 6) & 1) { + sfxCond1 = false; + } else { + if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) { + cond = true; + } else { + cond = false; + } + sfxCond1 = sFlags[i][0] ^ cond; + } + + if ((thisx->params >> 0xE) & 1) { + sfxCond2 = false; + } else { + if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { + cond2 = true; + } else { + cond2 = false; + } + sfxCond2 = sFlags[i][1] ^ cond2; + } + + if (sfxCond1 || sfxCond2) { + func_80078884(NA_SE_SY_TRE_BOX_APPEAR); + } + } + + sFlagSwitchFuncs[sFlags[i][0]](globalCtx, thisx->params & 0x3F); + sFlagSwitchFuncs[sFlags[i][1]](globalCtx, (thisx->params >> 8) & 0x3F); + + if (block->unk_24[i] & 2) { + ((ObjOshihiki*)thisx->attachedB)->unk_1BE = 1; + } + + break; + } + } +} diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h index cb17663759..fc0819c014 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.h @@ -8,7 +8,9 @@ struct ObjOshihiki; typedef struct ObjOshihiki { /* 0x0000 */ DynaPolyActor dyna; - /* 0x0164 */ char unk_164[0x70]; + /* 0x0164 */ char unk_164[0x5A]; + /* 0x01BE */ u8 unk_1BE; + /* 0x01BF */ char unk_1BF[0x15]; } ObjOshihiki; // size = 0x01D4 extern const ActorInit Obj_Oshihiki_InitVars;