Difference between revisions of "Main AI action setup"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Line 1: Line 1:
jumped to from 7537c
 
 
  00193e50: 27bdffe0 addiu r29,r29,0xffe0
 
  00193e50: 27bdffe0 addiu r29,r29,0xffe0
 
  00193e54: afb20018 sw r18,0x0018(r29)
 
  00193e54: afb20018 sw r18,0x0018(r29)
  00193e58: 00809021 addu r18,r4,r0 r18 = Unit ID
+
  00193e58: 00809021 addu r18,r4,r0 r18 = Unit ID
  00193e5c: afb10014 sw r17,0x0014(r29)
+
  00193e5c: afb10014 sw r17,0x0014(r29)
  00193e60: 00a08821 addu r17,r5,r0 r17 = ? Pointer (0x158 in Misc Unit Data)
+
  00193e60: 00a08821 addu r17,r5,r0 r17 = ? Pointer (0x158 in Misc Unit Data)
  00193e64: 34040001 ori r4,r0,0x0001 r4 = 1
+
  00193e64: 34040001 ori r4,r0,0x0001 r4 = 1
  00193e68: afbf001c sw r31,0x001c(r29)
+
  00193e68: afbf001c sw r31,0x001c(r29)
  00193e6c: 0c0076ea jal 0x0001dba8 [[0001dba8 - 0001dcec]] (Calculate Cycles Passed?)
+
  00193e6c: 0c0076ea jal 0x0001dba8 [[0001dba8 - 0001dcec]] (Calculate Cycles Passed?)
  00193e70: afb00010 sw r16,0x0010(r29)
+
  00193e70: afb00010 sw r16,0x0010(r29)
  00193e74: 3c10801a lui r16,0x801a
+
  00193e74: 3c10801a lui r16,0x801a
  00193e78: 2610f3c4 addiu r16,r16,0xf3c4 r16 = Ai Data Pointer
+
  00193e78: 2610f3c4 addiu r16,r16,0xf3c4 r16 = AI Data Pointer
  00193e7c: 284201b9 slti r2,r2,0x01b9
+
  00193e7c: 284201b9 slti r2,r2,0x01b9
  00193e80: 104000d6 beq r2,r0,0x001941dc Branch if Cycles Passed? >= 0x1b9
+
  00193e80: 104000d6 beq r2,r0,0x001941dc Exit and Return -1 if Frame RNG said so
  00193e84: 2402ffff addiu r2,r0,0xffff r2 = -1 (Fail)
+
  00193e84: 2402ffff addiu r2,r0,0xffff
  00193e88: 3c02801a lui r2,0x801a
+
 
  00193e8c: 90420d7b lbu r2,0x0d7b(r2) Load ?
+
  00193e88: 3c02801a lui r2,0x801a
  00193e90: 00000000 nop
+
  00193e8c: 90420d7b lbu r2,0x0d7b(r2) If Action = Decided
  00193e94: 1040000f beq r2,r0,0x00193ed4 Branch if ? = 0
+
  00193e90: 00000000 nop
  00193e98: 34020001 ori r2,r0,0x0001 r2 = 1
+
  00193e94: 1040000f beq r2,r0,0x00193ed4 Branch if no Action was decided
  00193e9c: 3c03801a lui r3,0x801a
+
 
  00193ea0: 90630298 lbu r3,0x0298(r3) Load ?
+
<AI Progress>
  00193ea4: 00000000 nop
+
  00193e98: 34020001 ori r2,r0,0x0001 r2 = 1
  00193ea8: 1062005f beq r3,r2,0x00194028 Branch if ? = 1
+
  00193e9c: 3c03801a lui r3,0x801a
  00193eac: 28620002 slti r2,r3,0x0002
+
  00193ea0: 90630298 lbu r3,0x0298(r3) Load AI Progress
  00193eb0: 10400005 beq r2,r0,0x00193ec8 Branch if ? >= 2
+
  00193ea4: 00000000 nop
  00193eb4: 00000000 nop
+
  00193ea8: 1062005f beq r3,r2,0x00194028 Branch if AI Progress = 1
  00193eb8: 1060004d beq r3,r0,0x00193ff0 Branch if ? = 0
+
  00193eac: 28620002 slti r2,r3,0x0002
  00193ebc: 00000000 nop
+
  00193eb0: 10400005 beq r2,r0,0x00193ec8 Branch if AI Progress >= 2
  00193ec0: 08064fb5 j 0x00193ed4
+
  00193eb4: 00000000 nop
  00193ec4: 00000000 nop
+
  00193eb8: 1060004d beq r3,r0,0x00193ff0 Branch if AI Progress = 0
  00193ec8: 34020002 ori r2,r0,0x0002
+
  00193ebc: 00000000 nop
  00193ecc: 10620066 beq r3,r2,0x00194068 Branch if ? = 2
+
  00193ec0: 08064fb5 j 0x00193ed4 Jump if -1
 +
  00193ec4: 00000000 nop
 +
  00193ec8: 34020002 ori r2,r0,0x0002
 +
  00193ecc: 10620066 beq r3,r2,0x00194068 Branch if AI Progress = 2
 
  00193ed0: 00000000 nop
 
  00193ed0: 00000000 nop
  00193ed4: 92031818 lbu r3,0x1818(r16) Load ?
+
 
  00193ed8: 340200ff ori r2,r0,0x00ff
+
 
  00193edc: 1462000f bne r3,r2,0x00193f1c Branch if ? != FF
+
  00193ed4: 92031818 lbu r3,0x1818(r16) Load Choice Byte
  00193ee0: 02121021 addu r2,r16,r18 r2 = AI Data Pointer + Unit ID
+
  00193ed8: 340200ff ori r2,r0,0x00ff
  00193ee4: 8e0417f8 lw r4,0x17f8(r16) Load Acting Unit's Data Pointer
+
  00193edc: 1462000f bne r3,r2,0x00193f1c Branch if AI did not make a decision
  00193ee8: 920219be lbu r2,0x19be(r16) Load Desired Movement Flag?
+
 
  00193eec: 90830187 lbu r3,0x0187(r4) Load Unit's Movement Taken? Flag
+
<Movement>
  00193ef0: 00000000 nop
+
  00193ee0: 02121021 addu r2,r16,r18 r2 = AI Data Pointer + Unit ID
  00193ef4: 14620009 bne r3,r2,0x00193f1c Branch if Unit's Flag != Desired Flag?
+
  00193ee4: 8e0417f8 lw r4,0x17f8(r16) Load Acting Unit's Data Pointer
  00193ef8: 02121021 addu r2,r16,r18 r2 = AI Data Pointer + Unit ID
+
  00193ee8: 920219be lbu r2,0x19be(r16) Load Desired Movement Flag?
  00193efc: 90830188 lbu r3,0x0188(r4) Load Unit's Action Taken? Flag
+
  00193eec: 90830187 lbu r3,0x0187(r4) Load Unit's Movement Taken? Flag
  00193f00: 920219bd lbu r2,0x19bd(r16) Load Desired Action Flag?
+
  00193ef0: 00000000 nop
  00193f04: 00000000 nop
+
  00193ef4: 14620009 bne r3,r2,0x00193f1c Branch if Unit's Flag != Desired Flag?
  00193f08: 14620004 bne r3,r2,0x00193f1c Branch if Unit's Flag != Desired Flag?
+
 
  00193f0c: 02121021 addu r2,r16,r18 r2 = AI Data Pointer + Unit ID
+
<Action>
  00193f10: 34020002 ori r2,r0,0x0002 r2 = 2
+
  00193ef8: 02121021 addu r2,r16,r18 r2 = AI Data Pointer + Unit ID
  00193f14: 08065076 j 0x001941d8
+
  00193efc: 90830188 lbu r3,0x0188(r4) Load Unit's Action Taken? Flag
  00193f18: ae220000 sw r2,0x0000(r17) Store ? = 2
+
  00193f00: 920219bd lbu r2,0x19bd(r16) Load Desired Action Flag?
  00193f1c: a2120e2e sb r18,0x0e2e(r16) Store Acting Unit's ID
+
  00193f04: 00000000 nop
  00193f20: 9042198c lbu r2,0x198c(r2) Load Unit's Battle ID
+
  00193f08: 14620004 bne r3,r2,0x00193f1c Branch if Unit's Flag != Desired Flag?
  00193f24: 00000000 nop
+
  00193f0c: 02121021 addu r2,r16,r18 r2 = AI Data Pointer + Unit ID
  00193f28: 2c420010 sltiu r2,r2,0x0010
+
  00193f10: 34020002 ori r2,r0,0x0002 r2 = 2
  00193f2c: 14400004 bne r2,r0,0x00193f40 Branch if ID is legal
+
  00193f14: 08065076 j 0x001941d8 Exit and Return 0
  00193f30: 00001821 addu r3,r0,r0 Counter = 0
+
  00193f18: ae220000 sw r2,0x0000(r17) Store ? = 2 (Taking Action?)
  00193f34: 34020002 ori r2,r0,0x0002 r2 = 2
+
 
  00193f38: 08065076 j 0x001941d8
+
<AI hasn't made a complete decision yet>
  00193f3c: ae220000 sw r2,0x0000(r17) Store ? = 2
+
  00193f1c: a2120e2e sb r18,0x0e2e(r16) Store Acting Unit's ID
  00193f40: 340500ff ori r5,r0,0x00ff r5 = FF
+
 
  00193f44: 00002021 addu r4,r0,r0 Pointer Mod = 0
+
<Evalulate Battle IDs for all units>
  00193f48: 3c018019 lui r1,0x8019
+
  00193f20: 9042198c lbu r2,0x198c(r2) Load Unit's Battle ID
  00193f4c: 00240821 addu r1,r1,r4
+
  00193f24: 00000000 nop
  00193f50: 902208cd lbu r2,0x08cd(r1) Load Unit's ID
+
  00193f28: 2c420010 sltiu r2,r2,0x0010
  00193f54: 00000000 nop
+
  00193f2c: 14400004 bne r2,r0,0x00193f40 Branch if ID is legal
  00193f58: 10450007 beq r2,r5,0x00193f78 Branch if unit doesn't exist
+
  00193f30: 00001821 addu r3,r0,r0 Initialize Unit Counter
  00193f5c: 248401c0 addiu r4,r4,0x01c0 Pointer Mod += 0x1c0
+
 
  00193f60: 02031021 addu r2,r16,r3
+
  00193f34: 34020002 ori r2,r0,0x0002 r2 = 2
  00193f64: 9042198c lbu r2,0x198c(r2) Load Unit's Battle ID
+
  00193f38: 08065076 j 0x001941d8
  00193f68: 00000000 nop
+
  00193f3c: ae220000 sw r2,0x0000(r17) Store ? = 2
  00193f6c: 2c420010 sltiu r2,r2,0x0010
+
 
  00193f70: 1040007f beq r2,r0,0x00194170 Branch if ID is illegal
+
  00193f40: 340500ff ori r5,r0,0x00ff r5 = FF
  00193f74: 34020002 ori r2,r0,0x0002 r2 = 2
+
  00193f44: 00002021 addu r4,r0,r0 Pointer Mod = 0
  00193f78: 24630001 addiu r3,r3,0x0001 Counter ++
+
  00193f48: 3c018019 lui r1,0x8019
  00193f7c: 28620015 slti r2,r3,0x0015
+
  00193f4c: 00240821 addu r1,r1,r4
  00193f80: 1440fff1 bne r2,r0,0x00193f48 Branch if Counter < 0x15
+
  00193f50: 902208cd lbu r2,0x08cd(r1) Load Unit's ID
  00193f84: 00000000 nop
+
  00193f54: 00000000 nop
  00193f88: 0c06507e jal 0x001941f8 [[Acting Unit's Data Setup]]
+
  00193f58: 10450007 beq r2,r5,0x00193f78 Branch if unit doesn't exist
  00193f8c: 00000000 nop
+
  00193f5c: 248401c0 addiu r4,r4,0x01c0 Pointer Mod += 0x1c0
  00193f90: 8e0217f8 lw r2,0x17f8(r16) Load Acting Unit's Data Pointer
+
  00193f60: 02031021 addu r2,r16,r3
  00193f94: 00000000 nop
+
  00193f64: 9042198c lbu r2,0x198c(r2) Load Unit's Battle ID
  00193f98: 9043015d lbu r3,0x015d(r2) Load Unit's Current Ability CT
+
  00193f68: 00000000 nop
  00193f9c: 340200ff ori r2,r0,0x00ff
+
  00193f6c: 2c420010 sltiu r2,r2,0x0010
  00193fa0: 14620007 bne r3,r2,0x00193fc0 Branch if Unit is charging something
+
  00193f70: 1040007f beq r2,r0,0x00194170 Branch if ID is illegal
  00193fa4: 00000000 nop
+
  00193f74: 34020002 ori r2,r0,0x0002 r2 = 2
  00193fa8: 8e030e34 lw r3,0x0e34(r16) Load Acting Unit's AI Decision Pointer
+
<Unit++>
  00193fac: 00000000 nop
+
  00193f78: 24630001 addiu r3,r3,0x0001 Counter ++
  00193fb0: 90620006 lbu r2,0x0006(r3) Load ?
+
  00193f7c: 28620015 slti r2,r3,0x0015
  00193fb4: 00000000 nop
+
  00193f80: 1440fff1 bne r2,r0,0x00193f48 Branch if Counter < 0x15
  00193fb8: 304200f7 andi r2,r2,0x00f7 Disable 0x8 (Charging?)
+
  00193f84: 00000000 nop
  00193fbc: a0620006 sb r2,0x0006(r3) Store new ?
+
 
  00193fc0: 92021818 lbu r2,0x1818(r16) Load ?
+
 
  00193fc4: 00000000 nop
+
  00193f88: 0c06507e jal 0x001941f8 Acting Unit's Data Setup
  00193fc8: 10400007 beq r2,r0,0x00193fe8 Branch if ? = 0
+
  00193f8c: 00000000 nop
  00193fcc: 00000000 nop
+
  00193f90: 8e0217f8 lw r2,0x17f8(r16) Load Acting Unit's Data Pointer
  00193fd0: 8e0217f8 lw r2,0x17f8(r16) Load Acting Unit's Data Pointer
+
  00193f94: 00000000 nop
  00193fd4: 00000000 nop
+
  00193f98: 9043015d lbu r3,0x015d(r2) Load Unit's Current Ability CT
  00193fd8: 90420188 lbu r2,0x0188(r2) Load Unit's Action Taken Flag
+
  00193f9c: 340200ff ori r2,r0,0x00ff
  00193fdc: 00000000 nop
+
  00193fa0: 14620007 bne r3,r2,0x00193fc0 Branch if Unit is charging something
  00193fe0: 10400038 beq r2,r0,0x001940c4 Branch if Unit hasn't acted
+
  00193fa4: 00000000 nop
 +
  00193fa8: 8e030e34 lw r3,0x0e34(r16) Load Acting Unit's AI Decision Pointer
 +
  00193fac: 00000000 nop
 +
  00193fb0: 90620006 lbu r2,0x0006(r3) Load Targeting Flags
 +
  00193fb4: 00000000 nop
 +
  00193fb8: 304200f7 andi r2,r2,0x00f7 Disable Charging/Performing Flag
 +
  00193fbc: a0620006 sb r2,0x0006(r3) Store new Targeting Flags
 +
 
 +
<No Decision or Act>
 +
  00193fc0: 92021818 lbu r2,0x1818(r16) Load Choice Byte
 +
  00193fc4: 00000000 nop
 +
  00193fc8: 10400007 beq r2,r0,0x00193fe8 <Set Targets> if AI could not make a decision
 +
  00193fcc: 00000000 nop
 +
  00193fd0: 8e0217f8 lw r2,0x17f8(r16) Load Acting Unit's Data Pointer
 +
  00193fd4: 00000000 nop
 +
  00193fd8: 90420188 lbu r2,0x0188(r2) Load Unit's Action Taken Flag
 +
  00193fdc: 00000000 nop
 +
  00193fe0: 10400038 beq r2,r0,0x001940c4 Branch if Unit hasn't acted
 
  00193fe4: 00000000 nop
 
  00193fe4: 00000000 nop
  00193fe8: 0c063979 jal 0x0018e5e4 [[Transfer Considered Action Data to AI]]
+
 
  00193fec: 00000000 nop
+
<Set Targets> (Act Chosen or already Acted?)
  00193ff0: 0c0650c5 jal 0x00194314 [[Set type of target for all targets]]
+
  00193fe8: 0c063979 jal 0x0018e5e4 Transfer Considered Action Data to AI
  00193ff4: 00000000 nop
+
  00193fec: 00000000 nop
  00193ff8: 2403ffff addiu r3,r0,0xffff
+
  00193ff0: 0c0650c5 jal 0x00194314 Set type of target for all targets
  00193ffc: 14430005 bne r2,r3,0x 00194014 branch if return value isn't 0xffff
+
  00193ff4: 00000000 nop
  00194000: 2402ffff addiu r2,r0,0xffff
+
  00193ff8: 2403ffff addiu r3,r0,0xffff
  00194004: 34030001 ori r3,r0,0x0001
+
  00193ffc: 14430005 bne r2,r3,0x 00194014 Branch if Frame Data said so
  00194008: a2000ed4 sb r0,0x0ed4(r16)
+
  00194000: 2402ffff addiu r2,r0,0xffff
  0019400c: 08065077 j 0x001941dc
+
  00194004: 34030001 ori r3,r0,0x0001
  00194010: a20319b7 sb r3,0x19b7(r16)
+
  00194008: a2000ed4 sb r0,0x0ed4(r16)
   
+
  0019400c: 08065077 j 0x001941dc Exit and Return -1
 +
  00194010: a20319b7 sb r3,0x19b7(r16) Action = Decided
 +
 
 +
  <Movement and Considerations>
 
  00194014: 8e0217f8 lw r2,0x17f8(r16) load unit data
 
  00194014: 8e0217f8 lw r2,0x17f8(r16) load unit data
  00194018: 00000000 nop
+
  00194018: 00000000 nop
 
  0019401c: 90440188 lbu r4,0x0188(r2) load able to act flag
 
  0019401c: 90440188 lbu r4,0x0188(r2) load able to act flag
  00194020: 0c065396 jal 0x00194e58 [[Set AI ability considerations for all units and self]]
+
  00194020: 0c065396 jal 0x00194e58 Set AI ability considerations for all units and self
  00194024: 00000000 nop
+
  00194024: 00000000 nop
  00194028: 8e0217f8 lw r2,0x17f8(r16)
+
  00194028: 8e0217f8 lw r2,0x17f8(r16)
  0019402c: 00000000 nop
+
  0019402c: 00000000 nop
 
  00194030: 90440187 lbu r4,0x0187(r2) load move flag
 
  00194030: 90440187 lbu r4,0x0187(r2) load move flag
  00194034: 0c065251 jal 0x00194944 [[AI movement/panel data setting]]
+
  00194034: 0c065251 jal 0x00194944 AI movement/panel data setting
  00194038: 00000000 nop
+
  00194038: 00000000 nop
  0019403c: 2403ffff addiu r3,r0,0xffff
+
  0019403c: 2403ffff addiu r3,r0,0xffff
  00194040: 14430005 bne r2,r3,0x 00194058
+
  00194040: 14430005 bne r2,r3,0x 00194058 Branch if the RNG said to; else always branch
  00194044: 2402ffff addiu r2,r0,0xffff
+
  00194044: 2402ffff addiu r2,r0,0xffff
  00194048: 34030001 ori r3,r0,0x0001
+
  00194048: 34030001 ori r3,r0,0x0001
  0019404c: a2030ed4 sb r3,0x0ed4(r16)
+
  0019404c: a2030ed4 sb r3,0x0ed4(r16)
  00194050: 08065077 j 0x 001941dc
+
  00194050: 08065077 j 0x 001941dc Exit and Return -1
  00194054: a20319b7 sb r3,0x19b7(r16)
+
  00194054: a20319b7 sb r3,0x19b7(r16) Action = Decided
+
  00194058: 0c06515c jal 0x00194570 [[Some targetability setting]]
+
  00194058: 0c06515c jal 0x00194570 Some targetability setting
  0019405c: a2 0019b7 sb r0,0x19b7(r16)
+
  0019405c: a20019b7 sb r0,0x19b7(r16) Action = Not Decided
  00194060: 0c0651c7 jal 0x0019471c [[Set AI flags for target consideration]]
+
  00194060: 0c0651c7 jal 0x0019471c Set AI flags for target consideration
  00194064: 00000000 nop
+
  00194064: 00000000 nop
  00194068: 0c065765 jal 0x00195d94 [[00195d94 - 00195f68]]
+
  00194068: 0c065765 jal 0x00195d94 00195d94 - 00195f68
  0019406c: 00000000 nop
+
  0019406c: 00000000 nop
  00194070: 2403ffff addiu r3,r0,0xffff
+
  00194070: 2403ffff addiu r3,r0,0xffff
  00194074: 14430007 bne r2,r3,0x 00194094
+
  00194074: 14430007 bne r2,r3,0x 00194094
  00194078: 340200ff ori r2,r0,0x00ff
+
  00194078: 340200ff ori r2,r0,0x00ff
  0019407c: 2402ffff addiu r2,r0,0xffff
+
  0019407c: 2402ffff addiu r2,r0,0xffff
  00194080: 34030002 ori r3,r0,0x0002
+
  00194080: 34030002 ori r3,r0,0x0002
  00194084: a2030ed4 sb r3,0x0ed4(r16)
+
  00194084: a2030ed4 sb r3,0x0ed4(r16)
  00194088: 34030001 ori r3,r0,0x0001
+
  00194088: 34030001 ori r3,r0,0x0001
  0019408c: 08065077 j 0x 001941dc
+
  0019408c: 08065077 j 0x 001941dc
  00194090: a20319b7 sb r3,0x19b7(r16)
+
  00194090: a20319b7 sb r3,0x19b7(r16) Action = Decided
+
  00194094: 920317fd lbu r3,0x17fd(r16)
+
  00194094: 920317fd lbu r3,0x17fd(r16)
  00194098: a2 0019b7 sb r0,0x19b7(r16)
+
  00194098: a20019b7 sb r0,0x19b7(r16) Action = Not Decided
  0019409c: 10600007 beq r3,r0,0x 001940bc
+
  0019409c: 10600007 beq r3,r0,0x 001940bc
  001940a0: a2021818 sb r2,0x1818(r16)
+
  001940a0: a2021818 sb r2,0x1818(r16) Save Choice Byte
 
  001940a4: 8e030e34 lw r3,0x0e34(r16) load decision data
 
  001940a4: 8e030e34 lw r3,0x0e34(r16) load decision data
  001940a8: 00000000 nop
+
  001940a8: 00000000 nop
  001940ac: 90620006 lbu r2,0x0006(r3)
+
  001940ac: 90620006 lbu r2,0x0006(r3)
  001940b0: 00000000 nop
+
  001940b0: 00000000 nop
  001940b4: 34420008 ori r2,r2,0x0008
+
  001940b4: 34420008 ori r2,r2,0x0008
  001940b8: a0620006 sb r2,0x0006(r3) store charging byte
+
  001940b8: a0620006 sb r2,0x0006(r3) store charging byte
  001940bc: 0c06398a jal 0x0018e628 [[Store current attack data into AI?]]
+
  001940bc: 0c06398a jal 0x0018e628 Store current attack data into AI?
  001940c0: 00000000 nop
+
  001940c0: 00000000 nop
  001940c4: 8e0317f8 lw r3,0x17f8(r16)
+
  001940c4: 8e0317f8 lw r3,0x17f8(r16) Load Acting Unit's Data
  001940c8: 00000000 nop
+
  001940c8: 00000000 nop
  001940cc: 90620187 lbu r2,0x0187(r3) load move flag
+
  001940cc: 90620187 lbu r2,0x0187(r3) load move flag
  001940d0: 00000000 nop
+
  001940d0: 00000000 nop
  001940d4: 1440 0019 bne r2,r0,0x 0019413c branch if able to move
+
  001940d4: 14400019 bne r2,r0,0x 0019413c branch if able to move
  001940d8: 00000000 nop
+
  001940d8: 00000000 nop
  001940dc: 90620188 lbu r2,0x0188(r3) load act flag
+
  001940dc: 90620188 lbu r2,0x0188(r3) load act flag
  001940e0: 00000000 nop
+
  001940e0: 00000000 nop
 
  001940e4: 14400005 bne r2,r0,0x 001940fc branch if able to act
 
  001940e4: 14400005 bne r2,r0,0x 001940fc branch if able to act
 
  001940e8: 00000000 nop
 
  001940e8: 00000000 nop
  001940ec: 920217fc lbu r2,0x17fc(r16)
+
 
  001940f0: 00000000 nop
+
<Neither Act or Move>
  001940f4: 14400011 bne r2,r0,0x 0019413c
+
  001940ec: 920217fc lbu r2,0x17fc(r16)
 +
  001940f0: 00000000 nop
 +
  001940f4: 14400011 bne r2,r0,0x 0019413c <If Move> if True
 
  001940f8: 00000000 nop
 
  001940f8: 00000000 nop
 +
 +
<Act, but not Move>
 +
001940fc: a2001803 sb r0,0x1803(r16)
 +
00194100: 8e031800 lw r3,0x1800(r16)
 +
00194104: 8e020e30 lw r2,0x0e30(r16)
 +
00194108: 00000000 nop
 +
0019410c: 1062000b beq r3,r2,0x 0019413c
 +
00194110: 00000000 nop
 +
00194114: ae200000 sw r0,0x0000(r17)
 +
00194118: 92021800 lbu r2,0x1800(r16)
 +
0019411c: 00000000 nop
 +
00194120: a6220004 sh r2,0x0004(r17)
 +
00194124: 92021802 lbu r2,0x1802(r16)
 +
00194128: 00000000 nop
 +
0019412c: a6220008 sh r2,0x0008(r17)
 +
00194130: 92021801 lbu r2,0x1801(r16)
 +
00194134: 08065063 j 0x0019418c
 +
00194138: a6220006 sh r2,0x0006(r17)
  
if able to act but not move
+
  <If Move>
  001940fc: a2001803 sb r0,0x1803(r16)
+
  0019413c: 8e0217f8 lw r2,0x17f8(r16)
00194100: 8e031800 lw r3,0x1800(r16)
+
  00194140: 00000000 nop
00194104: 8e020e30 lw r2,0x0e30(r16)
+
  00194144: 90420188 lbu r2,0x0188(r2) load act flag
00194108: 00000000 nop
+
  00194148: 00000000 nop
0019410c: 1062000b beq r3,r2,0x 0019413c
+
  0019414c: 14400006 bne r2,r0,0x 00194168 branch if able to act
00194110: 00000000 nop
+
  00194150: 34020002 ori r2,r0,0x0002
00194114: ae200000 sw r0,0x0000(r17)
 
00194118: 92021800 lbu r2,0x1800(r16)
 
0019411c: 00000000 nop
 
00194120: a6220004 sh r2,0x0004(r17)
 
00194124: 92021802 lbu r2,0x1802(r16)
 
00194128: 00000000 nop
 
0019412c: a6220008 sh r2,0x0008(r17)
 
00194130: 92021801 lbu r2,0x1801(r16)
 
00194134: 08065063 j 0x0019418c
 
00194138: a6220006 sh r2,0x0006(r17)
 
 
 
if able to move
 
  0019413c: 8e0217f8 lw r2,0x17f8(r16)
 
  00194140: 00000000 nop
 
  00194144: 90420188 lbu r2,0x0188(r2) load act flag
 
  00194148: 00000000 nop
 
  0019414c: 14400006 bne r2,r0,0x 00194168 branch if able to act
 
  00194150: 34020002 ori r2,r0,0x0002
 
  
if able to move but not act
+
<Move, but not Act>
  00194154: 92021805 lbu r2,0x1805(r16)
+
  00194154: 92021805 lbu r2,0x1805(r16)
  00194158: 00000000 nop
+
  00194158: 00000000 nop
  0019415c: 14400006 bne r2,r0,0x 00194178
+
  0019415c: 14400006 bne r2,r0,0x 00194178
  00194160: 34020001 ori r2,r0,0x0001
+
  00194160: 34020001 ori r2,r0,0x0001
  00194164: 34020002 ori r2,r0,0x0002
+
  00194164: 34020002 ori r2,r0,0x0002
  
if able to move and act
+
<Act and Move>
  00194168: 08065063 j 0x 0019418c
+
  00194168: 08065063 j 0x 0019418c
  0019416c: ae220000 sw r2,0x0000(r17)
+
  0019416c: ae220000 sw r2,0x0000(r17)
+
  00194170: 08065076 j 0x 001941d8
+
  00194170: 08065076 j 0x 001941d8 Exit and do not transfer data
  00194174: ae220000 sw r2,0x0000(r17)
+
  00194174: ae220000 sw r2,0x0000(r17)
+
  00194178: ae220000 sw r2,0x0000(r17)
+
  00194178: ae220000 sw r2,0x0000(r17)
  0019417c: 26240004 addiu r4,r17,0x0004
+
  0019417c: 26240004 addiu r4,r17,0x0004
  00194180: 26051804 addiu r5,r16,0x1804
+
  00194180: 26051804 addiu r5,r16,0x1804
  00194184: 0c066ac2 jal 0x0019ab08 [[Transfer Halfword Values]]
+
  00194184: 0c066ac2 jal 0x0019ab08 Transfer Halfword Values
 
  00194188: 34060014 ori r6,r0,0x0014
 
  00194188: 34060014 ori r6,r0,0x0014
  0019418c: 8e0217f8 lw r2,0x17f8(r16)
+
  00194190: 8e0317f8 lw r3,0x17f8(r16)
+
  0019418c: 8e0217f8 lw r2,0x17f8(r16)
  00194194: 90420187 lbu r2,0x0187(r2) load move flag?
+
  00194190: 8e0317f8 lw r3,0x17f8(r16)
  00194198: 00000000 nop
+
  00194194: 90420187 lbu r2,0x0187(r2) load move flag
  0019419c: a20219be sb r2,0x19be(r16) store move flag?
+
  00194198: 00000000 nop
  001941a0: 90620188 lbu r2,0x0188(r3) load act flag
+
  0019419c: a20219be sb r2,0x19be(r16) store move flag
  001941a4: 26040e30 addiu r4,r16,0x0e30
+
  001941a0: 90620188 lbu r2,0x0188(r3) load act flag
  001941a8: 0c067c96 jal 0x0019f258 [[Store units coordinates]]
+
  001941a4: 26040e30 addiu r4,r16,0x0e30
  001941ac: a20219bd sb r2,0x19bd(r16) store act flag
+
  001941a8: 0c067c96 jal 0x0019f258 Store units coordinates
  001941b0: 3c04801a lui r4,0x801a
+
  001941ac: a20219bd sb r2,0x19bd(r16) store act flag
  001941b4: 24840d94 addiu r4,r4,0x0d94
+
  001941b0: 3c04801a lui r4,0x801a
  001941b8: 24900018 addiu r16,r4,0x0018
+
  001941b4: 24840d94 addiu r4,r4,0x0d94
  001941bc: 02002821 addu r5,r16,r0
+
  001941b8: 24900018 addiu r16,r4,0x0018
  001941c0: 0c066ac2 jal 0x0019ab08 [[Transfer Halfword Values]]
+
  001941bc: 02002821 addu r5,r16,r0
  001941c4: 34060018 ori r6,r0,0x0018
+
  001941c0: 0c066ac2 jal 0x0019ab08 Transfer Halfword Values
  001941c8: 02002021 addu r4,r16,r0
+
  001941c4: 34060018 ori r6,r0,0x0018
  001941cc: 02202821 addu r5,r17,r0
+
  001941c8: 02002021 addu r4,r16,r0
  001941d0: 0c066ac2 jal 0x0019ab08 [[Transfer Halfword Values]]
+
  001941cc: 02202821 addu r5,r17,r0
 +
  001941d0: 0c066ac2 jal 0x0019ab08 Transfer Halfword Values
 
  001941d4: 34060018 ori r6,r0,0x0018
 
  001941d4: 34060018 ori r6,r0,0x0018
  001941d8: 00001021 addu r2,r0,r0
+
 
  001941dc: 8fbf001c lw r31,0x001c(r29)
+
  001941d8: 00001021 addu r2,r0,r0 Return 0
  001941e0: 8fb20018 lw r18,0x0018(r29)
+
  001941dc: 8fbf001c lw r31,0x001c(r29)
  001941e4: 8fb10014 lw r17,0x0014(r29)
+
  001941e0: 8fb20018 lw r18,0x0018(r29)
  001941e8: 8fb00010 lw r16,0x0010(r29)
+
  001941e4: 8fb10014 lw r17,0x0014(r29)
  001941ec: 27bd0020 addiu r29,r29,0x0020
+
  001941e8: 8fb00010 lw r16,0x0010(r29)
  001941f0: 03e00008 jr r31
+
  001941ec: 27bd0020 addiu r29,r29,0x0020
 +
  001941f0: 03e00008 jr r31
 
  001941f4: 00000000 nop
 
  001941f4: 00000000 nop

Revision as of 00:25, 9 March 2017

00193e50: 27bdffe0 addiu r29,r29,0xffe0
00193e54: afb20018 sw r18,0x0018(r29)
00193e58: 00809021 addu r18,r4,r0				r18 = Unit ID
00193e5c: afb10014 sw r17,0x0014(r29)	
00193e60: 00a08821 addu r17,r5,r0				r17 = ? Pointer (0x158 in Misc Unit Data)
00193e64: 34040001 ori r4,r0,0x0001				r4 = 1
00193e68: afbf001c sw r31,0x001c(r29)	
00193e6c: 0c0076ea jal 0x0001dba8				0001dba8 - 0001dcec (Calculate Cycles Passed?)
00193e70: afb00010 sw r16,0x0010(r29)	
00193e74: 3c10801a lui r16,0x801a	
00193e78: 2610f3c4 addiu r16,r16,0xf3c4			r16 = AI Data Pointer
00193e7c: 284201b9 slti r2,r2,0x01b9	
00193e80: 104000d6 beq r2,r0,0x001941dc			Exit and Return -1 if Frame RNG said so
00193e84: 2402ffff addiu r2,r0,0xffff			
00193e88: 3c02801a lui r2,0x801a	
00193e8c: 90420d7b lbu r2,0x0d7b(r2)			If Action = Decided
00193e90: 00000000 nop	
00193e94: 1040000f beq r2,r0,0x00193ed4			Branch if no Action was decided
<AI Progress>
00193e98: 34020001 ori r2,r0,0x0001				r2 = 1
00193e9c: 3c03801a lui r3,0x801a	
00193ea0: 90630298 lbu r3,0x0298(r3)			Load AI Progress
00193ea4: 00000000 nop	
00193ea8: 1062005f beq r3,r2,0x00194028			Branch if AI Progress = 1
00193eac: 28620002 slti r2,r3,0x0002	
00193eb0: 10400005 beq r2,r0,0x00193ec8			Branch if AI Progress >= 2
00193eb4: 00000000 nop	
00193eb8: 1060004d beq r3,r0,0x00193ff0			Branch if AI Progress = 0
00193ebc: 00000000 nop	
00193ec0: 08064fb5 j 0x00193ed4					Jump if -1
00193ec4: 00000000 nop	
00193ec8: 34020002 ori r2,r0,0x0002	
00193ecc: 10620066 beq r3,r2,0x00194068			Branch if AI Progress = 2
00193ed0: 00000000 nop


00193ed4: 92031818 lbu r3,0x1818(r16)			Load Choice Byte
00193ed8: 340200ff ori r2,r0,0x00ff	
00193edc: 1462000f bne r3,r2,0x00193f1c			Branch if AI did not make a decision
<Movement>
00193ee0: 02121021 addu r2,r16,r18				r2 = AI Data Pointer + Unit ID
00193ee4: 8e0417f8 lw r4,0x17f8(r16)			Load Acting Unit's Data Pointer
00193ee8: 920219be lbu r2,0x19be(r16)			Load Desired Movement Flag?
00193eec: 90830187 lbu r3,0x0187(r4)			Load Unit's Movement Taken? Flag
00193ef0: 00000000 nop	
00193ef4: 14620009 bne r3,r2,0x00193f1c			Branch if Unit's Flag != Desired Flag?
<Action>
00193ef8: 02121021 addu r2,r16,r18				r2 = AI Data Pointer + Unit ID
00193efc: 90830188 lbu r3,0x0188(r4)			Load Unit's Action Taken? Flag
00193f00: 920219bd lbu r2,0x19bd(r16)			Load Desired Action Flag?
00193f04: 00000000 nop	
00193f08: 14620004 bne r3,r2,0x00193f1c			Branch if Unit's Flag != Desired Flag?
00193f0c: 02121021 addu r2,r16,r18				r2 = AI Data Pointer + Unit ID
00193f10: 34020002 ori r2,r0,0x0002				r2 = 2
00193f14: 08065076 j 0x001941d8					Exit and Return 0
00193f18: ae220000 sw r2,0x0000(r17)			Store ? = 2 (Taking Action?)
<AI hasn't made a complete decision yet>
00193f1c: a2120e2e sb r18,0x0e2e(r16)			Store Acting Unit's ID
<Evalulate Battle IDs for all units>
00193f20: 9042198c lbu r2,0x198c(r2)			Load Unit's Battle ID
00193f24: 00000000 nop	
00193f28: 2c420010 sltiu r2,r2,0x0010	
00193f2c: 14400004 bne r2,r0,0x00193f40			Branch if ID is legal
00193f30: 00001821 addu r3,r0,r0				Initialize Unit Counter
00193f34: 34020002 ori r2,r0,0x0002				r2 = 2
00193f38: 08065076 j 0x001941d8	
00193f3c: ae220000 sw r2,0x0000(r17)			Store ? = 2
00193f40: 340500ff ori r5,r0,0x00ff				r5 = FF
00193f44: 00002021 addu r4,r0,r0				Pointer Mod = 0
00193f48: 3c018019 lui r1,0x8019	
00193f4c: 00240821 addu r1,r1,r4	
00193f50: 902208cd lbu r2,0x08cd(r1)			Load Unit's ID
00193f54: 00000000 nop	
00193f58: 10450007 beq r2,r5,0x00193f78			Branch if unit doesn't exist
00193f5c: 248401c0 addiu r4,r4,0x01c0			Pointer Mod += 0x1c0
00193f60: 02031021 addu r2,r16,r3	
00193f64: 9042198c lbu r2,0x198c(r2)			Load Unit's Battle ID
00193f68: 00000000 nop	
00193f6c: 2c420010 sltiu r2,r2,0x0010	
00193f70: 1040007f beq r2,r0,0x00194170			Branch if ID is illegal
00193f74: 34020002 ori r2,r0,0x0002				r2 = 2
<Unit++>
00193f78: 24630001 addiu r3,r3,0x0001			Counter ++
00193f7c: 28620015 slti r2,r3,0x0015	
00193f80: 1440fff1 bne r2,r0,0x00193f48			Branch if Counter < 0x15
00193f84: 00000000 nop	


00193f88: 0c06507e jal 0x001941f8				Acting Unit's Data Setup
00193f8c: 00000000 nop	
00193f90: 8e0217f8 lw r2,0x17f8(r16)			Load Acting Unit's Data Pointer
00193f94: 00000000 nop	
00193f98: 9043015d lbu r3,0x015d(r2)			Load Unit's Current Ability CT
00193f9c: 340200ff ori r2,r0,0x00ff	
00193fa0: 14620007 bne r3,r2,0x00193fc0			Branch if Unit is charging something
00193fa4: 00000000 nop	
00193fa8: 8e030e34 lw r3,0x0e34(r16)			Load Acting Unit's AI Decision Pointer
00193fac: 00000000 nop	
00193fb0: 90620006 lbu r2,0x0006(r3)			Load Targeting Flags
00193fb4: 00000000 nop	
00193fb8: 304200f7 andi r2,r2,0x00f7			Disable Charging/Performing Flag
00193fbc: a0620006 sb r2,0x0006(r3)				Store new Targeting Flags
<No Decision or Act>
00193fc0: 92021818 lbu r2,0x1818(r16)			Load Choice Byte
00193fc4: 00000000 nop	
00193fc8: 10400007 beq r2,r0,0x00193fe8			<Set Targets> if AI could not make a decision
00193fcc: 00000000 nop	
00193fd0: 8e0217f8 lw r2,0x17f8(r16)			Load Acting Unit's Data Pointer
00193fd4: 00000000 nop	
00193fd8: 90420188 lbu r2,0x0188(r2)			Load Unit's Action Taken Flag
00193fdc: 00000000 nop	
00193fe0: 10400038 beq r2,r0,0x001940c4			Branch if Unit hasn't acted
00193fe4: 00000000 nop
<Set Targets> (Act Chosen or already Acted?)
00193fe8: 0c063979 jal 0x0018e5e4				Transfer Considered Action Data to AI
00193fec: 00000000 nop	
00193ff0: 0c0650c5 jal 0x00194314				Set type of target for all targets
00193ff4: 00000000 nop	
00193ff8: 2403ffff addiu r3,r0,0xffff	
00193ffc: 14430005 bne r2,r3,0x 00194014		Branch if Frame Data said so
00194000: 2402ffff addiu r2,r0,0xffff	
00194004: 34030001 ori r3,r0,0x0001	
00194008: a2000ed4 sb r0,0x0ed4(r16)	
0019400c: 08065077 j 0x001941dc					Exit and Return -1
00194010: a20319b7 sb r3,0x19b7(r16)			Action = Decided
<Movement and Considerations>
00194014: 8e0217f8 lw r2,0x17f8(r16)			load unit data
00194018: 00000000 nop	
0019401c: 90440188 lbu r4,0x0188(r2)			load able to act flag
00194020: 0c065396 jal 0x00194e58				Set AI ability considerations for all units and self
00194024: 00000000 nop	
00194028: 8e0217f8 lw r2,0x17f8(r16)	
0019402c: 00000000 nop	
00194030: 90440187 lbu r4,0x0187(r2)			load move flag
00194034: 0c065251 jal 0x00194944				AI movement/panel data setting
00194038: 00000000 nop	
0019403c: 2403ffff addiu r3,r0,0xffff	
00194040: 14430005 bne r2,r3,0x 00194058		Branch if the RNG said to; else always branch
00194044: 2402ffff addiu r2,r0,0xffff	
00194048: 34030001 ori r3,r0,0x0001	
0019404c: a2030ed4 sb r3,0x0ed4(r16)	
00194050: 08065077 j 0x 001941dc				Exit and Return -1	
00194054: a20319b7 sb r3,0x19b7(r16)			Action = Decided
	
00194058: 0c06515c jal 0x00194570				Some targetability setting
0019405c: a20019b7 sb r0,0x19b7(r16)			Action = Not Decided
00194060: 0c0651c7 jal 0x0019471c				Set AI flags for target consideration
00194064: 00000000 nop	
00194068: 0c065765 jal 0x00195d94				00195d94 - 00195f68
0019406c: 00000000 nop	
00194070: 2403ffff addiu r3,r0,0xffff	
00194074: 14430007 bne r2,r3,0x 00194094	
00194078: 340200ff ori r2,r0,0x00ff	
0019407c: 2402ffff addiu r2,r0,0xffff	
00194080: 34030002 ori r3,r0,0x0002	
00194084: a2030ed4 sb r3,0x0ed4(r16)	
00194088: 34030001 ori r3,r0,0x0001	
0019408c: 08065077 j 0x 001941dc	
00194090: a20319b7 sb r3,0x19b7(r16)			Action = Decided	
	
00194094: 920317fd lbu r3,0x17fd(r16)	
00194098: a20019b7 sb r0,0x19b7(r16)			Action = Not Decided
0019409c: 10600007 beq r3,r0,0x 001940bc	
001940a0: a2021818 sb r2,0x1818(r16)			Save Choice Byte
001940a4: 8e030e34 lw r3,0x0e34(r16)			load decision data
001940a8: 00000000 nop	
001940ac: 90620006 lbu r2,0x0006(r3)	
001940b0: 00000000 nop	
001940b4: 34420008 ori r2,r2,0x0008	
001940b8: a0620006 sb r2,0x0006(r3)				store charging byte
001940bc: 0c06398a jal 0x0018e628				Store current attack data into AI?
001940c0: 00000000 nop	
001940c4: 8e0317f8 lw r3,0x17f8(r16)			Load Acting Unit's Data	
001940c8: 00000000 nop	
001940cc: 90620187 lbu r2,0x0187(r3)			load move flag
001940d0: 00000000 nop	
001940d4: 14400019 bne r2,r0,0x 0019413c		branch if able to move
001940d8: 00000000 nop	
001940dc: 90620188 lbu r2,0x0188(r3)			load act flag
001940e0: 00000000 nop	
001940e4: 14400005 bne r2,r0,0x 001940fc		branch if able to act
001940e8: 00000000 nop
<Neither Act or Move>
001940ec: 920217fc lbu r2,0x17fc(r16)	
001940f0: 00000000 nop	
001940f4: 14400011 bne r2,r0,0x 0019413c		<If Move> if True	
001940f8: 00000000 nop
	
<Act, but not Move>
001940fc: a2001803 sb r0,0x1803(r16)	
00194100: 8e031800 lw r3,0x1800(r16)	
00194104: 8e020e30 lw r2,0x0e30(r16)	
00194108: 00000000 nop	
0019410c: 1062000b beq r3,r2,0x 0019413c	
00194110: 00000000 nop	
00194114: ae200000 sw r0,0x0000(r17)	
00194118: 92021800 lbu r2,0x1800(r16)	
0019411c: 00000000 nop	
00194120: a6220004 sh r2,0x0004(r17)	
00194124: 92021802 lbu r2,0x1802(r16)	
00194128: 00000000 nop	
0019412c: a6220008 sh r2,0x0008(r17)	
00194130: 92021801 lbu r2,0x1801(r16)	
00194134: 08065063 j 0x0019418c	
00194138: a6220006 sh r2,0x0006(r17)	
<If Move>
0019413c: 8e0217f8 lw r2,0x17f8(r16)	
00194140: 00000000 nop	
00194144: 90420188 lbu r2,0x0188(r2)			load act flag
00194148: 00000000 nop	
0019414c: 14400006 bne r2,r0,0x 00194168			branch if able to act
00194150: 34020002 ori r2,r0,0x0002	
<Move, but not Act>
00194154: 92021805 lbu r2,0x1805(r16)	
00194158: 00000000 nop	
0019415c: 14400006 bne r2,r0,0x 00194178	
00194160: 34020001 ori r2,r0,0x0001	
00194164: 34020002 ori r2,r0,0x0002	
<Act and Move>
00194168: 08065063 j 0x 0019418c	
0019416c: ae220000 sw r2,0x0000(r17)	
	
00194170: 08065076 j 0x 001941d8				Exit and do not transfer data
00194174: ae220000 sw r2,0x0000(r17)	
	
00194178: ae220000 sw r2,0x0000(r17)	
0019417c: 26240004 addiu r4,r17,0x0004	
00194180: 26051804 addiu r5,r16,0x1804	
00194184: 0c066ac2 jal 0x0019ab08				Transfer Halfword Values
00194188: 34060014 ori r6,r0,0x0014
	
0019418c: 8e0217f8 lw r2,0x17f8(r16)	
00194190: 8e0317f8 lw r3,0x17f8(r16)	
00194194: 90420187 lbu r2,0x0187(r2)				load move flag
00194198: 00000000 nop	
0019419c: a20219be sb r2,0x19be(r16)				store move flag
001941a0: 90620188 lbu r2,0x0188(r3)				load act flag
001941a4: 26040e30 addiu r4,r16,0x0e30	
001941a8: 0c067c96 jal 0x0019f258				Store units coordinates
001941ac: a20219bd sb r2,0x19bd(r16)				store act flag
001941b0: 3c04801a lui r4,0x801a	
001941b4: 24840d94 addiu r4,r4,0x0d94	
001941b8: 24900018 addiu r16,r4,0x0018	
001941bc: 02002821 addu r5,r16,r0	
001941c0: 0c066ac2 jal 0x0019ab08				Transfer Halfword Values
001941c4: 34060018 ori r6,r0,0x0018	
001941c8: 02002021 addu r4,r16,r0	
001941cc: 02202821 addu r5,r17,r0	
001941d0: 0c066ac2 jal 0x0019ab08				Transfer Halfword Values
001941d4: 34060018 ori r6,r0,0x0018
001941d8: 00001021 addu r2,r0,r0				Return 0
001941dc: 8fbf001c lw r31,0x001c(r29)	
001941e0: 8fb20018 lw r18,0x0018(r29)	
001941e4: 8fb10014 lw r17,0x0014(r29)	
001941e8: 8fb00010 lw r16,0x0010(r29)	
001941ec: 27bd0020 addiu r29,r29,0x0020	
001941f0: 03e00008 jr r31	
001941f4: 00000000 nop