diff --git a/src/c/ext.c b/src/c/ext.c index 302e89b..bfc5e83 100644 --- a/src/c/ext.c +++ b/src/c/ext.c @@ -22,4 +22,5 @@ int __attribute__((naked)) customcodes_parse_generic(int code, char* parserAddre void __attribute__((naked)) m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight) {} void __attribute__((naked)) m2_setupbattlename(short value) {} void __attribute__((naked)) store_pixels_overworld() {} -void __attribute__((naked)) m12_dim_palette(short* palette, int total, int dimmingFactor) {} \ No newline at end of file +void __attribute__((naked)) m12_dim_palette(short* palette, int total, int dimmingFactor) {} +int __attribute__((naked)) m2_jump_to_offset(byte* character) {} \ No newline at end of file diff --git a/src/c/vwf.c b/src/c/vwf.c index 6858075..3565d5b 100644 --- a/src/c/vwf.c +++ b/src/c/vwf.c @@ -1276,33 +1276,6 @@ void setStuffWindow_Graphics() (*(address + 2)) = 0; } -int jumpToOffset(byte* character) -{ - int returnOffset = 0; - int baseOffset = 0; - if((*(character + 1)) != 0xFF) - return 0; - int code = 0xFFFF009F + ((*character) | 0xFF00); - - switch(code) - { - case 0x25: - returnOffset += 2; - baseOffset = returnOffset; - for(int i = 0; i < 4; i++) - returnOffset = returnOffset + ((*(character + baseOffset + i)) << (8 * i)); - byte* totalJumps = (byte*)0x3005078; - byte** oldOffsets = (byte**)0x3005080; - oldOffsets[*totalJumps] = character + 6; - (*totalJumps)++; - break; - default: - return 0; - } - - return returnOffset; -} - byte print_character_with_codes(WINDOW* window, byte* dest) { int delay = window->delay--; @@ -1422,7 +1395,7 @@ byte print_character_with_codes(WINDOW* window, byte* dest) break; default: if(code >= 0x60) - window->text_offset += jumpToOffset(character); + window->text_offset += m2_jump_to_offset(character); else { returnedLength = customcodes_parse_generic(code, character, window, dest); diff --git a/src/c/vwf.h b/src/c/vwf.h index b22b26f..56da11f 100644 --- a/src/c/vwf.h +++ b/src/c/vwf.h @@ -102,7 +102,6 @@ void clear_tile_buffer(int x, int y, byte* dest); int buffer_drawwindow(WINDOW* window, byte* dest); void scrolltext_buffer(WINDOW* window, byte* dest); void properScroll(WINDOW* window, byte* dest); -int jumpToOffset(byte* character); void copy_tile_buffer(int xSource, int ySource, int xDest, int yDest, byte *dest); void copy_tile_up_buffer(int x, int y, byte *dest); void setStuffWindow_Graphics(); @@ -166,6 +165,7 @@ extern int m2_remainder(int dividend, int divisor); extern void m2_soundeffect(int index); extern void m2_printstr(WINDOW* window, byte* str, unsigned short x, unsigned short y, bool highlight); extern int customcodes_parse_generic(int code, char* parserAddress, WINDOW* window, byte* dest); +extern int m2_jump_to_offset(byte* character); extern void m2_sub_d3c50(); extern void m2_sub_d6844(); extern int m2_setupwindow(WINDOW* window, short window_x, short window_y, short window_width, short window_height); diff --git a/src/m2-hack.asm b/src/m2-hack.asm index 5e1d7f8..7f50dc1 100644 --- a/src/m2-hack.asm +++ b/src/m2-hack.asm @@ -1844,6 +1844,7 @@ m12_cartridge_palettes_dimmed: .definelabel m2_enable_script ,0x80A1F6C .definelabel m2_sub_a334c ,0x80A334C .definelabel m2_sub_a3384 ,0x80A3384 +.definelabel m2_jump_to_offset ,0x80A6C24 .definelabel m2_get_selected_item ,0x80A469C .definelabel m2_psitargetwindow ,0x80B8AE0 .definelabel m2_isequipped ,0x80BC670