Sly 1:GS

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

GS (game state) is a data structure in Sly Cooper and the Thievius Raccoonus. It contains information about the current state of the game world, including an array of world states which, in turn, each contain an array of level states.

Fields

The GS struct has the following fields

Offset Size Type Name Notes
0x0 0x4
int
gsv Unknown
0x4 0x4
int
cbThis Size of this struct in bytes
0x8 0x4
int
nChecksum Unknown, possibly compared against cbThis for integrity check
0xc 0x4
float
dt Total time spent in game (secs)
0x10 0x19c8
struct WS[6]
aws Array of world states
0x19d8 0x4
enum GAMEWORLD
gameworldCur Current gameworld
0x19dc 0x4
enum WORLDLEVEL
worldlevelCur Current worldlevel
0x19e0 0x4
int
clife Lives count
0x19e4 0x4
int
ccharm Charm count
0x19e8 0x4
int
ccoin Coin count
0c19ec 0x4
int
grfgs Unknown bitfield, possibly settings flags
0x19f0 0x4
int
grfvault Bitfield of unlocked powerups
0x19f4 0x4
int
grfmovie Unofficial name, probably called something else internally
0x19f8 0x4
enum FGS
fgs Game state flags
0x19fc 0x4
int
last powerup? Unofficial name, may be wrong


GRFGS and GRFVAULT are aliases of int.

World states array

aws is an array of 5 WS structs, one for each world. In the release build, the order is as follows:

Bitfields

There are three sets of bitfields/flags after the world states.

Settings flags (GRFGS)

The purpose of grfgs is unclear. At least some of the bits appear to be used for game settings.

Powerup flags (GRFVAULT)

grfvault is a bitfield representing unlocked powerups. Each bit corresponding to a particular powerup being unlocked.

Cutscene flags

There are 16 bits for the cutscene flags, with each bit corresponding to a particular cutscene being unlocked. It is probably also stored as a typedef alias of int but the type is currently unknown.

Game state flags (FGS)

The current game state is represented by the FGS enum, which has the following possible values:

Name Value Description
FGS_FirstClue 0x1
FGS_HalfClues 0x2
FGS_AllClues 0x4
FGS_FirstVault 0x8
FGS_SecondVault 0x10