Improve compiling ease

This commit is contained in:
Lorenzooone 2019-09-17 23:10:28 +02:00
parent f10f326db2
commit c509b00432
8 changed files with 47 additions and 45 deletions

View File

@ -55,10 +55,10 @@ void printBattleMenu(byte validXs, byte validYs, byte highlighted)
{
if(validYs & 1)
{
print_blankstr_buffer(2,1,5,(byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(2,1,5,(byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
if((*drawValue) == 2)
{
print_blankstr_buffer(7,1,5,(byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(7,1,5,(byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
str = m12_battle_commands_str10; //Do Nothing
}
else if((*drawValue) == 1)
@ -70,7 +70,7 @@ void printBattleMenu(byte validXs, byte validYs, byte highlighted)
if(validYs & 2)
{
print_blankstr_buffer(2,3,5,(byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(2,3,5,(byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
if((*active_window_party_member) != 2)
printstr_hlight_buffer(window, m12_battle_commands_str3, 1, 1, highlighted & 2); //PSI
else
@ -84,14 +84,14 @@ void printBattleMenu(byte validXs, byte validYs, byte highlighted)
{
if((*drawValue) != 2)
{
print_blankstr_buffer(7,1,5,(byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(7,1,5,(byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
printstr_hlight_buffer(window, m12_battle_commands_str1, 6, 0, highlighted & 4); //Goods
}
}
if(validYs & 2)
{
print_blankstr_buffer(7,3,5,(byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(7,3,5,(byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
if((*drawValue) != 2)
{
printstr_hlight_buffer(window, m12_battle_commands_str4, 6, 1, highlighted & 8); //Defend

View File

@ -467,25 +467,25 @@ void equipPrint(WINDOW* window) //Prints equipment
byte *item;
//Clear the previous equipment
print_blankstr_buffer(window->window_x + 6, 1, 0xC, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(window->window_x + 6, 3, 0xC, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(window->window_x + 6, 5, 0xC, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(window->window_x + 6, 7, 0xC, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(window->window_x + 6, 1, 0xC, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
print_blankstr_buffer(window->window_x + 6, 3, 0xC, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
print_blankstr_buffer(window->window_x + 6, 5, 0xC, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
print_blankstr_buffer(window->window_x + 6, 7, 0xC, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
//Clear the previous numbers
print_blankstr_buffer(8, 0xB, 0x8, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(8, 0xD, 0x8, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(8, 0xB, 0x8, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
print_blankstr_buffer(8, 0xD, 0x8, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
//Reprint the ":"s
print_character_with_callback_1bpp_buffer(decode_character(0x6A), ((window->window_x + 6) << 3), (0x1 << 3), (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)), &get_tile_number_with_offset, 0, *tilemap_pointer, 32, 0xC);
print_character_with_callback_1bpp_buffer(decode_character(0x6A), ((window->window_x + 6) << 3), (0x3 << 3), (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)), &get_tile_number_with_offset, 0, *tilemap_pointer, 32, 0xC);
print_character_with_callback_1bpp_buffer(decode_character(0x6A), ((window->window_x + 6) << 3), (0x5 << 3), (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)), &get_tile_number_with_offset, 0, *tilemap_pointer, 32, 0xC);
print_character_with_callback_1bpp_buffer(decode_character(0x6A), ((window->window_x + 6) << 3), (0x7 << 3), (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)), &get_tile_number_with_offset, 0, *tilemap_pointer, 32, 0xC);
print_character_with_callback_1bpp_buffer(decode_character(0x6A), ((window->window_x + 6) << 3), (0x1 << 3), (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)), &get_tile_number_with_offset, 0, *tilemap_pointer, 32, 0xC);
print_character_with_callback_1bpp_buffer(decode_character(0x6A), ((window->window_x + 6) << 3), (0x3 << 3), (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)), &get_tile_number_with_offset, 0, *tilemap_pointer, 32, 0xC);
print_character_with_callback_1bpp_buffer(decode_character(0x6A), ((window->window_x + 6) << 3), (0x5 << 3), (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)), &get_tile_number_with_offset, 0, *tilemap_pointer, 32, 0xC);
print_character_with_callback_1bpp_buffer(decode_character(0x6A), ((window->window_x + 6) << 3), (0x7 << 3), (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)), &get_tile_number_with_offset, 0, *tilemap_pointer, 32, 0xC);
//Print the equipment
if(character_data->equipment[0] == 0) //Weapon
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x1) << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x1) << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
else
{
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->goods[character_data->equipment[0] - 1]);
@ -494,7 +494,7 @@ void equipPrint(WINDOW* window) //Prints equipment
}
if(character_data->equipment[1] == 0) //Body
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x3) << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x3) << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
else
{
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->goods[character_data->equipment[1] - 1]);
@ -503,7 +503,7 @@ void equipPrint(WINDOW* window) //Prints equipment
}
if(character_data->equipment[2] == 0) //Arms
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x5) << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x5) << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
else
{
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->goods[character_data->equipment[2] - 1]);
@ -512,7 +512,7 @@ void equipPrint(WINDOW* window) //Prints equipment
}
if(character_data->equipment[3] == 0) //Other
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x7) << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_string_in_buffer(nothing, (((window->window_x + 7)) << 3) - 2, (0x7) << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
else
{
item = m2_strlookup((int*)0x8B1AF94, (byte*)0x8B1A694, character_data->goods[character_data->equipment[3] - 1]);
@ -535,7 +535,7 @@ void printNumberEquip(WINDOW* window, byte* str, unsigned short x, unsigned shor
//Prints Offense: and Defense:
void printEquipWindowNumberText(WINDOW* window)
{
handle_first_window_buffer(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
handle_first_window_buffer(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
printstr_hlight_pixels_buffer(window, window->text_start, 0, 3, false);
}

View File

@ -135,7 +135,7 @@ void psiPrint_buffer(byte value, WINDOW* window, bool printPSILine, PSIPrintInfo
if(PSIID == 1)
{
str = (byte*)(m2_ness_name + (7 * 4) + (8 * 2)); //Go to Rockin's name
print_string_in_buffer(str, 0x71, ((printInfo->YPrinting) + window->window_y) << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_string_in_buffer(str, 0x71, ((printInfo->YPrinting) + window->window_y) << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
}
}
@ -455,7 +455,7 @@ int PSITargetInput(WINDOW* window)
if(!window->vwf_skip)
{
clear_window_buffer(getWindow(9), (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
clear_window_buffer(getWindow(9), (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
psiTargetWindow_buffer(target);
window->vwf_skip = true;
}

View File

@ -9,9 +9,9 @@ void printNumberOfStatus(int maxLength, int value, int blankX, int y, int strX,
int end = setNumber_getLength(value, str, maxLength);
str[end] = 0;
str[end + 1] = 0xFF;
print_blankstr_buffer(blankX, y, width, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(blankX, y, width, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
int x = (strX - (end * 6));
print_string_in_buffer(str, x, y << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_string_in_buffer(str, x, y << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
}
void printStatusSymbolArrangement(unsigned short symbolTile, WINDOW* window)
@ -57,7 +57,7 @@ int statusNumbersPrint(WINDOW* window, bool doNotPrint)
printNumberOfStatus(7, experienceLevelUp - character_data->experience, 2, 0xD, 0x3D, 6);
}
else
print_blankstr_buffer(2, 0xD, 6, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(2, 0xD, 6, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
printNumberOfStatus(3, character_data->offense_effective, 0x19, 0x1, 0xE1, 4);
printNumberOfStatus(3, character_data->defense_effective, 0x19, 0x3, 0xE1, 4);
printNumberOfStatus(3, character_data->speed_effective, 0x19, 0x5, 0xE1, 4);
@ -65,13 +65,13 @@ int statusNumbersPrint(WINDOW* window, bool doNotPrint)
printNumberOfStatus(3, character_data->vitality_effective, 0x19, 0x9, 0xE1, 4);
printNumberOfStatus(3, character_data->iq_effective, 0x19, 0xB, 0xE1, 4);
printNumberOfStatus(3, character_data->luck_effective, 0x19, 0xD, 0xE1, 4);
print_blankstr_buffer(5, 0xF, 0x14, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(5, 0xF, 0x14, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
if((*active_window_party_member) != JEFF)
{
byte *str = m2_strlookup((int*)0x8B17EE4, (byte*)0x8B17424, 0x13);
print_string_in_buffer(str, 0x2C, (0xF) << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_string_in_buffer(str, 0x2C, (0xF) << 3, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
}
print_blankstr_buffer(1, 0x3, 0xA, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_blankstr_buffer(1, 0x3, 0xA, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
unsigned short symbolTile = ailmentTileSetup(&(character_data->ailment), 0);
if(symbolTile == 0)
{
@ -223,18 +223,18 @@ int statusWindowNumbers(WINDOW* window, bool doNotPrint)
int statusWindowText(WINDOW* window)
{
if(window->redraw)
buffer_drawwindow(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
buffer_drawwindow(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
if(window->loaded_code != 0 && ((*script_readability) == 0))
{
window->delay = 0;
while(true)
{
while(window->text_y >= window->window_height || window->window_y + window->text_y > 0x1F)
properScroll(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
properScroll(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
byte *str = window->text_start + window->text_offset;
if((*(str + 1)) == 0xFF)
{
int returnedLength = customcodes_parse_generic(*str, str, window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
int returnedLength = customcodes_parse_generic(*str, str, window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
if(returnedLength != 0)
{
if(returnedLength < 0)
@ -265,7 +265,7 @@ int statusWindowText(WINDOW* window)
window->text_y += 2;
window->text_x = 0;
}
weld_entry_custom_buffer(window, str, 0, 0xF, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
weld_entry_custom_buffer(window, str, 0, 0xF, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
window->text_offset++;
}
}

View File

@ -1040,7 +1040,7 @@ int print_window_with_buffer(WINDOW* window)
while(window->loaded_code !=0)
{
window->delay = delay;
print_character_with_codes(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
print_character_with_codes(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
}
}
return 0;
@ -1277,7 +1277,7 @@ byte print_character_with_codes(WINDOW* window, byte* dest)
}
else
{
handle_first_window_buffer(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
handle_first_window_buffer(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
window->delay = window->delay_between_prints;
if(x > 0x1F)
{
@ -1414,7 +1414,7 @@ int printstr_buffer(WINDOW* window, byte* str, unsigned short x, unsigned short
while(output != 1)
{
window->delay = 0;
output = print_character_with_codes(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
output = print_character_with_codes(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
}
int retValue = (window->text_x << 3) + window->pixel_x;
window->text_start = tmpTextStart;
@ -1442,7 +1442,7 @@ unsigned short printstr_hlight_pixels_buffer(WINDOW* window, byte* str, unsigned
palette_mask_highlight += 0x1000;
(*palette_mask) = palette_mask_highlight;
unsigned short printed_Characters = print_string_in_buffer(str, printX, printY, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
unsigned short printed_Characters = print_string_in_buffer(str, printX, printY, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
(*palette_mask) = tmpPaletteMsk;
@ -1470,13 +1470,13 @@ int initWindow_buffer(WINDOW* window, byte* text_start, unsigned short delay_bet
window->flags_unknown1 |= 1;
window->redraw = true;
if(text_start == NULL)
buffer_drawwindow(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
buffer_drawwindow(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
return 0;
}
void clearWindowTiles_buffer(WINDOW* window)
{
clear_window_buffer(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8)));
clear_window_buffer(window, (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER)));
window->text_x = 0;
window->text_y = 0;
}
@ -1695,7 +1695,7 @@ void print_blankstr_buffer(int x, int y, int width, byte *dest)
void load_pixels_overworld_buffer()
{
byte* buffer = (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8));
byte* buffer = (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER));
for(int y = 0; y < 0x10; y++)
for(int x = 0; x < 0x1C; x++)
{
@ -1715,7 +1715,7 @@ void load_pixels_overworld_buffer()
void store_pixels_overworld_buffer(int totalYs)
{
byte* buffer = (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * 8));
byte* buffer = (byte*)(OVERWORLD_BUFFER - ((*tile_offset) * TILESET_OFFSET_BUFFER_MULTIPLIER));
for(int y = 0; y < totalYs; y++)
for(int x = 0; x < 0x1C; x++)
{

View File

@ -7,6 +7,7 @@
#define TRUE 1
#define FALSE 0
#define TILESET_OFFSET_BUFFER_MULTIPLIER 0x8
#define CHAR_OFFSET 0x50
#define CHAR_END 0x60
#define YOUWON_START 0x64

View File

@ -1701,6 +1701,7 @@ m2_coord_table_file:
// Existing subroutines/data
//==============================================================================
.definelabel buffer_subtractor ,0x0000800
.definelabel overworld_buffer ,0x200F200
.definelabel m2_ness_data ,0x3001D54
.definelabel m2_ness_name ,0x3001F10

View File

@ -491,7 +491,7 @@ beq @@next
// If flag 0x10 is set, clear the PSI window
ldr r0,[r5,0x1C] // PSI window
ldr r1,=#overworld_buffer - 0x800
ldr r1,=#overworld_buffer - buffer_subtractor
bl clear_window_buffer
@@next:
@ -749,7 +749,7 @@ ldrh r0,[r0]
cmp r0,0
beq @@next
ldr r0,=#0x3005230
ldr r1,=#overworld_buffer - 0x800
ldr r1,=#overworld_buffer - buffer_subtractor
ldr r0,[r0,0x1C]
bl clear_window_buffer
@ -2304,7 +2304,7 @@ orr r2,r1
strb r2,[r4,#0x3]
mov r3,r0
mov r0,r4
ldr r1,=#overworld_buffer - 0x800
ldr r1,=#overworld_buffer - buffer_subtractor
mov r4,r3
bl clear_window_buffer
mov r0,r4
@ -2594,7 +2594,7 @@ pop {r4,pc}
//Prints blankstr in the buffer
bb21c_print_blankstr_buffer:
push {lr}
ldr r3,=#overworld_buffer - 0x800
ldr r3,=#overworld_buffer - buffer_subtractor
bl print_blankstr_buffer
pop {pc}
@ -2602,7 +2602,7 @@ pop {pc}
//Prints blankstr in the buffer and stores it
bb21c_print_blankstr_buffer_store:
push {lr}
ldr r3,=#overworld_buffer - 0x800
ldr r3,=#overworld_buffer - buffer_subtractor
bl print_blankstr_buffer
bl store_pixels_overworld
pop {pc}