Resolving build warnings

This commit is contained in:
The Gears of Progress 2025-03-30 11:56:32 -04:00
parent b267912687
commit 1ee46e1719
13 changed files with 775 additions and 252 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 191 B

View File

@ -17,7 +17,7 @@
#define BOXMENU_TOP 32
#define BOXMENU_LEFT 88
#define BOXMENU_VSPACE -4
#define BOXMENU_HSPACE -8
#define BOXMENU_HSPACE -10
#define BOXMENU_HNUM 6
#define BOXMENU_SPRITE_WIDTH 32
#define BOXMENU_SPRITE_HEIGHT 24

View File

@ -27,7 +27,8 @@ void create_textbox(int startTileX, int startTileY, int width, int height, bool
}
add_menu_box(startTileX, startTileY, width, height);
tte_set_pos((startTileX + 1) * 8, (startTileY + 1) * 8);
tte_set_margins(startTileX + 1, startTileY + 1, startTileX + 1 + width, startTileY + 1 + height);
tte_set_margins((startTileX + 1) * 8, (startTileY + 1) * 8,
(startTileX + 1 + width) * 8, (startTileY + 1 + height) * 8);
tte_erase_rect(0, 0, H_MAX, V_MAX);
}

View File

@ -7,7 +7,7 @@
latin_shortFont:
.word latin_shortGlyphs, 0, 0
.hword 0, 256
.byte 8, 10
.byte 6, 10
.byte 8, 16
.hword 16
.byte 1, 0
@ -112,7 +112,7 @@ latin_shortGlyphs:
.word 0x0101011F,0x1110100F,0x0000000E,0x00000000,0x0101110E,0x1111110F,0x0000000E,0x00000000
.word 0x1010101F,0x04040808,0x00000004,0x00000000,0x1111110E,0x1111110E,0x0000000E,0x00000000
.word 0x1111110E,0x1110101E,0x0000000E,0x00000000,0x04040404,0x04000404,0x00000004,0x00000000
.word 0x1111110E,0x0400040C,0x00000004,0x00000000,0x00000000,0x86000000,0x00000006,0x00000000
.word 0x1111110E,0x0400040C,0x00000004,0x00000000,0x00000000,0x06000000,0x00000006,0x00000000
.word 0x00000000,0x0000001F,0x00000000,0x00000000,0x00000000,0x00000606,0x00000000,0x00000000
.word 0x00000000,0x00000000,0x00150000,0x00000000,0x1B1B0912,0x00000000,0x00000000,0x00000000

View File

@ -148,19 +148,16 @@ void initalization_script(void)
void game_load_error(void)
{
// EG_BG0CNT = (REG_BG0CNT & ~BG_PRIO_MASK) | BG_PRIO(3);
// REG_BG1CNT = (REG_BG1CNT & ~BG_PRIO_MASK) | BG_PRIO(2);
REG_BG2CNT = (REG_BG2CNT & ~BG_PRIO_MASK) | BG_PRIO(1);
REG_BG2VOFS = 0;
tte_set_pos(40, 24);
create_textbox(5, 3, 80, 80, true);
create_textbox(4, 1, 160, 80, true);
ptgb_write("#{cx:0xF000}The Pok@mon save\nfile was not loaded successfully.\n\nPlease remove and\nreinsert the Game\nPak, and then press the A button.");
key_poll();
while (!key_hit(KEY_A))
{
global_next_frame();
}
tte_erase_screen();
// This was causing a green screen (lol), so we might need to mess with it once the text is added back in
//tte_erase_screen();
delay_counter = 0;
while (delay_counter < 60)
@ -215,7 +212,8 @@ int credits()
{
if (update)
{
create_textbox(5, 3, 160, 80, true);
create_textbox(4, 1, 160, 80, true);
show_text_box();
ptgb_write(credits_array[curr_credits_num], true);
update = false;
}
@ -254,7 +252,7 @@ int credits()
bool tutorial = get_tutorial_flag();
int def_lang = get_def_lang_num();
create_textbox(5, 3, 80, 80, true);
create_textbox(4, 1, 160, 80, true);
ptgb_write_debug("Debug info:\n\nG: ", true);
std::string lang;
lang += curr_rom.language;
@ -327,7 +325,8 @@ int main_menu_loop()
for (int i = 0; i < NUM_MENU_OPTIONS; i++)
{
int size = get_string_length(menu_options[i]);
int x = (6 + ((18 - size) / 2)) * 8;
int char_width = (curr_rom.language == JPN_ID ? 8 : 6);
int x = ((240 - (size * char_width)) / 2);
tte_set_pos(x, ((i * 17) + 80));
if (i == curr_selection)
{
@ -411,7 +410,12 @@ int main(void)
obj_unhide_multi(ptgb_logo_l, 1, 2);
bool start_pressed = false;
REG_BLDCNT = BLD_BUILD(BLD_BG3, BLD_BG0, 1);
tte_set_pos(((30 - get_string_length(press_start)) / 2) * 8, 12 * 8);
int char_width = (curr_rom.language == JPN_ID ? 8 : 6);
int size = get_string_length(press_start);
int x = ((240 - (size * char_width)) / 2);
tte_set_pos(x, 12 * 8);
tte_set_ink(INK_DARK_GREY);
ptgb_write(press_start, true);
int fade = 0;
@ -484,8 +488,8 @@ int main(void)
break;
case (BTN_CREDITS):
tte_set_ink(INK_DARK_GREY);
create_textbox(0, 0, 160, 80, true);
show_text_box();
//create_textbox(0, 0, 160, 80, true);
//show_text_box();
REG_BG1CNT = (REG_BG1CNT & ~BG_PRIO_MASK) | BG_PRIO(3);
obj_set_pos(ptgb_logo_l, 56, 108);
obj_set_pos(ptgb_logo_r, 56 + 64, 108);

View File

@ -129,6 +129,7 @@ void mystery_gift_script::build_script(Pokemon_Party &incoming_box_data)
music_var songLooker(sec30_variable_list, &curr_section30_index);
// This determines if the event has been done before
bool first_time = true;
for (int i = 1; i <= 251; i++)
{

View File

@ -156,7 +156,7 @@ void textbox_var::set_virtual_start()
void textbox_var::insert_text(u8 mg_array[])
{
set_start();
for (unsigned int parser = 0; parser < text_length; parser++)
for (int parser = 0; parser < text_length; parser++)
{
if (curr_rom.is_hoenn() && (text[parser] == 0xFC) && (get_gen_3_char((char16_t)(text[parser + 1]), false) == 0x01)) // Removes colored text
{
@ -175,9 +175,8 @@ void textbox_var::insert_text(u8 mg_array[])
void textbox_var::insert_virtual_text(u8 mg_array[])
{
set_virtual_start();
for (unsigned int parser = 0; parser < text_length; parser++)
for (int parser = 0; parser < text_length; parser++)
{
text[parser];
if (curr_rom.is_hoenn() && (text[parser] == 0xFC) && (get_gen_3_char((char16_t)(text[parser + 1]), false) == 0x01)) // Removes colored text
{
parser += 2;

View File

@ -257,16 +257,18 @@ void add_menu_box(int startTileX, int startTileY, int width, int height)
int start = (32 * startTileY) + startTileX;
int tiles = height / 8;
int rem = height % 8;
width /= 8;
// Corners
se_mem[SBB][start] = TILE_NW;
se_mem[SBB][start + MENU_WIDTH] = TILE_NE;
se_mem[SBB][start + width] = TILE_NE;
se_mem[SBB][start + (32 * (tiles + 1))] = TILE_SW_U_ARR[rem / 2];
se_mem[SBB][start + (32 * (tiles + 2))] = TILE_SW_L_ARR[rem / 2];
se_mem[SBB][start + (32 * (tiles + 1)) + MENU_WIDTH] = TILE_SE_U_ARR[rem / 2];
se_mem[SBB][start + (32 * (tiles + 2)) + MENU_WIDTH] = TILE_SE_L_ARR[rem / 2];
se_mem[SBB][start + (32 * (tiles + 1)) + width] = TILE_SE_U_ARR[rem / 2];
se_mem[SBB][start + (32 * (tiles + 2)) + width] = TILE_SE_L_ARR[rem / 2];
// Top and bottom edge
for (int i = 1; i < MENU_WIDTH; i++)
for (int i = 1; i < width; i++)
{
se_mem[SBB][start + i] = TILE_N;
se_mem[SBB][start + ((32 * (tiles + 1))) + i] = TILE_S_U_ARR[rem / 2];
@ -276,12 +278,12 @@ void add_menu_box(int startTileX, int startTileY, int width, int height)
// Sides
for (int i = 0; i < tiles; i++)
{
se_mem[SBB][start + (32 * (i + 1)) + MENU_WIDTH] = TILE_E;
se_mem[SBB][start + (32 * (i + 1)) + width] = TILE_E;
se_mem[SBB][start + (32 * (i + 1))] = TILE_W;
}
// Middle
for (int x = 1; x < MENU_WIDTH; x++)
for (int x = 1; x < width; x++)
{
for (int y = 1; y < tiles + 1; y++)
{
@ -447,47 +449,50 @@ void load_eternal_sprites()
void load_temp_box_sprites(Pokemon_Party *party_data)
{
u32 curr_tile_id = global_tile_id_end;
for (int i = 0; i < 30; i++)
{
if (party_data->get_simple_pkmn(i).is_valid || DONT_HIDE_INVALID_PKMN)
{
Simplified_Pokemon curr_pkmn = party_data->get_simple_pkmn(i);
int dex_num = curr_pkmn.dex_number;
if (dex_num == 201)
{
dex_num = POKEMON_ARRAY_SIZE + curr_pkmn.unown_letter;
}
else if (curr_pkmn.is_missingno)
{
dex_num = 0;
}
// grab_menu_sprite(dex_num, curr_tile_id, party_sprites[i], 0);
u32 gMonIconPaletteIndices = 0x0857c388;
u32 sprite_table = 0x0857bca8;
u32 sprite_location = (*(u32 *)(sprite_table + (dex_num * 4)));
int pal_num = *(byte *)(0x0857c388 + dex_num);
load_sprite(party_sprites[i], (const unsigned int *)sprite_location, 512, curr_tile_id, MENU_PAL_RED + pal_num, ATTR0_SQUARE, ATTR1_SIZE_32x32, 1);
obj_set_pos(party_sprites[i], ((BOXMENU_SPRITE_WIDTH + BOXMENU_HSPACE) * (i % BOXMENU_HNUM)) + (BOXMENU_LEFT + BOXMENU_SPRITE_HOFFSET), ((BOXMENU_SPRITE_HEIGHT + BOXMENU_VSPACE) * (i / BOXMENU_HNUM)) + (BOXMENU_TOP + BOXMENU_SPRITE_VOFFSET));
obj_unhide(party_sprites[i], 0);
}
else
{
curr_tile_id += 16;
}
}
// Load the menu sprite palettes. Should this be done somewhere else?
u32 gMonIconPalettes = 0x08dde1f8;
unsigned short buffer[16];
for (int i = 0; i < 3; i++)
if (!IGNORE_GAME_PAK)
{
tonccpy((pal_obj_mem + ((MENU_PAL_RED + i) * 16)), (const unsigned short *)(gMonIconPalettes + (i * 32)), 32);
for (int i = 0; i < 30; i++)
{
if (party_data->get_simple_pkmn(i).is_valid || DONT_HIDE_INVALID_PKMN)
{
Simplified_Pokemon curr_pkmn = party_data->get_simple_pkmn(i);
int dex_num = curr_pkmn.dex_number;
if (dex_num == 201)
{
dex_num = POKEMON_ARRAY_SIZE + curr_pkmn.unown_letter;
}
else if (curr_pkmn.is_missingno)
{
dex_num = 0;
}
u32 gMonIconPaletteIndices = 0x0857c388;
u32 sprite_table = 0x0857bca8;
u32 sprite_location = (*(u32 *)(sprite_table + (dex_num * 4)));
int pal_num = *(byte *)(gMonIconPaletteIndices + dex_num);
load_sprite(party_sprites[i], (const unsigned int *)sprite_location, 512, curr_tile_id, MENU_PAL_RED + pal_num, ATTR0_SQUARE, ATTR1_SIZE_32x32, 1);
obj_set_pos(party_sprites[i], ((BOXMENU_SPRITE_WIDTH + BOXMENU_HSPACE) * (i % BOXMENU_HNUM)) + (BOXMENU_LEFT + BOXMENU_SPRITE_HOFFSET), ((BOXMENU_SPRITE_HEIGHT + BOXMENU_VSPACE) * (i / BOXMENU_HNUM)) + (BOXMENU_TOP + BOXMENU_SPRITE_VOFFSET));
obj_unhide(party_sprites[i], 0);
}
else
{
curr_tile_id += 16;
}
}
// Load the menu sprite palettes. Should this be done somewhere else?
u32 gMonIconPalettes = 0x08dde1f8;
for (int i = 0; i < 3; i++)
{
tonccpy((pal_obj_mem + ((MENU_PAL_RED + i) * 16)), (const unsigned short *)(gMonIconPalettes + (i * 32)), 32);
}
load_sprite_compressed(grabbed_front_sprite, (const unsigned int *)*(u32 *)(curr_rom.loc_gMonFrontPicTable + (0 * 8)), curr_tile_id, PULLED_SPRITE_PAL, ATTR0_SQUARE, ATTR1_SIZE_64x64, 1);
obj_set_pos(grabbed_front_sprite, 8, 16);
}
load_sprite_compressed(grabbed_front_sprite, (const unsigned int *)*(u32 *)(curr_rom.loc_gMonFrontPicTable + (0 * 8)), curr_tile_id, PULLED_SPRITE_PAL, ATTR0_SQUARE, ATTR1_SIZE_64x64, 1);
obj_set_pos(grabbed_front_sprite, 8, 16);
load_sprite_compressed(box_select, box_selectTiles, curr_tile_id, BTN_PAL, ATTR0_SQUARE, ATTR1_SIZE_16x16, 0);
load_sprite_compressed(box_select, box_selectTiles, curr_tile_id, BTN_PAL, ATTR0_SQUARE, ATTR1_SIZE_32x32, 0);
load_sprite_compressed(button_cancel_left, button_cancel_leftTiles, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
load_sprite_compressed(button_cancel_right, button_edgeTiles, curr_tile_id, BTN_PAL, ATTR0_TALL, ATTR1_SIZE_8x32, 1);
load_sprite_compressed(button_confirm_left, button_confirm_leftTiles, curr_tile_id, BTN_PAL, ATTR0_WIDE, ATTR1_SIZE_64x32, 1);
@ -835,8 +840,14 @@ void update_y_offset()
void update_front_box_sprite(Simplified_Pokemon *curr_pkmn)
{
if (IGNORE_GAME_PAK)
{
return; // We don't want to look into garbage data, get out of here.
}
u32 curr_tile_id = global_tile_id_end + (30 * 16);
int dex_num = 0;
if (curr_pkmn->unown_letter > 1)
{
dex_num = 412 + curr_pkmn->unown_letter;
@ -867,11 +878,15 @@ void update_front_box_sprite(Simplified_Pokemon *curr_pkmn)
}
tonccpy((pal_obj_mem + (PULLED_SPRITE_PAL * 16)), buffer, 32);
LZ77UnCompVram((const unsigned int *)sprite_location, &tile_mem[SPRITE_CHAR_BLOCK][curr_tile_id]);
// load_sprite_compressed(grabbed_front_sprite, (const unsigned int *)sprite_location, curr_tile_id, PULLED_SPRITE_PAL, ATTR0_SQUARE, ATTR1_SIZE_64x64, 1);
}
void update_menu_sprite(Pokemon_Party *party_data, int index, int frame)
{
if (IGNORE_GAME_PAK)
{
return; // We don't want to look into garbage data, get out of here.
}
u32 curr_tile_id = global_tile_id_end + (index * 16);
Simplified_Pokemon curr_pkmn = party_data->get_simple_pkmn(index);
@ -886,8 +901,6 @@ void update_menu_sprite(Pokemon_Party *party_data, int index, int frame)
}
u32 sprite_table = 0x0857bca8;
u32 gMonIconPaletteIndices = 0x0857c388;
u32 gMonIconPalettes = 0x08dde1f8;
u32 sprite_location = (*(u32 *)(sprite_table + (dex_num * 4))) + (frame == 0 ? 0 : 512);
tonccpy(&tile_mem[SPRITE_CHAR_BLOCK][curr_tile_id], (const unsigned int *)sprite_location, 512);

View File

@ -181,7 +181,7 @@ int ptgb_write(const byte *text, bool instant, int length)
{
tc->drawgProc(0xEF);
}
tc->cursorY += 10; // tc->font->charH;
tc->cursorY += tc->font->charH;
tc->cursorX = tc->marginLeft;
break;
default:
@ -204,7 +204,7 @@ int ptgb_write(const byte *text, bool instant, int length)
// Draw and update position
tc->drawgProc(gid);
tc->cursorX += 6; //charW;
tc->cursorX += charW;
}
num += 1;
}

File diff suppressed because one or more lines are too long

View File

@ -81,7 +81,7 @@ def convertByte(incoming, array):
print(f"Warning! No match found for char [ {chr(incoming)} ]!")
return 0
def SplitSentenceIntoLines(sentence, offset, charPerLine):
def SplitSentenceIntoLines(sentence, offset, pixelsPerChar, pixelsInLine):
# If we can optimize this to remove the spaces, it could save some space.
outStr = ""
currLine = ""
@ -92,6 +92,7 @@ def SplitSentenceIntoLines(sentence, offset, charPerLine):
word = words[currWordIndex]
# print(word)
if(True):
testOut = ((len(currLine + word) + offset) * pixelsPerChar)
# See if the whole sentence is a newline
if (sentence == "Ň"):
outStr += "Ň"
@ -100,11 +101,11 @@ def SplitSentenceIntoLines(sentence, offset, charPerLine):
offset = 0
currWordIndex += 1
# Test if the word is too long in general
elif (len(word) > charPerLine):
elif ((len(word) * pixelsPerChar) > pixelsInLine):
print(f"ERROR: Word {word} exceeds alloted length")
currWordIndex += 1
# Test if adding the word will go over our alloted space
elif ((len(currLine + word) + offset) <= charPerLine):
elif (((len(currLine + word) + offset) * pixelsPerChar) <= pixelsInLine):
# If not, add the word and increase the index
currLine += (word + " ")
currWordIndex += 1
@ -145,7 +146,7 @@ def SplitSentenceIntoLines(sentence, offset, charPerLine):
offset = 0
outStr += currLine
return len(currLine), lineCount, outStr
return len(currLine) + offset, lineCount, outStr
# -*- coding: utf-8 -*-
import re
@ -206,8 +207,8 @@ def split_into_sentences(text: str) -> list[str]:
return sentences
class Languages(Enum):
Japanese = 0
English = 1
Japanese = 0
# read by default 1st sheet of an excel file
dir = os.curdir + "\\text_helper"
@ -226,7 +227,7 @@ for lang in Languages:
textDict = copy.deepcopy(mainDict)
def convert_item(line, numLines, charPerLine, include_box_breaks):
def convert_item(line, numLines, pixelsInLine, include_box_breaks):
split_sents = split_into_sentences(line)
index = 0
outStr = ""
@ -234,7 +235,7 @@ def convert_item(line, numLines, charPerLine, include_box_breaks):
offset = 0
escapeCount = 0
while index < len(split_sents) and escapeCount < 100:
offset, recievedLine, out = SplitSentenceIntoLines(split_sents[index], offset, charPerLine)
offset, recievedLine, out = SplitSentenceIntoLines(split_sents[index], offset, 6, pixelsInLine)
currLine += recievedLine
if (currLine < numLines):
#print(split_sents[index])
@ -303,7 +304,7 @@ with open(os.curdir + '\\source\\translated_text.cpp', 'w') as cppFile:
num = 0
for key, line in PTGB.items():
#print("--------")
PTGB[key] = convert_item(line, 4, 28, True)
PTGB[key] = convert_item(line, 4, 224, True)
cppFile.write("\nconst byte dialogueLine" + str(num) + "[] = {" + PTGB[key] + "};")
hFile.write(f"#define {key} {num}\n")
num += 1
@ -327,14 +328,14 @@ with open(os.curdir + '\\source\\translated_text.cpp', 'w') as cppFile:
# General
GENERAL = mainDict[lang.name]["GENERAL"]
for key, line in GENERAL.items():
GENERAL[key] = convert_item(line, 16, 28, False) # TODO This should not be for *every* item
GENERAL[key] = convert_item(line, 16, 240, False) # TODO This should not be for *every* item
cppFile.write(f"const byte {key}[] = {{{GENERAL[key]}}};\n")
hFile.write(f"extern const byte {key}[];\n")
# Credits
CREDITS = mainDict[lang.name]["CREDITS"]
for key, line in CREDITS.items():
CREDITS[key] = convert_item(line, 8, 20, False)
CREDITS[key] = convert_item(line, 8, 160, False)
cppFile.write(f"const byte {key}[] = {{{CREDITS[key]}}};\n")
hFile.write(f"extern const byte {key}[];\n")
cppFile.write("\n")
@ -345,7 +346,7 @@ with open(os.curdir + '\\source\\translated_text.cpp', 'w') as cppFile:
num = 0
for key, line in PKMN_NAMES.items():
#print("--------")
PKMN_NAMES[key] = convert_item(line, 4, 28, True)
PKMN_NAMES[key] = convert_item(line, 4, 240, True)
cppFile.write("const byte PKMN_NAMES" + str(num) + "[] = {" + PKMN_NAMES[key] + "};\n")
num += 1

File diff suppressed because one or more lines are too long

Binary file not shown.