Move all settings to settings.vvv

The game previously did this dumb thing where it lumped in all its
settings with its file that tracked your records and unlocks,
`unlock.vvv`. It wasn't really an issue, until 2.3 came along and added
a few settings, suddenly making a problem where 2.3 settings would be
reset by chance if you decided to touch 2.2.

The solution to this is to move all settings to a new file,
`settings.vvv`. However, for compatibility with 2.2, settings will still
be written to `unlock.vvv`.

The game will prioritize reading from `settings.vvv` instead of
`unlock.vvv`, so if there's a setting that's missing from `unlock.vvv`,
no worries there. But if `settings.vvv` is missing, then it'll read
settings from `unlock.vvv`. As well, if `unlock.vvv` is missing, then
`settings.vvv` will be read from instead (I explicitly tested for this,
and found that I had to write special code to handle this case,
otherwise the game would overwrite the existing `settings.vvv` before
reading from it; kids, make sure to always test your code!).

Closes #373 fully.
This commit is contained in:
Misa
2020-11-03 23:11:21 -08:00
committed by Ethan Lee
parent 9e1ba97f63
commit 5aa8b99113
6 changed files with 144 additions and 27 deletions

View File

@@ -217,7 +217,12 @@ int main(int argc, char *argv[])
int width = 320;
int height = 240;
bool vsync = false;
// Prioritize unlock.vvv first (2.2 and below),
// but settings have been migrated to settings.vvv (2.3 and up)
game.loadstats(&width, &height, &vsync);
game.loadsettings(&width, &height, &vsync);
gameScreen.init(
width,
height,