Difference between revisions of "Store New Seed and Lay Eggs"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<font face='Courier New'> 00125a04: 3c058004 lui r5,0x8004 00125a08: 8ca559b8 lw r5,0x59b8(r5) 00125a0c: 3c038004 lui r3,0x8004 00125a10: 8c6359bc lw r3,0x59bc(r3) 0012...")
 
Line 1: Line 1:
<font face='Courier New'>
+
# Update RNG seed depends on current game time,
+
# and calculate party data, such as Birthday, Zodiac sign and Level.
 +
 
 +
# Description
 +
# When you arrive at a location, RNG seed is updated depends on current game time.
 +
# Which means if you arrive in exactly same game time, you can reproduce same things.
 +
# new RNG seed = Milsec * 101 + Seconds * 10 + Minutes + Hours
 +
 
 
  00125a04: 3c058004 lui r5,0x8004
 
  00125a04: 3c058004 lui r5,0x8004
  00125a08: 8ca559b8 lw r5,0x59b8(r5)
+
  00125a08: 8ca559b8 lw r5,0x59b8(r5) r5 = Milsecs (60 counts per 1 sec)
 
  00125a0c: 3c038004 lui r3,0x8004
 
  00125a0c: 3c038004 lui r3,0x8004
  00125a10: 8c6359bc lw r3,0x59bc(r3)
+
  00125a10: 8c6359bc lw r3,0x59bc(r3) r3 = Seconds
 
  00125a14: 27bdffa0 addiu r29,r29,0xffa0
 
  00125a14: 27bdffa0 addiu r29,r29,0xffa0
 
  00125a18: afb50054 sw r21,0x0054(r29)
 
  00125a18: afb50054 sw r21,0x0054(r29)
Line 21: Line 27:
 
  00125a4c: 000420c0 sll r4,r4,0x03
 
  00125a4c: 000420c0 sll r4,r4,0x03
 
  00125a50: 00852021 addu r4,r4,r5
 
  00125a50: 00852021 addu r4,r4,r5
  00125a54: 00042080 sll r4,r4,0x02
+
  00125a54: 00042080 sll r4,r4,0x02 r4 = Milsec * 100
 
  00125a58: 00031080 sll r2,r3,0x02
 
  00125a58: 00031080 sll r2,r3,0x02
 
  00125a5c: 00431021 addu r2,r2,r3
 
  00125a5c: 00431021 addu r2,r2,r3
  00125a60: 00021040 sll r2,r2,0x01
+
  00125a60: 00021040 sll r2,r2,0x01 r2 = Seconds * 10
  00125a64: 00822021 addu r4,r4,r2
+
  00125a64: 00822021 addu r4,r4,r2 r4 = Milsec * 100 + Seconds * 10
 
  00125a68: 3c028004 lui r2,0x8004
 
  00125a68: 3c028004 lui r2,0x8004
  00125a6c: 8c4259c0 lw r2,0x59c0(r2)
+
  00125a6c: 8c4259c0 lw r2,0x59c0(r2) r2 = Minutes
 
  00125a70: 3c038004 lui r3,0x8004
 
  00125a70: 3c038004 lui r3,0x8004
  00125a74: 8c6359c4 lw r3,0x59c4(r3)
+
  00125a74: 8c6359c4 lw r3,0x59c4(r3) r3 = Hours
 
  00125a78: 00822021 addu r4,r4,r2
 
  00125a78: 00822021 addu r4,r4,r2
 
  00125a7c: 00832021 addu r4,r4,r3
 
  00125a7c: 00832021 addu r4,r4,r3
  00125a80: 0c0088c7 jal 0x0002231c
+
  00125a80: 0c0088c7 jal 0x0002231c srand(r4)  (Update RNG seed depends on current game time)
  00125a84: 00852021 addu r4,r4,r5
+
  00125a84: 00852021 addu r4,r4,r5 r4 = Milsec * 101 + Seconds * 10 + Minutes + Hours
  00125a88: 0c0166bc jal 0x00059af0
+
  00125a88: 0c0166bc jal 0x00059af0 Get Party Data Pointer
  00125a8c: 02802021 addu r4,r20,r0
+
  00125a8c: 02802021 addu r4,r20,r0 r4 = 0
  00125a90: 00409021 addu r18,r2,r0
+
  00125a90: 00409021 addu r18,r2,r0 r18 = Unit's Party Data Pointer
  00125a94: 92430001 lbu r3,0x0001(r18)
+
  00125a94: 92430001 lbu r3,0x0001(r18) r3 = Unit's Party ID
  00125a98: 340200ff ori r2,r0,0x00ff
+
  00125a98: 340200ff ori r2,r0,0x00ff r2 = 0xFF
  00125a9c: 10620038 beq r3,r2,0x00125b80
+
  00125a9c: 10620038 beq r3,r2,0x00125b80 Branch if Units Party ID == 0xFF
 
  00125aa0: 00000000 nop
 
  00125aa0: 00000000 nop
  00125aa4: 92420004 lbu r2,0x0004(r18)
+
  00125aa4: 92420004 lbu r2,0x0004(r18) Load Unit's Gender Byte
 
  00125aa8: 00000000 nop
 
  00125aa8: 00000000 nop
 
  00125aac: 30420004 andi r2,r2,0x0004
 
  00125aac: 30420004 andi r2,r2,0x0004
  00125ab0: 10400026 beq r2,r0,0x00125b4c
+
  00125ab0: 10400026 beq r2,r0,0x00125b4c branch if Unit doesn't have Hide Stats Flag
 
  00125ab4: 27a20028 addiu r2,r29,0x0028
 
  00125ab4: 27a20028 addiu r2,r29,0x0028
  00125ab8: 92420005 lbu r2,0x0005(r18)
+
  00125ab8: 92420005 lbu r2,0x0005(r18) Load Unit's Birthday
 
  00125abc: 00000000 nop
 
  00125abc: 00000000 nop
 
  00125ac0: 3050000f andi r16,r2,0x000f
 
  00125ac0: 3050000f andi r16,r2,0x000f
Line 53: Line 59:
 
  00125acc: 00501025 or r2,r2,r16
 
  00125acc: 00501025 or r2,r2,r16
 
  00125ad0: 1600002b bne r16,r0,0x00125b80
 
  00125ad0: 1600002b bne r16,r0,0x00125b80
  00125ad4: a2420005 sb r2,0x0005(r18)
+
  00125ad4: a2420005 sb r2,0x0005(r18) Store Unit's Birthday
 
  00125ad8: 34020020 ori r2,r0,0x0020
 
  00125ad8: 34020020 ori r2,r0,0x0020
  00125adc: a2420004 sb r2,0x0004(r18)
+
  00125adc: a2420004 sb r2,0x0004(r18) Store Unit's Gender Byte as a Monster (0x20)
  00125ae0: 0c03bc6a jal 0x000ef1a8
+
  00125ae0: 0c03bc6a jal 0x000ef1a8 Load Main Variable
 
  00125ae4: 3404002f ori r4,r0,0x002f
 
  00125ae4: 3404002f ori r4,r0,0x002f
 
  00125ae8: 3404002e ori r4,r0,0x002e
 
  00125ae8: 3404002e ori r4,r0,0x002e
  00125aec: 0c03bc6a jal 0x000ef1a8
+
  00125aec: 0c03bc6a jal 0x000ef1a8 Load Main Variable
 
  00125af0: 00409821 addu r19,r2,r0
 
  00125af0: 00409821 addu r19,r2,r0
 
  00125af4: 34100001 ori r16,r0,0x0001
 
  00125af4: 34100001 ori r16,r0,0x0001
Line 80: Line 86:
 
  00125b38: 02228825 or r17,r17,r2
 
  00125b38: 02228825 or r17,r17,r2
 
  00125b3c: 00111203 sra r2,r17,0x08
 
  00125b3c: 00111203 sra r2,r17,0x08
  00125b40: a2510005 sb r17,0x0005(r18)
+
  00125b40: a2510005 sb r17,0x0005(r18) Store Unit's Birthday
 
  00125b44: 080496e0 j 0x00125b80
 
  00125b44: 080496e0 j 0x00125b80
  00125b48: a2420006 sb r2,0x0006(r18)
+
  00125b48: a2420006 sb r2,0x0006(r18) Store Unit's Zodiac sign
  00125b4c: 92430016 lbu r3,0x0016(r18)
+
  00125b4c: 92430016 lbu r3,0x0016(r18) Load Unit's Level
 
  00125b50: 00561021 addu r2,r2,r22
 
  00125b50: 00561021 addu r2,r2,r22
 
  00125b54: a0430000 sb r3,0x0000(r2)
 
  00125b54: a0430000 sb r3,0x0000(r2)
  00125b58: 92440002 lbu r4,0x0002(r18)
+
  00125b58: 92440002 lbu r4,0x0002(r18) Load Unit's Job ID
  00125b5c: 0c0489db jal 0x0012276c
+
  00125b5c: 0c0489db jal 0x0012276c Get job's skillset??
 
  00125b60: 26d60001 addiu r22,r22,0x0001
 
  00125b60: 26d60001 addiu r22,r22,0x0001
 
  00125b64: 2442ff50 addiu r2,r2,0xff50
 
  00125b64: 2442ff50 addiu r2,r2,0xff50
Line 102: Line 108:
 
  00125b90: 12a0004f beq r21,r0,0x00125cd0
 
  00125b90: 12a0004f beq r21,r0,0x00125cd0
 
  00125b94: 00000000 nop
 
  00125b94: 00000000 nop
  00125b98: 0c0088c3 jal 0x0002230c
+
  00125b98: 0c0088c3 jal 0x0002230c Random Number Generator
 
  00125b9c: 00000000 nop
 
  00125b9c: 00000000 nop
  00125ba0: 305100ff andi r17,r2,0x00ff
+
  00125ba0: 305100ff andi r17,r2,0x00ff rand(0..256)
 
  00125ba4: 2a220006 slti r2,r17,0x0006
 
  00125ba4: 2a220006 slti r2,r17,0x0006
  00125ba8: 14400005 bne r2,r0,0x00125bc0
+
  00125ba8: 14400005 bne r2,r0,0x00125bc0 Branch if Random < 6
 
  00125bac: 34100003 ori r16,r0,0x0003
 
  00125bac: 34100003 ori r16,r0,0x0003
 
  00125bb0: 2a220010 slti r2,r17,0x0010
 
  00125bb0: 2a220010 slti r2,r17,0x0010
  00125bb4: 14400002 bne r2,r0,0x00125bc0
+
  00125bb4: 14400002 bne r2,r0,0x00125bc0 Branch else if Random < 16
 
  00125bb8: 34100002 ori r16,r0,0x0002
 
  00125bb8: 34100002 ori r16,r0,0x0002
 
  00125bbc: 2a300020 slti r16,r17,0x0020
 
  00125bbc: 2a300020 slti r16,r17,0x0020
  00125bc0: 12000043 beq r16,r0,0x00125cd0
+
  00125bc0: 12000043 beq r16,r0,0x00125cd0 Branch else if Random < 32
 
  00125bc4: 00000000 nop
 
  00125bc4: 00000000 nop
  00125bc8: 0c0088c3 jal 0x0002230c
+
  00125bc8: 0c0088c3 jal 0x0002230c Random Number Generator
 
  00125bcc: 00000000 nop
 
  00125bcc: 00000000 nop
 
  00125bd0: 0055001a div r2,r21
 
  00125bd0: 0055001a div r2,r21
Line 121: Line 127:
 
  00125bdc: 03b51021 addu r2,r29,r21
 
  00125bdc: 03b51021 addu r2,r29,r21
 
  00125be0: 90440010 lbu r4,0x0010(r2)
 
  00125be0: 90440010 lbu r4,0x0010(r2)
  00125be4: 0c0166bc jal 0x00059af0
+
  00125be4: 0c0166bc jal 0x00059af0 Get Party Data Pointer
 
  00125be8: 00000000 nop
 
  00125be8: 00000000 nop
  00125bec: 90420002 lbu r2,0x0002(r2)
+
  00125bec: 90420002 lbu r2,0x0002(r2) Load Unit's Job ID
 
  00125bf0: 00000000 nop
 
  00125bf0: 00000000 nop
 
  00125bf4: 2442ffa2 addiu r2,r2,0xffa2
 
  00125bf4: 2442ffa2 addiu r2,r2,0xffa2
Line 131: Line 137:
 
  00125c04: 00220821 addu r1,r1,r2
 
  00125c04: 00220821 addu r1,r1,r2
 
  00125c08: 9030debc lbu r16,-0x2144(r1)
 
  00125c08: 9030debc lbu r16,-0x2144(r1)
  00125c0c: 0c0088c3 jal 0x0002230c
+
  00125c0c: 0c0088c3 jal 0x0002230c Random Number Generator
 
  00125c10: 00000000 nop
 
  00125c10: 00000000 nop
 
  00125c14: 2603ffa2 addiu r3,r16,0xffa2
 
  00125c14: 2603ffa2 addiu r3,r16,0xffa2
Line 152: Line 158:
 
  00125c58: 8c42d8c8 lw r2,-0x2738(r2)
 
  00125c58: 8c42d8c8 lw r2,-0x2738(r2)
 
  00125c5c: 8e510000 lw r17,0x0000(r18)
 
  00125c5c: 8e510000 lw r17,0x0000(r18)
  00125c60: 0c0088c3 jal 0x0002230c
+
  00125c60: 0c0088c3 jal 0x0002230c Random Number Generator
 
  00125c64: ae420000 sw r2,0x0000(r18)
 
  00125c64: ae420000 sw r2,0x0000(r18)
  00125c68: 04410002 bgez r2,0x00125c74
+
  00125c68: 04410002 bgez r2,0x00125c74 Branch if Random is positive
 
  00125c6c: 00403021 addu r6,r2,r0
 
  00125c6c: 00403021 addu r6,r2,r0
 
  00125c70: 24460003 addiu r6,r2,0x0003
 
  00125c70: 24460003 addiu r6,r2,0x0003
Line 168: Line 174:
 
  00125c98: 1202000d beq r16,r2,0x00125cd0
 
  00125c98: 1202000d beq r16,r2,0x00125cd0
 
  00125c9c: ae510000 sw r17,0x0000(r18)
 
  00125c9c: ae510000 sw r17,0x0000(r18)
  00125ca0: 0c0166bc jal 0x00059af0
+
  00125ca0: 0c0166bc jal 0x00059af0 Get Party Data Pointer
 
  00125ca4: 02002021 addu r4,r16,r0
 
  00125ca4: 02002021 addu r4,r16,r0
  00125ca8: 0c0088c3 jal 0x0002230c
+
  00125ca8: 0c0088c3 jal 0x0002230c Random Number Generator
  00125cac: 00409021 addu r18,r2,r0
+
  00125cac: 00409021 addu r18,r2,r0 r18 = Unit's Party Data Pointer
 
  00125cb0: 0056001a div r2,r22
 
  00125cb0: 0056001a div r2,r22
 
  00125cb4: 00001810 mfhi r3
 
  00125cb4: 00001810 mfhi r3
Line 177: Line 183:
 
  00125cbc: 03a31021 addu r2,r29,r3
 
  00125cbc: 03a31021 addu r2,r29,r3
 
  00125cc0: 90450028 lbu r5,0x0028(r2)
 
  00125cc0: 90450028 lbu r5,0x0028(r2)
  00125cc4: 02402021 addu r4,r18,r0
+
  00125cc4: 02402021 addu r4,r18,r0 r4 = Unit's Party Data Pointer
  00125cc8: 0c01763f jal 0x0005d8fc
+
  00125cc8: 0c01763f jal 0x0005d8fc Level Unit to Specific Level
 
  00125ccc: 24a5ffff addiu r5,r5,0xffff
 
  00125ccc: 24a5ffff addiu r5,r5,0xffff
 
  00125cd0: 8fbf005c lw r31,0x005c(r29)
 
  00125cd0: 8fbf005c lw r31,0x005c(r29)
Line 191: Line 197:
 
  00125cf4: 03e00008 jr r31
 
  00125cf4: 03e00008 jr r31
 
  00125cf8: 00000000 nop
 
  00125cf8: 00000000 nop
</font>
 

Revision as of 11:16, 3 February 2016

# Update RNG seed depends on current game time, 
# and calculate party data, such as Birthday, Zodiac sign and Level.
# Description
# When you arrive at a location, RNG seed is updated depends on current game time.
# Which means if you arrive in exactly same game time, you can reproduce same things.
# new RNG seed = Milsec * 101 + Seconds * 10 + Minutes + Hours
00125a04: 3c058004 lui r5,0x8004
00125a08: 8ca559b8 lw r5,0x59b8(r5)		r5 = Milsecs (60 counts per 1 sec)
00125a0c: 3c038004 lui r3,0x8004
00125a10: 8c6359bc lw r3,0x59bc(r3)		r3 = Seconds
00125a14: 27bdffa0 addiu r29,r29,0xffa0
00125a18: afb50054 sw r21,0x0054(r29)
00125a1c: 0000a821 addu r21,r0,r0
00125a20: afb60058 sw r22,0x0058(r29)
00125a24: 0000b021 addu r22,r0,r0
00125a28: afb40050 sw r20,0x0050(r29)
00125a2c: 0000a021 addu r20,r0,r0
00125a30: afbf005c sw r31,0x005c(r29)
00125a34: afb3004c sw r19,0x004c(r29)
00125a38: afb20048 sw r18,0x0048(r29)
00125a3c: afb10044 sw r17,0x0044(r29)
00125a40: afb00040 sw r16,0x0040(r29)
00125a44: 00052040 sll r4,r5,0x01
00125a48: 00852021 addu r4,r4,r5
00125a4c: 000420c0 sll r4,r4,0x03
00125a50: 00852021 addu r4,r4,r5
00125a54: 00042080 sll r4,r4,0x02		r4 = Milsec * 100
00125a58: 00031080 sll r2,r3,0x02
00125a5c: 00431021 addu r2,r2,r3
00125a60: 00021040 sll r2,r2,0x01		r2 = Seconds * 10
00125a64: 00822021 addu r4,r4,r2		r4 = Milsec * 100 + Seconds * 10
00125a68: 3c028004 lui r2,0x8004
00125a6c: 8c4259c0 lw r2,0x59c0(r2)		r2 = Minutes
00125a70: 3c038004 lui r3,0x8004
00125a74: 8c6359c4 lw r3,0x59c4(r3)		r3 = Hours
00125a78: 00822021 addu r4,r4,r2
00125a7c: 00832021 addu r4,r4,r3
00125a80: 0c0088c7 jal 0x0002231c		srand(r4)  (Update RNG seed depends on current game time)
00125a84: 00852021 addu r4,r4,r5		r4 = Milsec * 101 + Seconds * 10 + Minutes + Hours
00125a88: 0c0166bc jal 0x00059af0		Get Party Data Pointer
00125a8c: 02802021 addu r4,r20,r0		r4 = 0
00125a90: 00409021 addu r18,r2,r0		r18 = Unit's Party Data Pointer
00125a94: 92430001 lbu r3,0x0001(r18)		r3 = Unit's Party ID
00125a98: 340200ff ori r2,r0,0x00ff		r2 = 0xFF
00125a9c: 10620038 beq r3,r2,0x00125b80		Branch if Units Party ID == 0xFF
00125aa0: 00000000 nop
00125aa4: 92420004 lbu r2,0x0004(r18)		Load Unit's Gender Byte
00125aa8: 00000000 nop
00125aac: 30420004 andi r2,r2,0x0004
00125ab0: 10400026 beq r2,r0,0x00125b4c		branch if Unit doesn't have Hide Stats Flag
00125ab4: 27a20028 addiu r2,r29,0x0028
00125ab8: 92420005 lbu r2,0x0005(r18)		Load Unit's Birthday
00125abc: 00000000 nop
00125ac0: 3050000f andi r16,r2,0x000f
00125ac4: 2610ffff addiu r16,r16,0xffff
00125ac8: 304200f0 andi r2,r2,0x00f0
00125acc: 00501025 or r2,r2,r16
00125ad0: 1600002b bne r16,r0,0x00125b80
00125ad4: a2420005 sb r2,0x0005(r18)		Store Unit's Birthday
00125ad8: 34020020 ori r2,r0,0x0020
00125adc: a2420004 sb r2,0x0004(r18)		Store Unit's Gender Byte as a Monster (0x20)
00125ae0: 0c03bc6a jal 0x000ef1a8		Load Main Variable
00125ae4: 3404002f ori r4,r0,0x002f
00125ae8: 3404002e ori r4,r0,0x002e
00125aec: 0c03bc6a jal 0x000ef1a8		Load Main Variable
00125af0: 00409821 addu r19,r2,r0
00125af4: 34100001 ori r16,r0,0x0001
00125af8: 00402021 addu r4,r2,r0
00125afc: 0204102a slt r2,r16,r4
00125b00: 10400009 beq r2,r0,0x00125b28
00125b04: 00008821 addu r17,r0,r0
00125b08: 3c018019 lui r1,0x8019
00125b0c: 00300821 addu r1,r1,r16
00125b10: 9022deac lbu r2,-0x2154(r1)
00125b14: 26100001 addiu r16,r16,0x0001
00125b18: 02228821 addu r17,r17,r2
00125b1c: 0204102a slt r2,r16,r4
00125b20: 1440fff9 bne r2,r0,0x00125b08
00125b24: 00000000 nop
00125b28: 02338821 addu r17,r17,r19
00125b2c: 0c049664 jal 0x00125990
00125b30: 02602821 addu r5,r19,r0
00125b34: 00021300 sll r2,r2,0x0c
00125b38: 02228825 or r17,r17,r2
00125b3c: 00111203 sra r2,r17,0x08
00125b40: a2510005 sb r17,0x0005(r18)		Store Unit's Birthday
00125b44: 080496e0 j 0x00125b80
00125b48: a2420006 sb r2,0x0006(r18)		Store Unit's Zodiac sign
00125b4c: 92430016 lbu r3,0x0016(r18)		Load Unit's Level
00125b50: 00561021 addu r2,r2,r22
00125b54: a0430000 sb r3,0x0000(r2)
00125b58: 92440002 lbu r4,0x0002(r18)		Load Unit's Job ID
00125b5c: 0c0489db jal 0x0012276c		Get job's skillset??
00125b60: 26d60001 addiu r22,r22,0x0001
00125b64: 2442ff50 addiu r2,r2,0xff50
00125b68: 2c420030 sltiu r2,r2,0x0030
00125b6c: 10400004 beq r2,r0,0x00125b80
00125b70: 27a20010 addiu r2,r29,0x0010
00125b74: 00551021 addu r2,r2,r21
00125b78: a0540000 sb r20,0x0000(r2)
00125b7c: 26b50001 addiu r21,r21,0x0001
00125b80: 26940001 addiu r20,r20,0x0001
00125b84: 2a820014 slti r2,r20,0x0014
00125b88: 1440ffbf bne r2,r0,0x00125a88
00125b8c: 00000000 nop
00125b90: 12a0004f beq r21,r0,0x00125cd0
00125b94: 00000000 nop
00125b98: 0c0088c3 jal 0x0002230c		Random Number Generator
00125b9c: 00000000 nop
00125ba0: 305100ff andi r17,r2,0x00ff		rand(0..256)
00125ba4: 2a220006 slti r2,r17,0x0006
00125ba8: 14400005 bne r2,r0,0x00125bc0		Branch if Random < 6
00125bac: 34100003 ori r16,r0,0x0003
00125bb0: 2a220010 slti r2,r17,0x0010
00125bb4: 14400002 bne r2,r0,0x00125bc0		Branch else if Random < 16
00125bb8: 34100002 ori r16,r0,0x0002
00125bbc: 2a300020 slti r16,r17,0x0020
00125bc0: 12000043 beq r16,r0,0x00125cd0	Branch else if Random < 32
00125bc4: 00000000 nop
00125bc8: 0c0088c3 jal 0x0002230c		Random Number Generator
00125bcc: 00000000 nop
00125bd0: 0055001a div r2,r21
00125bd4: 0000a810 mfhi r21
00125bd8: 00000000 nop
00125bdc: 03b51021 addu r2,r29,r21
00125be0: 90440010 lbu r4,0x0010(r2)
00125be4: 0c0166bc jal 0x00059af0		Get Party Data Pointer
00125be8: 00000000 nop
00125bec: 90420002 lbu r2,0x0002(r2)		Load Unit's Job ID
00125bf0: 00000000 nop
00125bf4: 2442ffa2 addiu r2,r2,0xffa2
00125bf8: 00021080 sll r2,r2,0x02
00125bfc: 00501021 addu r2,r2,r16
00125c00: 3c018019 lui r1,0x8019
00125c04: 00220821 addu r1,r1,r2
00125c08: 9030debc lbu r16,-0x2144(r1)
00125c0c: 0c0088c3 jal 0x0002230c		Random Number Generator
00125c10: 00000000 nop
00125c14: 2603ffa2 addiu r3,r16,0xffa2
00125c18: 00031880 sll r3,r3,0x02
00125c1c: 3c018019 lui r1,0x8019
00125c20: 00230821 addu r1,r1,r3
00125c24: 9023debc lbu r3,-0x2144(r1)
00125c28: 00000000 nop
00125c2c: 0043001a div r2,r3
00125c30: 00001810 mfhi r3
00125c34: 00000000 nop
00125c38: 24740001 addiu r20,r3,0x0001
00125c3c: 2a820002 slti r2,r20,0x0002
00125c40: 10400002 beq r2,r0,0x00125c4c
00125c44: 00000000 nop
00125c48: 34140002 ori r20,r0,0x0002
00125c4c: 3c12801d lui r18,0x801d
00125c50: 2652d8c4 addiu r18,r18,0xd8c4
00125c54: 3c02801d lui r2,0x801d
00125c58: 8c42d8c8 lw r2,-0x2738(r2)
00125c5c: 8e510000 lw r17,0x0000(r18)
00125c60: 0c0088c3 jal 0x0002230c		Random Number Generator
00125c64: ae420000 sw r2,0x0000(r18)
00125c68: 04410002 bgez r2,0x00125c74		Branch if Random is positive
00125c6c: 00403021 addu r6,r2,r0
00125c70: 24460003 addiu r6,r2,0x0003
00125c74: 02002021 addu r4,r16,r0
00125c78: 00142900 sll r5,r20,0x04
00125c7c: 02852821 addu r5,r20,r5
00125c80: 00063083 sra r6,r6,0x02
00125c84: 00063080 sll r6,r6,0x02
00125c88: 0c016786 jal 0x00059e18
00125c8c: 00463023 subu r6,r2,r6
00125c90: 00408021 addu r16,r2,r0
00125c94: 2402ffff addiu r2,r0,0xffff
00125c98: 1202000d beq r16,r2,0x00125cd0
00125c9c: ae510000 sw r17,0x0000(r18)
00125ca0: 0c0166bc jal 0x00059af0		Get Party Data Pointer
00125ca4: 02002021 addu r4,r16,r0
00125ca8: 0c0088c3 jal 0x0002230c		Random Number Generator
00125cac: 00409021 addu r18,r2,r0		r18 = Unit's Party Data Pointer
00125cb0: 0056001a div r2,r22
00125cb4: 00001810 mfhi r3
00125cb8: 00000000 nop
00125cbc: 03a31021 addu r2,r29,r3
00125cc0: 90450028 lbu r5,0x0028(r2)
00125cc4: 02402021 addu r4,r18,r0		r4 = Unit's Party Data Pointer
00125cc8: 0c01763f jal 0x0005d8fc		Level Unit to Specific Level
00125ccc: 24a5ffff addiu r5,r5,0xffff
00125cd0: 8fbf005c lw r31,0x005c(r29)
00125cd4: 8fb60058 lw r22,0x0058(r29)
00125cd8: 8fb50054 lw r21,0x0054(r29)
00125cdc: 8fb40050 lw r20,0x0050(r29)
00125ce0: 8fb3004c lw r19,0x004c(r29)
00125ce4: 8fb20048 lw r18,0x0048(r29)
00125ce8: 8fb10044 lw r17,0x0044(r29)
00125cec: 8fb00040 lw r16,0x0040(r29)
00125cf0: 27bd0060 addiu r29,r29,0x0060
00125cf4: 03e00008 jr r31
00125cf8: 00000000 nop