Difference between revisions of "Unit Battle Initialization"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Line 88: Line 88:
  
 
  00059b78: [[Unit Initialization]]
 
  00059b78: [[Unit Initialization]]
  0017f9a0: 0017f8a0
+
  0017f9a0: [[Big ENTD unit loading routine]]
  0018c7d8: 0018c758
+
  0018c7d8: [[some kind of ENTD/Unit manipulation]]

Revision as of 02:59, 28 April 2017

Unit Battle Initialization
0005a9b4: 27bdffe0 addiu r29,r29,0xffe0
0005a9b8: afb00010 sw r16,0x0010(r29)
0005a9bc: 00808021 addu r16,r4,r0		r16 = Unit's Data Pointer
0005a9c0: afb10014 sw r17,0x0014(r29)
0005a9c4: afb20018 sw r18,0x0018(r29)
0005a9c8: 00e09021 addu r18,r7,r0		r18 = r7
0005a9cc: 34020082 ori r2,r0,0x0082		r2 = 0x82
0005a9d0: afbf001c sw r31,0x001c(r29)
0005a9d4: 3c018006 lui r1,0x8006
0005a9d8: ac266200 sw r6,0x6200(r1)		Store Battle Initialization Flag? (1 in 0x59b18)
0005a9dc: 12420008 beq r18,r2,0x0005aa00	Branch if r18 = 0x82 (set in one part of code, rest are 0)
0005a9e0: 00a08821 addu r17,r5,r0		r17 = ENTD Data Pointer
0005a9e4: 0c0177eb jal 0x0005dfac		Initialize Some Unit Data
0005a9e8: 00000000 nop
0005a9ec: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005a9f0: 0c016b07 jal 0x0005ac1c		ENTD Data Calculation
0005a9f4: 02202821 addu r5,r17,r0		r5 = ENTD Data Pointer
0005a9f8: 1440003a bne r2,r0,0x0005aae4		Branch if ENTD Data Calculation failed
0005a9fc: 2402ffff addiu r2,r0,0xffff		r2 = FFFF
0005aa00: 1640000f bne r18,r0,0x0005aa40	Branch if r18 = 0
0005aa04: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005aa08: 92220001 lbu r2,0x0001(r17)		Load ENTD's Gender Byte
0005aa0c: 00000000 nop
0005aa10: 30420008 andi r2,r2,0x0008
0005aa14: 14400033 bne r2,r0,0x 0005aae4		Branch if Unit has Load Formation
0005aa18: 00001021 addu r2,r0,r0		r2 = 0
0005aa1c: 92220000 lbu r2,0x0000(r17)		Load ENTD Sprite Set
0005aa20: 00000000 nop
0005aa24: 2c420004 sltiu r2,r2,0x0004
0005aa28: 1040 0005 beq r2,r0,0x0005aa40		Branch if Unit isn't Ramza
0005aa2c: 00000000 nop
0005aa30: 92220004 lbu r2,0x0004(r17)		Load ENTD Birth Month
0005aa34: 00000000 nop
0005aa38: 1040002a beq r2,r0,0x0005aae4		Branch if Birth Month = 0
0005aa3c: 00001021 addu r2,r0,r0		r2 = 0
0005aa40: 0c016cad jal 0x0005b2b4		Calculate ENTD Unit Jobs
0005aa44: 02202821 addu r5,r17,r0		r5 = ENTD Data Pointer
0005aa48: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005aa4c: 0c016e9c jal 0x0005ba70		Calculate Unit's Abilities
0005aa50: 02202821 addu r5,r17,r0		r5 = ENTD Data Pointer
0005aa54: 0c016de8 jal 0x 0005b7a0		Enable Unit's R/S/M Flags
0005aa58: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005aa5c: 0c016900 jal 0x0005a400		Prep for Generating Base Raw Stats
0005aa60: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005aa64: 0c016948 jal 0x0005a520		Transfer Job's Growths/Mults to Unit
0005aa68: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005aa6c: 92030002 lbu r3,0x0002(r16)		Load Unit's Party ID
0005aa70: 340200ff ori r2,r0,0x00ff		r2 = FF
0005aa74: 14620003 bne r3,r2,0x0005aa84		Branch if Unit is in the party
0005aa78: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005aa7c: 340200fe ori r2,r0,0x00fe		r2 = FE
0005aa80: a2020002 sb r2,0x0002(r16)		Store Unit's Party ID = FE (just for leveling up)
0005aa84: 0c016e20 jal 0x0005b880		Calculate Actual Stats
0005aa88: 00002821 addu r5,r0,r0		r5 = 0 (Level UP)
0005aa8c: 92030002 lbu r3,0x0002(r16)		Load Unit's Party ID
0005aa90: 340200fe ori r2,r0,0x00fe		r2 = FE
0005aa94: 14620002 bne r3,r2,0x 0005aaa0		Branch if Unit is in the party
0005aa98: 340200ff ori r2,r0,0x00ff		r2 = FF
0005aa9c: a2020002 sb r2,0x0002(r16)		Store Unit's Party ID = FF
0005aaa0: 0c01709f jal 0x 0005c27c		Equippable Item Setting (Support/Female-only)
0005aaa4: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005aaa8: 34020082 ori r2,r0,0x0082		r2 = 0x82
0005aaac: 12420008 beq r18,r2,0x0005aad0	Branch if r18 = 0x82
0005aab0: 00000000 nop
0005aab4: 92020002 lbu r2,0x0002(r16)		Load Unit's Party ID
0005aab8: 00000000 nop
0005aabc: 2c420014 sltiu r2,r2,0x0014
0005aac0: 14400003 bne r2,r0,0x 0005aad0		Branch if Unit is in the party/ID is legal
0005aac4: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005aac8: 0c016f7c jal 0x0005bdf0		Calculate/Store ENTD Unit Equipment
0005aacc: 02202821 addu r5,r17,r0		r5 = ENTD Pointer
0005aad0: 0c016ac0 jal 0x0005ab00		Equipment/Move/Jump +X/Name Storing/Generation
0005aad4: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005aad8: 0c016ad2 jal 0x0005ab48		Store Ramza's Name/Birthday/Zodiac
0005aadc: 02002021 addu r4,r16,r0		r4 = Unit's Data Pointer
0005aae0: 00001021 addu r2,r0,r0		r2 = 0 (Success)
0005aae4: 8fbf001c lw r31,0x001c(r29)
0005aae8: 8fb20018 lw r18,0x0018(r29)
0005aaec: 8fb10014 lw r17,0x0014(r29)
0005aaf0: 8fb00010 lw r16,0x0010(r29)
0005aaf4: 27bd0020 addiu r29,r29,0x0020
0005aaf8: 03e00008 jr r31
0005aafc: 00000000 nop


Return Locations

00059b78: Unit Initialization
0017f9a0: Big ENTD unit loading routine
0018c7d8: some kind of ENTD/Unit manipulation