Added proper printing for the name up top and also referenced the overworld alphabet table

This commit is contained in:
Lorenzooone 2019-08-25 02:24:31 +02:00
parent 8ffd478a85
commit f57113c246
6 changed files with 94 additions and 1 deletions

View File

@ -13,3 +13,4 @@ int __attribute__((naked)) m2_remainder(int dividend, int divisor) {}
int __attribute__((naked)) m2_sub_a334c(int value) {}
int __attribute__((naked)) m2_sub_a3384(int value) {}
int __attribute__((naked)) m2_clearwindowtiles(WINDOW* window) {}
void __attribute__((naked)) m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight) {}

View File

@ -766,6 +766,33 @@ void format_cash_window(int value, int padding, byte* str)
*str++ = 0xFF;
}
int player_name_printing_registration(byte* str, WINDOW* window)
{
char String[26];
bool ended = false;
int total = 24;
for(int i = 0; i < 24; i++)
{
if(ended)
{
String[i] = 0x53;
}
else if((i < 23 && str[i + 1] == 0xFF && str[i] == 0) || (i == 23 && str[i] == 0))
{
String[i] = 0x70;
total = i;
ended = true;
}
else
String[i] = str[i];
}
String[24] = 0;
String[25] = 0xFF;
print_blankstr_window(0, 2, 24, window);
m2_printstr(window, String, 0, 1, 0);
return total;
}
// The game draws windows lazily: no window will be drawn to the screen until
// a renderable token is encountered. So it's possible to have text that
// does stuff in the background without ever showing a window. Lots of doors

View File

@ -97,4 +97,5 @@ extern int m2_resetwindow(WINDOW* window, bool skip_redraw);
extern void m2_hpwindow_up(int character);
extern int m2_div(int dividend, int divisor);
extern int m2_remainder(int dividend, int divisor);
extern void m2_soundeffect(int index);
extern void m2_soundeffect(int index);
extern void m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight);

View File

@ -0,0 +1 @@
M鳰鵐鶰鸐麺齅﨧<EFBFBD>MyMMMMMMM颩馦蒑蔒薓蘉蚆蜯螹蠱袽MMMMMMMM騇襇覯訫誐諱譓豈費MMMMMMMMMM鞰MMMMMMMMMMMMMMMMMMMMMMMM鸐鳰郙酠釳鉓銶錗鍹鏜鐼镸MMMM麺<EFBFBD><EFBFBD><EFBFBD>

View File

@ -1311,6 +1311,21 @@ nop
.org 0x80056F0 :: add r0,#0x90 //New cursor's X
.org 0x86DBC6C :: .incbin "data/m2-summary-template.bin"
//==============================================================================
// Data files
//==============================================================================
//Player name printing - character is added
.org 0x80C75B4 :: bl c75b4_overworld_naming_top_printing :: b 0x80C777A
//Player name printing - character is deleted via add
.org 0x80C780E :: bl c780e_overworld_naming_top_printing :: b 0x80C789A
//Player name printing - character is deleted via backspace
.org 0x80C74CC :: bl c74cc_overworld_naming_top_printing :: b 0x80C755A
//Player name printing - menu is re-entered after the name has been inserted once
.org 0x80C6CC6 :: bl c6cc6_overworld_naming_top_printing :: b 0x80C6D5E
//==============================================================================
// Data files
//==============================================================================
@ -1318,6 +1333,11 @@ nop
.org m2_default_names
.incbin "data/m2-default-names.bin"
.org 0x8B1BBA0
m2_overworld_alphabet_table:
.incbin "data/m2-overworld-alphabet-table.bin"
.org 0x8B2C000
// Box font relocation
@ -1411,6 +1431,7 @@ flyovertextLater:
m2_coord_table_file:
.incbin "data/m2-coord-table-file-select.bin"
//==============================================================================
// Existing subroutines/data
//==============================================================================

View File

@ -2467,3 +2467,45 @@ bl _highlight_file
mov r0,#1 //Clobbered code
mov r1,#0
pop {pc}
//==============================================================================
// A Press
c75b4_overworld_naming_top_printing:
push {lr}
ldr r0,=#m2_player1
mov r1,r2
str r3,[sp,#0x24]
bl player_name_printing_registration
pop {pc}
//==============================================================================
// B Press
c780e_overworld_naming_top_printing:
push {lr}
ldr r1,=#0x3005230
ldr r1,[r1,#0x0C]
ldr r0,=#m2_player1
bl player_name_printing_registration
pop {pc}
//==============================================================================
// Backspace
c74cc_overworld_naming_top_printing:
push {lr}
ldr r1,=#0x3005230
ldr r1,[r1,#0x0C]
ldr r0,=#m2_player1
bl player_name_printing_registration
pop {pc}
//==============================================================================
// Re-enter the menu
c6cc6_overworld_naming_top_printing:
push {lr}
mov r2,r0
mov r0,r1
mov r1,r2
bl player_name_printing_registration
str r0,[sp,#0x24]
mov r9,r0
pop {pc}