Shift Current Effect Target ID

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
801ad828: 27bdffe8 addiu r29,r29,-0x0018
801ad82c: afb00010 sw r16,0x0010(r29)
801ad830: 3c10801c lui r16,0x801c
801ad834: 92109134 lbu r16,-0x6ecc(r16)         #   current effect target ID
801ad838: 00000000 nop
801ad83c: 320200ff andi r2,r16,0x00ff           #   
801ad840: 10400037 beq r2,r0,0x801ad920         #   branch to error check if no target ID
801ad844: afbf0014 sw r31,0x0014(r29)
801ad848: 00022080 sll r4,r2,0x02
801ad84c: 00822021 addu r4,r4,r2
801ad850: 00042080 sll r4,r4,0x02
801ad854: 00822021 addu r4,r4,r2
801ad858: 00042080 sll r4,r4,0x02		 #   effect target ID * 0x54
801ad85c: 3c01801c lui r1,0x801c
801ad860: 00240821 addu r1,r1,r4
801ad864: 90228b9c lbu r2,-0x7464(r1)		 #   load current effect target ID's previous current effect target ID
801ad868: 3c01801c lui r1,0x801c
801ad86c: a4229134 sh r2,-0x6ecc(r1)		 #   Store previous effect target ID in 0x801b9134 again
801ad870: 3c03801c lui r3,0x801c
801ad874: 94639134 lhu r3,-0x6ecc(r3)		 #
801ad878: 00000000 nop
801ad87c: 00031080 sll r2,r3,0x02
801ad880: 00431021 addu r2,r2,r3
801ad884: 00021080 sll r2,r2,0x02
801ad888: 00431021 addu r2,r2,r3
801ad88c: 00021080 sll r2,r2,0x02		 #   Previous effect target ID * 0x54
801ad890: 3c01801c lui r1,0x801c
801ad894: 00220821 addu r1,r1,r2
801ad898: a0208b9d sb r0,-0x7463(r1)		 #   Clear previous effect target's current effect target ID
801ad89c: 3c02801c lui r2,0x801c
801ad8a0: 90429130 lbu r2,-0x6ed0(r2)		 #   load first/previous effect target ID
801ad8a4: 3406001f ori r6,r0,0x001f
801ad8a8: 3c01801c lui r1,0x801c
801ad8ac: 00240821 addu r1,r1,r4
801ad8b0: a0208b9d sb r0,-0x7463(r1)		 #   Clear current effect target's current effect target ID
801ad8b4: 3c01801c lui r1,0x801c
801ad8b8: 00240821 addu r1,r1,r4
801ad8bc: a0228b9c sb r2,-0x7464(r1)		 #   Store first effect target ID as current effect target's previous effect target ID
801ad8c0: 3c02801c lui r2,0x801c
801ad8c4: 24428beb addiu r2,r2,-0x7415		 #   points to effect target table + 0x4f
801ad8c8: 3c03801c lui r3,0x801c
801ad8cc: 94639130 lhu r3,-0x6ed0(r3)		 #   load first/Previous effect target ID
801ad8d0: 00822821 addu r5,r4,r2		 #   pointer to current effect target's table + 0x4f
801ad8d4: 00031080 sll r2,r3,0x02
801ad8d8: 00431021 addu r2,r2,r3
801ad8dc: 00021080 sll r2,r2,0x02
801ad8e0: 00431021 addu r2,r2,r3
801ad8e4: 00021080 sll r2,r2,0x02		 #   First/Previous effect target's ID * 0x54
801ad8e8: 3c01801c lui r1,0x801c
801ad8ec: 00220821 addu r1,r1,r2		 #   First/Previous effect target's table
801ad8f0: a0308b9d sb r16,-0x7463(r1)		 #   store current effect target's ID as previous effect target's current effect target ID
801ad8f4: 3c01801c lui r1,0x801c
801ad8f8: a4309130 sh r16,-0x6ed0(r1)		 #   Store current effect target's ID as previous effect target ID
801ad8fc: 3c01801c lui r1,0x801c
801ad900: 00240821 addu r1,r1,r4
801ad904: a4208ba8 sh r0,-0x7458(r1)		 #   clear 0xC half current effect target's table
801ad908: a0a00000 sb r0,0x0000(r5)		 #   clear 0x4F - 0x30 current effect target's table
801ad90c: 24c6ffff addiu r6,r6,-0x0001
801ad910: 04c1fffd bgez r6,0x801ad908		 #   loop to clear 0x4F - 0x30 current effect target's table
801ad914: 24a5ffff addiu r5,r5,-0x0001
801ad918: 0806b64c j 0x801ad930
801ad91c: 02001021 addu r2,r16,r0		 #   return current effect target's ID
801ad920: 34040001 ori r4,r0,0x0001		 #   if effect target ID is invalid:
801ad924: 0c01127e jal 0x800449f8		 #   dummied error check
801ad928: 34050066 ori r5,r0,0x0066
801ad92c: 02001021 addu r2,r16,r0		 #   return current effect target ID
Return:
801ad930: 8fbf0014 lw r31,0x0014(r29)
801ad934: 8fb00010 lw r16,0x0010(r29)
801ad938: 27bd0018 addiu r29,r29,0x0018
801ad93c: 03e00008 jr r31
801ad940: 00000000 nop