Skip to content

Commit

Permalink
Merge pull request #15 from Yorisoft/issue_9
Browse files Browse the repository at this point in the history
Issue 9
  • Loading branch information
Yorisoft authored Jan 15, 2025
2 parents 0167c6a + 47affe1 commit df44639
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 32 deletions.
Binary file modified App/Retrodex/res/db/pokedex.sqlite
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -307,21 +307,21 @@ bool PokedexActivity_PokemonView_Evolution::renderPokeInfo(SDL_Surface* surf_dis
/////////////////////////////////////////////////////////////////////////////
//// Render poke method
std::string pokeMethod = (*evoChain)[offset + i][4];
if (pokeMethod == "level-up" && (*evoChain)[offset + i][5] != "NULL") {
pokeMethod = "Lv. " + (*evoChain)[offset + i][5];

if (pokeMethod == "Level up" && (*evoChain)[offset + i][5] != "NULL") {
pokeMethod += " " + (*evoChain)[offset + i][5];
}
if (pokeMethod == "use-item") {
pokeMethod = "Item:" + (*evoChain)[offset + i][6];
if (pokeMethod == "Use item") {
pokeMethod += " " + (*evoChain)[offset + i][6];

}
if (pokeMethod == "level-up" && (*evoChain)[offset + i][7] != "NULL") {
if (pokeMethod == "Level up" && (*evoChain)[offset + i][7] != "NULL") {
pokeMethod = "Time: " + (*evoChain)[offset + i][7];

if ((*evoChain)[offset + i][8] != "NULL") {
pokeMethod += " Happiness: " + (*evoChain)[offset + i][8];
}
}
if (pokeMethod == "level-up" && (*evoChain)[offset + i][8] != "NULL") {
else if (pokeMethod == "Level up" && (*evoChain)[offset + i][8] != "NULL") {
pokeMethod = "Happiness: " + (*evoChain)[offset + i][8];

}
SDL_Surface* pokeMethodSurface = TTF_RenderUTF8_Blended(
font,
Expand All @@ -336,10 +336,10 @@ bool PokedexActivity_PokemonView_Evolution::renderPokeInfo(SDL_Surface* surf_dis
SDL_Rect pokeMethodRect;
pokeMethodRect.x = pokeNameRect.x;
pokeMethodRect.y = pokeNameRect.y + pokeNameRect.h + 10;
pokeMethodRect.w = static_cast<int>(pokeMethodSurface->w);
pokeMethodRect.h = static_cast<int>(pokeMethodSurface->h);
pokeMethodRect.w = static_cast<int>(pokeMethodSurface->w * .9);
pokeMethodRect.h = static_cast<int>(pokeMethodSurface->h * .9);

PokeSurface::onDraw(surf_display, pokeMethodSurface, &pokeMethodRect);
PokeSurface::onDrawScaled(surf_display, pokeMethodSurface, &pokeMethodRect);
SDL_FreeSurface(pokeMethodSurface);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ const std::string SQL_getPokeEvoChain = R"(
p.id AS pokemon_id,
p.identifier AS pokemon_identifier,
psn.name AS localized_name,
COALESCE(et.identifier, 'Base') AS evolution_method,
COALESCE(etp.name, 'Base') AS evolution_method, -- Localized evolution method
pe.minimum_level,
item_locale.name AS trigger_item_name,
pe.time_of_day,
Expand All @@ -308,10 +308,12 @@ const std::string SQL_getPokeEvoChain = R"(
pokemon_evolution pe ON ps.id = pe.evolved_species_id
LEFT JOIN
evolution_triggers et ON pe.evolution_trigger_id = et.id
LEFT JOIN
evolution_trigger_prose etp ON et.id = etp.evolution_trigger_id AND etp.local_language_id = COALESCE(:language_id, 9) -- Use language ID or default to 9
LEFT JOIN
items i ON pe.trigger_item_id = i.id
LEFT JOIN
item_names item_locale ON i.id = item_locale.item_id AND item_locale.local_language_id = :language_id
item_names item_locale ON i.id = item_locale.item_id AND item_locale.local_language_id = COALESCE(:language_id, 9) -- Default to 9 for items too
LEFT JOIN
pokemon_game_indices pgi ON p.id = pgi.pokemon_id
LEFT JOIN
Expand All @@ -320,14 +322,14 @@ const std::string SQL_getPokeEvoChain = R"(
version_groups vg ON v.version_group_id = vg.id
WHERE
ps.evolution_chain_id = :evo_chain_id
AND psn.local_language_id = :language_id
AND psn.local_language_id = COALESCE(:language_id, 9) -- Default to 9 for species names
AND p.id <= 648
GROUP BY
ps.evolution_chain_id,
p.id,
p.identifier,
psn.name,
COALESCE(et.identifier, 'Base'),
COALESCE(etp.name, 'Base'), -- Use localized name or fallback
pe.minimum_level,
item_locale.name,
pe.time_of_day,
Expand Down
24 changes: 12 additions & 12 deletions Source/window_dev/PokedexActivity_PokemonView_Evolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,21 +307,21 @@ bool PokedexActivity_PokemonView_Evolution::renderPokeInfo(SDL_Surface* surf_dis
/////////////////////////////////////////////////////////////////////////////
//// Render poke method
std::string pokeMethod = (*evoChain)[offset + i][4];
if (pokeMethod == "level-up" && (*evoChain)[offset + i][5] != "NULL") {
pokeMethod = "Lv. " + (*evoChain)[offset + i][5];

if (pokeMethod == "Level up" && (*evoChain)[offset + i][5] != "NULL") {
pokeMethod += " " + (*evoChain)[offset + i][5];
}
if (pokeMethod == "use-item") {
pokeMethod = "Item:" + (*evoChain)[offset + i][6];
if (pokeMethod == "Use item") {
pokeMethod += " " + (*evoChain)[offset + i][6];

}
if (pokeMethod == "level-up" && (*evoChain)[offset + i][7] != "NULL") {
if (pokeMethod == "Level up" && (*evoChain)[offset + i][7] != "NULL") {
pokeMethod = "Time: " + (*evoChain)[offset + i][7];

if ((*evoChain)[offset + i][8] != "NULL") {
pokeMethod += " Happiness: " + (*evoChain)[offset + i][8];
}
}
if (pokeMethod == "level-up" && (*evoChain)[offset + i][8] != "NULL") {
else if (pokeMethod == "Level up" && (*evoChain)[offset + i][8] != "NULL") {
pokeMethod = "Happiness: " + (*evoChain)[offset + i][8];

}
SDL_Surface* pokeMethodSurface = TTF_RenderUTF8_Blended(
font,
Expand All @@ -336,10 +336,10 @@ bool PokedexActivity_PokemonView_Evolution::renderPokeInfo(SDL_Surface* surf_dis
SDL_Rect pokeMethodRect;
pokeMethodRect.x = pokeNameRect.x;
pokeMethodRect.y = pokeNameRect.y + pokeNameRect.h + 10;
pokeMethodRect.w = static_cast<int>(pokeMethodSurface->w);
pokeMethodRect.h = static_cast<int>(pokeMethodSurface->h);
pokeMethodRect.w = static_cast<int>(pokeMethodSurface->w * .9);
pokeMethodRect.h = static_cast<int>(pokeMethodSurface->h * .9);

PokeSurface::onDraw(surf_display, pokeMethodSurface, &pokeMethodRect);
PokeSurface::onDrawScaled(surf_display, pokeMethodSurface, &pokeMethodRect);
SDL_FreeSurface(pokeMethodSurface);


Expand Down
10 changes: 6 additions & 4 deletions Source/window_dev/SQLstatements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ const std::string SQL_getPokeEvoChain = R"(
p.id AS pokemon_id,
p.identifier AS pokemon_identifier,
psn.name AS localized_name,
COALESCE(et.identifier, 'Base') AS evolution_method,
COALESCE(etp.name, 'Base') AS evolution_method, -- Localized evolution method
pe.minimum_level,
item_locale.name AS trigger_item_name,
pe.time_of_day,
Expand All @@ -308,10 +308,12 @@ const std::string SQL_getPokeEvoChain = R"(
pokemon_evolution pe ON ps.id = pe.evolved_species_id
LEFT JOIN
evolution_triggers et ON pe.evolution_trigger_id = et.id
LEFT JOIN
evolution_trigger_prose etp ON et.id = etp.evolution_trigger_id AND etp.local_language_id = COALESCE(:language_id, 9) -- Use language ID or default to 9
LEFT JOIN
items i ON pe.trigger_item_id = i.id
LEFT JOIN
item_names item_locale ON i.id = item_locale.item_id AND item_locale.local_language_id = :language_id
item_names item_locale ON i.id = item_locale.item_id AND item_locale.local_language_id = COALESCE(:language_id, 9) -- Default to 9 for items too
LEFT JOIN
pokemon_game_indices pgi ON p.id = pgi.pokemon_id
LEFT JOIN
Expand All @@ -320,14 +322,14 @@ const std::string SQL_getPokeEvoChain = R"(
version_groups vg ON v.version_group_id = vg.id
WHERE
ps.evolution_chain_id = :evo_chain_id
AND psn.local_language_id = :language_id
AND psn.local_language_id = COALESCE(:language_id, 9) -- Default to 9 for species names
AND p.id <= 648
GROUP BY
ps.evolution_chain_id,
p.id,
p.identifier,
psn.name,
COALESCE(et.identifier, 'Base'),
COALESCE(etp.name, 'Base'), -- Use localized name or fallback
pe.minimum_level,
item_locale.name,
pe.time_of_day,
Expand Down

0 comments on commit df44639

Please sign in to comment.