Status CT Setting

From Final Fantasy Hacktics Wiki
Revision as of 20:06, 23 June 2021 by Orkney (talk | contribs) (return link)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Status CT Setting 
- Set death counter, nullify CT of removed status, set death sentence CT, set status CT
-----------------------------------
Need r4 = Target/Unit data pointer
     r5 = Loop Counter = Status number (see patcher list)  
     r6 = ? 0x01 when called from 0018e2c0 (removal section)
Return r2 = 0xffff (Death sentence already inflicted ) Else 0x00
----------------------------------
0005db70: 34020002 ori r2,r0,0x0002          r2 = 0x0002
0005db74: 14a2000d bne r5,r2,0x0005dbac      #If r5 = 0x02 (status = Death) /Branch if Counter != 2 (Death)
0005db78: 00803821 addu r7,r4,r0                |r7 = Unit Data Pointer
0005db7c: 90e20005 lbu r2,0x0005(r7)            |r2 = Unit ENTD flags
0005db80: 00000000 nop                          |
0005db84: 30420004 andi r2,r2,0x0004            |r2 = 0x04 if unit is immortal / else 0x00
0005db88: 14400007 bne r2,r0,0x0005dba8         #If Unit is not immortal / Else branch
0005db8c: 340200ff ori r2,r0,0x00ff             |r2 = 0xff
0005db90: 90e20006 lbu r2,0x0006(r7)                |r2 = Unit's Gender Byte
0005db94: 00000000 nop                              |
0005db98: 30420009 andi r2,r2,0x0009                |r2 <> 0x00 if Unit has Load/Save  Formation
0005db9c: 14400002 bne r2,r0,0x0005dba8             #If unit do not have save/load formation  
0005dba0: 340200ff ori r2,r0,0x00ff                 |r2 = 0xff
0005dba4: 34020003 ori r2,r0,0x0003                     |r2 = 0x03
0005dba8: a0e20007 sb r2,0x0007(r7)             |Store r2 as  Unit's Death Counter (0x03 or  0xff)
0005dbac: 24a4ffe8 addiu r4,r5,0xffe8       r4 = Counter - 0x18
0005dbb0: 2c820010 sltiu r2,r4,0x0010       r2 = 0x01 if r4 < 0x10
0005dbb4: 10400015 beq r2,r0,0x0005dc0c     #if r2 = 0x01 (16 last statuses - they have a CT)/ Else branch to end
0005dbb8: 00001021 addu r2,r0,r0            |r2 = 0x00
0005dbbc: 10c00005 beq r6,r0,0x0005dbd4        #If r6 <> 0x00 (remove status ?) / Branch if Not (Initializing Data?)
0005dbc0: 00804021 addu r8,r4,r0                    |r8 = Counter - 0x18
0005dbc4: 00e81021 addu r2,r7,r8                    |r2 = Unit's Data Pointer + Counter - 0x18
0005dbc8: a040005d sb r0,0x005d(r2)                 |Store Status X CT = 0
0005dbcc: 08017703 j 0x0005dc0c                     >> Jump to end
0005dbd0: 00001021 addu r2,r0,r0                    |r2 = 0x00
0005dbd4: 3402000f ori r2,r0,0x000f            |r2 = 0x0f
0005dbd8: 15020006 bne r8,r2,0x0005dbf4        #If Status is death sentence// Branch if Status Checked isn't Death Sentence
0005dbdc: 00001021 addu r2,r0,r0               |r2 = 0x00
0005dbe0: 90e2006c lbu r2,0x006c(r7)                |r2 = Unit's Death Sentence CT
0005dbe4: 00000000 nop                              |
0005dbe8: 14400008 bne r2,r0,0x0005dc0c             #If r2 = 0x00 - Death sentence CT = 0/ Else Branch to end (with r2 = 0xffff)
0005dbec: 2402ffff addiu r2,r0,0xffff               |r2 = 0xffff (death sentence is already inflicted)
0005dbf0: 00001021 addu r2,r0,r0                        |r2 = 0 (inflicting DS)
0005dbf4: 00051900 sll r3,r5,0x04              |r3 = Counter * 16
0005dbf8: 3c018006 lui r1,0x8006               |
0005dbfc: 00230821 addu r1,r1,r3               |r1 = 8006XXXX (XXXX = status number)
0005dc00: 90245de7 lbu r4,0x5de7(r1)           |r4 = status X CT Load Status's CT
0005dc04: 00e81821 addu r3,r7,r8               |r3 = Unit's Data Pointer + Counter - 0x18
0005dc08: a064005d sb r4,0x005d(r3)            |Store Unit's Status X's  CT
0005dc0c: 03e00008 jr r31
0005dc10: 00000000 nop


Return Locations

0005d588: Float/Current Statuses/Status Immunities/Status CT
0005d82c: Status Setting/Checking + Equip/R/S/M Stats
0018e2c8: Inflicted_status_CT_setting,_xfer_last_used_CT 
0018e474: Store_status,modified_ENTD_for_current_attack
0018ece0:0018ec44