mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 05:18:35 -07:00
Add back option to disable credits for base pack
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user