diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-11 20:47:46 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-11 20:47:46 -0500 |
commit | ec511705ce96d80d4e2a36054769c211448e8ec8 (patch) | |
tree | e0a70671430a84472024d54b934df3248924ec4d /src/message_system.h | |
parent | d9be54853910c2086013846661e0dc4a8603c20e (diff) | |
download | tanetane-ec511705ce96d80d4e2a36054769c211448e8ec8.tar.gz tanetane-ec511705ce96d80d4e2a36054769c211448e8ec8.tar.bz2 tanetane-ec511705ce96d80d4e2a36054769c211448e8ec8.zip |
Added choice prompts
"A presses" are also no longer special values in the lines list, but are rather a field on the MessageLine object.
Diffstat (limited to 'src/message_system.h')
-rw-r--r-- | src/message_system.h | 26 |
1 files changed, 20 insertions, 6 deletions
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 { | |||
18 | Nonhuman | 18 | Nonhuman |
19 | }; | 19 | }; |
20 | 20 | ||
21 | struct MessageLine { | ||
22 | std::string text; | ||
23 | int charsRevealed = 0; | ||
24 | bool pause = false; | ||
25 | bool isChoice = false; | ||
26 | int choicePos[2] = {-1, -1}; | ||
27 | }; | ||
28 | |||
21 | class MessageSystem : public System { | 29 | class MessageSystem : public System { |
22 | public: | 30 | public: |
23 | 31 | ||
@@ -41,17 +49,18 @@ public: | |||
41 | std::string speakerName = "", | 49 | std::string speakerName = "", |
42 | SpeakerType speakerType = SpeakerType::None); | 50 | SpeakerType speakerType = SpeakerType::None); |
43 | 51 | ||
52 | void showChoice(std::string choice1, std::string choice2); | ||
53 | |||
44 | void advanceText(); | 54 | void advanceText(); |
45 | 55 | ||
56 | void selectFirstChoice(); | ||
57 | |||
58 | void selectSecondChoice(); | ||
59 | |||
46 | // Info | 60 | // Info |
47 | 61 | ||
48 | double getCutsceneBarsProgress() const; | 62 | double getCutsceneBarsProgress() const; |
49 | 63 | ||
50 | struct MessageLine { | ||
51 | std::string text; | ||
52 | int charsRevealed = 0; | ||
53 | }; | ||
54 | |||
55 | const std::list<MessageLine>& getLines() const { return linesToShow_; } | 64 | const std::list<MessageLine>& getLines() const { return linesToShow_; } |
56 | 65 | ||
57 | bool isMessageActive() const { return !linesToShow_.empty(); } | 66 | bool isMessageActive() const { return !linesToShow_.empty(); } |
@@ -62,6 +71,10 @@ public: | |||
62 | 71 | ||
63 | int getNextArrowBob() const { return nextArrowBobPos_; } | 72 | int getNextArrowBob() const { return nextArrowBobPos_; } |
64 | 73 | ||
74 | bool isChoiceActive() const { return isMessageActive() && linesToShow_.back().isChoice; } | ||
75 | |||
76 | int getChoiceSelection() const { return choiceSelection_; } | ||
77 | |||
65 | private: | 78 | private: |
66 | 79 | ||
67 | enum class BarsState { | 80 | enum class BarsState { |
@@ -77,13 +90,14 @@ private: | |||
77 | double length_ = 1000.0/8; | 90 | double length_ = 1000.0/8; |
78 | SpeakerType speaker_ = SpeakerType::None; | 91 | SpeakerType speaker_ = SpeakerType::None; |
79 | std::string speakerName_; | 92 | std::string speakerName_; |
80 | std::list<std::string> lines_; | 93 | std::list<MessageLine> lines_; |
81 | std::list<MessageLine> linesToShow_; | 94 | std::list<MessageLine> linesToShow_; |
82 | Timer textAdvTimer_ { 15 }; | 95 | Timer textAdvTimer_ { 15 }; |
83 | bool showNextArrow_ = false; | 96 | bool showNextArrow_ = false; |
84 | int nextArrowBobPos_ = 0; | 97 | int nextArrowBobPos_ = 0; |
85 | bool nextArrowBobDown_ = true; | 98 | bool nextArrowBobDown_ = true; |
86 | Timer nextArrowBobTimer_ { 125 }; | 99 | Timer nextArrowBobTimer_ { 125 }; |
100 | int choiceSelection_ = 0; | ||
87 | }; | 101 | }; |
88 | 102 | ||
89 | #endif /* end of include guard: MESSAGE_SYSTEM_H_DE10D011 */ | 103 | #endif /* end of include guard: MESSAGE_SYSTEM_H_DE10D011 */ |