@@ -23,6 +23,7 @@ static void select_pokemon_render_callback(Canvas* canvas, void* model) {
23
23
24
24
static bool select_pokemon_input_callback (InputEvent* event, void * context) {
25
25
PokemonFap* pokemon_fap = (PokemonFap*)context;
26
+ int pokemon_num = pokemon_fap->curr_pokemon ;
26
27
bool consumed = false ;
27
28
28
29
furi_assert (context);
@@ -45,41 +46,41 @@ static bool select_pokemon_input_callback(InputEvent* event, void* context) {
45
46
46
47
/* Move back one through the pokedex listing */
47
48
case InputKeyLeft:
48
- if (pokemon_fap-> curr_pokemon == 0 )
49
- pokemon_fap-> curr_pokemon = 150 ;
49
+ if (pokemon_num == 0 )
50
+ pokemon_num = 150 ;
50
51
else
51
- pokemon_fap-> curr_pokemon --;
52
+ pokemon_num --;
52
53
consumed = true ;
53
54
break ;
54
55
55
- /* Move back ten through the pokemon listing, wrap to max pokemon on
56
+ /* Move back ten through the pokemon listing, wrap to max pokemon on
56
57
* underflow.
57
58
*/
58
59
case InputKeyDown:
59
- if (pokemon_fap-> curr_pokemon >= 10 )
60
- pokemon_fap-> curr_pokemon -= 10 ;
60
+ if (pokemon_num >= 10 )
61
+ pokemon_num -= 10 ;
61
62
else
62
- pokemon_fap-> curr_pokemon = 150 ;
63
+ pokemon_num = 150 ;
63
64
consumed = true ;
64
65
break ;
65
66
66
67
/* Move forward one through the pokedex listing */
67
68
case InputKeyRight:
68
- if (pokemon_fap-> curr_pokemon == 150 )
69
- pokemon_fap-> curr_pokemon = 0 ;
69
+ if (pokemon_num == 150 )
70
+ pokemon_num = 0 ;
70
71
else
71
- pokemon_fap-> curr_pokemon ++;
72
+ pokemon_num ++;
72
73
consumed = true ;
73
74
break ;
74
75
75
- /* Move forward ten through the pokemon listing, wrap to min pokemon on
76
+ /* Move forward ten through the pokemon listing, wrap to min pokemon on
76
77
* overflow.
77
78
*/
78
79
case InputKeyUp:
79
- if (pokemon_fap-> curr_pokemon <= 140 )
80
- pokemon_fap-> curr_pokemon += 10 ;
80
+ if (pokemon_num <= 140 )
81
+ pokemon_num += 10 ;
81
82
else
82
- pokemon_fap-> curr_pokemon = 0 ;
83
+ pokemon_num = 0 ;
83
84
consumed = true ;
84
85
break ;
85
86
@@ -88,6 +89,8 @@ static bool select_pokemon_input_callback(InputEvent* event, void* context) {
88
89
break ;
89
90
}
90
91
92
+ pokemon_fap->curr_pokemon = pokemon_num;
93
+
91
94
return consumed;
92
95
}
93
96
0 commit comments