001221d8 - 00122278

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
# Runs when purchasing or selling an item
# does not run when equipping or removing an item
# does not run when dropping an item from the inventory
# does not return a value
# Parameters:
#   r4 - sub menu type
#       0x00 - Armaments
#       0x01 - Headgear
#       0x02 - Bodygear
#       0x03 - Accessories
#       0x04 - Throwables and Chemist Items

001221d8: 27bdffe0 addiu r29,r29,0xffe0        #
001221dc: afb20018 sw r18,0x0018(r29)          #
001221e0: 00809021 addu r18,r4,r0              # r18 = sub menu type
001221e4: afb00010 sw r16,0x0010(r29)          #
001221e8: 34100001 ori r16,r0,0x0001           # counter = 1
001221ec: afbf001c sw r31,0x001c(r29)          #
001221f0: afb10014 sw r17,0x0014(r29)          #
001221f4: 00101400 sll r2,r16,0x10             # 
001221f8: 00028c03 sra r17,r2,0x10             # do: 
001221fc: 0c0494dd jal 0x00125374              #   item_type = Get Item Type from Item Number(counter)
00122200: 02202021 addu r4,r17,r0              # 
00122204: 10400002 beq r2,r0,0x00122210        #   if item_type != "weapon":
00122208: 00001821 addu r3,r0,r0               #       r3 = 0
0012220c: 2443ffff addiu r3,r2,0xffff          #       item_type--
                                               #
00122210: 1643000f bne r18,r3,0x00122250       #   if sub menu type != item_type: 
00122214: 00000000 nop                         #       continue
00122218: 0c048df9 jal 0x001237e4              #   result = func_001237e4 - 00123820(counter)
0012221c: 02202021 addu r4,r17,r0              #
00122220: 10400009 beq r2,r0,0x00122248        #    if result == 0: goto 0x00122248
00122224: 02002021 addu r4,r16,r0              #
                                               #
00122228: 0c04889f jal 0x0012227c              #    result = func_0012227c - 001222cc(counter, sub menu type)
0012222c: 02402821 addu r5,r18,r0              #
00122230: 14400007 bne r2,r0,0x00122250        #    if result != 0: continue
00122234: 02002021 addu r4,r16,r0              #
00122238: 0c0488b4 jal 0x001222d0              #    func_001222d0 - 00122334(counter, sub menu type)
0012223c: 02402821 addu r5,r18,r0              #
00122240: 08048895 j 0x00122254                # 
00122244: 26100001 addiu r16,r16,0x0001        #    counter++
                                               #
00122248: 0c0488ce jal 0x00122338              #    func_00122338 - 001223b4(counter, sub menu type)
0012224c: 02402821 addu r5,r18,r0              # 
00122250: 26100001 addiu r16,r16,0x0001        #    counter++
00122254: 2a0200fe slti r2,r16,0x00fe          # 
00122258: 1440ffe7 bne r2,r0,0x001221f8        #   while: counter < number of items
0012225c: 00101400 sll r2,r16,0x10             #
00122260: 8fbf001c lw r31,0x001c(r29)          #
00122264: 8fb20018 lw r18,0x0018(r29)          #
00122268: 8fb10014 lw r17,0x0014(r29)          #
0012226c: 8fb00010 lw r16,0x0010(r29)          #
00122270: 27bd0020 addiu r29,r29,0x0020        #
00122274: 03e00008 jr r31                      #
00122278: 00000000 nop                         #