117 while (nIndex < mLevels.size()) {
118 if (mLevels[nIndex].mName == name) {
123 return static_cast<int>(nIndex);
340 void RebuildStageLevels();
350 int IsLevelListed(
const HxStr &name);
369 void RecountStageCompleted(
int nDifficulty,
int nStage);
379 void RecountStageScore(
int nDifficulty,
int nStage);
387 int UpdateUnlockLevel();
396 void ResetCounters();
415 std::vector<LevelStats> mLevels;
int FindLevelIndex(const HxStr &name)
Find the record for a level by name.
Definition campaignstats.h:115
CampaignStats()
Construct empty progress.
void RecordLevelBeaten(int nDifficulty, const HxStr &name)
Record a level as beaten at a difficulty and recount what depends on it.
int GetStageScore(int nDifficulty, int nStage)
Report a stage's total score at a difficulty.
int IsSecretUnlocked()
Report whether the secret stage is unlocked.
Definition campaignstats.h:253
int GetStageScoreBeaten(int nDifficulty, int nStage)
Report whether a stage's total score has reached its target at a difficulty.
void RecordHighScore(int nDifficulty, const HxStr &name, int nScore)
Record a score for a level at a difficulty when it beats the high score.
virtual void Save(OBStream &stream)
Write the whole campaign record.
int GetLevelBeaten(int nDifficulty, const HxStr &name)
Report whether a level has been beaten at a difficulty.
int IsSuperSecretUnlocked()
Report whether the super secret is unlocked.
virtual void Load(IBStream &stream)
Read the whole campaign record.
int IsDifficultyComplete(int nDifficulty)
Report whether every stage of a difficulty is complete and every bonus level beaten.
int GetLevelHighScore(int nDifficulty, const HxStr &name)
Report a level's high score at a difficulty.
int IsStageComplete(int nDifficulty, int nStage)
Report whether every required level of a stage is beaten at a difficulty.
static constexpr int kSecretStage
The secret stage, which follows the last regular stage.
Definition campaignstats.h:50
static constexpr int kDifficultyCount
The number of difficulties, easy, normal, and expert.
Definition campaignstats.h:38
static constexpr int kDifficultyExpert
The expert difficulty, the last of the three.
Definition campaignstats.h:47
HxStr GetBonusLevelName(int nDifficulty, int nStage)
Report the name of a stage's bonus level.
void RebuildLevelList()
Clear the level vector and rebuild it from the global level list.
void Assign(const CampaignStats &other)
Copy another record's levels into this one and recount everything.
int IsLastLevelRemaining(const GameParams ¶ms)
Report whether a session's level is the one level left unbeaten at its difficulty.
int mUnlockLevel
The number of arenas unlocked, 1 through 8, as UpdateUnlockLevel() last computed it.
Definition campaignstats.h:424
static constexpr int kIndexedStageCount
The number of stages whose level indices the record stores, stages 1 through 5.
Definition campaignstats.h:44
int IsStageCompleteAtAnyDifficulty(int nStage)
Report whether a stage is complete at any difficulty that plays it as a main stage.
static constexpr int kStageCount
The number of stages, the secret stage 6 included.
Definition campaignstats.h:41
void PrintLevels(std::ostream &stream)
Write every level to a text stream, one line each as levels[<i>] and the level's own text.
void MergeLevelList()
Rebuild the level vector from the global level list after a load.
Settings a game session is started with.
Definition gameparams.h:42
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Input half of the byte stream interface.
Definition ibstream.h:36
Output half of the byte stream interface.
Definition obstream.h:25
std::vector< StageListEntry > * GetStageList(int nStage)
Report one stage's level list.