Difference between revisions of "001af3a4 - 001af3d8"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " Little math routine dedicated to arcing weapon trajectory '''Parameters''' : r4 = (Attacker to target distance)*4096 = [AT distance]*4096 '''Returns''' : r2 = ([AT dist...")
 
m
Line 8: Line 8:
 
  001af3a8: 00840018 mult r4,r4              |{{f/std|<nowiki> ([AT distance]*64)^2</nowiki>}}
 
  001af3a8: 00840018 mult r4,r4              |{{f/std|<nowiki> ([AT distance]*64)^2</nowiki>}}
 
  001af3ac: 3c03801c lui r3,0x801c            |{{f/std|<nowiki>r3 = 0x801c0000</nowiki>}}
 
  001af3ac: 3c03801c lui r3,0x801c            |{{f/std|<nowiki>r3 = 0x801c0000</nowiki>}}
  001af3b0: 8c638878 lw r3,-0x7788(r3)        |{{f/load|<nowiki>r3 = gravity mod ? 0xa8000 (12*28*2048)</nowiki>}} {{f/std|<nowiki>Higher value send arrow in the sky</nowiki>}}
+
  001af3b0: 8c638878 lw r3,-0x7788(r3)        |{{f/load|<nowiki>r3 = gravity mod ? 0xa8000 (12*28*2048)</nowiki>}} {{f/std|<nowiki>Higher value send arrow in the sky, but less far</nowiki>}}
 
  001af3b4: 00001012 mflo r2                  |{{f/std|<nowiki>r2 = [AT distance]² * 4096</nowiki>}}
 
  001af3b4: 00001012 mflo r2                  |{{f/std|<nowiki>r2 = [AT distance]² * 4096</nowiki>}}
 
  001af3b8: 000322c3 sra r4,r3,0x0b          |{{f/std|<nowiki>r4 = 0xa8000 / 2048 = 12*28</nowiki>}}
 
  001af3b8: 000322c3 sra r4,r3,0x0b          |{{f/std|<nowiki>r4 = 0xa8000 / 2048 = 12*28</nowiki>}}
Line 24: Line 24:
 
  '''Battle.bin'''
 
  '''Battle.bin'''
 
  001af434:
 
  001af434:
 +
 
  '''SCUS'''
 
  '''SCUS'''
 
  None
 
  None

Revision as of 21:03, 28 January 2022

Little math routine dedicated to arcing weapon trajectory

Parameters : r4 = (Attacker to target distance)*4096 = [AT distance]*4096

Returns : r2 = ([AT distance]² *4096/336) - 0x54000 
-------------------------------------------------------------------------------------------
001af3a4: 00042183 sra r4,r4,0x06           |r4 = [AT distance]*64
001af3a8: 00840018 mult r4,r4               | ([AT distance]*64)^2
001af3ac: 3c03801c lui r3,0x801c            |r3 = 0x801c0000
001af3b0: 8c638878 lw r3,-0x7788(r3)        |r3 = gravity mod ? 0xa8000 (12*28*2048) Higher value send arrow in the sky, but less far
001af3b4: 00001012 mflo r2                  |r2 = [AT distance]² * 4096
001af3b8: 000322c3 sra r4,r3,0x0b           |r4 = 0xa8000 / 2048 = 12*28
001af3bc: 00000000 nop                      |
001af3c0: 0044001a div r2,r4                |[AT distance]²* 4096 / 336
001af3c4: 00001012 mflo r2                  |r2 = [AT distance]²  * 4096 / 336
001af3c8: 000327c2 srl r4,r3,0x1f           |r4 = r3/ 2^31 = 0x00
001af3cc: 00641821 addu r3,r3,r4            |r3 = gravity mod + 0x00
001af3d0: 00031843 sra r3,r3,0x01           |r2 = gravity mod / 2 (0x54000)
001af3d4: 03e00008 jr r31                   |
001af3d8: 00621023 subu r2,r3,r2            |r2 = ([AT distance]² *4096/336) - 0x54000

Wiki Search flag

uses 0x801b8878 flagged as gravity mod  ( 801b8878 )

Return location

Battle.bin
001af434:

SCUS
None