Evaluate Linear Ability Behaviors
Jump to navigation
Jump to search
Primarily used by Find Highest Target Priority in Ability Range (0019bf2c)
This routine also contains minor routines for Water Movement, Elemental and Jump
0019c3d4: 27bdff90 addiu r29,r29,0xff90 0019c3d8: afb1004c sw r17,0x004c(r29) 0019c3dc: 00008821 addu r17,r0,r0 0019c3e0: afb5005c sw r21,0x005c(r29) 0019c3e4: 3c15801a lui r21,0x801a 0019c3e8: 26b5f3c4 addiu r21,r21,0xf3c4 0019c3ec: 02a01821 addu r3,r21,r0 0019c3f0: afbf006c sw r31,0x006c(r29) 0019c3f4: afbe0068 sw r30,0x0068(r29) 0019c3f8: afb70064 sw r23,0x0064(r29) 0019c3fc: afb60060 sw r22,0x0060(r29) 0019c400: afb40058 sw r20,0x0058(r29) 0019c404: afb30054 sw r19,0x0054(r29) 0019c408: afb20050 sw r18,0x0050(r29) 0019c40c: afb00048 sw r16,0x0048(r29) 0019c410: a4600bdc sh r0,0x0bdc(r3) 0019c414: a4600c00 sh r0,0x0c00(r3) 0019c418: 26310001 addiu r17,r17,0x0001 0019c41c: 2a220012 slti r2,r17,0x0012 0019c420: 1440fffb bne r2,r0,0x0019c410 0019c424: 24630002 addiu r3,r3,0x0002
0019c428: 8ea2000c lw r2,0x000c(r21) Load AI Ability Behavior Flags 1-4 0019c42c: 3c030080 lui r3,0x0080 0019c430: 00431024 and r2,r2,r3 0019c434: 1040000b beq r2,r0,0x0019c464 Branch if not Ignore Range 0019c438: 26a40b94 addiu r4,r21,0x0b94 0019c43c: 92a20e2d lbu r2,0x0e2d(r21) 0019c440: 34060048 ori r6,r0,0x0048 0019c444: 000228c0 sll r5,r2,0x03 0019c448: 00a22821 addu r5,r5,r2 0019c44c: 000528c0 sll r5,r5,0x03 0019c450: 24a50a74 addiu r5,r5,0x0a74 0019c454: 0c066ac2 jal 0x0019ab08 Transfer Halfword Values 0019c458: 02a52821 addu r5,r21,r5 0019c45c: 080671c3 j 0x0019c70c Jump to <Evaluate Linear with AoE> 0019c460: 0000a021 addu r20,r0,r0
<Evaluate Linear With Range> 0019c464: 0000a021 addu r20,r0,r0 0019c468: 02b41021 addu r2,r21,r20 0019c46c: 90420c8d lbu r2,0x0c8d(r2) Load Targetablity List 0019c470: 00000000 nop 0019c474: 1040001d beq r2,r0,0x0019c4ec Branch if unit is not on the list 0019c478: 02802021 addu r4,r20,r0 0019c47c: 0c067ca9 jal 0x0019f2a4 Transfer Unit Coordinates to AI 0019c480: 26a50c74 addiu r5,r21,0x0c74 0019c484: 92a30026 lbu r3,0x0026(r21) 0019c488: 34020006 ori r2,r0,0x0006 0019c48c: 14620002 bne r3,r2,0x0019c498 Jump to Linear Ability if (0xf3ea) =/= 0x06 0019c490: 34040002 ori r4,r0,0x0002 Linear Ability checks both Range and AoE 0019c494: 00002021 addu r4,r0,r0 Linear Ability Checks just Range 0019c498: 0c06723b jal 0x0019c8ec Check if Linear Ability Hits 0019c49c: 00002821 addu r5,r0,r0 Preset Range = 0 (Not used in 0 mode anyways)
0019c4a0: 92a20e3b lbu r2,0x0e3b(r21) Load Max Y 0019c4a4: 00000000 nop 0019c4a8: 18400010 blez r2,0x0019c4ec Branch if negative 0019c4ac: 00008821 addu r17,r0,r0 0019c4b0: 02a03021 addu r6,r21,r0 0019c4b4: 26310001 addiu r17,r17,0x0001 0019c4b8: 94c20bdc lhu r2,0x0bdc(r6) 0019c4bc: 94c40b4c lhu r4,0x0b4c(r6) 0019c4c0: 94c30c00 lhu r3,0x0c00(r6) 0019c4c4: 94c50b70 lhu r5,0x0b70(r6) 0019c4c8: 00441025 or r2,r2,r4 0019c4cc: 00651825 or r3,r3,r5 0019c4d0: a4c20bdc sh r2,0x0bdc(r6) 0019c4d4: a4c30c00 sh r3,0x0c00(r6) 0019c4d8: 92a20e3b lbu r2,0x0e3b(r21) 0019c4dc: 00000000 nop 0019c4e0: 0222102a slt r2,r17,r2 0019c4e4: 1440fff3 bne r2,r0,0x0019c4b4 0019c4e8: 24c60002 addiu r6,r6,0x0002 0019c4ec: 26940001 addiu r20,r20,0x0001 0019c4f0: 2a820015 slti r2,r20,0x0015 0019c4f4: 1440ffdd bne r2,r0,0x0019c46c Loop for all units 0019c4f8: 02b41021 addu r2,r21,r20
0019c4fc: 92a20e3b lbu r2,0x0e3b(r21) Load Max Y 0019c500: 00000000 nop 0019c504: 18400021 blez r2,0x0019c58c Branch if negative 0019c508: 00008821 addu r17,r0,r0 0019c50c: 02a02821 addu r5,r21,r0 0019c510: 92a30e2d lbu r3,0x0e2d(r21) 0019c514: 00112040 sll r4,r17,0x01 0019c518: 000310c0 sll r2,r3,0x03 0019c51c: 00431021 addu r2,r2,r3 0019c520: 000210c0 sll r2,r2,0x03 0019c524: 02a21021 addu r2,r21,r2 0019c528: 00821021 addu r2,r4,r2 0019c52c: 94420a74 lhu r2,0x0a74(r2) 0019c530: 94a30bdc lhu r3,0x0bdc(r5) 0019c534: 00000000 nop 0019c538: 00431024 and r2,r2,r3 0019c53c: a4a20b94 sh r2,0x0b94(r5) 0019c540: 92a30e2d lbu r3,0x0e2d(r21) 0019c544: 00000000 nop 0019c548: 000310c0 sll r2,r3,0x03 0019c54c: 00431021 addu r2,r2,r3 0019c550: 000210c0 sll r2,r2,0x03 0019c554: 02a21021 addu r2,r21,r2 0019c558: 00822021 addu r4,r4,r2 0019c55c: 94820a98 lhu r2,0x0a98(r4) 0019c560: 94a30c00 lhu r3,0x0c00(r5) 0019c564: 26310001 addiu r17,r17,0x0001 0019c568: a4a00bdc sh r0,0x0bdc(r5) 0019c56c: a4a00c00 sh r0,0x0c00(r5) 0019c570: 00431024 and r2,r2,r3 0019c574: a4a20bb8 sh r2,0x0bb8(r5) 0019c578: 92a20e3b lbu r2,0x0e3b(r21) 0019c57c: 00000000 nop 0019c580: 0222102a slt r2,r17,r2 0019c584: 1440ffe2 bne r2,r0,0x0019c510 0019c588: 24a50002 addiu r5,r5,0x0002
0019c58c: 00008821 addu r17,r0,r0 0019c590: 341e8000 ori r30,r0,0x8000 r30 = 0x8000 0019c594: 02a0b821 addu r23,r21,r0 r23 = AI Data 0019c598: 92a20e3b lbu r2,0x0e3b(r21) Load Max Y 0019c59c: 00000000 nop 0019c5a0: 1840003b blez r2,0x0019c690 Branch if negative 0019c5a4: 00009021 addu r18,r0,r0 0019c5a8: 26f60b94 addiu r22,r23,0x0b94 0019c5ac: 96d40000 lhu r20,0x0000(r22) r20 = ? 0019c5b0: 00000000 nop 0019c5b4: 12800031 beq r20,r0,0x0019c67c Skip Water/Elemental Eval if false 0019c5b8: 00000000 nop 0019c5bc: 92a30e3a lbu r3,0x0e3a(r21) 0019c5c0: 00000000 nop 0019c5c4: 1060002d beq r3,r0,0x0019c67c 0019c5c8: 00008021 addu r16,r0,r0 0019c5cc: 02c09821 addu r19,r22,r0 0019c5d0: 02141004 sllv r2,r20,r16 0019c5d4: 30428000 andi r2,r2,0x8000 0019c5d8: 10400023 beq r2,r0,0x0019c668 0019c5dc: 00000000 nop
<Water Movement> 0019c5e0: 92a219b9 lbu r2,0x19b9(r21) Load Water Movement Flag 0019c5e4: 00000000 nop 0019c5e8: 1040000e beq r2,r0,0x0019c624 Branch if Unit can ignore Water movement penalty 0019c5ec: 02430018 mult r18,r3 0019c5f0: 00111a00 sll r3,r17,0x08 0019c5f4: 00001012 mflo r2 0019c5f8: 00501021 addu r2,r2,r16 0019c5fc: 00431021 addu r2,r2,r3 0019c600: 000210c0 sll r2,r2,0x03 0019c604: 3c018019 lui r1,0x8019 0019c608: 00220821 addu r1,r1,r2 0019c60c: 9022f8cf lbu r2,-0x0731(r1) 0019c610: 00000000 nop 0019c614: 00021142 srl r2,r2,0x05 0019c618: 28420002 slti r2,r2,0x0002 0019c61c: 1040000e beq r2,r0,0x0019c658 0019c620: 00000000 nop
<Elemental Evaluation> 0019c624: 92a20000 lbu r2,0x0000(r21) 0019c628: 3c018006 lui r1,0x8006 0019c62c: 00220821 addu r1,r1,r2 0019c630: 90235cb4 lbu r3,0x5cb4(r1) Load Action Menu Type 0019c634: 34020004 ori r2,r0,0x0004 0019c638: 1462000b bne r3,r2,0x0019c668 Branch if not Elemental 0019c63c: 26a40c74 addiu r4,r21,0x0c74 0019c640: a2b00c74 sb r16,0x0c74(r21) 0019c644: a2b20c76 sb r18,0x0c76(r21) 0019c648: 0c066dd5 jal 0x0019b754 Elemental Panel Check 0019c64c: a2b10c75 sb r17,0x0c75(r21) 0019c650: 14400005 bne r2,r0,0x0019c668 Branch if not the correct Panel 0019c654: 00000000 nop 0019c658: 96630000 lhu r3,0x0000(r19) 0019c65c: 021e1007 srav r2,r30,r16 0019c660: 00621826 xor r3,r3,r2 0019c664: a6630000 sh r3,0x0000(r19)
0019c668: 92a30e3a lbu r3,0x0e3a(r21) 0019c66c: 26100001 addiu r16,r16,0x0001 0019c670: 0203102a slt r2,r16,r3 0019c674: 1440ffd7 bne r2,r0,0x0019c5d4 0019c678: 02141004 sllv r2,r20,r16 0019c67c: 92a20e3b lbu r2,0x0e3b(r21) 0019c680: 26520001 addiu r18,r18,0x0001 0019c684: 0242102a slt r2,r18,r2 0019c688: 1440ffc8 bne r2,r0,0x0019c5ac 0019c68c: 26d60002 addiu r22,r22,0x0002 0019c690: 26310001 addiu r17,r17,0x0001 0019c694: 2a220002 slti r2,r17,0x0002 0019c698: 1440ffbf bne r2,r0,0x0019c598 0019c69c: 26f70024 addiu r23,r23,0x0024 0019c6a0: 8ea2000c lw r2,0x000c(r21) Load AI Behavior Flags 0019c6a4: 3c030800 lui r3,0x0800 0019c6a8: 00431024 and r2,r2,r3 0019c6ac: 10400016 beq r2,r0,0x0019c708 <Evaluate Linear with AoE> if no Stat flag 0019c6b0: 00000000 nop 0019c6b4: 0c0672e5 jal 0x0019cb94 Height/Map Coordinate Check 0019c6b8: 00008821 addu r17,r0,r0 0019c6bc: 92a20e3b lbu r2,0x0e3b(r21) 0019c6c0: 00000000 nop 0019c6c4: 18400010 blez r2,0x0019c708 0019c6c8: 00000000 nop 0019c6cc: 02a03021 addu r6,r21,r0 0019c6d0: 26310001 addiu r17,r17,0x0001 0019c6d4: 94c20b94 lhu r2,0x0b94(r6) 0019c6d8: 94c40b4c lhu r4,0x0b4c(r6) 0019c6dc: 94c30bb8 lhu r3,0x0bb8(r6) 0019c6e0: 94c50b70 lhu r5,0x0b70(r6) 0019c6e4: 00441024 and r2,r2,r4 0019c6e8: 00651824 and r3,r3,r5 0019c6ec: a4c20b94 sh r2,0x0b94(r6) 0019c6f0: a4c30bb8 sh r3,0x0bb8(r6) 0019c6f4: 92a20e3b lbu r2,0x0e3b(r21) 0019c6f8: 00000000 nop 0019c6fc: 0222102a slt r2,r17,r2 0019c700: 1440fff3 bne r2,r0,0x0019c6d0 0019c704: 24c60002 addiu r6,r6,0x0002
<Evaluate Linear with AoE> 0019c708: 0000a021 addu r20,r0,r0 0019c70c: 02b41021 addu r2,r21,r20 Ignore Range check branches here 0019c710: 90420c8d lbu r2,0x0c8d(r2) 0019c714: 00000000 nop 0019c718: 1040001d beq r2,r0,0x0019c790 Branch if unit is not on targetable unit list 0019c71c: 02802021 addu r4,r20,r0 <Set Linear Presets> 0019c720: 0c067ca9 jal 0x0019f2a4 Transfer Unit Coordinates to AI 0019c724: 26a50c74 addiu r5,r21,0x0c74 0019c728: 92a30026 lbu r3,0x0026(r21) 0019c72c: 34020006 ori r2,r0,0x0006 0019c730: 14620002 bne r3,r2,0x0019c73c Branch if 4 and 2 flags aren't set 0019c734: 34040001 ori r4,r0,0x0001 Set AoE Mode 0019c738: 34040003 ori r4,r0,0x0003 Use Preset Range 0019c73c: 0c06723b jal 0x0019c8ec Check if Linear Ability Hits 0019c740: 00002821 addu r5,r0,r0 Range = 0 0019c744: 92a20e3b lbu r2,0x0e3b(r21) Load Max Y 0019c748: 00000000 nop 0019c74c: 18400010 blez r2,0x0019c790 Branch if negative 0019c750: 00008821 addu r17,r0,r0 0019c754: 02a03021 addu r6,r21,r0 0019c758: 26310001 addiu r17,r17,0x0001 0019c75c: 94c20bdc lhu r2,0x0bdc(r6) 0019c760: 94c40b4c lhu r4,0x0b4c(r6) 0019c764: 94c30c00 lhu r3,0x0c00(r6) 0019c768: 94c50b70 lhu r5,0x0b70(r6) 0019c76c: 00441025 or r2,r2,r4 0019c770: 00651825 or r3,r3,r5 0019c774: a4c20bdc sh r2,0x0bdc(r6) 0019c778: a4c30c00 sh r3,0x0c00(r6) 0019c77c: 92a20e3b lbu r2,0x0e3b(r21) Load Max Y 0019c780: 00000000 nop 0019c784: 0222102a slt r2,r17,r2 0019c788: 1440fff3 bne r2,r0,0x0019c758 0019c78c: 24c60002 addiu r6,r6,0x0002 0019c790: 26940001 addiu r20,r20,0x0001 0019c794: 2a820015 slti r2,r20,0x0015 0019c798: 1440ffdd bne r2,r0,0x0019c710 Loop for all units 0019c79c: 02b41021 addu r2,r21,r20
0019c7a0: 8ea2000c lw r2,0x000c(r21) Load AI Ability Behavior Flags 1-4 0019c7a4: 00000000 nop 0019c7a8: 30421000 andi r2,r2,0x1000 0019c7ac: 10400025 beq r2,r0,0x0019c844 Skip entire loop if not Vertical Fixed (AKA Red Panels are Linear) 0019c7b0: 00000000 nop 0019c7b4: 0000a021 addu r20,r0,r0 0019c7b8: 34080005 ori r8,r0,0x0005 0019c7bc: 34078000 ori r7,r0,0x8000 0019c7c0: 3c068019 lui r6,0x8019 0019c7c4: 24c608cc addiu r6,r6,0x08cc r6 = Unit Data 0019c7c8: 02b41021 addu r2,r21,r20 0019c7cc: 90420c8d lbu r2,0x0c8d(r2) 0019c7d0: 00000000 nop 0019c7d4: 10400017 beq r2,r0,0x0019c834 0019c7d8: 00c02821 addu r5,r6,r0 0019c7dc: 90c20058 lbu r2,0x0058(r6) Load Current Status 1 0019c7e0: 92a30026 lbu r3,0x0026(r21) Load ? Flags 0019c7e4: 00000000 nop 0019c7e8: 10680003 beq r3,r8,0x0019c7f8 Branch if ? == 0x05 0019c7ec: 30420004 andi r2,r2,0x0004 0019c7f0: 10400010 beq r2,r0,0x0019c834 Skip to Loop End if Unit Jumping 0019c7f4: 00000000 nop 0019c7f8: 94a30048 lhu r3,0x0048(r5) r3 = Unit Y 0019c7fc: 90a40048 lbu r4,0x0048(r5) r4 = Unit Y 0019c800: 00031bc2 srl r3,r3,0x0f 0019c804: 000310c0 sll r2,r3,0x03 0019c808: 00431021 addu r2,r2,r3 0019c80c: 00021080 sll r2,r2,0x02 0019c810: 00551021 addu r2,r2,r21 0019c814: 24420bdc addiu r2,r2,0x0bdc 0019c818: 00042040 sll r4,r4,0x01 0019c81c: 00822021 addu r4,r4,r2 0019c820: 90a20047 lbu r2,0x0047(r5) Load Unit X 0019c824: 94830000 lhu r3,0x0000(r4) 0019c828: 00471007 srav r2,r7,r2 0019c82c: 00621826 xor r3,r3,r2 0019c830: a4830000 sh r3,0x0000(r4) 0019c834: 26940001 addiu r20,r20,0x0001 0019c838: 2a820015 slti r2,r20,0x0015 0019c83c: 1440ffe2 bne r2,r0,0x0019c7c8 Loop for all units 0019c840: 24c601c0 addiu r6,r6,0x01c0
0019c844: 00008821 addu r17,r0,r0 0019c848: 02a03021 addu r6,r21,r0 0019c84c: 92a20e3b lbu r2,0x0e3b(r21) Load Max Y 0019c850: 00000000 nop 0019c854: 1840000e blez r2,0x0019c890 Branch if negative 0019c858: 00009021 addu r18,r0,r0 0019c85c: 24c40bdc addiu r4,r6,0x0bdc 0019c860: 24c50c24 addiu r5,r6,0x0c24 0019c864: 94a20000 lhu r2,0x0000(r5) 0019c868: 24a50002 addiu r5,r5,0x0002 0019c86c: 94830000 lhu r3,0x0000(r4) 0019c870: 26520001 addiu r18,r18,0x0001 0019c874: 00621824 and r3,r3,r2 0019c878: a4830000 sh r3,0x0000(r4) 0019c87c: 92a20e3b lbu r2,0x0e3b(r21) 0019c880: 00000000 nop 0019c884: 0242102a slt r2,r18,r2 0019c888: 1440fff6 bne r2,r0,0x0019c864 0019c88c: 24840002 addiu r4,r4,0x0002 0019c890: 26310001 addiu r17,r17,0x0001 0019c894: 2a220002 slti r2,r17,0x0002 0019c898: 1440ffec bne r2,r0,0x0019c84c 0019c89c: 24c60024 addiu r6,r6,0x0024
0019c8a0: 0c065f1a jal 0x00197c68 Final Targeting Check 0019c8a4: 26a40bdc addiu r4,r21,0x0bdc 0019c8a8: 26a40b94 addiu r4,r21,0x0b94 0019c8ac: 0c065f1a jal 0x00197c68 Final Targeting Check 0019c8b0: a2a20cbb sb r2,0x0cbb(r21) 0019c8b4: a2a20cbc sb r2,0x0cbc(r21) 0019c8b8: 8fbf006c lw r31,0x006c(r29) 0019c8bc: 8fbe0068 lw r30,0x0068(r29) 0019c8c0: 8fb70064 lw r23,0x0064(r29) 0019c8c4: 8fb60060 lw r22,0x0060(r29) 0019c8c8: 8fb5005c lw r21,0x005c(r29) 0019c8cc: 8fb40058 lw r20,0x0058(r29) 0019c8d0: 8fb30054 lw r19,0x0054(r29) 0019c8d4: 8fb20050 lw r18,0x0050(r29) 0019c8d8: 8fb1004c lw r17,0x004c(r29) 0019c8dc: 8fb00048 lw r16,0x0048(r29) 0019c8e0: 27bd0070 addiu r29,r29,0x0070 0019c8e4: 03e00008 jr r31 0019c8e8: 00000000 nop