Chose Move from Move List?

From Final Fantasy Hacktics Wiki
(Redirected from 00197e60 - 00197f10)
Jump to navigation Jump to search
BATTLE.BIN :  - Chose Move from Move List? 
Run Simulation for all Abilities in Unit List (AI 0xef0). Best results should be saved from AI 0x54 to AI 0x154
------------------------------------------------------------------------------------------
Parameter : 
Return : r2 = 0x00 (default)
         r2 = -0x01 if Simulation of an ability returns - 0x01
------------------------------------------------------------------------------------------
00197e60: 3c02801a lui r2,0x801a             |
00197e64: 90420d7b lbu r2,0x0d7b(r2)         |AI 0x19b7 801a0d7b
00197e68: 27bdffe8 addiu r29,r29,-0x0018     |
00197e6c: afb00010 sw r16,0x0010(r29)        |
00197e70: 3c10801a lui r16,0x801a            |
00197e74: 2610f3c4 addiu r16,r16,0xf3c4      |0x8019f3c4
00197e78: 14400013 bne r2,r0,0x00197ec8      #If AI 0x19b7 <> 0x00 : branch directly to   Simulation  (Ability is chosen or return where the routine fails ?)
00197e7c: afbf0014 sw r31,0x0014(r29)        |
                                             Else : AI 0x19b7 = 0x00
00197e80: 3c01801a lui r1,0x801a                 |
00197e84: a0200081 sb r0,0x0081(r1)              |Initialize Ability counter (at 0x801a0081) AI 0x0cbd
                                                @LOOP - Each Ability
00197e88: 92030e2f lbu r3,0x0e2f(r16)                |Load acting unit ID
00197e8c: 00000000 nop                               |
00197e90: 00031100 sll r2,r3,0x04                    |
00197e94: 00431021 addu r2,r2,r3                     |
00197e98: 000210c0 sll r2,r2,0x03                    |ID *0x88
00197e9c: 24420ef0 addiu r2,r2,0x0ef0                |
00197ea0: 92030cbd lbu r3,0x0cbd(r16)                |Load Ability counter
00197ea4: 02021021 addu r2,r16,r2                    |0x8019f3c4 + 0x0ef0 + Unit offset This unit start of usable abilities list
00197ea8: 00031880 sll r3,r3,0x02                    |Ability offset (1 word per ability)
00197eac: 00432021 addu r4,r2,r3                     |This Ability pointer 0x8019f3c4 + 0x0ef0 + Unit offset + Ability offset
00197eb0: 90830002 lbu r3,0x0002(r4)                 |Load This Ability skillset
00197eb4: 340200ff ori r2,r0,0x00ff                  |
00197eb8: 10620011 beq r3,r2,0x00197f00              #If End of usable Abilities  Exit routine Returns 0x00
00197ebc: 00001021 addu r2,r0,r0                     |
00197ec0: 0c06561e jal 0x00195878                    |-->AI_Ability_Data_Setting Set  data  at 8019f3c4 (from 0x00 to 0x13)
00197ec4: 00000000 nop                               |
                  AI 0x19b7 <>0
00197ec8: 0c066bc6 jal 0x0019af18                    |-->AI_Ability_Outcome_Evaluation Test All destination and targetable tile with this ability (save results in AI 0x54 Tables)
00197ecc: 00000000 nop                               |
00197ed0: 2403ffff addiu r3,r0,-0x0001               |
00197ed4: 1043000a beq r2,r3,0x00197f00              #If returned value is -0x01 Exit routine Returns -0x01
00197ed8: 2402ffff addiu r2,r0,-0x0001               |
00197edc: 92020cbd lbu r2,0x0cbd(r16)                |Load Current ability counter
00197ee0: 00000000 nop                               |
00197ee4: 24420001 addiu r2,r2,0x0001                |
00197ee8: a2020cbd sb r2,0x0cbd(r16)                 |Increase Ability counter by 0x1
00197eec: 92020cbd lbu r2,0x0cbd(r16)                |Load Current ability counter
00197ef0: 00000000 nop                               |
00197ef4: 2c420022 sltiu r2,r2,0x0022                |Check List limit
00197ef8: 1440ffe3 bne r2,r0,0x00197e88          #Do for all moves
00197efc: 00001021 addu r2,r0,r0                 |returns 0x00
00197f00: 8fbf0014 lw r31,0x0014(r29)
00197f04: 8fb00010 lw r16,0x0010(r29)
00197f08: 27bd0018 addiu r29,r29,0x0018
00197f0c: 03e00008 jr r31
00197f10: 00000000 nop

Return locations

BATTLE.BIN
 00196258: Non-Specific_AI_AutoBattle_(Enemies)
 00198248: Fight_for_Life_-_Auto_Battle_(00197ff4)
 00198288: Fight_for_Life_-_Auto_Battle_(00197ff4)
 00198750: Protect_Allies_-_Auto_Battle_(001984ec)
 00198790: Protect_Allies_-_Auto_Battle_(001984ec)
 001987c8: Protect_Allies_-_Auto_Battle_(001984ec)
 00198f28: AI_Critical_or_Run_Like_Rabbit
 00199000: AI_Critical_or_Run_Like_Rabbit