Skip to content

Commit

Permalink
added evolve ui
Browse files Browse the repository at this point in the history
  • Loading branch information
savaughn committed Nov 18, 2023
1 parent 56e460a commit dcb9bfe
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 42 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions include/pksavhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ enum eligible_evolution_status check_trade_evolution_gen2(PokemonSave *pkmn_save
void evolve_party_pokemon_at_index(PokemonSave *pkmn_save, uint8_t pkmn_party_index);
void generate_random_number_step(void);
void update_pkmn_DVs(PokemonSave *pkmn_save, uint8_t pkmn_party_index);
void update_pkmn_stats(PokemonSave *pkmn_save, uint8_t pkmn_party_index);
bool get_is_random_DVs_disabled(void);
void set_is_random_DVs_disabled(bool is_disabled);
bool get_is_item_required(void);
Expand Down
2 changes: 1 addition & 1 deletion include/raylibhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void draw_file_select(struct save_file_data *save_file_data, char *player1_save_
void draw_trade(PokemonSave *save_player1, PokemonSave *save_player2, char *player1_save_path, char *player2_save_path, struct TrainerSelection trainer_selection[2], struct trainer_info *trainer1, struct trainer_info *trainer2, bool *is_same_generation, GameScreen *current_screen, Texture2D *trade_texture);
void draw_file_select_single(struct save_file_data *save_file_data, PokemonSave *save_player1, char *player1_save_path, struct trainer_info *trainer1, struct TrainerSelection *trainer_selection, enum single_player_menu_types menu_type, GameScreen *current_screen);
void draw_bills_pc(PokemonSave *pkmn_save, char *save_path, struct trainer_info *trainer, struct TrainerSelection *trainerSelection, GameScreen *current_screen);
void draw_evolve(PokemonSave *pkmn_save, char *save_path, struct trainer_info *trainer, GameScreen *current_screen);
void draw_evolve(PokemonSave *pkmn_save, char *save_path, struct trainer_info *trainer, GameScreen *current_screen, Texture2D *evolve_texture);
void handle_list_scroll(int *y_offset, const int num_saves, const int corrupted_count, int *mouses_down_index, bool *is_moving_scroll, int *banner_position_offset);
void update_selected_indexes_with_selection(int *selected_saves_index, int *mouses_down_index, bool *is_moving_scroll);
void draw_no_save_files(char *save_path);
Expand Down
Binary file added saves/Pokemon - Blue Evolve.sav
Binary file not shown.
Binary file added saves/Pokemon - Crystal Evolve.sav
Binary file not shown.
8 changes: 3 additions & 5 deletions src/pksavhelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,8 @@ pksavhelper_error update_seen_owned_pkmn(PokemonSave *pkmn_save, uint8_t pokemon
error_handler(pksav_error, "Error setting owned pokedex bit");
}
}
if (pksav_error != PKSAV_ERROR_NONE)
{
return error_update_pokedex;
}
return error_none;

return pksav_error == PKSAV_ERROR_NONE ? error_none : error_update_pokedex;
}

void swap_party_pkmn_at_indices(struct pksav_gen2_save *save, uint8_t pkmn_party_index1, uint8_t pkmn_party_index2)
Expand Down Expand Up @@ -362,6 +359,7 @@ void update_pkmn_stats(PokemonSave *pkmn_save, uint8_t pkmn_party_index)
pkmn_save->save.gen1_save.pokemon_storage.p_party->party[pkmn_party_index].party_data.spd = pksav_bigendian16(pkmn_stats[PKSAV_GEN1_STAT_SPEED]);
pkmn_save->save.gen1_save.pokemon_storage.p_party->party[pkmn_party_index].party_data.spcl = pksav_bigendian16(pkmn_stats[PKSAV_GEN1_STAT_SPECIAL]);
pkmn_save->save.gen1_save.pokemon_storage.p_party->party[pkmn_party_index].party_data.max_hp = pksav_bigendian16(pkmn_stats[PKSAV_GEN1_STAT_HP]);
pkmn_save->save.gen1_save.pokemon_storage.p_party->party[pkmn_party_index].pc_data.current_hp = pkmn_save->save.gen1_save.pokemon_storage.p_party->party[pkmn_party_index].party_data.max_hp;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/raylibhelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void draw_raylib_screen_loop(
draw_file_select_single(save_file_data, pkmn_save_player1, player1_save_path, trainer1, &trainerSelection[0], SINGLE_PLAYER_MENU_TYPE_EVOLVE, &current_screen);
break;
case SCREEN_EVOLVE:
draw_evolve(pkmn_save_player1, player1_save_path, trainer1, &current_screen);
draw_evolve(pkmn_save_player1, player1_save_path, trainer1, &current_screen, &textures[T_EVOLVE]);
break;
case SCREEN_ABOUT:
draw_about(&current_screen, is_build_prerelease);
Expand Down
225 changes: 194 additions & 31 deletions src/screens/EvolveScreen.c

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/screens/TradeScreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ void draw_trade(PokemonSave *save_player1, PokemonSave *save_player2, char *play
DrawTextureEx(*trade_texture, (Vector2){50, 10}, 0, 0.4, WHITE);

bool is_valid_trade[2] = {true, true};
draw_trainer_info(trainer1, 25, (SCREEN_HEIGHT - 100)/2 - 75, trainerSelection, *is_same_generation, is_valid_trade);
draw_trainer_info(trainer2, SCREEN_WIDTH - 178, (SCREEN_HEIGHT - 100)/2-75, trainerSelection, *is_same_generation, is_valid_trade);
draw_trainer_info(trainer1, 25, (SCREEN_HEIGHT - 100) / 2 - 75, trainerSelection, *is_same_generation, is_valid_trade);
draw_trainer_info(trainer2, SCREEN_WIDTH - 178, (SCREEN_HEIGHT - 100) / 2 - 75, trainerSelection, *is_same_generation, is_valid_trade);
bool can_submit_trade = trainerSelection[0].pkmn_party_index != -1 && trainerSelection[1].pkmn_party_index != -1 && is_valid_trade[0] == true && is_valid_trade[1] == true;

// Bottom bar
Expand Down Expand Up @@ -51,7 +51,7 @@ void draw_trade(PokemonSave *save_player1, PokemonSave *save_player2, char *play
ui_selection = BUTTON_NONE;
}
}

static pksavhelper_error pksavhelper_error = error_none;
if (IsMouseButtonReleased(MOUSE_BUTTON_LEFT) && ui_selection != BUTTON_NONE)
{
Expand Down Expand Up @@ -151,7 +151,7 @@ void draw_trade(PokemonSave *save_player1, PokemonSave *save_player2, char *play
default:
break;
}

show_trade_toast = !draw_toast_message(toast_message, TOAST_SHORT, TOAST_INFO);
}
else
Expand Down

0 comments on commit dcb9bfe

Please sign in to comment.