[FL-1019] New main screen and graphics (#389)

* new status bar, lock menu and dolphin activities screen

* lock icon indication 

* main screen animation, basic scene switching

* level progression calculations based on icounter value 

Co-authored-by: rusdacent <rusdacentx0x08@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
its your bedtime
2021-03-25 20:48:58 +03:00
committed by GitHub
parent 610f4f5d73
commit 372710c31a
42 changed files with 454 additions and 34 deletions

View File

@@ -1,6 +1,7 @@
#include "dolphin_state.h"
#include <furi.h>
#include <api-hal.h>
#include <math.h>
typedef struct {
uint8_t magic;
@@ -17,6 +18,8 @@ typedef struct {
#define DOLPHIN_DATA_HEADER_MAGIC 0xD0
#define DOLPHIN_DATA_HEADER_VERSION 0x01
#define DOLPHIN_LVL_THRESHOLD 20.0f
typedef struct {
uint32_t limit_ibutton;
uint32_t limit_nfc;
@@ -119,3 +122,14 @@ uint32_t dolphin_state_get_icounter(DolphinState* dolphin_state) {
uint32_t dolphin_state_get_butthurt(DolphinState* dolphin_state) {
return dolphin_state->data.butthurt;
}
uint32_t dolphin_state_get_level(DolphinState* dolphin_state) {
return 0.5f +
sqrtf(1.0f + 8.0f * ((float)dolphin_state->data.icounter / DOLPHIN_LVL_THRESHOLD)) /
2.0f;
}
uint32_t dolphin_state_xp_to_levelup(DolphinState* dolphin_state, uint32_t level, bool remaining) {
return (DOLPHIN_LVL_THRESHOLD * level * (level + 1) / 2) -
(remaining ? dolphin_state->data.icounter : 0);
}