Difference between revisions of "Weapon Range Routine"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<pre>
+
00179a20: 27bdffe0 addiu r29,r29,0xffe0                         
00179a20:
+
00179a24: 00803821 addu r7,r4,r0                         Caster ID = r7  
00000000: 27bdffe0 addiu r29,r29,-0x0020
+
00179a28: afbf0018 sw r31,0x0018(r29)                          
00000004: 00803821 addu r7,r4,r0 Caster ID = r7
+
00179a2c: afb10014 sw r17,0x0014(r29)                          
00000008: afbf0018 sw r31,0x0018(r29)
+
00179a30: afb00010 sw r16,0x0010(r29)                          
0000000c: afb10014 sw r17,0x0014(r29)
+
00179a34: 90f10048 lbu r17,0x0048(r7)                     Caster Y    
00000010: afb00010 sw r16,0x0010(r29)
+
00179a38: 3c02800e lui r2,0x800e                          
00000014: 90f10048 lbu r17,0x0048(r7) Caster Y
+
00179a3c: 90424e9c lbu r2,0x4e9c(r2)                     Max Map X    
00000018: 3c02800e lui r2,0x800e
+
00179a40: 00000000 nop                          
0000001c: 90424e9c lbu r2,0x4e9c(r2) Max Map X
+
00179a44: 02220018 mult r17,r2                           Caster Y * Max X
00000020: 00000000 nop
+
00179a48: 90e4001d lbu r4,0x001d(r7)                     Caster Right hand Weapon    
00000024: 02220018 mult r17,r2 Caster Y * Max X
+
00179a4c: 90e2005a lbu r2,0x005a(r7)                     Caster Cur. Status 3    
00000028: 90e4001d lbu r4,0x001d(r7) Caster Right hand Weapon
+
00179a50: 90f00047 lbu r16,0x0047(r7)                     Caster X    
0000002c: 90e2005a lbu r2,0x005a(r7) Caster Cur. Status 3
+
00179a54: 30420002 andi r2,r2,0x0002                     Check for Frog    
00000030: 90f00047 lbu r16,0x0047(r7) Caster X
+
00179a58: 00001812 mflo r3                          
00000034: 30420002 andi r2,r2,0x0002 Check for Frog
+
00179a5c: 10400002 beq r2,r0,0x00179a68                  If Caster is Frogged    
00000038: 00001812 mflo r3
+
00179a60: 02032821 addu r5,r16,r3                         Caster Y * Max X + Caster X  
0000003c: 10400002 beq r2,r0,0x00000048 If Caster is Frogged
+
00179a64: 00002021 addu r4,r0,r0                         Right Hand is empty  
00000040: 02032821 addu r5,r16,r3 Caster Y * Max X + Caster X
+
00179a68: 308300ff andi r3,r4,0x00ff                     Rh weapon/frog = r3    
00000044: 00002021 addu r4,r0,r0 Right Hand is empty
+
00179a6c: 340200ff ori r2,r0,0x00ff                          
00000048: 308300ff andi r3,r4,0x00ff Rh weapon/frog = r3
+
00179a70: 14620006 bne r3,r2,0x00179a8c                  If Caster has a Rh weapon    
0000004c: 340200ff ori r2,r0,0x00ff
+
00179a74: 00000000 nop                          
00000050: 14620006 bne r3,r2,0x0000006c If Caster has a Rh weapon
+
00179a78: 90e4001f lbu r4,0x001f(r7)                     Caster Left Hand Weapon    
00000054: 00000000 nop
+
00179a7c: 00000000 nop                          
00000058: 90e4001f lbu r4,0x001f(r7) Caster Left Hand Weapon
+
00179a80: 14830003 bne r4,r3,0x00179a90                  If Caster has a Lh weapon    
0000005c: 00000000 nop
+
00179a84: 308200ff andi r2,r4,0x00ff                          
00000060: 14830003 bne r4,r3,0x00000070 If Caster has a Lh weapon
+
00179a88: 00002021 addu r4,r0,r0                         Left Hand is empty  
00000064: 308200ff andi r2,r4,0x00ff
+
00179a8c: 308200ff andi r2,r4,0x00ff                     r2 = weapon    
00000068: 00002021 addu r4,r0,r0 Left Hand is empty
+
00179a90: 2c420080 sltiu r2,r2,0x0080                     set if weapon     
0000006c: 308200ff andi r2,r4,0x00ff r2 = weapon
+
00179a94: 14400002 bne r2,r0,0x00179aa0                  Is item in hand a weapon?    
00000070: 2c420080 sltiu r2,r2,0x0080
+
00179a98: 00051880 sll r3,r5,0x02                          
00000074: 14400002 bne r2,r0,0x00000080 Is item in hand a weapon?
+
00179a9c: 00002021 addu r4,r0,r0                          
00000078: 00051880 sll r3,r5,0x02
+
00179aa0: 000420c0 sll r4,r4,0x03                          
0000007c: 00002021 addu r4,r0,r0
+
00179aa4: 3c028006 lui r2,0x8006                          
00000080: 000420c0 sll r4,r4,0x03
+
00179aa8: 24423ab8 addiu r2,r2,0x3ab8                     Get Weapon data    
00000084: 3c028006 lui r2,0x8006
+
00179aac: 00822021 addu r4,r4,r2                         point to weapon in hand  
00000088: 24423ab8 addiu r2,r2,0x3ab8 Get Weapon data
+
00179ab0: 00651821 addu r3,r3,r5                          
0000008c: 00822021 addu r4,r4,r2 point to weapon in hand
+
00179ab4: 3c028019 lui r2,0x8019                          
00000090: 00651821 addu r3,r3,r5
+
00179ab8: 24422dd8 addiu r2,r2,0x2dd8                          
00000094: 3c028019 lui r2,0x8019
+
00179abc: 00622821 addu r5,r3,r2                         Get Caster tile  
00000098: 24422dd8 addiu r2,r2,0x2dd8
+
00179ac0: 24420500 addiu r2,r2,0x0500                          
0000009c: 00622821 addu r5,r3,r2 Get Caster tile
+
00179ac4: 00621821 addu r3,r3,r2                         Get Caster tile + 500 (high tile?)  
000000a0: 24420500 addiu r2,r2,0x0500
+
00179ac8: 34020001 ori r2,r0,0x0001                          
000000a4: 00621821 addu r3,r3,r2 Get Caster tile + 500 (high tile?)
+
00179acc: 90880000 lbu r8,0x0000(r4)                     Get Weapon Range(r8)    
000000a8: 34020001 ori r2,r0,0x0001
+
00179ad0: 90860001 lbu r6,0x0001(r4)                     Get Weapon Attack Flags(r6)    
000000ac: 90880000 lbu r8,0x0000(r4) Get Weapon Range(r8)
+
00179ad4: 25040001 addiu r4,r8,0x0001                     r4 = Range + 1    
000000b0: 90860001 lbu r6,0x0001(r4) Get Weapon Attack Flags(r6)
+
00179ad8: a0a40000 sb r4,0x0000(r5)                       Save Weapon Range to Caster Panel  
000000b4: 25040001 addiu r4,r8,0x0001 r4 = Range + 1
+
00179adc: a0640000 sb r4,0x0000(r3)                       Save Weapon Range to Caster Panel+  
000000b8: a0a40000 sb r4,0x0000(r5) Save Weapon Range to Caster Panel
+
00179ae0: a0a20001 sb r2,0x0001(r5)                       Caster panel is targeted  
000000bc: a0640000 sb r4,0x0000(r3) Save Weapon Range to Caster Panel+
+
00179ae4: 30c200c0 andi r2,r6,0x00c0                     Is Weapon Striking/Lunging?    
000000c0: a0a20001 sb r2,0x0001(r5) Caster panel is targeted
+
00179ae8: 10400005 beq r2,r0,0x00179b00                  Branch if false    
000000c4: 30c200c0 andi r2,r6,0x00c0 Is Weapon Striking/Lunging?
+
00179aec: 00e02021 addu r4,r7,r0                         Save Caster data to r4  
000000c8: 10400005 beq r2,r0,0x000000e0 Branch if false
+
00179af0: 0c05e6d6 jal 0x00179b58                         [[Strike/Lunge Routine]]
000000cc: 00e02021 addu r4,r7,r0 Save Caster data to r4
+
00179af4: 00c02821 addu r5,r6,r0                         Save Weapon Attack Flags  
000000d0: 0c05e6d6 jal 0x00179b58 Strike/Lunge Routine
+
00179af8: 0805e6ce j 0x00179b38                           Jump to Select Target
000000d4: 00c02821 addu r5,r6,r0 Save Weapon Attack Flags
+
00179afc: 00000000 nop                          
000000d8: 0805e6ce j 0x00179b38 Jump to Select Target
+
00179b00: 30c20020 andi r2,r6,0x0020                     If Weapon is Direct    
000000dc: 00000000 nop
+
00179b04: 10400009 beq r2,r0,0x00179b2c                  branch to Arc Range Routine if false    
000000e0: 30c20020 andi r2,r6,0x0020 If Weapon is Direct
+
00179b08: 01002021 addu r4,r8,r0                         Store Weapon Range  
000000e4: 10400009 beq r2,r0,0x0000010c branch to Arc Range Routine if false
+
00179b0c: 0c05e546 jal 0x00179518                         [[Calculate Tiles Hit by Ability]] 
000000e8: 01002021 addu r4,r8,r0 Store Weapon Range
+
00179b10: 00002821 addu r5,r0,r0                          
000000ec: 0c05e546 jal 0x00179518 Limit Range to Map Function
+
00179b14: 02002021 addu r4,r16,r0                         Save Caster X  
000000f0: 00002821 addu r5,r0,r0
+
00179b18: 02202821 addu r5,r17,r0                         Save Caster Y  
000000f4: 02002021 addu r4,r16,r0 Save Caster X
+
00179b1c: 0c05e509 jal 0x00179424                         [[Remove Close Range Routine]] 
000000f8: 02202821 addu r5,r17,r0 Save Caster Y
+
00179b20: 34060002 ori r6,r0,0x0002                          
000000fc: 0c05e509 jal 0x00179424 Remove Close Range Routine
+
00179b24: 0805e6ce j 0x00179b38                           jump to Select Target
00000100: 34060002 ori r6,r0,0x0002
+
00179b28: 00000000 nop                          
00000104: 0805e6ce j 0x00179b38 jump to Select Target
+
00179b2c: 00e02021 addu r4,r7,r0                         Save Caster data  
00000108: 00000000 nop
+
00179b30: 0c05e62c jal 0x001798b0                         [[Arc Range Calculation Routine]] 
0000010c: 00e02021 addu r4,r7,r0 Save Caster data
+
00179b34: 01002821 addu r5,r8,r0                         save Weapon Range  
00000110: 0c05e62c jal 0x001798b0 Arc Range Calculation Routine
+
00179b38: 0c05e761 jal 0x00179d84                         [[Can Select Target Tile Routine]] 
00000114: 01002821 addu r5,r8,r0 save Weapon Range
+
00179b3c: 00000000 nop                          
00000118: 0c05e761 jal 0x00179d84 Can Select Target Tile Routine
+
00179b40: 8fbf0018 lw r31,0x0018(r29)                          
0000011c: 00000000 nop
+
00179b44: 8fb10014 lw r17,0x0014(r29)                          
00000120: 8fbf0018 lw r31,0x0018(r29)
+
00179b48: 8fb00010 lw r16,0x0010(r29)                          
00000124: 8fb10014 lw r17,0x0014(r29)
+
00179b4c: 27bd0020 addiu r29,r29,0x0020                          
00000128: 8fb00010 lw r16,0x0010(r29)
+
00179b50: 03e00008 jr r31                          
0000012c: addiu r29,r29,0x0020
+
00179b54: 00000000 nop
00000130: jr r31
 
00000134: nop
 
</pre>
 
 
 
*[[Strike/Lunge Routine]]
 
*[[Limit Range to Map Function]]
 
*[[Remove Close Range Routine]]
 
*[[Arc Range Calculation Routine]]
 
*[[Can Select Target Tile Routine]]
 

Latest revision as of 02:33, 30 March 2025

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