Difference between revisions of "Random Process 2"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " Random Process (gives a random based on r4 (MOD) and checks against r5 (chance to work)) 0018eed8: 27bdffe0 addiu r29,r29,0xffe0 0018eedc: afb00010 sw r16,0x0010(r29) 001...")
 
(Redirect: Dupe page.)
 
Line 1: Line 1:
Random Process (gives a random based on r4 (MOD) and checks against r5 (chance to  work))
+
#REDIRECT [[Random Process]]
0018eed8: 27bdffe0 addiu r29,r29,0xffe0
 
0018eedc: afb00010 sw r16,0x0010(r29)
 
0018eee0: 00808021 addu r16,r4,r0 r16 = Random MOD
 
0018eee4: afb10014 sw r17,0x0014(r29)
 
0018eee8: afbf0018 sw r31,0x0018(r29)
 
0018eeec: 0c063ba8 jal 0x0018eea0 Random Procees (returns 0-7FFF)
 
0018eef0: 00a08821 addu r17,r5,r0 r17 = Chance
 
0018eef4: 00500018 mult r2,r16 Random * MOD
 
0018eef8: 00001012 mflo r2 r2 = Random * MOD
 
0018eefc: 04410002 bgez r2,0x0018ef08 Branch if Random * MOD >= 0
 
0018ef00: 00000000 nop
 
0018ef04: 24427fff addiu r2,r2,0x7fff r2 + 7FFF (makes Random * MOD positive)
 
0018ef08: 000213c3 sra r2,r2,0x0f Random * MOD / 8000h
 
0018ef0c: 0051102a slt r2,r2,r17 r2 = 1 IF Random < chance
 
0018ef10: 38420001 xori r2,r2,0x0001 r2 = 0 IF Random < chance
 
0018ef14: 8fbf0018 lw r31,0x0018(r29)
 
0018ef18: 8fb10014 lw r17,0x0014(r29)
 
0018ef1c: 8fb00010 lw r16,0x0010(r29)
 
0018ef20: 27bd0020 addiu r29,r29,0x0020
 
0018ef24: 03e00008 jr r31
 
0018ef28: 00000000 nop
 

Latest revision as of 03:23, 30 June 2018

Redirect to: