Add highlighting - Fix issue with file arrangement not being properly updated - Move everrything related to the file selection menu to fileselect.c
Also put 4 more pixels between Ness' name in the file select main window and Level.
This commit is contained in:
parent
2ab18de102
commit
743c7396f5
|
@ -14,7 +14,8 @@ $input_c_files =
|
|||
"src/c/ext.c",
|
||||
"src/c/vwf.c",
|
||||
"src/c/locs.c",
|
||||
"src/c/goods.c"
|
||||
"src/c/goods.c",
|
||||
"src/c/fileselect.c"
|
||||
|
||||
$base_c_address = 0x8100000;
|
||||
$scripttool_cmd = "bin/ScriptTool/ScriptTool.dll"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,6 +2,7 @@
|
|||
#define HEADER_FILE_SELECT_INCLUDED
|
||||
|
||||
#include "types.h"
|
||||
#include "vwf.h"
|
||||
|
||||
typedef struct FILE_SELECT {
|
||||
short status; // 0 = used, -1 = empty
|
||||
|
@ -27,4 +28,46 @@ typedef struct FILE_SELECT {
|
|||
byte formatted_str[64];
|
||||
} FILE_SELECT;
|
||||
|
||||
int get_tile_number_file_select(int x, int y);
|
||||
void clear_tile_file(int x, int y, int pixels, int tile_offset_file);
|
||||
void clear_rect_file(int x, int y, int width, int height, int pixels, int tile_offset_file, unsigned short *tilesetDestPtr);
|
||||
unsigned short* getTilesetDest(int window_selector, int *width);
|
||||
unsigned short getPaletteFromFileWindow(int x, int y, int window_selector);
|
||||
void setPaletteToFileWindow(int x, int y, int window_selector, unsigned short palette);
|
||||
void setPaletteToZero(int x, int y, int window_selector);
|
||||
void setPaletteOnAllFile(int x, int y, byte *str, int length, int window_selector);
|
||||
void wrapper_file_string_selection(int x, int y, int length, byte *str, int window_selector);
|
||||
void setPaletteOnFile(int x, int y, int window_selector, FILE_SELECT *file);
|
||||
void print_file_string(int x, int y, int length, byte *str, int window_selector, int windowX, int windowY);
|
||||
void wrapper_first_file_string(int x, int y, int length, byte *str, int window_selector);
|
||||
void wrapper_delete_string(int x, int y, int length, byte *str, int window_selector);
|
||||
void wrapper_name_string(int x, int y, int length, byte *str, int window_selector);
|
||||
void wrapper_name_summary_string(int x, int y, int length, byte *str, int window_selector);
|
||||
void wrapper_copy_string(int x, int y, int length, byte *str, int window_selector);
|
||||
void clearArr(int x, int y, int width, unsigned short *tilesetDestPtr, int windowX);
|
||||
void print_file_string(int x, int y, int length, byte *str, int window_selector, int windowX, int windowY);
|
||||
unsigned short setupCursorAction(int *Pos1, int *Pos2);
|
||||
void setupCursorMovement();
|
||||
void setupCursorPosition(int *x, int *y);
|
||||
void format_options_cc(char String[], int *index, byte cmd);
|
||||
void options_setup(char String[], int selector);
|
||||
void text_speed_setup(char String[], int selector);
|
||||
void delete_setup(char String[], int selector);
|
||||
void text_flavour_setup(char String[], int selector);
|
||||
void description_setup(char String[], int selector);
|
||||
void copy_setup(char String[]);
|
||||
void letterSetup(char String[], int selector, bool capital, int *index);
|
||||
void numbersSetup(char String[], int *index);
|
||||
void alphabet_setup(char String[], int selector, bool capital);
|
||||
void summary_setup(char String[], int selector);
|
||||
void print_windows(int windowX, int windowY, int window_selector);
|
||||
void format_file_cc(FILE_SELECT *file, int *index, byte cmd);
|
||||
void format_file_string(FILE_SELECT *file);
|
||||
|
||||
extern unsigned short m2_coord_table_file[];
|
||||
extern byte m2_cstm_last_printed[];
|
||||
|
||||
extern void cpufastset(void *source, void *dest, int mode);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
986
src/c/vwf.c
986
src/c/vwf.c
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,5 @@
|
|||
#include "types.h"
|
||||
#include "pc.h"
|
||||
#include "fileselect.h"
|
||||
|
||||
#define NULL (0)
|
||||
#define QUESTION_MARK 0x1F
|
||||
|
@ -28,7 +27,9 @@
|
|||
byte decode_character(byte chr);
|
||||
byte encode_ascii(char chr);
|
||||
int get_tile_number(int x, int y);
|
||||
int count_pixels(byte *str, int length);
|
||||
int ascii_strlen(char *str);
|
||||
int wrapper_count_pixels_to_tiles(byte *str, int length);
|
||||
int count_pixels_to_tiles(byte *str, int length, int startingPos);
|
||||
int expand_bit_depth(byte row, int foreground);
|
||||
byte reduce_bit_depth(int row, int foreground);
|
||||
byte print_character(byte chr, int x, int y);
|
||||
|
@ -68,12 +69,8 @@ void print_number_menu_current(byte digit, WINDOW* window);
|
|||
void clear_number_menu(WINDOW* window);
|
||||
void format_cash_window(int value, int padding, byte* str);
|
||||
void handle_first_window(WINDOW* window);
|
||||
void print_file_string(int x, int y, int length, byte *str, int window_selector, int windowX, int windowY);
|
||||
void wrapper_file_string(int x, int y, int length, byte *str, int window_selector);
|
||||
void format_file_string(FILE_SELECT *file);
|
||||
|
||||
extern unsigned short m2_coord_table[];
|
||||
extern unsigned short m2_coord_table_file[];
|
||||
extern int m2_bits_to_nybbles[];
|
||||
extern byte m2_nybbles_to_bits[];
|
||||
extern byte *m2_font_table[];
|
||||
|
|
|
@ -1056,7 +1056,7 @@ nop
|
|||
.org 0x8003998 :: mov r0,1 // new window x
|
||||
.org 0x8003F92 :: mov r0,1
|
||||
.org 0x80053DC :: mov r0,1
|
||||
.org 0x8003A04 :: mov r0,1
|
||||
.org 0x8003A04 :: bl _3a04_highlight_file //Changes window position and makes sure the file is properly highlighted
|
||||
.org 0x8003B40 :: mov r0,0x10 // new cursor x
|
||||
.org 0x86DB070 :: .incbin "data/m2-fileselect-template.bin"
|
||||
|
||||
|
@ -1068,20 +1068,26 @@ nop
|
|||
.org 0x8002284 :: bl format_file_string
|
||||
|
||||
// Printing
|
||||
.org 0x80038CC :: mov r2,0x40 :: bl wrapper_file_string
|
||||
.org 0x80038DE :: mov r2,0x40 :: bl wrapper_file_string
|
||||
.org 0x80038F2 :: mov r2,0x40 :: bl wrapper_file_string
|
||||
.org 0x80038CC :: mov r2,0x40 :: bl wrapper_first_file_string
|
||||
.org 0x80038DE :: mov r2,0x40 :: bl wrapper_first_file_string
|
||||
.org 0x80038F2 :: mov r2,0x40 :: bl wrapper_first_file_string
|
||||
|
||||
// Bump file select cursor up by 3 pixels - Not needed now that the text is 3 pixels lower
|
||||
//.org 0x8003844 :: add r0,r5,1
|
||||
|
||||
// File select options
|
||||
.org 0x8003F78 :: bl _3f78_highlight_file //Keeps highlight consistent when changing palette in the text flavour window
|
||||
.org 0x8004072 :: bl _40e2_cursor_X //Removing highlight position
|
||||
.org 0x8004080 :: mov r3,#4 //Remove highlight of 4 tiles maximum
|
||||
.org 0x8004092 :: bl _4092_print_window //Printing
|
||||
.org 0x80041D4 :: bl _41D4_cursor_X //New cursor's X
|
||||
.org 0x80040E2 :: bl _40e2_cursor_X //Highlight position
|
||||
.org 0x80040F4 :: mov r3,#4 //Print highlight of 4 tiles maximum
|
||||
.org 0x80041D4 :: bl _41d4_cursor_X //New cursor's X
|
||||
|
||||
//Text Speed options
|
||||
.org 0x8003BBC :: bl _4092_print_window //Printing
|
||||
.org 0x8003FA2 :: bl _4092_print_window
|
||||
.org 0x8003F8C :: mov r3,#4 //Print highlight of 4 tiles maximum
|
||||
.org 0x8003E86 :: bl _3e86_special_setup //Avoid printing when not necessary
|
||||
.org 0x8003EF2 :: bl _3e86_special_setup //Avoid printing when not necessary
|
||||
.org 0x82B79D0 :: dw 0x10 //new window width
|
||||
|
@ -1145,9 +1151,9 @@ nop
|
|||
.org 0x800556A :: nop :: nop //Sends to a bunch of 0xFF
|
||||
.org 0x8005530 :: mov r0,#0x11 //New x for King's name
|
||||
.org 0x8005536 :: bl wrapper_name_summary_string //Printing King's name
|
||||
.org 0x8005578 :: bl count_pixels :: mov r2,#6 :: mov r4,#0x17 :: sub r0,r4,r0 //Count length of Food's name in tiles
|
||||
.org 0x8005578 :: bl wrapper_count_pixels_to_tiles :: mov r2,#6 :: mov r4,#0x17 :: sub r0,r4,r0 //Count length of Food's name in tiles
|
||||
.org 0x8005588 :: bl wrapper_name_summary_string //Printing Food's name
|
||||
.org 0x8005596 :: bl count_pixels :: mov r2,#6 :: sub r4,r4,r0 //Count length of Food's name in tiles
|
||||
.org 0x8005596 :: bl wrapper_count_pixels_to_tiles :: mov r2,#6 :: sub r4,r4,r0 //Count length of Thing's name in tiles
|
||||
.org 0x80055A6 :: bl wrapper_name_summary_string //Printing Thing's name
|
||||
.org 0x80056F0 :: add r0,#0x90 //New cursor's X
|
||||
.org 0x86DBC6C :: .incbin "data/m2-summary-template.bin"
|
||||
|
|
|
@ -1602,10 +1602,11 @@ mov r2,#0
|
|||
mov r3,#0
|
||||
pop {pc}
|
||||
|
||||
//==============================================================================
|
||||
//X cursor for the Options submenu in the File Select window
|
||||
_41D4_cursor_X:
|
||||
//
|
||||
//X cursor for the Options submenu position
|
||||
_position_X_Options:
|
||||
push {lr}
|
||||
|
||||
cmp r0,#1
|
||||
bne @@next1
|
||||
mov r0,#5
|
||||
|
@ -1624,6 +1625,23 @@ b @@end
|
|||
mov r0,#20
|
||||
|
||||
@@end:
|
||||
pop {pc}
|
||||
|
||||
//==============================================================================
|
||||
//Sets X for highlighting the Options submenu in the File Select window
|
||||
_40e2_cursor_X:
|
||||
push {lr}
|
||||
mov r0,r1
|
||||
bl _position_X_Options
|
||||
sub r1,r0,#3
|
||||
mov r0,#2
|
||||
pop {pc}
|
||||
|
||||
//==============================================================================
|
||||
//Sets X cursor for the Options submenu in the File Select window
|
||||
_41d4_cursor_X:
|
||||
push {lr}
|
||||
bl _position_X_Options
|
||||
lsl r0,r0,#3
|
||||
pop {pc}
|
||||
|
||||
|
@ -1656,9 +1674,11 @@ pop {pc}
|
|||
//Loads and prints the text lines for the file select main window
|
||||
_setup_file_strings:
|
||||
push {r4-r5,lr}
|
||||
add sp,#-4
|
||||
add sp,#-8
|
||||
ldr r5,=#0x3000024
|
||||
ldr r2,[r5,#0]
|
||||
ldr r4,[r2,#4]
|
||||
str r4,[sp,#4] //Save this here
|
||||
mov r4,#0
|
||||
str r4,[r2,#4]
|
||||
mov r0,#0
|
||||
|
@ -1675,7 +1695,7 @@ str r4,[sp,#0]
|
|||
mov r0,#2
|
||||
mov r1,#1
|
||||
mov r2,#0x40
|
||||
bl wrapper_file_string
|
||||
bl wrapper_file_string_selection
|
||||
ldr r3,[r5,#0]
|
||||
ldr r0,=#0x454
|
||||
add r3,r3,r0
|
||||
|
@ -1683,7 +1703,7 @@ str r4,[sp,#0]
|
|||
mov r0,#2
|
||||
mov r1,#3
|
||||
mov r2,#0x40
|
||||
bl wrapper_file_string
|
||||
bl wrapper_file_string_selection
|
||||
ldr r3,[r5,#0]
|
||||
mov r0,#0xD3
|
||||
lsl r0,r0,#3
|
||||
|
@ -1692,8 +1712,15 @@ str r4,[sp,#0]
|
|||
mov r0,#2
|
||||
mov r1,#5
|
||||
mov r2,#0x40
|
||||
bl wrapper_file_string
|
||||
add sp,#4
|
||||
bl wrapper_file_string_selection
|
||||
mov r0,#1
|
||||
mov r1,#0
|
||||
mov r2,#0
|
||||
bl 0x800341C
|
||||
ldr r2,[r5,#0]
|
||||
ldr r4,[sp,#4]
|
||||
str r4,[r2,#4] //Restore this
|
||||
add sp,#8
|
||||
pop {r4-r5,pc}
|
||||
|
||||
.pool
|
||||
|
@ -1738,3 +1765,38 @@ strb r1,[r0,#0]
|
|||
pop {r0-r2}
|
||||
bl 0x8003F44
|
||||
pop {pc}
|
||||
|
||||
//==============================================================================
|
||||
//Highlights all of the file string with the proper palette
|
||||
_highlight_file:
|
||||
push {lr}
|
||||
mov r0,#2
|
||||
ldr r1,=#0x3000024 //Load in r1 the y co-ordinate
|
||||
ldr r1,[r1,#0]
|
||||
ldr r1,[r1,#8]
|
||||
lsl r1,r1,#1
|
||||
add r1,#1
|
||||
mov r2,#0
|
||||
mov r3,r4
|
||||
bl setPaletteOnFile
|
||||
pop {pc}
|
||||
|
||||
.pool
|
||||
|
||||
//==============================================================================
|
||||
//File highlighting for the up-down arrows in the text flavour window
|
||||
_3f78_highlight_file:
|
||||
push {lr}
|
||||
bl _highlight_file
|
||||
mov r0,#4 //Clobbered code
|
||||
ldsh r2,[r4,r0]
|
||||
pop {pc}
|
||||
|
||||
//==============================================================================
|
||||
//File highlighting for when a file is selected
|
||||
_3a04_highlight_file:
|
||||
push {lr}
|
||||
bl _highlight_file
|
||||
mov r0,#1 //Clobbered code
|
||||
mov r1,#0
|
||||
pop {pc}
|
Loading…
Reference in New Issue