Difference between revisions of "Change Item Quantity on Equip"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<font face='Courier New'>
+
  # change the item quantity in the inventory
  # Add a value to the item quantity in the inventory.
 
 
  # Parameters:
 
  # Parameters:
 
  #  r4 = Item Number
 
  #  r4 = Item Number
  #  r5 = Value (positive or negative acceptable)
+
  #  r5 = Value
 
  #  
 
  #  
 
  # Return Value:
 
  # Return Value:
Line 9: Line 8:
 
   
 
   
 
  001208b8: 308403ff andi r4,r4,0x03ff          #  
 
  001208b8: 308403ff andi r4,r4,0x03ff          #  
  001208bc: 1080000c beq r4,r0,0x001208f0        # if Item Number AND 0x3FF = 0
+
  001208bc: 1080000c beq r4,r0,0x001208f0        # if not item number AND 0x3FF:
  001208c0: 00001021 addu r2,r0,                 #  return 0
+
  001208c0: 00001021 addu r2,r0,r0              #  return 0
 
  001208c4: 3c018006 lui r1,0x8006              #
 
  001208c4: 3c018006 lui r1,0x8006              #
 
  001208c8: 00240821 addu r1,r1,r4              #
 
  001208c8: 00240821 addu r1,r1,r4              #
  001208cc: 902296e0 lbu r2,-0x6920(r1)          # r2 = item quantity
+
  001208cc: 902296e0 lbu r2,-0x6920(r1)          # item quantity = inventory[item number]
 
  001208d0: 00000000 nop                        #
 
  001208d0: 00000000 nop                        #
  001208d4: 00451021 addu r2,r2,r5              # item quantity - r5
+
  001208d4: 00451021 addu r2,r2,r5              # item quantity += value
  001208d8: 04410002 bgez r2,0x001208e4          # if item quantity - r5 is negative
+
  001208d8: 04410002 bgez r2,0x001208e4          # if item quantity is negative:
 
  001208dc: 00000000 nop                        #
 
  001208dc: 00000000 nop                        #
 
  001208e0: 00001021 addu r2,r0,r0              #  item quantity = 0
 
  001208e0: 00001021 addu r2,r0,r0              #  item quantity = 0
 
  001208e4: 3c018006 lui r1,0x8006              #
 
  001208e4: 3c018006 lui r1,0x8006              #
 
  001208e8: 00240821 addu r1,r1,r4              #
 
  001208e8: 00240821 addu r1,r1,r4              #
  001208ec: a02296e0 sb r2,-0x6920(r1)          # store item quantity
+
  001208ec: a02296e0 sb r2,-0x6920(r1)          # inventory[item number] = item quantity
 
  001208f0: 03e00008 jr r31                      # return item quantity
 
  001208f0: 03e00008 jr r31                      # return item quantity
 
  001208f4: 00000000 nop                        #
 
  001208f4: 00000000 nop                        #
</font>
+
 
 +
== Return Locations ==
 +
0x0011b2b0:
 +
0x0011b2f4:
 +
0x0011b6e4:
 +
0x0011b738:
 +
0x0011c960:
 +
0x0011cba0:
 +
0x001219c8:
 +
0x00121b50:
 +
0x001237f8:
 +
0x00123b28:
 +
0x001244ac:
 +
0x001244ec:
 +
0x00124868:
 +
0x001248fc:
 +
0x0012494c:
 +
0x00124a30:
 +
0x00124acc:
 +
0x00124cf0:
 +
0x0012549c:
 +
0x001254ec:
 +
0x001345a0:
 +
0x00135070:
 +
0x001351d0:
 +
0x001370a4:
 +
0x001376b4:
 +
0x0013783c:
 +
0x00137e8c:

Latest revision as of 02:58, 29 September 2024

# change the item quantity in the inventory
# Parameters:
#   r4 = Item Number
#   r5 = Value
# 
# Return Value:
#   item quantity

001208b8: 308403ff andi r4,r4,0x03ff           # 
001208bc: 1080000c beq r4,r0,0x001208f0        # if not item number AND 0x3FF:
001208c0: 00001021 addu r2,r0,r0               #   return 0
001208c4: 3c018006 lui r1,0x8006               #
001208c8: 00240821 addu r1,r1,r4               #
001208cc: 902296e0 lbu r2,-0x6920(r1)          # item quantity = inventory[item number]
001208d0: 00000000 nop                         #
001208d4: 00451021 addu r2,r2,r5               # item quantity += value
001208d8: 04410002 bgez r2,0x001208e4          # if item quantity is negative:
001208dc: 00000000 nop                         #
001208e0: 00001021 addu r2,r0,r0               #   item quantity = 0
001208e4: 3c018006 lui r1,0x8006               #
001208e8: 00240821 addu r1,r1,r4               #
001208ec: a02296e0 sb r2,-0x6920(r1)           # inventory[item number] = item quantity
001208f0: 03e00008 jr r31                      # return item quantity
001208f4: 00000000 nop                         #

Return Locations

0x0011b2b0: 
0x0011b2f4: 
0x0011b6e4: 
0x0011b738: 
0x0011c960: 
0x0011cba0: 
0x001219c8: 
0x00121b50: 
0x001237f8: 
0x00123b28: 
0x001244ac: 
0x001244ec: 
0x00124868: 
0x001248fc: 
0x0012494c: 
0x00124a30: 
0x00124acc: 
0x00124cf0: 
0x0012549c: 
0x001254ec: 
0x001345a0: 
0x00135070: 
0x001351d0: 
0x001370a4: 
0x001376b4: 
0x0013783c: 
0x00137e8c: