pokemon_select.c 913 B

12345678910111213141516171819202122
  1. #include "../pokemon_app.h"
  2. void select_pokemon_scene_on_enter(void* context) {
  3. PokemonFap* pokemon_fap = (PokemonFap*)context;
  4. // switch to select pokemon scene
  5. // Note for the future, this might make sense to setup and teardown each view
  6. // at runtime rather than at the start of the whole application
  7. view_dispatcher_switch_to_view(pokemon_fap->view_dispatcher, AppViewSelectPokemon);
  8. }
  9. void select_pokemon_scene_on_exit(void* context) {
  10. PokemonFap* pokemon_fap = (PokemonFap*)context;
  11. /* If a new pokemon was selected, then recalculate all of the trade_block
  12. * values for the first pokemon in the party.
  13. */
  14. /* XXX: Find a way to see if exit was caused by an OK or a Back input? */
  15. if(pokemon_fap->pokemon_table[pokemon_fap->curr_pokemon].index !=
  16. pokemon_fap->trade_block->party[0].index) {
  17. pokemon_trade_block_recalculate(pokemon_fap);
  18. }
  19. }