[FE7] Attacker and defender battle position

Here’s the code snippet that determines which unit goes on the left or right side of the battle screen:

r6 = defender alliance
r7 --> r0 = attacker alliance

Alliance values set by routine 08053298:
00 = player, 01 = enemy, 02 = NPC/other, 03 = unused alliance

08051E80 2400     mov     r4,#0x0
08051E82 F7F9F98D bl      #0x804B1A0
08051E86 2801     cmp     r0,#0x1
08051E88 D00A     beq     #0x8051EA0  // If link arena: attacker(left)
08051E8A 0438     lsl     r0,r7,#0x10
08051E8C 1400     asr     r0,r0,#0x10
08051E8E 2800     cmp     r0,#0x0
08051E90 D005     beq     #0x8051E9E  // If attacker == player: attacker(right)
08051E92 2802     cmp     r0,#0x2
08051E94 D003     beq     #0x8051E9E  // If attacker == NPC/other: attacker(right)
08051E96 2801     cmp     r0,#0x1
08051E98 D102     bne     #0x8051EA0  // If attacker != enemy: attacker(left)
08051E9A 2E01     cmp     r6,#0x1
08051E9C D100     bne     #0x8051EA0  // If defender != enemy: attacker(left)
08051E9E 2401     mov     r4,#0x1     // Else, attacker(right)
08051EA0 1C22     mov     r2,r4
08051EA2 2A01     cmp     r2,#0x1
08051EA4 D11E     bne     #0x8051EE4

The battle background depends on the terrain of the left side unit.

@ghast The reverse level-up bug in your hack can be fixed by putting player units on the right side when they’re attacked by NPC units.
Paste this at 051E92:

00 2E 04 D0 02 28 01 D0 02 2E 00 D0
7 Likes

holy shit guy thanks! what a pleasant surprise :octopus: