mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Add unlock anims setting
This commit is contained in:
@@ -67,7 +67,8 @@ static void animation_manager_start_new_idle(AnimationManager* animation_manager
|
||||
static bool animation_manager_check_blocking(AnimationManager* animation_manager);
|
||||
static bool animation_manager_is_valid_idle_animation(
|
||||
const StorageAnimationManifestInfo* info,
|
||||
const DolphinStats* stats);
|
||||
const DolphinStats* stats,
|
||||
const bool unlock);
|
||||
static void animation_manager_switch_to_one_shot_view(AnimationManager* animation_manager);
|
||||
static void animation_manager_switch_to_animation_view(AnimationManager* animation_manager);
|
||||
|
||||
@@ -146,7 +147,7 @@ void animation_manager_check_blocking_process(AnimationManager* animation_manage
|
||||
|
||||
const StorageAnimationManifestInfo* manifest_info =
|
||||
animation_storage_get_meta(animation_manager->current_animation);
|
||||
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats);
|
||||
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats, XTREME_SETTINGS()->unlock_anims);
|
||||
|
||||
if(!valid) {
|
||||
animation_manager_start_new_idle(animation_manager);
|
||||
@@ -340,7 +341,8 @@ View* animation_manager_get_animation_view(AnimationManager* animation_manager)
|
||||
|
||||
static bool animation_manager_is_valid_idle_animation(
|
||||
const StorageAnimationManifestInfo* info,
|
||||
const DolphinStats* stats) {
|
||||
const DolphinStats* stats,
|
||||
const bool unlock) {
|
||||
furi_assert(info);
|
||||
furi_assert(info->name);
|
||||
|
||||
@@ -360,11 +362,13 @@ static bool animation_manager_is_valid_idle_animation(
|
||||
|
||||
result = (sd_status == FSE_NOT_READY);
|
||||
}
|
||||
if((stats->butthurt < info->min_butthurt) || (stats->butthurt > info->max_butthurt)) {
|
||||
result = false;
|
||||
}
|
||||
if((stats->level < info->min_level) || (stats->level > info->max_level)) {
|
||||
result = false;
|
||||
if (!unlock) {
|
||||
if((stats->butthurt < info->min_butthurt) || (stats->butthurt > info->max_butthurt)) {
|
||||
result = false;
|
||||
}
|
||||
if((stats->level < info->min_level) || (stats->level > info->max_level)) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -384,11 +388,12 @@ static StorageAnimation*
|
||||
uint32_t whole_weight = 0;
|
||||
|
||||
StorageAnimationList_it_t it;
|
||||
bool unlock = XTREME_SETTINGS()->unlock_anims;
|
||||
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);
|
||||
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats, unlock);
|
||||
|
||||
if(valid) {
|
||||
whole_weight += manifest_info->weight;
|
||||
@@ -505,7 +510,7 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
const StorageAnimationManifestInfo* manifest_info =
|
||||
animation_storage_get_meta(restore_animation);
|
||||
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats);
|
||||
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats, XTREME_SETTINGS()->unlock_anims);
|
||||
if(valid) {
|
||||
animation_manager_replace_current_animation(
|
||||
animation_manager, restore_animation);
|
||||
|
||||
@@ -28,6 +28,13 @@ static void xtreme_settings_scene_start_cycle_anims_changed(VariableItem* item)
|
||||
XTREME_SETTINGS_SAVE();
|
||||
}
|
||||
|
||||
static void xtreme_settings_scene_start_unlock_anims_changed(VariableItem* item) {
|
||||
bool value = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||
XTREME_SETTINGS()->unlock_anims = value;
|
||||
XTREME_SETTINGS_SAVE();
|
||||
}
|
||||
|
||||
void xtreme_settings_scene_start_on_enter(void* context) {
|
||||
XtremeSettingsApp* app = context;
|
||||
XtremeSettings* xtreme = XTREME_SETTINGS();
|
||||
@@ -46,6 +53,15 @@ void xtreme_settings_scene_start_on_enter(void* context) {
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, cycle_anims_names[value_index]);
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"Unlock Anims",
|
||||
2,
|
||||
xtreme_settings_scene_start_unlock_anims_changed,
|
||||
app);
|
||||
variable_item_set_current_value_index(item, xtreme->unlock_anims);
|
||||
variable_item_set_current_value_text(item, xtreme->unlock_anims ? "ON" : "OFF");
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeSettingsAppViewVarItemList);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user