From ec511705ce96d80d4e2a36054769c211448e8ec8 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 11 Feb 2021 20:47:46 -0500 Subject: Added choice prompts "A presses" are also no longer special values in the lines list, but are rather a field on the MessageLine object. --- src/message_system.h | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/message_system.h') diff --git a/src/message_system.h b/src/message_system.h index 155f9c6..ea27f14 100644 --- a/src/message_system.h +++ b/src/message_system.h @@ -18,6 +18,14 @@ enum class SpeakerType { Nonhuman }; +struct MessageLine { + std::string text; + int charsRevealed = 0; + bool pause = false; + bool isChoice = false; + int choicePos[2] = {-1, -1}; +}; + class MessageSystem : public System { public: @@ -41,17 +49,18 @@ public: std::string speakerName = "", SpeakerType speakerType = SpeakerType::None); + void showChoice(std::string choice1, std::string choice2); + void advanceText(); + void selectFirstChoice(); + + void selectSecondChoice(); + // Info double getCutsceneBarsProgress() const; - struct MessageLine { - std::string text; - int charsRevealed = 0; - }; - const std::list& getLines() const { return linesToShow_; } bool isMessageActive() const { return !linesToShow_.empty(); } @@ -62,6 +71,10 @@ public: int getNextArrowBob() const { return nextArrowBobPos_; } + bool isChoiceActive() const { return isMessageActive() && linesToShow_.back().isChoice; } + + int getChoiceSelection() const { return choiceSelection_; } + private: enum class BarsState { @@ -77,13 +90,14 @@ private: double length_ = 1000.0/8; SpeakerType speaker_ = SpeakerType::None; std::string speakerName_; - std::list lines_; + std::list lines_; std::list linesToShow_; Timer textAdvTimer_ { 15 }; bool showNextArrow_ = false; int nextArrowBobPos_ = 0; bool nextArrowBobDown_ = true; Timer nextArrowBobTimer_ { 125 }; + int choiceSelection_ = 0; }; #endif /* end of include guard: MESSAGE_SYSTEM_H_DE10D011 */ -- cgit 1.4.1