Sly 1:WS

From SlyMods
Jump to navigation Jump to search
Data Structure
GameSly Cooper and the Thievius Raccoonus
Official NameYes

WS (world state) is a data structure in Sly Cooper and the Thievius Raccoonus. It is responsible for tracking the state of a particular gameworld.


The WS struct has the following fields:

Offset Size Type Name Description
0x0 0x438
als Level states array
0x438 4
ckey Count of keys collected on world
0x43c 4
cvault Count of vaults opened on world
0x440 4
ctimed Count of MTSs completed on world
0x444 4
dt Time spent in world
0x448 4
fws World state flags

Level states array

Each WS has an array of 9 LS structs, even if the world has fewer than 9 levels. The LS structs are always aligned in the als array so the indices are as follows:

  • als[0]: Intro
  • als[1]: Hub
  • als[2] - als[7]: Platforming/minigames
  • als[8]: Boss

World 1 and World 5 have fewer than 9 levels, so some some of the entries levels in their als arrays are blank/unused.

World state flags (FWS)

The current state of the world is defined by the FWS enum, which has the following possible values:

Name Value Description
FWS_Visited 0x1 World is unlocked and can be selected in The Hideout
FWS_Lock_0 0x2 Corresponds to a particular LOCKG in the world being unlocked
FWS_Lock_1 0x4 "
FWS_Lock_2 0x8 "
FWS_Lock_3 0x10 "
GRFWS_Lock_All 0x1e All of the locks in the world have been unlocked

The fws acts as a bitfield and the game ORs the its value with the FWS enum values to check if a particular condition is met.

Note that the the order of locks is not the same for every world because each LOCKG independently decides which bit on the fws gets set when it gets unlocked.

See also