Difference between revisions of "Main reaction routine"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Updated documentation)
(Fixed a bad move, made this redirect to Talcall's renamed page)
Tag: New redirect
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
00197d0c: 00005821 addu r11,r0,r0
+
#REDIRECT [[Calculate Reaction Targetting & Usage]]
00197d10: 00003821 addu r7,r0,r0
 
00197d14: 340d0001 ori r13,r0,0x0001 r13 = True
 
00197d18: 3c0c801a lui r12,0x801a
 
00197d1c: 258cf3c4 addiu r12,r12,0xf3c4 Load Unit AI Data
 
00197d20: 01804821 addu r9,r12,r0 r9 = Current Unit's AI
 
00197d24: 00004021 addu r8,r0,r0
 
00197d28: 340a182c ori r10,r0,0x182c r10 = AI Decision Data Pointer
 
 
 
<Loop>
 
00197d2c: 018a1821 addu r3,r12,r10 r3 = AI Decision Data
 
00197d30: a1200c78 sb r0,0x0c78(r9) Initialize Chosen Unit ID?
 
00197d34: 90620007 lbu r2,0x0007(r3) Load AI Targeting Flag
 
00197d38: 00000000 nop
 
00197d3c: 30420010 andi r2,r2,0x0010
 
00197d40: 1440003f bne r2,r0,0x00197e40 Branch if Unit is untargetable
 
00197d44: 00000000 nop
 
00197d48: 3c018019 lui r1,0x8019
 
00197d4c: 00280821 addu r1,r1,r8
 
00197d50: 90220925 lbu r2,0x0925(r1) Load Current Status 2
 
00197d54: 00000000 nop
 
00197d58: 30420010 andi r2,r2,0x0010
 
00197d5c: 14400006 bne r2,r0,0x00197d78 Branch if Unit is Confused
 
00197d60: 00000000 nop
 
00197d64: 90620004 lbu r2,0x0004(r3) Load AI Targeting Flag
 
00197d68: 00000000 nop
 
00197d6c: 30420080 andi r2,r2,0x0080
 
00197d70: 10400033 beq r2,r0,0x00197e40 Next Unit if not Charging/Performing? or Active/alive?
 
00197d74: 00000000 nop
 
00197d78: 91820e2e lbu r2,0x0e2e(r12) Load Acting Unit's ID
 
00197d7c: 00000000 nop
 
00197d80: 14e20004 bne r7,r2,0x00197d94 Branch if self
 
00197d84: 34020002 ori r2,r0,0x0002 r2 = (0x2) 2
 
00197d88: 340200ff ori r2,r0,0x00ff r2 = (0xFF) 255
 
00197d8c: 10a2002c beq r5,r2,0x00197e40 Branch if PV = 0x00ff
 
00197d90: 34020002 ori r2,r0,0x0002 r2 = (0x2) 2
 
00197d94: 10820015 beq r4,r2,0x00197dec Branch PV = 0x0002
 
00197d98: 28820003 slti r2,r4,0x0003 Set if 0x0 < 3
 
00197d9c: 10400005 beq r2,r0,0x00197db4 Branch if not
 
00197da0: 00000000 nop
 
00197da4: 108d000e beq r4,r13,0x00197de0 Branch if 0x0 == 1 (1)
 
00197da8: 00000000 nop
 
00197dac: 08065f8f j 0x00197e3c
 
00197db0: a12d0c78 sb r13,0x0c78(r9) Store as Start of AI data = 1 (1)
 
 
 
00197db4: 34020003 ori r2,r0,0x0003 r2 = (0x3) 3
 
00197db8: 10820005 beq r4,r2,0x00197dd0 Branch if 0x0 == 3 (3)
 
 
 
00197dbc: 34020004 ori r2,r0,0x0004 r2 = (0x4) 4
 
00197dc0: 10820010 beq r4,r2,0x00197e04 Branch if 0x0 == 4 (4)
 
00197dc4: 3c020001 lui r2,0x0001
 
 
 
PV = 0
 
00197dc8: 08065f8f j 0x00197e3c
 
00197dcc: a12d0c78 sb r13,0x0c78(r9) Store as Start of AI data = 1 (1)
 
 
 
PV = 3
 
00197dd0: 14e5001b bne r7,r5,0x00197e40 Branch if 0 != 0x0
 
00197dd4: 00000000 nop
 
00197dd8: 08065f8f j 0x00197e3c
 
00197ddc: a12d0c78 sb r13,0x0c78(r9) Store as Start of AI data = 1 (1)
 
 
 
PV = 1
 
00197de0: 90620008 lbu r2,0x0008(r3) Load Enemy Flag
 
00197de4: 08065f8c j 0x00197e30
 
00197de8: 00000000 nop
 
 
 
PV = 2
 
00197dec: 90620008 lbu r2,0x0008(r3) Load Enemy Flag
 
00197df0: 00000000 nop
 
00197df4: 14400012 bne r2,r0,0x00197e40 Next Unit if Enemy
 
00197df8: 00000000 nop
 
00197dfc: 08065f8f j 0x00197e3c
 
00197e00: a12d0c78 sb r13,0x0c78(r9) Target Current Unit (As an Ally?)
 
 
 
PV = 4
 
00197e04: 3c038019 lui r3,0x8019
 
00197e08: 246308cc addiu r3,r3,0x08cc
 
00197e0c: 01033021 addu r6,r8,r3
 
00197e10: 8cc30058 lw r3,0x0058(r6) Load Current Statuses 1-4
 
00197e14: 34428020 ori r2,r2,0x8020 r2 = 00018020
 
00197e18: 00621824 and r3,r3,r2
 
00197e1c: 14600006 bne r3,r0,0x00197e38 Branch if Unit is Critical, Petrifed or Dead
 
00197e20: 00000000 nop
 
00197e24: 90c2005c lbu r2,0x005c(r6) Load Current Statuses 5
 
00197e28: 00000000 nop
 
00197e2c: 30420001 andi r2,r2,0x0001
 
00197e30: 10400003 beq r2,r0,0x00197e40 Branch if not Death Sentence
 
00197e34: 00000000 nop
 
00197e38: a12d0c78 sb r13,0x0c78(r9) Target Current Unit (as needing recovery?)
 
 
 
Unit++
 
00197e3c: 340b0001 ori r11,r0,0x0001 r11 = Considered Units Counter++
 
00197e40: 25290001 addiu r9,r9,0x0001 Unit ID++
 
00197e44: 250801c0 addiu r8,r8,0x01c0 Unit Pointer++
 
00197e48: 24e70001 addiu r7,r7,0x0001 Unit Counter++
 
00197e4c: 28e20015 slti r2,r7,0x0015
 
00197e50: 1440ffb6 bne r2,r0,0x00197d2c Do for all units
 
00197e54: 254a0010 addiu r10,r10,0x0010 Pointer++
 
</Loop>
 
00197e58: 03e00008 jr r31 Jump to Address
 
00197e5c: 01601021 addu r2,r11,r0 r2 = # of units considered
 

Latest revision as of 02:46, 18 July 2024