LevelCheck.h file
Namespaces
- namespace Jazz2
- Root namespace of Jazz² Resurrection.
- namespace Jazz2::Editor
Classes
- struct Jazz2::Editor::LevelProblem
- A problem found in a level, see CheckLevel().
Enums
-
enum class LevelProblemSeverity : std::
uint8_t { Error, Warning, Info } - How bad a problem of a level is.
-
enum class LevelProblemFix : std::
uint8_t { None, RemoveWarp, AddWarpTarget, AddStart, AddMultiplayerStart, AddCtfBase } - How a problem of a level can be fixed by a click, see LevelProblem::
Fix.
Functions
- void CheckLevel(const LevelDocument& document, SmallVectorImpl<LevelProblem>& problems)
- Looks for what's probably wrong in a level.
- void CheckReachability(IEditorContext& session, SmallVectorImpl<LevelProblem>& problems)
- Adds what the player can't get to from the start: an exit, and things to collect, see EditorSession::
ComputeReachability(). - void CheckLayerTiles(IEditorContext& session, SmallVectorImpl<LevelProblem>& problems)
- Adds problems of tiles that need their tile sets to tell, as tiles in palette colors on a layer drawn as Blur Behind.
-
void CheckLayerDrawing(const LevelDocument& document,
std::
int32_t layerIndex, bool aboutOthers, SmallVectorImpl<LevelProblem>& problems) - Adds what makes a layer drawn black, wrong or not at all, the texts without the name of the layer.
-
auto CountPaletteColorTiles(IEditorContext& session,
std::
int32_t layerIndex) -> std:: int32_t - Returns how many tiles of a layer are in palette colors, which do nothing on a layer drawn as Blur Behind.
- void CheckLevelSurroundings(IEditorContext& session, SmallVectorImpl<LevelProblem>& problems)
- Adds problems the shown level tells, events inside solid tiles and warp targets in walls, and files.
-
auto FixLevelProblem(IEditorContext& session,
LevelProblemFix fix,
std::
int32_t value) -> bool - Fixes a problem by LevelProblem::
Fix or LevelProblem:: AlternativeFix with LevelProblem:: FixValue. - auto GetLevelProblemFixLabel(LevelProblemFix fix) -> String
- Returns the label of the button that fixes a problem.
- void ShowCheckLevelDialog(IEditorContext& session)
- Shows the problems of the level, each can be shown in the view.
Enum documentation
enum class LevelProblemSeverity : std:: uint8_t
How bad a problem of a level is.
| Enumerators | |
|---|---|
| Error |
Something doesn't work at all, as a warp that leads nowhere |
| Warning |
Something probably doesn't work as it was meant to |
| Info |
Worth a look, but often meant so |
enum class LevelProblemFix : std:: uint8_t
How a problem of a level can be fixed by a click, see LevelProblem::
| Enumerators | |
|---|---|
| None |
Not by a click |
| RemoveWarp |
Removes the warp of LevelProblem:: |
| AddWarpTarget |
Places a target of the warp of LevelProblem:: |
| AddStart |
Places a start of the characters of LevelProblem:: |
| AddMultiplayerStart |
Places a multiplayer start of the team of LevelProblem:: |
| AddCtfBase |
Places a CTF base of the team of LevelProblem:: |
Function documentation
void CheckLevel(const LevelDocument& document, SmallVectorImpl<LevelProblem>& problems)
Looks for what's probably wrong in a level.
Starts missing for a character, warps without a target, coin warps needing more coins than there are, texts that don't exist, triggers that are set but change nothing and the other way around, rolling rocks that never roll, parameters out of their range, unknown events and more than one sky. For multiplayer, CTF bases missing or twice for a team, teams with a base but no start, too few multiplayer starts, a race with laps without waypoints, gaps in the order of the waypoints, and events only for multiplayer in a level that isn't. Errors come first. Problems of the same kind are told once, with how many there are and where the first one is.
void CheckReachability(IEditorContext& session, SmallVectorImpl<LevelProblem>& problems)
Adds what the player can't get to from the start: an exit, and things to collect, see EditorSession::
With the events as the level was loaded last, as springs and poles take the player places, so the level should be loaded again first, see EditorSession::
void CheckLayerDrawing(const LevelDocument& document,
std:: int32_t layerIndex,
bool aboutOthers,
SmallVectorImpl<LevelProblem>& problems)
Adds what makes a layer drawn black, wrong or not at all, the texts without the name of the layer.
A layer hidden in the game that has something to show, a color that multiplies its tiles nearly black, a layer that isn't drawn by its alpha or the transparent entry it's tinted with, a textured background that isn't 8x8 tiles or whose tiles are all empty, a wave without waves, the horizon of a reflection at its top or its bottom, x-ray tiles of a single frame. With aboutOthers also that a textured background or a reflection after it keeps it from being drawn (CheckLevel() tells those once for the level), and that an empty layer is hidden in the game. The problems need no tile sets to tell, see CountPaletteColorTiles() for those that do.
void CheckLevelSurroundings(IEditorContext& session, SmallVectorImpl<LevelProblem>& problems)
Adds problems the shown level tells, events inside solid tiles and warp targets in walls, and files.
The levels that follow and the music that aren't found, and a script that can't refer to all tile IDs.
bool FixLevelProblem(IEditorContext& session,
LevelProblemFix fix,
std:: int32_t value)
Fixes a problem by LevelProblem::
As an undoable step, what's placed goes to the empty tile nearest to the middle of the view. Returns false if it couldn't be fixed.