Some targetability setting
Jump to navigation
Jump to search
Targeting based on remaining Units 00194570: 3c02801a lui r2,0x801a 00194574: 8c4201f8 lw r2,0x01f8(r2) Acting Unit's AI Decision Pointer 00194578: 27bdffd0 addiu r29,r29,0xffd0 0019457c: afbf002c sw r31,0x002c(r29) 00194580: afb60028 sw r22,0x0028(r29) 00194584: afb50024 sw r21,0x0024(r29) 00194588: afb40020 sw r20,0x0020(r29) 0019458c: afb3001c sw r19,0x001c(r29) 00194590: afb20018 sw r18,0x0018(r29) 00194594: afb10014 sw r17,0x0014(r29) 00194598: afb00010 sw r16,0x0010(r29) 0019459c: 3c01801a lui r1,0x801a 001945a0: a0200d7f sb r0,0x0d7f(r1) 001945a4: 90420007 lbu r2,0x0007(r2) Load AI Targeting Flags 2 001945a8: 3c16801a lui r22,0x801a 001945ac: 26d6f3c4 addiu r22,r22,0xf3c4 001945b0: 30420008 andi r2,r2,0x0008 001945b4: 14400009 bne r2,r0,0x001945dc Branch if Enemy (Charm/Invite) 001945b8: 3c03bfff lui r3,0xbfff If Death Sentence 001945bc: 3c02801a lui r2,0x801a 001945c0: 8c420bbc lw r2,0x0bbc(r2) Load Acting Unit Data 001945c4: 00000000 nop 001945c8: 9042005c lbu r2,0x005c(r2) Load Current Status 5 001945cc: 00000000 nop 001945d0: 30420001 andi r2,r2,0x0001 001945d4: 10400009 beq r2,r0,0x001945fc Branch unless Death Sentence 001945d8: 00009821 addu r19,r0,r0 DS/Charm/Invite 001945dc: 3c02801a lui r2,0x801a 001945e0: 8c420078 lw r2,0x0078(r2) Load target setting 001945e4: 3463ffff ori r3,r3,0xffff 001945e8: 00431024 and r2,r2,r3 001945ec: 3c01801a lui r1,0x801a 001945f0: ac220078 sw r2,0x0078(r1) Save new target setting 001945f4: 080651bc j 0x001946f0 Exit 001945f8: 00000000 nop Determine # of allies, OK allies, and enemies 001945fc: 0000a821 addu r21,r0,r0 Initialize counters 00194600: 0000a021 addu r20,r0,r0 00194604: 00008021 addu r16,r0,r0 00194608: 00009021 addu r18,r0,r0 0019460c: 02c08821 addu r17,r22,r0 00194610: 0c065b23 jal 0x00196c8c Check if unit target type 00194614: 02002021 addu r4,r16,r0 00194618: 1440000f bne r2,r0,0x00194658 Next Unit if untargetable 0019461c: 00000000 nop 00194620: 92221834 lbu r2,0x1834(r17) Load Enemy Flag 00194624: 00000000 nop 00194628: 10400003 beq r2,r0,0x00194638 Branch if not an enemy 0019462c: 00000000 nop 00194630: 08065196 j 0x00194658 Next Unit 00194634: 26b50001 addiu r21,r21,0x0001 Enemy++ 00194638: 3c018019 lui r1,0x8019 0019463c: 00320821 addu r1,r1,r18 00194640: 90220926 lbu r2,0x0926(r1) Load Current Status 3 00194644: 00000000 nop 00194648: 30420003 andi r2,r2,0x0003 0019464c: 10400002 beq r2,r0,0x00194658 Branch if not Frog/Critical 00194650: 26730001 addiu r19,r19,0x0001 Ally++ 00194654: 26940001 addiu r20,r20,0x0001 OK++ 00194658: 265201c0 addiu r18,r18,0x01c0 Unit Data++ 0019465c: 26100001 addiu r16,r16,0x0001 Unit++ 00194660: 2a020015 slti r2,r16,0x0015 00194664: 1440ffea bne r2,r0,0x00194610 Loop for all units 00194668: 26310010 addiu r17,r17,0x0010 Unit AI++
Desperation Mode (Blue Only)
0019466c: 12740003 beq r19,r20,0x0019467c Branch if OK units = Ally Units 00194670: 2a620002 slti r2,r19,0x0002 00194674: 10400016 beq r2,r0,0x001946d0 Branch if 2+ units are OK 00194678: 34020001 ori r2,r0,0x0001 0019467c: 92c20e39 lbu r2,0x0e39(r22) Load Acting Unit's Team 00194680: 00000000 nop 00194684: 1040000d beq r2,r0,0x001946bc Branch if Uncontrolled Blue 00194688: 00008021 addu r16,r0,r0
Set Units as Allied (Red/Green Only)
0019468c: 02c01821 addu r3,r22,r0 00194690: 90621834 lbu r2,0x1834(r3) Load Enemy Flag 00194694: 00000000 nop 00194698: 14400005 bne r2,r0,0x001946b0 Next Unit if Enemy 0019469c: 26100001 addiu r16,r16,0x0001 001946a0: 90621833 lbu r2,0x1833(r3) Load AI Targeting Flags 2 001946a4: 00000000 nop 001946a8: 34420008 ori r2,r2,0x0008 001946ac: a0621833 sb r2,0x1833(r3) Unit is Allied unit 001946b0: 2a020015 slti r2,r16,0x0015 001946b4: 1440fff6 bne r2,r0,0x00194690 Loop for all units 001946b8: 24630010 addiu r3,r3,0x0010
Set Desperation
001946bc: 3c03bfff lui r3,0xbfff 001946c0: 8ec20cb4 lw r2,0x0cb4(r22) Load Target Setting 001946c4: 3463ffff ori r3,r3,0xffff 001946c8: 080651bb j 0x001946ec Save and Exit 001946cc: 00431024 and r2,r2,r3
Kill Final Target
001946d0: 16a20003 bne r21,r2,0x001946e0 Branch unless there is only one Enemy left 001946d4: 3c034000 lui r3,0x4000 001946d8: 34020001 ori r2,r0,0x0001 001946dc: a2c219bb sb r2,0x19bb(r22) Save to Unit targetable flag (Override Untargetable) 001946e0: 8ec20cb4 lw r2,0x0cb4(r22) Same as 0x0078 001946e4: 00000000 nop 001946e8: 00431025 or r2,r2,r3 001946ec: aec20cb4 sw r2,0x0cb4(r22) Save new target setting 001946f0: 8fbf002c lw r31,0x002c(r29) 001946f4: 8fb60028 lw r22,0x0028(r29) 001946f8: 8fb50024 lw r21,0x0024(r29) 001946fc: 8fb40020 lw r20,0x0020(r29) 00194700: 8fb3001c lw r19,0x001c(r29) 00194704: 8fb20018 lw r18,0x0018(r29) 00194708: 8fb10014 lw r17,0x0014(r29) 0019470c: 8fb00010 lw r16,0x0010(r29) 00194710: 27bd0030 addiu r29,r29,0x0030 00194714: 03e00008 jr r31 00194718: 00000000 nop