HP Bar Image/Location/Moving

Hey everyone, spent some of the day working on finding out where the engine decides to place various things in the battle screen. Just wanted to relay the addresses for documentation purposes in case anyone in the future needs it, as I didn’t see the numbers offhand when looking through FeUniverse. Thanks to Kirito in the discord and @Huichelaar for your help!

514F6 - Left Number Placement X Axis
514FC - Y Axis Placement for Numbers AND Single Health Bar on both left and right
51502 - Right Number Placement X Axis
51510 - Left HP Bar X Axis
51522 - Right HP Bar X Axis
5172A - When double HP bars, Left top Y Axis
51770 - When double HP bars, Left bottom Y Axis
5185C - When double HP bars, Right top Y Axis
518A2 - When double HP bars, Right bottom Y Axis

Not a huge change, but as an example, the HP bars and HP numbers have been moved in this example.

5 Likes

So you mentioned this:

I liked the idea so I implemented it. This is what I did in EA format:

// Many thanks to Sokaballa & Pikmin1211
// for finding a bunch of these locations.

PUSH

  // Move left HP value to the right.
  //ORG 0x51502         // Right HP value.
  ORG 0x514F6           // Left HP value.
  BYTE 0x5F

  // Move left HP bars to the left.
  //ORG 0x51522         // Right HP bars.
  ORG 0x51510           // Left HP bars.
  BYTE 0x3

  // X-flip left HP bars.
  //ORG 0x518AC         // Pointer to OAMData used by right HP bars.
  ORG 0x51780           // Pointer to OAMData used by left HP bars.
  POIN FlippedHPBarsOAMData

  // Move right hit, dmg, crt values right.
  //ORG 0x5190E         // Left.
  ORG 0x5196A           // Right.
  BYTE 0xC7

  // Move right hit, dmg, crt names left.
  //ORG 0x51938         // Left.
  ORG 0x51994           // Right.
  BYTE 0x9F

  ORG 0x51050
  callHack_r0(AlignDigitsLeft)
  SHORT 0x46C0

  // Move left item icon to the right.
  //ORG 0x51A70         // Right item icon.
  //ORG 0x51A04           // Left item icon.
  //BYTE 0x75

  // Move left item name to the left.
  //ORG 0x51FF0           // Set item name length same as right item name.
  //BYTE 0x3E
  //TODO

POP

ALIGN 4
FlippedHPBarsOAMData:
SHORT 0x4000 0x5000 0x180 0x38 0x0 0x0
SHORT 0x4000 0x5000 0x184 0x18 0x0 0x0
SHORT 0x4000 0x1000 0x188 0x08 0x0 0x0
SHORT 0x0000 0x1000 0x18A 0x00 0x0 0x0
WORD 0x1  // Terminator.
ALIGN 4
AlignDigitsLeft:
WORD 0x2100480D 0x2A0B8842 0x8883D103 0x80828003
WORD 0x8802E007 0xD1042A0B 0x80038843 0x80438883
WORD 0x30068082 0x29033101 0x2000DBEC 0x46689000
WORD 0x4A034902 0x4770DF0C 0x02017712 0x020169C8
WORD 0x01000100
/*
.thumb

ldr   r0, =0x2017712
mov   r1, #0x0
Loop:
  ldrh  r2, [r0, #0x2]
  cmp   r2, #0xB
  bne   L1
    ldrh  r3, [r0, #0x4]
    strh  r3, [r0]
    strh  r2, [r0, #0x4]
    b     L2
  L1:
  ldrh  r2, [r0]
  cmp   r2, #0xB
  bne   L2
    ldrh  r3, [r0, #0x2]
    strh  r3, [r0]
    ldrh  r3, [r0, #0x4]
    strh  r3, [r0, #0x2]
    strh  r2, [r0, #0x4]
  L2:
  add   r0, #0x6
  add   r1, #0x1
  cmp   r1, #0x3
  blt   Loop

@ Overwritten vanilla stuff.

mov   r0, #0x0
str   r0, [sp]
mov   r0, sp
ldr   r1, =0x20169C8
ldr   r2, =0x1000100
swi   #0xC      @ CpuFastSet

bx    r14
.ltorg
*/

Despite both left and right HP bars using the same OAMData, they draw this pointer from different literal pools, which allows you to repoint one without affecting the other. Although top-left and, if present, bottom-left HP bars do share this literal, same for top-right and, if present again, bottom-right.

I’ll make an edit to this post or make a new post once I figure out how to flip the item name & item icon and how to flip the battlestats.

EDIT: So the item names are a bit annoying as they’re not sprites, but part of the battlescreen BG. Some tiles are shared between left and right, others are not. I dread that if I change anything here, it’s going to break any custom battlescreens so I’m just going to drop that for now. I did flip the battlestats around.

EDIT2: I’ve added a routine which aligns the battlestat digits on the right side to the left.

Imgur

6 Likes

Huichelaar, this is so awesome. You’re a friggin’ wizard with this stuff!

Battle screen looks so awesome now, thanks so much!

Funny thing was that the first few times I watched the HP bar go down from the other side, it was like a screw loose in my head. We’ve been watching it go down the normal way for so long, it took me a few times to adjust to it. But I love it now!

I find it just a bit jarring with the hit/dmg/crit stuff, so I ended up leaving it out. And I fully understand how the item icons/item names would have been a huge hassle.

Thanks again for all your awesome work on this!

3 Likes

You can separate the Y axis for the single HP bars from each other as well as the HP numbers by writing shorts are these addresses

$5159E < Left HP number Y
$5162E < Right HP number Y
$51790 < Left HP bar Y
$518BC < Right HP bar Y

Each of these is part of a ldr instruction, simply more on byte earlier and write the following to change then to mov and put your Y value in the second byte

Numbers:
8836 < Replace with 26YY

Bars:
8812 < Replace with 22YY

Stacked HP

3 Likes