From 534b04ccc5cf09181e41ff4a08aa50cac0eac26f Mon Sep 17 00:00:00 2001 From: nthnn Date: Tue, 19 Mar 2024 12:42:37 +0800 Subject: [PATCH] Updated facial animation classes. --- src/scenes/tomo_blink.cpp | 13 +++++++------ src/scenes/tomo_closing_eyes.cpp | 25 ++++++++++++------------- src/scenes/tomo_exhausted.cpp | 26 +++++++++++++------------- src/scenes/tomo_interrupt.cpp | 13 +++++++++---- src/scenes/tomo_interrupta.cpp | 8 ++++---- src/scenes/tomo_left.cpp | 28 ++++++++++++++-------------- src/scenes/tomo_left_lift.cpp | 30 +++++++++++++++--------------- src/scenes/tomo_opening_eyes.cpp | 24 ++++++++++++------------ src/scenes/tomo_rest.cpp | 9 +++++---- src/scenes/tomo_right.cpp | 28 ++++++++++++++-------------- src/scenes/tomo_right_lift.cpp | 30 +++++++++++++++--------------- src/scenes/tomo_sleeping.cpp | 12 ++++++------ 12 files changed, 126 insertions(+), 120 deletions(-) diff --git a/src/scenes/tomo_blink.cpp b/src/scenes/tomo_blink.cpp index 1713256..004eb71 100644 --- a/src/scenes/tomo_blink.cpp +++ b/src/scenes/tomo_blink.cpp @@ -1,19 +1,20 @@ #include #include +#include #include #include -TomoBlinkScene::TomoBlinkScene() { - this->hasNoInterrupt(); -} +TomoBlinkScene::TomoBlinkScene() { } void TomoBlinkScene::rendition() { - if(TomoScene::renderScene(1)) + if(TomoScene::renderScene()) return; - if(TomoScene::renderScene(1)) + if(TomoScene::renderScene()) return; } -void TomoBlinkScene::onInteract() { } \ No newline at end of file +void TomoBlinkScene::onInteract() { + TomoScene::renderScene(); +} \ No newline at end of file diff --git a/src/scenes/tomo_closing_eyes.cpp b/src/scenes/tomo_closing_eyes.cpp index ced530a..d838d2e 100644 --- a/src/scenes/tomo_closing_eyes.cpp +++ b/src/scenes/tomo_closing_eyes.cpp @@ -538,20 +538,19 @@ const uint8_t tomo_closing_eyes_8[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -TomoClosingEyesScene::TomoClosingEyesScene() { } +TomoClosingEyesScene::TomoClosingEyesScene() { + this->hasNoInterrupt(); +} void TomoClosingEyesScene::rendition() { - TomoDisplay::renderBitmap(tomo_closing_eyes_1), delay(1000); - TomoDisplay::renderBitmap(tomo_closing_eyes_2), delay(5); - TomoDisplay::renderBitmap(tomo_closing_eyes_3), delay(5); - TomoDisplay::renderBitmap(tomo_closing_eyes_4), delay(5); - TomoDisplay::renderBitmap(tomo_closing_eyes_5), delay(5); - TomoDisplay::renderBitmap(tomo_closing_eyes_6), delay(5); - TomoDisplay::renderBitmap(tomo_closing_eyes_7), delay(5); - TomoDisplay::renderBitmap(tomo_closing_eyes_8), delay(5); + TomoDisplay::renderBitmap(tomo_closing_eyes_1, 1000); + TomoDisplay::renderBitmap(tomo_closing_eyes_2); + TomoDisplay::renderBitmap(tomo_closing_eyes_3); + TomoDisplay::renderBitmap(tomo_closing_eyes_4); + TomoDisplay::renderBitmap(tomo_closing_eyes_5); + TomoDisplay::renderBitmap(tomo_closing_eyes_6); + TomoDisplay::renderBitmap(tomo_closing_eyes_7); + TomoDisplay::renderBitmap(tomo_closing_eyes_8); } -void TomoClosingEyesScene::onInteract() { - TomoScene::renderScene(1, false); - TomoScene::renderScene(1); -} \ No newline at end of file +void TomoClosingEyesScene::onInteract() { } \ No newline at end of file diff --git a/src/scenes/tomo_exhausted.cpp b/src/scenes/tomo_exhausted.cpp index 32b7e32..d413886 100644 --- a/src/scenes/tomo_exhausted.cpp +++ b/src/scenes/tomo_exhausted.cpp @@ -206,19 +206,19 @@ TomoExhaustedScene::TomoExhaustedScene() { } void TomoExhaustedScene::rendition() { - TomoDisplay::renderBitmap(tomo_exhausted_1), delay(5); - TomoDisplay::renderBitmap(tomo_exhausted_2), delay(50); - TomoDisplay::renderBitmap(tomo_exhausted_3), delay(400); - TomoDisplay::renderBitmap(tomo_exhausted_2), delay(50); - TomoDisplay::renderBitmap(tomo_exhausted_1), delay(5); - TomoDisplay::renderBitmap(tomo_exhausted_2), delay(50); - TomoDisplay::renderBitmap(tomo_exhausted_3), delay(800); - TomoDisplay::renderBitmap(tomo_exhausted_2), delay(50); - TomoDisplay::renderBitmap(tomo_exhausted_1), delay(5); - TomoDisplay::renderBitmap(tomo_exhausted_2), delay(50); - TomoDisplay::renderBitmap(tomo_exhausted_3), delay(1000); - TomoDisplay::renderBitmap(tomo_exhausted_2), delay(50); - TomoDisplay::renderBitmap(tomo_exhausted_1), delay(5); + TomoDisplay::renderBitmap(tomo_exhausted_1); + TomoDisplay::renderBitmap(tomo_exhausted_2, 50); + TomoDisplay::renderBitmap(tomo_exhausted_3, 400); + TomoDisplay::renderBitmap(tomo_exhausted_2, 50); + TomoDisplay::renderBitmap(tomo_exhausted_1); + TomoDisplay::renderBitmap(tomo_exhausted_2, 50); + TomoDisplay::renderBitmap(tomo_exhausted_3, 800); + TomoDisplay::renderBitmap(tomo_exhausted_2, 50); + TomoDisplay::renderBitmap(tomo_exhausted_1); + TomoDisplay::renderBitmap(tomo_exhausted_2, 50); + TomoDisplay::renderBitmap(tomo_exhausted_3, 1000); + TomoDisplay::renderBitmap(tomo_exhausted_2, 50); + TomoDisplay::renderBitmap(tomo_exhausted_1); } void TomoExhaustedScene::onInteract() { } \ No newline at end of file diff --git a/src/scenes/tomo_interrupt.cpp b/src/scenes/tomo_interrupt.cpp index 22faedb..b2690c1 100644 --- a/src/scenes/tomo_interrupt.cpp +++ b/src/scenes/tomo_interrupt.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -11,17 +12,21 @@ TomoInterruptScene::TomoInterruptScene() { } void TomoInterruptScene::rendition() { - switch(TomoRNGEngine::get(0, 2)) { + switch(TomoRNGEngine::get(0, 3)) { + case TOMO_INT_ANGRY: + TomoScene::renderScene(); + break; + case TOMO_INT_A: - TomoScene::renderScene(1); + TomoScene::renderScene(); break; case TOMO_INT_LEFT_LIFT: - TomoScene::renderScene(1); + TomoScene::renderScene(); break; case TOMO_INT_RIGHT_LIFT: - TomoScene::renderScene(1); + TomoScene::renderScene(); break; } } diff --git a/src/scenes/tomo_interrupta.cpp b/src/scenes/tomo_interrupta.cpp index 8e7ab74..457cd5c 100644 --- a/src/scenes/tomo_interrupta.cpp +++ b/src/scenes/tomo_interrupta.cpp @@ -206,10 +206,10 @@ TomoInterruptAScene::TomoInterruptAScene() { } void TomoInterruptAScene::rendition() { - TomoDisplay::renderBitmap(tomo_interrupta_1), delay(50); - TomoDisplay::renderBitmap(tomo_interrupta_2), delay(1000); - TomoDisplay::renderBitmap(tomo_interrupta_3), delay(60); - TomoDisplay::renderBitmap(tomo_interrupta_1), delay(50); + TomoDisplay::renderBitmap(tomo_interrupta_1, 50); + TomoDisplay::renderBitmap(tomo_interrupta_2, 1000); + TomoDisplay::renderBitmap(tomo_interrupta_3, 60); + TomoDisplay::renderBitmap(tomo_interrupta_1, 50); } void TomoInterruptAScene::onInteract() { } \ No newline at end of file diff --git a/src/scenes/tomo_left.cpp b/src/scenes/tomo_left.cpp index b17fb8f..6f283e3 100644 --- a/src/scenes/tomo_left.cpp +++ b/src/scenes/tomo_left.cpp @@ -541,20 +541,20 @@ TomoLeftScene::TomoLeftScene() { } void TomoLeftScene::rendition() { - TomoDisplay::renderBitmap(tomo_left_1), delay(1000); - TomoDisplay::renderBitmap(tomo_left_2), delay(5); - TomoDisplay::renderBitmap(tomo_left_3), delay(5); - TomoDisplay::renderBitmap(tomo_left_4), delay(5); - TomoDisplay::renderBitmap(tomo_left_5), delay(5); - TomoDisplay::renderBitmap(tomo_left_6), delay(5); - TomoDisplay::renderBitmap(tomo_left_7), delay(5); - TomoDisplay::renderBitmap(tomo_left_8), delay(1000); - TomoDisplay::renderBitmap(tomo_left_7), delay(5); - TomoDisplay::renderBitmap(tomo_left_6), delay(5); - TomoDisplay::renderBitmap(tomo_left_5), delay(5); - TomoDisplay::renderBitmap(tomo_left_4), delay(5); - TomoDisplay::renderBitmap(tomo_left_3), delay(5); - TomoDisplay::renderBitmap(tomo_left_2), delay(5); + TomoDisplay::renderBitmap(tomo_left_1, 1000); + TomoDisplay::renderBitmap(tomo_left_2); + TomoDisplay::renderBitmap(tomo_left_3); + TomoDisplay::renderBitmap(tomo_left_4); + TomoDisplay::renderBitmap(tomo_left_5); + TomoDisplay::renderBitmap(tomo_left_6); + TomoDisplay::renderBitmap(tomo_left_7); + TomoDisplay::renderBitmap(tomo_left_8, 1000); + TomoDisplay::renderBitmap(tomo_left_7); + TomoDisplay::renderBitmap(tomo_left_6); + TomoDisplay::renderBitmap(tomo_left_5); + TomoDisplay::renderBitmap(tomo_left_4); + TomoDisplay::renderBitmap(tomo_left_3); + TomoDisplay::renderBitmap(tomo_left_2); } void TomoLeftScene::onInteract() { } \ No newline at end of file diff --git a/src/scenes/tomo_left_lift.cpp b/src/scenes/tomo_left_lift.cpp index d0d798d..f050062 100644 --- a/src/scenes/tomo_left_lift.cpp +++ b/src/scenes/tomo_left_lift.cpp @@ -541,21 +541,21 @@ TomoLeftLiftScene::TomoLeftLiftScene() { } void TomoLeftLiftScene::rendition() { - TomoDisplay::renderBitmap(tomo_left_lift_1), delay(5); - TomoDisplay::renderBitmap(tomo_left_lift_2), delay(5); - TomoDisplay::renderBitmap(tomo_left_lift_3), delay(5); - TomoDisplay::renderBitmap(tomo_left_lift_4), delay(5); - TomoDisplay::renderBitmap(tomo_left_lift_5), delay(5); - TomoDisplay::renderBitmap(tomo_left_lift_6), delay(5); - TomoDisplay::renderBitmap(tomo_left_lift_7), delay(5); - TomoDisplay::renderBitmap(tomo_left_lift_8), delay(1000); - TomoDisplay::renderBitmap(tomo_left_lift_7), delay(5); - TomoDisplay::renderBitmap(tomo_left_lift_6), delay(5); - TomoDisplay::renderBitmap(tomo_left_lift_5), delay(5); - TomoDisplay::renderBitmap(tomo_left_lift_4), delay(5); - TomoDisplay::renderBitmap(tomo_left_lift_3), delay(5); - TomoDisplay::renderBitmap(tomo_left_lift_2), delay(5); - TomoDisplay::renderBitmap(tomo_left_lift_1), delay(5); + TomoDisplay::renderBitmap(tomo_left_lift_1); + TomoDisplay::renderBitmap(tomo_left_lift_2); + TomoDisplay::renderBitmap(tomo_left_lift_3); + TomoDisplay::renderBitmap(tomo_left_lift_4); + TomoDisplay::renderBitmap(tomo_left_lift_5); + TomoDisplay::renderBitmap(tomo_left_lift_6); + TomoDisplay::renderBitmap(tomo_left_lift_7); + TomoDisplay::renderBitmap(tomo_left_lift_8, 1000); + TomoDisplay::renderBitmap(tomo_left_lift_7); + TomoDisplay::renderBitmap(tomo_left_lift_6); + TomoDisplay::renderBitmap(tomo_left_lift_5); + TomoDisplay::renderBitmap(tomo_left_lift_4); + TomoDisplay::renderBitmap(tomo_left_lift_3); + TomoDisplay::renderBitmap(tomo_left_lift_2); + TomoDisplay::renderBitmap(tomo_left_lift_1); } void TomoLeftLiftScene::onInteract() { } \ No newline at end of file diff --git a/src/scenes/tomo_opening_eyes.cpp b/src/scenes/tomo_opening_eyes.cpp index 6a2edf2..0258e07 100644 --- a/src/scenes/tomo_opening_eyes.cpp +++ b/src/scenes/tomo_opening_eyes.cpp @@ -1,5 +1,7 @@ #include -#include +#include + +#include const uint8_t tomo_opening_eyes_1[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -542,16 +544,14 @@ TomoOpeningEyesScene::TomoOpeningEyesScene() { } void TomoOpeningEyesScene::rendition() { - TomoDisplay::renderBitmap(tomo_opening_eyes_1), delay(5); - TomoDisplay::renderBitmap(tomo_opening_eyes_2), delay(5); - TomoDisplay::renderBitmap(tomo_opening_eyes_3), delay(5); - TomoDisplay::renderBitmap(tomo_opening_eyes_4), delay(5); - TomoDisplay::renderBitmap(tomo_opening_eyes_5), delay(5); - TomoDisplay::renderBitmap(tomo_opening_eyes_6), delay(5); - TomoDisplay::renderBitmap(tomo_opening_eyes_7), delay(5); - TomoDisplay::renderBitmap(tomo_opening_eyes_8), delay(1000); + TomoDisplay::renderBitmap(tomo_opening_eyes_1); + TomoDisplay::renderBitmap(tomo_opening_eyes_2); + TomoDisplay::renderBitmap(tomo_opening_eyes_3); + TomoDisplay::renderBitmap(tomo_opening_eyes_4); + TomoDisplay::renderBitmap(tomo_opening_eyes_5); + TomoDisplay::renderBitmap(tomo_opening_eyes_6); + TomoDisplay::renderBitmap(tomo_opening_eyes_7); + TomoDisplay::renderBitmap(tomo_opening_eyes_8, 1000); } -void TomoOpeningEyesScene::onInteract() { - TomoScene::renderScene(1); -} \ No newline at end of file +void TomoOpeningEyesScene::onInteract() { } \ No newline at end of file diff --git a/src/scenes/tomo_rest.cpp b/src/scenes/tomo_rest.cpp index cb9630d..4b0947e 100644 --- a/src/scenes/tomo_rest.cpp +++ b/src/scenes/tomo_rest.cpp @@ -4,6 +4,7 @@ #include #include +#include #include TomoRestScene::TomoRestScene() { @@ -11,16 +12,16 @@ TomoRestScene::TomoRestScene() { } void TomoRestScene::rendition() { - if(TomoScene::renderScene(1)) + if(TomoScene::renderScene()) return; - if(TomoScene::renderScene(1)) + if(TomoScene::renderScene()) return; - if(TomoScene::renderScene(12)) + if(TomoScene::renderScene(TomoRNGEngine::get(0, 12))) return; - if(TomoScene::renderScene(1)) + if(TomoScene::renderScene()) return; } diff --git a/src/scenes/tomo_right.cpp b/src/scenes/tomo_right.cpp index 5ccb6a3..6e88bfd 100644 --- a/src/scenes/tomo_right.cpp +++ b/src/scenes/tomo_right.cpp @@ -541,20 +541,20 @@ TomoRightScene::TomoRightScene() { } void TomoRightScene::rendition() { - TomoDisplay::renderBitmap(tomo_right_1), delay(1000); - TomoDisplay::renderBitmap(tomo_right_2), delay(5); - TomoDisplay::renderBitmap(tomo_right_3), delay(5); - TomoDisplay::renderBitmap(tomo_right_4), delay(5); - TomoDisplay::renderBitmap(tomo_right_5), delay(5); - TomoDisplay::renderBitmap(tomo_right_6), delay(5); - TomoDisplay::renderBitmap(tomo_right_7), delay(5); - TomoDisplay::renderBitmap(tomo_right_8), delay(1000); - TomoDisplay::renderBitmap(tomo_right_7), delay(5); - TomoDisplay::renderBitmap(tomo_right_6), delay(5); - TomoDisplay::renderBitmap(tomo_right_5), delay(5); - TomoDisplay::renderBitmap(tomo_right_4), delay(5); - TomoDisplay::renderBitmap(tomo_right_3), delay(5); - TomoDisplay::renderBitmap(tomo_right_2), delay(5); + TomoDisplay::renderBitmap(tomo_right_1, 1000); + TomoDisplay::renderBitmap(tomo_right_2); + TomoDisplay::renderBitmap(tomo_right_3); + TomoDisplay::renderBitmap(tomo_right_4); + TomoDisplay::renderBitmap(tomo_right_5); + TomoDisplay::renderBitmap(tomo_right_6); + TomoDisplay::renderBitmap(tomo_right_7); + TomoDisplay::renderBitmap(tomo_right_8, 1000); + TomoDisplay::renderBitmap(tomo_right_7); + TomoDisplay::renderBitmap(tomo_right_6); + TomoDisplay::renderBitmap(tomo_right_5); + TomoDisplay::renderBitmap(tomo_right_4); + TomoDisplay::renderBitmap(tomo_right_3); + TomoDisplay::renderBitmap(tomo_right_2); } void TomoRightScene::onInteract() { } \ No newline at end of file diff --git a/src/scenes/tomo_right_lift.cpp b/src/scenes/tomo_right_lift.cpp index 6596529..71c67c8 100644 --- a/src/scenes/tomo_right_lift.cpp +++ b/src/scenes/tomo_right_lift.cpp @@ -541,21 +541,21 @@ TomoRightLiftScene::TomoRightLiftScene() { } void TomoRightLiftScene::rendition() { - TomoDisplay::renderBitmap(tomo_right_lift_1), delay(5); - TomoDisplay::renderBitmap(tomo_right_lift_2), delay(5); - TomoDisplay::renderBitmap(tomo_right_lift_3), delay(5); - TomoDisplay::renderBitmap(tomo_right_lift_4), delay(5); - TomoDisplay::renderBitmap(tomo_right_lift_5), delay(5); - TomoDisplay::renderBitmap(tomo_right_lift_6), delay(5); - TomoDisplay::renderBitmap(tomo_right_lift_7), delay(5); - TomoDisplay::renderBitmap(tomo_right_lift_8), delay(1000); - TomoDisplay::renderBitmap(tomo_right_lift_7), delay(5); - TomoDisplay::renderBitmap(tomo_right_lift_6), delay(5); - TomoDisplay::renderBitmap(tomo_right_lift_5), delay(5); - TomoDisplay::renderBitmap(tomo_right_lift_4), delay(5); - TomoDisplay::renderBitmap(tomo_right_lift_3), delay(5); - TomoDisplay::renderBitmap(tomo_right_lift_2), delay(5); - TomoDisplay::renderBitmap(tomo_right_lift_1), delay(5); + TomoDisplay::renderBitmap(tomo_right_lift_1); + TomoDisplay::renderBitmap(tomo_right_lift_2); + TomoDisplay::renderBitmap(tomo_right_lift_3); + TomoDisplay::renderBitmap(tomo_right_lift_4); + TomoDisplay::renderBitmap(tomo_right_lift_5); + TomoDisplay::renderBitmap(tomo_right_lift_6); + TomoDisplay::renderBitmap(tomo_right_lift_7); + TomoDisplay::renderBitmap(tomo_right_lift_8, 1000); + TomoDisplay::renderBitmap(tomo_right_lift_7); + TomoDisplay::renderBitmap(tomo_right_lift_6); + TomoDisplay::renderBitmap(tomo_right_lift_5); + TomoDisplay::renderBitmap(tomo_right_lift_4); + TomoDisplay::renderBitmap(tomo_right_lift_3); + TomoDisplay::renderBitmap(tomo_right_lift_2); + TomoDisplay::renderBitmap(tomo_right_lift_1); } void TomoRightLiftScene::onInteract() { } \ No newline at end of file diff --git a/src/scenes/tomo_sleeping.cpp b/src/scenes/tomo_sleeping.cpp index 627f3b2..1932682 100644 --- a/src/scenes/tomo_sleeping.cpp +++ b/src/scenes/tomo_sleeping.cpp @@ -406,12 +406,12 @@ const uint8_t tomo_sleeping_6[] PROGMEM = { TomoSleepingScene::TomoSleepingScene() { } void TomoSleepingScene::rendition() { - TomoDisplay::renderBitmap(tomo_sleeping_1), delay(100); - TomoDisplay::renderBitmap(tomo_sleeping_2), delay(100); - TomoDisplay::renderBitmap(tomo_sleeping_3), delay(100); - TomoDisplay::renderBitmap(tomo_sleeping_4), delay(100); - TomoDisplay::renderBitmap(tomo_sleeping_5), delay(100); - TomoDisplay::renderBitmap(tomo_sleeping_6), delay(100); + TomoDisplay::renderBitmap(tomo_sleeping_1, 100); + TomoDisplay::renderBitmap(tomo_sleeping_2, 100); + TomoDisplay::renderBitmap(tomo_sleeping_3, 100); + TomoDisplay::renderBitmap(tomo_sleeping_4, 100); + TomoDisplay::renderBitmap(tomo_sleeping_5, 100); + TomoDisplay::renderBitmap(tomo_sleeping_6, 100); } void TomoSleepingScene::onInteract() {