Files
shweets-sim/src/dialogue.h
T

48 lines
1.2 KiB
C++

#pragma once
#include "character.h"
class Play;
enum TextMode
{
TEXT_INTERRUPTIBLE,
TEXT_UNINTERRUPTIBLE,
TEXT_SEQUENCE
};
// Plays out a dialogue entry's lines a character at a time with their effects, then offers its choices or the entry it
// leads to. A scene holds the game still until its last entry finishes. The UI shows it and passes on the player's input.
class Text
{
public:
std::string idleOnEnd;
Entry* entry = nullptr;
float animationTimePrevious = 0;
float life = 0;
int delay = 0;
int delayBase = 0;
int index = 0;
int line = 0;
int tick = 0;
bool isAnimationStarted = false;
bool isBlipQueued = false;
bool isFinished = false;
bool isScene = false;
bool isStarted = false;
void set(Play& play, Entry* next, TextMode mode = TEXT_INTERRUPTIBLE, const std::string& onEnd = "");
void update(Play& play);
void advance(Play& play);
void choose(Play& play, int choice);
void clear(Play& play);
Line* line_get();
bool is_interruptible();
bool is_last_line();
private:
void effects_apply(Play& play, int at);
void finish(Play& play);
void line_start(Play& play, int index, Interrupt interrupt);
};