Store hardcoded AI stuff (blood suck, frog, berserk abilities)

From Final Fantasy Hacktics Wiki
(Redirected from 00199d20 - 00199ec4)
Jump to navigation Jump to search
BATTLE.BIN :  :  - Store hardcoded AI stuff (blood suck, frog, berserk abilities)
------------------------------------------------------------------------------------------
00199d20: 27bdffd0 addiu r29,r29,-0x0030     |
00199d24: afb00010 sw r16,0x0010(r29)        |
00199d28: 00008021 addu r16,r0,r0            |
00199d2c: afb20018 sw r18,0x0018(r29)        |
00199d30: 00009021 addu r18,r0,r0            |
00199d34: afb3001c sw r19,0x001c(r29)        |
00199d38: 00009821 addu r19,r0,r0            |
00199d3c: afb50024 sw r21,0x0024(r29)        |
00199d40: 341500ff ori r21,r0,0x00ff         |
00199d44: afb10014 sw r17,0x0014(r29)        |
00199d48: 00008821 addu r17,r0,r0            |
00199d4c: afb40020 sw r20,0x0020(r29)        |
00199d50: 3c14801a lui r20,0x801a            |
00199d54: 2694f3c4 addiu r20,r20,-0x0c3c     |AI Data pointer  8019f3c4
00199d58: 3c028019 lui r2,0x8019             |
00199d5c: 24423924 addiu r2,r2,0x3924        |AI Extended Status data pointer   80193924
00199d60: 3c01801a lui r1,0x801a             |
00199d64: ac22f3c0 sw r2,-0x0c40(r1)         |Store pointer at 8019f3c0
00199d68: 340200a7 ori r2,r0,0x00a7          |
00199d6c: 3c01801a lui r1,0x801a             |
00199d70: a0220b36 sb r2,0x0b36(r1)          |store bloodsuck  skillset 801a0b36
00199d74: 340200c8 ori r2,r0,0x00c8          |
00199d78: 3c04800e lui r4,0x800e             |
00199d7c: 90844e9c lbu r4,0x4e9c(r4)         |Map max x
00199d80: 3c05800e lui r5,0x800e             |
00199d84: 90a54ea0 lbu r5,0x4ea0(r5)         |Map max Y
00199d88: 34030084 ori r3,r0,0x0084          |
00199d8c: 3c01801a lui r1,0x801a             |
00199d90: a4220b34 sh r2,0x0b34(r1)          |Store Blood Suck Ability ID (0x00c8) 801a0b34
00199d94: 340200a9 ori r2,r0,0x00a9          |
00199d98: 3c01801a lui r1,0x801a             |
00199d9c: a0220b3a sb r2,0x0b3a(r1)          |Store Empty skillset (0xA9)  801a0b3a for Frog ? 
00199da0: 3402016f ori r2,r0,0x016f          |
00199da4: afbf0028 sw r31,0x0028(r29)        |
00199da8: 3c01801a lui r1,0x801a             |
00199dac: ac34f3ac sw r20,-0x0c54(r1)        |Store AI data pointer
00199db0: 3c01801a lui r1,0x801a             |
00199db4: a0200d7b sb r0,0x0d7b(r1)          |Reset 801a0d7b - AI 0x19b7 (Decision state)
00199db8: 3c01801a lui r1,0x801a             |
00199dbc: a0200bdc sb r0,0x0bdc(r1)          |Reset 801a0dbc - AI 0x1818 
00199dc0: 3c01801a lui r1,0x801a             |
00199dc4: a0200bc7 sb r0,0x0bc7(r1)          |Reset 801a0bc7 - AI 0x1803
00199dc8: 3c01801a lui r1,0x801a             |
00199dcc: a0230b37 sb r3,0x0b37(r1)          |Store bloodsuck usage type (0x84)
00199dd0: 3c01801a lui r1,0x801a             |
00199dd4: a4220b38 sh r2,0x0b38(r1)          |Store frog ability ID (0x16f)
00199dd8: 3c01801a lui r1,0x801a             |
00199ddc: a0230b3b sb r3,0x0b3b(r1)          |Store Frog usage type (0x84)
00199de0: 3c01801a lui r1,0x801a             |
00199de4: a02001db sb r0,0x01db(r1)          |Reset 801a01db - AI 0x0e17
00199de8: 3c01801a lui r1,0x801a             |
00199dec: a02401fe sb r4,0x01fe(r1)          |Store map max x
00199df0: 3c01801a lui r1,0x801a             |
00199df4: a02501ff sb r5,0x01ff(r1)          |Store map max y
                                            @LOOP - Do all units
00199df8: 02901821 addu r3,r20,r16               |Dynamic AI pointer - 1 byte per Unit iteration
00199dfc: a075198c sb r21,0x198c(r3)             |Store 0xff unit battle id
00199e00: 3c018019 lui r1,0x8019                 |
00199e04: 00310821 addu r1,r1,r17                |Part of Dynamic pointer to Unit battle data - +0x1c0 bytes per unit iteration
00199e08: 902208cd lbu r2,0x08cd(r1)             |This Unit battle id
00199e0c: 00000000 nop                           |
00199e10: 10550008 beq r2,r21,0x00199e34         #If Unit exists (not 0xff)
00199e14: 02002021 addu r4,r16,r0                    |Send Unit ID
00199e18: 0c0667b2 jal 0x00199ec8                    |-->Usable_Ability_Setting/ENTD_AI_Calculations
00199e1c: a072198c sb r18,0x198c(r3)                 |store Unit ID
00199e20: 3c018019 lui r1,0x8019                     |
00199e24: 00310821 addu r1,r1,r17                    |Part of Dynamic pointer to Unit battle data - +0x1c0 bytes per unit iteration
00199e28: 942208f6 lhu r2,0x08f6(r1)                 |Unit  max hp (0x2A)
00199e2c: 26520001 addiu r18,r18,0x0001              |Existing Unit counter +1
00199e30: 02629821 addu r19,r19,r2                   |add max hp (of all units ??)
00199e34: 26100001 addiu r16,r16,0x0001          |Loop Counter + 1
00199e38: 2a020015 slti r2,r16,0x0015            |
00199e3c: 1440ffee bne r2,r0,0x00199df8      #Loop 0x15 Times
00199e40: 263101c0 addiu r17,r17,0x01c0          |Offset of Unit battle data
00199e44: 1240000c beq r18,r0,0x00199e78     #If No Units found : Avoid average HP math
00199e48: 340300ff ori r3,r0,0x00ff              |
00199e4c: 0272001a div r19,r18               |All max hp / nb of units
00199e50: 00001812 mflo r3                   |r3 = average hp of units
00199e54: 00000000 nop                       |
00199e58: 28620100 slti r2,r3,0x0100         |
00199e5c: 14400004 bne r2,r0,0x00199e70      #If Average HP > 256
00199e60: 00000000 nop                           |
00199e64: 340200ff ori r2,r0,0x00ff              |cap at 256
00199e68: 0806679d j 0x00199e74                  |
00199e6c: a2820e17 sb r2,0x0e17(r20)             |store average max hp of team members
                                            Else : Average HP < 256
00199e70: a2830e17 sb r3,0x0e17(r20)             |store average max hp of team members
00199e74: 340300ff ori r3,r0,0x00ff          |
00199e78: 34100003 ori r16,r0,0x0003         |Initialize counter
00199e7c: 2682000c addiu r2,r20,0x000c       |Dynamic Pointer to AI + 0x0c
                                            @LOOP - 4 times
00199e80: a043181c sb r3,0x181c(r2)              |Store 0xff at 0x181c Table (3 entries)
00199e84: 2610ffff addiu r16,r16,0xffff          |Counter -1
00199e88: 0601fffd bgez r16,0x00199e80       Λ LOOP while counter is >=0
00199e8c: 2442fffc addiu r2,r2,-0x0004           |Dynamic offset - 0x04
00199e90: 3402017f ori r2,r0,0x017f          |
00199e94: a6820e14 sh r2,0x0e14(r20)         |Store 0x017f at AI 0x0e14 Initialize acting Unit choosen Throw Ability ID
00199e98: 34020001 ori r2,r0,0x0001          |
00199e9c: a2820e16 sb r2,0x0e16(r20)         |Store 0x01 at AI 0x0e16   Initialize ID of best weapon to throw
00199ea0: 8fbf0028 lw r31,0x0028(r29)
00199ea4: 8fb50024 lw r21,0x0024(r29)
00199ea8: 8fb40020 lw r20,0x0020(r29)
00199eac: 8fb3001c lw r19,0x001c(r29)
00199eb0: 8fb20018 lw r18,0x0018(r29)
00199eb4: 8fb10014 lw r17,0x0014(r29)
00199eb8: 8fb00010 lw r16,0x0010(r29)
00199ebc: 27bd0030 addiu r29,r29,0x0030
00199ec0: 03e00008 jr r31
00199ec4: 00000000 nop

Return locations

BATTLE.BIN
 00078674: [[000785ac_-_000787d8]]
 0008ec50: [[0008ea6c_-_0008ec6c]]
 0008ef04: [[0008ec70_-_0008ef20]]