1
0
mirror of https://github.com/blawar/ooot.git synced 2024-07-07 12:32:37 +00:00

En_Torch2 (#486)

* Darkmeiro decompilation

Bg_Gnd_Darkmeiro decompiled, matched, and documented.

* give this a shot

* fix conflict

* one more try

* Oh boy more giant functions

* now functional, but not equivalent

* Now only non-matching

* cleaned up illusion room

* much closer. static variables still suck though

* much closer. static variables still suck though

* some docs and cleanup. matching is horrible.

* static varaibles are a troublesome  lot

* ifdef

* merge ZAP

* merge again

* small cleanup

* small fixes

* swordstate

* resolve conflict

* comments and such

Co-authored-by: fig <fig02srl@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
This commit is contained in:
petrie911 2020-12-28 19:56:24 -06:00 committed by GitHub
parent 1e6bd7f623
commit 42f2d38b8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 1148 additions and 949 deletions

View File

@ -1,30 +0,0 @@
glabel EnTorch2_Destroy
/* 001A8 80B1DB28 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0
/* 001AC 80B1DB2C AFB00014 */ sw $s0, 0x0014($sp)
/* 001B0 80B1DB30 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000
/* 001B4 80B1DB34 AFB10018 */ sw $s1, 0x0018($sp)
/* 001B8 80B1DB38 00A08825 */ or $s1, $a1, $zero ## $s1 = 00000000
/* 001BC 80B1DB3C AFBF001C */ sw $ra, 0x001C($sp)
/* 001C0 80B1DB40 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000
/* 001C4 80B1DB44 0C009C27 */ jal Effect_Delete
/* 001C8 80B1DB48 8E050670 */ lw $a1, 0x0670($s0) ## 00000670
/* 001CC 80B1DB4C 0C03D6D6 */ jal func_800F5B58
/* 001D0 80B1DB50 00000000 */ nop
/* 001D4 80B1DB54 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000
/* 001D8 80B1DB58 0C0170EB */ jal Collider_DestroyCylinder
/* 001DC 80B1DB5C 26050498 */ addiu $a1, $s0, 0x0498 ## $a1 = 00000498
/* 001E0 80B1DB60 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000
/* 001E4 80B1DB64 0C017418 */ jal Collider_DestroyQuad
/* 001E8 80B1DB68 260504E4 */ addiu $a1, $s0, 0x04E4 ## $a1 = 000004E4
/* 001EC 80B1DB6C 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000
/* 001F0 80B1DB70 0C017418 */ jal Collider_DestroyQuad
/* 001F4 80B1DB74 26050564 */ addiu $a1, $s0, 0x0564 ## $a1 = 00000564
/* 001F8 80B1DB78 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000
/* 001FC 80B1DB7C 0C017418 */ jal Collider_DestroyQuad
/* 00200 80B1DB80 260505E4 */ addiu $a1, $s0, 0x05E4 ## $a1 = 000005E4
/* 00204 80B1DB84 8FBF001C */ lw $ra, 0x001C($sp)
/* 00208 80B1DB88 8FB00014 */ lw $s0, 0x0014($sp)
/* 0020C 80B1DB8C 8FB10018 */ lw $s1, 0x0018($sp)
/* 00210 80B1DB90 03E00008 */ jr $ra
/* 00214 80B1DB94 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000

View File

@ -1,131 +0,0 @@
.rdata
glabel D_80B1FA30
.asciz "../z_en_torch2.c"
.balign 4
glabel D_80B1FA44
.asciz "../z_en_torch2.c"
.balign 4
.text
glabel EnTorch2_Draw
/* 01E78 80B1F7F8 27BDFF90 */ addiu $sp, $sp, 0xFF90 ## $sp = FFFFFF90
/* 01E7C 80B1F7FC AFB20030 */ sw $s2, 0x0030($sp)
/* 01E80 80B1F800 00A09025 */ or $s2, $a1, $zero ## $s2 = 00000000
/* 01E84 80B1F804 AFBF0034 */ sw $ra, 0x0034($sp)
/* 01E88 80B1F808 AFB1002C */ sw $s1, 0x002C($sp)
/* 01E8C 80B1F80C AFB00028 */ sw $s0, 0x0028($sp)
/* 01E90 80B1F810 8CA50000 */ lw $a1, 0x0000($a1) ## 00000000
/* 01E94 80B1F814 00808825 */ or $s1, $a0, $zero ## $s1 = 00000000
/* 01E98 80B1F818 3C0680B2 */ lui $a2, %hi(D_80B1FA30) ## $a2 = 80B20000
/* 01E9C 80B1F81C 24C6FA30 */ addiu $a2, $a2, %lo(D_80B1FA30) ## $a2 = 80B1FA30
/* 01EA0 80B1F820 27A40050 */ addiu $a0, $sp, 0x0050 ## $a0 = FFFFFFE0
/* 01EA4 80B1F824 2407041A */ addiu $a3, $zero, 0x041A ## $a3 = 0000041A
/* 01EA8 80B1F828 0C031AB1 */ jal Graph_OpenDisps
/* 01EAC 80B1F82C 00A08025 */ or $s0, $a1, $zero ## $s0 = 00000000
/* 01EB0 80B1F830 0C024F20 */ jal func_80093C80
/* 01EB4 80B1F834 02402025 */ or $a0, $s2, $zero ## $a0 = 00000000
/* 01EB8 80B1F838 0C024F61 */ jal func_80093D84
/* 01EBC 80B1F83C 8E440000 */ lw $a0, 0x0000($s2) ## 00000000
/* 01EC0 80B1F840 3C0480B2 */ lui $a0, %hi(D_80B20165) ## $a0 = 80B20000
/* 01EC4 80B1F844 24840165 */ addiu $a0, $a0, %lo(D_80B20165) ## $a0 = 80B20165
/* 01EC8 80B1F848 908E0000 */ lbu $t6, 0x0000($a0) ## 80B20165
/* 01ECC 80B1F84C 240100FF */ addiu $at, $zero, 0x00FF ## $at = 000000FF
/* 01ED0 80B1F850 3C19FB00 */ lui $t9, 0xFB00 ## $t9 = FB000000
/* 01ED4 80B1F854 15C1002B */ bne $t6, $at, .L80B1F904
/* 01ED8 80B1F858 3C0CDB06 */ lui $t4, 0xDB06 ## $t4 = DB060000
/* 01EDC 80B1F85C 8E0302C0 */ lw $v1, 0x02C0($s0) ## 000002C0
/* 01EE0 80B1F860 3C18FB00 */ lui $t8, 0xFB00 ## $t8 = FB000000
/* 01EE4 80B1F864 3C01FF00 */ lui $at, 0xFF00 ## $at = FF000000
/* 01EE8 80B1F868 246F0008 */ addiu $t7, $v1, 0x0008 ## $t7 = 00000008
/* 01EEC 80B1F86C AE0F02C0 */ sw $t7, 0x02C0($s0) ## 000002C0
/* 01EF0 80B1F870 AC780000 */ sw $t8, 0x0000($v1) ## 00000000
/* 01EF4 80B1F874 90880000 */ lbu $t0, 0x0000($a0) ## 80B20165
/* 01EF8 80B1F878 3C0BDB06 */ lui $t3, 0xDB06 ## $t3 = DB060000
/* 01EFC 80B1F87C 3C0C8011 */ lui $t4, %hi(D_80116280+0x10)
/* 01F00 80B1F880 01014825 */ or $t1, $t0, $at ## $t1 = FF000000
/* 01F04 80B1F884 AC690004 */ sw $t1, 0x0004($v1) ## 00000004
/* 01F08 80B1F888 8E0302C0 */ lw $v1, 0x02C0($s0) ## 000002C0
/* 01F0C 80B1F88C 258C6290 */ addiu $t4, %lo(D_80116280+0x10)
/* 01F10 80B1F890 356B0030 */ ori $t3, $t3, 0x0030 ## $t3 = DB060030
/* 01F14 80B1F894 246A0008 */ addiu $t2, $v1, 0x0008 ## $t2 = 00000008
/* 01F18 80B1F898 AE0A02C0 */ sw $t2, 0x02C0($s0) ## 000002C0
/* 01F1C 80B1F89C 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000
/* 01F20 80B1F8A0 02402825 */ or $a1, $s2, $zero ## $a1 = 00000000
/* 01F24 80B1F8A4 00003025 */ or $a2, $zero, $zero ## $a2 = 00000000
/* 01F28 80B1F8A8 AC6C0004 */ sw $t4, 0x0004($v1) ## 00000004
/* 01F2C 80B1F8AC 0C00BAF3 */ jal func_8002EBCC
/* 01F30 80B1F8B0 AC6B0000 */ sw $t3, 0x0000($v1) ## 00000000
/* 01F34 80B1F8B4 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000
/* 01F38 80B1F8B8 02402825 */ or $a1, $s2, $zero ## $a1 = 00000000
/* 01F3C 80B1F8BC 0C00BB60 */ jal func_8002ED80
/* 01F40 80B1F8C0 00003025 */ or $a2, $zero, $zero ## $a2 = 00000000
/* 01F44 80B1F8C4 8E2501B8 */ lw $a1, 0x01B8($s1) ## 000001B8
/* 01F48 80B1F8C8 8E2601D4 */ lw $a2, 0x01D4($s1) ## 000001D4
/* 01F4C 80B1F8CC 922701B6 */ lbu $a3, 0x01B6($s1) ## 000001B6
/* 01F50 80B1F8D0 3C0D80B2 */ lui $t5, %hi(func_80B1F7A8) ## $t5 = 80B20000
/* 01F54 80B1F8D4 3C0E80B2 */ lui $t6, %hi(func_80B1F7D4) ## $t6 = 80B20000
/* 01F58 80B1F8D8 25CEF7D4 */ addiu $t6, $t6, %lo(func_80B1F7D4) ## $t6 = 80B1F7D4
/* 01F5C 80B1F8DC 25ADF7A8 */ addiu $t5, $t5, %lo(func_80B1F7A8) ## $t5 = 80B1F7A8
/* 01F60 80B1F8E0 AFAD0010 */ sw $t5, 0x0010($sp)
/* 01F64 80B1F8E4 AFAE0014 */ sw $t6, 0x0014($sp)
/* 01F68 80B1F8E8 AFB10018 */ sw $s1, 0x0018($sp)
/* 01F6C 80B1F8EC 8E0F02C0 */ lw $t7, 0x02C0($s0) ## 000002C0
/* 01F70 80B1F8F0 02402025 */ or $a0, $s2, $zero ## $a0 = 00000000
/* 01F74 80B1F8F4 0C0289CF */ jal SkelAnime_DrawFlex
/* 01F78 80B1F8F8 AFAF001C */ sw $t7, 0x001C($sp)
/* 01F7C 80B1F8FC 10000028 */ beq $zero, $zero, .L80B1F9A0
/* 01F80 80B1F900 AE0202C0 */ sw $v0, 0x02C0($s0) ## 000002C0
.L80B1F904:
/* 01F84 80B1F904 8E0302D0 */ lw $v1, 0x02D0($s0) ## 000002D0
/* 01F88 80B1F908 3C01FF00 */ lui $at, 0xFF00 ## $at = FF000000
/* 01F8C 80B1F90C 3C0D8011 */ lui $t5, %hi(D_80116280)
/* 01F90 80B1F910 24780008 */ addiu $t8, $v1, 0x0008 ## $t8 = 00000008
/* 01F94 80B1F914 AE1802D0 */ sw $t8, 0x02D0($s0) ## 000002D0
/* 01F98 80B1F918 AC790000 */ sw $t9, 0x0000($v1) ## 00000000
/* 01F9C 80B1F91C 90890000 */ lbu $t1, 0x0000($a0) ## 00000000
/* 01FA0 80B1F920 25AD6280 */ addiu $t5, %lo(D_80116280)
/* 01FA4 80B1F924 358C0030 */ ori $t4, $t4, 0x0030 ## $t4 = 00000030
/* 01FA8 80B1F928 01215025 */ or $t2, $t1, $at ## $t2 = FF000000
/* 01FAC 80B1F92C AC6A0004 */ sw $t2, 0x0004($v1) ## 00000004
/* 01FB0 80B1F930 8E0302D0 */ lw $v1, 0x02D0($s0) ## 000002D0
/* 01FB4 80B1F934 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000
/* 01FB8 80B1F938 02402825 */ or $a1, $s2, $zero ## $a1 = 00000000
/* 01FBC 80B1F93C 246B0008 */ addiu $t3, $v1, 0x0008 ## $t3 = 00000008
/* 01FC0 80B1F940 AE0B02D0 */ sw $t3, 0x02D0($s0) ## 000002D0
/* 01FC4 80B1F944 00003025 */ or $a2, $zero, $zero ## $a2 = 00000000
/* 01FC8 80B1F948 AC6D0004 */ sw $t5, 0x0004($v1) ## 00000004
/* 01FCC 80B1F94C 0C00BAF3 */ jal func_8002EBCC
/* 01FD0 80B1F950 AC6C0000 */ sw $t4, 0x0000($v1) ## 00000000
/* 01FD4 80B1F954 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000
/* 01FD8 80B1F958 02402825 */ or $a1, $s2, $zero ## $a1 = 00000000
/* 01FDC 80B1F95C 0C00BB60 */ jal func_8002ED80
/* 01FE0 80B1F960 00003025 */ or $a2, $zero, $zero ## $a2 = 00000000
/* 01FE4 80B1F964 8E2501B8 */ lw $a1, 0x01B8($s1) ## 000001B8
/* 01FE8 80B1F968 8E2601D4 */ lw $a2, 0x01D4($s1) ## 000001D4
/* 01FEC 80B1F96C 922701B6 */ lbu $a3, 0x01B6($s1) ## 000001B6
/* 01FF0 80B1F970 3C0E80B2 */ lui $t6, %hi(func_80B1F7A8) ## $t6 = 80B20000
/* 01FF4 80B1F974 3C0F80B2 */ lui $t7, %hi(func_80B1F7D4) ## $t7 = 80B20000
/* 01FF8 80B1F978 25EFF7D4 */ addiu $t7, $t7, %lo(func_80B1F7D4) ## $t7 = 80B1F7D4
/* 01FFC 80B1F97C 25CEF7A8 */ addiu $t6, $t6, %lo(func_80B1F7A8) ## $t6 = 80B1F7A8
/* 02000 80B1F980 AFAE0010 */ sw $t6, 0x0010($sp)
/* 02004 80B1F984 AFAF0014 */ sw $t7, 0x0014($sp)
/* 02008 80B1F988 AFB10018 */ sw $s1, 0x0018($sp)
/* 0200C 80B1F98C 8E1802D0 */ lw $t8, 0x02D0($s0) ## 000002D0
/* 02010 80B1F990 02402025 */ or $a0, $s2, $zero ## $a0 = 00000000
/* 02014 80B1F994 0C0289CF */ jal SkelAnime_DrawFlex
/* 02018 80B1F998 AFB8001C */ sw $t8, 0x001C($sp)
/* 0201C 80B1F99C AE0202D0 */ sw $v0, 0x02D0($s0) ## 000002D0
.L80B1F9A0:
/* 02020 80B1F9A0 3C0680B2 */ lui $a2, %hi(D_80B1FA44) ## $a2 = 80B20000
/* 02024 80B1F9A4 24C6FA44 */ addiu $a2, $a2, %lo(D_80B1FA44) ## $a2 = 80B1FA44
/* 02028 80B1F9A8 27A40050 */ addiu $a0, $sp, 0x0050 ## $a0 = FFFFFFE0
/* 0202C 80B1F9AC 8E450000 */ lw $a1, 0x0000($s2) ## 00000000
/* 02030 80B1F9B0 0C031AD5 */ jal Graph_CloseDisps
/* 02034 80B1F9B4 2407045A */ addiu $a3, $zero, 0x045A ## $a3 = 0000045A
/* 02038 80B1F9B8 8FBF0034 */ lw $ra, 0x0034($sp)
/* 0203C 80B1F9BC 8FB00028 */ lw $s0, 0x0028($sp)
/* 02040 80B1F9C0 8FB1002C */ lw $s1, 0x002C($sp)
/* 02044 80B1F9C4 8FB20030 */ lw $s2, 0x0030($sp)
/* 02048 80B1F9C8 03E00008 */ jr $ra
/* 0204C 80B1F9CC 27BD0070 */ addiu $sp, $sp, 0x0070 ## $sp = 00000000

View File

@ -1,107 +0,0 @@
glabel EnTorch2_Init
/* 00000 80B1D980 3C0280B2 */ lui $v0, %hi(D_80B20130) ## $v0 = 80B20000
/* 00004 80B1D984 24420130 */ addiu $v0, $v0, %lo(D_80B20130) ## $v0 = 80B20130
/* 00008 80B1D988 27BDFFD0 */ addiu $sp, $sp, 0xFFD0 ## $sp = FFFFFFD0
/* 0000C 80B1D98C A0400003 */ sb $zero, 0x0003($v0) ## 80B20133
/* 00010 80B1D990 80580003 */ lb $t8, 0x0003($v0) ## 80B20133
/* 00014 80B1D994 AFBF001C */ sw $ra, 0x001C($sp)
/* 00018 80B1D998 AFB00018 */ sw $s0, 0x0018($sp)
/* 0001C 80B1D99C AFA50034 */ sw $a1, 0x0034($sp)
/* 00020 80B1D9A0 A4400012 */ sh $zero, 0x0012($v0) ## 80B20142
/* 00024 80B1D9A4 A440000C */ sh $zero, 0x000C($v0) ## 80B2013C
/* 00028 80B1D9A8 A4400000 */ sh $zero, 0x0000($v0) ## 80B20130
/* 0002C 80B1D9AC A0580002 */ sb $t8, 0x0002($v0) ## 80B20132
/* 00030 80B1D9B0 24190002 */ addiu $t9, $zero, 0x0002 ## $t9 = 00000002
/* 00034 80B1D9B4 24090003 */ addiu $t1, $zero, 0x0003 ## $t1 = 00000003
/* 00038 80B1D9B8 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000
/* 0003C 80B1D9BC A099014E */ sb $t9, 0x014E($a0) ## 0000014E
/* 00040 80B1D9C0 A0890152 */ sb $t1, 0x0152($a0) ## 00000152
/* 00044 80B1D9C4 A0890151 */ sb $t1, 0x0151($a0) ## 00000151
/* 00048 80B1D9C8 0C023B01 */ jal Player_SetModelGroup
/* 0004C 80B1D9CC 24050002 */ addiu $a1, $zero, 0x0002 ## $a1 = 00000002
/* 00050 80B1D9D0 8FA50034 */ lw $a1, 0x0034($sp)
/* 00054 80B1D9D4 3C010001 */ lui $at, 0x0001 ## $at = 00010000
/* 00058 80B1D9D8 3C060600 */ lui $a2, 0x0600 ## $a2 = 06000000
/* 0005C 80B1D9DC 00A11021 */ addu $v0, $a1, $at
/* 00060 80B1D9E0 AFA20024 */ sw $v0, 0x0024($sp)
/* 00064 80B1D9E4 8C591D3C */ lw $t9, 0x1D3C($v0) ## 00001D3C
/* 00068 80B1D9E8 24C64764 */ addiu $a2, $a2, 0x4764 ## $a2 = 06004764
/* 0006C 80B1D9EC 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 00070 80B1D9F0 0320F809 */ jalr $ra, $t9
/* 00074 80B1D9F4 00000000 */ nop
/* 00078 80B1D9F8 8FA20024 */ lw $v0, 0x0024($sp)
/* 0007C 80B1D9FC 8FA50034 */ lw $a1, 0x0034($sp)
/* 00080 80B1DA00 240D0009 */ addiu $t5, $zero, 0x0009 ## $t5 = 00000009
/* 00084 80B1DA04 24040011 */ addiu $a0, $zero, 0x0011 ## $a0 = 00000011
/* 00088 80B1DA08 2406000D */ addiu $a2, $zero, 0x000D ## $a2 = 0000000D
/* 0008C 80B1DA0C 240F0008 */ addiu $t7, $zero, 0x0008 ## $t7 = 00000008
/* 00090 80B1DA10 24080001 */ addiu $t0, $zero, 0x0001 ## $t0 = 00000001
/* 00094 80B1DA14 3C0980B2 */ lui $t1, %hi(D_80B1FA08) ## $t1 = 80B20000
/* 00098 80B1DA18 240A0026 */ addiu $t2, $zero, 0x0026 ## $t2 = 00000026
/* 0009C 80B1DA1C 2529FA08 */ addiu $t1, $t1, %lo(D_80B1FA08) ## $t1 = 80B1FA08
/* 000A0 80B1DA20 A20A0117 */ sb $t2, 0x0117($s0) ## 00000117
/* 000A4 80B1DA24 A20D04A9 */ sb $t5, 0x04A9($s0) ## 000004A9
/* 000A8 80B1DA28 A2040574 */ sb $a0, 0x0574($s0) ## 00000574
/* 000AC 80B1DA2C A20404F4 */ sb $a0, 0x04F4($s0) ## 000004F4
/* 000B0 80B1DA30 A2060575 */ sb $a2, 0x0575($s0) ## 00000575
/* 000B4 80B1DA34 A20604F5 */ sb $a2, 0x04F5($s0) ## 000004F5
/* 000B8 80B1DA38 A20D0578 */ sb $t5, 0x0578($s0) ## 00000578
/* 000BC 80B1DA3C A20D04F8 */ sb $t5, 0x04F8($s0) ## 000004F8
/* 000C0 80B1DA40 A20F0581 */ sb $t7, 0x0581($s0) ## 00000581
/* 000C4 80B1DA44 A20F0501 */ sb $t7, 0x0501($s0) ## 00000501
/* 000C8 80B1DA48 A2080592 */ sb $t0, 0x0592($s0) ## 00000592
/* 000CC 80B1DA4C A2080512 */ sb $t0, 0x0512($s0) ## 00000512
/* 000D0 80B1DA50 A20405F4 */ sb $a0, 0x05F4($s0) ## 000005F4
/* 000D4 80B1DA54 A20605F5 */ sb $a2, 0x05F5($s0) ## 000005F5
/* 000D8 80B1DA58 AE090098 */ sw $t1, 0x0098($s0) ## 00000098
/* 000DC 80B1DA5C 3C198016 */ lui $t9, %hi(gSaveContext+0x2e)
/* 000E0 80B1DA60 8739E68E */ lh $t9, %lo(gSaveContext+0x2e)($t9)
/* 000E4 80B1DA64 240B003C */ addiu $t3, $zero, 0x003C ## $t3 = 0000003C
/* 000E8 80B1DA68 240C0064 */ addiu $t4, $zero, 0x0064 ## $t4 = 00000064
/* 000EC 80B1DA6C 001950C3 */ sra $t2, $t9, 3
/* 000F0 80B1DA70 A20A00AF */ sb $t2, 0x00AF($s0) ## 000000AF
/* 000F4 80B1DA74 A60B00A8 */ sh $t3, 0x00A8($s0) ## 000000A8
/* 000F8 80B1DA78 A60C00AA */ sh $t4, 0x00AA($s0) ## 000000AA
/* 000FC 80B1DA7C 8C591D54 */ lw $t9, 0x1D54($v0) ## 00001D54
/* 00100 80B1DA80 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 00104 80B1DA84 0320F809 */ jalr $ra, $t9
/* 00108 80B1DA88 00000000 */ nop
/* 0010C 80B1DA8C 3C0180B2 */ lui $at, %hi(D_80B2015E) ## $at = 80B20000
/* 00110 80B1DA90 A020015E */ sb $zero, %lo(D_80B2015E)($at)
/* 00114 80B1DA94 44802000 */ mtc1 $zero, $f4 ## $f4 = 0.00
/* 00118 80B1DA98 3C0180B2 */ lui $at, %hi(D_80B20161) ## $at = 80B20000
/* 0011C 80B1DA9C A0200161 */ sb $zero, %lo(D_80B20161)($at)
/* 00120 80B1DAA0 3C0180B2 */ lui $at, %hi(D_80B1F9F8) ## $at = 80B20000
/* 00124 80B1DAA4 E424F9F8 */ swc1 $f4, %lo(D_80B1F9F8)($at)
/* 00128 80B1DAA8 3C0180B2 */ lui $at, %hi(D_80B20148) ## $at = 80B20000
/* 0012C 80B1DAAC A0200148 */ sb $zero, %lo(D_80B20148)($at)
/* 00130 80B1DAB0 3C0180B2 */ lui $at, %hi(D_80B2015C) ## $at = 80B20000
/* 00134 80B1DAB4 A020015C */ sb $zero, %lo(D_80B2015C)($at)
/* 00138 80B1DAB8 3C0180B2 */ lui $at, %hi(D_80B2015D) ## $at = 80B20000
/* 0013C 80B1DABC A020015D */ sb $zero, %lo(D_80B2015D)($at)
/* 00140 80B1DAC0 3C0280B2 */ lui $v0, %hi(D_80B20162) ## $v0 = 80B20000
/* 00144 80B1DAC4 3C0380B2 */ lui $v1, %hi(D_80B20163) ## $v1 = 80B20000
/* 00148 80B1DAC8 24630163 */ addiu $v1, $v1, %lo(D_80B20163) ## $v1 = 80B20163
/* 0014C 80B1DACC 24420162 */ addiu $v0, $v0, %lo(D_80B20162) ## $v0 = 80B20162
/* 00150 80B1DAD0 A0400000 */ sb $zero, 0x0000($v0) ## 80B20162
/* 00154 80B1DAD4 A0600000 */ sb $zero, 0x0000($v1) ## 80B20163
/* 00158 80B1DAD8 3C0180B2 */ lui $at, %hi(D_80B20160) ## $at = 80B20000
/* 0015C 80B1DADC A0200160 */ sb $zero, %lo(D_80B20160)($at)
/* 00160 80B1DAE0 3C0180B2 */ lui $at, %hi(D_80B20164) ## $at = 80B20000
/* 00164 80B1DAE4 A0200164 */ sb $zero, %lo(D_80B20164)($at)
/* 00168 80B1DAE8 3C0180B2 */ lui $at, %hi(D_80B20165) ## $at = 80B20000
/* 0016C 80B1DAEC 240F005F */ addiu $t7, $zero, 0x005F ## $t7 = 0000005F
/* 00170 80B1DAF0 A02F0165 */ sb $t7, %lo(D_80B20165)($at)
/* 00174 80B1DAF4 8E090008 */ lw $t1, 0x0008($s0) ## 00000008
/* 00178 80B1DAF8 3C1880B2 */ lui $t8, %hi(D_80B20150) ## $t8 = 80B20000
/* 0017C 80B1DAFC 27180150 */ addiu $t8, $t8, %lo(D_80B20150) ## $t8 = 80B20150
/* 00180 80B1DB00 AF090000 */ sw $t1, 0x0000($t8) ## 80B20150
/* 00184 80B1DB04 8E08000C */ lw $t0, 0x000C($s0) ## 0000000C
/* 00188 80B1DB08 AF080004 */ sw $t0, 0x0004($t8) ## 80B20154
/* 0018C 80B1DB0C 8E090010 */ lw $t1, 0x0010($s0) ## 00000010
/* 00190 80B1DB10 AF090008 */ sw $t1, 0x0008($t8) ## 80B20158
/* 00194 80B1DB14 8FBF001C */ lw $ra, 0x001C($sp)
/* 00198 80B1DB18 8FB00018 */ lw $s0, 0x0018($sp)
/* 0019C 80B1DB1C 27BD0030 */ addiu $sp, $sp, 0x0030 ## $sp = 00000000
/* 001A0 80B1DB20 03E00008 */ jr $ra
/* 001A4 80B1DB24 00000000 */ nop

View File

@ -1,19 +0,0 @@
glabel func_80B1DB98
/* 00218 80B1DB98 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8
/* 0021C 80B1DB9C AFBF0014 */ sw $ra, 0x0014($sp)
/* 00220 80B1DBA0 AFA40018 */ sw $a0, 0x0018($sp)
/* 00224 80B1DBA4 AFA5001C */ sw $a1, 0x001C($sp)
/* 00228 80B1DBA8 0C00CDE0 */ jal func_80033780
/* 0022C 80B1DBAC 3C06457A */ lui $a2, 0x457A ## $a2 = 457A0000
/* 00230 80B1DBB0 10400003 */ beq $v0, $zero, .L80B1DBC0
/* 00234 80B1DBB4 8FA40018 */ lw $a0, 0x0018($sp)
/* 00238 80B1DBB8 10000004 */ beq $zero, $zero, .L80B1DBCC
/* 0023C 80B1DBBC 8FBF0014 */ lw $ra, 0x0014($sp)
.L80B1DBC0:
/* 00240 80B1DBC0 0C00CDA1 */ jal func_80033684
/* 00244 80B1DBC4 8FA5001C */ lw $a1, 0x001C($sp)
/* 00248 80B1DBC8 8FBF0014 */ lw $ra, 0x0014($sp)
.L80B1DBCC:
/* 0024C 80B1DBCC 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000
/* 00250 80B1DBD0 03E00008 */ jr $ra
/* 00254 80B1DBD4 00000000 */ nop

View File

@ -1,120 +0,0 @@
.late_rodata
glabel D_80B1FA58
.float 0.3
.text
glabel func_80B1DBD8
/* 00258 80B1DBD8 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0
/* 0025C 80B1DBDC AFBF0014 */ sw $ra, 0x0014($sp)
/* 00260 80B1DBE0 AFA50024 */ sw $a1, 0x0024($sp)
/* 00264 80B1DBE4 44800000 */ mtc1 $zero, $f0 ## $f0 = 0.00
/* 00268 80B1DBE8 C4C40838 */ lwc1 $f4, 0x0838($a2) ## 00000838
/* 0026C 80B1DBEC 24020007 */ addiu $v0, $zero, 0x0007 ## $v0 = 00000007
/* 00270 80B1DBF0 8C831C44 */ lw $v1, 0x1C44($a0) ## 00001C44
/* 00274 80B1DBF4 4600203C */ c.lt.s $f4, $f0
/* 00278 80B1DBF8 46000086 */ mov.s $f2, $f0
/* 0027C 80B1DBFC 45010009 */ bc1t .L80B1DC24
/* 00280 80B1DC00 00000000 */ nop
/* 00284 80B1DC04 C4660838 */ lwc1 $f6, 0x0838($v1) ## 00000838
/* 00288 80B1DC08 3C180001 */ lui $t8, 0x0001 ## $t8 = 00010000
/* 0028C 80B1DC0C 3C0E8016 */ lui $t6, %hi(gSaveContext+0x30)
/* 00290 80B1DC10 4600303C */ c.lt.s $f6, $f0
/* 00294 80B1DC14 3C0F80B2 */ lui $t7, %hi(D_80B20165) ## $t7 = 80B20000
/* 00298 80B1DC18 0304C021 */ addu $t8, $t8, $a0
/* 0029C 80B1DC1C 45000003 */ bc1f .L80B1DC2C
/* 002A0 80B1DC20 00000000 */ nop
.L80B1DC24:
/* 002A4 80B1DC24 1000004E */ beq $zero, $zero, .L80B1DD60
/* 002A8 80B1DC28 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000
.L80B1DC2C:
/* 002AC 80B1DC2C 85CEE690 */ lh $t6, %lo(gSaveContext+0x30)($t6)
/* 002B0 80B1DC30 3C0880B2 */ lui $t0, %hi(D_80B20148) ## $t0 = 80B20000
/* 002B4 80B1DC34 29C10050 */ slti $at, $t6, 0x0050
/* 002B8 80B1DC38 10200004 */ beq $at, $zero, .L80B1DC4C
/* 002BC 80B1DC3C 3C0180B2 */ lui $at, %hi(D_80B1FA58) ## $at = 80B20000
/* 002C0 80B1DC40 C428FA58 */ lwc1 $f8, %lo(D_80B1FA58)($at)
/* 002C4 80B1DC44 2402000F */ addiu $v0, $zero, 0x000F ## $v0 = 0000000F
/* 002C8 80B1DC48 46080080 */ add.s $f2, $f0, $f8
.L80B1DC4C:
/* 002CC 80B1DC4C 91EF0165 */ lbu $t7, %lo(D_80B20165)($t7)
/* 002D0 80B1DC50 240100FF */ addiu $at, $zero, 0x00FF ## $at = 000000FF
/* 002D4 80B1DC54 11E10004 */ beq $t7, $at, .L80B1DC68
/* 002D8 80B1DC58 3C014000 */ lui $at, 0x4000 ## $at = 40000000
/* 002DC 80B1DC5C 44815000 */ mtc1 $at, $f10 ## $f10 = 2.00
/* 002E0 80B1DC60 00000000 */ nop
/* 002E4 80B1DC64 460A1080 */ add.s $f2, $f2, $f10
.L80B1DC68:
/* 002E8 80B1DC68 8F181DE4 */ lw $t8, 0x1DE4($t8) ## 00011DE4
/* 002EC 80B1DC6C 0302C824 */ and $t9, $t8, $v0
/* 002F0 80B1DC70 13200004 */ beq $t9, $zero, .L80B1DC84
/* 002F4 80B1DC74 00000000 */ nop
/* 002F8 80B1DC78 91080148 */ lbu $t0, %lo(D_80B20148)($t0)
/* 002FC 80B1DC7C 51000038 */ beql $t0, $zero, .L80B1DD60
/* 00300 80B1DC80 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000
.L80B1DC84:
/* 00304 80B1DC84 0C03F66B */ jal Rand_ZeroOne
## Rand.Next() float
/* 00308 80B1DC88 E7A2001C */ swc1 $f2, 0x001C($sp)
/* 0030C 80B1DC8C C7A2001C */ lwc1 $f2, 0x001C($sp)
/* 00310 80B1DC90 3C0980B2 */ lui $t1, %hi(D_80B20148) ## $t1 = 80B20000
/* 00314 80B1DC94 4600103E */ c.le.s $f2, $f0
/* 00318 80B1DC98 00000000 */ nop
/* 0031C 80B1DC9C 45020030 */ bc1fl .L80B1DD60
/* 00320 80B1DCA0 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000
/* 00324 80B1DCA4 91290148 */ lbu $t1, %lo(D_80B20148)($t1)
/* 00328 80B1DCA8 55200028 */ bnel $t1, $zero, .L80B1DD4C
/* 0032C 80B1DCAC 8FB80024 */ lw $t8, 0x0024($sp)
/* 00330 80B1DCB0 0C03F66B */ jal Rand_ZeroOne
## Rand.Next() float
/* 00334 80B1DCB4 00000000 */ nop
/* 00338 80B1DCB8 3C0140E0 */ lui $at, 0x40E0 ## $at = 40E00000
/* 0033C 80B1DCBC 44818000 */ mtc1 $at, $f16 ## $f16 = 7.00
/* 00340 80B1DCC0 24010001 */ addiu $at, $zero, 0x0001 ## $at = 00000001
/* 00344 80B1DCC4 46100482 */ mul.s $f18, $f0, $f16
/* 00348 80B1DCC8 4600910D */ trunc.w.s $f4, $f18
/* 0034C 80B1DCCC 44022000 */ mfc1 $v0, $f4
/* 00350 80B1DCD0 00000000 */ nop
/* 00354 80B1DCD4 10410009 */ beq $v0, $at, .L80B1DCFC
/* 00358 80B1DCD8 24010002 */ addiu $at, $zero, 0x0002 ## $at = 00000002
/* 0035C 80B1DCDC 10410011 */ beq $v0, $at, .L80B1DD24
/* 00360 80B1DCE0 24010005 */ addiu $at, $zero, 0x0005 ## $at = 00000005
/* 00364 80B1DCE4 10410005 */ beq $v0, $at, .L80B1DCFC
/* 00368 80B1DCE8 24010006 */ addiu $at, $zero, 0x0006 ## $at = 00000006
/* 0036C 80B1DCEC 1041000D */ beq $v0, $at, .L80B1DD24
/* 00370 80B1DCF0 00000000 */ nop
/* 00374 80B1DCF4 10000015 */ beq $zero, $zero, .L80B1DD4C
/* 00378 80B1DCF8 8FB80024 */ lw $t8, 0x0024($sp)
.L80B1DCFC:
/* 0037C 80B1DCFC 3C0280B2 */ lui $v0, %hi(D_80B1F9F4) ## $v0 = 80B20000
/* 00380 80B1DD00 2442F9F4 */ addiu $v0, $v0, %lo(D_80B1F9F4) ## $v0 = 80B1F9F4
/* 00384 80B1DD04 844B0000 */ lh $t3, 0x0000($v0) ## 80B1F9F4
/* 00388 80B1DD08 3C0142FE */ lui $at, 0x42FE ## $at = 42FE0000
/* 0038C 80B1DD0C 44813000 */ mtc1 $at, $f6 ## $f6 = 127.00
/* 00390 80B1DD10 256C4000 */ addiu $t4, $t3, 0x4000 ## $t4 = 00004000
/* 00394 80B1DD14 A44C0000 */ sh $t4, 0x0000($v0) ## 80B1F9F4
/* 00398 80B1DD18 3C0180B2 */ lui $at, %hi(D_80B1F9F0) ## $at = 80B20000
/* 0039C 80B1DD1C 1000000A */ beq $zero, $zero, .L80B1DD48
/* 003A0 80B1DD20 E426F9F0 */ swc1 $f6, %lo(D_80B1F9F0)($at)
.L80B1DD24:
/* 003A4 80B1DD24 3C0280B2 */ lui $v0, %hi(D_80B1F9F4) ## $v0 = 80B20000
/* 003A8 80B1DD28 2442F9F4 */ addiu $v0, $v0, %lo(D_80B1F9F4) ## $v0 = 80B1F9F4
/* 003AC 80B1DD2C 844D0000 */ lh $t5, 0x0000($v0) ## 80B1F9F4
/* 003B0 80B1DD30 3C0142FE */ lui $at, 0x42FE ## $at = 42FE0000
/* 003B4 80B1DD34 44814000 */ mtc1 $at, $f8 ## $f8 = 127.00
/* 003B8 80B1DD38 25AEC000 */ addiu $t6, $t5, 0xC000 ## $t6 = FFFFC000
/* 003BC 80B1DD3C A44E0000 */ sh $t6, 0x0000($v0) ## 80B1F9F4
/* 003C0 80B1DD40 3C0180B2 */ lui $at, %hi(D_80B1F9F0) ## $at = 80B20000
/* 003C4 80B1DD44 E428F9F0 */ swc1 $f8, %lo(D_80B1F9F0)($at)
.L80B1DD48:
/* 003C8 80B1DD48 8FB80024 */ lw $t8, 0x0024($sp)
.L80B1DD4C:
/* 003CC 80B1DD4C 240F4000 */ addiu $t7, $zero, 0x4000 ## $t7 = 00004000
/* 003D0 80B1DD50 24020001 */ addiu $v0, $zero, 0x0001 ## $v0 = 00000001
/* 003D4 80B1DD54 10000002 */ beq $zero, $zero, .L80B1DD60
/* 003D8 80B1DD58 A70F0000 */ sh $t7, 0x0000($t8) ## 00000000
/* 003DC 80B1DD5C 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000
.L80B1DD60:
/* 003E0 80B1DD60 8FBF0014 */ lw $ra, 0x0014($sp)
/* 003E4 80B1DD64 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000
/* 003E8 80B1DD68 03E00008 */ jr $ra
/* 003EC 80B1DD6C 00000000 */ nop

View File

@ -1,22 +0,0 @@
glabel func_80B1DD70
/* 003F0 80B1DD70 84C2008A */ lh $v0, 0x008A($a2) ## 0000008A
/* 003F4 80B1DD74 34018000 */ ori $at, $zero, 0x8000 ## $at = 00008000
/* 003F8 80B1DD78 240F0001 */ addiu $t7, $zero, 0x0001 ## $t7 = 00000001
/* 003FC 80B1DD7C 00417021 */ addu $t6, $v0, $at
/* 00400 80B1DD80 3C0180B2 */ lui $at, %hi(D_80B1F9F4) ## $at = 80B20000
/* 00404 80B1DD84 A4C200B6 */ sh $v0, 0x00B6($a2) ## 000000B6
/* 00408 80B1DD88 A4C20032 */ sh $v0, 0x0032($a2) ## 00000032
/* 0040C 80B1DD8C A42EF9F4 */ sh $t6, %lo(D_80B1F9F4)($at)
/* 00410 80B1DD90 3C0142FE */ lui $at, 0x42FE ## $at = 42FE0000
/* 00414 80B1DD94 44812000 */ mtc1 $at, $f4 ## $f4 = 127.00
/* 00418 80B1DD98 3C0180B2 */ lui $at, %hi(D_80B1F9F0) ## $at = 80B20000
/* 0041C 80B1DD9C 34188000 */ ori $t8, $zero, 0x8000 ## $t8 = 00008000
/* 00420 80B1DDA0 E424F9F0 */ swc1 $f4, %lo(D_80B1F9F0)($at)
/* 00424 80B1DDA4 3C0180B2 */ lui $at, %hi(D_80B1FA00) ## $at = 80B20000
/* 00428 80B1DDA8 A02FFA00 */ sb $t7, %lo(D_80B1FA00)($at)
/* 0042C 80B1DDAC A4B80000 */ sh $t8, 0x0000($a1) ## 00000000
/* 00430 80B1DDB0 2419000A */ addiu $t9, $zero, 0x000A ## $t9 = 0000000A
/* 00434 80B1DDB4 A0990A78 */ sb $t9, 0x0A78($a0) ## 00000A78
/* 00438 80B1DDB8 3C0180B2 */ lui $at, %hi(D_80B20160) ## $at = 80B20000
/* 0043C 80B1DDBC 03E00008 */ jr $ra
/* 00440 80B1DDC0 A0200160 */ sb $zero, %lo(D_80B20160)($at)

View File

@ -1,12 +0,0 @@
glabel func_80B1F7A8
/* 01E28 80B1F7A8 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0
/* 01E2C 80B1F7AC 8FAE0030 */ lw $t6, 0x0030($sp)
/* 01E30 80B1F7B0 8FAF0034 */ lw $t7, 0x0034($sp)
/* 01E34 80B1F7B4 AFBF001C */ sw $ra, 0x001C($sp)
/* 01E38 80B1F7B8 AFAE0010 */ sw $t6, 0x0010($sp)
/* 01E3C 80B1F7BC 0C023F32 */ jal func_8008FCC8
/* 01E40 80B1F7C0 AFAF0014 */ sw $t7, 0x0014($sp)
/* 01E44 80B1F7C4 8FBF001C */ lw $ra, 0x001C($sp)
/* 01E48 80B1F7C8 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000
/* 01E4C 80B1F7CC 03E00008 */ jr $ra
/* 01E50 80B1F7D0 00000000 */ nop

View File

@ -1,10 +0,0 @@
glabel func_80B1F7D4
/* 01E54 80B1F7D4 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0
/* 01E58 80B1F7D8 8FAE0030 */ lw $t6, 0x0030($sp)
/* 01E5C 80B1F7DC AFBF001C */ sw $ra, 0x001C($sp)
/* 01E60 80B1F7E0 0C024348 */ jal func_80090D20
/* 01E64 80B1F7E4 AFAE0010 */ sw $t6, 0x0010($sp)
/* 01E68 80B1F7E8 8FBF001C */ lw $ra, 0x001C($sp)
/* 01E6C 80B1F7EC 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000
/* 01E70 80B1F7F0 03E00008 */ jr $ra
/* 01E74 80B1F7F4 00000000 */ nop

View File

@ -1,60 +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 .bss
.balign 16
glabel D_80B20130
.space 0x02
glabel D_80B20132
.space 0x01
glabel D_80B20133
.space 0x03
glabel D_80B20136
.space 0x02
glabel D_80B20138
.space 0x01
glabel D_80B20139
.space 0x03
glabel D_80B2013C
.space 0x02
glabel D_80B2013E
.space 0x01
glabel D_80B2013F
.space 0x03
glabel D_80B20142
.space 0x06
glabel D_80B20148
.space 0x08
glabel D_80B20150
.space 0x04
glabel D_80B20154
.space 0x04
glabel D_80B20158
.space 0x04
glabel D_80B2015C
.space 0x01
glabel D_80B2015D
.space 0x01
glabel D_80B2015E
.space 0x01
glabel D_80B2015F
.space 0x01
glabel D_80B20160
.space 0x01
glabel D_80B20161
.space 0x01
glabel D_80B20162
.space 0x01
glabel D_80B20163
.space 0x01
glabel D_80B20164
.space 0x01
glabel D_80B20165
.space 0x0B

View File

@ -1,32 +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 En_Torch2_InitVars
.word 0x00330900, 0x00000035, 0x00200000, 0x00000A94
.word EnTorch2_Init
.word EnTorch2_Destroy
.word EnTorch2_Update
.word EnTorch2_Draw
glabel D_80B1F9F0
.word 0x00000000
glabel D_80B1F9F4
.word 0x00000000
glabel D_80B1F9F8
.word 0x00000000
glabel D_80B1F9FC
.word 0x00000000
glabel D_80B1FA00
.word 0x00000000
glabel D_80B1FA04
.word 0x00000000
glabel D_80B1FA08
.word 0x10020102, 0x10020210, 0x01020402, 0x02020202, 0x02E260D3, 0x00000104, 0x02020804, 0x00000400, 0x00000000, 0x00000000

6
spec
View File

@ -3072,9 +3072,11 @@ endseg
beginseg
name "ovl_En_Torch2"
include "build/src/overlays/actors/ovl_En_Torch2/z_en_torch2.o"
include "build/data/overlays/actors/z_en_torch2.data.o"
include "build/data/overlays/actors/z_en_torch2.bss.o"
#ifdef NON_MATCHING
include "build/src/overlays/actors/ovl_En_Torch2/ovl_En_Torch2_reloc.o"
#else
include "build/data/overlays/actors/z_en_torch2.reloc.o"
#endif
endseg
beginseg

View File

@ -15,10 +15,10 @@ void EnBlkobj_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnBlkobj_Update(Actor* thisx, GlobalContext* globalCtx);
void EnBlkobj_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_809C2148(EnBlkobj* this, GlobalContext* globalCtx);
void func_809C21A0(EnBlkobj* this, GlobalContext* globalCtx);
void func_809C2218(EnBlkobj* this, GlobalContext* globalCtx);
void func_809C22F4(EnBlkobj* this, GlobalContext* globalCtx);
void EnBlkobj_Wait(EnBlkobj* this, GlobalContext* globalCtx);
void EnBlkobj_SpawnDarkLink(EnBlkobj* this, GlobalContext* globalCtx);
void EnBlkobj_DarkLinkFight(EnBlkobj* this, GlobalContext* globalCtx);
void EnBlkobj_DoNothing(EnBlkobj* this, GlobalContext* globalCtx);
const ActorInit En_Blkobj_InitVars = {
ACTOR_EN_BLKOBJ,
@ -39,109 +39,109 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_STOP),
};
static Gfx D_809C2590[] = {
static Gfx sSetupOpaDL[] = {
gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_OPA_SURF2),
gsSPEndDisplayList(),
};
static Gfx D_809C25A0[] = {
static Gfx sSetupXluDL[] = {
gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_SURF2),
gsSPEndDisplayList(),
};
extern Gfx D_060014E0[];
extern Gfx D_060053D0[];
extern UNK_TYPE D_06007564;
extern ColHeader D_06007564;
void func_809C2060(EnBlkobj* this, EnBlkobjActionFunc actionFunc) {
void EnBlkobj_SetupAction(EnBlkobj* this, EnBlkobjActionFunc actionFunc) {
this->actionFunc = actionFunc;
this->unk_166 = 0;
this->timer = 0;
}
void EnBlkobj_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnBlkobj* this = THIS;
s32 localC = 0;
ColHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyInfo_SetActorMove(&this->dyna, 0);
if (Flags_GetClear(globalCtx, this->dyna.actor.room)) {
this->unk_164 = 0xFF;
func_809C2060(this, func_809C22F4);
this->alpha = 255;
EnBlkobj_SetupAction(this, EnBlkobj_DoNothing);
} else {
DynaPolyInfo_Alloc(&D_06007564, &localC);
DynaPolyInfo_Alloc(&D_06007564, &colHeader);
this->dyna.dynaPolyId =
DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, localC);
func_809C2060(this, func_809C2148);
DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
EnBlkobj_SetupAction(this, EnBlkobj_Wait);
}
}
void EnBlkobj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnBlkobj* this = THIS;
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
}
void func_809C2148(EnBlkobj* this, GlobalContext* globalCtx) {
void EnBlkobj_Wait(EnBlkobj* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
if (this->dyna.actor.xzDistFromLink < 120.0f) {
func_809C2060(this, func_809C21A0);
EnBlkobj_SetupAction(this, EnBlkobj_SpawnDarkLink);
}
player->stateFlags2 |= 0x4000000;
player->stateFlags2 |= 0x04000000;
}
void func_809C21A0(EnBlkobj* this, GlobalContext* globalCtx) {
void EnBlkobj_SpawnDarkLink(EnBlkobj* this, GlobalContext* globalCtx) {
if (!(this->dyna.actor.flags & 0x40)) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TORCH2, this->dyna.actor.posRot.pos.x,
this->dyna.actor.posRot.pos.y, this->dyna.actor.posRot.pos.z, 0, this->dyna.actor.yawTowardsLink, 0,
0);
func_809C2060(this, func_809C2218);
EnBlkobj_SetupAction(this, EnBlkobj_DarkLinkFight);
}
}
void func_809C2218(EnBlkobj* this, GlobalContext* globalCtx) {
s32 temp;
void EnBlkobj_DarkLinkFight(EnBlkobj* this, GlobalContext* globalCtx) {
s32 alphaMod;
if (this->unk_166 == 0) {
if (this->timer == 0) {
if (Actor_Find(&globalCtx->actorCtx, ACTOR_EN_TORCH2, ACTORTYPE_BOSS) == NULL) {
Flags_SetClear(globalCtx, this->dyna.actor.room);
this->unk_166 += 1;
this->timer++;
}
} else {
if (this->unk_166++ > 100) {
temp = (this->unk_166 - 100) >> 2;
if (temp > 5) {
temp = 5;
}
this->unk_164 += temp;
if (this->unk_164 > 255) {
this->unk_164 = 255;
func_809C2060(this, func_809C22F4);
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
}
} else if (this->timer++ > 100) {
alphaMod = (this->timer - 100) >> 2;
if (alphaMod > 5) {
alphaMod = 5;
}
this->alpha += alphaMod;
if (this->alpha > 255) {
this->alpha = 255;
EnBlkobj_SetupAction(this, EnBlkobj_DoNothing);
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
}
}
}
void func_809C22F4(EnBlkobj* this, GlobalContext* globalCtx) {
void EnBlkobj_DoNothing(EnBlkobj* this, GlobalContext* globalCtx) {
}
void EnBlkobj_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnBlkobj* this = THIS;
this->actionFunc(this, globalCtx);
}
void func_809C2324(GlobalContext* globalCtx, Gfx* dList, s32 alpha) {
void EnBlkobj_DrawAlpha(GlobalContext* globalCtx, Gfx* dList, s32 alpha) {
Gfx* segment;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 322);
if (alpha == 255) {
segment = D_809C2590;
segment = sSetupOpaDL;
} else {
segment = D_809C25A0;
segment = sSetupXluDL;
}
gSPSegment(POLY_XLU_DISP++, 0x08, segment);
@ -152,9 +152,9 @@ void func_809C2324(GlobalContext* globalCtx, Gfx* dList, s32 alpha) {
}
void EnBlkobj_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnBlkobj* this = THIS;
s32 pad;
s32 temp_a3;
EnBlkobj* this = THIS;
s32 illusionAlpha;
u32 gameplayFrames;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 349);
@ -168,12 +168,12 @@ void EnBlkobj_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 363),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (this->unk_164 != 0) {
func_809C2324(globalCtx, D_060014E0, this->unk_164);
if (this->alpha != 0) {
EnBlkobj_DrawAlpha(globalCtx, D_060014E0, this->alpha);
}
temp_a3 = 255 - this->unk_164;
if (temp_a3 != 0) {
func_809C2324(globalCtx, D_060053D0, temp_a3);
illusionAlpha = 255 - this->alpha;
if (illusionAlpha != 0) {
EnBlkobj_DrawAlpha(globalCtx, D_060053D0, illusionAlpha);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 375);

View File

@ -10,8 +10,8 @@ typedef void (*EnBlkobjActionFunc)(struct EnBlkobj*, GlobalContext*);
typedef struct EnBlkobj {
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ s16 unk_164;
/* 0x0166 */ s16 unk_166;
/* 0x0164 */ s16 alpha;
/* 0x0166 */ s16 timer;
/* 0x0168 */ EnBlkobjActionFunc actionFunc;
} EnBlkobj; // size = 0x016C

View File

@ -10,12 +10,51 @@
#define THIS ((Player*)thisx)
typedef enum {
/* 0 */ ENTORCH2_WAIT,
/* 1 */ ENTORCH2_ATTACK,
/* 2 */ ENTORCH2_DEATH,
/* 3 */ ENTORCH2_DAMAGE
} EnTorch2ActionStates;
typedef enum {
/* 0 */ FORWARD_SLASH_1H,
/* 1 */ FORWARD_SLASH_2H,
/* 2 */ FORWARD_COMBO_1H,
/* 3 */ FORWARD_COMBO_2H,
/* 4 */ RIGHT_SLASH_1H,
/* 5 */ RIGHT_SLASH_2H,
/* 6 */ RIGHT_COMBO_1H,
/* 7 */ RIGHT_COMBO_2H,
/* 8 */ LEFT_SLASH_1H,
/* 9 */ LEFT_SLASH_2H,
/* 10 */ LEFT_COMBO_1H,
/* 11 */ LEFT_COMBO_2H,
/* 12 */ STAB_1H,
/* 13 */ STAB_2H,
/* 14 */ STAB_COMBO_1H,
/* 15 */ STAB_COMBO_2H,
/* 16 */ FLIPSLASH_START,
/* 17 */ JUMPSLASH_START,
/* 18 */ FLIPSLASH_FINISH,
/* 19 */ JUMPSLASH_FINISH,
/* 20 */ BACKSLASH_RIGHT,
/* 21 */ BACKSLASH_LEFT,
/* 22 */ HAMMER_FORWARD,
/* 23 */ HAMMER_SIDE,
/* 24 */ SPIN_ATTACK_1H,
/* 25 */ SPIN_ATTACK_2H,
/* 26 */ BIG_SPIN_1H,
/* 27 */ BIG_SPIN_2H
} PlayerSwordAnimation;
void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx);
void EnTorch2_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx);
void EnTorch2_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
extern FlexSkeletonHeader D_06004764;
const ActorInit En_Torch2_InitVars = {
ACTOR_EN_TORCH2,
ACTORTYPE_BOSS,
@ -27,21 +66,719 @@ const ActorInit En_Torch2_InitVars = {
(ActorFunc)EnTorch2_Update,
(ActorFunc)EnTorch2_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Torch2/EnTorch2_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Torch2/EnTorch2_Destroy.s")
/* static */ f32 sStickTilt = 0.0f;
/* static */ s16 sStickAngle = 0;
/* static */ f32 sSwordJumpHeight = 0.0f;
/* static */ s32 sHoldShieldTimer = 0;
/* static */ u8 sZTargetFlag = false;
/* static */ u8 sDeathFlag = false;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Torch2/func_80B1DB98.s")
/* static */ Input sInput;
/* static */ u8 sSwordJumpState;
/* static */ Vec3f sSpawnPoint;
/* static */ u8 sJumpslashTimer;
/* static */ u8 sJumpslashFlag;
/* static */ u8 sActionState;
/* static */ u8 sSwordJumpTimer;
/* static */ u8 sCounterState;
/* static */ u8 sDodgeRollState;
/* static */ u8 sStaggerCount;
/* static */ u8 sStaggerTimer;
/* static */ s8 sLastSwordAnim;
/* static */ u8 sAlpha;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Torch2/func_80B1DBD8.s")
static DamageTable sDamageTable = {
0x10, 0x02, 0x01, 0x02, 0x10, 0x02, 0x02, 0x10, 0x01, 0x02, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0xE2, 0x60, 0xD3, 0x00, 0x00, 0x01, 0x04, 0x02, 0x02, 0x08, 0x04, 0x00, 0x00, 0x04, 0x00,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Torch2/func_80B1DD70.s")
void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
Player* this = THIS;
sInput.cur.button = sInput.press.button = sInput.rel.button = 0;
sInput.cur.stick_x = sInput.cur.stick_y = 0;
this->currentShield = PLAYER_SHIELD_HYLIAN;
this->heldItemActionParam = this->heldItemId = PLAYER_AP_SWORD_MASTER;
Player_SetModelGroup(this, 2);
globalCtx->playerInit(this, globalCtx, &D_06004764);
this->actor.naviEnemyId = 0x26;
this->cylinder.base.acFlags = 9;
this->swordQuads[0].base.atFlags = this->swordQuads[1].base.atFlags = 0x11;
this->swordQuads[0].base.acFlags = this->swordQuads[1].base.acFlags = 0xD;
this->swordQuads[0].base.type = this->swordQuads[1].base.type = 9;
this->swordQuads[0].body.toucher.damage = this->swordQuads[1].body.toucher.damage = 8;
this->swordQuads[0].body.bumperFlags = this->swordQuads[1].body.bumperFlags = 1;
this->shieldQuad.base.atFlags = 0x11;
this->shieldQuad.base.acFlags = 0xD;
this->actor.colChkInfo.damageTable = &sDamageTable;
this->actor.colChkInfo.health = gSaveContext.healthCapacity >> 3;
this->actor.colChkInfo.unk_10 = 60;
this->actor.colChkInfo.unk_12 = 100;
globalCtx->func_11D54(this, globalCtx);
sActionState = ENTORCH2_WAIT;
sDodgeRollState = 0;
sSwordJumpHeight = 0.0f;
sSwordJumpState = 0;
sJumpslashTimer = 0;
sJumpslashFlag = false;
sCounterState = sStaggerTimer = sStaggerCount = 0;
sLastSwordAnim = 0;
sAlpha = 95;
sSpawnPoint = this->actor.initPosRot.pos;
}
void EnTorch2_Destroy(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
Player* this = THIS;
Effect_Delete(globalCtx, this->swordEffectIndex);
func_800F5B58();
Collider_DestroyCylinder(globalCtx, &this->cylinder);
Collider_DestroyQuad(globalCtx, &this->swordQuads[0]);
Collider_DestroyQuad(globalCtx, &this->swordQuads[1]);
Collider_DestroyQuad(globalCtx, &this->shieldQuad);
}
Actor* EnTorch2_GetAttackItem(GlobalContext* globalCtx, Player* this) {
Actor* rangedItem = func_80033780(globalCtx, &this->actor, 4000.0f);
if (rangedItem != NULL) {
return rangedItem;
} else {
return func_80033684(globalCtx, &this->actor);
}
}
s32 EnTorch2_SwingSword(GlobalContext* globalCtx, Input* input, Player* this) {
f32 noAttackChance = 0.0f;
s32 attackDelay = 7;
Player* player = PLAYER;
if ((this->linearVelocity < 0.0f) || (player->linearVelocity < 0.0f)) {
return 0;
}
if (gSaveContext.health < 0x50) {
attackDelay = 15;
noAttackChance += 0.3f;
}
if (sAlpha != 255) {
noAttackChance += 2.0f;
}
if ((((globalCtx->gameplayFrames & attackDelay) == 0) || (sSwordJumpState != 0)) &&
(noAttackChance <= Rand_ZeroOne())) {
if (sSwordJumpState == 0) {
switch ((s32)(Rand_ZeroOne() * 7.0f)) {
case 1:
case 5:
sStickAngle += 0x4000;
sStickTilt = 127.0f;
break;
case 2:
case 6:
sStickAngle -= 0x4000;
sStickTilt = 127.0f;
break;
}
}
input->cur.button = BTN_B;
return 1;
}
return 0;
}
void EnTorch2_Backflip(Player* this, Input* input, Actor* thisx) {
thisx->posRot.rot.y = thisx->shape.rot.y = thisx->yawTowardsLink;
sStickAngle = thisx->yawTowardsLink + 0x8000;
sStickTilt = 127.0f;
sZTargetFlag = true;
input->cur.button = BTN_A;
this->invincibilityTimer = 10;
sCounterState = 0;
}
#ifdef NON_MATCHING
/**
* Static variables are sometimes loaded from pointers and sometimes directly. While
* neither this nor the original are consistent about it, unfortunately they're not
* inconsistent in the same way. Also a small instruction mismatch in the input section
*/
void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
Player* player = PLAYER;
Player* this = THIS;
Input* input = &sInput;
u16 phi_a2;
s8 tempX;
s8 tempY;
Camera* camera;
u8 staggerThreshold;
s8 temp;
s16 sp66;
u32 phi_v0;
Actor* attackItem;
s16 sp5A;
s16 pad58;
s32 pad54;
f32 sp50;
s16 sp4E;
s16 pad4C;
sp5A = player->actor.shape.rot.y - this->actor.shape.rot.y;
input->cur.button = 0;
camera = Gameplay_GetCamera(globalCtx, 0);
attackItem = EnTorch2_GetAttackItem(globalCtx, this);
switch (sActionState) {
case ENTORCH2_WAIT:
this->actor.shape.rot.y = this->actor.posRot.rot.y = this->actor.yawTowardsLink;
this->skelAnime.animCurrentFrame = 0.0f;
this->skelAnime.animPlaybackSpeed = 0.0f;
this->actor.posRot.pos.x = (Math_SinS(this->actor.posRot.rot.y) * 25.0f) + sSpawnPoint.x;
this->actor.posRot.pos.z = (Math_CosS(this->actor.posRot.rot.y) * 25.0f) + sSpawnPoint.z;
if ((this->actor.xzDistFromLink <= 120.0f) || func_80033A84(globalCtx, &this->actor) ||
(attackItem != NULL)) {
if (attackItem != NULL) {
sDodgeRollState = 1;
sStickAngle = this->actor.yawTowardsLink;
sStickTilt = 127.0f;
input->cur.button = BTN_A;
sZTargetFlag = false;
sp66 = camera->camDir.y - sStickAngle;
input->cur.stick_x = sStickTilt * Math_SinS(sp66);
temp = sStickTilt * Math_CosS(sp66);
input->cur.stick_y = temp;
}
func_800F5ACC(0x38);
sActionState = ENTORCH2_ATTACK;
}
break;
case ENTORCH2_ATTACK:
sStickTilt = 0.0f;
// Handles Dark Link's sword clanking on Link's sword
if ((this->swordQuads[0].base.acFlags & 0x80) || (this->swordQuads[1].base.acFlags & 0x80)) {
this->swordQuads[0].base.acFlags &= ~0x80;
this->swordQuads[1].base.acFlags &= ~0x80;
this->swordQuads[0].base.atFlags |= 4; // Loads these out of order
this->swordQuads[1].base.atFlags |= 4;
this->cylinder.base.acFlags &= ~2;
if (sLastSwordAnim != this->swordAnimation) {
sStaggerCount++;
sLastSwordAnim = this->swordAnimation;
}
/*! @bug
* This code is needed to reset sCounterState, and should run regardless
* of how much health Link has. Without it, sCounterState stays at 2 until
* something else resets it, preventing Dark Link from using his shield and
* creating a hole in his defenses. This also makes Dark Link harder at low
* health, while the other health checks are intended to make him easier.
*/
if ((gSaveContext.health < 0x50) && (sCounterState != 0)) { // Loads in wrong order
sCounterState = 0;
sStaggerTimer = 50;
}
}
if ((sCounterState != 0) && (this->swordState != 0)) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->swordQuads[0].base);
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->swordQuads[1].base);
}
// Ignores hits when jumping on Link's sword
if ((this->invincibilityTimer < 0) && (sActionState != ENTORCH2_DAMAGE) &&
(this->cylinder.base.acFlags & 2)) {
this->cylinder.base.acFlags &= ~2;
}
// Handles Dark Link rolling to dodge item attacks
if (sDodgeRollState != 0) {
sStickTilt = 127.0f;
} else if (attackItem != NULL) {
sDodgeRollState = 1;
sStickAngle = this->actor.yawTowardsLink;
sStickTilt = 127.0f;
input->cur.button = BTN_A;
} else if (sJumpslashTimer == 0) {
// Handles Dark Link's initial reaction to jumpslashes
if (((player->swordState != 0) || (player->actor.velocity.y > -3.0f)) &&
(player->swordAnimation == JUMPSLASH_START)) {
this->actor.posRot.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsLink;
if (globalCtx->gameplayFrames % 2) {
sStickAngle = this->actor.yawTowardsLink + 0x4000;
} else {
sStickAngle = this->actor.yawTowardsLink - 0x4000;
}
sStickTilt = 127.0f; // Does not store with pointer
sJumpslashFlag = false; // Does not store with POinter
input->cur.button |= BTN_A;
sJumpslashTimer = 15;
// Handles jumping on Link's sword
} else if (sSwordJumpState != 0) {
sStickTilt = 0.0f;
player->stateFlags3 |= 4;
Math_SmoothStepToF(&this->actor.posRot.pos.x,
(Math_SinS(player->actor.shape.rot.y - 0x3E8) * 45.0f) +
player->actor.posRot.pos.x,
1.0f, 5.0f, 0.0f);
Math_SmoothStepToF(&this->actor.posRot.pos.z,
(Math_CosS(player->actor.shape.rot.y - 0x3E8) * 45.0f) +
player->actor.posRot.pos.z,
1.0f, 5.0f, 0.0f);
sSwordJumpTimer--;
if ((sSwordJumpTimer == 0) || ((player->invincibilityTimer > 0) && (this->swordState == 0))) {
this->actor.posRot.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsLink;
input->cur.button = BTN_A;
player->stateFlags3 &= ~4;
sStickTilt = 127.0f;
player->skelAnime.animCurrentFrame = 3.0f;
sStickAngle = this->actor.yawTowardsLink + 0x8000;
sSwordJumpTimer = sSwordJumpState = 0;
this->actor.flags |= 1;
} else if (sSwordJumpState == 1) {
if (sSwordJumpTimer < 16) {
EnTorch2_SwingSword(globalCtx, input, this);
sSwordJumpState++;
} else if (sSwordJumpTimer == 19) {
func_800F4190(&this->actor.projectedPos, NA_SE_VO_LI_AUTO_JUMP);
}
}
} else {
// This does nothing, as sHoldShieldTimer is never set.
if (sHoldShieldTimer != 0) {
sHoldShieldTimer--;
input->cur.button = BTN_R;
}
// Handles Dark Link's reaction to sword attack other than jumpslashes
if (func_800354B4(globalCtx, &this->actor, 120.0f, 0x7FFF, 0x7FFF, this->actor.posRot.rot.y)) {
// Loads arguments in wrong order. Probably related to static variables problem.
if ((player->swordAnimation == STAB_1H) && (this->actor.xzDistFromLink < 90.0f)) {
// Handles the reaction to a one-handed stab. If the conditions are satisfied,
// Dark Link jumps on Link's sword. Otherwise he backflips away.
if ((this->swordState == 0) && (sCounterState == 0) && (player->invincibilityTimer == 0) &&
(player->swordAnimation == STAB_1H) && (this->actor.xzDistFromLink <= 85.0f) &&
func_80033A84(globalCtx, &this->actor)) {
sStickTilt = 0.0f;
sSwordJumpState = 1;
player->stateFlags3 |= 4;
this->actor.flags &= ~1;
sSwordJumpTimer = 27;
player->swordState = 0;
player->linearVelocity = 0.0f;
this->invincibilityTimer = -7;
this->linearVelocity = 0.0f;
player->skelAnime.animCurrentFrame = 2.0f;
func_800A3BC0(globalCtx, &player->skelAnime);
sHoldShieldTimer = 0;
input->cur.button = BTN_A;
} else {
EnTorch2_Backflip(this, input, &this->actor);
}
} else {
// Handles reactions to all other sword attacks
sStickAngle = this->actor.yawTowardsLink; // Not loaded into pointer
input->cur.button = BTN_B;
if (player->swordAnimation <= FORWARD_COMBO_2H) {
sStickTilt = 0.0f;
} else if (player->swordAnimation <= RIGHT_COMBO_2H) {
sStickTilt = 127.0f;
sStickAngle += sStickAngle; // Not loaded from pointer
} else if (player->swordAnimation <= LEFT_COMBO_2H) {
sStickTilt = 127.0f;
sStickAngle += -0x4000; // Not loaded from pointer
} else if (player->swordAnimation <= HAMMER_SIDE) {
input->cur.button = BTN_R;
} else if (player->swordAnimation <= BIG_SPIN_2H) {
EnTorch2_Backflip(this, input, &this->actor);
} else {
EnTorch2_Backflip(this, input, &this->actor);
}
if (CHECK_BTN_ANY(input->cur.button, BTN_A | BTN_R) && (this->swordState == 0) &&
(player->swordState != 0)) {
sCounterState = 1;
}
}
} else {
// Handles movement and attacks when not reacting to Link's actions
sStickAngle = this->actor.yawTowardsLink;
sp50 = 0.0f;
if ((90.0f >= this->actor.xzDistFromLink) && (this->actor.xzDistFromLink > 70.0f) &&
(ABS(sp5A) >= 0x7800) &&
((this->actor.unk_10C != 0) || !(player->stateFlags1 & 0x00400000))) {
EnTorch2_SwingSword(globalCtx, input, this);
} else if (((this->actor.xzDistFromLink <= 70.0f) ||
((this->actor.xzDistFromLink <= 80.0f + sp50) && (player->swordState != 0))) &&
(this->swordState == 0)) {
if (!EnTorch2_SwingSword(globalCtx, input, this) && (this->swordState == 0) &&
(sCounterState == 0)) {
EnTorch2_Backflip(this, input, &this->actor);
}
} else if (this->actor.xzDistFromLink <= 50 + sp50) {
sStickTilt = 127.0f;
sStickAngle = this->actor.yawTowardsLink;
if (this->actor.unk_10C == 0) {
Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0);
}
} else if (this->actor.xzDistFromLink > 100.0f + sp50) {
if ((player->swordState == 0) || (player->swordAnimation < SPIN_ATTACK_1H) ||
(player->swordAnimation > BIG_SPIN_2H) || (this->actor.xzDistFromLink >= 280.0f)) {
sStickTilt = 127.0f;
sStickAngle = this->actor.yawTowardsLink;
if (this->actor.unk_10C == 0) {
Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0);
}
} else {
EnTorch2_Backflip(this, input, &this->actor);
}
} else if (((ABS(sp5A) < 0x7800) && (ABS(sp5A) >= 0x3000)) ||
!EnTorch2_SwingSword(globalCtx, input, this)) {
sStickAngle = this->actor.yawTowardsLink;
sStickTilt = 127.0f;
if (this->actor.unk_10C == 0) {
Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0);
}
}
}
}
// Handles Dark Link's counterattack to jumpslashes
} else if (sJumpslashFlag && (sAlpha == 255) && (this->actor.velocity.y > 0)) {
input->cur.button |= BTN_B;
} else if (!sJumpslashFlag && (this->actor.bgCheckFlags & 1)) {
sStickAngle = this->actor.posRot.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsLink;
if (sAlpha != 255) {
sStickAngle += 0x8000;
sStickTilt = 127.0f; // Not loaded from pointer
sZTargetFlag = true;
}
input->cur.button |= BTN_A;
sJumpslashFlag = true;
this->invincibilityTimer = 10;
}
// Rotates Dark Link's stick angle from Link-relative to camera-relative.
sp66 = camera->camDir.y - sStickAngle;
input->cur.stick_x = Math_SinS(sp66) * sStickTilt;
temp = Math_CosS(sp66) * sStickTilt;
input->cur.stick_y = temp;
if ((sAlpha != 255) && ((globalCtx->gameplayFrames % 8) == 0)) {
sAlpha++;
}
break;
case ENTORCH2_DAMAGE:
this->swordState = 0;
input->cur.stick_x = input->cur.stick_y = 0;
if ((this->invincibilityTimer > 0) && (this->actor.posRot.pos.y < (this->actor.groundY - 160.0f))) {
this->stateFlags3 &= ~1;
this->actor.flags |= 1;
this->invincibilityTimer = 0;
this->actor.velocity.y = 0.0f;
this->actor.posRot.pos.y = sSpawnPoint.y + 40.0f;
this->actor.posRot.pos.x =
(Math_SinS(player->actor.shape.rot.y) * -120.0f) + player->actor.posRot.pos.x;
this->actor.posRot.pos.z =
(Math_CosS(player->actor.shape.rot.y) * -120.0f) + player->actor.posRot.pos.z;
if (func_8002DB6C(&this->actor, &sSpawnPoint) > 800.0f) {
sp50 = Rand_ZeroOne() * 20.0f;
sp4E = Rand_CenteredFloat(4000.0f);
this->actor.shape.rot.y = this->actor.posRot.rot.y =
Math_Vec3f_Yaw(&sSpawnPoint, &player->actor.posRot.pos);
this->actor.posRot.pos.x =
(Math_SinS(this->actor.posRot.rot.y + sp4E) * (25.0f + sp50)) + sSpawnPoint.x;
this->actor.posRot.pos.z =
(Math_CosS(this->actor.posRot.rot.y + sp4E) * (25.0f + sp50)) + sSpawnPoint.z;
this->actor.posRot.pos.y = sSpawnPoint.y;
} else {
this->actor.posRot.pos.y = this->actor.groundY;
}
Math_Vec3f_Copy(&this->actor.initPosRot.pos, &this->actor.posRot.pos);
globalCtx->func_11D54(this, globalCtx);
sActionState = ENTORCH2_ATTACK;
sStickTilt = 0.0f;
if (sAlpha != 255) {
sStaggerCount = 0;
sStaggerTimer = 0;
}
}
break;
case ENTORCH2_DEATH:
if (sAlpha - 13 <= 0) {
sAlpha = 0;
Actor_Kill(&this->actor);
return;
}
sAlpha -= 13;
this->actor.shape.unk_14 -= 13;
break;
}
// Causes Dark Link to shield in place when Link is using magic attacks other than the spin attack
if ((gSaveContext.unk_13F0 == 3) && (player->swordState == 0 || (player->swordAnimation < SPIN_ATTACK_1H) ||
(player->swordAnimation > BIG_SPIN_2H))) {
sStickTilt = 0.0f;
input->cur.stick_x = 0;
input->cur.stick_y = 0;
input->cur.button = BTN_R;
}
if ((sActionState == ENTORCH2_ATTACK) && (this->actor.xzDistFromLink <= 610.0f) && sZTargetFlag) {
input->cur.button |= BTN_Z;
}
// Updates Dark Link's "controller". The conditional seems to cause him to
// stop targeting and hold shield if he's been holding it long enough.
phi_a2 = input->cur.button;
pad54 = input->cur.button ^ input->prev.button;
input->press.button = input->cur.button & pad54;
phi_v0 = input->cur.button;
if (input->cur.button & BTN_R) {
input->cur.button = phi_a2;
phi_a2 = ((sCounterState == 0) && (this->swordState == 0)) ? BTN_R : phi_v0 ^ BTN_R;
phi_v0 = phi_a2; // instruction mismatch
}
input->rel.button = input->prev.button & pad54;
input->prev.button = phi_v0 & 0x3FFF; // & ~(BTN_A | BTN_B)
input->cur.button = phi_a2;
PadUtils_UpdateRelXY(input);
input->press.stick_x += (s8)(input->cur.stick_x - input->prev.stick_x);
input->press.stick_y += (s8)(input->cur.stick_y - input->prev.stick_y);
// Handles Dark Link being damaged
if ((this->actor.colChkInfo.health == 0) && sDeathFlag) {
this->csMode = 0x18;
this->unk_448 = &player->actor;
this->unk_46A = 1;
sDeathFlag = false;
}
if ((this->invincibilityTimer == 0) && (this->actor.colChkInfo.health != 0) && (this->cylinder.base.acFlags & 2) &&
!(this->stateFlags1 & 0x04000000) && !(this->swordQuads[0].base.atFlags & 2) &&
!(this->swordQuads[1].base.atFlags & 2)) {
if (!Actor_ApplyDamage(&this->actor)) {
func_800F5B58();
this->actor.flags &= ~5;
this->unk_8A1 = 2;
this->unk_8A4 = 6.0f;
this->unk_8A8 = 6.0f;
this->unk_8A0 = this->actor.colChkInfo.damage;
this->unk_8A2 = this->actor.yawTowardsLink + 0x8000;
sDeathFlag++;
sActionState = ENTORCH2_DEATH;
func_80032C7C(globalCtx, &this->actor);
Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.posRot.pos, 0xC0);
this->stateFlags3 &= ~4;
} else {
func_800F5ACC(0x38);
if (this->actor.colChkInfo.damageEffect == 1) {
if (sAlpha == 255) {
func_8003426C(&this->actor, 0, 0xFF, 0, 0x50);
} else {
func_8003426C(&this->actor, 0, 0xFF, 0x2000, 0x50);
}
} else {
this->actor.flags &= ~1;
this->unk_8A1 = 1;
this->unk_8A8 = 6.0f;
this->unk_8A0 = this->actor.colChkInfo.damage;
this->unk_8A4 = 8.0f;
this->unk_8A2 = this->actor.yawTowardsLink + 0x8000;
func_80035650(&this->actor, &this->cylinder.body, 1);
this->stateFlags3 &= ~4;
this->stateFlags3 |= 1;
sActionState = ENTORCH2_DAMAGE;
if (sAlpha == 255) {
func_8003426C(&this->actor, 0x4000, 0xFF, 0, 0xC);
} else {
func_8003426C(&this->actor, 0x4000, 0xFF, 0x2000, 0xC);
}
}
}
this->actor.colChkInfo.damage = 0;
this->unk_8A0 = 0;
}
// Handles being frozen by a deku nut
if ((this->actor.dmgEffectTimer == 0) || (this->actor.dmgEffectParams & 0x4000)) {
this->stateFlags3 &= ~4;
} else {
this->stateFlags3 |= 4;
this->stateFlags1 &= ~0x04000000;
this->invincibilityTimer = 0;
input->press.stick_x = input->press.stick_y = 0;
/*! @bug
* Setting cur.button to 0 clears the Z-trigger, causing Dark Link to break his
* lock on Link. If he presses A while not locked on, he'll put his sword away.
* This clears his held item param permanently and makes him unable to attack.
*/
input->cur.button = 0;
input->press.button = 0;
this->linearVelocity = 0.0f;
}
globalCtx->playerUpdate(this, globalCtx, input);
/*
* Handles sword clanks and removes their recoil for both Links. Dark Link staggers
* if he's had to counter with enough different sword animations in a row.
*/
if (this->linearVelocity == -18.0f) {
staggerThreshold = (u32)Rand_CenteredFloat(2.0f) + 6;
if (gSaveContext.health < 0x50) {
staggerThreshold = (u32)Rand_CenteredFloat(2.0f) + 3;
}
if (this->actor.xzDistFromLink > 80.0f) {
this->linearVelocity = 1.2f;
} else if (this->actor.xzDistFromLink < 70.0f) {
this->linearVelocity = -1.5f;
} else {
this->linearVelocity = 1.0f;
}
if (staggerThreshold < sStaggerCount) {
this->skelAnime.animPlaybackSpeed *= 0.6f;
func_800F4190(&this->actor.projectedPos, NA_SE_PL_DAMAGE);
sStaggerTimer = 0;
sStaggerCount = 0;
}
}
if (player->linearVelocity == -18.0f) {
if (this->actor.xzDistFromLink > 80.0f) {
player->linearVelocity = 1.2f;
} else if (this->actor.xzDistFromLink < 70.0f) {
player->linearVelocity = -1.5f;
} else {
player->linearVelocity = 1.0f;
}
}
/*
* This ensures Dark Link's counter animation mirrors Link's exactly.
*/
if ((sCounterState != 0) && (sCounterState == 1)) {
if (this->swordState == 0) {
sCounterState = 0;
} else {
sCounterState = 2;
this->swordState = 1;
this->skelAnime.animCurrentFrame = player->skelAnime.animCurrentFrame - player->skelAnime.animPlaybackSpeed;
this->skelAnime.animPlaybackSpeed = player->skelAnime.animPlaybackSpeed;
func_800A3BC0(globalCtx, &this->skelAnime);
Collider_QuadSetAT(globalCtx, &this->swordQuads[0].base);
Collider_QuadSetAT(globalCtx, &this->swordQuads[1].base);
}
}
if (sStaggerTimer != 0) {
sStaggerTimer--;
if (sStaggerTimer == 0) {
sCounterState = 0;
sStaggerCount = 0;
}
}
if (sDodgeRollState != 0) {
if (sDodgeRollState == 1) {
this->invincibilityTimer = 20;
}
sDodgeRollState = (this->invincibilityTimer > 0) ? 2 : 0;
}
if (this->invincibilityTimer != 0) {
this->cylinder.base.type = 0xA;
this->cylinder.body.flags = 5;
} else {
this->cylinder.base.type = 5;
this->cylinder.body.flags = 1;
}
/*
* Handles the jump movement onto Link's sword. Dark Link doesn't move during the
* sword jump. Instead, his shape y-offset is increased (see below). Once the sword
* jump is finished, the offset is added to his position to fix the discrepancy.
*/
if (sSwordJumpState != 0) {
Math_SmoothStepToF(&sSwordJumpHeight, 2630.0f, 1.0f, 2000.0f, 0.0f);
this->actor.velocity.y -= 0.6f;
} else if (sSwordJumpHeight != 0) {
this->actor.posRot.pos.y += sSwordJumpHeight * 0.01f;
sSwordJumpHeight = 0;
}
if ((sActionState == ENTORCH2_WAIT) || (this->invincibilityTimer < 0)) {
sZTargetFlag = false;
} else {
sZTargetFlag = true;
}
if (sJumpslashTimer != 0) {
sJumpslashTimer--;
}
this->actor.posRot2.pos = this->actor.posRot.pos;
this->actor.posRot2.pos.y += 20.0f;
this->actor.shape.unk_08 = sSwordJumpHeight;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Torch2/EnTorch2_Update.s")
#endif
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Torch2/func_80B1F7A8.s")
s32 EnTorch2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx,
Gfx** gfx) {
Player* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Torch2/func_80B1F7D4.s")
return func_8008FCC8(globalCtx, limbIndex, dList, pos, rot, &this->actor);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Torch2/EnTorch2_Draw.s")
void EnTorch2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) {
Player* this = THIS;
func_80090D20(globalCtx, limbIndex, dList, rot, &this->actor);
}
void EnTorch2_Draw(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
Player* this = THIS;
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_torch2.c", 1050);
func_80093C80(globalCtx);
func_80093D84(globalCtx->state.gfxCtx);
if (sAlpha == 255) {
gDPSetEnvColor(POLY_OPA_DISP++, 255, 0, 0, sAlpha);
gSPSegment(POLY_OPA_DISP++, 0x0C, D_80116280 + 2);
func_8002EBCC(&this->actor, globalCtx, 0);
func_8002ED80(&this->actor, globalCtx, 0);
POLY_OPA_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
this->skelAnime.dListCount, EnTorch2_OverrideLimbDraw, EnTorch2_PostLimbDraw,
this, POLY_OPA_DISP);
} else {
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, sAlpha);
gSPSegment(POLY_XLU_DISP++, 0x0C, D_80116280);
func_8002EBCC(&this->actor, globalCtx, 0);
func_8002ED80(&this->actor, globalCtx, 0);
POLY_XLU_DISP = SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl,
this->skelAnime.dListCount, EnTorch2_OverrideLimbDraw, EnTorch2_PostLimbDraw,
this, POLY_XLU_DISP);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_torch2.c", 1114);
}

View File

@ -1603,6 +1603,9 @@ D_0600C080 = 0x0600C080;
D_060088B0 = 0x060088B0;
D_0600BEC0 = 0x0600BEC0;
// z_en_torch2
D_06004764 = 0x06004764;
// z_bg_mori_rakkatenjo
D_06007690 = 0x06007690;
D_060087AC = 0x060087AC;