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 LS struct is defined as follows:

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

uSuck values
Each individual level state has a  value which is used to scale the game's difficulty. There is also a second value related to suck stored at offset 0x10, but the purpose of that value is currently unknown. It is often incremented at the same time as the first suck value, but the second one is sometimes multiplied by some value to make it bigger or smaller.

Clue values
The level state has two values associated with clue bottles. The first,, is the quantity of clue bottles have been collected in the level. The second,, is a bitfield that keeps track of which specific clue bottles have been collected.

Each bit in  corresponds to a specific clue in the map. During a level load, any particular clue bottle will only be spawned in if the corresponding bit is not set.

Dialogue flags
Every  has an array for storing up to 12 dialogue flags, , with each flag corresponding to a specific dialog. Most are Bentley cutscenes but it is also used for things like the PA announcements in the hub maps.

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

Scene variables
Every  has an array for storing up to 4 scene variables. A scene variable consists of two int values comprising an ID and value pair. For instance, in The Swamp’s Dark Center, an ID of 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. When the game needs to check the value of a scene variable, it calls a function that takes a map ID and a variable ID, iterating over the array of scene flags on that map’s  and stops when it finds a match.