Create Monster Egg

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Create Monster Egg
00059e18: 27bdffd8 addiu r29,r29,0xffd8
00059e1c: afb3001c sw r19,0x001c(r29)
00059e20: 00809821 addu r19,r4,r0		r19 = Monster Job ID
00059e24: afb00010 sw r16,0x0010(r29)
00059e28: 00a08021 addu r16,r5,r0		r16 = Egg Mod (used as birthday)
00059e2c: afb40020 sw r20,0x0020(r29)
00059e30: 00c0a021 addu r20,r6,r0		r20 = Random (rand(0..3))
00059e34: 34040003 ori r4,r0,0x0003		Unit Type = Monster
00059e38: afbf0024 sw r31,0x0024(r29)
00059e3c: afb20018 sw r18,0x0018(r29)
00059e40: 0c0167b5 jal 0x00059ed4		Find Empty Party Slot and Generate  Unit
00059e44: afb10014 sw r17,0x0014(r29)
00059e48: 00409021 addu r18,r2,r0		r18 = Party ID
00059e4c: 2402ffff addiu r2,r0,0xffff
00059e50: 12420017 beq r18,r2,0x00059eb0	Branch if there is no space left
00059e54: 00000000 nop
00059e58: 0c0166bc jal 0x00059af0		Get Party Data Pointer
00059e5c: 02402021 addu r4,r18,r0		r4 = Party ID
00059e60: 00408821 addu r17,r2,r0		r17 = Party Data Pointer
00059e64: 92220004 lbu r2,0x0004(r17)		Load Party Gender Byte
00059e68: a2330002 sb r19,0x0002(r17)		Store Job ID
00059e6c: a23400d2 sb r20,0x00d2(r17)		Store ? = Random
00059e70: 34420004 ori r2,r2,0x0004
00059e74: a2220004 sb r2,0x0004(r17)		Store Gender with ??? Stats (Egg) Enabled
00059e78: 3202ffff andi r2,r16,0xffff
00059e7c: 2c42016e sltiu r2,r2,0x016e
00059e80: 14400002 bne r2,r0,0x00059e8c		Branch if Egg Mod < 0x16e
00059e84: 00000000 nop
00059e88: 34100001 ori r16,r0,0x0001		r16 = 1
00059e8c: 0c017976 jal 0x0005e5d8		Calculate Zodiac Symbol
00059e90: 3204ffff andi r4,r16,0xffff		r4 = Egg Mod
00059e94: 00022100 sll r4,r2,0x04		Zodiac * 16
00059e98: 02401021 addu r2,r18,r0		r2 = Party ID
00059e9c: 32030100 andi r3,r16,0x0100		Egg Mod High Bit (not needed; just generic date code)
00059ea0: 00031a02 srl r3,r3,0x08		High Bit / 256
00059ea4: 00641821 addu r3,r3,r4		High Bit + Zodiac
00059ea8: a2300005 sb r16,0x0005(r17)		Store Birthday = Egg Mod
00059eac: a2230006 sb r3,0x0006(r17)		Store Zodiac (useless?)
00059eb0: 8fbf0024 lw r31,0x0024(r29)
00059eb4: 8fb40020 lw r20,0x0020(r29)
00059eb8: 8fb3001c lw r19,0x001c(r29)
00059ebc: 8fb20018 lw r18,0x0018(r29)
00059ec0: 8fb10014 lw r17,0x0014(r29)
00059ec4: 8fb00010 lw r16,0x0010(r29)
00059ec8: 27bd0028 addiu r29,r29,0x0028
00059ecc: 03e00008 jr r31
00059ed0: 00000000 nop

Return Locations

WORLD.BIN
80125c88 - Store New Seed and Lay Eggs