Added code to draw equip window header

This commit is contained in:
jeffman 2017-04-16 19:15:22 -04:00
parent 6f448b8f2c
commit a633b9d643
3 changed files with 72 additions and 0 deletions

View File

@ -186,6 +186,55 @@ void clear_window_header(int *dest)
clear_rect_ram(dest, 16, 0x33333333); clear_rect_ram(dest, 16, 0x33333333);
} }
unsigned short* print_equip_header(int type, unsigned short *tilemap, unsigned int *dest, WINDOW *window)
{
byte *str = 0;
switch (type)
{
case 3:
str = m12_other_str5; // Weapon
break;
case 4:
str = m12_other_str6; // Body
break;
case 5:
str = m12_other_str7; // Arms
break;
case 6:
str = m12_other_str8; // Other
break;
}
if (str != 0)
{
int startX = 0x10 * 8;
int startY = 0x11 * 8;
int width = 0;
width += print_window_header_string(dest, str, startX + width, startY);
// Print (X)
if (window->cursor_x > 6)
{
int page = window->page;
str = m2_strlookup(m2_misc_offsets, m2_misc_strings, page + 0x8C);
width += print_window_header_string(dest, str, startX + width, startY);
}
// Do tilemap
int tiles = (width + 7) >> 3;
int tileIndex = 0x230 + *tile_offset;
for (int i = 0; i < tiles; i++)
{
*tilemap++ = tileIndex++ | *palette_mask;
}
}
return tilemap;
}
void weld_entry(WINDOW *window, byte *str) void weld_entry(WINDOW *window, byte *str)
{ {
weld_entry_custom(window, str, 0, 0xF); weld_entry_custom(window, str, 0, 0xF);

View File

@ -9,6 +9,9 @@ unsigned short *palette_mask = (unsigned short*)0x3005228;
unsigned short **tilemap_pointer = (unsigned short**)0x3005270; unsigned short **tilemap_pointer = (unsigned short**)0x3005270;
int *vram = (int*)0x6000000; int *vram = (int*)0x6000000;
int *m2_misc_offsets = (int*)0x8B17EE4;
byte *m2_misc_strings = (byte*)0x8B17424;
byte decode_character(byte chr); byte decode_character(byte chr);
int get_tile_number(int x, int y); int get_tile_number(int x, int y);
int expand_bit_depth(byte row, int foreground); int expand_bit_depth(byte row, int foreground);
@ -20,6 +23,8 @@ byte print_character_with_callback(byte chr, int x, int y, int font, int foregro
byte print_character_to_ram(byte chr, int *dest, int xOffset, int font, int foreground); byte print_character_to_ram(byte chr, int *dest, int xOffset, int font, int foreground);
int print_window_header_string(int *dest, byte *str, int x, int y); int print_window_header_string(int *dest, byte *str, int x, int y);
void clear_window_header(int *dest); void clear_window_header(int *dest);
unsigned short* print_equip_header(int type, unsigned short *tilemap, unsigned int *dest,
WINDOW *window);
void weld_entry(WINDOW *window, byte *str); void weld_entry(WINDOW *window, byte *str);
void weld_entry_custom(WINDOW *window, byte *str, int font, int foreground); void weld_entry_custom(WINDOW *window, byte *str, int font, int foreground);
void clear_tile(int x, int y, int pixels); void clear_tile(int x, int y, int pixels);
@ -38,6 +43,10 @@ extern byte *m2_font_table[];
extern byte m2_font_widths[]; extern byte m2_font_widths[];
extern byte m2_font_heights[]; extern byte m2_font_heights[];
extern unsigned short *m2_widths_table[]; extern unsigned short *m2_widths_table[];
extern byte m12_other_str5[];
extern byte m12_other_str6[];
extern byte m12_other_str7[];
extern byte m12_other_str8[];
extern void cpufastset(void *source, void *dest, int mode); extern void cpufastset(void *source, void *dest, int mode);
extern byte* m2_strlookup(int *offset_table, byte *strings, int index); extern byte* m2_strlookup(int *offset_table, byte *strings, int index);

View File

@ -163,6 +163,20 @@ b 0x80BFB84 // Skip the remaining nonsense
.org 0x80C5A1A :: nop .org 0x80C5A1A :: nop
.org 0x80C5A28 :: nop .org 0x80C5A28 :: nop
// Draw equipment window header
.org 0x80C55CE :: b 0x80C55F8
.org 0x80C55F8
mov r4,r0
mov r0,r9
bl clear_window_header
mov r0,r4
mov r1,r6 // tilemap
mov r2,r9 // vram
mov r3,r7 // window
bl print_equip_header
mov r6,r0
b 0x80C5726
//--------------------------------------------------------- //---------------------------------------------------------
// C1FBC hacks (PSI window) // C1FBC hacks (PSI window)
//--------------------------------------------------------- //---------------------------------------------------------