Difference between revisions of "Store Weapon? Attack Data"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " Store Weapon? Attack Data 0019a52c: 340200ff ori r2,r0,0x00ff r2 = FF 0019a530: 10a2002f beq r5,r2,0x 0019a5f0 Branch if Unarmed 0019a534: 000510c0 sll r2,r5,0x03 ID * ...")
 
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
  Store Weapon? Attack Data
+
Parameters : {{f/adr|<nowiki>r4 = Unit's AI Attack data pointer </nowiki>}}- ( 0x8019f3c4 + 0x1778 + Unit's AI Battle ID) - AI Battle ID (0x8019f3c4 + 0x198c + Unit ID)
  0019a52c: 340200ff ori r2,r0,0x00ff r2 = FF
+
              r5 = Equiped Weapon ID
  0019a530: 10a2002f beq r5,r2,0x 0019a5f0 Branch if Unarmed
+
              {{f/adr|<nowiki>r6 = Previous Routine Stack pointer</nowiki>}}
  0019a534: 000510c0 sll r2,r5,0x03 ID * 8
+
  0019a538: 3c038006 lui r3,0x8006
+
Returns : Nothing
  0019a53c: 24633ab8 addiu r3,r3,0x3ab8
+
  0019a540: 00433821 addu r7,r2,r3
+
Udpate Some AI Attacks data
  0019a544: 90e30001 lbu r3,0x0001(r7) Load Weapon's Attack Flags
+
  - 0x00 AI Weapon Range (left hand range will overwrite Right one if two weapons are equiped)
  0019a548: 00000000 nop
+
  - 0x03 AI Behavior flag's 3 : if weapon is arcing or direct
  0019a54c: 30620010 andi r2,r3,0x0010
+
  - 0x04 AI Weapon ID - (left hand ID will overwrite Right one if two weapons are equiped)
  0019a550: 10400004 beq r2,r0,0x 0019a564 Branch if not Arcing
+
  - 0x05 AI Attack Elements
  0019a554: 00000000 nop
+
  Store some flags on Previous routine stack (0x01 if normal weapon - 0x02 if weapon absorbs HP - 0x04 if Weapon Heal HP)
  0019a558: 90820003 lbu r2,0x0003(r4) Load AI Behavior Flags 3
+
Note : Flags are hardcoded to formula (0x06 and 0x07)
  0019a55c: 0806695f j 0x 0019a57c
+
--------------------------------------------------------------------------------------------------------
  0019a560: 34420080 ori r2,r2,0x0080 Enable Arc Attack?
+
  0019a52c: 340200ff ori r2,r0,0x00ff             |{{f/std|<nowiki>r2 = 0x0ff</nowiki>}}
  0019a564: 30620020 andi r2,r3,0x0020
+
  0019a530: 10a2002f beq r5,r2,0x0019a5f0        {{f/Cond|If Weapon Exists}} /Else Branch to  {{f/loc|END}}
  0019a568: 10400005 beq r2,r0,0x 0019a580 Branch if not Direct
+
  0019a534: 000510c0 sll r2,r5,0x03                   |{{f/std|<nowiki>r2 = Weapon ID * 8</nowiki>}}
  0019a56c: 00000000 nop
+
  0019a538: 3c038006 lui r3,0x8006                   |
  0019a570: 90820003 lbu r2,0x0003(r4) Load AI Behavior Flags 3
+
  0019a53c: 24633ab8 addiu r3,r3,0x3ab8               |{{f/std|<nowiki>r3 = 0x80063ab8 (1st Weapon secondary data pointer)</nowiki>}}
  0019a574: 00000000 nop
+
  0019a540: 00433821 addu r7,r2,r3                   |{{f/adr|<nowiki>r7 = Equiped Weapon's secondary data pointer</nowiki>}}
  0019a578: 34420040 ori r2,r2,0x0040 Enable Enable Direct Attack
+
  0019a544: 90e30001 lbu r3,0x0001(r7)               |{{f/load|<nowiki>r3 = Equiped Weapon's Attack Flags</nowiki>}}
  0019a57c: a0820003 sb r2,0x0003(r4) Store new AI Behavior Flags 3
+
  0019a548: 00000000 nop                             |
  0019a580: 90e30002 lbu r3,0x0002(r7) Load Weapon's Formula
+
  0019a54c: 30620010 andi r2,r3,0x0010               |{{f/std|<nowiki>r2 = 0x10 if Weapon is Arcing</nowiki>}}
  0019a584: 34020006 ori r2,r0,0x0006 r2 = 6
+
  0019a550: 10400004 beq r2,r0,0x0019a564            {{f/Cond|If Weapon is Arcing}} /Branch if not Arcing
  0019a588: 10620006 beq r3,r2,0x 0019a5a4 Branch if Formula = HP Absorb Weapon
+
  0019a554: 00000000 nop                                 |
  0019a58c: 00000000 nop
+
  0019a558: 90820003 lbu r2,0x0003(r4)                   |{{f/load|Load Unit's AI Behavior Flags 3 }}
  0019a590: 34020007 ori r2,r0,0x0007
+
  0019a55c: 0806695f j 0x0019a57c                        {{f/jump|Jump to Store new flags section}}
  0019a594: 10620006 beq r3,r2,0x 0019a5b0 Branch if Formula = Healing Weapon
+
  0019a560: 34420080 ori r2,r2,0x0080                     |{{f/std|<nowiki>r2 = Flags updated with Arcing weapon</nowiki>}}
  0019a598: 00000000 nop
+
  0019a564: 30620020 andi r2,r3,0x0020               |{{f/std|<nowiki>r2 = 0x20 if Weapon is Direct</nowiki>}}
  0019a59c: 0806696f j 0x 0019a5bc
+
  0019a568: 10400005 beq r2,r0,0x0019a580            {{f/Cond|If Weapon is Direct}}
  0019a5a0: 00000000 nop
+
  0019a56c: 00000000 nop                                 |
  0019a5a4: 8cc20000 lw r2,0x0000(r6) Load Stack Flags
+
  0019a570: 90820003 lbu r2,0x0003(r4)                   |{{f/load|Load Unit's AI Behavior Flags 3 }}
  0019a5a8: 08066972 j 0x 0019a5c8
+
  0019a574: 00000000 nop                                 |
  0019a5ac: 34420002 ori r2,r2,0x0002 Enable 0x02 (absorption)
+
  0019a578: 34420040 ori r2,r2,0x0040                     |{{f/std|<nowiki>r2 = Flags updated with Direct Weapon</nowiki>}}
  0019a5b0: 8cc20000 lw r2,0x0000(r6) Load Stack Flags
+
  0019a5b4: 08066972 j 0x 0019a5c8
+
  0019a57c: a0820003 sb r2,0x0003(r4)             >j      |{{f/store|Store new Unit's AI Behavior Flags 3}}  {{f/std|(Arcing section's jump landing site)}}
  0019a5b8: 34420004 ori r2,r2,0x0004 Enable 0x04 (healing)
+
  0019a580: 90e30002 lbu r3,0x0002(r7)               |{{f/load|<nowiki>r3 = Weapon's Formula</nowiki>}}
  0019a5bc: 8cc20000 lw r2,0x0000(r6) Load Stack Flags
+
  0019a584: 34020006 ori r2,r0,0x0006                 |{{f/std|<nowiki>r2 = 0x06</nowiki>}}
  0019a5c0: 00000000 nop
+
  0019a588: 10620006 beq r3,r2,0x0019a5a4            {{f/Cond|If Weapon Formula is not 0x06 (Absord HP)}}
  0019a5c4: 34420001 ori r2,r2,0x0001 Enable 0x01 (normal)
+
  0019a58c: 00000000 nop                                 |
  0019a5c8: acc20000 sw r2,0x0000(r6) Store new Stack Flags
+
  0019a590: 34020007 ori r2,r0,0x0007                     |{{f/std|<nowiki>r2 = 0x07</nowiki>}}
  0019a5cc: a0850004 sb r5,0x0004(r4) Store Weapon ID
+
  0019a594: 10620006 beq r3,r2,0x0019a5b0                {{f/Cond|If Weapon Formula is not 0x07 (Heal HP)}}
  0019a5d0: 90e20000 lbu r2,0x0000(r7) Load Weapon Range
+
  0019a598: 00000000 nop                                     |
  0019a5d4: 00000000 nop
+
  0019a59c: 0806696f j 0x0019a5bc                            {{f/jump|jump to default flag}}
  0019a5d8: a0820000 sb r2,0x0000(r4) Store Weapon Range
+
  0019a5a0: 00000000 nop                                     |
  0019a5dc: 90820005 lbu r2,0x0005(r4) Load Attack Elements
+
                                                    {{f/loc|Formula 0x06 section}}
  0019a5e0: 90e30006 lbu r3,0x0006(r7) Load Weapon's Elements
+
  0019a5a4: 8cc20000 lw r2,0x0000(r6)                     |{{f/load|<nowiki>r2 = Flags on Previous Routine Stack</nowiki>}}
  0019a5e4: 00000000 nop
+
  0019a5a8: 08066972 j 0x0019a5c8                        {{f/jump|Jump to Store Stack flag}}
  0019a5e8: 00431025 or r2,r2,r3 Enable Weapon's Elements
+
  0019a5ac: 34420002 ori r2,r2,0x0002                     |{{f/std|<nowiki>r2 = Flag Value with 0x02 enabled (absorption)</nowiki>}}
  0019a5ec: a0820005 sb r2,0x0005(r4) Store new Attack Elements
+
                                                    {{f/loc|Formula 0x07 section}}
  0019a5f0: 03e00008 jr r31
+
  0019a5b0: 8cc20000 lw r2,0x0000(r6)                     |{{f/load|<nowiki>r2 = Flags on Previous Routine Stack</nowiki>}}
  0019a5f4: 00000000 nop
+
  0019a5b4: 08066972 j 0x0019a5c8                        {{f/jump|Jump to Store Stack flag}}
 +
  0019a5b8: 34420004 ori r2,r2,0x0004                     |{{f/std|<nowiki>r2 = Flag Value with 0x04 enabled (Healing)</nowiki>}}
 +
                                                    {{f/loc|Other weapon's formula section}}
 +
  0019a5bc: 8cc20000 lw r2,0x0000(r6)                     |{{f/load|<nowiki>r2 = Flags on Previous Routine Stack</nowiki>}}
 +
  0019a5c0: 00000000 nop                                 |
 +
  0019a5c4: 34420001 ori r2,r2,0x0001                     |{{f/std|<nowiki>r2 = Flag Value with 0x01 enabled (Normal)</nowiki>}}
 +
  0019a5c8: acc20000 sw r2,0x0000(r6)                 |{{f/store|Store Updated Stack Flags}}
 +
  0019a5cc: a0850004 sb r5,0x0004(r4)                 |{{f/store|Store Weapon ID on Unit's AI Attack data}}
 +
  0019a5d0: 90e20000 lbu r2,0x0000(r7)               |{{f/load|<nowiki>r2 = Equipped Weapon Range</nowiki>}}
 +
  0019a5d4: 00000000 nop                             |
 +
  0019a5d8: a0820000 sb r2,0x0000(r4)                 |{{f/store|Store Weapon Range in AI Attacks data}}
 +
  0019a5dc: 90820005 lbu r2,0x0005(r4)               |{{f/load|<nowiki>r2 = Unit's AI Attack Elements</nowiki>}}
 +
  0019a5e0: 90e30006 lbu r3,0x0006(r7)               |{{f/load|<nowiki>r3 = Equiped Weapon's Elements</nowiki>}}
 +
  0019a5e4: 00000000 nop                             |
 +
  0019a5e8: 00431025 or r2,r2,r3                     |{{f/std|<nowiki>r2 = Attacks Elements + Weapon's Elements</nowiki>}}
 +
  0019a5ec: a0820005 sb r2,0x0005(r4)                 |{{f/store|Store Updated Attack Elements}}
 +
  0019a5f0: 03e00008 jr r31                       END
 +
  0019a5f4: 00000000 nop                        
 +
 
 +
=== Return locations ===
 +
'''Battle.bin'''
 +
0019a3d0: [[Set_AI_Flags/Usable_Abilities]]
 +
0019a3e0: [[Set_AI_Flags/Usable_Abilities]]

Latest revision as of 08:12, 19 April 2023

Parameters : r4 = Unit's AI Attack data pointer - ( 0x8019f3c4 + 0x1778 + Unit's AI Battle ID) - AI Battle ID (0x8019f3c4 + 0x198c + Unit ID)
             r5 = Equiped Weapon ID
             r6 = Previous Routine Stack pointer

Returns : Nothing

Udpate Some AI Attacks data
 - 0x00 AI Weapon Range (left hand range will overwrite Right one if two weapons are equiped)
 - 0x03 AI Behavior flag's 3 : if weapon is arcing or direct
 - 0x04 AI Weapon ID - (left hand ID will overwrite Right one if two weapons are equiped)
 - 0x05 AI Attack Elements
Store some flags on Previous routine stack (0x01 if normal weapon - 0x02 if weapon absorbs HP - 0x04 if Weapon Heal HP)
Note : Flags are hardcoded to formula (0x06 and 0x07)
--------------------------------------------------------------------------------------------------------
0019a52c: 340200ff ori r2,r0,0x00ff             |r2 = 0x0ff
0019a530: 10a2002f beq r5,r2,0x0019a5f0         #If Weapon Exists /Else Branch to  END
0019a534: 000510c0 sll r2,r5,0x03                   |r2 = Weapon ID * 8
0019a538: 3c038006 lui r3,0x8006                    |
0019a53c: 24633ab8 addiu r3,r3,0x3ab8               |r3 = 0x80063ab8 (1st Weapon secondary data pointer)
0019a540: 00433821 addu r7,r2,r3                    |r7 = Equiped Weapon's secondary data pointer
0019a544: 90e30001 lbu r3,0x0001(r7)                |r3 = Equiped Weapon's Attack Flags
0019a548: 00000000 nop                              |
0019a54c: 30620010 andi r2,r3,0x0010                |r2 = 0x10 if Weapon is Arcing
0019a550: 10400004 beq r2,r0,0x0019a564             #If Weapon is Arcing /Branch if not Arcing
0019a554: 00000000 nop                                  |
0019a558: 90820003 lbu r2,0x0003(r4)                    |Load Unit's AI Behavior Flags 3 
0019a55c: 0806695f j 0x0019a57c                         >>Jump to Store new flags section
0019a560: 34420080 ori r2,r2,0x0080                     |r2 = Flags updated with Arcing weapon
0019a564: 30620020 andi r2,r3,0x0020                |r2 = 0x20 if Weapon is Direct
0019a568: 10400005 beq r2,r0,0x0019a580             #If Weapon is Direct
0019a56c: 00000000 nop                                  |
0019a570: 90820003 lbu r2,0x0003(r4)                    |Load Unit's AI Behavior Flags 3 
0019a574: 00000000 nop                                  |
0019a578: 34420040 ori r2,r2,0x0040                     |r2 = Flags updated with Direct Weapon

0019a57c: a0820003 sb r2,0x0003(r4)             >j      |Store new Unit's AI Behavior Flags 3   (Arcing section's jump landing site)
0019a580: 90e30002 lbu r3,0x0002(r7)                |r3 = Weapon's Formula
0019a584: 34020006 ori r2,r0,0x0006                 |r2 = 0x06
0019a588: 10620006 beq r3,r2,0x0019a5a4             #If Weapon Formula is not 0x06 (Absord HP)
0019a58c: 00000000 nop                                  |
0019a590: 34020007 ori r2,r0,0x0007                     |r2 = 0x07
0019a594: 10620006 beq r3,r2,0x0019a5b0                 #If Weapon Formula is not 0x07 (Heal HP)
0019a598: 00000000 nop                                      |
0019a59c: 0806696f j 0x0019a5bc                             >>jump to default flag
0019a5a0: 00000000 nop                                      |
                                                    Formula 0x06 section
0019a5a4: 8cc20000 lw r2,0x0000(r6)                     |r2 = Flags on Previous Routine Stack
0019a5a8: 08066972 j 0x0019a5c8                         >>Jump to Store Stack flag
0019a5ac: 34420002 ori r2,r2,0x0002                     |r2 = Flag Value with 0x02 enabled (absorption)
                                                    Formula 0x07 section
0019a5b0: 8cc20000 lw r2,0x0000(r6)                     |r2 = Flags on Previous Routine Stack
0019a5b4: 08066972 j 0x0019a5c8                         >>Jump to Store Stack flag
0019a5b8: 34420004 ori r2,r2,0x0004                     |r2 = Flag Value with 0x04 enabled (Healing)
                                                    Other weapon's formula section
0019a5bc: 8cc20000 lw r2,0x0000(r6)                     |r2 = Flags on Previous Routine Stack
0019a5c0: 00000000 nop                                  |
0019a5c4: 34420001 ori r2,r2,0x0001                     |r2 = Flag Value with 0x01 enabled (Normal)
0019a5c8: acc20000 sw r2,0x0000(r6)                 |Store Updated Stack Flags
0019a5cc: a0850004 sb r5,0x0004(r4)                 |Store Weapon ID on Unit's AI Attack data
0019a5d0: 90e20000 lbu r2,0x0000(r7)                |r2 = Equipped Weapon Range
0019a5d4: 00000000 nop                              |
0019a5d8: a0820000 sb r2,0x0000(r4)                 |Store Weapon Range in AI Attacks data
0019a5dc: 90820005 lbu r2,0x0005(r4)                |r2 = Unit's AI Attack Elements
0019a5e0: 90e30006 lbu r3,0x0006(r7)                |r3 = Equiped Weapon's Elements
0019a5e4: 00000000 nop                              |
0019a5e8: 00431025 or r2,r2,r3                      |r2 = Attacks Elements + Weapon's Elements
0019a5ec: a0820005 sb r2,0x0005(r4)                 |Store Updated Attack Elements
0019a5f0: 03e00008 jr r31                       END
0019a5f4: 00000000 nop                          

Return locations

Battle.bin
0019a3d0: Set_AI_Flags/Usable_Abilities
0019a3e0: Set_AI_Flags/Usable_Abilities