Weapon Range Routine

From Final Fantasy Hacktics Wiki
Revision as of 02:11, 30 March 2025 by Nyzer (talk | contribs)
Jump to navigation Jump to search

DUPLICATED Set_targeting_for_weapon_attack

00179a20: 27bdffe0 addiu r29,r29,0xffe0                           
00179a24: 00803821 addu r7,r4,r0                          Caster ID = r7   
00179a28: afbf0018 sw r31,0x0018(r29)                           
00179a2c: afb10014 sw r17,0x0014(r29)                           
00179a30: afb00010 sw r16,0x0010(r29)                           
00179a34: 90f10048 lbu r17,0x0048(r7)                     Caster Y      
00179a38: 3c02800e lui r2,0x800e                           
00179a3c: 90424e9c lbu r2,0x4e9c(r2)                      Max Map X      
00179a40: 00000000 nop                           
00179a44: 02220018 mult r17,r2                            Caster Y * Max X
00179a48: 90e4001d lbu r4,0x001d(r7)                      Caster Right hand Weapon      
00179a4c: 90e2005a lbu r2,0x005a(r7)                      Caster Cur. Status 3      
00179a50: 90f00047 lbu r16,0x0047(r7)                     Caster X      
00179a54: 30420002 andi r2,r2,0x0002                      Check for Frog      
00179a58: 00001812 mflo r3                           
00179a5c: 10400002 beq r2,r0,0x00179a68                   If Caster is Frogged      
00179a60: 02032821 addu r5,r16,r3                         Caster Y * Max X + Caster X   
00179a64: 00002021 addu r4,r0,r0                          Right Hand is empty   
00179a68: 308300ff andi r3,r4,0x00ff                      Rh weapon/frog = r3      
00179a6c: 340200ff ori r2,r0,0x00ff                           
00179a70: 14620006 bne r3,r2,0x00179a8c                   If Caster has a Rh weapon      
00179a74: 00000000 nop                           
00179a78: 90e4001f lbu r4,0x001f(r7)                      Caster Left Hand Weapon      
00179a7c: 00000000 nop                           
00179a80: 14830003 bne r4,r3,0x00179a90                   If Caster has a Lh weapon      
00179a84: 308200ff andi r2,r4,0x00ff                           
00179a88: 00002021 addu r4,r0,r0                          Left Hand is empty   
00179a8c: 308200ff andi r2,r4,0x00ff                      r2 = weapon      
00179a90: 2c420080 sltiu r2,r2,0x0080                     set if weapon      
00179a94: 14400002 bne r2,r0,0x00179aa0                   Is item in hand a weapon?      
00179a98: 00051880 sll r3,r5,0x02                           
00179a9c: 00002021 addu r4,r0,r0                           
00179aa0: 000420c0 sll r4,r4,0x03                           
00179aa4: 3c028006 lui r2,0x8006                           
00179aa8: 24423ab8 addiu r2,r2,0x3ab8                     Get Weapon data      
00179aac: 00822021 addu r4,r4,r2                          point to weapon in hand   
00179ab0: 00651821 addu r3,r3,r5                           
00179ab4: 3c028019 lui r2,0x8019                           
00179ab8: 24422dd8 addiu r2,r2,0x2dd8                           
00179abc: 00622821 addu r5,r3,r2                          Get Caster tile   
00179ac0: 24420500 addiu r2,r2,0x0500                           
00179ac4: 00621821 addu r3,r3,r2                          Get Caster tile + 500 (high tile?)   
00179ac8: 34020001 ori r2,r0,0x0001                           
00179acc: 90880000 lbu r8,0x0000(r4)                      Get Weapon Range(r8)      
00179ad0: 90860001 lbu r6,0x0001(r4)                      Get Weapon Attack Flags(r6)      
00179ad4: 25040001 addiu r4,r8,0x0001                     r4 = Range + 1      
00179ad8: a0a40000 sb r4,0x0000(r5)                       Save Weapon Range to Caster Panel   
00179adc: a0640000 sb r4,0x0000(r3)                       Save Weapon Range to Caster Panel+   
00179ae0: a0a20001 sb r2,0x0001(r5)                       Caster panel is targeted   
00179ae4: 30c200c0 andi r2,r6,0x00c0                      Is Weapon Striking/Lunging?      
00179ae8: 10400005 beq r2,r0,0x00179b00                   Branch if false      
00179aec: 00e02021 addu r4,r7,r0                          Save Caster data to r4   
00179af0: 0c05e6d6 jal 0x00179b58                         Strike/Lunge Routine
00179af4: 00c02821 addu r5,r6,r0                          Save Weapon Attack Flags   
00179af8: 0805e6ce j 0x00179b38                           Jump to Select Target
00179afc: 00000000 nop                           
00179b00: 30c20020 andi r2,r6,0x0020                      If Weapon is Direct      
00179b04: 10400009 beq r2,r0,0x00179b2c                   branch to Arc Range Routine if false      
00179b08: 01002021 addu r4,r8,r0                          Store Weapon Range   
00179b0c: 0c05e546 jal 0x00179518                         Calculate Tiles Hit by Ability   
00179b10: 00002821 addu r5,r0,r0                            
00179b14: 02002021 addu r4,r16,r0                         Save Caster X   
00179b18: 02202821 addu r5,r17,r0                         Save Caster Y   
00179b1c: 0c05e509 jal 0x00179424                         Remove Close Range Routine   
00179b20: 34060002 ori r6,r0,0x0002                           
00179b24: 0805e6ce j 0x00179b38                           jump to Select Target
00179b28: 00000000 nop                           
00179b2c: 00e02021 addu r4,r7,r0                          Save Caster data   
00179b30: 0c05e62c jal 0x001798b0                         Arc Range Calculation Routine   
00179b34: 01002821 addu r5,r8,r0                          save Weapon Range   
00179b38: 0c05e761 jal 0x00179d84                         Can Select Target Tile Routine   
00179b3c: 00000000 nop                           
00179b40: 8fbf0018 lw r31,0x0018(r29)                           
00179b44: 8fb10014 lw r17,0x0014(r29)                           
00179b48: 8fb00010 lw r16,0x0010(r29)                           
00179b4c: 27bd0020 addiu r29,r29,0x0020                           
00179b50: 03e00008 jr r31                           
00179b54: 00000000 nop