Difference between revisions of "Store used weapon"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<font face='Courier New'> 0018b274: 3c028019 lui r2,0x8019 0018b278: 904238c3 lbu r2,0x38c3(r2) load strike counter 0018b27c: 00000000 nop 0018b280: 14400005 bne r2,r0,...")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<font face='Courier New'>
+
'''Parameters :''' r4 = Attacker 0x16e pointer
 
   
 
   
  0018b274: 3c028019 lui r2,0x8019
+
Store data at 0x801938d8 (current ability used weapon)
  0018b278: 904238c3 lbu r2,0x38c3(r2) load strike counter
+
  - By default right or left hand equiped weapon (depend if it's first hit or not)
  0018b27c: 00000000 nop
+
  - If action menu is item or katana inventory : store attacker used item ID (Attacker 0x0176 - stored in pre formula stack)
  0018b280: 14400005 bne r2,r0,0x0018b298 branch if not 1st strike
+
  - If Jump or unknown 0x0f : store 0x00 (unarmed)
  0018b284: 00000000 nop
+
  - If weapon ID is 0xff : store 0x00 (weapon doesn't exist - flag for off hand with two hand weapon)
  0018b288: 3c058019 lui r5,0x8019
+
-------------------------------------------------------------------------------------------------------------------
  0018b28c: 90a538c4 lbu r5,0x38c4(r5) load right hand weapon
+
  0018b274: 3c028019 lui r2,0x8019           |
  0018b290: 08062ca8 j 0x0018b2a0
+
  0018b278: 904238c3 lbu r2,0x38c3(r2)       |{{f/load|<nowiki>r2 =  current action strike counter</nowiki>}}
  0018b294: 00000000 nop
+
  0018b27c: 00000000 nop                     |
  0018b298: 3c058019 lui r5,0x8019
+
  0018b280: 14400005 bne r2,r0,0x0018b298     {{f/Cond|<nowiki>if first strike</nowiki>}}
  0018b29c: 90a538c5 lbu r5,0x38c5(r5) load Left hand weapon
+
  0018b284: 00000000 nop                           |{{f/std|<nowiki> </nowiki>}}
  0018b2a0: 90820001 lbu r2,0x0001(r4) load skillset used
+
  0018b288: 3c058019 lui r5,0x8019                 |{{f/std|<nowiki> </nowiki>}}
  0018b2a4: 3c018006 lui r1,0x8006
+
  0018b28c: 90a538c4 lbu r5,0x38c4(r5)             |{{f/load|<nowiki>r5 = current action right hand weapon</nowiki>}}
  0018b2a8: 00220821 addu r1,r1,r2
+
  0018b290: 08062ca8 j 0x0018b2a0                 {{f/jump|<nowiki>jump post left hand section</nowiki>}}
  0018b2ac: 90235cb4 lbu r3,0x5cb4(r1) load action menu byte
+
  0018b294: 00000000 nop                           |
  0018b2b0: 00000000 nop
+
  0018b298: 3c058019 lui r5,0x8019           {{f/Cond|<nowiki>E not first strike</nowiki>}}
  0018b2b4: 2c620010 sltiu r2,r3,0x0010
+
  0018b29c: 90a538c5 lbu r5,0x38c5(r5)             |{{f/load|<nowiki>r5 = current action left hand weapon</nowiki>}} {{f/load|<nowiki>11</nowiki>}}
  0018b2b8: 1040001b beq r2,r0,0x0018b328 validity check
+
  0018b2a0: 90820001 lbu r2,0x0001(r4)       |{{f/load|<nowiki>r2 = attacker last skillset used</nowiki>}} {{f/load|<nowiki>        </nowiki>}} {{f/load|<nowiki>                                            </nowiki>}}
  0018b2bc: 00031080 sll r2,r3,0x02
+
  0018b2a4: 3c018006 lui r1,0x8006           |
  0018b2c0: 3c018017 lui r1,0x8017
+
  0018b2a8: 00220821 addu r1,r1,r2           |
  0018b2c4: 00220821 addu r1,r1,r2
+
  0018b2ac: 90235cb4 lbu r3,0x5cb4(r1)       |{{f/load|<nowiki>r3 = last used skillset action menu</nowiki>}}
  0018b2c8: 8c224304 lw r2,0x4304(r1) load return address
+
  0018b2b0: 00000000 nop                     |
  0018b2cc: 00000000 nop
+
  0018b2b4: 2c620010 sltiu r2,r3,0x0010       |{{f/std|<nowiki>r2 = 0x01 if action menu is <= 0xf (action menu exist)</nowiki>}}
  0018b2d0: 00400008 jr r2
+
  0018b2b8: 1040001b beq r2,r0,0x0018b328     {{f/Cond|<nowiki>if action menu is valid</nowiki>}} /Else go to Attack section
  0018b2d4: 00000000 nop
+
  0018b2bc: 00031080 sll r2,r3,0x02               |{{f/std|<nowiki>r2 = action menu ID * 4</nowiki>}}
00174304: 8018b2d8 lb r24,-0x4d28(r0) default
+
  0018b2c0: 3c018017 lui r1,0x8017                 |
00174308: 8018b318 lb r24,-0x4ce8(r0) Item
+
  0018b2c4: 00220821 addu r1,r1,r2                 |
0017430c: 8018b328 lb r24,-0x4cd8(r0) throw
+
  0018b2c8: 8c224304 lw r2,0x4304(r1)             |{{f/adr|<nowiki>r2 = action menu return adress </nowiki>}} {{f/jal|Action_menu_return_adress_(routine_0018b274_-_Store_used_weapon)|<nowiki>|Action_menu_return_adress</nowiki>}}
00174310: 8018b2d8 lb r24,-0x4d28(r0) math skill
+
  0018b2cc: 00000000 nop                           |
00174314: 8018b2d8 lb r24,-0x4d28(r0) elemental
+
  0018b2d0: 00400008 jr r2                         {{f/jump|<nowiki>Jump to action menu dedicated section</nowiki>}}
00174318: 8018b328 lb r24,-0x4cd8(r0) blank
+
  0018b2d4: 00000000 nop                           |
0017431c: 8018b2d8 lb r24,-0x4d28(r0) monster
+
00174320: 8018b318 lb r24,-0x4ce8(r0) katana
+
                                            {{f/com| --- Default / Math skill/ Elemental/ Monster  section---}}
00174324: 8018b328 lb r24,-0x4cd8(r0) attack
+
  0018b2d8: 84840002 lh r4,0x0002(r4)             |{{f/load|<nowiki>r4 = Attacker last used ability</nowiki>}}
00174328: 8018b324 lb r24,-0x4cdc(r0) jump
+
  0018b2dc: 00000000 nop                           |
0017432c: 8018b328 lb r24,-0x4cd8(r0) charge
+
  0018b2e0: 28820170 slti r2,r4,0x0170             |{{f/std|<nowiki>r2 = 0x01 if ability ID is < Potion</nowiki>}}
00174330: 8018b328 lb r24,-0x4cd8(r0) defend
+
  0018b2e4: 10400010 beq r2,r0,0x0018b328         {{f/Cond|<nowiki>If ability ID < Potion</nowiki>}}
00174334: 8018b328 lb r24,-0x4cd8(r0) equip change
+
  0018b2e8: 000410c0 sll r2,r4,0x03                   |{{f/std|<nowiki>r2 = ability ID * 8</nowiki>}}
00174338: 8018b328 lb r24,-0x4cd8(r0) unknown
+
  0018b2ec: 00441023 subu r2,r2,r4                     |{{f/std|<nowiki>r2 = ability ID * 7</nowiki>}}
0017433c: 8018b328 lb r24,-0x4cd8(r0) blank
+
  0018b2f0: 00021040 sll r2,r2,0x01                   |{{f/std|<nowiki>r2 = ability ID * 14</nowiki>}}
00174340: 8018b324 lb r24,-0x4cdc(r0) unknown
+
  0018b2f4: 3c018006 lui r1,0x8006                     |
Default/math skill/elemental/monster
+
  0018b2f8: 00220821 addu r1,r1,r2                     |
  0018b2d8: 84840002 lh r4,0x0002(r4) load ability
+
  0018b2fc: 9022fbf3 lbu r2,-0x040d(r1)               |{{f/load|<nowiki>r2 = Ability Data 2 flag 1</nowiki>}}
  0018b2dc: 00000000 nop
+
  0018b300: 00000000 nop                               |
  0018b2e0: 28820170 slti r2,r4,0x0170
+
  0018b304: 30420024 andi r2,r2,0x0024                 |{{f/std|<nowiki>r2 = flag 1 filtered  with weapon strike and  weapon range </nowiki>}}
  0018b2e4: 10400010 beq r2,r0,0x0018b328 branch if not regular ability
+
  0018b308: 14400008 bne r2,r0,0x0018b32c             {{f/Cond|<nowiki>If neither weapon strike nor weapon range is checked</nowiki>}} /Else branch in attack section
  0018b2e8: 000410c0 sll r2,r4,0x03
+
  0018b30c: 30a300ff andi r3,r5,0x00ff                 |{{f/std|<nowiki>r3 = weapon ID</nowiki>}}
  0018b2ec: 00441023 subu r2,r2,r4
+
  0018b310: 08062cca j 0x0018b328                         {{f/jump|<nowiki>jump in attack section (weapon will be 0x00)</nowiki>}}
  0018b2f0: 00021040 sll r2,r2,0x01
+
  0018b314: 00002821 addu r5,r0,r0                         |{{f/std|<nowiki>r5 = 0x00</nowiki>}}
  0018b2f4: 3c018006 lui r1,0x8006
+
   
  0018b2f8: 00220821 addu r1,r1,r2
+
                                            {{f/com|--- Item / Katana inventory section ---}}
  0018b2fc: 9022fbf3 lbu r2,-0x040d(r1) load ability flags 3
+
  0018b318: 90850008 lbu r5,0x0008(r4)             |{{f/load|<nowiki>r5 =  used item</nowiki>}}
  0018b300: 00000000 nop
+
  0018b31c: 08062ccb j 0x0018b32c                 {{f/jump|<nowiki>jump in attack section (weapon will be used item)</nowiki>}}
  0018b304: 30420024 andi r2,r2,0x0024
+
  0018b320: 30a300ff andi r3,r5,0x00ff             |{{f/std|<nowiki>r3 = used item</nowiki>}}
  0018b308: 14400008 bne r2,r0,0x0018b32c branch if weapon strike/ranged weapon flagged
+
   
  0018b30c: 30a300ff andi r3,r5,0x00ff r3 = weapon ID
+
                                            {{f/com|--- Jump / Unknow section}}
  0018b310: 08062cca j 0x0018b328
+
  0018b324: 00002821 addu r5,r0,r0                 |{{f/std|<nowiki>r5 = 0x00</nowiki>}}
  0018b314: 00002821 addu r5,r0,r0
+
   
  item/katana inventory
+
                                            {{f/com|---  Weapon inventory / Attack / Blank / Charge / Defend / Equip change / Unknown / Blank section ---}}
  0018b318: 90850008 lbu r5,0x0008(r4) load used item
+
  0018b328: 30a300ff andi r3,r5,0x00ff             |{{f/std|<nowiki>r3 = weapon ID  (or 0x00 if coming from jump at 18b310, used item ID jump from 18b31c)</nowiki>}}
  0018b31c: 08062ccb j 0x0018b32c
+
  0018b320: 30a300ff andi r3,r5,0x00ff r3 = used item
+
                                            {{f/com|--- Store weapon section ---}}
  jump/unknown
+
  0018b32c: 340200ff ori r2,r0,0x00ff             |{{f/std|<nowiki>r2 = 0xff</nowiki>}}
  0018b324: 00002821 addu r5,r0,r0
+
  0018b330: 14620002 bne r3,r2,0x0018b33c         {{f/Cond|<nowiki>if weapon doesn't exist</nowiki>}} /Else branch keeping r5
  weapon inventory/attack/blank/charge/defend/equip change/unknown/blank
+
  0018b334: 00000000 nop                               |{{f/std|<nowiki> </nowiki>}}
  0018b328: 30a300ff andi r3,r5,0x00ff
+
  0018b338: 00002821 addu r5,r0,r0                     |{{f/std|<nowiki>r5 = 0x00 (will be stored as used weapon)</nowiki>}}
  0018b32c: 340200ff ori r2,r0,0x00ff
+
  0018b33c: 3c018019 lui r1,0x8019                     |
  0018b330: 14620002 bne r3,r2,0x0018b33c branch if weapon exists
+
  0018b340: a02538d8 sb r5,0x38d8(r1)             |{{f/store|<nowiki>store r5 as current ability used weapon ID</nowiki>}}
  0018b334: 00000000 nop
+
  0018b344: 03e00008 jr r31                       |
  0018b338: 00002821 addu r5,r0,r0 store unarmed
+
  0018b348: 00000000 nop                          
  0018b33c: 3c018019 lui r1,0x8019
+
 
  0018b340: a02538d8 sb r5,0x38d8(r1) store used weapon ID
+
==Return location==
  0018b344: 03e00008 jr r31
+
0017d0a4: [[Main_ability_loading_routine%3F]]
  0018b348: 00000000 nop
+
0018b414: [[Pre_Formula_Setup_(FDC)]]
</font>
 

Latest revision as of 21:15, 15 February 2022

Parameters : r4 = Attacker 0x16e pointer

Store data at 0x801938d8 (current ability used weapon)
  - By default right or left hand equiped weapon (depend if it's first hit or not)
  - If action menu is item or katana inventory : store attacker used item ID (Attacker 0x0176 - stored in pre formula stack)
  - If Jump or unknown 0x0f : store 0x00 (unarmed)
  - If weapon ID is 0xff : store 0x00 (weapon doesn't exist - flag for off hand with two hand weapon)
-------------------------------------------------------------------------------------------------------------------
0018b274: 3c028019 lui r2,0x8019            |
0018b278: 904238c3 lbu r2,0x38c3(r2)        |r2 =  current action strike counter
0018b27c: 00000000 nop                      |
0018b280: 14400005 bne r2,r0,0x0018b298     #if first strike
0018b284: 00000000 nop                           | 
0018b288: 3c058019 lui r5,0x8019                 | 
0018b28c: 90a538c4 lbu r5,0x38c4(r5)             |r5 = current action right hand weapon
0018b290: 08062ca8 j 0x0018b2a0                  >>jump post left hand section
0018b294: 00000000 nop                           |
0018b298: 3c058019 lui r5,0x8019            #E not first strike
0018b29c: 90a538c5 lbu r5,0x38c5(r5)             |r5 = current action left hand weapon 11
0018b2a0: 90820001 lbu r2,0x0001(r4)        |r2 = attacker last skillset used                                                       
0018b2a4: 3c018006 lui r1,0x8006            |
0018b2a8: 00220821 addu r1,r1,r2            |
0018b2ac: 90235cb4 lbu r3,0x5cb4(r1)        |r3 = last used skillset action menu
0018b2b0: 00000000 nop                      |
0018b2b4: 2c620010 sltiu r2,r3,0x0010       |r2 = 0x01 if action menu is <= 0xf (action menu exist)
0018b2b8: 1040001b beq r2,r0,0x0018b328     #if action menu is valid /Else go to Attack section
0018b2bc: 00031080 sll r2,r3,0x02                |r2 = action menu ID * 4
0018b2c0: 3c018017 lui r1,0x8017                 |
0018b2c4: 00220821 addu r1,r1,r2                 |
0018b2c8: 8c224304 lw r2,0x4304(r1)              |r2 = action menu return adress  -->|Action_menu_return_adress
0018b2cc: 00000000 nop                           |
0018b2d0: 00400008 jr r2                         >>Jump to action menu dedicated section
0018b2d4: 00000000 nop                           |

                                             --- Default / Math skill/ Elemental/ Monster  section---
0018b2d8: 84840002 lh r4,0x0002(r4)              |r4 = Attacker last used ability
0018b2dc: 00000000 nop                           |
0018b2e0: 28820170 slti r2,r4,0x0170             |r2 = 0x01 if ability ID is < Potion
0018b2e4: 10400010 beq r2,r0,0x0018b328          #If ability ID < Potion
0018b2e8: 000410c0 sll r2,r4,0x03                    |r2 = ability ID * 8
0018b2ec: 00441023 subu r2,r2,r4                     |r2 = ability ID * 7
0018b2f0: 00021040 sll r2,r2,0x01                    |r2 = ability ID * 14
0018b2f4: 3c018006 lui r1,0x8006                     |
0018b2f8: 00220821 addu r1,r1,r2                     |
0018b2fc: 9022fbf3 lbu r2,-0x040d(r1)                |r2 = Ability Data 2 flag 1
0018b300: 00000000 nop                               |
0018b304: 30420024 andi r2,r2,0x0024                 |r2 = flag 1 filtered  with weapon strike and  weapon range 
0018b308: 14400008 bne r2,r0,0x0018b32c              #If neither weapon strike nor weapon range is checked /Else branch in attack section
0018b30c: 30a300ff andi r3,r5,0x00ff                 |r3 = weapon ID
0018b310: 08062cca j 0x0018b328                          >>jump in attack section (weapon will be 0x00)
0018b314: 00002821 addu r5,r0,r0                         |r5 = 0x00

                                            --- Item / Katana inventory  section ---
0018b318: 90850008 lbu r5,0x0008(r4)             |r5 =  used item
0018b31c: 08062ccb j 0x0018b32c                  >>jump in attack section (weapon will be used item)
0018b320: 30a300ff andi r3,r5,0x00ff             |r3 = used item

                                            --- Jump / Unknow section
0018b324: 00002821 addu r5,r0,r0                 |r5 = 0x00

                                            ---  Weapon inventory / Attack / Blank / Charge / Defend / Equip change / Unknown / Blank section ---
0018b328: 30a300ff andi r3,r5,0x00ff             |r3 = weapon ID  (or 0x00 if coming from jump at 18b310, used item ID jump from 18b31c)

                                            --- Store weapon section ---
0018b32c: 340200ff ori r2,r0,0x00ff              |r2 = 0xff
0018b330: 14620002 bne r3,r2,0x0018b33c          #if weapon doesn't exist /Else branch keeping r5
0018b334: 00000000 nop                               | 
0018b338: 00002821 addu r5,r0,r0                     |r5 = 0x00 (will be stored as used weapon)
0018b33c: 3c018019 lui r1,0x8019                     |
0018b340: a02538d8 sb r5,0x38d8(r1)              |store r5 as current ability used weapon ID
0018b344: 03e00008 jr r31                        |
0018b348: 00000000 nop                           

Return location

0017d0a4: Main_ability_loading_routine?
0018b414: Pre_Formula_Setup_(FDC)