Difference between revisions of "Non-Specific AI AutoBattle (Enemies)"
Jump to navigation
Jump to search
m (Choto moved page 0019619c - 0019629c to Non-Specific AI AutoBattle (Enemies)) |
Tag: Undo |
||
| (4 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| − | + | '''BATTLE.BIN''' : - Non-Specific AI AutoBattle (Enemies) | |
| − | Non-Specific AI AutoBattle (Enemies) | + | Test any combination of [Ability / Destination /Targeted Tile] and store selected action data in AI 0x17fc |
| − | + | ------------------------------------------------------------------------------------------ | |
| − | + | Parameter : Nothing | |
| − | + | Return : r2 = 0x00 (default) | |
| − | + | r2 = -0x01 (Abort on Vsync alert ?) | |
| − | + | ------------------------------------------------------------------------------------------ | |
| − | + | 0019619c: 3c02801a lui r2,0x801a | | |
| − | + | 001961a0: 90420d7b lbu r2,0x0d7b(r2) |{{f/load|Load AI 0x19b7}} {{f/std|Flag to return where the code stops after a V_Sync alert (refresh animation on screen ?)}} | |
| − | + | 001961a4: 27bdffe8 addiu r29,r29,-0x0018 | | |
| − | + | 001961a8: afb00010 sw r16,0x0010(r29) | | |
| − | + | 001961ac: 3c10801a lui r16,0x801a | | |
| − | + | 001961b0: 2610f3c4 addiu r16,r16,-0x0c3c |{{f/adr|8019f3c4}} | |
| − | + | ||
| − | + | {{f/sec|<nowiki>=== Return to where the code left off ===</nowiki>}} | |
| − | + | 001961b4: 1040000a beq r2,r0,0x001961e0 {{f/Cond|If AI 0x19b7 <> 0x00 - Read Control variable}} | |
| − | + | 001961b8: afbf0014 sw r31,0x0014(r29) | | |
| − | + | 001961bc: 3c03801a lui r3,0x801a | | |
| − | + | 001961c0: 90630299 lbu r3,0x0299(r3) |{{f/load|AI 0xe5d (this routine memory variable)}} {{f/std| 0x801a0299}} | |
| − | + | 001961c4: 34020004 ori r2,r0,0x0004 | | |
| − | + | 001961c8: 10620008 beq r3,r2,0x001961ec {{f/Cond|<nowiki>if AI 0xe5d = 0x04</nowiki>}} {{f/loc|Return to Evaluate best destination}} | |
| − | + | 001961cc: 34020002 ori r2,r0,0x0002 | | |
| − | + | 001961d0: 1062000f beq r3,r2,0x00196210 {{f/Cond|<nowiki>if AI 0xe5d = 0x02</nowiki>}} {{f/loc|Return to Evaluate best destination if Caster is charging}} | |
| − | + | 001961d4: 00000000 nop | | |
| − | + | 001961d8: 08065894 j 0x00196250 {{f/Cond|<nowiki>Else (AI 0xe5d = 0x7) </nowiki>}} {{f/loc|Return to Abilities evaluation}} | |
| − | + | 001961dc: 00000000 nop | | |
| − | + | ||
| − | + | {{f/sec|<nowiki>=== Proceed to AI non specific auto battle (from beginning) ===</nowiki>}} | |
| − | + | '''<nowiki>Else : AI 0x19b7 = 0x00</nowiki>''' | |
| − | + | 001961e0: 34020001 ori r2,r0,0x0001 | | |
| − | + | 001961e4: 3c01801a lui r1,0x801a | | |
| − | + | 001961e8: a02201f1 sb r2,0x01f1(r1) |{{f/store|Store 0x01 at 8019f3c4 + 0x0e2d}} {{f/std| Consider moving toward target}} | |
| − | + | ||
| − | + | {{f/sec|--- Evaluate best destination ---}} | |
| − | + | 001961ec: 0c0658e3 jal 0x0019638c |{{f/jal|Map movement decision/data setting|Map movement decision/data setting}} {{f/std|Set best Tile to move on and store it in AI 0xcc4}} | |
| − | + | 001961f0: 00000000 nop | | |
| − | + | 001961f4: 2403ffff addiu r3,r0,-0x0001 | | |
| − | + | 001961f8: 1043001a beq r2,r3,0x00196264 {{f/Cond|If returned value is -0x01}} {{f/loc|<nowiki>Set AI 0xed5 = 0x04 and Exit</nowiki>}} {{f/Returns|return -0x01}} | |
| − | + | 001961fc: 34020004 ori r2,r0,0x0004 | | |
| − | + | 00196200: 0c0658c3 jal 0x0019630c |{{f/jal|Invert_Target_Priority_(0019630c)|Invert_Target_Priority_(0019630c)}} {{f/std|Store priority from considered Tile (at AI 0xcc4) and store it reverted at Table AI 0x154 + 0x1e}} | |
| − | + | 00196204: a2000e2d sb r0,0x0e2d(r16) |{{f/store|<nowiki>0xe2d = 0x0</nowiki>}} {{f/std|No Target consideration}} | |
| − | + | 00196208: 34020001 ori r2,r0,0x0001 | | |
| − | + | 0019620c: a2020e2d sb r2,0x0e2d(r16) |{{f/store|<nowiki>0xe2d = 0x1</nowiki>}} {{f/std| Consider moving closer to Target}} | |
| − | + | 00196210: 0c0657e3 jal 0x00195f8c |{{f/jal|Set_or_Remove_Charging_(00195f8c)|Set_or_Remove_Charging_(00195f8c)}} {{f/std|If Caster is Charging Simulate Movement, with or without charge}} | |
| − | + | 00196214: 00000000 nop | | |
| − | + | 00196218: 00401821 addu r3,r2,r0 | | |
| − | + | 0019621c: 2402ffff addiu r2,r0,-0x0001 | | |
| − | + | 00196220: 10620010 beq r3,r2,0x00196264 {{f/Cond|If Returned value is -0x01 :}} {{f/loc|<nowiki>Set AI 0xed5 = 0x02 and Exit</nowiki>}} {{f/Returns|Returns -0x01}} {{f/std|V_Sync alert ?}} | |
| − | + | 00196224: 34020002 ori r2,r0,0x0002 | | |
| − | + | 00196228: 34020001 ori r2,r0,0x0001 | | |
| − | + | 0019622c: 10620017 beq r3,r2,0x0019628c {{f/Cond|If returned value is 0x01}} {{f/loc|Exit}} {{f/Returns|Returns 0x00}} {{f/std|AI 0x14 Action data is better then AI 0x17fc Action data (move and cancel charged ability)}} | |
| − | + | 00196230: 00001021 addu r2,r0,r0 | | |
| − | + | 00196234: 34020001 ori r2,r0,0x0001 | | |
| − | + | 00196238: a2020e2d sb r2,0x0e2d(r16) |{{f/store|<nowiki>Set AI 0xe2d = 0x01</nowiki>}} {{f/std| Consider getting closer to Target}} | |
| − | + | 0019623c: 00002021 addu r4,r0,r0 |{{f/std|Set Look for any unit}} | |
| − | + | 00196240: 0c065f43 jal 0x00197d0c |{{f/jal|Find_which_units_are_active%3F|Find_which_units_are_active%3F}} {{f/std|Fill AI List 0xa78 with any targetable Units - returns Nb of unit in list}} | |
| − | + | 00196244: 00002821 addu r5,r0,r0 |{{f/std|Set Look for self too}} | |
| − | + | 00196248: 10400009 beq r2,r0,0x00196270 {{f/Cond|If There is no Unit to Target }} {{f/loc|Avoid Abilities evaluation}} | |
| − | + | 0019624c: 00000000 nop | | |
| − | + | ||
| − | + | {{f/sec|--- Evaluate All possible actions ---}} | |
| − | + | 00196250: 0c065f98 jal 0x00197e60 |{{f/jal|Chose_Move_from_Move_List%3F|Chose_Move_from_Move_List%3F}} {{f/std|Test All abilities in any situation - save best results in AI 0x54 to AI 0x134}} | |
| − | + | 00196254: 00000000 nop | | |
| − | + | 00196258: 2403ffff addiu r3,r0,-0x0001 | | |
| − | + | 0019625c: 14430004 bne r2,r3,0x00196270 {{f/Cond|If returned value is not -0x01 :}} {{f/loc|Avoid routine abortion}} | |
| − | + | 00196260: 34020007 ori r2,r0,0x0007 | | |
| − | + | '''<nowiki>Else : r2 = -0x01 </nowiki>''' | |
| − | + | ||
| − | + | {{f/sec|<nowiki>=== Abort section ===</nowiki>}} | |
| − | + | 00196264: a2020ed5 sb r2,0x0ed5(r16) |{{f/store|Update this routine control variable}} | |
| − | + | 00196268: 080658a3 j 0x0019628c |{{f/loc|Exit}} {{f/Returns|Return -0x01}} | |
| − | + | 0019626c: 2402ffff addiu r2,r0,-0x0001 | | |
| − | + | ||
| − | + | {{f/sec|<nowiki>=== Select best action and store it at AI 0x17fc ===</nowiki>}} | |
| + | 00196270: 0c065c2f jal 0x001970bc |{{f/jal|Randomly_Transfer_Data|Randomly_Transfer_Data}} {{f/std|Set selected action in AI 0x17fc}} | ||
| + | 00196274: 00000000 nop | | ||
| + | 00196278: 14400004 bne r2,r0,0x0019628c {{f/Cond|If No Action selected}} | ||
| + | 0019627c: 00001021 addu r2,r0,r0 | | ||
| + | 00196280: 0c066526 jal 0x00199498 |{{f/jal|Tranfer_AI_Ability_Data_and_Set_Defend_flag_(00199498)|Tranfer_AI_Ability_Data_and_Set_Defend_flag_(00199498)}} {{f/std|Set Selected action to move and use Defend if possible}} | ||
| + | 00196284: a2000e2d sb r0,0x0e2d(r16) |{{f/store|<nowiki>AI 0xe2d = 0x00</nowiki>}} {{f/std| No target consideration}} | ||
| + | 00196288: 00001021 addu r2,r0,r0 |{{f/Returns|Returns 0x00}} | ||
| + | 0019628c: 8fbf0014 lw r31,0x0014(r29) | ||
| + | 00196290: 8fb00010 lw r16,0x0010(r29) | ||
| + | 00196294: 27bd0018 addiu r29,r29,0x0018 | ||
| + | 00196298: 03e00008 jr r31 | ||
| + | 0019629c: 00000000 nop | ||
| + | ===Return locations=== | ||
| + | '''BATTLE.BIN''' | ||
| + | 00195f38: [[AI_Initial_Targeting_Selection]] | ||
| + | 00198e44: [[Save_Fading_Life_-_Auto_Battle_(00198df0)]] | ||
Latest revision as of 06:33, 11 July 2024
BATTLE.BIN : - Non-Specific AI AutoBattle (Enemies)
Test any combination of [Ability / Destination /Targeted Tile] and store selected action data in AI 0x17fc
------------------------------------------------------------------------------------------
Parameter : Nothing
Return : r2 = 0x00 (default)
r2 = -0x01 (Abort on Vsync alert ?)
------------------------------------------------------------------------------------------
0019619c: 3c02801a lui r2,0x801a |
001961a0: 90420d7b lbu r2,0x0d7b(r2) |Load AI 0x19b7 Flag to return where the code stops after a V_Sync alert (refresh animation on screen ?)
001961a4: 27bdffe8 addiu r29,r29,-0x0018 |
001961a8: afb00010 sw r16,0x0010(r29) |
001961ac: 3c10801a lui r16,0x801a |
001961b0: 2610f3c4 addiu r16,r16,-0x0c3c |8019f3c4
=== Return to where the code left off ===
001961b4: 1040000a beq r2,r0,0x001961e0 #If AI 0x19b7 <> 0x00 - Read Control variable
001961b8: afbf0014 sw r31,0x0014(r29) |
001961bc: 3c03801a lui r3,0x801a |
001961c0: 90630299 lbu r3,0x0299(r3) |AI 0xe5d (this routine memory variable) 0x801a0299
001961c4: 34020004 ori r2,r0,0x0004 |
001961c8: 10620008 beq r3,r2,0x001961ec #if AI 0xe5d = 0x04 Return to Evaluate best destination
001961cc: 34020002 ori r2,r0,0x0002 |
001961d0: 1062000f beq r3,r2,0x00196210 #if AI 0xe5d = 0x02 Return to Evaluate best destination if Caster is charging
001961d4: 00000000 nop |
001961d8: 08065894 j 0x00196250 #Else (AI 0xe5d = 0x7) Return to Abilities evaluation
001961dc: 00000000 nop |
=== Proceed to AI non specific auto battle (from beginning) ===
Else : AI 0x19b7 = 0x00
001961e0: 34020001 ori r2,r0,0x0001 |
001961e4: 3c01801a lui r1,0x801a |
001961e8: a02201f1 sb r2,0x01f1(r1) |Store 0x01 at 8019f3c4 + 0x0e2d Consider moving toward target
--- Evaluate best destination ---
001961ec: 0c0658e3 jal 0x0019638c |-->Map movement decision/data setting Set best Tile to move on and store it in AI 0xcc4
001961f0: 00000000 nop |
001961f4: 2403ffff addiu r3,r0,-0x0001 |
001961f8: 1043001a beq r2,r3,0x00196264 #If returned value is -0x01 Set AI 0xed5 = 0x04 and Exit return -0x01
001961fc: 34020004 ori r2,r0,0x0004 |
00196200: 0c0658c3 jal 0x0019630c |-->Invert_Target_Priority_(0019630c) Store priority from considered Tile (at AI 0xcc4) and store it reverted at Table AI 0x154 + 0x1e
00196204: a2000e2d sb r0,0x0e2d(r16) |0xe2d = 0x0 No Target consideration
00196208: 34020001 ori r2,r0,0x0001 |
0019620c: a2020e2d sb r2,0x0e2d(r16) |0xe2d = 0x1 Consider moving closer to Target
00196210: 0c0657e3 jal 0x00195f8c |-->Set_or_Remove_Charging_(00195f8c) If Caster is Charging Simulate Movement, with or without charge
00196214: 00000000 nop |
00196218: 00401821 addu r3,r2,r0 |
0019621c: 2402ffff addiu r2,r0,-0x0001 |
00196220: 10620010 beq r3,r2,0x00196264 #If Returned value is -0x01 : Set AI 0xed5 = 0x02 and Exit Returns -0x01 V_Sync alert ?
00196224: 34020002 ori r2,r0,0x0002 |
00196228: 34020001 ori r2,r0,0x0001 |
0019622c: 10620017 beq r3,r2,0x0019628c #If returned value is 0x01 Exit Returns 0x00 AI 0x14 Action data is better then AI 0x17fc Action data (move and cancel charged ability)
00196230: 00001021 addu r2,r0,r0 |
00196234: 34020001 ori r2,r0,0x0001 |
00196238: a2020e2d sb r2,0x0e2d(r16) |Set AI 0xe2d = 0x01 Consider getting closer to Target
0019623c: 00002021 addu r4,r0,r0 |Set Look for any unit
00196240: 0c065f43 jal 0x00197d0c |-->Find_which_units_are_active%3F Fill AI List 0xa78 with any targetable Units - returns Nb of unit in list
00196244: 00002821 addu r5,r0,r0 |Set Look for self too
00196248: 10400009 beq r2,r0,0x00196270 #If There is no Unit to Target Avoid Abilities evaluation
0019624c: 00000000 nop |
--- Evaluate All possible actions ---
00196250: 0c065f98 jal 0x00197e60 |-->Chose_Move_from_Move_List%3F Test All abilities in any situation - save best results in AI 0x54 to AI 0x134
00196254: 00000000 nop |
00196258: 2403ffff addiu r3,r0,-0x0001 |
0019625c: 14430004 bne r2,r3,0x00196270 #If returned value is not -0x01 : Avoid routine abortion
00196260: 34020007 ori r2,r0,0x0007 |
Else : r2 = -0x01
=== Abort section ===
00196264: a2020ed5 sb r2,0x0ed5(r16) |Update this routine control variable
00196268: 080658a3 j 0x0019628c |Exit Return -0x01
0019626c: 2402ffff addiu r2,r0,-0x0001 |
=== Select best action and store it at AI 0x17fc ===
00196270: 0c065c2f jal 0x001970bc |-->Randomly_Transfer_Data Set selected action in AI 0x17fc
00196274: 00000000 nop |
00196278: 14400004 bne r2,r0,0x0019628c #If No Action selected
0019627c: 00001021 addu r2,r0,r0 |
00196280: 0c066526 jal 0x00199498 |-->Tranfer_AI_Ability_Data_and_Set_Defend_flag_(00199498) Set Selected action to move and use Defend if possible
00196284: a2000e2d sb r0,0x0e2d(r16) |AI 0xe2d = 0x00 No target consideration
00196288: 00001021 addu r2,r0,r0 |Returns 0x00
0019628c: 8fbf0014 lw r31,0x0014(r29)
00196290: 8fb00010 lw r16,0x0010(r29)
00196294: 27bd0018 addiu r29,r29,0x0018
00196298: 03e00008 jr r31
0019629c: 00000000 nop
Return locations
BATTLE.BIN 00195f38: AI_Initial_Targeting_Selection 00198e44: Save_Fading_Life_-_Auto_Battle_(00198df0)