0019905c - 00199120

From Final Fantasy Hacktics Wiki
Revision as of 18:25, 10 July 2020 by Dokurider (talk | contribs) (Added Documentation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

0019905c - 00199120 Cowardly AI Movement Routine

0019905c: 3c02801a lui r2,0x801a
00199060: 90420d7b lbu r2,0x0d7b(r2)
00199064: 27bdffe8 addiu r29,r29,0xffe8
00199068: afb00010 sw r16,0x0010(r29)
0019906c: 3c10801a lui r16,0x801a
00199070: 2610f3c4 addiu r16,r16,0xf3c4
00199074: 10400008 beq r2,r0,0x00199098
00199078: afbf0014 sw r31,0x0014(r29)
0019907c: 3c03801a lui r3,0x801a
00199080: 8c63f394 lw r3,-0x0c6c(r3)			Load Movement Progress Variable
00199084: 00000000 nop
00199088: 10600005 beq r3,r0,0x001990a0			Branch if Progress = 0
0019908c: 34020001 ori r2,r0,0x0001
00199090: 1062000c beq r3,r2,0x001990c4			Branch if Progress = 1
00199094: 00000000 nop

<Set Priority on Tiles>

00199098: 3c01801a lui r1,0x801a
0019909c: a02001f1 sb r0,0x01f1(r1)
001990a0: 0c066672 jal 0x001999c8			Set Priority on Tiles within Movement Range
001990a4: 00000000 nop
001990a8: 2403ffff addiu r3,r0,0xffff
001990ac: 14430005 bne r2,r3,0x001990c4		Branch unless time's up on Animate Frame Timer
001990b0: 2402ffff addiu r2,r0,0xffff
001990b4: 3c01801a lui r1,0x801a
001990b8: ac20f394 sw r0,-0x0c6c(r1)		Movement Progress Variable = 0
001990bc: 08066444 j 0x00199110				Jump to Exit
001990c0: 00000000 nop

<Find Coordinate>

001990c4: 8e040e34 lw r4,0x0e34(r16)
001990c8: 0c06653e jal 0x001994f8			See if able to move to target?
001990cc: 00000000 nop
001990d0: 2403ffff addiu r3,r0,0xffff
001990d4: 1043000a beq r2,r3,0x00199100		Branch if time's up on Animate Frame Timer
001990d8: 340400ff ori r4,r0,0x00ff
001990dc: 0c065a4f jal 0x0019693c			AI Post Action Movement Decision Routine
001990e0: 00002821 addu r5,r0,r0			Move away from enemies instead of closer to healer
001990e4: 8e030cc4 lw r3,0x0cc4(r16)		Load Coordinates
001990e8: 34020001 ori r2,r0,0x0001
001990ec: a2020e2d sb r2,0x0e2d(r16)
001990f0: 0c0664e8 jal 0x001993a0			001993a0 - 00199494
001990f4: ae030cc8 sw r3,0x0cc8(r16)		Save coordinates to new destination
001990f8: 08066444 j 0x00199110
001990fc: 00001021 addu r2,r0,r0			Return 0

<Set Progess to 1>

00199100: 34020001 ori r2,r0,0x0001
00199104: 3c01801a lui r1,0x801a
00199108: ac22f394 sw r2,-0x0c6c(r1)		Set Movement Progress to 1
0019910c: 2402ffff addiu r2,r0,0xffff

<Exit>

00199110: 8fbf0014 lw r31,0x0014(r29)
00199114: 8fb00010 lw r16,0x0010(r29)
00199118: 27bd0018 addiu r29,r29,0x0018
0019911c: 03e00008 jr r31
00199120: 00000000 nop