Sly 1:LS: Difference between revisions
TheOnlyZac (talk | contribs) (Updated scene flags section) |
TheOnlyZac (talk | contribs) (Update struct and enum tables) |
||
Line 6: | Line 6: | ||
}} |
}} |
||
{{Google sheets|https://docs.google.com/spreadsheets/d/1cT5ZpMyTpoCMEb_xbVJ3QAjduLg2cCZIQFtFdG6Bk4I/}} |
{{Google sheets|https://docs.google.com/spreadsheets/d/1cT5ZpMyTpoCMEb_xbVJ3QAjduLg2cCZIQFtFdG6Bk4I/}} |
||
'''LS''' ( |
'''LS''' (level state) is a data structure in {{Sly 1}}. It is responsible for the state of each [[worldlevel]] in the game. |
||
== |
== Fields == |
||
The LS struct is defined as follows:<syntaxhighlight lang="c++"> |
|||
The LS struct has the following fields: |
|||
struct LS { |
|||
enum FLS fls; /* Level state flags */ |
|||
{{Struct top}} |
|||
float dt; /* Time spent in level (secs) */ |
|||
{{Struct field|type=enum FLS|name=fls|offset=0x0|size=4|description=Level state flags}} |
|||
⚫ | |||
{{Struct field|type=float|name=dt|offset=0x4|size=4|type=float|description=Time spent in level (secs)}} |
|||
⚫ | |||
⚫ | |||
float suck_field_0x10; /* Unknown value, related to uSuck */ |
|||
⚫ | |||
int afDialogPlayed[12]; /* Dialog played flags */ |
|||
{{Struct field|type=float|name=?|offset=0x10|size=4|description=Unknown value, realated to suck}} |
|||
struct SceneVar a_scene_vars[4]; /* Scene variables */ |
|||
{{Struct field|type=int[12]|name=afDialogPlayed|offset=|size=48|description=Array of dialog played flags}} |
|||
int cclue; /* Count of bottles collected */ |
|||
{{Struct field|type=struct SceneVar[4]|name=scene vars array|offset=|size=32|description=Array of scene variables}} |
|||
uint fclue; /* Flags marking which bottles have been collected */ |
|||
{{Struct field|type=int|name=cclue|offset=|size=4|description=Count of clue bottles collected}} |
|||
undefined4 field_0x6c; /* Unknown */ |
|||
{{Struct field|type=unsigned int|name=fclue|offset=|size=4|description=Bitfield denoting which bottles have been collected}} |
|||
int field_0x70; /* Unknown */ |
|||
{{Struct field|type=|name=?|offset=0x6c|size=4|description=Unknown}} |
|||
byte * unk_ptr_0x74; /* Unknown ptr to 1-byte value */ |
|||
{{Struct field|type=|name=?|offset=0x70|size=4|description=Unknown}} |
|||
}; |
|||
{{Struct field|type=byte*|name=?|offset=0x74|size=1|description=Unknown}} |
|||
</syntaxhighlight> |
|||
{{Struct bottom}} |
|||
== Level state flags == |
== Level state flags == |
||
The current state of the level is represented using the FLS enum, which has the following possible values: |
The current state of the level is represented using the FLS enum, which has the following possible values: |
||
{{Enum top}} |
|||
{| class="wikitable" |
|||
⚫ | |||
!Name |
|||
⚫ | |||
!Value |
|||
⚫ | |||
!Description |
|||
⚫ | |||
|- |
|||
{{Enum value|FLS_BossDefeated|0x10|Self-explanatory}} |
|||
|FLS_Visited |
|||
{{Enum bottom}} |
|||
|0x1 |
|||
⚫ | |||
|- |
|||
|FLS_KeyCollected |
|||
|0x2 |
|||
⚫ | |||
|- |
|||
|FLS_Secondary |
|||
|0x4 |
|||
⚫ | |||
|- |
|||
|FLS_Tertiary |
|||
|0x8 |
|||
⚫ | |||
|- |
|||
|FLS_BossDefeated |
|||
|0x10 |
|||
|Unknown |
|||
|} |
|||
== uSuck values == |
== uSuck values == |
||
{{main|Sly 1:Difficulty}} |
{{main|Sly 1:Difficulty}} |
||
Line 61: | Line 46: | ||
== Clue values == |
== Clue values == |
||
The level state has two values associated with clue bottles. The first, <code>cclue</code>, is the quantity of clue bottles have been collected in the level. The second, <code>fclue</code>, is a bitfield that keeps track of which specific clue bottles have been collected. |
The level state has two values associated with clue bottles. The first, <code>cclue</code>, is the quantity of clue bottles have been collected in the level. The second, <code>fclue</code>, is a bitfield that keeps track of which specific clue bottles have been collected. |
||
Line 66: | Line 52: | ||
== Dialogue flags == |
== Dialogue flags == |
||
Every <code>LS</code> has an array for storing up to 12 [[Sly 1:DIALOG|dialogue]] flags, <code>afDialogPlayed</code>, 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. |
Every <code>LS</code> has an array for storing up to 12 [[Sly 1:DIALOG|dialogue]] flags, <code>afDialogPlayed</code>, 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. |
||
Line 71: | Line 58: | ||
== Scene flags == |
== Scene flags == |
||
{{Investigate|<br/> |
{{Investigate|<br/> |
||
* See if there is an official name for these variables (the term “scene flags” was coined by me). |
* See if there is an official name for these variables (the term “scene flags” was coined by me). |
||
Line 129: | Line 117: | ||
== See also == |
== See also == |
||
* {{Sly 1|GS}} |
* {{Sly 1|GS}} |
||
* {{Sly 1|WS}} |
* {{Sly 1|WS}} |
Revision as of 17:57, 23 September 2023
Data Structure | |
---|---|
Game | Sly Cooper and the Thievius Raccoonus |
Size | 0x78 |
Official Name | Yes |
LS (level state) is a data structure in Sly Cooper and the Thievius Raccoonus. It is responsible for the state of each worldlevel in the game.
Fields
The LS struct has the following fields:
Offset | Size | Type | Name | Notes |
---|---|---|---|---|
0x0 | 4 | enum FLS
|
fls
|
Level state flags |
0x4 | 4 | float
|
dt
|
Time spent in level (secs) |
0x8 | 4 | float
|
dtTimedBest
|
Best MTS time for level |
0xc | 4 | float
|
uSuck
|
Current player suck value for level |
0x10 | 4 | float
|
?
|
Unknown value, realated to suck |
48 | int[12]
|
afDialogPlayed
|
Array of dialog played flags | |
32 | struct SceneVar[4]
|
scene vars array
|
Array of scene variables | |
4 | int
|
cclue
|
Count of clue bottles collected | |
4 | unsigned int
|
fclue
|
Bitfield denoting which bottles have been collected | |
0x6c | 4 | ?
|
Unknown | |
0x70 | 4 | ?
|
Unknown | |
0x74 | 1 | byte*
|
?
|
Unknown |
Level state flags
The current state of the level is represented using the FLS enum, which has the following possible values:
Name | Value | Description |
---|---|---|
FLS_Visited | 0x1 | The level has been visited and is selectable from the map |
FLS_KeyCollected | 0x2 | The key has been collected on the level |
FLS_Secondary | 0x4 | The vault has been opened on the level |
FLS_Tertiary | 0x8 | The MTS has been completed on the level |
FLS_BossDefeated | 0x10 | Self-explanatory |
uSuck values
Each individual level state has a uSuck
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.
This topic needs further investigation. |
Clue values
The level state has two values associated with clue bottles. The first, cclue
, is the quantity of clue bottles have been collected in the level. The second, fclue
, is a bitfield that keeps track of which specific clue bottles have been collected.
Each bit in fclue
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 LS
has an array for storing up to 12 dialogue flags, afDialogPlayed
, 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 flags
This topic needs further investigation. |
Every LS
has slots for up to 4 scene flags. A new game has no scene variables set, and the game sets them as it needs to. Setting a scene flags means writing an ID and value pair to the save data for a level.
When the game sets a scene flag on a level, it checks all the scene flags on the LS
for that level to see if it is already set. If so, it updates the value. If not, it writes it to the first available slot on the level.
The following is a list of all known scene variables the game uses. There may still be more that are undiscovered.
Level | ID (hex) | ID (dec) | Known Values |
---|---|---|---|
Prowling the Grounds | 0x748 | 1864 | 1 - Unknown |
Into The Machine | 0x7e3 | 2019 | 2019 - Set if the invisible wall of fire is activated |
Last Call | 0x5a8 | 1448 | 1 - Unknown |
The Swamp's Dark Center | 0x692 | 1682 | 1 - Voodoo gate left candle broken on the roof near Down Home Cooking |
The Swamp's Dark Center | 0x695 | 1685 | 1 - Voodoo gate right candle broken on the roof near Down Home Cooking |
Duel by the Dragon | 0x53b | 1339 | 0 - Set when you first load the level. It indicates that the first Carmelita cutscene should play when you get to the roof.
1 - Set when the first Carmelita cutscene plays. It remains 1 after you die so you don't have to watch the cutscene every time. |
A Strange Reunion | 0x701 | 1793 | 1 - Unknown, set when the level starts. Probably related to cutscenes.
3 - Unknown, probably related to cutscenes. |
A Strange Reunion | 0x704 | 1796 | 10 - Unknown |