Skip to content

Commit

Permalink
MAPINFO: fix a bug where setting the 'Text' field in 'Cluster' would …
Browse files Browse the repository at this point in the history
…not clear unused lines.

The bug would result in unwanted text from the base game's finale displaying - now fixed.
Also update the docs for MAPINFO, since they were missing the 'Text' field.
  • Loading branch information
BodbDearg committed Oct 16, 2021
1 parent 2ea958a commit cbc771c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/PsyDoom MAPINFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ Cluster 2 {
EnableCast = true
NoCenterText = false
SmallFont = false
Text =
"you did it!",
"by turning the evil of",
"the horrors of hell in",
"upon itself you have",
"destroyed the power of",
"the demons.",
"their dreadful invasion",
"has been stopped cold!",
"now you can retire to",
"a lifetime of frivolity.",
"congratulations!"
}
```
Header fields:
Expand All @@ -134,6 +146,8 @@ Internal Fields:
- `EnableCast`: if set to `true` then a finale with a cast call will be shown.
- `NoCenterText`: if set to `true` then the finale text will not be centered.
- `SmallFont`: if set to `true` then the small (8x8) font used for rendering status bar messages will be used for the finale.
- `Text`: The text to show for the finale, with one line in each string. Each pair of lines is separated by `,`.
## `GameInfo` definition
Defines general (global) game settings. If these settings are not explicitly specified, then the default values for the current game disc will be used. Example, using the same settings as the original PSX Doom:
```
Expand Down
4 changes: 4 additions & 0 deletions game/PsyDoom/MapInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ static void readCluster(const Block& block) noexcept {
const LinkedToken* const pTextValue = block.getValue("Text");
const LinkedToken* pTextData = (pTextValue) ? pTextValue->pNextData : nullptr;

if (pTextValue) {
std::memset(cluster.text, 0, sizeof(cluster.text)); // If text is specified then it overwrites the text for the cluster
}

for (int32_t lineIdx = 0; (lineIdx < C_ARRAY_SIZE(Cluster::text)) && pTextData; ++lineIdx, pTextData = pTextData->pNextData) {
const std::string_view text = pTextData->token.text();
cluster.text[lineIdx].assign(text.data(), (uint32_t) text.length());
Expand Down

0 comments on commit cbc771c

Please sign in to comment.