Transfer Unit Data to AI Data
Jump to navigation
Jump to search
Parameters : r4 - 0x00 : Transfer a lot of data from Battle stats to the AI extended status section not 0x00 : Transfer Current status from Battle to AI section and then from AI extended section to Unit (0x80193924 -> 0x801908cc) Returns nothing ----------------------------------------------------------------------------------------------- 0019e160: 27bdffc8 addiu r29,r29,0xffc8 | 0019e164: afb60028 sw r22,0x0028(r29) | 0019e168: 0080b021 addu r22,r4,r0 |r22 = Preset Value 0019e16c: afb7002c sw r23,0x002c(r29) | 0019e170: 3c17801a lui r23,0x801a | 0019e174: 26f7f3c4 addiu r23,r23,-0x0c3c |Pointer to start of AI data 8019f3c4 0019e178: afb40020 sw r20,0x0020(r29) | 0019e17c: 0000a021 addu r20,r0,r0 |Unit Counter = 0 0019e180: afb50024 sw r21,0x0024(r29) | 0019e184: 0000a821 addu r21,r0,r0 |Pointer Mod = 0 (+0x1c0 each iteration) 0019e188: afbf0030 sw r31,0x0030(r29) | 0019e18c: afb3001c sw r19,0x001c(r29) | 0019e190: afb20018 sw r18,0x0018(r29) | 0019e194: afb10014 sw r17,0x0014(r29) | 0019e198: afb00010 sw r16,0x0010(r29) | @LOOP throught all units (ID from AI data 0x198c 0019e19c: 02f41021 addu r2,r23,r20 |This iteration AI data pointer 0019e1a0: 9053198c lbu r19,0x198c(r2) |Load This iteration Unit's Battle ID 0019e1a4: 340200ff ori r2,r0,0x00ff | 0019e1a8: 1262005d beq r19,r2,0x0019e320 #If Unit exists /Else branch to next iteration 0019e1ac: 00000000 nop | 0019e1b0: 3c028019 lui r2,0x8019 | 0019e1b4: 244208cc addiu r2,r2,0x08cc |Start of 1st unit battle data 0019e1b8: 12c00005 beq r22,r0,0x0019e1d0 #If Preset Value is not 0x00 0019e1bc: 02a28821 addu r17,r21,r2 |r17 = This iteration Unit's Data Pointer 0019e1c0: 001310c0 sll r2,r19,0x03 |Unit ID * 8 0019e1c4: 24420e50 addiu r2,r2,0x0e50 | 0019e1c8: 08067878 j 0x0019e1e0 >>Avoid Preset value 0x00 section 0019e1cc: 02e28021 addu r16,r23,r2 |r16 = Unit's AI Status Data Pointer 0x8019f3c4 - 0x0e50 + 8 Bytes per unit 0019e1d0: 3c03801a lui r3,0x801a #Else : Preset value is 0x00 0019e1d4: 8c63f3c0 lw r3,-0x0c40(r3) |Load AI Extended Status Data Pointer ( 80193924 ) 0019e1d8: 00131180 sll r2,r19,0x06 |Unit ID * 64 (0x40 bytes per unit) 0019e1dc: 00438021 addu r16,r2,r3 |r16 = Unit's AI Extended Status Data Pointer 0x80193924 + 0x40 bytes per unit 0019e1e0: 26040003 addiu r4,r16,0x0003 |r4 = Current Status 1 Pointer AI data or Extended data) 0019e1e4: 26320058 addiu r18,r17,0x0058 |r18 = Current Status Data Pointer (from battle data) 0019e1e8: 92220001 lbu r2,0x0001(r17) |Load Unit's ID 0019e1ec: 02402821 addu r5,r18,r0 |r5 = Unit's Current Status Data Pointer 0019e1f0: a2020000 sb r2,0x0000(r16) |Store Unit's ID from Battle data in Extended or AI data 0019e1f4: 92220007 lbu r2,0x0007(r17) |Load Unit's Death Counter 0019e1f8: 34060005 ori r6,r0,0x0005 |Limit = 5 bytes 0019e1fc: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Tranfer the 5 sets of current status (battle) to extended or AI data 0019e200: a2020001 sb r2,0x0001(r16) |Store Unit's Death Counter in extended/AI data 0019e204: 12c00014 beq r22,r0,0x0019e258 #If preset value is not 0x00 0019e208: 02402021 addu r4,r18,r0 |r4 = Unit's 1st set of Current Status Data Pointer (Battle stats) PV != 0 0019e20c: 9222006c lbu r2,0x006c(r17) |Load Unit's Death Sentence CT (Battle stats) Unit 0x58 -> AI 0019e210: 00000000 nop |Extended -> Unit 0019e214: a2020002 sb r2,0x0002(r16) |Store Unit's Death Sentence CT in unit AI data 0019e218: 3c03801a lui r3,0x801a | 0019e21c: 8c63f3c0 lw r3,-0x0c40(r3) |Load AI Extended Status Data Pointer 0019e220: 00131180 sll r2,r19,0x06 |ID * 64 0019e224: 00438021 addu r16,r2,r3 |r16 = Unit's AI Extended Status Data Pointer 0019e228: 92020000 lbu r2,0x0000(r16) |Load Unit's ID from extended status data 0019e22c: 00000000 nop | 0019e230: a2220001 sb r2,0x0001(r17) |Store Unit's ID in Unit battle data 0019e234: 92020001 lbu r2,0x0001(r16) |Load Unit's Death Counter (Extended status) 0019e238: 34060005 ori r6,r0,0x0005 |Limit = 5 0019e23c: a2220007 sb r2,0x0007(r17) |Store Unit's Death Counter (Battle stats) 0019e240: 92020017 lbu r2,0x0017(r16) |Load Unit's Death Sentence CT (extended status) 0019e244: 26050003 addiu r5,r16,0x0003 |r5 = Unit Extended Status Data Pointer (1st set of current status) 0019e248: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Copy Status from extended status table to Unit current status (Battle stats) 0019e24c: a222006c sb r2,0x006c(r17) |Store Unit's Death Sentence CT (battle stats) 0019e250: 080678c9 j 0x0019e324 >>Avoid Preset 0x00 Section 0019e254: 26940001 addiu r20,r20,0x0001 |Unit Counter +1 #Else Preset value 0x00 0019e258: 26040008 addiu r4,r16,0x0008 |Unit AI Extended Status CT pointer 0019e25c: 2625005d addiu r5,r17,0x005d |Pointer Unit Status CT (Battle stats) 0019e260: 92220005 lbu r2,0x0005(r17) |Load Unit's ENTD Flags 0019e264: 34060010 ori r6,r0,0x0010 |Limit = 0x10 0019e268: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Transfer all CT from Battle data to AI extended status data 0019e26c: a2020018 sb r2,0x0018(r16) |Store ENTD Flags (Extended status data) 0019e270: 26040036 addiu r4,r16,0x0036 |Unit AI Extended Status helmet pointer 0019e274: 2625001a addiu r5,r17,0x001a |Unit Helmet pointer 0019e278: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Transfer equipment ID from Battle data to Ai extended status 0019e27c: 34060007 ori r6,r0,0x0007 |Limit = 7 0019e280: 26040019 addiu r4,r16,0x0019 |Unit AI Extended data Faith pointer 0019e284: 26250026 addiu r5,r17,0x0026 |Unit Battle stat faith pointer 0019e288: 92220024 lbu r2,0x0024(r17) |Load Unit's Brave (battle stats) 0019e28c: 34060004 ori r6,r0,0x0004 |Limit = 4 0019e290: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Transfer Faith, Turn ?, HP, Max HP (Battle --> extended) 0019e294: a202003d sb r2,0x003d(r16) |Store Brave (AI extended data) 0019e298: 26040021 addiu r4,r16,0x0021 |Unit AI Extended Status Base PA pointer 0019e29c: 26250030 addiu r5,r17,0x0030 |Unit Battle stat Original PA pointer 0019e2a0: 9622002c lhu r2,0x002c(r17) |Load Unit's MP (battle stats) 0019e2a4: 34060003 ori r6,r0,0x0003 |Limit = 3 0019e2a8: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Transfer Base PA MA Speed (Battle -> extended) 0019e2ac: a602001e sh r2,0x001e(r16) |Store MP (Extended) 0019e2b0: 26040024 addiu r4,r16,0x0024 |Unit AI Extended Status PA pointer 0019e2b4: 26250036 addiu r5,r17,0x0036 |Unit Battle stat PA pointer 0019e2b8: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Transfer PA MA Speed et CT (Battle -> extended) 0019e2bc: 34060004 ori r6,r0,0x0004 |Limit = 4 0019e2c0: 26040028 addiu r4,r16,0x0028 |Unit AI Extended Status X coordinates pointer 0019e2c4: 26250047 addiu r5,r17,0x0047 |Unit Battle X coordinate pointer 0019e2c8: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Transfer X, Y and map flags (Battle -> Extended) 0019e2cc: 34060003 ori r6,r0,0x0003 |Limit = 3 0019e2d0: 2604002b addiu r4,r16,0x002b |Unit AI Extended Status Turn flag pointer 0019e2d4: 26250186 addiu r5,r17,0x0186 |Unit Battle Unit's Turn pointer 0019e2d8: 9222015d lbu r2,0x015d(r17) |Load Unit's Current Ability CT (Battle) 0019e2dc: 34060003 ori r6,r0,0x0003 |Limit = 3 0019e2e0: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Transfer Turn, Action, Movement flags (Battle -> Extended) 0019e2e4: a2020020 sb r2,0x0020(r16) |Store Current Ability CT (Extended) 0019e2e8: 2604002e addiu r4,r16,0x002e |Unit AI Extended Status Auto Battle flag pointer 0019e2ec: 262501b8 addiu r5,r17,0x01b8 |r5 = Unit's Auto Battle flag pointer 0019e2f0: 92220182 lbu r2,0x0182(r17) |Load Unit's Mount Info (Battle) 0019e2f4: 34060008 ori r6,r0,0x0008 |Limit = 8 0019e2f8: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Transfer from Auto Battle to Inflicted status 5 0019e2fc: a202003e sb r2,0x003e(r16) |Store Mount Info (Extended) 0019e300: 00132080 sll r4,r19,0x02 |Unit ID * 4 0019e304: 00932021 addu r4,r4,r19 |ID * 5 0019e308: 00042080 sll r4,r4,0x02 |ID * 20 0019e30c: 24840cd4 addiu r4,r4,0x0cd4 | 0019e310: 02e42021 addu r4,r23,r4 |Unit's AI Action Data? 0x8019f3c4 - 0x0cd4 + Unit offset 0019e314: 2625016e addiu r5,r17,0x016e |Unit's Target data for Action pointer 0019e318: 0c066ac2 jal 0x0019ab08 |-->Transfer Halfword Values Transfer from 0x16e to 0x181 (Battle --> Unit AI action data) 0019e31c: 34060014 ori r6,r0,0x0014 |Limit = 0x14 0019e320: 26940001 addiu r20,r20,0x0001 |Unit Counter +1 0019e324: 2a820015 slti r2,r20,0x0015 |Check Unit counter Vs limit 0019e328: 1440ff9c bne r2,r0,0x0019e19c Λ Loop through all units 0019e32c: 26b501c0 addiu r21,r21,0x01c0 |Pointer Mod += 0x1c0 0019e330: 16c00005 bne r22,r0,0x0019e348 #If Preset Value = 0x00 0019e334: 26e40e3c addiu r4,r23,0x0e3c |AI Team golem pointer 0019e338: 3c058019 lui r5,0x8019 | 0019e33c: 24a5f5f4 addiu r5,r5,-0x0a0c |Team Golem pointer 0019e340: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values 0019e344: 34060008 ori r6,r0,0x0008 |Limit = 8 0019e348: 8fbf0030 lw r31,0x0030(r29) END 0019e34c: 8fb7002c lw r23,0x002c(r29) 0019e350: 8fb60028 lw r22,0x0028(r29) 0019e354: 8fb50024 lw r21,0x0024(r29) 0019e358: 8fb40020 lw r20,0x0020(r29) 0019e35c: 8fb3001c lw r19,0x001c(r29) 0019e360: 8fb20018 lw r18,0x0018(r29) 0019e364: 8fb10014 lw r17,0x0014(r29) 0019e368: 8fb00010 lw r16,0x0010(r29) 0019e36c: 27bd0038 addiu r29,r29,0x0038 0019e370: 03e00008 jr r31 0019e374: 00000000 nop
Retun locations
Battle.bin 0019d404: AI_Act_phase_handling_(in_between_turn,_end_of_turn,_etc.) r4 = 0x00 0019d6d0: AI_Act_phase_handling_(in_between_turn,_end_of_turn,_etc.) r4 = 0x01 0019db20: AI_Act_phase_handling_(in_between_turn,_end_of_turn,_etc.) r4 = 0x01