Transfer AI Data to Unit Data
Jump to navigation
Jump to search
BATTLE.BIN : - Transfer_AI_Data_to_Unit_Data ------------------------------------------------------------------------------------------ Parameter : r4 = 0x00 : Transfer AI extendend data and Golem amounts r4 = 0x01 : Transfer AI 0x0e50 dta Return : Nothing ------------------------------------------------------------------------------------------ 0019e378: 27bdffd0 addiu r29,r29,-0x0030 | 0019e37c: afb50024 sw r21,0x0024(r29) | 0019e380: 0080a821 addu r21,r4,r0 |r21 = Preset Value 0019e384: afb60028 sw r22,0x0028(r29) | 0019e388: 3c16801a lui r22,0x801a | 0019e38c: 26d6f3c4 addiu r22,r22,-0x0c3c |AI Data Pointer ( 8019f3c4 ) 0019e390: afb3001c sw r19,0x001c(r29) | 0019e394: 00009821 addu r19,r0,r0 |Unit Counter = 0 0019e398: afb40020 sw r20,0x0020(r29) | 0019e39c: 0000a021 addu r20,r0,r0 |Pointer Mod = 0 0019e3a0: afbf002c sw r31,0x002c(r29) | 0019e3a4: afb20018 sw r18,0x0018(r29) | 0019e3a8: afb10014 sw r17,0x0014(r29) | 0019e3ac: afb00010 sw r16,0x0010(r29) | @LOOP 0019e3b0: 02d31021 addu r2,r22,r19 |Dynamic AI pointer (8019f3c4 + Unit counter) 0019e3b4: 9052198c lbu r18,0x198c(r2) |This iteration Unit's Battle ID 0019e3b8: 340200ff ori r2,r0,0x00ff | 0019e3bc: 1242004b beq r18,r2,0x0019e4ec #If Unit doesn't exist : branch to Next unit 0019e3c0: 00000000 nop | 0019e3c4: 3c028019 lui r2,0x8019 | 0019e3c8: 244208cc addiu r2,r2,0x08cc | 0019e3cc: 12a00005 beq r21,r0,0x0019e3e4 #If Preset Value <> 0x00 0019e3d0: 02828821 addu r17,r20,r2 |Dynamic Battle data pointer 0019e3d4: 001210c0 sll r2,r18,0x03 |Battle ID * 8 0019e3d8: 24420e50 addiu r2,r2,0x0e50 | 0019e3dc: 080678fd j 0x0019e3f4 >>Avoid PV 0x00 0019e3e0: 02c28021 addu r16,r22,r2 |r16 = Unit AI Status Data Pointer 8019f3c4 + Unit ID (8 bytes per unit) Else PV = 0 0019e3e4: 3c03801a lui r3,0x801a | 0019e3e8: 8c63f3c0 lw r3,-0x0c40(r3) |Load AI Extended Status Data Pointer 80193924 0019e3ec: 00121180 sll r2,r18,0x06 |ID * 64 0019e3f0: 00438021 addu r16,r2,r3 |Dynamic Unit's AI Extended Status Data Pointer 0019e3f4: 26240058 addiu r4,r17,0x0058 | Pointer to Unit's Current Statuses 0019e3f8: 92020000 lbu r2,0x0000(r16) |Load Unit ID (AI 0x00) 0019e3fc: 26050003 addiu r5,r16,0x0003 |Unit AI Status Data Pointer 0019e400: a2220001 sb r2,0x0001(r17) |Store Unit ID (on Battle 0x001) 0019e404: 92020001 lbu r2,0x0001(r16) |Load Unit's Death Counter (AI 0x01) 0019e408: 34060005 ori r6,r0,0x0005 |Limit = 5 0019e40c: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values From AI 0x03 to Battle 0x58 (5 bytes) 0019e410: a2220007 sb r2,0x0007(r17) |Store Unit's Death Counter (Battle 0x007) 0019e414: 12a00004 beq r21,r0,0x0019e428 #If Preset Value <> 0x00 0019e418: 2624005d addiu r4,r17,0x005d |Unit's Status CT Pointer 0019e41c: 92020002 lbu r2,0x0002(r16) |Load Unit's Death Sentence CT (AI 0x02) 0019e420: 0806793b j 0x0019e4ec >>Jump to Next Unit 0019e424: a222006c sb r2,0x006c(r17) |Store Death Sentence CT (Battle 0x06c) Else : Preset Value = 0x00 0019e428: 26050008 addiu r5,r16,0x0008 |Unit's AI Status CT Pointer 0019e42c: 92020018 lbu r2,0x0018(r16) |r2 = Load Unit's ENTD Flags 0019e430: 34060010 ori r6,r0,0x0010 |Limit = 0x10 0019e434: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Transfer statii CT from AI 0x08 to Battle data 0x5d (16 Bytes) 0019e438: a2220005 sb r2,0x0005(r17) |Store ENTD Flags 0019e43c: 2624001a addiu r4,r17,0x001a |Unit's Equipment Pointer 0019e440: 26050036 addiu r5,r16,0x0036 |Unit's AI Equipment Pointer 0019e444: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Transfer Equipment data from AI 0x36 to Battle 0x1a (7 bytes) 0019e448: 34060007 ori r6,r0,0x0007 |Limit = 7 0019e44c: 26240026 addiu r4,r17,0x0026 |Unit's Faith/Turn Flag?/HP Pointer 0019e450: 26050019 addiu r5,r16,0x0019 |Unit's AI " 0019e454: 9202003d lbu r2,0x003d(r16) |Load Unit's Brave 0019e458: 34060004 ori r6,r0,0x0004 |Limit = 4 0019e45c: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values AI 0x19 to Battle 0x26 (4 Bytes) 0019e460: a2220024 sb r2,0x0024(r17) |Store Unit's Brave 0019e464: 26240030 addiu r4,r17,0x0030 |Unit's Original PA/MA/SP Pointer 0019e468: 26050021 addiu r5,r16,0x0021 |Unit's AI " 0019e46c: 9602001e lhu r2,0x001e(r16) |Load Unit's MP 0019e470: 34060003 ori r6,r0,0x0003 |Limit = 3 0019e474: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Transfer stats from AI 0x21 to Battle 0x30 (3 bytes) 0019e478: a622002c sh r2,0x002c(r17) |Store Unit's MP 0019e47c: 26240036 addiu r4,r17,0x0036 |Unit's Modified PA/MA/SP/CT Pointer 0019e480: 26050024 addiu r5,r16,0x0024 | Unit's AI " 0019e484: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Transfer stats from AI 0x24 to Battle 0x36 (4 bytes) 0019e488: 34060004 ori r6,r0,0x0004 |Limit = 4 0019e48c: 26240047 addiu r4,r17,0x0047 | Unit's Coordinate Data 0019e490: 26050028 addiu r5,r16,0x0028 | Unit's AI " 0019e494: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values Transfer coordinates from AI 0x28 to Battle 0x47 (3 Bytes) 0019e498: 34060003 ori r6,r0,0x0003 |Limit = 3 0019e49c: 26240186 addiu r4,r17,0x0186 |Unit's Turn Data Flags? 0019e4a0: 2605002b addiu r5,r16,0x002b |Unit's AI " 0019e4a4: 92020020 lbu r2,0x0020(r16) |Load Unit's Current Ability CT 0019e4a8: 34060003 ori r6,r0,0x0003 |Limit = 3 0019e4ac: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values AI 2b to Battle 0x186 (3bytes) 0019e4b0: a222015d sb r2,0x015d(r17) |Store Current Ability CT 0019e4b4: 262401b8 addiu r4,r17,0x01b8 |Unit's Action Data? 0019e4b8: 2605002e addiu r5,r16,0x002e |Unit's AI " 0019e4bc: 9202003e lbu r2,0x003e(r16) |Load Unit's Mount Info 0019e4c0: 34060008 ori r6,r0,0x0008 |Limit = 8 0019e4c4: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values AI 0x2e to Battle 0x1b8 (8 bytes) 0019e4c8: a2220182 sb r2,0x0182(r17) |Store Mount Info 0019e4cc: 2624016e addiu r4,r17,0x016e |Unit's Pointer to Current Action target data 0019e4d0: 00122880 sll r5,r18,0x02 |Battle ID * 4 0019e4d4: 00b22821 addu r5,r5,r18 |ID * 5 0019e4d8: 00052880 sll r5,r5,0x02 |ID * 20 (0x14) 0019e4dc: 24a50cd4 addiu r5,r5,0x0cd4 | 0019e4e0: 02c52821 addu r5,r22,r5 |Unit's AI pointer to Current action target data 0019e4e4: 0c066ac2 jal 0x0019ab08 |-->Transfer Halfword Values Transfer current action target data from AI to Battle 0019e4e8: 34060014 ori r6,r0,0x0014 |Limit = 0x14 0019e4ec: 26730001 addiu r19,r19,0x0001 |Unit Counter ++ 0019e4f0: 2a620015 slti r2,r19,0x0015 | 0019e4f4: 1440ffae bne r2,r0,0x0019e3b0 #Branch if Unit Counter < 0x15 0019e4f8: 269401c0 addiu r20,r20,0x01c0 |Pointer Mod += 0x1c0 0019e4fc: 16a00005 bne r21,r0,0x0019e514 #If Preset Value = 0x00 0019e500: 26c50e3c addiu r5,r22,0x0e3c |AI team golem amount pointer 0019e504: 3c048019 lui r4,0x8019 | 0019e508: 2484f5f4 addiu r4,r4,-0x0a0c |Pointer to Team Golem amounts 0019e50c: 0c066ad2 jal 0x0019ab48 |-->Transfer Byte Values 0019e510: 34060008 ori r6,r0,0x0008 |Limit = 8 0019e514: 8fbf002c lw r31,0x002c(r29) 0019e518: 8fb60028 lw r22,0x0028(r29) 0019e51c: 8fb50024 lw r21,0x0024(r29) 0019e520: 8fb40020 lw r20,0x0020(r29) 0019e524: 8fb3001c lw r19,0x001c(r29) 0019e528: 8fb20018 lw r18,0x0018(r29) 0019e52c: 8fb10014 lw r17,0x0014(r29) 0019e530: 8fb00010 lw r16,0x0010(r29) 0019e534: 27bd0030 addiu r29,r29,0x0030 0019e538: 03e00008 jr r31 0019e53c: 00000000 nop
Return locations
BATTLE.BIN 0019d3c0: AI_End_of_turn,_in_between_turn,_etc. 0019db0c: AI_End_of_turn,_in_between_turn,_etc. 0019db5c: AI_End_of_turn,_in_between_turn,_etc.