mirror of
https://github.com/zeldaret/oot.git
synced 2025-05-10 11:03:46 +00:00
matched Math3D_CylVsLineSeg and fixed a Math_ error (#564)
* matched cylvsline * slight name adjustment * format * and asm * comment cleanup * fixed misspelling and added mathfixer tool * formatting Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
This commit is contained in:
parent
b95643b397
commit
3727cc38b8
36 changed files with 382 additions and 1048 deletions
|
@ -1,672 +0,0 @@
|
|||
.late_rodata
|
||||
glabel D_80146544
|
||||
.float 0.008
|
||||
|
||||
glabel D_80146548
|
||||
.float 0.008
|
||||
|
||||
glabel D_8014654C
|
||||
.float 0.008
|
||||
|
||||
.text
|
||||
glabel Math3D_CylVsLineSeg
|
||||
/* B45FAC 800CEE0C 27BDFF08 */ addiu $sp, $sp, -0xf8
|
||||
/* B45FB0 800CEE10 AFBF001C */ sw $ra, 0x1c($sp)
|
||||
/* B45FB4 800CEE14 AFB00018 */ sw $s0, 0x18($sp)
|
||||
/* B45FB8 800CEE18 00808025 */ move $s0, $a0
|
||||
/* B45FBC 800CEE1C AFA500FC */ sw $a1, 0xfc($sp)
|
||||
/* B45FC0 800CEE20 AFA60100 */ sw $a2, 0x100($sp)
|
||||
/* B45FC4 800CEE24 AFA70104 */ sw $a3, 0x104($sp)
|
||||
/* B45FC8 800CEE28 0C033B54 */ jal Math3D_PointInCyl
|
||||
/* B45FCC 800CEE2C AFA0009C */ sw $zero, 0x9c($sp)
|
||||
/* B45FD0 800CEE30 8FA70100 */ lw $a3, 0x100($sp)
|
||||
/* B45FD4 800CEE34 10400019 */ beqz $v0, .L800CEE9C
|
||||
/* B45FD8 800CEE38 8FA8009C */ lw $t0, 0x9c($sp)
|
||||
/* B45FDC 800CEE3C 02002025 */ move $a0, $s0
|
||||
/* B45FE0 800CEE40 00E02825 */ move $a1, $a3
|
||||
/* B45FE4 800CEE44 0C033B54 */ jal Math3D_PointInCyl
|
||||
/* B45FE8 800CEE48 AFA8009C */ sw $t0, 0x9c($sp)
|
||||
/* B45FEC 800CEE4C 8FA70100 */ lw $a3, 0x100($sp)
|
||||
/* B45FF0 800CEE50 10400012 */ beqz $v0, .L800CEE9C
|
||||
/* B45FF4 800CEE54 8FA8009C */ lw $t0, 0x9c($sp)
|
||||
/* B45FF8 800CEE58 8FB900FC */ lw $t9, 0xfc($sp)
|
||||
/* B45FFC 800CEE5C 8FAF0104 */ lw $t7, 0x104($sp)
|
||||
/* B46000 800CEE60 24020002 */ li $v0, 2
|
||||
/* B46004 800CEE64 8F290000 */ lw $t1, ($t9)
|
||||
/* B46008 800CEE68 ADE90000 */ sw $t1, ($t7)
|
||||
/* B4600C 800CEE6C 8F380004 */ lw $t8, 4($t9)
|
||||
/* B46010 800CEE70 ADF80004 */ sw $t8, 4($t7)
|
||||
/* B46014 800CEE74 8F290008 */ lw $t1, 8($t9)
|
||||
/* B46018 800CEE78 ADE90008 */ sw $t1, 8($t7)
|
||||
/* B4601C 800CEE7C 8CEC0000 */ lw $t4, ($a3)
|
||||
/* B46020 800CEE80 8FAA0108 */ lw $t2, 0x108($sp)
|
||||
/* B46024 800CEE84 AD4C0000 */ sw $t4, ($t2)
|
||||
/* B46028 800CEE88 8CEB0004 */ lw $t3, 4($a3)
|
||||
/* B4602C 800CEE8C AD4B0004 */ sw $t3, 4($t2)
|
||||
/* B46030 800CEE90 8CEC0008 */ lw $t4, 8($a3)
|
||||
/* B46034 800CEE94 10000249 */ b .L800CF7BC
|
||||
/* B46038 800CEE98 AD4C0008 */ sw $t4, 8($t2)
|
||||
.L800CEE9C:
|
||||
/* B4603C 800CEE9C 860D0006 */ lh $t5, 6($s0)
|
||||
/* B46040 800CEEA0 8FA200FC */ lw $v0, 0xfc($sp)
|
||||
/* B46044 800CEEA4 27A400E0 */ addiu $a0, $sp, 0xe0
|
||||
/* B46048 800CEEA8 448D3000 */ mtc1 $t5, $f6
|
||||
/* B4604C 800CEEAC C44A0000 */ lwc1 $f10, ($v0)
|
||||
/* B46050 800CEEB0 27A500EC */ addiu $a1, $sp, 0xec
|
||||
/* B46054 800CEEB4 46803220 */ cvt.s.w $f8, $f6
|
||||
/* B46058 800CEEB8 27A600D4 */ addiu $a2, $sp, 0xd4
|
||||
/* B4605C 800CEEBC 46085101 */ sub.s $f4, $f10, $f8
|
||||
/* B46060 800CEEC0 E7A400EC */ swc1 $f4, 0xec($sp)
|
||||
/* B46064 800CEEC4 860E0008 */ lh $t6, 8($s0)
|
||||
/* B46068 800CEEC8 860F0004 */ lh $t7, 4($s0)
|
||||
/* B4606C 800CEECC C4460004 */ lwc1 $f6, 4($v0)
|
||||
/* B46070 800CEED0 448E5000 */ mtc1 $t6, $f10
|
||||
/* B46074 800CEED4 00000000 */ nop
|
||||
/* B46078 800CEED8 46805220 */ cvt.s.w $f8, $f10
|
||||
/* B4607C 800CEEDC 448F5000 */ mtc1 $t7, $f10
|
||||
/* B46080 800CEEE0 46083101 */ sub.s $f4, $f6, $f8
|
||||
/* B46084 800CEEE4 468051A0 */ cvt.s.w $f6, $f10
|
||||
/* B46088 800CEEE8 46062201 */ sub.s $f8, $f4, $f6
|
||||
/* B4608C 800CEEEC E7A800F0 */ swc1 $f8, 0xf0($sp)
|
||||
/* B46090 800CEEF0 8619000A */ lh $t9, 0xa($s0)
|
||||
/* B46094 800CEEF4 C44A0008 */ lwc1 $f10, 8($v0)
|
||||
/* B46098 800CEEF8 44992000 */ mtc1 $t9, $f4
|
||||
/* B4609C 800CEEFC 00000000 */ nop
|
||||
/* B460A0 800CEF00 468021A0 */ cvt.s.w $f6, $f4
|
||||
/* B460A4 800CEF04 46065201 */ sub.s $f8, $f10, $f6
|
||||
/* B460A8 800CEF08 E7A800F4 */ swc1 $f8, 0xf4($sp)
|
||||
/* B460AC 800CEF0C 86180006 */ lh $t8, 6($s0)
|
||||
/* B460B0 800CEF10 C4E40000 */ lwc1 $f4, ($a3)
|
||||
/* B460B4 800CEF14 44985000 */ mtc1 $t8, $f10
|
||||
/* B460B8 800CEF18 00000000 */ nop
|
||||
/* B460BC 800CEF1C 468051A0 */ cvt.s.w $f6, $f10
|
||||
/* B460C0 800CEF20 46062201 */ sub.s $f8, $f4, $f6
|
||||
/* B460C4 800CEF24 E7A800E0 */ swc1 $f8, 0xe0($sp)
|
||||
/* B460C8 800CEF28 86090008 */ lh $t1, 8($s0)
|
||||
/* B460CC 800CEF2C 860A0004 */ lh $t2, 4($s0)
|
||||
/* B460D0 800CEF30 C4EA0004 */ lwc1 $f10, 4($a3)
|
||||
/* B460D4 800CEF34 44892000 */ mtc1 $t1, $f4
|
||||
/* B460D8 800CEF38 00000000 */ nop
|
||||
/* B460DC 800CEF3C 468021A0 */ cvt.s.w $f6, $f4
|
||||
/* B460E0 800CEF40 448A2000 */ mtc1 $t2, $f4
|
||||
/* B460E4 800CEF44 46065201 */ sub.s $f8, $f10, $f6
|
||||
/* B460E8 800CEF48 468022A0 */ cvt.s.w $f10, $f4
|
||||
/* B460EC 800CEF4C 460A4181 */ sub.s $f6, $f8, $f10
|
||||
/* B460F0 800CEF50 E7A600E4 */ swc1 $f6, 0xe4($sp)
|
||||
/* B460F4 800CEF54 860B000A */ lh $t3, 0xa($s0)
|
||||
/* B460F8 800CEF58 C4E40008 */ lwc1 $f4, 8($a3)
|
||||
/* B460FC 800CEF5C AFA8009C */ sw $t0, 0x9c($sp)
|
||||
/* B46100 800CEF60 448B4000 */ mtc1 $t3, $f8
|
||||
/* B46104 800CEF64 00000000 */ nop
|
||||
/* B46108 800CEF68 468042A0 */ cvt.s.w $f10, $f8
|
||||
/* B4610C 800CEF6C 460A2181 */ sub.s $f6, $f4, $f10
|
||||
/* B46110 800CEF70 0C01DFB4 */ jal Math_Vec3f_Diff
|
||||
/* B46114 800CEF74 E7A600E8 */ swc1 $f6, 0xe8($sp)
|
||||
/* B46118 800CEF78 86020000 */ lh $v0, ($s0)
|
||||
/* B4611C 800CEF7C C7A400D8 */ lwc1 $f4, 0xd8($sp)
|
||||
/* B46120 800CEF80 3C018014 */ lui $at, %hi(D_80146544)
|
||||
/* B46124 800CEF84 00420019 */ multu $v0, $v0
|
||||
/* B46128 800CEF88 C42A6544 */ lwc1 $f10, %lo(D_80146544)($at)
|
||||
/* B4612C 800CEF8C 46002005 */ abs.s $f0, $f4
|
||||
/* B46130 800CEF90 8FA8009C */ lw $t0, 0x9c($sp)
|
||||
/* B46134 800CEF94 460A003C */ c.lt.s $f0, $f10
|
||||
/* B46138 800CEF98 C7A600F0 */ lwc1 $f6, 0xf0($sp)
|
||||
/* B4613C 800CEF9C 00006012 */ mflo $t4
|
||||
/* B46140 800CEFA0 448C4000 */ mtc1 $t4, $f8
|
||||
/* B46144 800CEFA4 4501006D */ bc1t .L800CF15C
|
||||
/* B46148 800CEFA8 468043A0 */ cvt.s.w $f14, $f8
|
||||
/* B4614C 800CEFAC 46003207 */ neg.s $f8, $f6
|
||||
/* B46150 800CEFB0 44805000 */ mtc1 $zero, $f10
|
||||
/* B46154 800CEFB4 46044003 */ div.s $f0, $f8, $f4
|
||||
/* B46158 800CEFB8 3C013F80 */ li $at, 0x3F800000 # 0.000000
|
||||
/* B4615C 800CEFBC 4600503E */ c.le.s $f10, $f0
|
||||
/* B46160 800CEFC0 00000000 */ nop
|
||||
/* B46164 800CEFC4 4502002B */ bc1fl .L800CF074
|
||||
/* B46168 800CEFC8 86180002 */ lh $t8, 2($s0)
|
||||
/* B4616C 800CEFCC 44813000 */ mtc1 $at, $f6
|
||||
/* B46170 800CEFD0 C7A800D4 */ lwc1 $f8, 0xd4($sp)
|
||||
/* B46174 800CEFD4 4606003E */ c.le.s $f0, $f6
|
||||
/* B46178 800CEFD8 C7A600DC */ lwc1 $f6, 0xdc($sp)
|
||||
/* B4617C 800CEFDC 45020025 */ bc1fl .L800CF074
|
||||
/* B46180 800CEFE0 86180002 */ lh $t8, 2($s0)
|
||||
/* B46184 800CEFE4 46004102 */ mul.s $f4, $f8, $f0
|
||||
/* B46188 800CEFE8 C7AA00EC */ lwc1 $f10, 0xec($sp)
|
||||
/* B4618C 800CEFEC 46003202 */ mul.s $f8, $f6, $f0
|
||||
/* B46190 800CEFF0 460A2080 */ add.s $f2, $f4, $f10
|
||||
/* B46194 800CEFF4 C7A400F4 */ lwc1 $f4, 0xf4($sp)
|
||||
/* B46198 800CEFF8 46044300 */ add.s $f12, $f8, $f4
|
||||
/* B4619C 800CEFFC 46021282 */ mul.s $f10, $f2, $f2
|
||||
/* B461A0 800CF000 00000000 */ nop
|
||||
/* B461A4 800CF004 460C6182 */ mul.s $f6, $f12, $f12
|
||||
/* B461A8 800CF008 46065200 */ add.s $f8, $f10, $f6
|
||||
/* B461AC 800CF00C 460E403C */ c.lt.s $f8, $f14
|
||||
/* B461B0 800CF010 00000000 */ nop
|
||||
/* B461B4 800CF014 45000016 */ bc1f .L800CF070
|
||||
/* B461B8 800CF018 00000000 */ nop
|
||||
/* B461BC 800CF01C 860D0006 */ lh $t5, 6($s0)
|
||||
/* B461C0 800CF020 24080001 */ li $t0, 1
|
||||
/* B461C4 800CF024 448D2000 */ mtc1 $t5, $f4
|
||||
/* B461C8 800CF028 00000000 */ nop
|
||||
/* B461CC 800CF02C 468022A0 */ cvt.s.w $f10, $f4
|
||||
/* B461D0 800CF030 46025180 */ add.s $f6, $f10, $f2
|
||||
/* B461D4 800CF034 E7A6006C */ swc1 $f6, 0x6c($sp)
|
||||
/* B461D8 800CF038 860F0004 */ lh $t7, 4($s0)
|
||||
/* B461DC 800CF03C 860E0008 */ lh $t6, 8($s0)
|
||||
/* B461E0 800CF040 448F5000 */ mtc1 $t7, $f10
|
||||
/* B461E4 800CF044 448E4000 */ mtc1 $t6, $f8
|
||||
/* B461E8 800CF048 468051A0 */ cvt.s.w $f6, $f10
|
||||
/* B461EC 800CF04C 46804120 */ cvt.s.w $f4, $f8
|
||||
/* B461F0 800CF050 46062200 */ add.s $f8, $f4, $f6
|
||||
/* B461F4 800CF054 E7A80070 */ swc1 $f8, 0x70($sp)
|
||||
/* B461F8 800CF058 8619000A */ lh $t9, 0xa($s0)
|
||||
/* B461FC 800CF05C 44995000 */ mtc1 $t9, $f10
|
||||
/* B46200 800CF060 00000000 */ nop
|
||||
/* B46204 800CF064 46805120 */ cvt.s.w $f4, $f10
|
||||
/* B46208 800CF068 460C2180 */ add.s $f6, $f4, $f12
|
||||
/* B4620C 800CF06C E7A60074 */ swc1 $f6, 0x74($sp)
|
||||
.L800CF070:
|
||||
/* B46210 800CF070 86180002 */ lh $t8, 2($s0)
|
||||
.L800CF074:
|
||||
/* B46214 800CF074 C7A400F0 */ lwc1 $f4, 0xf0($sp)
|
||||
/* B46218 800CF078 3C013F80 */ li $at, 0x3F800000 # 0.000000
|
||||
/* B4621C 800CF07C 44984000 */ mtc1 $t8, $f8
|
||||
/* B46220 800CF080 00000000 */ nop
|
||||
/* B46224 800CF084 468042A0 */ cvt.s.w $f10, $f8
|
||||
/* B46228 800CF088 C7A800D8 */ lwc1 $f8, 0xd8($sp)
|
||||
/* B4622C 800CF08C 46045181 */ sub.s $f6, $f10, $f4
|
||||
/* B46230 800CF090 44802000 */ mtc1 $zero, $f4
|
||||
/* B46234 800CF094 46083283 */ div.s $f10, $f6, $f8
|
||||
/* B46238 800CF098 460A203E */ c.le.s $f4, $f10
|
||||
/* B4623C 800CF09C E7AA00D0 */ swc1 $f10, 0xd0($sp)
|
||||
/* B46240 800CF0A0 4502002F */ bc1fl .L800CF160
|
||||
/* B46244 800CF0A4 C7AA00EC */ lwc1 $f10, 0xec($sp)
|
||||
/* B46248 800CF0A8 44813000 */ mtc1 $at, $f6
|
||||
/* B4624C 800CF0AC C7A800D4 */ lwc1 $f8, 0xd4($sp)
|
||||
/* B46250 800CF0B0 4606503E */ c.le.s $f10, $f6
|
||||
/* B46254 800CF0B4 00000000 */ nop
|
||||
/* B46258 800CF0B8 45020029 */ bc1fl .L800CF160
|
||||
/* B4625C 800CF0BC C7AA00EC */ lwc1 $f10, 0xec($sp)
|
||||
/* B46260 800CF0C0 460A4102 */ mul.s $f4, $f8, $f10
|
||||
/* B46264 800CF0C4 C7A600EC */ lwc1 $f6, 0xec($sp)
|
||||
/* B46268 800CF0C8 C7A800DC */ lwc1 $f8, 0xdc($sp)
|
||||
/* B4626C 800CF0CC 46062000 */ add.s $f0, $f4, $f6
|
||||
/* B46270 800CF0D0 460A4102 */ mul.s $f4, $f8, $f10
|
||||
/* B46274 800CF0D4 C7A600F4 */ lwc1 $f6, 0xf4($sp)
|
||||
/* B46278 800CF0D8 46000202 */ mul.s $f8, $f0, $f0
|
||||
/* B4627C 800CF0DC 46062080 */ add.s $f2, $f4, $f6
|
||||
/* B46280 800CF0E0 46021282 */ mul.s $f10, $f2, $f2
|
||||
/* B46284 800CF0E4 460A4100 */ add.s $f4, $f8, $f10
|
||||
/* B46288 800CF0E8 460E203C */ c.lt.s $f4, $f14
|
||||
/* B4628C 800CF0EC 00000000 */ nop
|
||||
/* B46290 800CF0F0 4502001B */ bc1fl .L800CF160
|
||||
/* B46294 800CF0F4 C7AA00EC */ lwc1 $f10, 0xec($sp)
|
||||
/* B46298 800CF0F8 86090006 */ lh $t1, 6($s0)
|
||||
/* B4629C 800CF0FC 35080002 */ ori $t0, $t0, 2
|
||||
/* B462A0 800CF100 44893000 */ mtc1 $t1, $f6
|
||||
/* B462A4 800CF104 00000000 */ nop
|
||||
/* B462A8 800CF108 46803220 */ cvt.s.w $f8, $f6
|
||||
/* B462AC 800CF10C 46004280 */ add.s $f10, $f8, $f0
|
||||
/* B462B0 800CF110 E7AA0078 */ swc1 $f10, 0x78($sp)
|
||||
/* B462B4 800CF114 860B0004 */ lh $t3, 4($s0)
|
||||
/* B462B8 800CF118 860A0008 */ lh $t2, 8($s0)
|
||||
/* B462BC 800CF11C 860C0002 */ lh $t4, 2($s0)
|
||||
/* B462C0 800CF120 448B4000 */ mtc1 $t3, $f8
|
||||
/* B462C4 800CF124 448A2000 */ mtc1 $t2, $f4
|
||||
/* B462C8 800CF128 468042A0 */ cvt.s.w $f10, $f8
|
||||
/* B462CC 800CF12C 448C4000 */ mtc1 $t4, $f8
|
||||
/* B462D0 800CF130 468021A0 */ cvt.s.w $f6, $f4
|
||||
/* B462D4 800CF134 460A3100 */ add.s $f4, $f6, $f10
|
||||
/* B462D8 800CF138 468041A0 */ cvt.s.w $f6, $f8
|
||||
/* B462DC 800CF13C 46062280 */ add.s $f10, $f4, $f6
|
||||
/* B462E0 800CF140 E7AA007C */ swc1 $f10, 0x7c($sp)
|
||||
/* B462E4 800CF144 860D000A */ lh $t5, 0xa($s0)
|
||||
/* B462E8 800CF148 448D4000 */ mtc1 $t5, $f8
|
||||
/* B462EC 800CF14C 00000000 */ nop
|
||||
/* B462F0 800CF150 46804120 */ cvt.s.w $f4, $f8
|
||||
/* B462F4 800CF154 46022180 */ add.s $f6, $f4, $f2
|
||||
/* B462F8 800CF158 E7A60080 */ swc1 $f6, 0x80($sp)
|
||||
.L800CF15C:
|
||||
/* B462FC 800CF15C C7AA00EC */ lwc1 $f10, 0xec($sp)
|
||||
.L800CF160:
|
||||
/* B46300 800CF160 C7A400F4 */ lwc1 $f4, 0xf4($sp)
|
||||
/* B46304 800CF164 3C018014 */ lui $at, %hi(D_80146548)
|
||||
/* B46308 800CF168 460A5202 */ mul.s $f8, $f10, $f10
|
||||
/* B4630C 800CF16C E7AA0020 */ swc1 $f10, 0x20($sp)
|
||||
/* B46310 800CF170 C7AA00DC */ lwc1 $f10, 0xdc($sp)
|
||||
/* B46314 800CF174 46042182 */ mul.s $f6, $f4, $f4
|
||||
/* B46318 800CF178 E7A40024 */ swc1 $f4, 0x24($sp)
|
||||
/* B4631C 800CF17C 46064200 */ add.s $f8, $f8, $f6
|
||||
/* B46320 800CF180 C7A600D4 */ lwc1 $f6, 0xd4($sp)
|
||||
/* B46324 800CF184 460E4401 */ sub.s $f16, $f8, $f14
|
||||
/* B46328 800CF188 46063202 */ mul.s $f8, $f6, $f6
|
||||
/* B4632C 800CF18C 00000000 */ nop
|
||||
/* B46330 800CF190 460A5102 */ mul.s $f4, $f10, $f10
|
||||
/* B46334 800CF194 E7B000B8 */ swc1 $f16, 0xb8($sp)
|
||||
/* B46338 800CF198 46044300 */ add.s $f12, $f8, $f4
|
||||
/* B4633C 800CF19C C4286548 */ lwc1 $f8, %lo(D_80146548)($at)
|
||||
/* B46340 800CF1A0 C7A400D4 */ lwc1 $f4, 0xd4($sp)
|
||||
/* B46344 800CF1A4 460C6480 */ add.s $f18, $f12, $f12
|
||||
/* B46348 800CF1A8 46009005 */ abs.s $f0, $f18
|
||||
/* B4634C 800CF1AC 4608003C */ c.lt.s $f0, $f8
|
||||
/* B46350 800CF1B0 00000000 */ nop
|
||||
/* B46354 800CF1B4 4501002C */ bc1t .L800CF268
|
||||
/* B46358 800CF1B8 00000000 */ nop
|
||||
/* B4635C 800CF1BC C7A40020 */ lwc1 $f4, 0x20($sp)
|
||||
/* B46360 800CF1C0 3C014080 */ li $at, 0x40800000 # 0.000000
|
||||
/* B46364 800CF1C4 46043202 */ mul.s $f8, $f6, $f4
|
||||
/* B46368 800CF1C8 C7A60024 */ lwc1 $f6, 0x24($sp)
|
||||
/* B4636C 800CF1CC 46065102 */ mul.s $f4, $f10, $f6
|
||||
/* B46370 800CF1D0 44815000 */ mtc1 $at, $f10
|
||||
/* B46374 800CF1D4 46044080 */ add.s $f2, $f8, $f4
|
||||
/* B46378 800CF1D8 C7A800B8 */ lwc1 $f8, 0xb8($sp)
|
||||
/* B4637C 800CF1DC 46021380 */ add.s $f14, $f2, $f2
|
||||
/* B46380 800CF1E0 460E7002 */ mul.s $f0, $f14, $f14
|
||||
/* B46384 800CF1E4 00000000 */ nop
|
||||
/* B46388 800CF1E8 460C5182 */ mul.s $f6, $f10, $f12
|
||||
/* B4638C 800CF1EC 00000000 */ nop
|
||||
/* B46390 800CF1F0 46083402 */ mul.s $f16, $f6, $f8
|
||||
/* B46394 800CF1F4 4610003C */ c.lt.s $f0, $f16
|
||||
/* B46398 800CF1F8 00000000 */ nop
|
||||
/* B4639C 800CF1FC 45000003 */ bc1f .L800CF20C
|
||||
/* B463A0 800CF200 00000000 */ nop
|
||||
/* B463A4 800CF204 1000016D */ b .L800CF7BC
|
||||
/* B463A8 800CF208 00001025 */ move $v0, $zero
|
||||
.L800CF20C:
|
||||
/* B463AC 800CF20C 46100081 */ sub.s $f2, $f0, $f16
|
||||
/* B463B0 800CF210 44802000 */ mtc1 $zero, $f4
|
||||
/* B463B4 800CF214 24060001 */ li $a2, 1
|
||||
/* B463B8 800CF218 00002825 */ move $a1, $zero
|
||||
/* B463BC 800CF21C 4602203C */ c.lt.s $f4, $f2
|
||||
/* B463C0 800CF220 46001004 */ sqrt.s $f0, $f2
|
||||
/* B463C4 800CF224 45000004 */ bc1f .L800CF238
|
||||
/* B463C8 800CF228 00000000 */ nop
|
||||
/* B463CC 800CF22C 24050001 */ li $a1, 1
|
||||
/* B463D0 800CF230 10000001 */ b .L800CF238
|
||||
/* B463D4 800CF234 24060001 */ li $a2, 1
|
||||
.L800CF238:
|
||||
/* B463D8 800CF238 460E0281 */ sub.s $f10, $f0, $f14
|
||||
/* B463DC 800CF23C 24070001 */ li $a3, 1
|
||||
/* B463E0 800CF240 46125083 */ div.s $f2, $f10, $f18
|
||||
/* B463E4 800CF244 E7A200D0 */ swc1 $f2, 0xd0($sp)
|
||||
/* B463E8 800CF248 14A70005 */ bne $a1, $a3, .L800CF260
|
||||
/* B463EC 800CF24C C7A200D0 */ lwc1 $f2, 0xd0($sp)
|
||||
/* B463F0 800CF250 46007187 */ neg.s $f6, $f14
|
||||
/* B463F4 800CF254 46003201 */ sub.s $f8, $f6, $f0
|
||||
/* B463F8 800CF258 46124303 */ div.s $f12, $f8, $f18
|
||||
/* B463FC 800CF25C E7AC00CC */ swc1 $f12, 0xcc($sp)
|
||||
.L800CF260:
|
||||
/* B46400 800CF260 10000019 */ b .L800CF2C8
|
||||
/* B46404 800CF264 C7AC00CC */ lwc1 $f12, 0xcc($sp)
|
||||
.L800CF268:
|
||||
/* B46408 800CF268 C7AA00EC */ lwc1 $f10, 0xec($sp)
|
||||
/* B4640C 800CF26C C7A800DC */ lwc1 $f8, 0xdc($sp)
|
||||
/* B46410 800CF270 3C018014 */ lui $at, %hi(D_8014654C)
|
||||
/* B46414 800CF274 460A2182 */ mul.s $f6, $f4, $f10
|
||||
/* B46418 800CF278 C7A400F4 */ lwc1 $f4, 0xf4($sp)
|
||||
/* B4641C 800CF27C 46044282 */ mul.s $f10, $f8, $f4
|
||||
/* B46420 800CF280 C428654C */ lwc1 $f8, %lo(D_8014654C)($at)
|
||||
/* B46424 800CF284 460A3080 */ add.s $f2, $f6, $f10
|
||||
/* B46428 800CF288 46021380 */ add.s $f14, $f2, $f2
|
||||
/* B4642C 800CF28C 46007005 */ abs.s $f0, $f14
|
||||
/* B46430 800CF290 4608003C */ c.lt.s $f0, $f8
|
||||
/* B46434 800CF294 00000000 */ nop
|
||||
/* B46438 800CF298 45010009 */ bc1t .L800CF2C0
|
||||
/* B4643C 800CF29C 00000000 */ nop
|
||||
/* B46440 800CF2A0 46008107 */ neg.s $f4, $f16
|
||||
/* B46444 800CF2A4 24060001 */ li $a2, 1
|
||||
/* B46448 800CF2A8 460E2083 */ div.s $f2, $f4, $f14
|
||||
/* B4644C 800CF2AC 00002825 */ move $a1, $zero
|
||||
/* B46450 800CF2B0 C7AC00CC */ lwc1 $f12, 0xcc($sp)
|
||||
/* B46454 800CF2B4 24070001 */ li $a3, 1
|
||||
/* B46458 800CF2B8 10000003 */ b .L800CF2C8
|
||||
/* B4645C 800CF2BC E7A200D0 */ swc1 $f2, 0xd0($sp)
|
||||
.L800CF2C0:
|
||||
/* B46460 800CF2C0 1000013E */ b .L800CF7BC
|
||||
/* B46464 800CF2C4 00001025 */ move $v0, $zero
|
||||
.L800CF2C8:
|
||||
/* B46468 800CF2C8 54A00010 */ bnezl $a1, .L800CF30C
|
||||
/* B4646C 800CF2CC 44802000 */ mtc1 $zero, $f4
|
||||
/* B46470 800CF2D0 44805000 */ mtc1 $zero, $f10
|
||||
/* B46474 800CF2D4 3C013F80 */ li $at, 0x3F800000 # 0.000000
|
||||
/* B46478 800CF2D8 460A103C */ c.lt.s $f2, $f10
|
||||
/* B4647C 800CF2DC 00000000 */ nop
|
||||
/* B46480 800CF2E0 45010007 */ bc1t .L800CF300
|
||||
/* B46484 800CF2E4 00000000 */ nop
|
||||
/* B46488 800CF2E8 44814000 */ mtc1 $at, $f8
|
||||
/* B4648C 800CF2EC 00000000 */ nop
|
||||
/* B46490 800CF2F0 4602403C */ c.lt.s $f8, $f2
|
||||
/* B46494 800CF2F4 00000000 */ nop
|
||||
/* B46498 800CF2F8 45000030 */ bc1f .L800CF3BC
|
||||
/* B4649C 800CF2FC 00000000 */ nop
|
||||
.L800CF300:
|
||||
/* B464A0 800CF300 1000012E */ b .L800CF7BC
|
||||
/* B464A4 800CF304 00001025 */ move $v0, $zero
|
||||
/* B464A8 800CF308 44802000 */ mtc1 $zero, $f4
|
||||
.L800CF30C:
|
||||
/* B464AC 800CF30C 44805000 */ mtc1 $zero, $f10
|
||||
/* B464B0 800CF310 00001025 */ move $v0, $zero
|
||||
/* B464B4 800CF314 4604103C */ c.lt.s $f2, $f4
|
||||
/* B464B8 800CF318 3C013F80 */ li $at, 0x3F800000 # 0.000000
|
||||
/* B464BC 800CF31C 45000002 */ bc1f .L800CF328
|
||||
/* B464C0 800CF320 00000000 */ nop
|
||||
/* B464C4 800CF324 24020001 */ li $v0, 1
|
||||
.L800CF328:
|
||||
/* B464C8 800CF328 14400008 */ bnez $v0, .L800CF34C
|
||||
/* B464CC 800CF32C 00401825 */ move $v1, $v0
|
||||
/* B464D0 800CF330 44813000 */ mtc1 $at, $f6
|
||||
/* B464D4 800CF334 00001825 */ move $v1, $zero
|
||||
/* B464D8 800CF338 4602303C */ c.lt.s $f6, $f2
|
||||
/* B464DC 800CF33C 00000000 */ nop
|
||||
/* B464E0 800CF340 45020003 */ bc1fl .L800CF350
|
||||
/* B464E4 800CF344 460A603C */ c.lt.s $f12, $f10
|
||||
/* B464E8 800CF348 24030001 */ li $v1, 1
|
||||
.L800CF34C:
|
||||
/* B464EC 800CF34C 460A603C */ c.lt.s $f12, $f10
|
||||
.L800CF350:
|
||||
/* B464F0 800CF350 00602025 */ move $a0, $v1
|
||||
/* B464F4 800CF354 00001025 */ move $v0, $zero
|
||||
/* B464F8 800CF358 3C013F80 */ li $at, 0x3F800000 # 0.000000
|
||||
/* B464FC 800CF35C 45000002 */ bc1f .L800CF368
|
||||
/* B46500 800CF360 00000000 */ nop
|
||||
/* B46504 800CF364 24020001 */ li $v0, 1
|
||||
.L800CF368:
|
||||
/* B46508 800CF368 14400008 */ bnez $v0, .L800CF38C
|
||||
/* B4650C 800CF36C 00401825 */ move $v1, $v0
|
||||
/* B46510 800CF370 44814000 */ mtc1 $at, $f8
|
||||
/* B46514 800CF374 00001825 */ move $v1, $zero
|
||||
/* B46518 800CF378 460C403C */ c.lt.s $f8, $f12
|
||||
/* B4651C 800CF37C 00000000 */ nop
|
||||
/* B46520 800CF380 45000002 */ bc1f .L800CF38C
|
||||
/* B46524 800CF384 00000000 */ nop
|
||||
/* B46528 800CF388 24030001 */ li $v1, 1
|
||||
.L800CF38C:
|
||||
/* B4652C 800CF38C 10800005 */ beqz $a0, .L800CF3A4
|
||||
/* B46530 800CF390 00000000 */ nop
|
||||
/* B46534 800CF394 10600003 */ beqz $v1, .L800CF3A4
|
||||
/* B46538 800CF398 00000000 */ nop
|
||||
/* B4653C 800CF39C 10000107 */ b .L800CF7BC
|
||||
/* B46540 800CF3A0 00001025 */ move $v0, $zero
|
||||
.L800CF3A4:
|
||||
/* B46544 800CF3A4 10800002 */ beqz $a0, .L800CF3B0
|
||||
/* B46548 800CF3A8 00000000 */ nop
|
||||
/* B4654C 800CF3AC 00003025 */ move $a2, $zero
|
||||
.L800CF3B0:
|
||||
/* B46550 800CF3B0 10600002 */ beqz $v1, .L800CF3BC
|
||||
/* B46554 800CF3B4 00000000 */ nop
|
||||
/* B46558 800CF3B8 00002825 */ move $a1, $zero
|
||||
.L800CF3BC:
|
||||
/* B4655C 800CF3BC 14C70012 */ bne $a2, $a3, .L800CF408
|
||||
/* B46560 800CF3C0 C7A400D8 */ lwc1 $f4, 0xd8($sp)
|
||||
/* B46564 800CF3C4 46041182 */ mul.s $f6, $f2, $f4
|
||||
/* B46568 800CF3C8 C7AA00F0 */ lwc1 $f10, 0xf0($sp)
|
||||
/* B4656C 800CF3CC 44804000 */ mtc1 $zero, $f8
|
||||
/* B46570 800CF3D0 460A3000 */ add.s $f0, $f6, $f10
|
||||
/* B46574 800CF3D4 4608003C */ c.lt.s $f0, $f8
|
||||
/* B46578 800CF3D8 00000000 */ nop
|
||||
/* B4657C 800CF3DC 4503000A */ bc1tl .L800CF408
|
||||
/* B46580 800CF3E0 00003025 */ move $a2, $zero
|
||||
/* B46584 800CF3E4 860E0002 */ lh $t6, 2($s0)
|
||||
/* B46588 800CF3E8 448E2000 */ mtc1 $t6, $f4
|
||||
/* B4658C 800CF3EC 00000000 */ nop
|
||||
/* B46590 800CF3F0 468021A0 */ cvt.s.w $f6, $f4
|
||||
/* B46594 800CF3F4 4600303C */ c.lt.s $f6, $f0
|
||||
/* B46598 800CF3F8 00000000 */ nop
|
||||
/* B4659C 800CF3FC 45000002 */ bc1f .L800CF408
|
||||
/* B465A0 800CF400 00000000 */ nop
|
||||
/* B465A4 800CF404 00003025 */ move $a2, $zero
|
||||
.L800CF408:
|
||||
/* B465A8 800CF408 14A70012 */ bne $a1, $a3, .L800CF454
|
||||
/* B465AC 800CF40C C7AA00D8 */ lwc1 $f10, 0xd8($sp)
|
||||
/* B465B0 800CF410 460A6202 */ mul.s $f8, $f12, $f10
|
||||
/* B465B4 800CF414 C7A400F0 */ lwc1 $f4, 0xf0($sp)
|
||||
/* B465B8 800CF418 44803000 */ mtc1 $zero, $f6
|
||||
/* B465BC 800CF41C 46044000 */ add.s $f0, $f8, $f4
|
||||
/* B465C0 800CF420 4606003C */ c.lt.s $f0, $f6
|
||||
/* B465C4 800CF424 00000000 */ nop
|
||||
/* B465C8 800CF428 4503000A */ bc1tl .L800CF454
|
||||
/* B465CC 800CF42C 00002825 */ move $a1, $zero
|
||||
/* B465D0 800CF430 860F0002 */ lh $t7, 2($s0)
|
||||
/* B465D4 800CF434 448F5000 */ mtc1 $t7, $f10
|
||||
/* B465D8 800CF438 00000000 */ nop
|
||||
/* B465DC 800CF43C 46805220 */ cvt.s.w $f8, $f10
|
||||
/* B465E0 800CF440 4600403C */ c.lt.s $f8, $f0
|
||||
/* B465E4 800CF444 00000000 */ nop
|
||||
/* B465E8 800CF448 45000002 */ bc1f .L800CF454
|
||||
/* B465EC 800CF44C 00000000 */ nop
|
||||
/* B465F0 800CF450 00002825 */ move $a1, $zero
|
||||
.L800CF454:
|
||||
/* B465F4 800CF454 14C00005 */ bnez $a2, .L800CF46C
|
||||
/* B465F8 800CF458 00001825 */ move $v1, $zero
|
||||
/* B465FC 800CF45C 14A00003 */ bnez $a1, .L800CF46C
|
||||
/* B46600 800CF460 00000000 */ nop
|
||||
/* B46604 800CF464 100000D5 */ b .L800CF7BC
|
||||
/* B46608 800CF468 00001025 */ move $v0, $zero
|
||||
.L800CF46C:
|
||||
/* B4660C 800CF46C 14C7004B */ bne $a2, $a3, .L800CF59C
|
||||
/* B46610 800CF470 00001025 */ move $v0, $zero
|
||||
/* B46614 800CF474 14A70049 */ bne $a1, $a3, .L800CF59C
|
||||
/* B46618 800CF478 C7A400D4 */ lwc1 $f4, 0xd4($sp)
|
||||
/* B4661C 800CF47C 46041182 */ mul.s $f6, $f2, $f4
|
||||
/* B46620 800CF480 C7AA00EC */ lwc1 $f10, 0xec($sp)
|
||||
/* B46624 800CF484 86190006 */ lh $t9, 6($s0)
|
||||
/* B46628 800CF488 E7A40024 */ swc1 $f4, 0x24($sp)
|
||||
/* B4662C 800CF48C C7A400F0 */ lwc1 $f4, 0xf0($sp)
|
||||
/* B46630 800CF490 35080004 */ ori $t0, $t0, 4
|
||||
/* B46634 800CF494 35080008 */ ori $t0, $t0, 8
|
||||
/* B46638 800CF498 460A3200 */ add.s $f8, $f6, $f10
|
||||
/* B4663C 800CF49C 44993000 */ mtc1 $t9, $f6
|
||||
/* B46640 800CF4A0 00000000 */ nop
|
||||
/* B46644 800CF4A4 468031A0 */ cvt.s.w $f6, $f6
|
||||
/* B46648 800CF4A8 46064200 */ add.s $f8, $f8, $f6
|
||||
/* B4664C 800CF4AC C7A600D8 */ lwc1 $f6, 0xd8($sp)
|
||||
/* B46650 800CF4B0 E7A80084 */ swc1 $f8, 0x84($sp)
|
||||
/* B46654 800CF4B4 86180008 */ lh $t8, 8($s0)
|
||||
/* B46658 800CF4B8 46061202 */ mul.s $f8, $f2, $f6
|
||||
/* B4665C 800CF4BC E7AA0020 */ swc1 $f10, 0x20($sp)
|
||||
/* B46660 800CF4C0 44985000 */ mtc1 $t8, $f10
|
||||
/* B46664 800CF4C4 86090004 */ lh $t1, 4($s0)
|
||||
/* B46668 800CF4C8 E7A60028 */ swc1 $f6, 0x28($sp)
|
||||
/* B4666C 800CF4CC C7A600F4 */ lwc1 $f6, 0xf4($sp)
|
||||
/* B46670 800CF4D0 468052A0 */ cvt.s.w $f10, $f10
|
||||
/* B46674 800CF4D4 46044200 */ add.s $f8, $f8, $f4
|
||||
/* B46678 800CF4D8 460A4200 */ add.s $f8, $f8, $f10
|
||||
/* B4667C 800CF4DC 44895000 */ mtc1 $t1, $f10
|
||||
/* B46680 800CF4E0 00000000 */ nop
|
||||
/* B46684 800CF4E4 468052A0 */ cvt.s.w $f10, $f10
|
||||
/* B46688 800CF4E8 460A4200 */ add.s $f8, $f8, $f10
|
||||
/* B4668C 800CF4EC C7AA00DC */ lwc1 $f10, 0xdc($sp)
|
||||
/* B46690 800CF4F0 E7A80088 */ swc1 $f8, 0x88($sp)
|
||||
/* B46694 800CF4F4 860A000A */ lh $t2, 0xa($s0)
|
||||
/* B46698 800CF4F8 460A1202 */ mul.s $f8, $f2, $f10
|
||||
/* B4669C 800CF4FC E7A4002C */ swc1 $f4, 0x2c($sp)
|
||||
/* B466A0 800CF500 448A2000 */ mtc1 $t2, $f4
|
||||
/* B466A4 800CF504 00000000 */ nop
|
||||
/* B466A8 800CF508 46802120 */ cvt.s.w $f4, $f4
|
||||
/* B466AC 800CF50C 46064200 */ add.s $f8, $f8, $f6
|
||||
/* B466B0 800CF510 46044200 */ add.s $f8, $f8, $f4
|
||||
/* B466B4 800CF514 C7A40024 */ lwc1 $f4, 0x24($sp)
|
||||
/* B466B8 800CF518 E7A8008C */ swc1 $f8, 0x8c($sp)
|
||||
/* B466BC 800CF51C 46046202 */ mul.s $f8, $f12, $f4
|
||||
/* B466C0 800CF520 C7A40020 */ lwc1 $f4, 0x20($sp)
|
||||
/* B466C4 800CF524 860B0006 */ lh $t3, 6($s0)
|
||||
/* B466C8 800CF528 46044200 */ add.s $f8, $f8, $f4
|
||||
/* B466CC 800CF52C 448B2000 */ mtc1 $t3, $f4
|
||||
/* B466D0 800CF530 00000000 */ nop
|
||||
/* B466D4 800CF534 46802120 */ cvt.s.w $f4, $f4
|
||||
/* B466D8 800CF538 46044200 */ add.s $f8, $f8, $f4
|
||||
/* B466DC 800CF53C C7A40028 */ lwc1 $f4, 0x28($sp)
|
||||
/* B466E0 800CF540 E7A80090 */ swc1 $f8, 0x90($sp)
|
||||
/* B466E4 800CF544 46046202 */ mul.s $f8, $f12, $f4
|
||||
/* B466E8 800CF548 C7A4002C */ lwc1 $f4, 0x2c($sp)
|
||||
/* B466EC 800CF54C 860C0008 */ lh $t4, 8($s0)
|
||||
/* B466F0 800CF550 860D0004 */ lh $t5, 4($s0)
|
||||
/* B466F4 800CF554 46044200 */ add.s $f8, $f8, $f4
|
||||
/* B466F8 800CF558 448C2000 */ mtc1 $t4, $f4
|
||||
/* B466FC 800CF55C 00000000 */ nop
|
||||
/* B46700 800CF560 46802120 */ cvt.s.w $f4, $f4
|
||||
/* B46704 800CF564 46044200 */ add.s $f8, $f8, $f4
|
||||
/* B46708 800CF568 448D2000 */ mtc1 $t5, $f4
|
||||
/* B4670C 800CF56C 00000000 */ nop
|
||||
/* B46710 800CF570 46802120 */ cvt.s.w $f4, $f4
|
||||
/* B46714 800CF574 46044200 */ add.s $f8, $f8, $f4
|
||||
/* B46718 800CF578 460A6102 */ mul.s $f4, $f12, $f10
|
||||
/* B4671C 800CF57C E7A80094 */ swc1 $f8, 0x94($sp)
|
||||
/* B46720 800CF580 860E000A */ lh $t6, 0xa($s0)
|
||||
/* B46724 800CF584 448E5000 */ mtc1 $t6, $f10
|
||||
/* B46728 800CF588 46062200 */ add.s $f8, $f4, $f6
|
||||
/* B4672C 800CF58C 46805120 */ cvt.s.w $f4, $f10
|
||||
/* B46730 800CF590 46044180 */ add.s $f6, $f8, $f4
|
||||
/* B46734 800CF594 10000044 */ b .L800CF6A8
|
||||
/* B46738 800CF598 E7A60098 */ swc1 $f6, 0x98($sp)
|
||||
.L800CF59C:
|
||||
/* B4673C 800CF59C 14C70021 */ bne $a2, $a3, .L800CF624
|
||||
/* B46740 800CF5A0 C7AA00D4 */ lwc1 $f10, 0xd4($sp)
|
||||
/* B46744 800CF5A4 460A1202 */ mul.s $f8, $f2, $f10
|
||||
/* B46748 800CF5A8 860F0006 */ lh $t7, 6($s0)
|
||||
/* B4674C 800CF5AC C7A400EC */ lwc1 $f4, 0xec($sp)
|
||||
/* B46750 800CF5B0 35080004 */ ori $t0, $t0, 4
|
||||
/* B46754 800CF5B4 448F5000 */ mtc1 $t7, $f10
|
||||
/* B46758 800CF5B8 46044180 */ add.s $f6, $f8, $f4
|
||||
/* B4675C 800CF5BC 46805220 */ cvt.s.w $f8, $f10
|
||||
/* B46760 800CF5C0 C7AA00D8 */ lwc1 $f10, 0xd8($sp)
|
||||
/* B46764 800CF5C4 46083100 */ add.s $f4, $f6, $f8
|
||||
/* B46768 800CF5C8 460A1182 */ mul.s $f6, $f2, $f10
|
||||
/* B4676C 800CF5CC C7A800F0 */ lwc1 $f8, 0xf0($sp)
|
||||
/* B46770 800CF5D0 E7A40084 */ swc1 $f4, 0x84($sp)
|
||||
/* B46774 800CF5D4 86190008 */ lh $t9, 8($s0)
|
||||
/* B46778 800CF5D8 86180004 */ lh $t8, 4($s0)
|
||||
/* B4677C 800CF5DC 44995000 */ mtc1 $t9, $f10
|
||||
/* B46780 800CF5E0 46083100 */ add.s $f4, $f6, $f8
|
||||
/* B46784 800CF5E4 468051A0 */ cvt.s.w $f6, $f10
|
||||
/* B46788 800CF5E8 44985000 */ mtc1 $t8, $f10
|
||||
/* B4678C 800CF5EC 46062200 */ add.s $f8, $f4, $f6
|
||||
/* B46790 800CF5F0 46805120 */ cvt.s.w $f4, $f10
|
||||
/* B46794 800CF5F4 C7AA00DC */ lwc1 $f10, 0xdc($sp)
|
||||
/* B46798 800CF5F8 46044180 */ add.s $f6, $f8, $f4
|
||||
/* B4679C 800CF5FC 460A1202 */ mul.s $f8, $f2, $f10
|
||||
/* B467A0 800CF600 C7A400F4 */ lwc1 $f4, 0xf4($sp)
|
||||
/* B467A4 800CF604 E7A60088 */ swc1 $f6, 0x88($sp)
|
||||
/* B467A8 800CF608 8609000A */ lh $t1, 0xa($s0)
|
||||
/* B467AC 800CF60C 44895000 */ mtc1 $t1, $f10
|
||||
/* B467B0 800CF610 46044180 */ add.s $f6, $f8, $f4
|
||||
/* B467B4 800CF614 46805220 */ cvt.s.w $f8, $f10
|
||||
/* B467B8 800CF618 46083100 */ add.s $f4, $f6, $f8
|
||||
/* B467BC 800CF61C 10000022 */ b .L800CF6A8
|
||||
/* B467C0 800CF620 E7A4008C */ swc1 $f4, 0x8c($sp)
|
||||
.L800CF624:
|
||||
/* B467C4 800CF624 14A70020 */ bne $a1, $a3, .L800CF6A8
|
||||
/* B467C8 800CF628 C7AA00D4 */ lwc1 $f10, 0xd4($sp)
|
||||
/* B467CC 800CF62C 460A6182 */ mul.s $f6, $f12, $f10
|
||||
/* B467D0 800CF630 860A0006 */ lh $t2, 6($s0)
|
||||
/* B467D4 800CF634 C7A800EC */ lwc1 $f8, 0xec($sp)
|
||||
/* B467D8 800CF638 35080004 */ ori $t0, $t0, 4
|
||||
/* B467DC 800CF63C 448A5000 */ mtc1 $t2, $f10
|
||||
/* B467E0 800CF640 46083100 */ add.s $f4, $f6, $f8
|
||||
/* B467E4 800CF644 468051A0 */ cvt.s.w $f6, $f10
|
||||
/* B467E8 800CF648 C7AA00D8 */ lwc1 $f10, 0xd8($sp)
|
||||
/* B467EC 800CF64C 46062200 */ add.s $f8, $f4, $f6
|
||||
/* B467F0 800CF650 460A6102 */ mul.s $f4, $f12, $f10
|
||||
/* B467F4 800CF654 C7A600F0 */ lwc1 $f6, 0xf0($sp)
|
||||
/* B467F8 800CF658 E7A80084 */ swc1 $f8, 0x84($sp)
|
||||
/* B467FC 800CF65C 860B0008 */ lh $t3, 8($s0)
|
||||
/* B46800 800CF660 860C0004 */ lh $t4, 4($s0)
|
||||
/* B46804 800CF664 448B5000 */ mtc1 $t3, $f10
|
||||
/* B46808 800CF668 46062200 */ add.s $f8, $f4, $f6
|
||||
/* B4680C 800CF66C 46805120 */ cvt.s.w $f4, $f10
|
||||
/* B46810 800CF670 448C5000 */ mtc1 $t4, $f10
|
||||
/* B46814 800CF674 46044180 */ add.s $f6, $f8, $f4
|
||||
/* B46818 800CF678 46805220 */ cvt.s.w $f8, $f10
|
||||
/* B4681C 800CF67C C7AA00DC */ lwc1 $f10, 0xdc($sp)
|
||||
/* B46820 800CF680 46083100 */ add.s $f4, $f6, $f8
|
||||
/* B46824 800CF684 460A6182 */ mul.s $f6, $f12, $f10
|
||||
/* B46828 800CF688 C7A800F4 */ lwc1 $f8, 0xf4($sp)
|
||||
/* B4682C 800CF68C E7A40088 */ swc1 $f4, 0x88($sp)
|
||||
/* B46830 800CF690 860D000A */ lh $t5, 0xa($s0)
|
||||
/* B46834 800CF694 448D5000 */ mtc1 $t5, $f10
|
||||
/* B46838 800CF698 46083100 */ add.s $f4, $f6, $f8
|
||||
/* B4683C 800CF69C 468051A0 */ cvt.s.w $f6, $f10
|
||||
/* B46840 800CF6A0 46062200 */ add.s $f8, $f4, $f6
|
||||
/* B46844 800CF6A4 E7A8008C */ swc1 $f8, 0x8c($sp)
|
||||
.L800CF6A8:
|
||||
/* B46848 800CF6A8 24060004 */ li $a2, 4
|
||||
/* B4684C 800CF6AC 2405000C */ li $a1, 12
|
||||
/* B46850 800CF6B0 27A4006C */ addiu $a0, $sp, 0x6c
|
||||
/* B46854 800CF6B4 240E0001 */ li $t6, 1
|
||||
.L800CF6B8:
|
||||
/* B46858 800CF6B8 004E7804 */ sllv $t7, $t6, $v0
|
||||
/* B4685C 800CF6BC 01E8C824 */ and $t9, $t7, $t0
|
||||
/* B46860 800CF6C0 5320003B */ beql $t9, $zero, .L800CF7B0
|
||||
/* B46864 800CF6C4 24420001 */ addiu $v0, $v0, 1
|
||||
/* B46868 800CF6C8 1460000C */ bnez $v1, .L800CF6FC
|
||||
/* B4686C 800CF6CC 00000000 */ nop
|
||||
/* B46870 800CF6D0 00450019 */ multu $v0, $a1
|
||||
/* B46874 800CF6D4 8FB80104 */ lw $t8, 0x104($sp)
|
||||
/* B46878 800CF6D8 00004812 */ mflo $t1
|
||||
/* B4687C 800CF6DC 00895021 */ addu $t2, $a0, $t1
|
||||
/* B46880 800CF6E0 8D4C0000 */ lw $t4, ($t2)
|
||||
/* B46884 800CF6E4 AF0C0000 */ sw $t4, ($t8)
|
||||
/* B46888 800CF6E8 8D4B0004 */ lw $t3, 4($t2)
|
||||
/* B4688C 800CF6EC AF0B0004 */ sw $t3, 4($t8)
|
||||
/* B46890 800CF6F0 8D4C0008 */ lw $t4, 8($t2)
|
||||
/* B46894 800CF6F4 1000002C */ b .L800CF7A8
|
||||
/* B46898 800CF6F8 AF0C0008 */ sw $t4, 8($t8)
|
||||
.L800CF6FC:
|
||||
/* B4689C 800CF6FC 1467002A */ bne $v1, $a3, .L800CF7A8
|
||||
/* B468A0 800CF700 00026880 */ sll $t5, $v0, 2
|
||||
/* B468A4 800CF704 01A26823 */ subu $t5, $t5, $v0
|
||||
/* B468A8 800CF708 000D6880 */ sll $t5, $t5, 2
|
||||
/* B468AC 800CF70C 27AE006C */ addiu $t6, $sp, 0x6c
|
||||
/* B468B0 800CF710 01AE8021 */ addu $s0, $t5, $t6
|
||||
/* B468B4 800CF714 8FA40104 */ lw $a0, 0x104($sp)
|
||||
/* B468B8 800CF718 8FA500FC */ lw $a1, 0xfc($sp)
|
||||
/* B468BC 800CF71C 0C032D94 */ jal Math3D_Vec3fDistSq
|
||||
/* B468C0 800CF720 AFA30068 */ sw $v1, 0x68($sp)
|
||||
/* B468C4 800CF724 E7A0004C */ swc1 $f0, 0x4c($sp)
|
||||
/* B468C8 800CF728 8FA40104 */ lw $a0, 0x104($sp)
|
||||
/* B468CC 800CF72C 0C032D94 */ jal Math3D_Vec3fDistSq
|
||||
/* B468D0 800CF730 02002825 */ move $a1, $s0
|
||||
/* B468D4 800CF734 C7AA004C */ lwc1 $f10, 0x4c($sp)
|
||||
/* B468D8 800CF738 8FA30068 */ lw $v1, 0x68($sp)
|
||||
/* B468DC 800CF73C 8FAF0108 */ lw $t7, 0x108($sp)
|
||||
/* B468E0 800CF740 4600503C */ c.lt.s $f10, $f0
|
||||
/* B468E4 800CF744 8FAA0104 */ lw $t2, 0x104($sp)
|
||||
/* B468E8 800CF748 45020009 */ bc1fl .L800CF770
|
||||
/* B468EC 800CF74C 8FB80108 */ lw $t8, 0x108($sp)
|
||||
/* B468F0 800CF750 8E090000 */ lw $t1, ($s0)
|
||||
/* B468F4 800CF754 ADE90000 */ sw $t1, ($t7)
|
||||
/* B468F8 800CF758 8E190004 */ lw $t9, 4($s0)
|
||||
/* B468FC 800CF75C ADF90004 */ sw $t9, 4($t7)
|
||||
/* B46900 800CF760 8E090008 */ lw $t1, 8($s0)
|
||||
/* B46904 800CF764 10000014 */ b .L800CF7B8
|
||||
/* B46908 800CF768 ADE90008 */ sw $t1, 8($t7)
|
||||
/* B4690C 800CF76C 8FB80108 */ lw $t8, 0x108($sp)
|
||||
.L800CF770:
|
||||
/* B46910 800CF770 8D4C0000 */ lw $t4, ($t2)
|
||||
/* B46914 800CF774 AF0C0000 */ sw $t4, ($t8)
|
||||
/* B46918 800CF778 8D4B0004 */ lw $t3, 4($t2)
|
||||
/* B4691C 800CF77C AF0B0004 */ sw $t3, 4($t8)
|
||||
/* B46920 800CF780 8D4C0008 */ lw $t4, 8($t2)
|
||||
/* B46924 800CF784 AF0C0008 */ sw $t4, 8($t8)
|
||||
/* B46928 800CF788 8E0F0000 */ lw $t7, ($s0)
|
||||
/* B4692C 800CF78C 8FAD0104 */ lw $t5, 0x104($sp)
|
||||
/* B46930 800CF790 ADAF0000 */ sw $t7, ($t5)
|
||||
/* B46934 800CF794 8E0E0004 */ lw $t6, 4($s0)
|
||||
/* B46938 800CF798 ADAE0004 */ sw $t6, 4($t5)
|
||||
/* B4693C 800CF79C 8E0F0008 */ lw $t7, 8($s0)
|
||||
/* B46940 800CF7A0 10000005 */ b .L800CF7B8
|
||||
/* B46944 800CF7A4 ADAF0008 */ sw $t7, 8($t5)
|
||||
.L800CF7A8:
|
||||
/* B46948 800CF7A8 24630001 */ addiu $v1, $v1, 1
|
||||
/* B4694C 800CF7AC 24420001 */ addiu $v0, $v0, 1
|
||||
.L800CF7B0:
|
||||
/* B46950 800CF7B0 5446FFC1 */ bnel $v0, $a2, .L800CF6B8
|
||||
/* B46954 800CF7B4 240E0001 */ li $t6, 1
|
||||
.L800CF7B8:
|
||||
/* B46958 800CF7B8 00601025 */ move $v0, $v1
|
||||
.L800CF7BC:
|
||||
/* B4695C 800CF7BC 8FBF001C */ lw $ra, 0x1c($sp)
|
||||
/* B46960 800CF7C0 8FB00018 */ lw $s0, 0x18($sp)
|
||||
/* B46964 800CF7C4 27BD00F8 */ addiu $sp, $sp, 0xf8
|
||||
/* B46968 800CF7C8 03E00008 */ jr $ra
|
||||
/* B4696C 800CF7CC 00000000 */ nop
|
||||
|
|
@ -972,7 +972,7 @@ s32 Math_StepUntilAngleS(s16* pValue, s16 limit, s16 step);
|
|||
s32 Math_StepUntilS(s16* pValue, s16 limit, s16 step);
|
||||
s32 Math_StepToAngleS(s16* pValue, s16 target, s16 step);
|
||||
s32 Math_StepUntilF(f32* pValue, f32 limit, f32 step);
|
||||
s32 Math_AymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep);
|
||||
s32 Math_AsymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep);
|
||||
void func_80077D10(f32* arg0, s16* arg1, Input* input);
|
||||
s16 Rand_S16Offset(s16 base, s16 range);
|
||||
void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src);
|
||||
|
|
|
@ -92,9 +92,7 @@ typedef struct {
|
|||
#define COLPOLY_NORM_FRAC (1.0f / 32767)
|
||||
#define BGCHECK_Y_MIN -32000.0f
|
||||
|
||||
/**
|
||||
* Trig macros
|
||||
*/
|
||||
// Trig macros
|
||||
#define DEGF_TO_BINANG(degreesf) (s16)(degreesf * 182.04167f + .5f)
|
||||
#define RADF_TO_DEGF(radf) (radf * (180.0f / M_PI))
|
||||
#define DEGF_TO_RADF(degf) (degf * (M_PI / 180.0f))
|
||||
|
@ -103,4 +101,10 @@ typedef struct {
|
|||
#define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f))
|
||||
#define BINANG_TO_DEGF(binang) ((f32)binang * (360.0001525f / 65535.0f))
|
||||
|
||||
// Vector macros
|
||||
#define SQXZ(vec) ((vec.x) * (vec.x) + (vec.z) * (vec.z))
|
||||
#define DOTXZ(vec1, vec2) ((vec1.x) * (vec2.x) + (vec1.z) * (vec2.z))
|
||||
#define SQXYZ(vec) ((vec.x) * (vec.x) + (vec.y) * (vec.y) + (vec.z) * (vec.z))
|
||||
#define DOTXYZ(vec1, vec2) ((vec1.x) * (vec2.x) + (vec1.y) * (vec2.y) + (vec1.z) * (vec2.z))
|
||||
|
||||
#endif
|
||||
|
|
|
@ -62,6 +62,11 @@ s32 Math3D_LineSegMakePerpLineSeg(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f*
|
|||
Vec3f lineABPointADiff;
|
||||
f32 t;
|
||||
f32 t2;
|
||||
f32 tempf1;
|
||||
f32 tempf2;
|
||||
f32 tempf3;
|
||||
f32 tempf4;
|
||||
f32 tempf5;
|
||||
|
||||
lineADiff.x = lineAPointB->x - lineAPointA->x;
|
||||
lineADiff.y = lineAPointB->y - lineAPointA->y;
|
||||
|
@ -70,21 +75,18 @@ s32 Math3D_LineSegMakePerpLineSeg(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f*
|
|||
lineBDiff.y = lineBPointB->y - lineBPointA->y;
|
||||
lineBDiff.z = lineBPointB->z - lineBPointA->z;
|
||||
|
||||
if (IS_ZERO(SQ(lineBDiff.x) + SQ(lineBDiff.y) + SQ(lineBDiff.z))) {
|
||||
if (IS_ZERO(SQXYZ(lineBDiff))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sp5C = ((lineADiff.x * lineBDiff.x) + (lineADiff.y * lineBDiff.y) + (lineADiff.z * lineBDiff.z)) *
|
||||
(1.0f / (SQ(lineBDiff.x) + SQ(lineBDiff.y) + SQ(lineBDiff.z)));
|
||||
tempf1 = 1.0f / SQXYZ(lineBDiff);
|
||||
sp5C = DOTXYZ(lineADiff, lineBDiff) * tempf1;
|
||||
|
||||
lineABPointADiff.x = lineAPointA->x - lineBPointA->x;
|
||||
lineABPointADiff.y = lineAPointA->y - lineBPointA->y;
|
||||
lineABPointADiff.z = lineAPointA->z - lineBPointA->z;
|
||||
|
||||
// most reordering is here.
|
||||
temp_f18 =
|
||||
((lineABPointADiff.x * lineBDiff.x) + (lineABPointADiff.y * lineBDiff.y) + (lineABPointADiff.z * lineBDiff.z)) *
|
||||
(1.0f / (SQ(lineBDiff.x) + SQ(lineBDiff.y) + SQ(lineBDiff.z)));
|
||||
temp_f18 = DOTXYZ(lineABPointADiff, lineBDiff) * tempf1;
|
||||
|
||||
sp4C = lineADiff.x - (lineBDiff.x * sp5C);
|
||||
sp50 = lineADiff.y - (lineBDiff.y * sp5C);
|
||||
|
@ -92,7 +94,6 @@ s32 Math3D_LineSegMakePerpLineSeg(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f*
|
|||
if (IS_ZERO(SQ(sp4C) + SQ(sp50) + SQ(sp30))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
t = SQ(sp4C) + SQ(sp50) + SQ(sp30);
|
||||
temp_f0_4 = -((sp4C * (lineABPointADiff.x - (lineBDiff.x * temp_f18))) +
|
||||
(sp50 * (lineABPointADiff.y - (lineBDiff.y * temp_f18))) +
|
||||
|
@ -1624,72 +1625,28 @@ s32 Math3D_PointInCyl(Cylinder16* cyl, Vec3f* point) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
s32 Math3D_CylVsLineSeg(Cylinder16* cyl, Vec3f* linePointA, Vec3f* linePointB, Vec3f* intersectA, Vec3f* intersectB) {
|
||||
Vec3f pointACylBottomDiff;
|
||||
Vec3f pointBCylBottomDiff;
|
||||
Vec3f spD4;
|
||||
f32 spD0;
|
||||
f32 spCC;
|
||||
f32 spB8;
|
||||
s32 sp9C;
|
||||
Vec3f sp6C[4];
|
||||
s32 sp68;
|
||||
f32 sp4C;
|
||||
f32 sp2C;
|
||||
f32 sp28;
|
||||
f32* temp_a0;
|
||||
f32* temp_a1;
|
||||
f32* temp_s0;
|
||||
f32 temp_f0;
|
||||
f32 temp_f0_2;
|
||||
f32 temp_f0_3;
|
||||
f32 temp_f0_4;
|
||||
f32 temp_f0_5;
|
||||
f32 temp_f0_6;
|
||||
f32 temp_f10;
|
||||
f32 temp_f12;
|
||||
f32 temp_f12_2;
|
||||
Vec3f cylToPtA;
|
||||
Vec3f cylToPtB;
|
||||
Vec3f ptAToPtB;
|
||||
f32 fracA;
|
||||
f32 fracB;
|
||||
f32 fracBase;
|
||||
f32 zero = 0.0f;
|
||||
f32 pad;
|
||||
f32 cylRadiusSq;
|
||||
f32 temp_f14_2;
|
||||
f32 temp_f14_3;
|
||||
f32 temp_f16;
|
||||
f32 temp_f16_2;
|
||||
f32 temp_f18;
|
||||
f32 temp_f2;
|
||||
f32 temp_f2_2;
|
||||
f32 temp_f2_3;
|
||||
f32 temp_f2_4;
|
||||
f32 temp_f2_5;
|
||||
f32 temp_f2_6;
|
||||
f32 temp_f2_7;
|
||||
s32 temp_a0_2;
|
||||
s32 temp_t0;
|
||||
s32 temp_v0;
|
||||
s32 temp_v1;
|
||||
void* temp_t2;
|
||||
s32 phi_a1;
|
||||
s32 phi_a1_2;
|
||||
f32 phi_f2;
|
||||
s32 phi_v0;
|
||||
s32 phi_v0_2;
|
||||
s32 phi_v1;
|
||||
s32 phi_v1_2;
|
||||
s32 phi_a2;
|
||||
s32 phi_a1_3;
|
||||
s32 phi_a2_2;
|
||||
s32 phi_a1_4;
|
||||
s32 phi_v0_3;
|
||||
s32 phi_t0;
|
||||
s32 phi_v1_3;
|
||||
s32 phi_v1_4;
|
||||
s32 phi_a2_3;
|
||||
s32 phi_a2_4;
|
||||
s32 phi_t0_2;
|
||||
s32 phi_v1_5;
|
||||
s32 phi_t0_3;
|
||||
f32 radSqDiff;
|
||||
f32 distCent2;
|
||||
f32 dot2AB;
|
||||
s32 sideIntA;
|
||||
s32 sideIntB;
|
||||
s32 intBeyondA;
|
||||
s32 intBeyondB;
|
||||
s32 intFlags = 0;
|
||||
Vec3f intPts[4];
|
||||
s32 count;
|
||||
s32 i;
|
||||
|
||||
sp9C = 0;
|
||||
if (Math3D_PointInCyl(cyl, linePointA) && Math3D_PointInCyl(cyl, linePointB)) {
|
||||
// both points are in the cylinder
|
||||
*intersectA = *linePointA;
|
||||
|
@ -1697,151 +1654,158 @@ s32 Math3D_CylVsLineSeg(Cylinder16* cyl, Vec3f* linePointA, Vec3f* linePointB, V
|
|||
return 2;
|
||||
}
|
||||
|
||||
pointACylBottomDiff.x = linePointA->x - cyl->pos.x;
|
||||
pointACylBottomDiff.y = linePointA->y - cyl->pos.y - cyl->yShift;
|
||||
pointACylBottomDiff.z = linePointA->z - cyl->pos.z;
|
||||
pointBCylBottomDiff.x = linePointB->x - cyl->pos.x;
|
||||
pointBCylBottomDiff.y = linePointB->y - cyl->pos.y - cyl->yShift;
|
||||
pointBCylBottomDiff.z = linePointB->z - cyl->pos.z;
|
||||
Math_Vec3f_Diff(&pointBCylBottomDiff, &pointACylBottomDiff, &spD4);
|
||||
cylToPtA.x = linePointA->x - cyl->pos.x;
|
||||
cylToPtA.y = linePointA->y - cyl->pos.y - cyl->yShift;
|
||||
cylToPtA.z = linePointA->z - cyl->pos.z;
|
||||
cylToPtB.x = linePointB->x - cyl->pos.x;
|
||||
cylToPtB.y = linePointB->y - cyl->pos.y - cyl->yShift;
|
||||
cylToPtB.z = linePointB->z - cyl->pos.z;
|
||||
Math_Vec3f_Diff(&cylToPtB, &cylToPtA, &ptAToPtB);
|
||||
cylRadiusSq = SQ(cyl->radius);
|
||||
if (!IS_ZERO(spD4.y)) {
|
||||
if (1) {}
|
||||
if ((-pointACylBottomDiff.y / spD4.y) >= 0.0f) {
|
||||
if ((-pointACylBottomDiff.y / spD4.y) <= 1.0f) {
|
||||
if ((SQ((spD4.x * (-pointACylBottomDiff.y / spD4.y)) + pointACylBottomDiff.x) +
|
||||
SQ((spD4.z * (-pointACylBottomDiff.y / spD4.y)) + pointACylBottomDiff.z)) < cylRadiusSq) {
|
||||
sp6C[0].x =
|
||||
(f32)cyl->pos.x + ((spD4.x * (-pointACylBottomDiff.y / spD4.y)) + pointACylBottomDiff.x);
|
||||
sp6C[0].y = (f32)cyl->pos.y + (f32)cyl->yShift;
|
||||
sp6C[0].z =
|
||||
(f32)cyl->pos.z + ((spD4.z * (-pointACylBottomDiff.y / spD4.y)) + pointACylBottomDiff.z);
|
||||
sp9C |= 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* This section checks for intersections with the cylinder's base and top
|
||||
*/
|
||||
if (!IS_ZERO(ptAToPtB.y)) {
|
||||
// fraction of length along AB to reach y = 0
|
||||
fracBase = -cylToPtA.y / ptAToPtB.y;
|
||||
if ((0.0f <= fracBase) && (fracBase <= 1.0f)) {
|
||||
f32 baseIntX = (ptAToPtB.x * fracBase) + cylToPtA.x;
|
||||
f32 baseIntZ = (ptAToPtB.z * fracBase) + cylToPtA.z;
|
||||
|
||||
if (SQ(baseIntX) + SQ(baseIntZ) < cylRadiusSq) {
|
||||
// adds base intersection point to intPts and sets its flag
|
||||
intPts[0].x = cyl->pos.x + baseIntX;
|
||||
intPts[0].y = (f32)cyl->pos.y + cyl->yShift;
|
||||
intPts[0].z = cyl->pos.z + baseIntZ;
|
||||
intFlags |= 1;
|
||||
}
|
||||
}
|
||||
// fraction of length along AB to reach y = cyl->height
|
||||
fracA = (cyl->height - cylToPtA.y) / ptAToPtB.y;
|
||||
if ((0.0f <= fracA) && (fracA <= 1.0f)) {
|
||||
f32 topIntX = ptAToPtB.x * fracA + cylToPtA.x;
|
||||
f32 topIntZ = ptAToPtB.z * fracA + cylToPtA.z;
|
||||
|
||||
phi_f2 = ((cyl->height - pointACylBottomDiff.y) / spD4.y);
|
||||
if (phi_f2 >= 0.0f) {
|
||||
if (phi_f2 <= 1.0f) {
|
||||
if ((SQ(pointACylBottomDiff.x + (spD4.x * phi_f2)) + SQ(pointACylBottomDiff.z + (spD4.z * phi_f2))) <
|
||||
cylRadiusSq) {
|
||||
sp6C[1].x = (f32)cyl->pos.x + pointACylBottomDiff.x + (spD4.x * phi_f2);
|
||||
sp6C[1].y = (f32)cyl->pos.y + cyl->height + cyl->yShift;
|
||||
sp6C[1].z = (f32)cyl->pos.z + pointACylBottomDiff.z + (spD4.x * phi_f2);
|
||||
sp9C |= 2;
|
||||
}
|
||||
if (SQ(topIntX) + SQ(topIntZ) < cylRadiusSq) {
|
||||
// adds top intersection point to intPts and sets its flag
|
||||
intPts[1].x = cyl->pos.x + topIntX;
|
||||
intPts[1].y = (f32)cyl->pos.y + cyl->yShift + cyl->height;
|
||||
intPts[1].z = cyl->pos.z + topIntZ;
|
||||
intFlags |= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
spB8 = SQ(pointACylBottomDiff.x) + SQ(pointACylBottomDiff.z) - cylRadiusSq; // 498c
|
||||
temp_f12_2 = SQ(spD4.z) + SQ(spD4.x);
|
||||
temp_f18 = temp_f12_2 * 2.0f;
|
||||
if (!IS_ZERO(temp_f18)) {
|
||||
temp_f2_3 = (spD4.x * pointACylBottomDiff.x) + (spD4.z * pointACylBottomDiff.z);
|
||||
temp_f14_2 = temp_f2_3 + temp_f2_3;
|
||||
temp_f0_3 = temp_f14_2 * temp_f14_2;
|
||||
temp_f16_2 = (4.0f * temp_f12_2) * spB8;
|
||||
if (temp_f0_3 < temp_f16_2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
phi_a1 = (temp_f0_3 - temp_f16_2) > 0.0f;
|
||||
phi_f2 = (sqrtf((temp_f0_3 - temp_f16_2)) - temp_f14_2) / temp_f18;
|
||||
|
||||
if (phi_a1) {
|
||||
spCC = (-temp_f14_2 - sqrtf((temp_f0_3 - temp_f16_2))) / temp_f18;
|
||||
}
|
||||
} else if (!IS_ZERO(((spD4.x * pointACylBottomDiff.x) + (spD4.z * pointACylBottomDiff.z)) +
|
||||
((spD4.x * pointACylBottomDiff.x) + (spD4.z * pointACylBottomDiff.z)))) {
|
||||
phi_f2 = -spB8 / ((spD4.x * pointACylBottomDiff.x) + (spD4.z * pointACylBottomDiff.z)) +
|
||||
((spD4.x * pointACylBottomDiff.x) + (spD4.z * pointACylBottomDiff.z));
|
||||
phi_a2 = 1;
|
||||
phi_a1 = 0;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!phi_a1) {
|
||||
if (phi_f2 < 0.0f || phi_f2 > 1.0f) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
phi_a2 = phi_f2 < 0.0f || phi_f2 > 1.0f;
|
||||
|
||||
phi_a1 = spCC < 0.0f || spCC > 1.0f;
|
||||
|
||||
if (phi_a1 && phi_a2) {
|
||||
/**
|
||||
* This section finds the points of intersection of the infinite line containing AB with the side of the infinite
|
||||
* cylinder containing cyl. Intersection points beyond the bounds of the segment and cylinder are filtered out
|
||||
* afterward.
|
||||
*/
|
||||
radSqDiff = SQXZ(cylToPtA) - cylRadiusSq;
|
||||
if (!IS_ZERO(2.0f * SQXZ(ptAToPtB))) {
|
||||
dot2AB = 2.0f * DOTXZ(ptAToPtB, cylToPtA);
|
||||
if (SQ(dot2AB) < 4.0f * SQXZ(ptAToPtB) * radSqDiff) {
|
||||
// Line's closest xz-approach is outside cylinder. No intersections.
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (phi_a2) {
|
||||
phi_a2 = 0;
|
||||
if (SQ(dot2AB) - (4.0f * SQXZ(ptAToPtB) * radSqDiff) > zero) {
|
||||
sideIntA = sideIntB = 1;
|
||||
} else {
|
||||
// Line is tangent in xz-plane. At most 1 side intersection.
|
||||
sideIntA = 1;
|
||||
sideIntB = 0;
|
||||
}
|
||||
|
||||
if (phi_a1) {
|
||||
phi_a1 = 0;
|
||||
distCent2 = sqrtf(SQ(dot2AB) - (4.0f * SQXZ(ptAToPtB) * radSqDiff));
|
||||
if (sideIntA == 1) {
|
||||
// fraction of length along AB for side intersection closer to A
|
||||
fracA = (distCent2 - dot2AB) / (2.0f * SQXZ(ptAToPtB));
|
||||
}
|
||||
}
|
||||
|
||||
if ((phi_a2 == 1) && (((phi_f2 * spD4.y) + pointACylBottomDiff.y) < 0.0f ||
|
||||
cyl->height < ((phi_f2 * spD4.y) + pointACylBottomDiff.y))) {
|
||||
phi_a2 = 0;
|
||||
}
|
||||
|
||||
if ((phi_a1 == 1) &&
|
||||
(((spCC * spD4.y) + pointACylBottomDiff.y) < 0.0f || cyl->height < ((spCC * spD4.y) + pointACylBottomDiff.y))) {
|
||||
phi_a1 = 0;
|
||||
}
|
||||
if (phi_a2 == 0 && phi_a1 == 0) {
|
||||
if (sideIntB == 1) {
|
||||
// fraction of length along AB for side intersection closer to B
|
||||
fracB = (-dot2AB - distCent2) / (2.0f * SQXZ(ptAToPtB));
|
||||
}
|
||||
} else if (!IS_ZERO(2.0f * DOTXZ(ptAToPtB, cylToPtA))) {
|
||||
// Used if the line segment is nearly vertical. Unclear what it's calculating.
|
||||
fracA = -radSqDiff / (2.0f * DOTXZ(ptAToPtB, cylToPtA));
|
||||
sideIntA = 1;
|
||||
sideIntB = 0;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (phi_a2 == 1 && phi_a1 == 1) {
|
||||
sp6C[2].x = ((phi_f2 * spD4.x) + pointACylBottomDiff.x) + (f32)cyl->pos.x;
|
||||
sp6C[2].y = (((phi_f2 * spD4.y) + pointACylBottomDiff.y) + (f32)cyl->pos.y) + (f32)cyl->yShift;
|
||||
sp6C[2].z = ((phi_f2 * spD4.z) + pointACylBottomDiff.z) + (f32)cyl->pos.z;
|
||||
sp6C[2].x = ((spCC * spD4.x) + pointACylBottomDiff.x) + (f32)cyl->pos.x;
|
||||
sp6C[2].y = (((spCC * spD4.y) + pointACylBottomDiff.y) + (f32)cyl->pos.y) + (f32)cyl->yShift;
|
||||
sp6C[2].z = ((spCC * spD4.z) + pointACylBottomDiff.z) + (f32)cyl->pos.z;
|
||||
sp9C = (sp9C | 4) | 8;
|
||||
} else if (phi_a2 == 1) {
|
||||
sp6C[2].x = ((phi_f2 * spD4.x) + pointACylBottomDiff.x) + (f32)cyl->pos.x;
|
||||
sp6C[2].y = (((phi_f2 * spD4.y) + pointACylBottomDiff.y) + (f32)cyl->pos.y) + (f32)cyl->yShift;
|
||||
sp6C[2].z = ((phi_f2 * spD4.z) + pointACylBottomDiff.z) + (f32)cyl->pos.z;
|
||||
sp9C |= 4;
|
||||
} else if (phi_a1 == 1) {
|
||||
sp6C[2].x = ((spCC * spD4.x) + pointACylBottomDiff.x) + (f32)cyl->pos.x;
|
||||
sp6C[2].y = (((spCC * spD4.y) + pointACylBottomDiff.y) + (f32)cyl->pos.y) + (f32)cyl->yShift;
|
||||
sp6C[2].z = ((spCC * spD4.z) + pointACylBottomDiff.z) + (f32)cyl->pos.z;
|
||||
sp9C |= 4;
|
||||
// checks for intersection points outside the bounds of the segment
|
||||
if (!sideIntB) {
|
||||
if (fracA < 0.0f || 1.0f < fracA) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
intBeyondA = fracA < 0.0f || 1.0f < fracA;
|
||||
intBeyondB = fracB < 0.0f || 1.0f < fracB;
|
||||
if (intBeyondA && intBeyondB) {
|
||||
return 0;
|
||||
}
|
||||
if (intBeyondA) {
|
||||
sideIntA = 0;
|
||||
}
|
||||
if (intBeyondB) {
|
||||
sideIntB = 0;
|
||||
}
|
||||
}
|
||||
// checks for intersection points outside the bounds of the cylinder
|
||||
if ((sideIntA == 1) &&
|
||||
((fracA * ptAToPtB.y + cylToPtA.y) < 0.0f || cyl->height < (fracA * ptAToPtB.y + cylToPtA.y))) {
|
||||
sideIntA = 0;
|
||||
}
|
||||
if ((sideIntB == 1) &&
|
||||
((fracB * ptAToPtB.y + cylToPtA.y) < 0.0f || cyl->height < (fracB * ptAToPtB.y + cylToPtA.y))) {
|
||||
sideIntB = 0;
|
||||
}
|
||||
if (sideIntA == 0 && sideIntB == 0) {
|
||||
return 0;
|
||||
}
|
||||
// Adds intersection points to intPts and sets side A and side B flags
|
||||
if (sideIntA == 1 && sideIntB == 1) {
|
||||
intPts[2].x = (fracA * ptAToPtB.x + cylToPtA.x) + cyl->pos.x;
|
||||
intPts[2].y = (fracA * ptAToPtB.y + cylToPtA.y) + cyl->pos.y + cyl->yShift;
|
||||
intPts[2].z = (fracA * ptAToPtB.z + cylToPtA.z) + cyl->pos.z;
|
||||
intFlags |= 4;
|
||||
intPts[3].x = (fracB * ptAToPtB.x + cylToPtA.x) + cyl->pos.x;
|
||||
intPts[3].y = (fracB * ptAToPtB.y + cylToPtA.y) + cyl->pos.y + cyl->yShift;
|
||||
intPts[3].z = (fracB * ptAToPtB.z + cylToPtA.z) + cyl->pos.z;
|
||||
intFlags |= 8;
|
||||
} else if (sideIntA == 1) {
|
||||
intPts[2].x = (fracA * ptAToPtB.x + cylToPtA.x) + cyl->pos.x;
|
||||
intPts[2].y = (fracA * ptAToPtB.y + cylToPtA.y) + cyl->pos.y + cyl->yShift;
|
||||
intPts[2].z = (fracA * ptAToPtB.z + cylToPtA.z) + cyl->pos.z;
|
||||
intFlags |= 4;
|
||||
} else if (sideIntB == 1) {
|
||||
intPts[2].x = (fracB * ptAToPtB.x + cylToPtA.x) + cyl->pos.x;
|
||||
intPts[2].y = (fracB * ptAToPtB.y + cylToPtA.y) + cyl->pos.y + cyl->yShift;
|
||||
intPts[2].z = (fracB * ptAToPtB.z + cylToPtA.z) + cyl->pos.z;
|
||||
intFlags |= 4;
|
||||
}
|
||||
|
||||
for (phi_v0_3 = 0, phi_v1_3 = 0; phi_v0_3 < 4; phi_v0_3++) {
|
||||
if (sp9C & (1 << phi_v0_3)) {
|
||||
if (phi_v1_3 == 0) {
|
||||
*intersectA = sp6C[phi_v0_3];
|
||||
} else if (phi_v1_3 == 1) {
|
||||
if (Math3D_Vec3fDistSq(intersectA, linePointA) < Math3D_Vec3fDistSq(intersectA, &sp6C[phi_v0_3])) {
|
||||
*intersectB = sp6C[phi_v0_3];
|
||||
/**
|
||||
* Places the found intersection points into intersectA and intersectB. IntersectA is always closer to point A
|
||||
*/
|
||||
for (count = 0, i = 0; i < 4; i++) {
|
||||
if (intFlags & (1 << i)) {
|
||||
if (count == 0) {
|
||||
*intersectA = intPts[i];
|
||||
} else if (count == 1) {
|
||||
if (Math3D_Vec3fDistSq(intersectA, linePointA) < Math3D_Vec3fDistSq(intersectA, &intPts[i])) {
|
||||
*intersectB = intPts[i];
|
||||
} else {
|
||||
*intersectB = *intersectA;
|
||||
*intersectA = sp6C[phi_v0_3];
|
||||
*intersectA = intPts[i];
|
||||
}
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
phi_v1_3++;
|
||||
}
|
||||
|
||||
return phi_v1_3;
|
||||
return count;
|
||||
}
|
||||
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_math3d/Math3D_CylVsLineSeg.s")
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Determines if `cyl` and `tri` are touching. The point of intersection
|
||||
* is placed in `intersect` Returns 1 if they are touching, 0 otherwise.
|
||||
|
|
|
@ -3160,9 +3160,6 @@ void func_80062E14(GlobalContext* globalCtx, Vec3f* v, Vec3f* arg2) {
|
|||
Audio_PlaySoundGeneral(NA_SE_IT_REFLECTION_WOOD, arg2, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
|
||||
#define SQXZ(vec) (SQ(vec.x) + SQ(vec.z))
|
||||
#define DOTXZ(vec1, vec2) ((vec1.x) * (vec2.x) + (vec1.z) * (vec2.z))
|
||||
|
||||
/*
|
||||
* Determines if the line segment connecting itemPos and itemProjPos intersects the side of a cylinder with the given
|
||||
* radius, height, and offset at actorPos. Returns 3 if either endpoint is inside the cylinder, otherwise returns the
|
||||
|
@ -3174,18 +3171,18 @@ s32 func_80062ECC(f32 radius, f32 height, f32 offset, Vec3f* actorPos, Vec3f* it
|
|||
Vec3f actorToItem;
|
||||
Vec3f actorToItemProj;
|
||||
Vec3f itemStep;
|
||||
f32 sp50;
|
||||
f32 sp4C;
|
||||
u32 phi_v0;
|
||||
u32 phi_v1;
|
||||
u32 phi_a1;
|
||||
u32 phi_a2;
|
||||
f32 sp38;
|
||||
f32 temp_f14;
|
||||
f32 temp_f2;
|
||||
f32 frac1;
|
||||
f32 frac2;
|
||||
u32 intersect2;
|
||||
u32 intersect1;
|
||||
u32 test1;
|
||||
u32 test2;
|
||||
f32 radSqDiff;
|
||||
f32 actorDotItemXZ;
|
||||
f32 zero = 0.0f;
|
||||
f32 temp_f0;
|
||||
f32 pad;
|
||||
f32 closeDist;
|
||||
s32 pad1;
|
||||
s32 pad2;
|
||||
|
||||
actorToItem.x = itemPos->x - actorPos->x;
|
||||
actorToItem.y = itemPos->y - actorPos->y - offset;
|
||||
|
@ -3199,54 +3196,51 @@ s32 func_80062ECC(f32 radius, f32 height, f32 offset, Vec3f* actorPos, Vec3f* it
|
|||
itemStep.y = actorToItemProj.y - actorToItem.y;
|
||||
itemStep.z = actorToItemProj.z - actorToItem.z;
|
||||
|
||||
if ((actorToItem.y > 0.0f) && (actorToItem.y < height) && (sqrtf(SQ(actorToItem.x) + SQ(actorToItem.z)) < radius)) {
|
||||
if ((actorToItem.y > 0.0f) && (actorToItem.y < height) && (sqrtf(SQXZ(actorToItem)) < radius)) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if ((actorToItemProj.y > 0.0f) && (actorToItemProj.y < height) &&
|
||||
(sqrtf(SQ(actorToItemProj.x) + SQ(actorToItemProj.z)) < radius)) {
|
||||
if ((actorToItemProj.y > 0.0f) && (actorToItemProj.y < height) && (sqrtf(SQXZ(actorToItemProj)) < radius)) {
|
||||
return 3;
|
||||
}
|
||||
sp38 = SQXZ(actorToItem) - SQ(radius);
|
||||
temp_f2 = SQXZ(itemStep);
|
||||
if (!IS_ZERO(temp_f2)) {
|
||||
temp_f14 = DOTXZ(2.0f * itemStep, actorToItem);
|
||||
if (SQ(temp_f14) < (4.0f * temp_f2) * sp38) {
|
||||
radSqDiff = SQXZ(actorToItem) - SQ(radius);
|
||||
if (!IS_ZERO(SQXZ(itemStep))) {
|
||||
actorDotItemXZ = DOTXZ(2.0f * itemStep, actorToItem);
|
||||
if (SQ(actorDotItemXZ) < (4.0f * SQXZ(itemStep) * radSqDiff)) {
|
||||
return 0;
|
||||
}
|
||||
if (SQ(temp_f14) - ((4.0f * temp_f2) * sp38) > zero) {
|
||||
phi_v1 = phi_v0 = 1;
|
||||
if (SQ(actorDotItemXZ) - (4.0f * SQXZ(itemStep) * radSqDiff) > zero) {
|
||||
intersect1 = intersect2 = 1;
|
||||
} else {
|
||||
phi_v1 = 1;
|
||||
phi_v0 = 0;
|
||||
intersect1 = 1;
|
||||
intersect2 = 0;
|
||||
}
|
||||
temp_f0 = sqrtf(SQ(temp_f14) - (4.0f * temp_f2) * sp38);
|
||||
if (phi_v1 == 1) {
|
||||
sp50 = (temp_f0 - temp_f14) / (2.0f * temp_f2);
|
||||
closeDist = sqrtf(SQ(actorDotItemXZ) - (4.0f * SQXZ(itemStep) * radSqDiff));
|
||||
if (intersect1 == 1) {
|
||||
frac1 = (closeDist - actorDotItemXZ) / (2.0f * SQXZ(itemStep));
|
||||
}
|
||||
if (phi_v0 == 1) {
|
||||
sp4C = (-temp_f14 - temp_f0) / (2.0f * temp_f2);
|
||||
if (intersect2 == 1) {
|
||||
frac2 = (-actorDotItemXZ - closeDist) / (2.0f * SQXZ(itemStep));
|
||||
}
|
||||
|
||||
} else if (!IS_ZERO(DOTXZ(2.0f * itemStep, actorToItem))) {
|
||||
phi_v1 = 1;
|
||||
phi_v0 = 0;
|
||||
sp50 = -sp38 / DOTXZ(2.0f * itemStep, actorToItem);
|
||||
intersect1 = 1;
|
||||
intersect2 = 0;
|
||||
frac1 = -radSqDiff / DOTXZ(2.0f * itemStep, actorToItem);
|
||||
} else {
|
||||
if (sp38 <= 0.0f) {
|
||||
phi_a1 = (0.0f < actorToItem.y) && (actorToItem.y < height);
|
||||
phi_a2 = (0.0f < actorToItemProj.y) && (actorToItemProj.y < height);
|
||||
if (radSqDiff <= 0.0f) {
|
||||
test1 = (0.0f < actorToItem.y) && (actorToItem.y < height);
|
||||
test2 = (0.0f < actorToItemProj.y) && (actorToItemProj.y < height);
|
||||
|
||||
if (phi_a1 && phi_a2) {
|
||||
if (test1 && test2) {
|
||||
*out1 = actorToItem;
|
||||
*out2 = actorToItemProj;
|
||||
return 2;
|
||||
}
|
||||
if (phi_a1) {
|
||||
if (test1) {
|
||||
*out1 = actorToItem;
|
||||
return 1;
|
||||
}
|
||||
if (phi_a2) {
|
||||
if (test2) {
|
||||
*out1 = actorToItemProj;
|
||||
return 1;
|
||||
}
|
||||
|
@ -3254,58 +3248,57 @@ s32 func_80062ECC(f32 radius, f32 height, f32 offset, Vec3f* actorPos, Vec3f* it
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (phi_v0 == 0) {
|
||||
if (sp50 < 0.0f || 1.0f < sp50) {
|
||||
if (intersect2 == 0) {
|
||||
if (frac1 < 0.0f || 1.0f < frac1) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
phi_a1 = (sp50 < 0.0f || 1.0f < sp50);
|
||||
phi_a2 = (sp4C < 0.0f || 1.0f < sp4C);
|
||||
test1 = (frac1 < 0.0f || 1.0f < frac1);
|
||||
test2 = (frac2 < 0.0f || 1.0f < frac2);
|
||||
|
||||
if (phi_a1 && phi_a2) {
|
||||
if (test1 && test2) {
|
||||
return 0;
|
||||
}
|
||||
if (phi_a1) {
|
||||
phi_v1 = 0;
|
||||
if (test1) {
|
||||
intersect1 = 0;
|
||||
}
|
||||
if (phi_a2) {
|
||||
phi_v0 = 0;
|
||||
if (test2) {
|
||||
intersect2 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((phi_v1 == 1) && ((sp50 * itemStep.y + actorToItem.y < 0.0f) || (height < sp50 * itemStep.y + actorToItem.y))) {
|
||||
phi_v1 = 0;
|
||||
if ((intersect1 == 1) &&
|
||||
((frac1 * itemStep.y + actorToItem.y < 0.0f) || (height < frac1 * itemStep.y + actorToItem.y))) {
|
||||
intersect1 = 0;
|
||||
}
|
||||
if ((phi_v0 == 1) && ((sp4C * itemStep.y + actorToItem.y < 0.0f) || (height < sp4C * itemStep.y + actorToItem.y))) {
|
||||
phi_v0 = 0;
|
||||
if ((intersect2 == 1) &&
|
||||
((frac2 * itemStep.y + actorToItem.y < 0.0f) || (height < frac2 * itemStep.y + actorToItem.y))) {
|
||||
intersect2 = 0;
|
||||
}
|
||||
if (phi_v1 == 0 && phi_v0 == 0) {
|
||||
if (intersect1 == 0 && intersect2 == 0) {
|
||||
return 0;
|
||||
} else if ((phi_v1 == 1) && (phi_v0 == 1)) {
|
||||
out1->x = sp50 * itemStep.x + actorToItem.x + actorPos->x;
|
||||
out1->y = sp50 * itemStep.y + actorToItem.y + actorPos->y;
|
||||
out1->z = sp50 * itemStep.z + actorToItem.z + actorPos->z;
|
||||
out2->x = sp4C * itemStep.x + actorToItem.x + actorPos->x;
|
||||
out2->y = sp4C * itemStep.y + actorToItem.y + actorPos->y;
|
||||
out2->z = sp4C * itemStep.z + actorToItem.z + actorPos->z;
|
||||
} else if ((intersect1 == 1) && (intersect2 == 1)) {
|
||||
out1->x = frac1 * itemStep.x + actorToItem.x + actorPos->x;
|
||||
out1->y = frac1 * itemStep.y + actorToItem.y + actorPos->y;
|
||||
out1->z = frac1 * itemStep.z + actorToItem.z + actorPos->z;
|
||||
out2->x = frac2 * itemStep.x + actorToItem.x + actorPos->x;
|
||||
out2->y = frac2 * itemStep.y + actorToItem.y + actorPos->y;
|
||||
out2->z = frac2 * itemStep.z + actorToItem.z + actorPos->z;
|
||||
return 2;
|
||||
} else if (phi_v1 == 1) {
|
||||
out1->x = sp50 * itemStep.x + actorToItem.x + actorPos->x;
|
||||
out1->y = sp50 * itemStep.y + actorToItem.y + actorPos->y;
|
||||
out1->z = sp50 * itemStep.z + actorToItem.z + actorPos->z;
|
||||
} else if (intersect1 == 1) {
|
||||
out1->x = frac1 * itemStep.x + actorToItem.x + actorPos->x;
|
||||
out1->y = frac1 * itemStep.y + actorToItem.y + actorPos->y;
|
||||
out1->z = frac1 * itemStep.z + actorToItem.z + actorPos->z;
|
||||
return 1;
|
||||
} else if (phi_v0 == 1) {
|
||||
out1->x = sp4C * itemStep.x + actorToItem.x + actorPos->x;
|
||||
out1->y = sp4C * itemStep.y + actorToItem.y + actorPos->y;
|
||||
out1->z = sp4C * itemStep.z + actorToItem.z + actorPos->z;
|
||||
} else if (intersect2 == 1) {
|
||||
out1->x = frac2 * itemStep.x + actorToItem.x + actorPos->x;
|
||||
out1->y = frac2 * itemStep.y + actorToItem.y + actorPos->y;
|
||||
out1->z = frac2 * itemStep.z + actorToItem.z + actorPos->z;
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#undef SQXZ
|
||||
#undef DOTXZ
|
||||
|
||||
s32 func_800635D0(s32 arg0) {
|
||||
s32 result;
|
||||
|
||||
|
|
|
@ -286,13 +286,11 @@ void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) {
|
|||
} else {
|
||||
if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) {
|
||||
if (this->unk_15A == -1) {
|
||||
if (!Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.posRot.rot.x - 0x4000, 2, 3000,
|
||||
1500)) {
|
||||
if (!Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.posRot.rot.x - 0x4000, 2, 3000, 1500)) {
|
||||
this->unk_15A = -2;
|
||||
}
|
||||
} else {
|
||||
if (!Math_SmoothStepToS(&this->actor.shape.rot.x, -this->actor.posRot.rot.x - 0x4000, 2, 3000,
|
||||
1500)) {
|
||||
if (!Math_SmoothStepToS(&this->actor.shape.rot.x, -this->actor.posRot.rot.x - 0x4000, 2, 3000, 1500)) {
|
||||
this->unk_15A = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ s32 Math_StepUntilF(f32* pValue, f32 limit, f32 step) {
|
|||
* Changes pValue toward target by incrStep if pValue is smaller and by decrStep if it is greater, setting it equal when
|
||||
* target is reached. Returns true when target is reached, false otherwise.
|
||||
*/
|
||||
s32 Math_AymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep) {
|
||||
s32 Math_AsymStepToF(f32* pValue, f32 target, f32 incrStep, f32 decrStep) {
|
||||
f32 step = (target >= *pValue) ? incrStep : decrStep;
|
||||
|
||||
if (step != 0.0f) {
|
||||
|
|
|
@ -196,7 +196,7 @@ void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) {
|
|||
|
||||
void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) {
|
||||
if (Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 500.0f, 0.5f, 7.5f,
|
||||
1.0f) < 0.1f) {
|
||||
1.0f) < 0.1f) {
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A);
|
||||
this->actionFunc = func_8086C29C;
|
||||
this->unk_16A = 0x1E;
|
||||
|
@ -331,7 +331,7 @@ void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx) {
|
|||
|
||||
void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx) {
|
||||
if (Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 965.0f, 0.5f, 15.0f,
|
||||
0.2f) < 0.01f) {
|
||||
0.2f) < 0.01f) {
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A);
|
||||
this->actionFunc = BgBdanObjects_DoNothing;
|
||||
} else {
|
||||
|
|
|
@ -120,8 +120,8 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) {
|
|||
Math_SmoothStepToF(&this->dyna.actor.speedXZ, 4.0f, 0.5f, 0.025f, 0.0f);
|
||||
func_800AA000(500.0f, 0x78, 0x14, 0xA);
|
||||
|
||||
if (Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, (this->dyna.actor.initPosRot.pos.y - 200.0f) - 20.0f,
|
||||
0.075f, this->dyna.actor.speedXZ, 0.0075f) == 0.0f) {
|
||||
if (Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, (this->dyna.actor.initPosRot.pos.y - 200.0f) - 20.0f, 0.075f,
|
||||
this->dyna.actor.speedXZ, 0.0075f) == 0.0f) {
|
||||
Flags_SetSwitch(globalCtx, this->dyna.actor.params);
|
||||
BgDdanKd_SetupAction(this, func_80871838);
|
||||
} else {
|
||||
|
|
|
@ -417,8 +417,7 @@ void func_80880AE8(BgHakaTrap* this, GlobalContext* globalCtx) {
|
|||
this->actionFunc = func_808809B0;
|
||||
}
|
||||
} else {
|
||||
if (Math_ScaledStepToS(&this->dyna.actor.posRot.rot.z, 0x3A00,
|
||||
this->dyna.actor.posRot.rot.z * 0.03f + 5.0f)) {
|
||||
if (Math_ScaledStepToS(&this->dyna.actor.posRot.rot.z, 0x3A00, this->dyna.actor.posRot.rot.z * 0.03f + 5.0f)) {
|
||||
this->timer = 100;
|
||||
this->actionFunc = func_80880C0C;
|
||||
}
|
||||
|
|
|
@ -168,8 +168,8 @@ void BgHidanFwbig_WaitForPlayer(BgHidanFwbig* this, GlobalContext* globalCtx) {
|
|||
|
||||
void BgHidanFwbig_Move(BgHidanFwbig* this, GlobalContext* globalCtx) {
|
||||
if (!Player_InCsMode(globalCtx)) {
|
||||
if (Math_ScaledStepToS(&this->actor.shape.rot.y,
|
||||
this->actor.initPosRot.rot.y + (this->direction * 0x6390), 0x20)) {
|
||||
if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.initPosRot.rot.y + (this->direction * 0x6390),
|
||||
0x20)) {
|
||||
this->moveState = FWBIG_RESET;
|
||||
this->actionFunc = BgHidanFwbig_Lower;
|
||||
} else {
|
||||
|
|
|
@ -149,7 +149,7 @@ void BgJya1flift_Move(BgJya1flift* this, GlobalContext* globalCtx) {
|
|||
tempVelocity = this->dyna.actor.velocity.y;
|
||||
}
|
||||
if (fabsf(Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, (sFinalPositions[this->isMovingDown]), 0.5f,
|
||||
tempVelocity, 1.0f)) < 0.001f) {
|
||||
tempVelocity, 1.0f)) < 0.001f) {
|
||||
this->dyna.actor.posRot.pos.y = sFinalPositions[this->isMovingDown];
|
||||
BgJya1flift_ResetMoveDelay(this);
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
|
||||
|
|
|
@ -91,8 +91,7 @@ void func_809937B4(DemoTreLgt* this, GlobalContext* globalCtx, f32 currentFrame)
|
|||
this->action = DEMO_TRE_LGT_ACTION_ANIMATE;
|
||||
|
||||
SkelCurve_SetAnim(skelCurve, sTransformUpdIdx[gSaveContext.linkAge], 1.0f,
|
||||
sDemoTreLgtInfo[gSaveContext.linkAge].endFrame +
|
||||
sDemoTreLgtInfo[gSaveContext.linkAge].unk_08,
|
||||
sDemoTreLgtInfo[gSaveContext.linkAge].endFrame + sDemoTreLgtInfo[gSaveContext.linkAge].unk_08,
|
||||
currentFrame, 1.0f);
|
||||
SkelCurve_Update(globalCtx, skelCurve);
|
||||
}
|
||||
|
@ -103,8 +102,8 @@ void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) {
|
|||
if (currentFrame < sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame) {
|
||||
this->unk_170 = 255;
|
||||
} else {
|
||||
if (currentFrame <= (sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame +
|
||||
sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_08)) {
|
||||
if (currentFrame <=
|
||||
(sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame + sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_08)) {
|
||||
this->unk_170 = ((((sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame - currentFrame) /
|
||||
sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_08) *
|
||||
255.0f) +
|
||||
|
@ -117,8 +116,7 @@ void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) {
|
|||
this->unk_174 = 255;
|
||||
} else if (currentFrame < (sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_0C + 10.0f)) {
|
||||
this->unk_174 =
|
||||
((((sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_0C - currentFrame) / 10.0f) * 255.0f) +
|
||||
255.0f);
|
||||
((((sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_0C - currentFrame) / 10.0f) * 255.0f) + 255.0f);
|
||||
} else {
|
||||
this->unk_174 = 0;
|
||||
}
|
||||
|
@ -135,7 +133,7 @@ void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) {
|
|||
void DemoTreLgt_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
DemoTreLgt* this = THIS;
|
||||
|
||||
sActionFuncs[this->action](this, globalCtx);
|
||||
sActionFuncs[this->action](this, globalCtx);
|
||||
}
|
||||
|
||||
s32 DemoTreLgt_PostLimbDraw(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, s32 limbIndex, void* thisx) {
|
||||
|
|
|
@ -106,8 +106,8 @@ void func_809C1E40(EnBird* this, GlobalContext* globalCtx) {
|
|||
Math_SmoothStepToF(&this->actor.speedXZ, this->unk_1A8, 0.1f, this->unk_1AC, 0.0f);
|
||||
|
||||
if (this->unk_1B0 < Math_Vec3f_DistXZ(&this->actor.posRot.pos, &this->actor.initPosRot.pos) || this->unk_198 < 4) {
|
||||
Math_StepToAngleS(&this->actor.posRot.rot.y, Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.initPosRot.pos),
|
||||
this->unk_1C0);
|
||||
Math_StepToAngleS(&this->actor.posRot.rot.y,
|
||||
Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.initPosRot.pos), this->unk_1C0);
|
||||
} else {
|
||||
fVar4 = sinf(this->unk_1B4);
|
||||
this->actor.posRot.rot.y += (s16)(fVar4 * this->unk_1A4);
|
||||
|
|
|
@ -216,7 +216,7 @@ void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) {
|
|||
this->actor.initPosRot.pos.z);
|
||||
func_809CD56C(this);
|
||||
Math_SmoothStepToF(&this->actor.speedXZ, flightParams->speedXZTarget, flightParams->speedXZScale,
|
||||
flightParams->speedXZStep, 0.0f);
|
||||
flightParams->speedXZStep, 0.0f);
|
||||
|
||||
if (this->unk_257 == 1) {
|
||||
maxDistSqFromHome = SQ(100.0f);
|
||||
|
@ -290,7 +290,7 @@ void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx) {
|
|||
|
||||
func_809CD634(this);
|
||||
Math_SmoothStepToF(&this->actor.speedXZ, flightParams->speedXZTarget, flightParams->speedXZScale,
|
||||
flightParams->speedXZStep, 0.0f);
|
||||
flightParams->speedXZStep, 0.0f);
|
||||
minAnimSpeed = 0.0f;
|
||||
|
||||
if ((this->flightParamsIdx != 0) && (this->timer < 12)) {
|
||||
|
|
|
@ -268,10 +268,9 @@ s32 EnFirefly_ReturnToPerch(EnFirefly* this, GlobalContext* globalCtx) {
|
|||
this->actor.speedXZ *= distFromHome;
|
||||
}
|
||||
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos),
|
||||
0x300);
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.x,
|
||||
func_8002DB28(&this->actor, &this->actor.initPosRot.pos) + 0x1554, 0x100);
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos), 0x300);
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.x, func_8002DB28(&this->actor, &this->actor.initPosRot.pos) + 0x1554,
|
||||
0x100);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -308,8 +307,7 @@ s32 EnFirefly_SeekTorch(EnFirefly* this, GlobalContext* globalCtx) {
|
|||
EnFirefly_Ignite(this);
|
||||
return 1;
|
||||
} else {
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DA78(&this->actor, &closestTorch->actor),
|
||||
0x300);
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DA78(&this->actor, &closestTorch->actor), 0x300);
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.x, func_8002DB28(&this->actor, &flamePos) + 0x1554, 0x100);
|
||||
return 1;
|
||||
}
|
||||
|
@ -332,8 +330,8 @@ void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) {
|
|||
if (skelanimeUpdated) {
|
||||
rand = Rand_ZeroOne();
|
||||
if (rand < 0.5f) {
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y,
|
||||
func_8002DAC0(&this->actor, &this->actor.initPosRot.pos), 0x300);
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos),
|
||||
0x300);
|
||||
} else if (rand < 0.8f) {
|
||||
this->actor.shape.rot.y += Rand_CenteredFloat(1536.0f);
|
||||
}
|
||||
|
@ -424,8 +422,7 @@ void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) {
|
|||
preyPos.x = player->actor.posRot.pos.x;
|
||||
preyPos.y = player->actor.posRot.pos.y + 20.0f;
|
||||
preyPos.z = player->actor.posRot.pos.z;
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.x, func_8002DB28(&this->actor, &preyPos) + 0x1554, 2, 0x400,
|
||||
0x100);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.x, func_8002DB28(&this->actor, &preyPos) + 0x1554, 2, 0x400, 0x100);
|
||||
} else {
|
||||
this->skelAnime.animPlaybackSpeed = 1.5f;
|
||||
if (this->actor.xzDistFromLink > 80.0f) {
|
||||
|
@ -483,8 +480,7 @@ void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx) {
|
|||
if (this->actor.bgCheckFlags & 8) {
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallPolyRot, 2, 0xC00, 0x300);
|
||||
} else {
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos),
|
||||
0x300);
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos), 0x300);
|
||||
}
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100);
|
||||
}
|
||||
|
|
|
@ -275,8 +275,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) {
|
|||
} else {
|
||||
Vec3f sp48;
|
||||
EnFw_GetPosAdjAroundCircle(&sp48, this, this->runRadius, this->runDirection);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, (Math_FAtan2F(sp48.x, sp48.z) * (0x8000 / M_PI)), 4, 0xFA0,
|
||||
1);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, (Math_FAtan2F(sp48.x, sp48.z) * (0x8000 / M_PI)), 4, 0xFA0, 1);
|
||||
}
|
||||
|
||||
this->actor.posRot.rot = this->actor.shape.rot;
|
||||
|
|
|
@ -305,10 +305,8 @@ void EnGSwitch_GalleryRupee(EnGSwitch* this, GlobalContext* globalCtx) {
|
|||
if (this->waitTimer == 0) {
|
||||
if ((fabsf(this->actor.posRot.pos.x - this->actor.initPosRot.pos.x) > 5.0f) ||
|
||||
(fabsf(this->actor.posRot.pos.y - this->actor.initPosRot.pos.y) > 5.0f)) {
|
||||
Math_ApproachF(&this->actor.posRot.pos.x, this->actor.initPosRot.pos.x, 0.3f,
|
||||
30.0f);
|
||||
Math_ApproachF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.3f,
|
||||
30.0f);
|
||||
Math_ApproachF(&this->actor.posRot.pos.x, this->actor.initPosRot.pos.x, 0.3f, 30.0f);
|
||||
Math_ApproachF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.3f, 30.0f);
|
||||
} else {
|
||||
gallery = ((EnSyatekiItm*)this->actor.parent);
|
||||
if (gallery->actor.update != NULL) {
|
||||
|
|
|
@ -1258,8 +1258,7 @@ void func_80A391D8(EnGeldB* this, GlobalContext* globalCtx) {
|
|||
this->headRot.y = Math_SinS(this->lookTimer * 0x1068) * 8920.0f;
|
||||
} else if (this->actionState != GELDB_STUNNED) {
|
||||
if ((this->actionState != GELDB_SLASH) && (this->actionState != GELDB_SPIN_ATTACK)) {
|
||||
Math_SmoothStepToS(&this->headRot.y, this->actor.yawTowardsLink - this->actor.shape.rot.y, 1, 0x1F4,
|
||||
0);
|
||||
Math_SmoothStepToS(&this->headRot.y, this->actor.yawTowardsLink - this->actor.shape.rot.y, 1, 0x1F4, 0);
|
||||
this->headRot.y = CLAMP(this->headRot.y, -0x256F, 0x256F);
|
||||
} else {
|
||||
this->headRot.y = 0;
|
||||
|
|
|
@ -176,7 +176,7 @@ void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx) {
|
|||
pathDiffX = pointPos->x - this->actor.posRot.pos.x;
|
||||
pathDiffZ = pointPos->z - this->actor.posRot.pos.z;
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, (Math_FAtan2F(pathDiffX, pathDiffZ) * 10430.378f), 3,
|
||||
this->bodyTurnSpeed, 0);
|
||||
this->bodyTurnSpeed, 0);
|
||||
|
||||
Math_ApproachF(&this->bodyTurnSpeed, this->bodyTurnSpeedTarget, 1.0f, this->bodyTurnSpeedMax);
|
||||
|
||||
|
@ -309,7 +309,7 @@ void EnHeishi1_Wait(EnHeishi1* this, GlobalContext* globalCtx) {
|
|||
break;
|
||||
}
|
||||
Math_ApproachF(&this->headAngle, this->headAngleTarget, this->headTurnSpeedScale,
|
||||
this->headTurnSpeedMax + this->headTurnSpeedMax);
|
||||
this->headTurnSpeedMax + this->headTurnSpeedMax);
|
||||
|
||||
if ((this->path == BREG(1)) && (BREG(0) != 0)) {
|
||||
osSyncPrintf(VT_FGCOL(GREEN) " 種類 %d\n" VT_RST, this->path);
|
||||
|
|
|
@ -268,8 +268,8 @@ s32 EnKz_FollowPath(EnKz* this, GlobalContext* globalCtx) {
|
|||
|
||||
pathDiffX = pointPos->x - this->actor.posRot.pos.x;
|
||||
pathDiffZ = pointPos->z - this->actor.posRot.pos.z;
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.y, (Math_FAtan2F(pathDiffX, pathDiffZ) * 10430.3779296875f), 0xA,
|
||||
0x3E8, 1);
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.y, (Math_FAtan2F(pathDiffX, pathDiffZ) * 10430.3779296875f), 0xA, 0x3E8,
|
||||
1);
|
||||
|
||||
if ((SQ(pathDiffX) + SQ(pathDiffZ)) < 10.0f) {
|
||||
this->waypoint++;
|
||||
|
|
|
@ -676,8 +676,7 @@ void func_80AA7938(EnMb* this, GlobalContext* globalCtx) {
|
|||
s16 sp54[] = { 20, 40, 0 };
|
||||
s16 sp4C[] = { -2500, 0, 3500 };
|
||||
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, sp4C[this->attackParams - 1] + this->actor.posRot.rot.y, 1, 0x2EE,
|
||||
0);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, sp4C[this->attackParams - 1] + this->actor.posRot.rot.y, 1, 0x2EE, 0);
|
||||
|
||||
if (this->collider2.base.atFlags & 2) {
|
||||
this->collider2.base.atFlags &= ~2;
|
||||
|
|
|
@ -540,8 +540,8 @@ u8 EnMd_FollowPath(EnMd* this, GlobalContext* globalCtx) {
|
|||
|
||||
pathDiffX = pointPos->x - this->actor.posRot.pos.x;
|
||||
pathDiffZ = pointPos->z - this->actor.posRot.pos.z;
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.y, Math_FAtan2F(pathDiffX, pathDiffZ) * (65536.0f / (2 * M_PI)), 4,
|
||||
4000, 1);
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.y, Math_FAtan2F(pathDiffX, pathDiffZ) * (65536.0f / (2 * M_PI)), 4, 4000,
|
||||
1);
|
||||
|
||||
if ((SQ(pathDiffX) + SQ(pathDiffZ)) < 100.0f) {
|
||||
this->waypoint++;
|
||||
|
|
|
@ -556,8 +556,7 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) {
|
|||
this->unk_29E = 7;
|
||||
}
|
||||
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.y, Math_FAtan2F(posY, posZ) * (0x8000 / M_PI), 3, this->unk_300,
|
||||
0);
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.y, Math_FAtan2F(posY, posZ) * (0x8000 / M_PI), 3, this->unk_300, 0);
|
||||
Math_ApproachF(&this->unk_300, 10000.0f, 1.0f, 1000.0f);
|
||||
}
|
||||
|
||||
|
@ -819,7 +818,7 @@ void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) {
|
|||
this->actionFunc = EnNiw_ResetAction;
|
||||
} else {
|
||||
this->unk_2E4 = Math_FAtan2F(this->actor.posRot.pos.x - player->actor.posRot.pos.x,
|
||||
this->actor.posRot.pos.z - player->actor.posRot.pos.z) *
|
||||
this->actor.posRot.pos.z - player->actor.posRot.pos.z) *
|
||||
(0x8000 / M_PI);
|
||||
func_80AB6100(this, globalCtx, 0);
|
||||
func_80AB5BF8(this, globalCtx, 2);
|
||||
|
|
|
@ -119,7 +119,7 @@ void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx) {
|
|||
|
||||
// Change her angle so that she is always facing the cuckoo
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(xDistBetween, zDistBetween) * 10430.378f, 3,
|
||||
this->unk_27C, 0);
|
||||
this->unk_27C, 0);
|
||||
Math_ApproachF(&this->unk_27C, 5000.0f, 30.0f, 150.0f);
|
||||
this->actor.posRot.rot.y = this->actor.shape.rot.y;
|
||||
|
||||
|
|
|
@ -223,8 +223,7 @@ void func_80ACE7E8(EnPart* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
if (this->timer == 0) {
|
||||
f32 diffsSum =
|
||||
Math_SmoothStepToF(&this->actor.posRot.pos.x, this->actor.initPosRot.pos.x, 1.0f, 5.0f, 0.0f);
|
||||
f32 diffsSum = Math_SmoothStepToF(&this->actor.posRot.pos.x, this->actor.initPosRot.pos.x, 1.0f, 5.0f, 0.0f);
|
||||
diffsSum += Math_SmoothStepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 1.0f, 5.0f, 0.0f);
|
||||
diffsSum += Math_SmoothStepToF(&this->actor.posRot.pos.z, this->actor.initPosRot.pos.z, 1.0f, 5.0f, 0.0f);
|
||||
diffsSum += Math_SmoothStepToF(&this->rotZ, 0.0f, 1.0f, 0.25f, 0.0f);
|
||||
|
|
|
@ -574,11 +574,9 @@ void func_80ADA530(EnPoSisters* this, GlobalContext* globalCtx) {
|
|||
func_80AD9368(this);
|
||||
}
|
||||
if (this->actor.bgCheckFlags & 8) {
|
||||
Math_ScaledStepToS(&this->actor.posRot.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos),
|
||||
0x71C);
|
||||
Math_ScaledStepToS(&this->actor.posRot.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos), 0x71C);
|
||||
} else if (func_8002DBB0(&this->actor, &this->actor.initPosRot.pos) > 300.0f) {
|
||||
Math_ScaledStepToS(&this->actor.posRot.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos),
|
||||
0x71C);
|
||||
Math_ScaledStepToS(&this->actor.posRot.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos), 0x71C);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -670,7 +668,7 @@ void func_80ADAAA4(EnPoSisters* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
if (this->unk_195 != 0) {
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.parent->shape.rot.y,
|
||||
(this->unk_195 == 2) ? 0x800 : 0x400);
|
||||
(this->unk_195 == 2) ? 0x800 : 0x400);
|
||||
this->unk_22E.a = ((this->skelAnime.animFrameCount - this->skelAnime.animCurrentFrame) * 255.0f) /
|
||||
this->skelAnime.animFrameCount;
|
||||
this->actor.posRot.pos.y = this->actor.parent->posRot.pos.y;
|
||||
|
@ -880,7 +878,7 @@ void func_80ADB51C(EnPoSisters* this, GlobalContext* globalCtx) {
|
|||
phi_a2 *= 2;
|
||||
}
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y,
|
||||
this->actor.parent->shape.rot.y + (this->unk_195 * 0x4000) * phi_v0, phi_a2);
|
||||
this->actor.parent->shape.rot.y + (this->unk_195 * 0x4000) * phi_v0, phi_a2);
|
||||
} else if (this->unk_19A == 70 || this->unk_19A == 40) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2);
|
||||
}
|
||||
|
@ -975,8 +973,7 @@ void func_80ADBB6C(EnPoSisters* this, GlobalContext* globalCtx) {
|
|||
if (func_8002DBB0(&this->actor, &this->actor.initPosRot.pos) < 10.0f) {
|
||||
func_80ADA028(this);
|
||||
} else {
|
||||
Math_ScaledStepToS(&this->actor.posRot.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos),
|
||||
1820);
|
||||
Math_ScaledStepToS(&this->actor.posRot.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos), 1820);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -245,8 +245,7 @@ void func_80AE2970(EnRd* this) {
|
|||
void func_80AE2A10(EnRd* this, GlobalContext* globalCtx) {
|
||||
if (this->actor.shape.rot.x != -0x4000) {
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x7D0, 0);
|
||||
if (Math_SmoothStepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.3f, 2.0f, 0.3f) ==
|
||||
0.0f) {
|
||||
if (Math_SmoothStepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.3f, 2.0f, 0.3f) == 0.0f) {
|
||||
this->actor.gravity = -3.5f;
|
||||
func_80AE269C(this);
|
||||
}
|
||||
|
@ -254,8 +253,8 @@ void func_80AE2A10(EnRd* this, GlobalContext* globalCtx) {
|
|||
if (this->actor.posRot.pos.y == this->actor.initPosRot.pos.y) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY);
|
||||
}
|
||||
if (Math_SmoothStepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + 50.0f, 0.3f, 2.0f,
|
||||
0.3f) == 0.0f) {
|
||||
if (Math_SmoothStepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + 50.0f, 0.3f, 2.0f, 0.3f) ==
|
||||
0.0f) {
|
||||
if (this->unk_30C != 0) {
|
||||
this->unk_30C--;
|
||||
Math_SmoothStepToF(&this->actor.speedXZ, 6.0f, 0.3f, 1.0f, 0.3f);
|
||||
|
@ -467,12 +466,12 @@ void func_80AE3454(EnRd* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
Math_SmoothStepToF(&this->actor.posRot.pos.x,
|
||||
(Math_SinS(player->actor.shape.rot.y) * -25.0f) + player->actor.posRot.pos.x, 1.0f,
|
||||
10.0f, 0.0f);
|
||||
(Math_SinS(player->actor.shape.rot.y) * -25.0f) + player->actor.posRot.pos.x, 1.0f,
|
||||
10.0f, 0.0f);
|
||||
Math_SmoothStepToF(&this->actor.posRot.pos.y, player->actor.posRot.pos.y, 1.0f, 10.0f, 0.0f);
|
||||
Math_SmoothStepToF(&this->actor.posRot.pos.z,
|
||||
(Math_CosS(player->actor.shape.rot.y) * -25.0f) + player->actor.posRot.pos.z, 1.0f,
|
||||
10.0f, 0.0f);
|
||||
(Math_CosS(player->actor.shape.rot.y) * -25.0f) + player->actor.posRot.pos.z, 1.0f,
|
||||
10.0f, 0.0f);
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, player->actor.shape.rot.y, 1, 0x1770, 0);
|
||||
|
||||
if (this->skelAnime.animCurrentFrame == 0.0f) {
|
||||
|
|
|
@ -763,15 +763,13 @@ void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Math_ApproachF(&this->pulseSize, this->pulseSizeTarget, 1.0f, 0.0015f);
|
||||
Math_ApproachF(&this->wobbleSize, this->wobbleSizeTarget, 1.0f, 20.0f);
|
||||
for (i = 0; i < 5; i++) {
|
||||
Math_SmoothStepToS(&this->bodySegs[i].rot.x, this->bodySegs[i].rotTarget.x, 5,
|
||||
this->segMoveRate * 1000.0f, 0);
|
||||
Math_SmoothStepToS(&this->bodySegs[i].rot.z, this->bodySegs[i].rotTarget.z, 5,
|
||||
this->segMoveRate * 1000.0f, 0);
|
||||
Math_ApproachF(&this->bodySegs[i].scale.x, this->bodySegs[i].scaleTarget.x, 1.0f,
|
||||
this->segMoveRate * 0.2f);
|
||||
Math_SmoothStepToS(&this->bodySegs[i].rot.x, this->bodySegs[i].rotTarget.x, 5, this->segMoveRate * 1000.0f,
|
||||
0);
|
||||
Math_SmoothStepToS(&this->bodySegs[i].rot.z, this->bodySegs[i].rotTarget.z, 5, this->segMoveRate * 1000.0f,
|
||||
0);
|
||||
Math_ApproachF(&this->bodySegs[i].scale.x, this->bodySegs[i].scaleTarget.x, 1.0f, this->segMoveRate * 0.2f);
|
||||
this->bodySegs[i].scale.z = this->bodySegs[i].scale.x;
|
||||
Math_ApproachF(&this->bodySegs[i].height, this->bodySegs[i].heightTarget, 1.0f,
|
||||
this->segMoveRate * 300.0f);
|
||||
Math_ApproachF(&this->bodySegs[i].height, this->bodySegs[i].heightTarget, 1.0f, this->segMoveRate * 300.0f);
|
||||
}
|
||||
Math_ApproachF(&this->segMoveRate, 1.0f, 1.0f, 0.2f);
|
||||
}
|
||||
|
|
|
@ -301,8 +301,7 @@ void EnSsh_Turn(EnSsh* this, GlobalContext* globalCtx) {
|
|||
|
||||
void EnSsh_Stunned(EnSsh* this, GlobalContext* globalCtx) {
|
||||
if ((this->swayTimer == 0) && (this->stunTimer == 0)) {
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink ^ 0x8000, 4, this->maxTurnRate,
|
||||
1);
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink ^ 0x8000, 4, this->maxTurnRate, 1);
|
||||
}
|
||||
this->actor.shape.rot.y = this->actor.posRot.rot.y;
|
||||
if (this->stunTimer < 30) {
|
||||
|
|
|
@ -320,8 +320,7 @@ void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx) {
|
|||
this->unk_294 = 7;
|
||||
}
|
||||
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.y, Math_FAtan2F(tmpf1, tmpf2) * 10430.378f, 3, this->unk_2C8.z,
|
||||
0);
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.y, Math_FAtan2F(tmpf1, tmpf2) * 10430.378f, 3, this->unk_2C8.z, 0);
|
||||
Math_ApproachF(&this->unk_2C8.z, 10000.0f, 1.0f, 1000.0f);
|
||||
}
|
||||
|
||||
|
@ -466,11 +465,11 @@ void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
Math_SmoothStepToS(&this->actor.posRot.rot.y,
|
||||
(s16)(Math_FAtan2F(player->actor.posRot.pos.x - this->actor.posRot.pos.x,
|
||||
player->actor.posRot.pos.z - this->actor.posRot.pos.z) *
|
||||
10430.378f) +
|
||||
phi_f16,
|
||||
5, this->unk_2C8.y, 0);
|
||||
(s16)(Math_FAtan2F(player->actor.posRot.pos.x - this->actor.posRot.pos.x,
|
||||
player->actor.posRot.pos.z - this->actor.posRot.pos.z) *
|
||||
10430.378f) +
|
||||
phi_f16,
|
||||
5, this->unk_2C8.y, 0);
|
||||
Math_ApproachF(&this->unk_2C8.y, 3000.0f, 1.0f, 500.0f);
|
||||
if (this->unk_296 == 2) {
|
||||
this->unk_256 = 10;
|
||||
|
|
|
@ -157,7 +157,7 @@ void EnVm_Wait(EnVm* this, GlobalContext* globalCtx) {
|
|||
this->actor.yDistFromLink <= 80.0f && this->actor.yDistFromLink >= -160.0f) {
|
||||
Math_SmoothStepToS(&this->beamRot, pitch, 10, 0xFA0, 0);
|
||||
if (Math_SmoothStepToS(&this->headRotY, this->actor.yawTowardsLink - this->actor.shape.rot.y, 1,
|
||||
(ABS((s16)(dist * 180.0f)) / 3) + 0xFA0, 0) <= 5460) {
|
||||
(ABS((s16)(dist * 180.0f)) / 3) + 0xFA0, 0) <= 5460) {
|
||||
this->timer--;
|
||||
if (this->timer == 0) {
|
||||
this->unk_25E++;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "z_magic_dark.h"
|
||||
|
||||
static u64 sDiamondTexture[] = {
|
||||
#include "assets/overlays/ovl_Magic_Dark/diamond_texture.i8.inc.c"
|
||||
#include "assets/overlays/ovl_Magic_Dark/diamond_texture.i8.inc.c"
|
||||
};
|
||||
|
||||
extern UNK_TYPE D_04032490[];
|
||||
|
|
|
@ -129,7 +129,7 @@ void func_80B93E38(ObjHsblock* this) {
|
|||
void func_80B93E5C(ObjHsblock* this, GlobalContext* globalCtx) {
|
||||
Math_SmoothStepToF(&this->dyna.actor.velocity.y, 16.0f, 0.1f, 0.8f, 0.0f);
|
||||
if (fabsf(Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 0.3f,
|
||||
this->dyna.actor.velocity.y, 0.3f)) < 0.001f) {
|
||||
this->dyna.actor.velocity.y, 0.3f)) < 0.001f) {
|
||||
this->dyna.actor.posRot.pos.y = this->dyna.actor.initPosRot.pos.y;
|
||||
func_80B93D90(this);
|
||||
this->dyna.actor.flags &= ~0x10;
|
||||
|
|
|
@ -2957,7 +2957,7 @@ void func_808368EC(Player* this, GlobalContext* globalCtx) {
|
|||
if ((this->unk_664 != NULL) &&
|
||||
((globalCtx->actorCtx.targetCtx.unk_4B != 0) || (this->actor.type != ACTORTYPE_PLAYER))) {
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y,
|
||||
Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->unk_664->posRot2.pos), 4000);
|
||||
Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->unk_664->posRot2.pos), 4000);
|
||||
} else if ((this->stateFlags1 & 0x20000) && !(this->stateFlags2 & 0x60)) {
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetYaw, 4000);
|
||||
}
|
||||
|
@ -5777,7 +5777,7 @@ void func_8083DDC8(Player* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void func_8083DF68(Player* this, f32 arg1, s16 arg2) {
|
||||
Math_AymStepToF(&this->linearVelocity, arg1, REG(19) / 100.0f, 1.5f);
|
||||
Math_AsymStepToF(&this->linearVelocity, arg1, REG(19) / 100.0f, 1.5f);
|
||||
Math_ScaledStepToS(&this->currentYaw, arg2, REG(27));
|
||||
}
|
||||
|
||||
|
@ -5793,7 +5793,7 @@ void func_8083DFE0(Player* this, f32* arg1, s16* arg2) {
|
|||
this->currentYaw = *arg2;
|
||||
}
|
||||
} else {
|
||||
Math_AymStepToF(&this->linearVelocity, *arg1, 0.05f, 0.1f);
|
||||
Math_AsymStepToF(&this->linearVelocity, *arg1, 0.05f, 0.1f);
|
||||
Math_ScaledStepToS(&this->currentYaw, *arg2, 200);
|
||||
}
|
||||
}
|
||||
|
@ -6672,7 +6672,7 @@ void func_80840450(Player* this, GlobalContext* globalCtx) {
|
|||
return;
|
||||
}
|
||||
|
||||
Math_AymStepToF(&this->linearVelocity, sp44 * 0.3f, 2.0f, 1.5f);
|
||||
Math_AsymStepToF(&this->linearVelocity, sp44 * 0.3f, 2.0f, 1.5f);
|
||||
|
||||
if (!(this->stateFlags3 & 8)) {
|
||||
Math_ScaledStepToS(&this->currentYaw, sp42, temp4 * 0.1f);
|
||||
|
@ -6939,7 +6939,7 @@ void func_80840DE4(Player* this, GlobalContext* globalCtx) {
|
|||
return;
|
||||
}
|
||||
|
||||
Math_AymStepToF(&this->linearVelocity, sp44 * 0.4f, 1.5f, 1.5f);
|
||||
Math_AsymStepToF(&this->linearVelocity, sp44 * 0.4f, 1.5f, 1.5f);
|
||||
Math_ScaledStepToS(&this->currentYaw, sp42, temp3 * 0.1f);
|
||||
}
|
||||
}
|
||||
|
@ -7034,7 +7034,7 @@ void func_808414F8(Player* this, GlobalContext* globalCtx) {
|
|||
} else {
|
||||
sp2A = sp32 - this->currentYaw;
|
||||
|
||||
Math_AymStepToF(&this->linearVelocity, sp34 * 1.5f, 1.5f, 2.0f);
|
||||
Math_AsymStepToF(&this->linearVelocity, sp34 * 1.5f, 1.5f, 2.0f);
|
||||
Math_ScaledStepToS(&this->currentYaw, sp32, sp2A * 0.1f);
|
||||
|
||||
if ((sp34 == 0.0f) && (this->linearVelocity == 0.0f)) {
|
||||
|
@ -7159,7 +7159,7 @@ void func_8084193C(Player* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
sp3C *= 0.9f;
|
||||
Math_AymStepToF(&this->linearVelocity, sp3C, 2.0f, 3.0f);
|
||||
Math_AsymStepToF(&this->linearVelocity, sp3C, 2.0f, 3.0f);
|
||||
Math_ScaledStepToS(&this->currentYaw, sp3A, temp3 * 0.1f);
|
||||
}
|
||||
}
|
||||
|
@ -8400,7 +8400,7 @@ void func_80845000(Player* this, GlobalContext* globalCtx) {
|
|||
return;
|
||||
}
|
||||
|
||||
Math_AymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f);
|
||||
Math_AsymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f);
|
||||
Math_ScaledStepToS(&this->currentYaw, sp52, sp44 * 0.1f);
|
||||
|
||||
if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f)) {
|
||||
|
@ -8468,7 +8468,7 @@ void func_80845308(Player* this, GlobalContext* globalCtx) {
|
|||
return;
|
||||
}
|
||||
|
||||
Math_AymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f);
|
||||
Math_AsymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f);
|
||||
Math_ScaledStepToS(&this->currentYaw, sp52, sp44 * 0.1f);
|
||||
|
||||
if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f) && (sp5C == 0.0f)) {
|
||||
|
@ -10080,7 +10080,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) {
|
|||
Math_StepToF(&this->windSpeed, sp48, sp48 * 0.1f);
|
||||
|
||||
Math_ScaledStepToS(&this->windDirection, D_808535FC,
|
||||
((this->stateFlags1 & 0x8000000) ? 400.0f : 800.0f) * sp48);
|
||||
((this->stateFlags1 & 0x8000000) ? 400.0f : 800.0f) * sp48);
|
||||
} else if (this->windSpeed != 0.0f) {
|
||||
Math_StepToF(&this->windSpeed, 0.0f, (this->stateFlags1 & 0x8000000) ? 0.5f : 1.0f);
|
||||
}
|
||||
|
@ -10556,7 +10556,7 @@ void func_8084AEEC(Player* this, f32* arg1, f32 arg2, s16 arg3) {
|
|||
arg2 = 0.0f;
|
||||
}
|
||||
|
||||
Math_AymStepToF(arg1, arg2 * 0.8f, temp1, (fabsf(*arg1) * 0.02f) + 0.05f);
|
||||
Math_AsymStepToF(arg1, arg2 * 0.8f, temp1, (fabsf(*arg1) * 0.02f) + 0.05f);
|
||||
Math_ScaledStepToS(&this->currentYaw, arg3, 1600);
|
||||
}
|
||||
|
||||
|
@ -12341,7 +12341,7 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) {
|
|||
sp4C = 1.0f;
|
||||
}
|
||||
|
||||
if (Math_AymStepToF(&this->linearVelocity, sp50, sp4C, sp48) && (sp50 == 0)) {
|
||||
if (Math_AsymStepToF(&this->linearVelocity, sp50, sp4C, sp48) && (sp50 == 0)) {
|
||||
LinkAnimationHeader* anim;
|
||||
if (this->unk_84F == 0) {
|
||||
anim = D_80853D04[this->modelAnimType];
|
||||
|
|
69
tools/mathfixer.py
Normal file
69
tools/mathfixer.py
Normal file
|
@ -0,0 +1,69 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import argparse
|
||||
|
||||
mathdict ={"Math_Rand_":"Rand_",
|
||||
"func_800CA540(":"Math_FactorialF(",
|
||||
"func_800CA63C(":"Math_Factorial(",
|
||||
"func_800CA6FC(":"Math_PowF(",
|
||||
"func_800CA720(":"Math_SinF(",
|
||||
"func_800CA774(":"Math_CosF(",
|
||||
"Math_atan2f(":"Math_FAtan2F(",
|
||||
"atan2f(":"Math_Atan2F(",
|
||||
"atan2s(":"Math_Atan2S(",
|
||||
"Math_Coss(":"Math_CosS(",
|
||||
"Math_Sins(":"Math_SinS(",
|
||||
"Math_ApproxUpdateScaledS(":"Math_ScaledStepToS(",
|
||||
"Math_ApproxS(":"Math_StepToS(",
|
||||
"Math_ApproxF(":"Math_StepToF(",
|
||||
"func_80077A90(":"Math_StepUntilAngleS(",
|
||||
"func_80077AF8(":"Math_StepUntilS(",
|
||||
"func_80077B58(":"Math_StepToAngleS(",
|
||||
"func_80077C1C(":"Math_StepUntilF(",
|
||||
"func_80077C6C(":"Math_AsymStepToF(",
|
||||
"Math_SmoothScaleMaxMinF(":"Math_SmoothStepToF(",
|
||||
"Math_SmoothScaleMaxF(":"Math_ApproachF(",
|
||||
"Math_SmoothDownscaleMaxF(":"Math_ApproachZeroF(",
|
||||
"func_800784D8(":"Math_SmoothStepToDegF(",
|
||||
"Math_SmoothScaleMaxMinS(":"Math_SmoothStepToS(",
|
||||
"Math_SmoothScaleMaxS(":"Math_ApproachS("}
|
||||
|
||||
def replace_math(file):
|
||||
with open(file,'r',encoding = 'utf-8') as infile:
|
||||
srcdata = infile.read()
|
||||
|
||||
funcs = list(mathdict.keys())
|
||||
fixes = 0
|
||||
for func in funcs:
|
||||
newfunc = mathdict.get(func)
|
||||
if(newfunc is None):
|
||||
print("How did this happen?")
|
||||
return -1
|
||||
if(func in srcdata):
|
||||
fixes += 1
|
||||
srcdata = srcdata.replace(func, newfunc)
|
||||
|
||||
|
||||
if(fixes > 0):
|
||||
print('Changed', fixes,'function' + ('' if fixes == 1 else 's') + ' in',file)
|
||||
with open(file, 'w', encoding = 'utf-8', newline = '\n') as outfile:
|
||||
outfile.write(srcdata)
|
||||
return 1
|
||||
|
||||
def replace_math_all(repo):
|
||||
for subdir, dirs, files in os.walk(repo + os.sep + 'src'):
|
||||
for filename in files:
|
||||
if(filename.endswith('.c')):
|
||||
file = subdir + os.sep + filename
|
||||
replace_math(file)
|
||||
for subdir, dirs, files in os.walk(repo + os.sep + 'asm' + os.sep + 'non_matchings'):
|
||||
for filename in files:
|
||||
if(filename.endswith('.c')):
|
||||
file = subdir + os.sep + filename
|
||||
replace_math(file)
|
||||
return 1
|
||||
|
||||
if __name__ == "__main__":
|
||||
repo = os.curdir
|
||||
replace_math_all(repo)
|
Loading…
Add table
Reference in a new issue