Difference between revisions of "Acting Unit's Data Setup"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "Acting Unit's Data Setup 001941f8: 27bdffe8 addiu r29,r29,0xffe8 001941fc: 3c03801a lui r3,0x801a 00194200: 906301f2 lbu r3,0x01f2(r3) Load Acting Unit ID 00194204: 3c028...")
 
m
 
Line 1: Line 1:
Acting Unit's Data Setup
+
BATTLE.BIN : Acting Unit's Data Setup
  001941f8: 27bdffe8 addiu r29,r29,0xffe8
+
------------------------------------------------------------------------------------------
  001941fc: 3c03801a lui r3,0x801a
+
Parameters : Nothing
  00194200: 906301f2 lbu r3,0x01f2(r3) Load Acting Unit ID
+
Returns : Nothing
  00194204: 3c028019 lui r2,0x8019
+
------------------------------------------------------------------------------------------
  00194208: 244208cc addiu r2,r2,0x08cc
+
  001941f8: 27bdffe8 addiu r29,r29,-0x0018    |
  0019420c: afb00010 sw r16,0x0010(r29)
+
  001941fc: 3c03801a lui r3,0x801a           |
  00194210: 3c10801a lui r16,0x801a
+
  00194200: 906301f2 lbu r3,0x01f2(r3)       |{{f/load|Load Acting Unit ID}} {{f/std|8019f3c4 + 0xe2e}}
  00194214: 2610f3c4 addiu r16,r16,0xf3c4 r16 = AI Data Pointer
+
  00194204: 3c028019 lui r2,0x8019           |
  00194218: afbf0014 sw r31,0x0014(r29)
+
  00194208: 244208cc addiu r2,r2,0x08cc       |{{f/adr|Start of Unit data (Battle stats) pointer}}
  0019421c: 000320c0 sll r4,r3,0x03 ID * 8
+
  0019420c: afb00010 sw r16,0x0010(r29)       |
  00194220: 00832023 subu r4,r4,r3 ID * 7
+
  00194210: 3c10801a lui r16,0x801a           |
  00194224: 00042180 sll r4,r4,0x06 ID * 448
+
  00194214: 2610f3c4 addiu r16,r16,-0x0c3c    |{{f/adr|Start of AI data pointer}}
  00194228: 00822021 addu r4,r4,r2 r4 = Unit's Data Pointer
+
  00194218: afbf0014 sw r31,0x0014(r29)       |
  0019422c: 00031100 sll r2,r3,0x04 ID * 16
+
  0019421c: 000320c0 sll r4,r3,0x03           |{{f/std|ID * 8}}
  00194230: 2442182c addiu r2,r2,0x182c
+
  00194220: 00832023 subu r4,r4,r3           |{{f/std|ID * 7}}
  00194234: 00501021 addu r2,r2,r16 r2 = AI Decision Data Pointer
+
  00194224: 00042180 sll r4,r4,0x06           |{{f/std|Unit ID * 0x1c0}}
  00194238: 3c01801a lui r1,0x801a
+
  00194228: 00822021 addu r4,r4,r2           |{{f/adr|<nowiki>r4 = Unit's Data Pointer (Battle stats)</nowiki>}}
  0019423c: ac240bbc sw r4,0x0bbc(r1) Store Unit's Data Pointer
+
  0019422c: 00031100 sll r2,r3,0x04           |{{f/std|unit ID * 16}}
  00194240: 3c01801a lui r1,0x801a
+
  00194230: 2442182c addiu r2,r2,0x182c       |
  00194244: ac2201f8 sw r2,0x01f8(r1) Store Unit's AI Decision Pointer
+
  00194234: 00501021 addu r2,r2,r16           |{{f/adr|<nowiki>r2 = AI Decision Data Pointer</nowiki>}}
  00194248: 90820047 lbu r2,0x0047(r4) Load Unit's X
+
  00194238: 3c01801a lui r1,0x801a           |
  0019424c: 3c01801a lui r1,0x801a
+
  0019423c: ac240bbc sw r4,0x0bbc(r1)         |{{f/store|Store Unit's Data Pointer}} {{f/std| 8019f3c4 + 0x17f8 / 801a0bbc}}
  00194250: a02201f4 sb r2,0x01f4(r1) Store Unit's X
+
  00194240: 3c01801a lui r1,0x801a           |
  00194254: 90820048 lbu r2,0x0048(r4) Load Unit's Y
+
  00194244: ac2201f8 sw r2,0x01f8(r1)         |{{f/store|Store Unit's AI Decision Pointer}} {{f/std| 8019f3c4 + 0xe34 / 801a01f8}}
  00194258: 3c01801a lui r1,0x801a
+
  00194248: 90820047 lbu r2,0x0047(r4)       |{{f/load|Load Unit's X}}
  0019425c: a02201f6 sb r2,0x01f6(r1) Store Unit's Y
+
  0019424c: 3c01801a lui r1,0x801a           |
  00194260: 94820048 lhu r2,0x0048(r4) Load Unit's Y + Map Level
+
  00194250: a02201f4 sb r2,0x01f4(r1)         |{{f/store|Store Unit's X}} {{f/std| 8019f3c4 + 0xe30 / 801a01f4}}
  00194264: 00701821 addu r3,r3,r16
+
  00194254: 90820048 lbu r2,0x0048(r4)       |{{f/load|Load Unit's Y}}
  00194268: 3c01801a lui r1,0x801a
+
  00194258: 3c01801a lui r1,0x801a           |
  0019426c: a02001f7 sb r0,0x01f7(r1) Store ? = 0
+
  0019425c: a02201f6 sb r2,0x01f6(r1)         |{{f/store|Store Unit's Y}} {{f/std| 8019f3c4 + 0xe32 / 801a01f6}}
  00194270: 000213c2 srl r2,r2,0x0f
+
  00194260: 94820048 lhu r2,0x0048(r4)       |{{f/load|Load Unit's Y + Map Level}}
  00194274: 3c01801a lui r1,0x801a
+
  00194264: 00701821 addu r3,r3,r16           |{{f/adr|8019f3c4 + Unit offset}}
  00194278: a02201f5 sb r2,0x01f5(r1) Store Unit's Map Level
+
  00194268: 3c01801a lui r1,0x801a           |
  0019427c: 9062198c lbu r2,0x198c(r3) Load Unit's Battle ID
+
  0019426c: a02001f7 sb r0,0x01f7(r1)         |{{f/store|Nullify 801a01f7}} {{f/std|Setting a breakpoint here only point to nullification}}
  00194280: 3c01801a lui r1,0x801a
+
  00194270: 000213c2 srl r2,r2,0x0f           |{{f/std|Focus on Elevation flag}}
  00194284: a02201f3 sb r2,0x01f3(r1) Store Unit's Battle ID
+
  00194274: 3c01801a lui r1,0x801a           |
  00194288: 90820005 lbu r2,0x0005(r4) Load Unit's ENTD Flags
+
  00194278: a02201f5 sb r2,0x01f5(r1)         |{{f/store|Store Unit's Map Level}} {{f/std| 8019f3c4 + 0xe31 / 801a01f5}}
  0019428c: 00000000 nop
+
  0019427c: 9062198c lbu r2,0x198c(r3)       |{{f/load|Load Unit's Battle ID }}
  00194290: 30420030 andi r2,r2,0x0030
+
  00194280: 3c01801a lui r1,0x801a           |
  00194294: 3c01801a lui r1,0x801a
+
  00194284: a02201f3 sb r2,0x01f3(r1)         |{{f/store|Store Unit's Battle ID}} {{f/std| 8019f3c4 + 0xe2f / 801a01f3}}
  00194298: a02201fd sb r2,0x01fd(r1) Store Unit's Team
+
  00194288: 90820005 lbu r2,0x0005(r4)       |{{f/load|Load Unit's ENTD Flags}}
  0019429c: 0c0666e6 jal 0x00199b98 Calculate Clockticks Until Unit Acts
+
  0019428c: 00000000 nop                     |
  001942a0: 00000000 nop
+
  00194290: 30420030 andi r2,r2,0x0030       |{{f/std|Check Team}}
  001942a4: 3c04801a lui r4,0x801a
+
  00194294: 3c01801a lui r1,0x801a           |
  001942a8: 8c840bbc lw r4,0x0bbc(r4) Load Unit's Data Pointer
+
  00194298: a02201fd sb r2,0x01fd(r1)         |{{f/store|Store Unit's Team}} {{f/std| 8019f3c4 + 0xe39 / 801a01fd}}
  001942ac: 3c01801a lui r1,0x801a
+
  0019429c: 0c0666e6 jal 0x00199b98           |{{f/jal|Calculate Clockticks Until Unit Acts|Calculate Clockticks Until Unit Acts}} {{f/std|Returns r2 as remaining ticks before Turn}}
  001942b0: a0220213 sb r2,0x0213(r1) Store Unit's Remaining Clockticks
+
  001942a0: 00000000 nop                     |
  001942b4: 90830182 lbu r3,0x0182(r4) Load Unit's Mount Info
+
  001942a4: 3c04801a lui r4,0x801a           |
  001942b8: 00000000 nop
+
  001942a8: 8c840bbc lw r4,0x0bbc(r4)         |{{f/adr|Load Acting Unit's Data Pointer}}
  001942bc: 30620080 andi r2,r3,0x0080
+
  001942ac: 3c01801a lui r1,0x801a           |
  001942c0: 10400009 beq r2,r0,0x 001942e8 Branch if Unit isn't Riding a unit
+
  001942b0: a0220213 sb r2,0x0213(r1)         |{{f/store|Store Unit's Remaining Clockticks}} {{f/std| 8019f3c4 + 0xe4f / 801a0213}}
  001942c4: 3062001f andi r2,r3,0x001f r2 = Mount's ID
+
  001942b4: 90830182 lbu r3,0x0182(r4)       |{{f/load|Load Unit's Mount Info}}
  001942c8: 000218c0 sll r3,r2,0x03 ID * 8
+
  001942b8: 00000000 nop                     |
  001942cc: 00621823 subu r3,r3,r2 ID * 7
+
  001942bc: 30620080 andi r2,r3,0x0080       |{{f/std|Check [Rider]}}
  001942d0: 00031980 sll r3,r3,0x06 ID * 448
+
  001942c0: 10400009 beq r2,r0,0x001942e8    {{f/Cond|If Unit is riding a monster}}
  001942d4: 3c018019 lui r1,0x8019
+
  001942c4: 3062001f andi r2,r3,0x001f       |{{f/std|<nowiki>r2 = Mount's ID</nowiki>}}
  001942d8: 00230821 addu r1,r1,r3
+
  001942c8: 000218c0 sll r3,r2,0x03               |{{f/std|ID * 8}}
  001942dc: 90220906 lbu r2,0x0906(r1) Load Mount's Move
+
  001942cc: 00621823 subu r3,r3,r2               |{{f/std|ID * 7}}
  001942e0: 080650bb j 0x 001942ec
+
  001942d0: 00031980 sll r3,r3,0x06               |{{f/std|Mount ID * 0x1c0}}
  001942e4: 00000000 nop
+
  001942d4: 3c018019 lui r1,0x8019               |
  001942e8: 9082003a lbu r2,0x003a(r4) Load Unit's Move
+
  001942d8: 00230821 addu r1,r1,r3               |{{f/adr|Part of Mounted Unit data pointer}}
  001942ec: 3c01801a lui r1,0x801a
+
  001942dc: 90220906 lbu r2,0x0906(r1)           |{{f/load|Load Mount's Move}}
  001942f0: a02201fc sb r2,0x01fc(r1) Store Unit's Move
+
  001942e0: 080650bb j 0x001942ec                {{f/jump|Avoid not riding section}}
  001942f4: 92020e2e lbu r2,0x0e2e(r16) Load Unit's ID
+
  001942e4: 00000000 nop                         |
  001942f8: a200001b sb r0,0x001b(r16) Store ? = 0
+
                                            '''Else : Unit is not riding'''
  001942fc: a202001c sb r2,0x001c(r16) Store Unit's ID
+
  001942e8: 9082003a lbu r2,0x003a(r4)           |{{f/load|Load Unit's Move}}
  00194300: 8fbf0014 lw r31,0x0014(r29)
+
  001942ec: 3c01801a lui r1,0x801a           |
 +
  001942f0: a02201fc sb r2,0x01fc(r1)         |{{f/store|Store Unit's Move}} {{f/std| 8019f3c4 + 0xe38 / 801a01fc}}
 +
  001942f4: 92020e2e lbu r2,0x0e2e(r16)       |{{f/load|Load Unit's ID}}
 +
  001942f8: a200001b sb r0,0x001b(r16)       |{{f/store|Nullify 8019f3c4 - 0x1b}} {{f/std|Unknown purpose}}
 +
  001942fc: a202001c sb r2,0x001c(r16)       |{{f/store|Store Unit's ID}} {{f/std|8019f3c4 -+ 0x1c}}
 +
  00194300: 8fbf0014 lw r31,0x0014(r29)       END
 
  00194304: 8fb00010 lw r16,0x0010(r29)
 
  00194304: 8fb00010 lw r16,0x0010(r29)
 
  00194308: 27bd0018 addiu r29,r29,0x0018
 
  00194308: 27bd0018 addiu r29,r29,0x0018
 
  0019430c: 03e00008 jr r31
 
  0019430c: 03e00008 jr r31
 
  00194310: 00000000 nop
 
  00194310: 00000000 nop
 +
===Return Locations===
 +
'''BATTLE.BIN'''
 +
00193f90: [[Main_AI_action_setup]]

Latest revision as of 09:31, 4 May 2023

BATTLE.BIN : Acting Unit's Data Setup
------------------------------------------------------------------------------------------
Parameters : Nothing 
Returns : Nothing
------------------------------------------------------------------------------------------ 
001941f8: 27bdffe8 addiu r29,r29,-0x0018    |
001941fc: 3c03801a lui r3,0x801a            |
00194200: 906301f2 lbu r3,0x01f2(r3)        |Load Acting Unit ID 8019f3c4 + 0xe2e
00194204: 3c028019 lui r2,0x8019            |
00194208: 244208cc addiu r2,r2,0x08cc       |Start of Unit data (Battle stats) pointer
0019420c: afb00010 sw r16,0x0010(r29)       |
00194210: 3c10801a lui r16,0x801a           |
00194214: 2610f3c4 addiu r16,r16,-0x0c3c    |Start of AI data pointer
00194218: afbf0014 sw r31,0x0014(r29)       |
0019421c: 000320c0 sll r4,r3,0x03           |ID * 8
00194220: 00832023 subu r4,r4,r3            |ID * 7
00194224: 00042180 sll r4,r4,0x06           |Unit ID * 0x1c0
00194228: 00822021 addu r4,r4,r2            |r4 = Unit's Data Pointer (Battle stats)
0019422c: 00031100 sll r2,r3,0x04           |unit ID * 16
00194230: 2442182c addiu r2,r2,0x182c       |
00194234: 00501021 addu r2,r2,r16           |r2 = AI Decision Data Pointer
00194238: 3c01801a lui r1,0x801a            |
0019423c: ac240bbc sw r4,0x0bbc(r1)         |Store Unit's Data Pointer  8019f3c4 + 0x17f8 / 801a0bbc
00194240: 3c01801a lui r1,0x801a            |
00194244: ac2201f8 sw r2,0x01f8(r1)         |Store Unit's AI Decision Pointer  8019f3c4 + 0xe34 / 801a01f8
00194248: 90820047 lbu r2,0x0047(r4)        |Load Unit's X
0019424c: 3c01801a lui r1,0x801a            |
00194250: a02201f4 sb r2,0x01f4(r1)         |Store Unit's X  8019f3c4 + 0xe30 / 801a01f4
00194254: 90820048 lbu r2,0x0048(r4)        |Load Unit's Y
00194258: 3c01801a lui r1,0x801a            |
0019425c: a02201f6 sb r2,0x01f6(r1)         |Store Unit's Y  8019f3c4 + 0xe32 / 801a01f6
00194260: 94820048 lhu r2,0x0048(r4)        |Load Unit's Y + Map Level
00194264: 00701821 addu r3,r3,r16           |8019f3c4 + Unit offset
00194268: 3c01801a lui r1,0x801a            |
0019426c: a02001f7 sb r0,0x01f7(r1)         |Nullify 801a01f7 Setting a breakpoint here only point to nullification
00194270: 000213c2 srl r2,r2,0x0f           |Focus on Elevation flag
00194274: 3c01801a lui r1,0x801a            |
00194278: a02201f5 sb r2,0x01f5(r1)         |Store Unit's Map Level  8019f3c4 + 0xe31 / 801a01f5
0019427c: 9062198c lbu r2,0x198c(r3)        |Load Unit's Battle ID 
00194280: 3c01801a lui r1,0x801a            |
00194284: a02201f3 sb r2,0x01f3(r1)         |Store Unit's Battle ID  8019f3c4 + 0xe2f / 801a01f3
00194288: 90820005 lbu r2,0x0005(r4)        |Load Unit's ENTD Flags
0019428c: 00000000 nop                      |
00194290: 30420030 andi r2,r2,0x0030        |Check Team
00194294: 3c01801a lui r1,0x801a            |
00194298: a02201fd sb r2,0x01fd(r1)         |Store Unit's Team  8019f3c4 + 0xe39 / 801a01fd
0019429c: 0c0666e6 jal 0x00199b98           |-->Calculate Clockticks Until Unit Acts Returns r2 as remaining ticks before Turn
001942a0: 00000000 nop                      |
001942a4: 3c04801a lui r4,0x801a            |
001942a8: 8c840bbc lw r4,0x0bbc(r4)         |Load Acting Unit's Data Pointer
001942ac: 3c01801a lui r1,0x801a            |
001942b0: a0220213 sb r2,0x0213(r1)         |Store Unit's Remaining Clockticks  8019f3c4 + 0xe4f / 801a0213
001942b4: 90830182 lbu r3,0x0182(r4)        |Load Unit's Mount Info
001942b8: 00000000 nop                      |
001942bc: 30620080 andi r2,r3,0x0080        |Check [Rider]
001942c0: 10400009 beq r2,r0,0x001942e8     #If Unit is riding a monster
001942c4: 3062001f andi r2,r3,0x001f        |r2 = Mount's ID
001942c8: 000218c0 sll r3,r2,0x03               |ID * 8
001942cc: 00621823 subu r3,r3,r2                |ID * 7
001942d0: 00031980 sll r3,r3,0x06               |Mount ID * 0x1c0
001942d4: 3c018019 lui r1,0x8019                |
001942d8: 00230821 addu r1,r1,r3                |Part of Mounted Unit data pointer
001942dc: 90220906 lbu r2,0x0906(r1)            |Load Mount's Move
001942e0: 080650bb j 0x001942ec                 >>Avoid not riding section
001942e4: 00000000 nop                          |
                                            Else : Unit is not riding
001942e8: 9082003a lbu r2,0x003a(r4)            |Load Unit's Move
001942ec: 3c01801a lui r1,0x801a            |
001942f0: a02201fc sb r2,0x01fc(r1)         |Store Unit's Move  8019f3c4 + 0xe38 / 801a01fc
001942f4: 92020e2e lbu r2,0x0e2e(r16)       |Load Unit's ID
001942f8: a200001b sb r0,0x001b(r16)        |Nullify 8019f3c4 - 0x1b Unknown purpose
001942fc: a202001c sb r2,0x001c(r16)        |Store Unit's ID 8019f3c4 -+ 0x1c
00194300: 8fbf0014 lw r31,0x0014(r29)       END
00194304: 8fb00010 lw r16,0x0010(r29)
00194308: 27bd0018 addiu r29,r29,0x0018
0019430c: 03e00008 jr r31
00194310: 00000000 nop

Return Locations

BATTLE.BIN
00193f90: Main_AI_action_setup