Generate Unit's Base Raw Stats

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Generate Unit's Base Raw Stats
0005a448: 27bdffd0 addiu r29,r29,0xffd0
0005a44c: afb40020 sw r20,0x0020(r29)
0005a450: 00a0a021 addu r20,r5,r0		r20 = Gender Value
0005a454: afb20018 sw r18,0x0018(r29)
0005a458: 00009021 addu r18,r0,r0		Counter = 0
0005a45c: afb50024 sw r21,0x0024(r29)
0005a460: 3c158006 lui r21,0x8006
0005a464: 26b5e93c addiu r21,r21,0xe93c		r21 = Base Raw Random Mod Pointer
0005a468: afb10014 sw r17,0x0014(r29)
0005a46c: 00808821 addu r17,r4,r0		r17 = Unit's Data Pointer
0005a470: 3c038006 lui r3,0x8006
0005a474: 2463e90c addiu r3,r3,0xe90c		r3 = Base Raw Stat Pointer
0005a478: 00141040 sll r2,r20,0x01		Gender Value * 2
0005a47c: 00541021 addu r2,r2,r20		Gender Value * 3
0005a480: 00021080 sll r2,r2,0x02		Gender Value * 12
0005a484: afb3001c sw r19,0x001c(r29)
0005a488: 00439821 addu r19,r2,r3
0005a48c: afbf0028 sw r31,0x0028(r29)
0005a490: afb00010 sw r16,0x0010(r29)
0005a494: 92700000 lbu r16,0x0000(r19)		Load Raw Stat Mod
0005a498: 0c0088c3 jal 0x0002230c		Random Number Generator
0005a49c: 00108380 sll r16,r16,0x0e		Mod * 16384
0005a4a0: 00141880 sll r3,r20,0x02		Gender Value * 4
0005a4a4: 00741821 addu r3,r3,r20		Gender Value * 5
0005a4a8: 00751821 addu r3,r3,r21
0005a4ac: 00721821 addu r3,r3,r18
0005a4b0: 90630000 lbu r3,0x0000(r3)		Load Raw Random Mod
0005a4b4: 00000000 nop
0005a4b8: 00430018 mult r2,r3			Random * Mod
0005a4bc: 26730001 addiu r19,r19,0x0001		Raw Pointer ++
0005a4c0: 26520001 addiu r18,r18,0x0001		Counter ++
0005a4c4: 00001012 mflo r2			r2 = Random * Mod
0005a4c8: 00021fc2 srl r3,r2,0x1f
0005a4cc: 00431021 addu r2,r2,r3
0005a4d0: 00021043 sra r2,r2,0x01		Mod Bonus = rand(0..Mod*16384 - 1)
0005a4d4: 02028021 addu r16,r16,r2		Base Raw = Raw + Mod Bonus
0005a4d8: 00101202 srl r2,r16,0x08		Base Raw / 256
0005a4dc: a2300000 sb r16,0x0000(r17)		Store Raw Stat Byte 1
0005a4e0: 00108403 sra r16,r16,0x10		Base Raw / 65536
0005a4e4: a2220001 sb r2,0x0001(r17)		Store Raw Stat Byte 2
0005a4e8: a2300002 sb r16,0x0002(r17)		Store Raw Stat Byte 3
0005a4ec: 2a420005 slti r2,r18,0x0005
0005a4f0: 1440ffe8 bne r2,r0,0x0005a494		Branch if Counter < 5
0005a4f4: 26310003 addiu r17,r17,0x0003		Unit's Raw Stat Pointer ++
0005a4f8: 8fbf0028 lw r31,0x0028(r29)
0005a4fc: 8fb50024 lw r21,0x0024(r29)
0005a500: 8fb40020 lw r20,0x0020(r29)
0005a504: 8fb3001c lw r19,0x001c(r29)
0005a508: 8fb20018 lw r18,0x0018(r29)
0005a50c: 8fb10014 lw r17,0x0014(r29)
0005a510: 8fb00010 lw r16,0x0010(r29)
0005a514: 27bd0030 addiu r29,r29,0x0030
0005a518: 03e00008 jr r31
0005a51c: 00000000 nop


Return Locations

0005a3e8:  Generate Unit's Base Raw Stats Prep
0005a430:  Prep for Generating Base Raw Stats