Difference between revisions of "See if ability should be used based on CT"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
  See if ability should be used based on CT  
+
  '''BATTLE.BIN''' :  - See if ability should be used based on CT
 
+
------------------------------------------------------------------------------------------
  0019f0d8: 27bdffe0 addiu r29,r29,0xffe0
+
Parameter : r4 = Unit ID
  0019f0dc: afb00010 sw r16,0x0010(r29)
+
Return : r2 = 0x00 if Unit Won't move before Ability CT ends
  0019f0e0: 3c10801a lui r16,0x801a
+
          r2 = 0x01 if Unit will get an active Turn before Ability CT ends
  0019f0e4: 9210f3c5 lbu r16,-0x0c3b(r16)         load CT
+
------------------------------------------------------------------------------------------
  0019f0e8: afb10014 sw r17,0x0014(r29)
+
  0019f0d8: 27bdffe0 addiu r29,r29,-0x0020    |
  0019f0ec: 00808821 addu r17,r4,r0
+
  0019f0dc: afb00010 sw r16,0x0010(r29)       |
  0019f0f0: 12000013 beq r16,r0,0x0019f140         branch if 00
+
  0019f0e0: 3c10801a lui r16,0x801a           |
  0019f0f4: afbf0018 sw r31,0x0018(r29)
+
  0019f0e4: 9210f3c5 lbu r16,-0x0c3b(r16)     |{{f/load|Considered Ability CT}} {{f/adr|8019f3c4 + 0x01}}
  0019f0f8: 001120c0 sll r4,r17,0x03
+
  0019f0e8: afb10014 sw r17,0x0014(r29)       |
  0019f0fc: 00912023 subu r4,r4,r17
+
  0019f0ec: 00808821 addu r17,r4,r0           |{{f/std|Preserve Unit ID}}
  0019f100: 00042180 sll r4,r4,0x06
+
  0019f0f0: 12000013 beq r16,r0,0x0019f140     {{f/Cond|If Ability CT is null}} {{f/loc|Exit }} {{f/Returns|Returns 0x00}}
  0019f104: 3c028019 lui r2,0x8019
+
  0019f0f4: afbf0018 sw r31,0x0018(r29)       |
  0019f108: 244208cc addiu r2,r2,0x08cc        
+
  0019f0f8: 001120c0 sll r4,r17,0x03           |
  0019f10c: 0c0666e6 jal 0x00199b98            [[Calculate Clockticks Until Unit Acts]]
+
  0019f0fc: 00912023 subu r4,r4,r17           |
  0019f110: 00822021 addu r4,r4,r2                 r4 = unit data
+
  0019f100: 00042180 sll r4,r4,0x06           |{{f/std|Unit ID * 0x1c0}}
  0019f114: 3c037fff lui r3,0x7fff
+
  0019f104: 3c028019 lui r2,0x8019             |
  0019f118: 3463ffff ori r3,r3,0xffff
+
  0019f108: 244208cc addiu r2,r2,0x08cc       |
  0019f11c: 10430008 beq r2,r3,0x0019f140         branch if = 0x7fffffff
+
  0019f10c: 0c0666e6 jal 0x00199b98            |{{f/jal|Calculate Clockticks Until Unit Acts|Calculate Clockticks Until Unit Acts}} {{f/std|returns CT before Unit action}}
  0019f120: 0202102a slt r2,r16,r2                 set if CT < CT unitl unit acts
+
  0019f110: 00822021 addu r4,r4,r2             |{{f/adr|Send Unit Battle Data pointer ( 0x801908cc + Unit offset)}}
  0019f124: 14400007 bne r2,r0,0x0019f144         branch if so
+
  0019f114: 3c037fff lui r3,0x7fff             |
  0019f128: 00001021 addu r2,r0,r0
+
  0019f118: 3463ffff ori r3,r3,0xffff         |
  0019f12c: 02002021 addu r4,r16,r0
+
  0019f11c: 10430008 beq r2,r3,0x0019f140     {{f/Cond|If Unit will never get a Turn}} {{f/loc|Exit }} {{f/Returns|Returns 0x00}}
  0019f130: 0c067c57 jal 0x0019f15c             [[0019f15c - 0019f254]]
+
  0019f120: 0202102a slt r2,r16,r2             |{{f/std|0x1 if Ability CT < CT before Unit Turn}}
  0019f134: 02202821 addu r5,r17,r0
+
  0019f124: 14400007 bne r2,r0,0x0019f144     {{f/Cond|If Considered Unit won't get his turn before Abilty CT ends}} {{f/loc|Exit }} {{f/Returns|Returns 0x00}}
  0019f138: 08067c51 j 0x0019f144
+
  0019f128: 00001021 addu r2,r0,r0                 |
  0019f13c: 00000000 nop
+
                                              '''Else : Considered Unit will get a Turn before end of Ability CT'''
 +
  0019f12c: 02002021 addu r4,r16,r0           |{{f/std|Send CT}}
 +
  0019f130: 0c067c57 jal 0x0019f15c           |{{f/jal|See_if_ability_should_be_used_based_on_CT|See_if_ability_should_be_used_based_on_CT}} {{f/std|returns 0x1 if Unit is active (wil get an active turn)}}
 +
  0019f134: 02202821 addu r5,r17,r0           |{{f/std|Send Unit ID}}
 +
  0019f138: 08067c51 j 0x0019f144             |{{f/loc|Exit }} {{f/Returns|returns 0x00 if Unit is inactive else 0x01}}
 +
  0019f13c: 00000000 nop                       |
 
  0019f140: 00001021 addu r2,r0,r0
 
  0019f140: 00001021 addu r2,r0,r0
 
  0019f144: 8fbf0018 lw r31,0x0018(r29)
 
  0019f144: 8fbf0018 lw r31,0x0018(r29)
Line 33: Line 38:
 
  0019f150: 27bd0020 addiu r29,r29,0x0020
 
  0019f150: 27bd0020 addiu r29,r29,0x0020
 
  0019f154: 03e00008 jr r31
 
  0019f154: 03e00008 jr r31
  0019f158: 00000000 nop
+
  0019f158: 00000000 nop  
 
=== Returns Location ===
 
=== Returns Location ===
 
  0019b1a0: [[AI_ability_use_control_routine]]
 
  0019b1a0: [[AI_ability_use_control_routine]]

Revision as of 11:16, 1 May 2024

BATTLE.BIN :  - See if ability should be used based on CT
------------------------------------------------------------------------------------------
Parameter : r4 = Unit ID 
Return : r2 = 0x00 if Unit Won't move before Ability CT ends
         r2 = 0x01 if Unit will get an active Turn before Ability CT ends
------------------------------------------------------------------------------------------
0019f0d8: 27bdffe0 addiu r29,r29,-0x0020     |
0019f0dc: afb00010 sw r16,0x0010(r29)        |
0019f0e0: 3c10801a lui r16,0x801a            |
0019f0e4: 9210f3c5 lbu r16,-0x0c3b(r16)      |Considered Ability CT 8019f3c4 + 0x01
0019f0e8: afb10014 sw r17,0x0014(r29)        |
0019f0ec: 00808821 addu r17,r4,r0            |Preserve Unit ID
0019f0f0: 12000013 beq r16,r0,0x0019f140     #If Ability CT is null Exit  Returns 0x00
0019f0f4: afbf0018 sw r31,0x0018(r29)        |
0019f0f8: 001120c0 sll r4,r17,0x03           |
0019f0fc: 00912023 subu r4,r4,r17            |
0019f100: 00042180 sll r4,r4,0x06            |Unit ID * 0x1c0
0019f104: 3c028019 lui r2,0x8019             |
0019f108: 244208cc addiu r2,r2,0x08cc        |
0019f10c: 0c0666e6 jal 0x00199b98            |-->Calculate Clockticks Until Unit Acts returns CT before Unit action
0019f110: 00822021 addu r4,r4,r2             |Send Unit Battle Data pointer ( 0x801908cc + Unit offset)
0019f114: 3c037fff lui r3,0x7fff             |
0019f118: 3463ffff ori r3,r3,0xffff          |
0019f11c: 10430008 beq r2,r3,0x0019f140      #If Unit will never get a Turn Exit  Returns 0x00
0019f120: 0202102a slt r2,r16,r2             |0x1 if Ability CT < CT before Unit Turn
0019f124: 14400007 bne r2,r0,0x0019f144      #If Considered Unit won't get his turn before Abilty CT ends Exit  Returns 0x00
0019f128: 00001021 addu r2,r0,r0                 |
                                             Else : Considered Unit will get a Turn before end of Ability CT
0019f12c: 02002021 addu r4,r16,r0            |Send CT
0019f130: 0c067c57 jal 0x0019f15c            |-->See_if_ability_should_be_used_based_on_CT returns 0x1 if Unit is active (wil get an active turn)
0019f134: 02202821 addu r5,r17,r0            |Send Unit ID
0019f138: 08067c51 j 0x0019f144              |Exit  returns 0x00 if Unit is inactive else 0x01
0019f13c: 00000000 nop                       |
0019f140: 00001021 addu r2,r0,r0
0019f144: 8fbf0018 lw r31,0x0018(r29)
0019f148: 8fb10014 lw r17,0x0014(r29)
0019f14c: 8fb00010 lw r16,0x0010(r29)
0019f150: 27bd0020 addiu r29,r29,0x0020
0019f154: 03e00008 jr r31
0019f158: 00000000 nop 

Returns Location

0019b1a0: AI_ability_use_control_routine
0019b208: AI_ability_use_control_routine
0019b878: AI_Targeting_Matrix_Analysis_(0019b7b8)
0019b930: AI_Targeting_Matrix_Analysis_(0019b7b8)
0019f08c: Set_unit_untargetable_based_on_19f0d8_routine