Find Highest Target Priority in Ability Range (0019bf2c)
Jump to navigation
Jump to search
Find Highest Target Priority in Ability Range
0019bf2c: 3c02801a lui r2,0x801a 0019bf30: 90420d7b lbu r2,0x0d7b(r2) 0019bf34: 27bdffe0 addiu r29,r29,0xffe0 0019bf38: afb00010 sw r16,0x0010(r29) 0019bf3c: 3c10801a lui r16,0x801a 0019bf40: 2610f3c4 addiu r16,r16,0xf3c4 Load AI Data 0019bf44: afbf0018 sw r31,0x0018(r29) 0019bf48: 10400016 beq r2,r0,0x0019bfa4 Branch and get Target Unit List if No Action Taken 0019bf4c: afb10014 sw r17,0x0014(r29) 0019bf50: 3c03801a lui r3,0x801a 0019bf54: 9063029d lbu r3,0x029d(r3) Load ? 0019bf58: 00000000 nop 0019bf5c: 1060001d beq r3,r0,0x0019bfd4 Branch to and let the Frame RNG decide if false 0019bf60: 34020001 ori r2,r0,0x0001 0019bf64: 10620055 beq r3,r2,0x0019c0bc Branch to ? if 1 0019bf68: 00000000 nop
0019bf6c: 3c02801a lui r2,0x801a 0019bf70: 904202a0 lbu r2,0x02a0(r2) Load ? ID 0019bf74: 00000000 nop 0019bf78: 000218c0 sll r3,r2,0x03 0019bf7c: 00621821 addu r3,r3,r2 0019bf80: 00031880 sll r3,r3,0x02 0019bf84: 3c02801a lui r2,0x801a 0019bf88: 9042029f lbu r2,0x029f(r2) Load ? 0019bf8c: 00701821 addu r3,r3,r16 0019bf90: 00021040 sll r2,r2,0x01 0019bf94: 00621821 addu r3,r3,r2 0019bf98: 94710b94 lhu r17,0x0b94(r3) r17 = "Current Map Data...?" Or Unit Target Matrix? 0019bf9c: 08067059 j 0x0019c164 Go directly into Target Matrix evaluation 0019bfa0: 00000000 nop
0019bfa4: 3c02801a lui r2,0x801a 0019bfa8: 904201f2 lbu r2,0x01f2(r2) Load Acting Unit's ID 0019bfac: 00000000 nop 0019bfb0: 00501021 addu r2,r2,r16 Get Acting Unit's AI Data for next Routine 0019bfb4: 90510c8d lbu r17,0x0c8d(r2) r17 = Targetable Unit List 0019bfb8: 0c0670f5 jal 0x0019c3d4 Generate new Targetable Unit List? 0019bfbc: a0400c8d sb r0,0x0c8d(r2) Clear Targetable Unit List 0019bfc0: 3c02801a lui r2,0x801a 0019bfc4: 904201f2 lbu r2,0x01f2(r2) Load Acting Unit's ID 0019bfc8: 00000000 nop 0019bfcc: 00501021 addu r2,r2,r16 Get Acting Unit's AI Data 0019bfd0: a0510c8d sb r17,0x0c8d(r2) Restore Targetable Unit List
<Decide based on Frame Data> 0019bfd4: 0c0076ea jal 0x0001dba8 Get RNG from frame data 0019bfd8: 34040001 ori r4,r0,0x0001 0019bfdc: 284201b9 slti r2,r2,0x01b9 0019bfe0: 14400004 bne r2,r0,0x0019bff4 Branch to Can Target Enemy? unless RNG said not to 0019bfe4: 3c030400 lui r3,0x0400 0019bfe8: a2000ed9 sb r0,0x0ed9(r16) 0019bfec: 0806707d j 0x0019c1f4 RNG gods said not to use this skill; Exit and set to -1 0019bff0: 2402ffff addiu r2,r0,0xffff
0019bff4: 8e02000c lw r2,0x000c(r16) Load AI Flags 0019bff8: a20019b7 sb r0,0x19b7(r16) Clear Usage? 0019bffc: 00431024 and r2,r2,r3 0019c000: 1040000a beq r2,r0,0x0019c02c Branch if allowed to target enemies 0019c004: a2000e4d sb r0,0x0e4d(r16) Clear ? 0019c008: 3c03fdff lui r3,0xfdff 0019c00c: 8e020cb4 lw r2,0x0cb4(r16) Load ? 0019c010: 3463ffff ori r3,r3,0xffff 0019c014: 00431024 and r2,r2,r3 Remove 0x04000000 from ? 0019c018: 0806701a j 0x0019c068 0019c01c: ae020cb4 sw r2,0x0cb4(r16) Save ?
0019c020: a2020ed9 sb r2,0x0ed9(r16) r2 = 0 (can be 1 if from XY loop or 2 from Targeting Matrix loop) 0019c024: 0806707d j 0x0019c1f4 This ability has units in range to be hit; is usable (jump to exit and set -1) 0019c028: 2402ffff addiu r2,r0,0xffff
0019c02c: 92030cbb lbu r3,0x0cbb(r16) Load X? 0019c030: 92020cbc lbu r2,0x0cbc(r16) Load Y? 0019c034: 00000000 nop 0019c038: 00620018 mult r3,r2 0019c03c: a2030eda sb r3,0x0eda(r16) Save X? 0019c040: 00001012 mflo r2 0019c044: a2020eda sb r2,0x0eda(r16) Save over X immediately...? 0019c048: 92020eda lbu r2,0x0eda(r16) Load previous data before being saved over? Action Menu? 0019c04c: 00000000 nop 0019c050: 2c42000b sltiu r2,r2,0x000b 0019c054: 14400003 bne r2,r0,0x0019c064 Branch if normal menu ability? 0019c058: 34020001 ori r2,r0,0x0001 0019c05c: a2020e4d sb r2,0x0e4d(r16) 0019c060: 34020001 ori r2,r0,0x0001 0019c064: a2020e4d sb r2,0x0e4d(r16) This saves the exact same information to the exact same place. 0019c068: 8e020cb4 lw r2,0x0cb4(r16) Load ? 0019c06c: 3c030200 lui r3,0x0200 0019c070: 00431024 and r2,r2,r3 0019c074: 14400005 bne r2,r0,0x0019c08c Skip next branch if ? ["ability ID = holy water???"] 0019c078: 00000000 nop 0019c07c: 92020e4d lbu r2,0x0e4d(r16) Load ? 0019c080: 00000000 nop 0019c084: 10400014 beq r2,r0,0x0019c0d8 Skip XY Loop if ? 0019c088: 00000000 nop
<XY Loop> 0019c08c: 92020cbb lbu r2,0x0cbb(r16) Load X? 0019c090: 00000000 nop 0019c094: 10400054 beq r2,r0,0x0019c1e8 Store Unit Coordinates and exit routine to select ability if false 0019c098: 00000000 nop 0019c09c: 92020cbc lbu r2,0x0cbc(r16) Load Y? 0019c0a0: 00000000 nop 0019c0a4: 10400050 beq r2,r0,0x0019c1e8 Store Unit Coordinates and exit routine to select ability if false 0019c0a8: 00000000 nop 0019c0ac: 0c0670a0 jal 0x0019c280 Find Highest Target Priority 0019c0b0: 00000000 nop 0019c0b4: 0c067083 jal 0x0019c20c Check if units match their coordinates in the AI 0019c0b8: 00000000 nop 0019c0bc: 0c067367 jal 0x0019cd9c Check if units are in Range 0019c0c0: 00000000 nop 0019c0c4: 2403ffff addiu r3,r0,0xffff 0019c0c8: 1043ffd5 beq r2,r3,0x0019c020 branch, set true and exit if units in range 0019c0cc: 34020001 ori r2,r0,0x0001 0019c0d0: 08067023 j 0x0019c08c Jump back until success 0019c0d4: 00000000 nop </XY Loop>
0019c0d8: a2000edc sb r0,0x0edc(r16) Initialize Current Map Level
<Map Level Loop> 0019c0dc: 92020e3b lbu r2,0x0e3b(r16) Load Max Map Y 0019c0e0: 00000000 nop 0019c0e4: 10400037 beq r2,r0,0x0019c1c4 Exit if Max Y is false 0019c0e8: a2000edb sb r0,0x0edb(r16) Initialize Y
<Y Loop> 0019c0ec: 92020edc lbu r2,0x0edc(r16) Load Current Map Level 0019c0f0: 00000000 nop 0019c0f4: 000218c0 sll r3,r2,0x03 r3 = Level * 8 0019c0f8: 00621821 addu r3,r3,r2 r3 = Level * 9 0019c0fc: 00031880 sll r3,r3,0x02 r3 = Level * 24 0019c100: 92020edb lbu r2,0x0edb(r16) Load Current Y 0019c104: 00701821 addu r3,r3,r16 Get current unit AI Data 0019c108: 00021040 sll r2,r2,0x01 Y * 2 0019c10c: 00621821 addu r3,r3,r2 0019c110: 94710b94 lhu r17,0x0b94(r3) Get Current Unit Target Matrix 0019c114: 00000000 nop 0019c118: 12200021 beq r17,r0,0x0019c1a0 Branch if not targeting anything 0019c11c: 00000000 nop 0019c120: 92020e3a lbu r2,0x0e3a(r16) Load Max Map X 0019c124: 00000000 nop 0019c128: 1040001d beq r2,r0,0x0019c1a0 Exit if false 0019c12c: a2000eda sb r0,0x0eda(r16) Initialize X
<X Loop> 0019c130: 92020eda lbu r2,0x0eda(r16) Load X 0019c134: 00000000 nop 0019c138: 00511004 sllv r2,r17,r2 0019c13c: 30428000 andi r2,r2,0x8000 0019c140: 1040000d beq r2,r0,0x0019c178 Next X if nothing in the cell 0019c144: 00000000 nop 0019c148: 92020eda lbu r2,0x0eda(r16) Load Current X 0019c14c: 92030edb lbu r3,0x0edb(r16) Load Current Y 0019c150: 92040edc lbu r4,0x0edc(r16) Load Current Map Level 0019c154: a2020018 sb r2,0x0018(r16) Save as Acting Unit X 0019c158: a203001a sb r3,0x001a(r16) Save as Acting Unit Y 0019c15c: 0c067083 jal 0x0019c20c Check if Units match their coordinates in the AI 0019c160: a2040019 sb r4,0x0019(r16) Save as Acting Unit Map Level 0019c164: 0c067367 jal 0x0019cd9c Check if Units are in Range 0019c168: 00000000 nop 0019c16c: 2403ffff addiu r3,r0,0xffff 0019c170: 1043ffab beq r2,r3,0x0019c020 Branch to Exit Jump and set 2 if success 0019c174: 34020002 ori r2,r0,0x0002 Don't select ability just yet
<X++> 0019c178: 92020eda lbu r2,0x0eda(r16) Load Current X 0019c17c: 00000000 nop 0019c180: 24420001 addiu r2,r2,0x0001 Current X++ 0019c184: a2020eda sb r2,0x0eda(r16) Save Current X 0019c188: 92030eda lbu r3,0x0eda(r16) Load Current X 0019c18c: 92020e3a lbu r2,0x0e3a(r16) Load Max X 0019c190: 00000000 nop 0019c194: 0062182b sltu r3,r3,r2 0019c198: 1460ffe5 bne r3,r0,0x0019c130 Loop until Max X 0019c19c: 00000000 nop </X Loop> <Y++> 0019c1a0: 92020edb lbu r2,0x0edb(r16) Load Current Y 0019c1a4: 92030e3b lbu r3,0x0e3b(r16) Load Max Y 0019c1a8: 24420001 addiu r2,r2,0x0001 Current Y++ 0019c1ac: a2020edb sb r2,0x0edb(r16) Save Current Y 0019c1b0: 92020edb lbu r2,0x0edb(r16) Load Current Y 0019c1b4: 00000000 nop 0019c1b8: 0043102b sltu r2,r2,r3 0019c1bc: 1440ffcb bne r2,r0,0x0019c0ec Loop until Max Y 0019c1c0: 00000000 nop </Y Loop> <Map Level++> 0019c1c4: 92020edc lbu r2,0x0edc(r16) Load Current Map Level 0019c1c8: 00000000 nop 0019c1cc: 24420001 addiu r2,r2,0x0001 Current Map Level++ 0019c1d0: a2020edc sb r2,0x0edc(r16) Save Current Map Level 0019c1d4: 92020edc lbu r2,0x0edc(r16) Load Current Map Level 0019c1d8: 00000000 nop 0019c1dc: 2c420002 sltiu r2,r2,0x0002 0019c1e0: 1440ffbe bne r2,r0,0x0019c0dc Loop again 0019c1e4: 00000000 nop </Map Level Loop>
0019c1e8: 0c067c96 jal 0x0019f258 Store units coordinates 0019c1ec: 26040e30 addiu r4,r16,0x0e30 r4 = AI Coordinate Data 0019c1f0: 00001021 addu r2,r0,r0 No units in range (Return failure) 0019c1f4: 8fbf0018 lw r31,0x0018(r29) 0019c1f8: 8fb10014 lw r17,0x0014(r29) 0019c1fc: 8fb00010 lw r16,0x0010(r29) 0019c200: 27bd0020 addiu r29,r29,0x0020 0019c204: 03e00008 jr r31 0019c208: 00000000 nop