OoTRandomizer / OoT-Randomizer

A randomizer for Ocarina of Time.
Other
397 stars 230 forks source link

Add a setting to lock starting the game behind a password #2240

Open GSKirox opened 3 weeks ago

GSKirox commented 3 weeks ago

This PR adds a non-GUI setting password_lock which when enabled, make starting a file in the file select screen password protected. This password is exposed in the spoiler log after the file hash, and is in form of A/C inputs. The texture at the bottom of file select has been removed to show instead if the seed is still locked. Once the right password has been entered, the message will disappear and the player can start the seed normally. The normal texture is only removed when the setting is enabled. Since we store the password information in the extended save context, the player will still need to save once in game to keep the "password clear" state. Edit : Thanks to Rob, the information is now saved instantly after inputting it, no need to save in game !

https://github.com/OoTRandomizer/OoT-Randomizer/assets/65768236/23fd7570-1a96-4e00-84c4-f91c6ba1f7f2

fenhl commented 1 week ago

There's something wrong with the password input. Maybe an off-by-one when handling B inputs? Hard to tell.

https://github.com/OoTRandomizer/OoT-Randomizer/assets/641386/2bf3f321-388f-43b8-a5fe-1189c1c0e24d

flagrama commented 1 week ago

Looks like that was my fault, sorry. I'll describe what bothers me about that code so I don't risk changing actual logic again. An index value used to access an array should match the array it is accessing. You consistently use password_index - 1 instead of the password_index on its own which is a code smell that your index value is not being assigned the proper values.

GSKirox commented 1 week ago

That's fair criticism, there was no real reason to start the index at 0 and offset everything else.

fenhl commented 1 week ago

With that fixed, there still seems to be an issue where the password displayed in the spoiler log doesn't work. I just generated a seed which shows a password of ["C left", "C left", "C left", "C up", "C up", "C left"] in the log but that sequence gives me the “error” sound effect.

fenhl commented 1 week ago

Also, plandoing a password seems to be ignored — the spoiler log shows a different password.

GSKirox commented 6 days ago

Integrated the latest fix from #2251 to solve the issue