Equipment Stat Setting

From Final Fantasy Hacktics Wiki
Revision as of 20:45, 21 March 2022 by Orkney (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Equipment Stat Setting

Parameters : r4 = Unit Data pointer

This routine set Unit's 0x3c to 0x46 data based on Equipped item's data (Equipped Item ID come from Unit 0x1c to 0x20)
----------------------------------------------------------------------------------------------------------------
0005c398: 27bdffe8 addiu r29,r29,-0x0018    |
0005c39c: afb00010 sw r16,0x0010(r29)       |
0005c3a0: 00808021 addu r16,r4,r0           |r16 = Unit data pointer
0005c3a4: 2604003c addiu r4,r16,0x003c      |r4 = Unit's WP1 data pointer
0005c3a8: afbf0014 sw r31,0x0014(r29)       |
0005c3ac: 0c017991 jal 0x0005e644           |-->Data_Nullifying Nullify data from Unit 0x3c (Wp1) to 0x46 (LH shield M-Ev)
0005c3b0: 3405000b ori r5,r0,0x000b         |r5 = 0x0b
0005c3b4: 92030003 lbu r3,0x0003(r16)       |r3 = Unit's Job ID
0005c3b8: 00000000 nop                      |
0005c3bc: 00031040 sll r2,r3,0x01           |Job ID * 2
0005c3c0: 00431021 addu r2,r2,r3            |Job ID * 3
0005c3c4: 3c038006 lui r3,0x8006            |
0005c3c8: 8c636194 lw r3,0x6194(r3)         |r3 = Job Data Pointer
0005c3cc: 00021100 sll r2,r2,0x04           |r2 = Unit's Job ID * 0x30 (Job Offset in Job data)
0005c3d0: 00431021 addu r2,r2,r3            |r2 = Unit's Job data pointer
0005c3d4: 90430019 lbu r3,0x0019(r2)        |r3 = Job 's C-Ev
0005c3d8: 92020006 lbu r2,0x0006(r16)       |r2 = Unit's Gender
0005c3dc: 00000000 nop                      |
0005c3e0: 30420020 andi r2,r2,0x0020        |r2 = 0x20 If Unit is a monster
0005c3e4: 14400073 bne r2,r0,0x0005c5b4     #If Unit is not a monster /Else Branch to  END
0005c3e8: a2030043 sb r3,0x0043(r16)        |Store Job C-Ev in Unit C-ev
0005c3ec: 9202001c lbu r2,0x001c(r16)           |r2 = Unit's Accessory ID
0005c3f0: 00000000 nop                          |
0005c3f4: 00021840 sll r3,r2,0x01               |Accessory ID * 2
0005c3f8: 00621821 addu r3,r3,r2                |Accessory ID * 3
0005c3fc: 00031880 sll r3,r3,0x02               |Accessory ID * 0x0c (Item data size = Item offset in Item data table)
0005c400: 3c018006 lui r1,0x8006                |
0005c404: 00230821 addu r1,r1,r3                |r1 = 0x80060000 + Unit's Accessory offset
0005c408: 90222ebb lbu r2,0x2ebb(r1)            |r2 = Unit's Accessory Item Type flags
0005c40c: 3c048006 lui r4,0x8006                |
0005c410: 24842eb8 addiu r4,r4,0x2eb8           |r4 = Start of Item data Table
0005c414: 30420008 andi r2,r2,0x0008            |r2 = 0x08 if Unit's Accessory has his Accessory flag checked
0005c418: 1040000e beq r2,r0,0x0005c454         #If Unit's Accessory is valid (Second Table will be valid) /Else Skip Accessory section
0005c41c: 00000000 nop                              |
0005c420: 3c018006 lui r1,0x8006                    |
0005c424: 00230821 addu r1,r1,r3                    |r1 = 0x80060000 + Unit's Accessory offset
0005c428: 90222ebc lbu r2,0x2ebc(r1)                |r2 = Unit's Accessory Second Table ID
0005c42c: 3c038006 lui r3,0x8006                    |
0005c430: 24633f58 addiu r3,r3,0x3f58               |r3 = 0x80063f58
0005c434: 00021040 sll r2,r2,0x01                   |r2 Unit's Accessory Second Table ID *2
0005c438: 00431021 addu r2,r2,r3                    |r3 = Unit's Accessory Second Table data pointer
0005c43c: 90430000 lbu r3,0x0000(r2)                |r2 = Unit's Accessory P-Ev
0005c440: 00000000 nop                              |
0005c444: a2030040 sb r3,0x0040(r16)                |Store Unit's Accessory P-Ev in Unit's 0x40 (Accessory P-Ev)
0005c448: 90420001 lbu r2,0x0001(r2)                |r2 = Unit's Accessory M-Ev
0005c44c: 00000000 nop                              |
0005c450: a2020044 sb r2,0x0044(r16)                |Store Unit's Accessory M-Ev in Unit's 0x44 (Accessory M-Ev)
0005c454: 9202001e lbu r2,0x001e(r16)           |r2 = Unit's Right Hand's Shield ID
0005c458: 00000000 nop                          |
0005c45c: 00021840 sll r3,r2,0x01               |Right Hand's Shield ID * 2
0005c460: 00621821 addu r3,r3,r2                |Right Hand's Shield ID * 3
0005c464: 00031880 sll r3,r3,0x02               |Right Hand's Shield ID * 0x0c
0005c468: 00641021 addu r2,r3,r4                |r2 = Start of Unit's Right Hand's Shield data pointer
0005c46c: 90420003 lbu r2,0x0003(r2)            |r2 = Unit's Right Hand's Shield Type flag
0005c470: 00000000 nop                          |
0005c474: 30420040 andi r2,r2,0x0040            |r2 = 0x40 If Unit's Right Hand's Shield is a shield
0005c478: 1040000e beq r2,r0,0x0005c4b4         #If Right Hand's Shield is a shield /Else Avoid Right Hand's Shield Section
0005c47c: 00000000 nop                              |
0005c480: 3c018006 lui r1,0x8006                    |
0005c484: 00230821 addu r1,r1,r3                    |r1 = 0x80060000 + Unit's Right Hand's Shield offset
0005c488: 90222ebc lbu r2,0x2ebc(r1)                |r2 = Unit's Right Hand's Shield Second Table ID
0005c48c: 3c038006 lui r3,0x8006                    |
0005c490: 24633eb8 addiu r3,r3,0x3eb8               |r3 = 0x80063f58
0005c494: 00021040 sll r2,r2,0x01                   |r2 = Right Hand's Shield Second Table ID *2
0005c498: 00431821 addu r3,r2,r3                    |r3 = Right Hand's Shield Second Table data pointer
0005c49c: 90620000 lbu r2,0x0000(r3)                |r2 = Right Hand's Shield P-Ev
0005c4a0: 00000000 nop                              |
0005c4a4: a2020041 sb r2,0x0041(r16)                |Store Right Hand's Shield P-Ev in Unit Data
0005c4a8: 90620001 lbu r2,0x0001(r3)                |r2 = Right Hand's Shield M-Ev
0005c4ac: 00000000 nop                              |
0005c4b0: a2020045 sb r2,0x0045(r16)                |Store Right Hand's Shield M-Ev in Unit Data
0005c4b4: 92020020 lbu r2,0x0020(r16)           |r2 = Unit's LH shield
0005c4b8: 00000000 nop                          |
0005c4bc: 00021840 sll r3,r2,0x01               |Leftt Hand's Shield ID * 2
0005c4c0: 00621821 addu r3,r3,r2                |Leftt Hand's Shield ID * 3
0005c4c4: 00031880 sll r3,r3,0x02               |Leftt Hand's Shield ID * 0x0c
0005c4c8: 00641021 addu r2,r3,r4                |r2 = Start of Unit's Leftt Hand's Shield data pointer
0005c4cc: 90420003 lbu r2,0x0003(r2)            |r2 = Unit's Leftt Hand's Shield Type flag
0005c4d0: 00000000 nop                          |
0005c4d4: 30420040 andi r2,r2,0x0040            |r2 = 0x40 If Unit's Leftt Hand's Shield is a shield
0005c4d8: 1040000e beq r2,r0,0x0005c514         #If Leftt Hand's Shield is a shield /Else Avoid Leftt Hand's Shield Section
0005c4dc: 00000000 nop                              |
0005c4e0: 3c018006 lui r1,0x8006                    |
0005c4e4: 00230821 addu r1,r1,r3                    |r1 = 0x80060000 + Unit's Leftt Hand's Shield offset
0005c4e8: 90222ebc lbu r2,0x2ebc(r1)                |r2 = Unit's Leftt Hand's Shield Second Table ID
0005c4ec: 3c038006 lui r3,0x8006                    |
0005c4f0: 24633eb8 addiu r3,r3,0x3eb8               |r3 = 0x80063f58
0005c4f4: 00021040 sll r2,r2,0x01                   |r2 = Leftt Hand's Shield Second Table ID *2
0005c4f8: 00431821 addu r3,r2,r3                    |r3 = Leftt Hand's Shield Second Table data pointer
0005c4fc: 90620000 lbu r2,0x0000(r3)                |r2 = Leftt Hand's Shield P-Ev
0005c500: 00000000 nop                              |
0005c504: a2020042 sb r2,0x0042(r16)                |Store Leftt Hand's Shield P-Ev in Unit Data
0005c508: 90620001 lbu r2,0x0001(r3)                |r2 = Leftt Hand's Shield M-Ev
0005c50c: 00000000 nop                              |
0005c510: a2020046 sb r2,0x0046(r16)                |Store Leftt Hand's Shield M-Ev in Unit Data
0005c514: 9203001d lbu r3,0x001d(r16)           |r3 = Unit's Right Hand's Weapon
0005c518: 00000000 nop                          |
0005c51c: 00031040 sll r2,r3,0x01               |Right Hand's Weapon ID * 2
0005c520: 00431021 addu r2,r2,r3                |Right Hand's Weapon ID * 3
0005c524: 00021080 sll r2,r2,0x02               |Right Hand's Weapon ID * 0x0c
0005c528: 00441021 addu r2,r2,r4                |r2 = Start of Unit's Right Hand's Weapon data pointer
0005c52c: 90420003 lbu r2,0x0003(r2)            |r2 = Unit's Right Hand's Weapon Type flag
0005c530: 00000000 nop                          |
0005c534: 30420080 andi r2,r2,0x0080            |r2 = 0x80 If Unit's Right Hand's Weapon is a Weapon
0005c538: 1040000a beq r2,r0,0x0005c564         #If Right Hand's Weapon is a Weapon /Else Avoid Right Hand's Weapon Section
0005c53c: 000318c0 sll r3,r3,0x03                   |r3 = Right Hand's Weapon ID * 0x08
0005c540: 3c028006 lui r2,0x8006                    |
0005c544: 24423ab8 addiu r2,r2,0x3ab8               |r2 = 0x80063ab8 Weapon secondary data Table start
0005c548: 00621821 addu r3,r3,r2                    |r3 = Unit's Right Hand's Weapon Secondary data pointer
0005c54c: 90620004 lbu r2,0x0004(r3)                |r2 = Right Hand's Weapon Weapon Power
0005c550: 00000000 nop                              |
0005c554: a202003c sb r2,0x003c(r16)                |Store Right Hand's Weapon Power in Unit Data
0005c558: 90620005 lbu r2,0x0005(r3)                |r2 = Right Hand's Weapon W-Ev
0005c55c: 00000000 nop                              |
0005c560: a202003e sb r2,0x003e(r16)                |Store Right Hand's Weapon W-Ev in Unit Data
0005c564: 9203001f lbu r3,0x001f(r16)           |r3 = Unit's Left Hand's Weapon
0005c568: 00000000 nop                          |
0005c56c: 00031040 sll r2,r3,0x01               |Left Hand's Weapon ID * 2
0005c570: 00431021 addu r2,r2,r3                |Left Hand's Weapon ID * 3
0005c574: 00021080 sll r2,r2,0x02               |Left Hand's Weapon ID * 0x0c
0005c578: 00441021 addu r2,r2,r4                |r2 = Start of Unit's Left Hand's Weapon data pointer
0005c57c: 90420003 lbu r2,0x0003(r2)            |r2 = Unit's Left Hand's Weapon Type flag
0005c580: 00000000 nop                          |
0005c584: 30420080 andi r2,r2,0x0080            |r2 = 0x80 If Unit's Left Hand's Weapon is a Weapon
0005c588: 1040000a beq r2,r0,0x0005c5b4         #If Left Hand's Weapon is a Weapon /Else Avoid Left Hand's Weapon Section
0005c58c: 000318c0 sll r3,r3,0x03                   |r3 = Left Hand's Weapon ID * 0x08
0005c590: 3c028006 lui r2,0x8006                    |
0005c594: 24423ab8 addiu r2,r2,0x3ab8               |r2 = 0x80063ab8 Weapon secondary data Table start
0005c598: 00621821 addu r3,r3,r2                    |r3 = Unit's Left Hand's Weapon Secondary data pointer
0005c59c: 90620004 lbu r2,0x0004(r3)                |r2 = Left Hand's Weapon Weapon Power
0005c5a0: 00000000 nop                              |
0005c5a4: a202003d sb r2,0x003d(r16)                |Store Left Hand's Weapon Power in Unit Data
0005c5a8: 90620005 lbu r2,0x0005(r3)                |r2 = Left Hand's Weapon W-Ev
0005c5ac: 00000000 nop                              |
0005c5b0: a202003f sb r2,0x003f(r16)                |Store Left Hand's Weapon W-Ev in Unit Data
0005c5b4: 8fbf0014 lw r31,0x0014(r29)           END
0005c5b8: 8fb00010 lw r16,0x0010(r29)               
0005c5bc: 27bd0018 addiu r29,r29,0x0018             
0005c5c0: 03e00008 jr r31                           
0005c5c4: 00000000 nop                              

Return Locations

SCUS_942.21
0005ab0c: Equipment/Move/Jump +X/Name Storing/Generation
0005d704: Status Setting/Checking + Equip/R/S/M Stats


Notes

Notes : The Item Data/Table start at 80062eb8 Each items are 12 bytes long So loading 0x8006YYYY (YYYY = Item ID * 12) + 2ebb = Loading offset 0x03 (2ebb - 2eb8) of this item