Random Process, gives a number between 0-7fff

From Final Fantasy Hacktics Wiki
Revision as of 10:48, 23 September 2016 by FFHGuest (talk | contribs)
Jump to navigation Jump to search

Gets a random 16-bit integer (between 0 and 0x7FFF, inclusive), or 0x4000 if this is just damage prediction. The result is stored in r2 as a 32-bit signed number. See RNG.

0018eea0: 3c028019 lui r2,0x8019
0018eea4: 8c42f5fc lw r2,-0x0a04(r2)		Load ? (maybe dealing with displayed damage?)
0018eea8: 27bdffe8 addiu r29,r29,0xffe8
0018eeac: 14400005 bne r2,r0,0x0018eec4		Branch if only displaying damage (not actually attacking)
0018eeb0: afbf0010 sw r31,0x0010(r29)
0018eeb4: 0c0088c3 jal 0x0002230c		Random Number Generator (sets r2 = rand 0..7FFF)
0018eeb8: 00000000 nop
0018eebc: 08063bb2 j 0x0018eec8
0018eec0: 00000000 nop
0018eec4: 34024000 ori r2,r0,0x4000		Random = 4000 (for displayed damage, to show "average")
0018eec8: 8fbf0010 lw r31,0x0010(r29)
0018eecc: 27bd0018 addiu r29,r29,0x0018
0018eed0: 03e00008 jr r31
0018eed4: 00000000 nop

Return Locations

00187f24: Apply status (to action)