Add auto newline for encounter text
This commit is contained in:
parent
4e23e12b54
commit
bd2acc82ab
|
@ -33,7 +33,8 @@ $input_c_files =
|
|||
"src/c/title.c",
|
||||
"src/c/luminehall.c",
|
||||
"src/c/custom_codes.c",
|
||||
"src/c/first_func.c"
|
||||
"src/c/first_func.c",
|
||||
"src/c/window.c"
|
||||
|
||||
$input_c_test_files =
|
||||
"src/c/tests/main_test.c",
|
||||
|
|
|
@ -131,6 +131,12 @@ int custom_codes_parse_generic(int code, char* parserAddress, WINDOW* window, by
|
|||
store = true;
|
||||
break;
|
||||
|
||||
case IS_NEWLINE:
|
||||
// 5E FF 06 : Load whether it's a newline or not
|
||||
val_to_store = (window->text_y != 0) && (window->pixel_x == 0) ? 1 : 2;
|
||||
store = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -191,6 +197,35 @@ int custom_codes_parse_generic(int code, char* parserAddress, WINDOW* window, by
|
|||
free_overworld_buffer();
|
||||
break;
|
||||
|
||||
case CHECK_WIDTH_OVERFLOW:
|
||||
// 57 FF: Start/End width calculation.
|
||||
// Jump to newline if it would go over the window's boundaries
|
||||
if((byte)parserAddress[2] == CALC_WIDTH_END)
|
||||
window->inside_width_calc = false;
|
||||
else
|
||||
if(!window->inside_width_calc) {
|
||||
WINDOW w;
|
||||
int possible_return_addresses = 4;
|
||||
int return_addresses[possible_return_addresses];
|
||||
int nreturns = *((int*)(0x3005078));
|
||||
cpuset((int*)(0x3005080), return_addresses, possible_return_addresses * 2);
|
||||
copy_window(window, &w);
|
||||
window->text_offset += 3;
|
||||
window->inside_width_calc = true;
|
||||
while(window->inside_width_calc)
|
||||
m2_printnextch(window);
|
||||
if(window->text_x >= window->window_width) {
|
||||
w.text_x = 0;
|
||||
w.pixel_x = 0;
|
||||
w.text_y += 2;
|
||||
}
|
||||
copy_window(&w, window);
|
||||
(*((int*)(0x3005078))) = nreturns;
|
||||
cpuset(return_addresses, (int*)(0x3005080), possible_return_addresses * 2);
|
||||
}
|
||||
addedSize = 3;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,12 @@
|
|||
#define BATTLE_TARGET_THE 3
|
||||
#define BATTLE_USER_GENDER 4
|
||||
#define BATTLE_TARGET_GENDER 5
|
||||
#define IS_NEWLINE 6
|
||||
|
||||
#define CALC_WIDTH_START 0
|
||||
#define CALC_WIDTH_END 1
|
||||
|
||||
#define CHECK_WIDTH_OVERFLOW 0x57
|
||||
#define RESET_WRITE_BUFFER 0x58
|
||||
#define RESET_STORED_GOODS 0x59
|
||||
#define RESTORE_DIALOGUE 0x5A
|
||||
|
@ -43,6 +48,7 @@ int custom_codes_parse_generic(int code, char* parserAddress, WINDOW* window, by
|
|||
extern void load_pixels_overworld();
|
||||
extern void generic_reprinting_first_menu_talk_to_highlight();
|
||||
extern byte m2_sub_daf84(short value);
|
||||
extern void m2_printnextch(WINDOW* window);
|
||||
|
||||
extern unsigned short m2_enemy_attributes[];
|
||||
extern short m2_is_battle;
|
||||
|
|
|
@ -39,3 +39,4 @@ void __attribute__((naked)) m2_title_teardown() {}
|
|||
void __attribute__((naked)) vblank() {}
|
||||
int __attribute__((naked)) m2_set_equippables(WINDOW* window, unsigned short choice, byte* index_list) {}
|
||||
void __attribute__((naked)) reg_ram_reset(int flag) {}
|
||||
void __attribute__((naked)) m2_printnextch(WINDOW* window) {}
|
15
src/c/vwf.c
15
src/c/vwf.c
|
@ -825,10 +825,15 @@ void weld_entry_custom(WINDOW *window, byte *str, int font, int foreground)
|
|||
int x = window->pixel_x + (window->window_x + window->text_x) * 8;
|
||||
int y = (window->window_y + window->text_y) * 8;
|
||||
|
||||
x += print_character_formatted(chr, x, y, font, foreground);
|
||||
if(!window->inside_width_calc)
|
||||
x += print_character_formatted(chr, x, y, font, foreground);
|
||||
else
|
||||
x += (m2_widths_table[font][chr] & 0xFF);
|
||||
|
||||
window->pixel_x = x & 7;
|
||||
window->text_x = (x >> 3) - window->window_x;
|
||||
if(window->inside_width_calc && window->text_x >= window->window_width)
|
||||
window->text_x = window->window_width;
|
||||
}
|
||||
|
||||
// Returns: ____XXXX = number of characters printed
|
||||
|
@ -1520,10 +1525,16 @@ void weld_entry_custom_buffer(WINDOW *window, byte *str, int font, int foregroun
|
|||
int x = window->pixel_x + (window->window_x + window->text_x) * 8;
|
||||
int y = (window->window_y + window->text_y) * 8;
|
||||
|
||||
x += print_character_formatted_buffer(chr, x, y, font, foreground, dest);
|
||||
if(!window->inside_width_calc)
|
||||
x += print_character_formatted_buffer(chr, x, y, font, foreground, dest);
|
||||
else
|
||||
x += (m2_widths_table[font][chr] & 0xFF);
|
||||
|
||||
window->pixel_x = x & 7;
|
||||
window->text_x = (x >> 3) - window->window_x;
|
||||
if(window->inside_width_calc && window->text_x >= window->window_width)
|
||||
window->text_x = window->window_width;
|
||||
|
||||
}
|
||||
|
||||
void handle_first_window_buffer(WINDOW* window, byte* dest)
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#include "window.h"
|
||||
|
||||
extern void cpuset(void *source, void *dest, int mode);
|
||||
|
||||
void copy_window(WINDOW* source, WINDOW* destination) {
|
||||
cpuset(source, destination, sizeof(WINDOW) >> 1);
|
||||
}
|
|
@ -25,7 +25,8 @@ typedef struct WINDOW {
|
|||
unsigned int flags_unknown3b : 4; // 0xF000
|
||||
byte pixel_x;
|
||||
bool vwf_skip : 1;
|
||||
unsigned int vwf_unused : 7;
|
||||
bool inside_width_calc : 1;
|
||||
unsigned int vwf_unused : 6;
|
||||
byte* text_start;
|
||||
byte* text_start2;
|
||||
byte* menu_text;
|
||||
|
@ -66,4 +67,6 @@ typedef struct WINDOW {
|
|||
int unknown11;
|
||||
} WINDOW;
|
||||
|
||||
void copy_window(WINDOW* source, WINDOW* destination);
|
||||
|
||||
#endif
|
|
@ -1946,28 +1946,29 @@
|
|||
^L1951^[83 FF C5 00][82 FF _L2197_][08 FF 0C 02][A2 FF _L5617_][FC FF 05 00][1C FF 80 01 _L2197_][9D FF 01 1F _L5625_][00 FF]
|
||||
^L1952^[1C FF 49 00 _L2197_][9D FF 01 0E _L5614_][00 FF]
|
||||
^L10000^[5E FF 01][95 FF 03 _L10001_ _L10002_ _L10003_][00 FF]
|
||||
^L10001^[86 FF _useruppertheignore_][9F FF][00 FF]
|
||||
^L10002^[86 FF _useruppertheignore_][9F FF] and its cohort[00 FF]
|
||||
^L10003^[86 FF _useruppertheignore_][9F FF] and its cohorts[00 FF]
|
||||
^L10001^[86 FF _useruppertheignore_][57 FF 00][86 FF _twospacesifnewline_][9F FF][00 FF]
|
||||
^L10002^[86 FF _useruppertheignore_][57 FF 00][86 FF _twospacesifnewline_][9F FF][57 FF 01][57 FF 00][86 FF _onespaceifnewline_] and its cohort[00 FF]
|
||||
^L10003^[86 FF _useruppertheignore_][57 FF 00][86 FF _twospacesifnewline_][9F FF][57 FF 01][57 FF 00][86 FF _onespaceifnewline_] and its cohorts[00 FF]
|
||||
^L10004^[5E FF 01][95 FF 03 _L10005_ _L10006_ _L10007_][00 FF]
|
||||
^L10005^[86 FF _userlowertheignore_][9F FF][00 FF]
|
||||
^L10006^[86 FF _userlowertheignore_][9F FF][01 FF] and its cohort[00 FF]
|
||||
^L10007^[86 FF _userlowertheignore_][9F FF][01 FF] and its cohorts[00 FF]
|
||||
^L10008^[5E FF 01][95 FF 03 _L10009_ _L10010_ _L10011_]^L10011^[86 FF _userlowertheignore_][9F FF][01 FF] and its cohorts's[00 FF]
|
||||
^L10009^[86 FF _userlowertheignore_][9F FF]'s[01 FF] [00 FF]
|
||||
^L10010^[86 FF _userlowertheignore_][9F FF][01 FF] and its cohort's[00 FF]
|
||||
^L1953^@[86 FF _L10000_][01 FF] attacked![02 FF][00 FF]
|
||||
^L1954^@[86 FF _L10000_] trapped you![02 FF][00 FF]
|
||||
^L1954-1^@[86 FF _L10000_] came after you![02 FF][00 FF]
|
||||
^L1954-2^@[86 FF _L10000_] blocked the way![02 FF][00 FF]
|
||||
^L10005^[86 FF _userlowertheignore_][57 FF 00][86 FF _twospacesifnewline_][9F FF][00 FF]
|
||||
^L10006^[86 FF _userlowertheignore_][57 FF 00][86 FF _twospacesifnewline_][9F FF][57 FF 01][57 FF 00][86 FF _onespaceifnewline_] and its cohort[00 FF]
|
||||
^L10007^[86 FF _userlowertheignore_][57 FF 00][86 FF _twospacesifnewline_][9F FF][57 FF 01][57 FF 00][86 FF _onespaceifnewline_] and its cohorts[00 FF]
|
||||
^L10008^[5E FF 01][95 FF 03 _L10009_ _L10010_ _L10011_][00 FF]
|
||||
^L10009^[86 FF _userlowertheignore_][57 FF 00][86 FF _twospacesifnewline_][9F FF]'s[00 FF]
|
||||
^L10010^[86 FF _userlowertheignore_][57 FF 00][86 FF _twospacesifnewline_][9F FF][57 FF 01][57 FF 00][86 FF _onespaceifnewline_] and its cohort's[00 FF]
|
||||
^L10011^[86 FF _userlowertheignore_][57 FF 00][86 FF _twospacesifnewline_][9F FF][57 FF 01][57 FF 00][86 FF _onespaceifnewline_] and its cohorts's[00 FF]
|
||||
^L1953^@[86 FF _L10000_] attacked![57 FF 01][02 FF][00 FF]
|
||||
^L1954^@[86 FF _L10000_][57 FF 01][57 FF 00][86 FF _onespaceifnewline_] trapped you![57 FF 01][02 FF][00 FF]
|
||||
^L1954-1^@[86 FF _L10000_][57 FF 01][57 FF 00][86 FF _onespaceifnewline_] came after you![57 FF 01][02 FF][00 FF]
|
||||
^L1954-2^@[86 FF _L10000_][57 FF 01][57 FF 00][86 FF _onespaceifnewline_] blocked the way![57 FF 01][02 FF][00 FF]
|
||||
^L1955^@[86 FF _targetupperthe_][AD FF] turned[01 FF] back to normal![D4 FF 21 00][00 FF]
|
||||
^L1956^@[86 FF _targetupperthe_][AD FF] was[01 FF] defeated![D4 FF 21 00][00 FF]
|
||||
^L1957^@[86 FF _targetupperthe_][AD FF] became[01 FF] tame![D4 FF 21 00][00 FF]
|
||||
^L1958^@You encounter [86 FF _L10004_].[02 FF][00 FF]
|
||||
^L1958-1^@You meet [86 FF _L10004_].[02 FF][00 FF]
|
||||
^L1958^@You encounter [86 FF _L10004_].[57 FF 01][02 FF][00 FF]
|
||||
^L1958-1^@You meet [86 FF _L10004_].[57 FF 01][02 FF][00 FF]
|
||||
^L1959^@[86 FF _targetupperthe_][AD FF] stopped[01 FF] moving![D4 FF 21 00][00 FF]
|
||||
^L1960^@You confront [86 FF _L10004_].[02 FF][00 FF]
|
||||
^L1960-1^@You engage [86 FF _L10004_].[02 FF][00 FF]
|
||||
^L1960^@You confront [86 FF _L10004_].[57 FF 01][02 FF][00 FF]
|
||||
^L1960-1^@You engage [86 FF _L10004_].[57 FF 01][02 FF][00 FF]
|
||||
^L1961^@[86 FF _targetupperthe_][AD FF] was broken[01 FF] into pieces![D4 FF 21 00][00 FF]
|
||||
^L1962^@The figure of [86 FF _targetlowerthe_][AD FF][01 FF] melted into thin air![D4 FF 21 00][00 FF]
|
||||
^L1963^@[86 FF _targetupperthe_][AD FF][01 FF] disappeared![D4 FF 21 00][00 FF]
|
||||
|
@ -2116,7 +2117,7 @@
|
|||
^L2105^@But, the seed didn't sprout.[02 FF][00 FF]
|
||||
^L2106^[C4 FF 00 62]@Time started again.[02 FF][00 FF]
|
||||
^L2107^@Here is a chance[01 FF] for a surprise opening attack![02 FF][00 FF]
|
||||
^L2108^@Here is [86 FF _L10008_] opening attack![02 FF][00 FF]
|
||||
^L2108^@Here is [86 FF _L10008_][57 FF 01][57 FF 00][86 FF _onespaceifnewline_] opening attack![57 FF 01][02 FF][00 FF]
|
||||
^L11000^[C2 FF][1A FF 05 00][8D FF 01 00][87 FF][BC FF 01 00]^L11001^[C0 FF][A8 FF 01][96 FF 00][81 FF _L11002_][8D FF 00 00][92 FF 00 01 02][81 FF _L11002_][8D FF 00 00][92 FF 00 01 03][81 FF _L11002_][80 FF _L11001_]
|
||||
^L11002^[A8 FF 01][87 FF][95 FF 05 _L11003_ _L11003_ _L11004_ _L11005_ _L11005_][00 FF]
|
||||
^L11003^[00 FF]
|
||||
|
@ -5215,6 +5216,10 @@
|
|||
^userlowerthe^[5E FF 02][00][95 FF 02 _none_ _lowerthe_]^none^[00 FF]
|
||||
^userlowertheignore^[5E FF 02][01][95 FF 02 _none_ _lowerthe_][00 FF]
|
||||
^lowerthe^the [00 FF]
|
||||
^twospacesifnewline^[5E FF 06][95 FF 02 _twospaces_ _none_][00 FF]
|
||||
^twospaces^ [00 FF]
|
||||
^onespaceifnewline^[5E FF 06][95 FF 02 _onespace_ _none_][00 FF]
|
||||
^onespace^ [00 FF]
|
||||
^userupperthe^[5E FF 02][00][95 FF 02 _none_ _upperthe_][00 FF]
|
||||
^useruppertheignore^[5E FF 02][01][95 FF 02 _none_ _upperthe_][00 FF]
|
||||
^upperthe^The [00 FF]
|
||||
|
|
Loading…
Reference in New Issue