Add back option to disable credits for base pack

This commit is contained in:
Willy-JL
2023-11-29 17:52:31 +00:00
parent 466e1f989f
commit 0d3a12c00d
12 changed files with 43 additions and 4 deletions

View File

@@ -5,7 +5,7 @@ enum VarItemListIndex {
VarItemListIndexAnimSpeed,
VarItemListIndexCycleAnims,
VarItemListIndexUnlockAnims,
VarItemListIndexFallbackAnim,
VarItemListIndexCreditsAnim,
};
void xtreme_app_scene_interface_graphics_var_item_list_callback(void* context, uint32_t index) {
@@ -18,6 +18,10 @@ static void xtreme_app_scene_interface_graphics_asset_pack_changed(VariableItem*
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(
item, index == 0 ? "Default" : *CharList_get(app->asset_pack_names, index - 1));
variable_item_set_locked(
variable_item_list_get(app->var_item_list, VarItemListIndexCreditsAnim),
index != 0,
"Credits\nare in\ndefault pack!");
strlcpy(
xtreme_settings.asset_pack,
index == 0 ? "" : *CharList_get(app->asset_pack_names, index - 1),
@@ -113,6 +117,14 @@ static void xtreme_app_scene_interface_graphics_unlock_anims_changed(VariableIte
app->save_settings = true;
}
static void xtreme_app_scene_interface_graphics_credits_anim_changed(VariableItem* item) {
XtremeApp* app = variable_item_get_context(item);
bool value = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
xtreme_settings.credits_anim = value;
app->save_settings = true;
}
void xtreme_app_scene_interface_graphics_on_enter(void* context) {
XtremeApp* app = context;
VariableItemList* var_item_list = app->var_item_list;
@@ -163,6 +175,16 @@ void xtreme_app_scene_interface_graphics_on_enter(void* context) {
variable_item_set_current_value_index(item, xtreme_settings.unlock_anims);
variable_item_set_current_value_text(item, xtreme_settings.unlock_anims ? "ON" : "OFF");
item = variable_item_list_add(
var_item_list,
"Credits Anim",
2,
xtreme_app_scene_interface_graphics_credits_anim_changed,
app);
variable_item_set_current_value_index(item, xtreme_settings.credits_anim);
variable_item_set_current_value_text(item, xtreme_settings.credits_anim ? "ON" : "OFF");
variable_item_set_locked(item, app->asset_pack_index != 0, "Credits\nare in\ndefault pack!");
variable_item_list_set_enter_callback(
var_item_list, xtreme_app_scene_interface_graphics_var_item_list_callback, app);

View File

@@ -20,6 +20,7 @@
#define HARDCODED_ANIMATION_NAME "L1_AnimationError_128x64"
#define NO_SD_ANIMATION_NAME "L1_NoSd_128x49"
#define BAD_BATTERY_ANIMATION_NAME "L1_BadBattery_128x47"
#define CREDITS_ANIMATION_NAME "Credits_128x64"
#define NO_DB_ANIMATION_NAME "L0_NoDb_128x51"
#define BAD_SD_ANIMATION_NAME "L0_SdBad_128x51"
@@ -388,15 +389,24 @@ static StorageAnimation*
uint32_t whole_weight = 0;
// Filter valid animations
bool skip_credits = !xtreme_settings.credits_anim && xtreme_settings.asset_pack[0] == '\0';
bool unlock = xtreme_settings.unlock_anims;
StorageAnimationList_it_t it;
for(StorageAnimationList_it(it, animation_list); !StorageAnimationList_end_p(it);) {
StorageAnimation* storage_animation = *StorageAnimationList_ref(it);
const StorageAnimationManifestInfo* manifest_info =
animation_storage_get_meta(storage_animation);
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats, unlock);
if(animation_manager_is_valid_idle_animation(manifest_info, &stats, unlock) &&
strcmp(manifest_info->name, HARDCODED_ANIMATION_NAME)) { // Dont pick error anim randomly
if(strcmp(manifest_info->name, HARDCODED_ANIMATION_NAME) == 0) {
// Dont pick error anim randomly
valid = false;
} else if(skip_credits && strcmp(manifest_info->name, CREDITS_ANIMATION_NAME) == 0) {
// Dont pick credits anim if disabled
valid = false;
}
if(valid) { // Dont pick error anim randomly
StorageAnimationList_next(it);
} else {
animation_storage_free_storage_animation(&storage_animation);

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -176,7 +176,7 @@ Min level: 22
Max level: 30
Weight: 4
Name: thank_you_128x64
Name: Credits_128x64
Min butthurt: 0
Max butthurt: 14
Min level: 6

View File

@@ -10,6 +10,7 @@ XtremeSettings xtreme_settings = {
.anim_speed = 100, // 100%
.cycle_anims = 0, // Meta.txt
.unlock_anims = false, // OFF
.credits_anim = true, // ON
.menu_style = MenuStyleWii, // Wii
.lock_on_boot = false, // OFF
.bad_pins_format = false, // OFF
@@ -68,6 +69,10 @@ void XTREME_SETTINGS_LOAD() {
x->unlock_anims = b;
}
flipper_format_rewind(file);
if(flipper_format_read_bool(file, "credits_anim", &b, 1)) {
x->credits_anim = b;
}
flipper_format_rewind(file);
if(flipper_format_read_uint32(file, "menu_style", &u, 1)) {
x->menu_style = CLAMP(u, MenuStyleCount - 1U, 0U);
}
@@ -204,6 +209,7 @@ void XTREME_SETTINGS_SAVE() {
flipper_format_write_uint32(file, "anim_speed", &x->anim_speed, 1);
flipper_format_write_int32(file, "cycle_anims", &x->cycle_anims, 1);
flipper_format_write_bool(file, "unlock_anims", &x->unlock_anims, 1);
flipper_format_write_bool(file, "credits_anim", &x->credits_anim, 1);
e = x->menu_style;
flipper_format_write_uint32(file, "menu_style", &e, 1);
flipper_format_write_bool(file, "bad_pins_format", &x->bad_pins_format, 1);

View File

@@ -57,6 +57,7 @@ typedef struct {
uint32_t anim_speed;
int32_t cycle_anims;
bool unlock_anims;
bool credits_anim;
MenuStyle menu_style;
bool lock_on_boot;
bool bad_pins_format;