Jazz2::Editor::PlayPathHistory class

Paths the player took in the last play-tests of a level.

Kept in the editor-only chunk ppth of the level (see Formats::LevelFile::IsEditorOnlyChunk()), so the paths are still there when the level is opened again, and the deaths of all of them can be shown together. The chunk starts with a version byte, then the number of paths, each with its time in frames, whether the level was finished, and its segments of points as differences from the previous point with the speed of the player there, a path thinned out to a few thousand points.

Public static variables

static std::uint32_t Chunk constexpr
Tag of the chunk the paths are kept in.
static std::uint8_t Version constexpr
Version of the chunk, a chunk of another one is left alone until new paths are written over it.
static std::int32_t MaxPaths constexpr
Most paths kept, the oldest go first.
static std::int32_t MaxStoredPoints constexpr
Most points of a path written into the level.

Public static functions

static auto SelfTest() -> std::int32_t
Writes paths into a level and reads them back, returns the number of problems found, see EditorSelfTest.

Public functions

void Clear()
Forgets all paths.
auto IsEmpty() const -> bool
Returns true if there is no path.
void Update(const PlayPath& path, std::uint32_t playTest)
Adds the path of a play-test.
auto GetPaths() const -> ArrayView<const PlayPath>
Returns the paths, the oldest first.
auto GetRevision() const -> std::uint32_t
Returns a number that changes whenever the paths change, so what is made of them can be kept until then.
void CollectDeaths(SmallVectorImpl<Vector2f>& positions) const
Returns the places where the player died in all paths.
auto GetBestExitTime() const -> float
Returns the shortest time of the paths in which the level was finished, in frames, or -1.
auto GetTotalDeaths() const -> std::int32_t
Returns how many times the player died in all paths.
auto Read(const LevelDocument& document) -> bool
Reads the paths from the level, returns false if it has none or they can't be read.
void Write(LevelDocument& document) const
Writes the paths into the level.

Function documentation

void Jazz2::Editor::PlayPathHistory::Update(const PlayPath& path, std::uint32_t playTest)

Adds the path of a play-test.

A play-test that goes on after it was left keeps its path, so the path of the same playTest replaces the last one instead.