4
4
#include <src/include/pokemon_app.h>
5
5
6
6
#include <src/scenes/include/pokemon_scene.h>
7
-
8
- static const char * pokerus_states [] = {
9
- "Clean" ,
10
- "Infected" ,
11
- "Cured" ,
12
- "" ,
13
- };
7
+ #include <src/include/pokemon_pokerus.h>
14
8
15
9
static const char * strains [] = {
16
10
"None" ,
@@ -21,16 +15,6 @@ static const char* strains[] = {
21
15
"" ,
22
16
};
23
17
24
- const char * select_pokerus_status (PokemonFap * pokemon_fap ) {
25
- uint8_t pokerus ;
26
-
27
- pokerus = pokemon_stat_get (pokemon_fap -> pdata , STAT_POKERUS , NONE );
28
-
29
- if (pokerus == 0x00 ) return pokerus_states [0 ];
30
- if ((pokerus & 0x0f ) != 0x00 ) return pokerus_states [1 ];
31
- return pokerus_states [2 ];
32
- }
33
-
34
18
struct pokerus_itemlist {
35
19
VariableItem * strain ;
36
20
VariableItem * days ;
@@ -41,13 +25,8 @@ static void select_pokerus_rebuild_list(PokemonFap* pokemon_fap);
41
25
42
26
static void select_strain_callback (VariableItem * item ) {
43
27
uint8_t index = variable_item_get_current_value_index (item );
44
- uint8_t pokerus ;
45
28
PokemonFap * pokemon_fap = variable_item_get_context (item );
46
29
47
- /* Need to read/modify/write the existing stat */
48
- pokerus = pokemon_stat_get (pokemon_fap -> pdata , STAT_POKERUS , NONE );
49
- pokerus &= 0x0f ;
50
-
51
30
/* Need to set the new text from the mangled index */
52
31
variable_item_set_current_value_text (item , strains [index ]);
53
32
@@ -58,24 +37,18 @@ static void select_strain_callback(VariableItem* item) {
58
37
index = 0x04 ; // Map this back to the A strain
59
38
else
60
39
index -- ;
61
- pokerus |= (index << 4 );
62
- if ((pokerus & 0xf0 ) == 0x00 ) pokerus = 0 ;
63
- pokemon_stat_set (pokemon_fap -> pdata , STAT_POKERUS , NONE , pokerus );
40
+
41
+ pokerus_set_strain (pokemon_fap -> pdata , index );
64
42
65
43
select_pokerus_rebuild_list (pokemon_fap );
66
44
variable_item_list_set_selected_item (pokemon_fap -> variable_item_list , 0 );
67
45
}
68
46
69
47
static void select_days_callback (VariableItem * item ) {
70
48
uint8_t index = variable_item_get_current_value_index (item );
71
- uint8_t pokerus ;
72
49
PokemonFap * pokemon_fap = variable_item_get_context (item );
73
50
74
- /* Need to read/modify/write the existing stat */
75
- pokerus = pokemon_stat_get (pokemon_fap -> pdata , STAT_POKERUS , NONE );
76
- pokerus &= 0xf0 ;
77
- pokerus |= index ;
78
- pokemon_stat_set (pokemon_fap -> pdata , STAT_POKERUS , NONE , pokerus );
51
+ pokerus_set_days (pokemon_fap -> pdata , index );
79
52
80
53
select_pokerus_rebuild_list (pokemon_fap );
81
54
variable_item_list_set_selected_item (pokemon_fap -> variable_item_list , 1 );
0 commit comments