forked from flipperdevices/flipperzero-firmware
-
-
Notifications
You must be signed in to change notification settings - Fork 550
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pokerus: Separate out accessor functions from scene
Signed-off-by: Kris Bahnsen <Kris@KBEmbedded.com>
- Loading branch information
1 parent
2f9f536
commit eafd365
Showing
5 changed files
with
71 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef POKEMON_POKERUS_H | ||
#define POKEMON_POKERUS_H | ||
|
||
#include <src/include/pokemon_data.h> | ||
|
||
#pragma once | ||
|
||
const char* pokerus_get_status_str(PokemonData* pdata); | ||
|
||
void pokerus_set_strain(PokemonData* pdata, uint8_t strain); | ||
|
||
void pokerus_set_days(PokemonData *pdata, uint8_t days); | ||
|
||
#endif // POKEMON_POKERUS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include <gui/modules/variable_item_list.h> | ||
#include <furi.h> | ||
|
||
#include <src/include/pokemon_data.h> | ||
|
||
static const char* pokerus_states[] = { | ||
"Clean", | ||
"Infected", | ||
"Cured", | ||
"", | ||
}; | ||
|
||
const char* pokerus_get_status_str(PokemonData* pdata) { | ||
uint8_t pokerus; | ||
|
||
pokerus = pokemon_stat_get(pdata, STAT_POKERUS, NONE); | ||
|
||
if(pokerus == 0x00) | ||
return pokerus_states[0]; | ||
|
||
if((pokerus & 0x0f) != 0x00) | ||
return pokerus_states[1]; | ||
|
||
return pokerus_states[2]; | ||
} | ||
|
||
void pokerus_set_strain(PokemonData* pdata, uint8_t strain) { | ||
uint8_t pokerus; | ||
|
||
/* Need to read/modify/write the existing stat */ | ||
pokerus = pokemon_stat_get(pdata, STAT_POKERUS, NONE); | ||
pokerus &= 0x0f; | ||
pokerus |= (strain << 4); | ||
|
||
if((pokerus & 0xf0) == 0x00) | ||
pokerus = 0; | ||
|
||
pokemon_stat_set(pdata, STAT_POKERUS, NONE, pokerus); | ||
} | ||
|
||
void pokerus_set_days(PokemonData *pdata, uint8_t days) { | ||
uint8_t pokerus; | ||
|
||
days &= 0x0f; | ||
|
||
/* Need to read/modify/write the existing stat */ | ||
pokerus = pokemon_stat_get(pdata, STAT_POKERUS, NONE); | ||
pokerus &= 0xf0; | ||
pokerus |= days; | ||
pokemon_stat_set(pdata, STAT_POKERUS, NONE, pokerus); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters