Sly 1:LS

LS (Level State) is a data structure in. It is used for storing the current state of each level in the Game State.

Structure
The structure of LS is as follows:

Level State Flags
The current state of the level is represented using the FLS enum, which has the following possible values:

uSuck
Each individual has a uSuck value used for scaling the difficulty level. There is also a second value related to suck stored at offset 0x10, but the purpose of that variable is currently unknown.

Dialogue Flags
Each level has an array for storing up to 12 dialogue flags. Each of these flags corresponds to a dialog/cutscene where Bentley talks to Sly.

If a dialog flag is set to 0, that dialog will automatically play when Sly enters the relevant trigger volume. If the flag is set to 1, then the trigger volume instead causes the L1 popup blot appears in the lower-left corner, giving the option to replay the dialog.

Scene Variables
Each LS has an array for storing up to 4 scene variables. A scene variable takes up 8 bytes, consisting of an ID and value pair. For instance, in The Swamp’s Dark Center, ID 0x693 corresponds to the state of the left candle on the purple voodoo gate, and a value of 1 corresponds to that candle being broken.

When the game sets a scene variable it uses the first available slot on the LS. When the game reads the scene variables, it calls a function that takes a map ID and an variable ID, which iterates over the array of scene flags for that map’s LS and stops when it finds a match.