Rename Irukagotchi to Dolphin. Add basic game state structures. (#268)

* Rename Irukagotchi to Dolphin. Add basic game state structures.
* Dolphin: state, counters, api. BT: shared access to flash. Flash: write api.
* add fake -1 deeds, example of changing icounter

Co-authored-by: coreglitch <mail@s3f.ru>
This commit is contained in:
あく
2020-12-18 23:15:29 +03:00
committed by GitHub
parent 3ba1738acd
commit 73ecc7cde6
17 changed files with 383 additions and 81 deletions

View File

@@ -0,0 +1,52 @@
#include "dolphin_state.h"
#include <flipper_v2.h>
typedef struct {
uint32_t ibutton;
uint32_t nfc;
uint32_t ir;
uint32_t rfid;
} DolphinLimit;
struct DolphinState {
uint32_t icounter;
uint32_t butthurt;
DolphinLimit limit;
};
DolphinState* dolphin_state_alloc() {
DolphinState* dolphin_state = furi_alloc(sizeof(DolphinState));
return dolphin_state;
}
void dolphin_state_release(DolphinState* dolphin_state) {
free(dolphin_state);
}
void dolphin_state_save(DolphinState* dolphin_state) {
}
void dolphin_state_load(DolphinState* dolphin_state) {
}
void dolphin_state_clear(DolphinState* dolphin_state) {
memset(dolphin_state, 0, sizeof(DolphinState));
}
void dolphin_state_on_deed(DolphinState* dolphin_state, DolphinDeed deed) {
const DolphinDeedWeight* deed_weight = dolphin_deed_weight(deed);
int32_t icounter = dolphin_state->icounter + deed_weight->icounter;
if(icounter >= 0) {
dolphin_state->icounter = icounter;
}
}
uint32_t dolphin_state_get_icounter(DolphinState* dolphin_state) {
return dolphin_state->icounter;
}
uint32_t dolphin_state_get_butthurt(DolphinState* dolphin_state) {
return dolphin_state->butthurt;
}