Store Weapon Attack Data
Jump to navigation
Jump to search
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