diff --git a/assets/0002AfterMainstation.mp3 b/assets/0002AfterMainstation.mp3 index 40bde85..d712de1 100644 --- a/assets/0002AfterMainstation.mp3 +++ b/assets/0002AfterMainstation.mp3 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:121cf70913522060d0dc273c4d7b98d73bc147895e13f3d987108b16515e0a3b -size 185472 +oid sha256:d62be81090dc60237585f64d22cbbd659146569807394f6b8c99cee5068beaa6 +size 337152 diff --git a/assets/0012HackingTobione.mp3 b/assets/0012HackingTobione.mp3 index b73a808..96db91f 100644 --- a/assets/0012HackingTobione.mp3 +++ b/assets/0012HackingTobione.mp3 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:42d9b18e9fd14c9a0bc2cd87ffe02fb88c2171eda0133fcb77023f31d8d17f59 -size 801600 +oid sha256:5e57161e59f565b14c7819844768e9871d0f983597bed8033852e2895d55c881 +size 736800 diff --git a/assets/0015End.mp3 b/assets/0015End.mp3 index bd9154a..9754bce 100644 --- a/assets/0015End.mp3 +++ b/assets/0015End.mp3 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:64ab0f541e5fe67b9f3663b0fc87ad77ddd217df05dc31bf546138fc0a2e5e9e -size 791520 +oid sha256:ee259ea16340622bd563297bc4dd3672cdcc9d3818612d5549d9f6d52c42de99 +size 911520 diff --git a/src/audioState.h b/src/audioState.h index c3f26f1..4bdfc1d 100644 --- a/src/audioState.h +++ b/src/audioState.h @@ -1,12 +1,9 @@ -#pragma once -#include -#include - #pragma once #include #include #include + inline void printMp3Detail(const uint8_t type, const int value) { Serial.println(); // Add a newline before printing the details diff --git a/src/states.cpp b/src/states.cpp index 5446753..6e30087 100644 --- a/src/states.cpp +++ b/src/states.cpp @@ -76,7 +76,7 @@ State* StartInstructions::putDown(const Context context, Station* newStation) if (newStation == context.stations) { - return new WaitingForGameStart(); // todo replace with Restarting + return new Restarting(); } return new IncorrectStation(targetStation, context.stations); } @@ -125,7 +125,7 @@ State* OnTheMove::putDown(const Context context, Station* newStation) } if (newStation == context.stations) { - return new WaitingForGameStart(); // todo replace with Restarting + return new Restarting(); } return new IncorrectStation(targetStation, previousStation); @@ -168,23 +168,23 @@ void OnTheMove::activated(const Context context) const int index = context.getStationIndex(this->targetStation); if (index == 0) { - context.dfPlayer->play(AFTER_TOBIONE); + context.dfPlayer->loop(AFTER_TOBIONE); } else if (index == 1) { - context.dfPlayer->play(AFTER_MAIN_STATION); + context.dfPlayer->loop(AFTER_MAIN_STATION); } else if (index == 2) { - context.dfPlayer->play(AFTER_MUHVELLA); + context.dfPlayer->loop(AFTER_MUHVELLA); } else if (index == 3) { - context.dfPlayer->play(AFTER_MAGIE); + context.dfPlayer->loop(AFTER_MAGIE); } else if (index == 4) { - context.dfPlayer->play(AFTER_BICOLA); + context.dfPlayer->loop(AFTER_BICOLA); } } @@ -316,10 +316,10 @@ State* Complain::putDown(const Context context, Station* newStation) } return new Hacking(this->currentStation); } - if (newStation == context.stations) // if was incorrectly put back on main station - { - return new WaitingForGameStart(); // todo return Restarting - } + if (newStation == context.stations) // if was incorrectly put back on main station + { + return new Restarting(); + } return this; // was not put back on correct station (just keeps complaining) } @@ -410,7 +410,6 @@ End::End(): timer(Timer(0, false)) State* End::pickedUp(const Context context) { - // todo complain return new Complain(context.stations); } @@ -419,7 +418,7 @@ State* End::update(const Context context) const bool done = timer.update(context.delta); if (done) { - return new WaitingForGameStart(); + return new Restarting(); } return this; } @@ -435,3 +434,37 @@ void End::activated(const Context context) timer = Timer(38000, false); timer.start(); } + + +//------------------------------------ + + +Restarting::Restarting(): timer(Timer(10000, false)) +{ +} + +State* Restarting::pickedUp(const Context context) +{ + return new StartInstructions(context.stations + 1); // starting despite not beeing in waiting for game start +} + +State* Restarting::update(const Context context) +{ + const bool done = timer.update(context.delta); + if (done) + { + return new WaitingForGameStart(); + } + return this; +} + +String Restarting::updateDisplay(const Context& context) +{ + return "RESTARTING......"; // todo +} + +void Restarting::activated(const Context context) +{ + timer.start(); + context.dfPlayer->stop(); +} diff --git a/src/states.h b/src/states.h index 2dc6913..869334e 100644 --- a/src/states.h +++ b/src/states.h @@ -122,3 +122,15 @@ public: String updateDisplay(const Context& context) override; void activated(Context context) override; }; + +class Restarting final : public State +{ +protected: + Timer timer; +public: + Restarting(); + State* pickedUp(Context context) override; + State* update(Context context) override; + String updateDisplay(const Context& context) override; + void activated(Context context) override; +};