Get misc ID

From Final Fantasy Hacktics Wiki
(Redirected from Routine at 133158)
Jump to navigation Jump to search

< BATTLE.BIN

00133158: 27bdffd0 addiu r29,r29,0xffd0
0013315c: afb00018 sw r16,0x0018(r29)
00133160: 00808021 addu r16,r4,r0
00133164: 2602ffff addiu r2,r16,0xffff			event command - 1
00133168: 2c420049 sltiu r2,r2,0x0049			set if event command is 1-49
0013316c: afbf0028 sw r31,0x0028(r29)
00133170: afb30024 sw r19,0x0024(r29)
00133174: afb20020 sw r18,0x0020(r29)
00133178: 1040000f beq r2,r0,0x001331b8			branch if not
0013317c: afb1001c sw r17,0x001c(r29)
00133180: 0c0602cb jal 0x00180b2c				Check Base Class | Ramza Causes Game Over
00133184: 00000000 nop
00133188: 0440000b bltz r2,0x001331b8			branch if returned value < 0
0013318c: afa20010 sw r2,0x0010(r29)			store returned value
00133190: 0c0602bf jal 0x00180afc				Get Unit's Data Pointer
00133194: 00402021 addu r4,r2,r0
00133198: 00408821 addu r17,r2,r0
0013319c: 92220161 lbu r2,0x0161(r17)			load ENTD ID
001331a0: 00000000 nop
001331a4: 2442ff88 addiu r2,r2,0xff88			ID - 0x78
001331a8: 2c420005 sltiu r2,r2,0x0005			set if 0x78-0x7d
001331ac: 10400003 beq r2,r0,0x001331bc			branch if not
001331b0: 34020068 ori r2,r0,0x0068
001331b4: 92300161 lbu r16,0x0161(r17)			load ENTD ID
001331b8: 34020068 ori r2,r0,0x0068
001331bc: 16020019 bne r16,r2,0x00133224		branch if event command/ENTD ID isn't 0x68
001331c0: 02009021 addu r18,r16,r0
001331c4: afa00010 sw r0,0x0010(r29)			store 0 into returned value
001331c8: 8fa40010 lw r4,0x0010(r29)
001331cc: 0c0602bf jal 0x00180afc				Get Unit's Data Pointer
001331d0: 00000000 nop
001331d4: 00408821 addu r17,r2,r0
001331d8: 92220005 lbu r2,0x0005(r17)			load ENTD flags
001331dc: 00000000 nop
001331e0: 30420003 andi r2,r2,0x0003
001331e4: 14400008 bne r2,r0,0x00133208		branch if Ramza
001331e8: 00000000 nop
001331ec: 8fa20010 lw r2,0x0010(r29)
001331f0: 00000000 nop
001331f4: 24420001 addiu r2,r2,0x0001
001331f8: afa20010 sw r2,0x0010(r29)			add 1 to returned value
001331fc: 28420010 slti r2,r2,0x0010
00133200: 1440fff1 bne r2,r0,0x001331c8		branch if value > 0x10
00133204: 00000000 nop
00133208: 8fa30010 lw r3,0x0010(r29)
0013320c: 34020010 ori r2,r0,0x0010
00133210: 10620095 beq r3,r2,0x00133468
00133214: 00000000 nop
00133218: 92300161 lbu r16,0x0161(r17)
0013321c: 0804ccc9 j 0x00133324
00133220: 00000000 nop
00133224: 34020069 ori r2,r0,0x0069
00133228: 1602003e bne r16,r2,0x00133324		branch if event command isn't 69
0013322c: 2413ffff addiu r19,r0,0xffff
00133230: afa00010 sw r0,0x0010(r29)
00133234: 8fa40010 lw r4,0x0010(r29)
00133238: 0c0232ed jal 0x0008cbb4				Does Misc Unit Exist With ID
0013323c: 00000000 nop
00133240: 1040000e beq r2,r0,0x0013327c
00133244: 00000000 nop
00133248: 8fa40010 lw r4,0x0010(r29)
0013324c: 0c023374 jal 0x0008cdd0				Get Battle Unit Index By Unit Misc ID
00133250: 00000000 nop
00133254: 00408021 addu r16,r2,r0
00133258: 12130008 beq r16,r19,0x0013327c
0013325c: 00000000 nop
00133260: 0c0602bf jal 0x00180afc				Get Unit's Data Pointer
00133264: 02002021 addu r4,r16,r0
00133268: 00408821 addu r17,r2,r0
0013326c: 92220186 lbu r2,0x0186(r17)			load units turn byte
00133270: 00000000 nop
00133274: 14400008 bne r2,r0,0x00133298			branch if units turn
00133278: 00000000 nop
0013327c: 8fa20010 lw r2,0x0010(r29)
00133280: 00000000 nop
00133284: 24420001 addiu r2,r2,0x0001
00133288: afa20010 sw r2,0x0010(r29)
0013328c: 28420015 slti r2,r2,0x0015
00133290: 1440ffe8 bne r2,r0,0x00133234
00133294: 00000000 nop
00133298: 8fa30010 lw r3,0x0010(r29)
0013329c: 34020015 ori r2,r0,0x0015
001332a0: 10620006 beq r3,r2,0x001332bc
001332a4: 27a50010 addiu r5,r29,0x0010
001332a8: 92300161 lbu r16,0x0161(r17)			load ENTD ID
001332ac: 0c060324 jal 0x00180c90				Find Unit Data Pointer For ENTD Unit ID | Unit Existence/crystaltreasure check
001332b0: 02002021 addu r4,r16,r0
001332b4: 0804ccb1 j 0x001332c4
001332b8: 00000000 nop
001332bc: 2402ffff addiu r2,r0,0xffff
001332c0: afa20010 sw r2,0x0010(r29)
001332c4: 8fa20010 lw r2,0x0010(r29)
001332c8: 00000000 nop
001332cc: 04410015 bgez r2,0x00133324
001332d0: 00000000 nop
001332d4: 34100001 ori r16,r0,0x0001
001332d8: 02002021 addu r4,r16,r0
001332dc: 0c060324 jal 0x00180c90				Find Unit Data Pointer For ENTD Unit ID | Unit Existence/crystaltreasure check
001332e0: 27a50010 addiu r5,r29,0x0010
001332e4: 8fa30010 lw r3,0x0010(r29)
001332e8: 00000000 nop
001332ec: 04610005 bgez r3,0x00133304
001332f0: 00408821 addu r17,r2,r0
001332f4: 26100001 addiu r16,r16,0x0001
001332f8: 2a020003 slti r2,r16,0x0003
001332fc: 1440fff7 bne r2,r0,0x001332dc
00133300: 02002021 addu r4,r16,r0
00133304: 34020003 ori r2,r0,0x0003
00133308: 10620057 beq r3,r2,0x00133468
0013330c: 00000000 nop
00133310: 92220058 lbu r2,0x0058(r17)
00133314: 00000000 nop
00133318: 30420004 andi r2,r2,0x0004
0013331c: 14400052 bne r2,r0,0x00133468
00133320: 00000000 nop
00133324: 0c04ed64 jal 0x0013b590				Get Script Variable (returned 0x1ba)
00133328: 34040027 ori r4,r0,0x0027
0013332c: 34030194 ori r3,r0,0x0194
00133330: 1443001a bne r2,r3,0x0013339c			branch if ?? isn't 0x194
00133334: 2602ff9c addiu r2,r16,0xff9c			command - 0x64
00133338: afa00010 sw r0,0x0010(r29)
0013333c: 8fa40010 lw r4,0x0010(r29)
00133340: 0c0602bf jal 0x00180afc				Get Unit's Data Pointer
00133344: 00000000 nop
00133348: 00408821 addu r17,r2,r0
0013334c: 92220000 lbu r2,0x0000(r17)
00133350: 00000000 nop
00133354: 10400003 beq r2,r0,0x00133364
00133358: 2c420004 sltiu r2,r2,0x0004
0013335c: 14400008 bne r2,r0,0x00133380
00133360: 00000000 nop
00133364: 8fa20010 lw r2,0x0010(r29)
00133368: 00000000 nop
0013336c: 24420001 addiu r2,r2,0x0001
00133370: afa20010 sw r2,0x0010(r29)
00133374: 28420015 slti r2,r2,0x0015
00133378: 1440fff0 bne r2,r0,0x0013333c
0013337c: 00000000 nop
00133380: 8fa30010 lw r3,0x0010(r29)
00133384: 34020015 ori r2,r0,0x0015
00133388: 1062003a beq r3,r2,0x00133474
0013338c: 2402ffff addiu r2,r0,0xffff
00133390: 92300161 lbu r16,0x0161(r17)
00133394: 00000000 nop
00133398: 2602ff9c addiu r2,r16,0xff9c
0013339c: 2c420004 sltiu r2,r2,0x0004			
001333a0: 10400009 beq r2,r0,0x001333c8			branch if command isn't 64-68
001333a4: 00101040 sll r2,r16,0x01				command*2
001333a8: 3c018016 lui r1,0x8016
001333ac: 00220821 addu r1,r1,r2
001333b0: 94235f20 lhu r3,0x5f20(r1)
001333b4: 340203e8 ori r2,r0,0x03e8
001333b8: 1062002b beq r3,r2,0x00133468
001333bc: 00601021 addu r2,r3,r0
001333c0: 0804cd1d j 0x00133474
001333c4: 00000000 nop
001333c8: 02002021 addu r4,r16,r0				r4 = command*2
001333cc: 0c060324 jal 0x00180c90				Find Unit Data Pointer For ENTD Unit ID | Unit Existence/crystaltreasure check
001333d0: 27a50014 addiu r5,r29,0x0014
001333d4: 8fa30014 lw r3,0x0014(r29)
001333d8: 00000000 nop
001333dc: 04610009 bgez r3,0x00133404
001333e0: 00408821 addu r17,r2,r0
001333e4: 2402fffe addiu r2,r0,0xfffe
001333e8: 10620006 beq r3,r2,0x00133404
001333ec: 00000000 nop
001333f0: 0c04ed64 jal 0x0013b590				Get Script Variable
001333f4: 34040027 ori r4,r0,0x0027
001333f8: 34030194 ori r3,r0,0x0194
001333fc: 1443001a bne r2,r3,0x00133468
00133400: 00000000 nop
00133404: afa00010 sw r0,0x0010(r29)			initialize counter
00133408: 8fa40010 lw r4,0x0010(r29)
0013340c: 0c0602bf jal 0x00180afc				Get Unit's Data Pointer
00133410: 00000000 nop
00133414: 10510008 beq r2,r17,0x00133438		branch if when unit data found
00133418: 00000000 nop
0013341c: 8fa20010 lw r2,0x0010(r29)			load counter
00133420: 00000000 nop
00133424: 24420001 addiu r2,r2,0x0001			counter++
00133428: afa20010 sw r2,0x0010(r29)			store new counter
0013342c: 28420015 slti r2,r2,0x0015			
00133430: 1440fff5 bne r2,r0,0x00133408			run each unit
00133434: 00000000 nop
00133438: 8fa40010 lw r4,0x0010(r29)
0013343c: 0c023388 jal 0x0008ce20				get misc data ID
00133440: 00000000 nop
00133444: 00408021 addu r16,r2,r0				
00133448: 2402ffff addiu r2,r0,0xffff
0013344c: 12020006 beq r16,r2,0x00133468		branch if no misc ID found
00133450: 00000000 nop
00133454: 92220059 lbu r2,0x0059(r17)			load status
00133458: 00000000 nop
0013345c: 30420001 andi r2,r2,0x0001
00133460: 10400004 beq r2,r0,0x00133474			branch if not treasure
00133464: 02001021 addu r2,r16,r0				return misc ID
00133468: 0c04cc54 jal 0x00133150				jr r31
0013346c: 02402021 addu r4,r18,r0
80133470: 340207d0 ori r2,r0,0x07d0
80133474: 8fbf0028 lw r31,0x0028(r29)
80133478: 8fb30024 lw r19,0x0024(r29)
8013347c: 8fb20020 lw r18,0x0020(r29)
80133480: 8fb1001c lw r17,0x001c(r29)
80133484: 8fb00018 lw r16,0x0018(r29)
80133488: 27bd0030 addiu r29,r29,0x0030
8013348c: 03e00008 jr r31
80133490: 00000000 nop