Difference between revisions of "Depth Calculation"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m (Redirecting duplicate page)
 
Line 1: Line 1:
<pre>
+
#REDIRECT [[Height vs Water and Float Routine]]
Get Caster Height From Water Supports and Float
 
001797b4: 27bdffe0 addiu r29,r29,-0x0020
 
001797b8: afb00010 sw r16,0x0010(r29)
 
001797bc: 00808021 addu r16,r4,r0 r16 = Caster data
 
001797c0: afb10014 sw r17,0x0014(r29)
 
001797c4: afbf0018 sw r31,0x0018(r29)
 
001797c8: 0c060428 jal 0x001810a0 Map Location Calculation
 
001797cc: 00008821 addu r17,r0,r0 Clear Weapon Range
 
001797d0: 000210c0 sll r2,r2,0x03
 
001797d4: 3c038019 lui r3,0x8019
 
001797d8: 2463f8cc addiu r3,r3,-0x0734 r3 = 8018f8cc(tile data)
 
001797dc: 00431021 addu r2,r2,r3 r2 = 18f8cc + caster tile id
 
001797e0: 92050182 lbu r5,0x0182(r16) Caster's Mount Data
 
001797e4: 90440002 lbu r4,0x0002(r2) Caster Tile's Height
 
001797e8: 90430003 lbu r3,0x0003(r2) Caster Tile's Height (halves)
 
001797ec: 90420003 lbu r2,0x0003(r2) Caster Tile's Height (halves)
 
001797f0: 00042040 sll r4,r4,0x01
 
001797f4: 3063001f andi r3,r3,0x001f Ignore Depth
 
001797f8: 00832021 addu r4,r4,r3 Height + Height(halves)
 
001797fc: 00021142 srl r2,r2,0x05 Ignore Halves
 
00179800: 00023040 sll r6,r2,0x01 r6 = Depth
 
00179804: 30a20080 andi r2,r5,0x0080 Is Unit Riding?
 
00179808: 10400009 beq r2,r0,0x00179830 Branch if false
 
0017980c: 00801821 addu r3,r4,r0 r3 = Height and halves
 
00179810: 30a2001f andi r2,r5,0x001f r2 = Mount ID
 
00179814: 000218c0 sll r3,r2,0x03
 
00179818: 00621823 subu r3,r3,r2
 
0017981c: 00031980 sll r3,r3,0x06
 
00179820: 3c028019 lui r2,0x8019
 
00179824: 244208cc addiu r2,r2,0x08cc Get Unit Data
 
00179828: 00628021 addu r16,r3,r2 Get Mount's Unit Data (replacing Caster's Data)
 
0017982c: 24830002 addiu r3,r4,0x0002 r3 = Height + 2
 
00179830: 92050095 lbu r5,0x0095(r16) Get Movement 3
 
00179834: 00000000 nop
 
00179838: 30a20008 andi r2,r5,0x0008 If Unit has Float(movement)
 
0017983c: 14400006 bne r2,r0,0x00179858 Branch if True
 
00179840: 00000000 nop
 
00179844: 9202005a lbu r2,0x005a(r16) Get Unit Current Status 3
 
00179848: 00000000 nop
 
0017984c: 30420040 andi r2,r2,0x0040 If Unit = Float (status)
 
00179850: 10400003 beq r2,r0,0x00179860 Branch if False
 
00179854: 00000000 nop
 
00179858: 24630002 addiu r3,r3,0x0002 Height + 2
 
0017985c: 34110001 ori r17,r0,0x0001 r17 = True
 
00179860: 10c0000c beq r6,r0,0x00179894 Exit if in Deep Water
 
00179864: 322200ff andi r2,r17,0x00ff
 
00179868: 14400004 bne r2,r0,0x0017987c branch if Float = True
 
0017986c: 00661021 addu r2,r3,r6 r2 = Height + Depth
 
00179870: 30a20080 andi r2,r5,0x0080 If Walk on Water (Water Walk)
 
00179874: 10400003 beq r2,r0,0x00179884 Branch if false
 
00179878: 00661021 addu r2,r3,r6 r2 = Height + Depth
 
0017987c: 0805e625 j 0x00179894 Skip next branch
 
00179880: 00401821 addu r3,r2,r0 r3 = Height + Height(Halves)
 
00179884: 30a20040 andi r2,r5,0x0040 If Move in Water (Swim)
 
00179888: 10400002 beq r2,r0,0x00179894 Branch if false
 
0017988c: 246200fe addiu r2,r3,0x00fe 0 if Height = 1
 
00179890: 00c21821 addu r3,r6,r2 Height + Height(Halves) + Depth
 
00179894: 306200ff andi r2,r3,0x00ff r2 = Height
 
00179898: 8fbf0018 lw r31,0x0018(r29)
 
0017989c: 8fb10014 lw r17,0x0014(r29)
 
001798a0: 8fb00010 lw r16,0x0010(r29)
 
001798a4: 27bd0020 addiu r29,r29,0x0020
 
001798a8: 03e00008 jr r31
 
001798ac: 00000000 nop
 
</pre>
 

Latest revision as of 20:49, 15 January 2019