print_window_header_string now uses pixel coordinates

This is so that we can glue strings together. For example, the game
prints "Weapons" and "(X)" (page number) as separate strings.
This commit is contained in:
jeffman 2017-04-16 19:12:33 -04:00
parent 08b586b1f0
commit 0ae74eefd9
2 changed files with 11 additions and 4 deletions

View File

@ -159,8 +159,8 @@ byte print_character_with_callback(byte chr, int x, int y, int font, int foregro
int print_window_header_string(int *dest, byte *str, int x, int y)
{
int pixelX = 0;
int *destOffset = dest + (x + (y * 32)) * 8;
int pixelX = x & 7;
int *destOffset = dest + ((x & ~7) + (y * 32));
for (;;)
{
@ -177,7 +177,7 @@ int print_window_header_string(int *dest, byte *str, int x, int y)
pixelX += print_character_to_ram(decode_character(*str++), destOffset, pixelX, 4, 0xF);
}
return (pixelX + 7) >> 3;
return pixelX - (x & 7);
}
void weld_entry(WINDOW *window, byte *str)

View File

@ -382,7 +382,14 @@ b 0x80C9788
// CAB90 hacks (print window header string)
//---------------------------------------------------------
.org 0x80CAB90 :: push {lr} :: bl print_window_header_string :: pop {pc}
.org 0x80CAB90
push {lr}
lsl r2,r2,3
lsl r3,r3,3 // tiles to pixels
bl print_window_header_string
add r0,7
lsr r0,r0,3 // pixels to tiles
pop {pc}
//---------------------------------------------------------
// CABF8 hacks (print checkerboard string)