Set Enemy Level Data

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

Used to store the Highest Enemy Level and Sum of Enemy Levels for calculating things like the end of battle Bonus Money.

Parameters: r4 = Unit's Battle Stats pointer

00180db0: 90820005 lbu r2,0x0005(r4)			Load unit's ENTD Flags
00180db4: 00000000 nop
00180db8: 30420030 andi r2,r2,0x0030			Check if unit has the flags for Red Team, Green Team, or Light Blue Team (enemies)
00180dbc: 1040000e beq r2,r0,0x00180df8			Branch to end if Blue Team (allies)
00180dc0: 00000000 nop
00180dc4: 90840022 lbu r4,0x0022(r4)			Load unit's Level 
00180dc8: 3c028019 lui r2,0x8019			
00180dcc: 94423844 lhu r2,0x3844(r2)			Load Sum of Enemy Levels
00180dd0: 3c038019 lui r3,0x8019			
00180dd4: 90633920 lbu r3,0x3920(r3)			Load Highest Enemy Level
00180dd8: 00441021 addu r2,r2,r4
00180ddc: 0064182b sltu r3,r3,r4			Set if < Level 
00180de0: 3c018019 lui r1,0x8019			
00180de4: a4223844 sh r2,0x3844(r1)			Store updated Sum of Enemy Levels into 0x80193844
00180de8: 10600003 beq r3,r0,0x00180df8			Branch if this is not the new Highest Enemy Level
00180dec: 00000000 nop
00180df0: 3c018019 lui r1,0x8019			
00180df4: a0243920 sb r4,0x3920(r1)			Store new Highest Enemy Level into 0x80193920
00180df8: 03e00008 jr r31
00180dfc: 00000000 nop

Return Locations

8017fb58: Load ENTD Units / Big ENTD unit loading routine
8017fd6c: Check for unit availability(existance) and ENTD level setting