Something height related?

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

called with ffc1, argument 1 = 3
000897dc: 27bdffe0 addiu r29,r29,0xffe0
000897e0: afb00010 sw r16,0x0010(r29)
000897e4: 00808021 addu r16,r4,r0
000897e8: afbf0018 sw r31,0x0018(r29)
000897ec: afb10014 sw r17,0x0014(r29)
000897f0: 8e11008c lw r17,0x008c(r16)			#load distortion var.
000897f4: 8e030088 lw r3,0x0088(r16)			#load distort counter
000897f8: 8e040090 lw r4,0x0090(r16)			#load temp. arg
000897fc: 10600005 beq r3,r0,0x00089814		#branch if distort, counter is 0
00089800: 34020001 ori r2,r0,0x0001
00089804: 1062000e beq r3,r2,0x00089840		#if 1
00089808: 00000000 nop
0008980c: 08022621 j 0x00089884			#otherwise, skip
00089810: ae11008c sw r17,0x008c(r16)			#store distortion variable back.
If distort counter = 0
00089814: 0c01f4fd jal 0x0007d3f4			#0007d3f4 - 0007d474 - obtain height of unit being ridden
00089818: 02002021 addu r4,r16,r0
0008981c: 00022300 sll r4,r2,0x0c			#mount's height * 0x1000
00089820: 86030042 lh r3,0x0042(r16)			#load height mod
00089824: 8e020088 lw r2,0x0088(r16)			#load distort counter
00089828: 00031b00 sll r3,r3,0x0c			#height mod * 0x1000
0008982c: 00831823 subu r3,r4,r3			#mount height - unit's height
00089830: 24420001 addiu r2,r2,0x0001
00089834: 0071001a div r3,r17				#divide difference by distortion variable
00089838: 00008812 mflo r17
0008983c: ae020088 sw r2,0x0088(r16)			#store incremented distort counter
if distort counter = 0, 1
00089840: 8e03001c lw r3,0x001c(r16)			#load unit's height mod (* 0x1000)
00089844: 00000000 nop
00089848: 0064102a slt r2,r3,r4			#true if unit's height is less than mount's height
0008984c: 10400003 beq r2,r0,0x0008985c		#branch if unit's height is greater than mount's height (loop until so)
00089850: 02231021 addu r2,r17,r3			#unit's height + height difference / distortion variable
00089854: 08022619 j 0x00089864
00089858: ae02001c sw r2,0x001c(r16)			#store new height

0008985c: ae04001c sw r4,0x001c(r16)			#store mount's height as unit's height
00089860: a2000087 sb r0,0x0087(r16)			#clear distortion wait check
00089864: 8e02001c lw r2,0x001c(r16)			#load unit's height
00089868: 00000000 nop
0008986c: 04410002 bgez r2,0x00089878			#negative division check
00089870: 00000000 nop
00089874: 24420fff addiu r2,r2,0x0fff
00089878: 00021303 sra r2,r2,0x0c			#divide by 0x1000
0008987c: a6020042 sh r2,0x0042(r16)			#store back as height mod
00089880: ae11008c sw r17,0x008c(r16)			#restore distortion variable
00089884: ae040090 sw r4,0x0090(r16)			#store mount height for next loop
00089888: 8fbf0018 lw r31,0x0018(r29)
0008988c: 8fb10014 lw r17,0x0014(r29)
00089890: 8fb00010 lw r16,0x0010(r29)
00089894: 27bd0020 addiu r29,r29,0x0020
00089898: 03e00008 jr r31
0008989c: 00000000 nop