Move/Jump +X Calculation

From Final Fantasy Hacktics Wiki
Revision as of 19:53, 21 March 2022 by Orkney (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
HP initialization + Move/Jump +X Calculation (CAN BE USED TO LOAD DATA AT START OF BATTLE

Parameters : r4 = Unit data pointer
             r5 = Input value / if <> 0x00 will skip HP initialization
--------------------------------------------------------------------------------------------------
0005c8ec: 14a00005 bne r5,r0,0x0005c904     #If Input value = 0x00
0005c8f0: 00000000 nop                          |
0005c8f4: 9482002a lhu r2,0x002a(r4)            |r2 = Unit's max HP
0005c8f8: 9483002e lhu r3,0x002e(r4)            |r3 = Unit's Max MP
0005c8fc: a4820028 sh r2,0x0028(r4)             |Store Unit Current HP = Max HP
0005c900: a483002c sh r3,0x002c(r4)             |Store Unit Current MP = Max MP
0005c904: 9085003a lbu r5,0x003a(r4)        |r5 = Unit's Move
0005c908: 90860093 lbu r6,0x0093(r4)        |r6 = Unit's 1st set of Movements
0005c90c: 9083003b lbu r3,0x003b(r4)        |r3 = Unit's Jump
0005c910: 30c20080 andi r2,r6,0x0080        |r2 = 0x80 if Unit uses Move + 1
0005c914: 10400002 beq r2,r0,0x0005c920     #If Unit uses Move +1
0005c918: 30c20040 andi r2,r6,0x0040        |r2 = 0x40 if unit uses Move + 2
0005c91c: 24a50001 addiu r5,r5,0x0001           |r5 = Unit's move + 1
0005c920: 10400002 beq r2,r0,0x0005c92c     #If Unit uses Move +2
0005c924: 30c20020 andi r2,r6,0x0020        |r2 = 0x20 if unit uses Move + 3
0005c928: 24a50002 addiu r5,r5,0x0002           |r5 = Unit's Move + 2
0005c92c: 10400002 beq r2,r0,0x0005c938     #If Unit uses Move + 3
0005c930: 30c20010 andi r2,r6,0x0010        |r2 = 0x10 if Unit uses Jump + 1
0005c934: 24a50003 addiu r5,r5,0x0003           |r5 = Unit's Move + 3
0005c938: 10400002 beq r2,r0,0x0005c944     #If Unit uses Jump +1
0005c93c: 30c20008 andi r2,r6,0x0008        |r2 = 0x08 if Unit uses Jump + 2
0005c940: 24630001 addiu r3,r3,0x0001           |r3 = Unit's Jump + 1
0005c944: 10400002 beq r2,r0,0x0005c950     #If Unit uses Jump + 2
0005c948: 30c20004 andi r2,r6,0x0004        |r2 = 0x04 if Unit uses Jump +3
0005c94c: 24630002 addiu r3,r3,0x0002           |r3 = Unit's Jump + 2
0005c950: 10400002 beq r2,r0,0x0005c95c     #If Unit uses Jump + 3
0005c954: 30a2ffff andi r2,r5,0xffff        |r2 = Unit's Move (halfword)
0005c958: 24630003 addiu r3,r3,0x0003           |r3 = Unit's Jump + 3
0005c95c: 2c4200fd sltiu r2,r2,0x00fd       |r2 = 0x01 if Unit's Move < 0xfd (253)
0005c960: 14400002 bne r2,r0,0x0005c96c     #If Unit's Move > 252
0005c964: 3062ffff andi r2,r3,0xffff        |r2 = Unit's Jump (halfword)
0005c968: 340500fc ori r5,r0,0x00fc             |r5 = Unit's Move caped to 252
0005c96c: 2c420008 sltiu r2,r2,0x0008       |r2 = 0x01 if Unit's Jump < 0x08
0005c970: 14400002 bne r2,r0,0x0005c97c     #If Unit's Jump > 7
0005c974: a085003a sb r5,0x003a(r4)         |Store Unit's Move
0005c978: 34030007 ori r3,r0,0x0007             |r3 = Unit's Jump forced to 0x07
0005c97c: 03e00008 jr r31                       
0005c980: a083003b sb r3,0x003b(r4)         |Store Unit's Jump

Return Locations

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