swfans / swars

Syndicate Wars port, alternative binary for the classic Bullfrog game
Other
96 stars 14 forks source link

Cheat mode is saved in user profiles #167

Closed geist22 closed 4 months ago

geist22 commented 4 months ago

Saving a game with enabled cheat mode will save this in the profile, meaning that starting new games or loading other saves with the same login name will have cheat mode enabled by default.

This is not how the original game behaves. There, cheat mode only works per session and isn't saved in profiles.

Regression, could be from https://github.com/swfans/swars/commit/3422bf6acc893ba8621f6221bcde686daf37abc4.

mefistotelis commented 4 months ago

Well, it was saved really, but ignored during load.

I came to conclusion that if someone enabled the cheat mode, the game should remain "tainted" with it. Do you have a different opinion?

geist22 commented 4 months ago

if someone enabled the cheat mode, the game should remain "tainted" with it

Definitely, this is how many games do it and it makes sense.

But my main issue is that any other game using the same login name will get "infected" alongside it, which is not a desirable behaviour in my opinion. So perhaps it would be better if it's ignored during load, if that's what the original game does. Or was it a bug?

mefistotelis commented 4 months ago

Or was it a bug?

Hard to tell. After reading the value from saved game, it was just never used.

But my main issue is that any other game using the same login name will get "infected" alongside it.

I don't think it was a part of user profile.. But I made it so the cheat mode can be set by loading a game, but cannot be cleared this way - if you load a savegame with cheats on, you're "tainted" until you close the whole game and run it again.

EDIT: Maybe there should be another flag, telling whether any cheat was really used? Then the cheat enable flag could be ignored while loading, and we would still have info on the cheater stored in saves.

geist22 commented 4 months ago

Cheat flag is stored in savegames too? This is where I would logically expect it to be, not user profiles.

I assume it must be tied to user profiles because the way it works. Testing this, copying a profile file saved with cheats from the DOS game to the port, then starting a new campaign with that name will have cheats enabled. No savegame used.

But then you should also be able to clear the profiles by generating new ones from scratch?

Though I'm against introducing anything that could break compatibility with the original game. Profiles and savegames from the DOS game should work in the port and vice versa.

-edit- Further testing: In the DOS version, you can save a game with cheats, restart the game, load and save again and it will be cleared.

mefistotelis commented 4 months ago

Yes, my mistake - the ingame.UserFlags are stored in the profile, not in saved game.

Profiles and savegames from the DOS game should work in the port and vice versa.

Not sure about profiles, I never cared that much about them. But for saved games, they do have a fmtver at start. This is what allowed us to recognize and load older levels - so it basically introduces an opportunity to keep the old format versions working. (a conversion still have to be programmed though)

For vice versa - that will get broken at some point.

EDIT: Ok, I see the problem. A "taint" should be part of the saved game, not necessarily user profile. And making cheat mode permanent after used once is not really a good idea..

I will revert back to ignoring this flag from the profile.

mefistotelis commented 4 months ago

Should be fixed now.

geist22 commented 4 months ago

Yes, seems to work now. Thanks.