trigger-segfault / OpenLRR

An open source re-implementation of LEGO Rock Raiders 🪨⛏
66 stars 5 forks source link

ROCK FOG invalid comments in Lego.cfg #31

Open trigger-segfault opened 2 years ago

trigger-segfault commented 2 years ago

Describe the issue

In the standard Lego.cfg configuration file, there are invalid comments used when defining the fog colour values for Rock biomes: // ROCK FOG

The token // is not a valid line comment! (only ; is valid)

So when // ROCK FOG occurs, these 3 tokens (//, ROCK, FOG) are consumed, throwing off the file's key/value property parsing until the next // ROCK FOG comment appears on the second line defining HighFogColourRGB. If these comments did not appear in pairs, the entire Lego.cfg file would have been broken from the start. Instead, only HighFogColourRGB is broken on the offending lines.

Config snippet

The offending lines, appearing 15 times in Lego.cfg.

    FogColourRGB        110:110:155    // ROCK FOG
    HighFogColourRGB    155:155:110    // ROCK FOG

Solution

For the time being, it's safe to assume that the exact string: // ROCK FOG will not appear in property keys/values, and that it will only be used in its original form. However, we should not make assumptions about the usage of // itself, as it could be used as a property value. The solution should aim to fix // ROCK FOG and only // ROCK FOG, while maintaining the stance that // is -and always will be- an invalid comment.

In the future, more user-friendly solutions could be created to identify rogue double-slash comments in custom user-made Lego.cfg files. Either by having an option to correct them, or to warn the modder when loading the config file.

Attachments

Below are comparisons of the intended Rock biome fog colour vs. the actual colour.

On the left: The fog colour as it was intended. On the right: The fog colour as we get with the // ROCK FOG comments left unfixed.

RockFogBroken1

RockFogBroken2

trigger-segfault commented 2 years ago

This should be considered an alteration to the game, because it's no longer clear when // ROCK FOG's brown high fog colour was really intended to be used.

There are a handful of ice biome levels that also use // ROCK FOG comments. It's possible the original broken blue-only colour was intended in these levels without realizing it was due to the malformed comments in Lego.cfg.

Additionally, it's hard to tell if the brown high fog colour was intended at all because the paired low fog colour is usually defined as blue.

Attachments

Frozen Frenzy with the "fixed" fog on the left, and the original broken fog on the right.

8B5ECB15-0B26-416D-9AF9-DF395B0489FA