mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-23 05:24:46 -07:00
New asset system base and passport PoC
This commit is contained in:
@@ -7,35 +7,9 @@
|
|||||||
#include <furi_hal_version.h>
|
#include <furi_hal_version.h>
|
||||||
#include "dolphin/dolphin.h"
|
#include "dolphin/dolphin.h"
|
||||||
#include "../xtreme_settings/xtreme_settings.h"
|
#include "../xtreme_settings/xtreme_settings.h"
|
||||||
|
#include "../xtreme_settings/xtreme_assets.h"
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
#define MOODS_TOTAL 3
|
|
||||||
#define BUTTHURT_MAX 3
|
|
||||||
|
|
||||||
static const Icon* const portrait_happy_sfw[BUTTHURT_MAX] = {
|
|
||||||
&I_passport_happy1_46x49_sfw,
|
|
||||||
&I_passport_happy2_46x49_sfw,
|
|
||||||
&I_passport_happy3_46x49_sfw};
|
|
||||||
static const Icon* const portrait_ok_sfw[BUTTHURT_MAX] = {
|
|
||||||
&I_passport_okay1_46x49_sfw,
|
|
||||||
&I_passport_okay2_46x49_sfw,
|
|
||||||
&I_passport_okay3_46x49_sfw};
|
|
||||||
static const Icon* const portrait_bad_sfw[BUTTHURT_MAX] = {
|
|
||||||
&I_passport_bad1_46x49_sfw,
|
|
||||||
&I_passport_bad2_46x49_sfw,
|
|
||||||
&I_passport_bad3_46x49_sfw};
|
|
||||||
|
|
||||||
static const Icon* const portrait_happy[BUTTHURT_MAX] = {&I_flipper};
|
|
||||||
static const Icon* const portrait_ok[BUTTHURT_MAX] = {&I_flipper};
|
|
||||||
static const Icon* const portrait_bad[BUTTHURT_MAX] = {&I_flipper};
|
|
||||||
|
|
||||||
static const Icon* const* portraits_sfw[MOODS_TOTAL] = {
|
|
||||||
portrait_happy_sfw,
|
|
||||||
portrait_ok_sfw,
|
|
||||||
portrait_bad_sfw};
|
|
||||||
static const Icon* const* portraits[MOODS_TOTAL] = {portrait_happy, portrait_ok, portrait_bad};
|
|
||||||
// static const Icon* const* portraits[MOODS_TOTAL] = {portrait_happy};
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
FuriSemaphore* semaphore;
|
FuriSemaphore* semaphore;
|
||||||
DolphinStats* stats;
|
DolphinStats* stats;
|
||||||
@@ -64,30 +38,30 @@ static void render_callback(Canvas* canvas, void* _ctx) {
|
|||||||
|
|
||||||
char level_str[20];
|
char level_str[20];
|
||||||
char xp_str[12];
|
char xp_str[12];
|
||||||
char mood_str[32];
|
const char* mood_str = NULL;
|
||||||
uint8_t mood = 0;
|
const Icon* portrait = NULL;
|
||||||
|
|
||||||
if(xtreme_settings->sfw_mode) {
|
if(xtreme_settings->sfw_mode) {
|
||||||
if(stats->butthurt <= 4) {
|
if(stats->butthurt <= 4) {
|
||||||
mood = 0;
|
portrait = XTREME_ASSETS()->passport_happy;
|
||||||
snprintf(mood_str, 20, "Mood: Happy");
|
mood_str = "Mood: Happy";
|
||||||
} else if(stats->butthurt <= 9) {
|
} else if(stats->butthurt <= 9) {
|
||||||
mood = 1;
|
portrait = XTREME_ASSETS()->passport_okay;
|
||||||
snprintf(mood_str, 20, "Mood: Okay");
|
mood_str = "Mood: Okay";
|
||||||
} else {
|
} else {
|
||||||
mood = 2;
|
portrait = XTREME_ASSETS()->passport_angry;
|
||||||
snprintf(mood_str, 20, "Mood: Angry");
|
mood_str = "Mood: Angry";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(stats->butthurt <= 4) {
|
if(stats->butthurt <= 4) {
|
||||||
mood = 0;
|
portrait = XTREME_ASSETS()->passport_happy;
|
||||||
snprintf(mood_str, 20, "Status: Wet");
|
mood_str = "Status: Wet";
|
||||||
} else if(stats->butthurt <= 9) {
|
} else if(stats->butthurt <= 9) {
|
||||||
mood = 1;
|
portrait = XTREME_ASSETS()->passport_okay;
|
||||||
snprintf(mood_str, 20, "Status: Horny");
|
mood_str = "Status: Horny";
|
||||||
} else {
|
} else {
|
||||||
mood = 2;
|
portrait = XTREME_ASSETS()->passport_angry;
|
||||||
snprintf(mood_str, 20, "Status: Desperate");
|
mood_str = "Status: Desperate";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uint32_t xp_progress = 0;
|
uint32_t xp_progress = 0;
|
||||||
@@ -116,12 +90,7 @@ static void render_callback(Canvas* canvas, void* _ctx) {
|
|||||||
|
|
||||||
// portrait
|
// portrait
|
||||||
furi_assert((stats->level > 0) && (stats->level <= DOLPHIN_LEVEL_COUNT + 1));
|
furi_assert((stats->level > 0) && (stats->level <= DOLPHIN_LEVEL_COUNT + 1));
|
||||||
uint16_t tmpLvl = 0;
|
canvas_draw_icon(canvas, 11, 2, portrait);
|
||||||
if(xtreme_settings->sfw_mode) {
|
|
||||||
canvas_draw_icon(canvas, 11, 2, portraits_sfw[mood][tmpLvl]);
|
|
||||||
} else {
|
|
||||||
canvas_draw_icon(canvas, 11, 2, portraits[mood][tmpLvl]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* my_name = furi_hal_version_get_name_ptr();
|
const char* my_name = furi_hal_version_get_name_ptr();
|
||||||
snprintf(level_str, 12, "Level: %hu", stats->level);
|
snprintf(level_str, 12, "Level: %hu", stats->level);
|
||||||
|
|||||||
26
applications/settings/xtreme_settings/xtreme_assets.c
Normal file
26
applications/settings/xtreme_settings/xtreme_assets.c
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#include "xtreme_assets.h"
|
||||||
|
|
||||||
|
XtremeAssets* xtreme_assets = NULL;
|
||||||
|
|
||||||
|
XtremeAssets* XTREME_ASSETS() {
|
||||||
|
if (xtreme_assets == NULL) {
|
||||||
|
XTREME_ASSETS_UPDATE();
|
||||||
|
}
|
||||||
|
return xtreme_assets;
|
||||||
|
}
|
||||||
|
|
||||||
|
void XTREME_ASSETS_UPDATE() {
|
||||||
|
if (xtreme_assets == NULL) {
|
||||||
|
xtreme_assets = malloc(sizeof(XtremeAssets));
|
||||||
|
}
|
||||||
|
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
||||||
|
if (xtreme_settings->sfw_mode) {
|
||||||
|
xtreme_assets->passport_happy = &I_passport_happy1_46x49_sfw;
|
||||||
|
xtreme_assets->passport_okay = &I_passport_okay1_46x49_sfw;
|
||||||
|
xtreme_assets->passport_angry = &I_passport_bad1_46x49_sfw;
|
||||||
|
} else {
|
||||||
|
xtreme_assets->passport_happy = &I_flipper;
|
||||||
|
xtreme_assets->passport_okay = &I_flipper;
|
||||||
|
xtreme_assets->passport_angry = &I_flipper;
|
||||||
|
}
|
||||||
|
}
|
||||||
14
applications/settings/xtreme_settings/xtreme_assets.h
Normal file
14
applications/settings/xtreme_settings/xtreme_assets.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "xtreme_settings.h"
|
||||||
|
#include "assets_icons.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const Icon* passport_happy;
|
||||||
|
const Icon* passport_okay;
|
||||||
|
const Icon* passport_angry;
|
||||||
|
} XtremeAssets;
|
||||||
|
|
||||||
|
XtremeAssets* XTREME_ASSETS();
|
||||||
|
|
||||||
|
void XTREME_ASSETS_UPDATE();
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "xtreme_settings.h"
|
#include "xtreme_settings.h"
|
||||||
|
#include "xtreme_assets.h"
|
||||||
|
|
||||||
void xtreme_on_system_start() {
|
void xtreme_on_system_start() {
|
||||||
XTREME_SETTINGS_LOAD();
|
XTREME_SETTINGS_LOAD();
|
||||||
|
XTREME_ASSETS_UPDATE();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user