mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 09:38:35 -07:00
Dont play same anim twice in a row
This commit is contained in:
@@ -70,6 +70,8 @@ static bool animation_manager_is_valid_idle_animation(
|
|||||||
static void animation_manager_switch_to_one_shot_view(AnimationManager* animation_manager);
|
static void animation_manager_switch_to_one_shot_view(AnimationManager* animation_manager);
|
||||||
static void animation_manager_switch_to_animation_view(AnimationManager* animation_manager);
|
static void animation_manager_switch_to_animation_view(AnimationManager* animation_manager);
|
||||||
|
|
||||||
|
bool select_idle_animation_failed;
|
||||||
|
|
||||||
void animation_manager_set_context(AnimationManager* animation_manager, void* context) {
|
void animation_manager_set_context(AnimationManager* animation_manager, void* context) {
|
||||||
furi_assert(animation_manager);
|
furi_assert(animation_manager);
|
||||||
animation_manager->context = context;
|
animation_manager->context = context;
|
||||||
@@ -195,7 +197,18 @@ bool animation_manager_interact_process(AnimationManager* animation_manager) {
|
|||||||
static void animation_manager_start_new_idle(AnimationManager* animation_manager) {
|
static void animation_manager_start_new_idle(AnimationManager* animation_manager) {
|
||||||
furi_assert(animation_manager);
|
furi_assert(animation_manager);
|
||||||
|
|
||||||
StorageAnimation* new_animation = animation_manager_select_idle_animation(animation_manager);
|
StorageAnimation* old_animation = animation_manager->current_animation;
|
||||||
|
StorageAnimation* new_animation;
|
||||||
|
while (true) {
|
||||||
|
new_animation = animation_manager_select_idle_animation(animation_manager);
|
||||||
|
if (select_idle_animation_failed || !old_animation) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (strcmp(animation_storage_get_meta(new_animation)->name, animation_storage_get_meta(old_animation)->name) != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
animation_storage_free_storage_animation(&new_animation);
|
||||||
|
}
|
||||||
animation_manager_replace_current_animation(animation_manager, new_animation);
|
animation_manager_replace_current_animation(animation_manager, new_animation);
|
||||||
const BubbleAnimation* bubble_animation =
|
const BubbleAnimation* bubble_animation =
|
||||||
animation_storage_get_bubble_animation(animation_manager->current_animation);
|
animation_storage_get_bubble_animation(animation_manager->current_animation);
|
||||||
@@ -370,6 +383,7 @@ static bool animation_manager_is_valid_idle_animation(
|
|||||||
static StorageAnimation*
|
static StorageAnimation*
|
||||||
animation_manager_select_idle_animation(AnimationManager* animation_manager) {
|
animation_manager_select_idle_animation(AnimationManager* animation_manager) {
|
||||||
UNUSED(animation_manager);
|
UNUSED(animation_manager);
|
||||||
|
select_idle_animation_failed = false;
|
||||||
|
|
||||||
StorageAnimationList_t animation_list;
|
StorageAnimationList_t animation_list;
|
||||||
StorageAnimationList_init(animation_list);
|
StorageAnimationList_init(animation_list);
|
||||||
@@ -426,6 +440,7 @@ static StorageAnimation*
|
|||||||
FURI_LOG_E(TAG, "Can't upload animation described in manifest: \'%s\'", name);
|
FURI_LOG_E(TAG, "Can't upload animation described in manifest: \'%s\'", name);
|
||||||
animation_storage_free_storage_animation(&selected);
|
animation_storage_free_storage_animation(&selected);
|
||||||
selected = animation_storage_find_animation(HARDCODED_ANIMATION_NAME);
|
selected = animation_storage_find_animation(HARDCODED_ANIMATION_NAME);
|
||||||
|
select_idle_animation_failed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
furi_assert(selected);
|
furi_assert(selected);
|
||||||
|
|||||||
Reference in New Issue
Block a user