Sly 1:GS: Difference between revisions

From SlyMods
Jump to navigation Jump to search
Content added Content deleted
m (TheOnlyZac moved page GS to Sly 1:GS: Moved to gamespace)
(Changed hatnote, added links)
Line 4: Line 4:
| sly1= y
| sly1= y
}}
}}
{{Distinguish|Graphics Synthesizer}}
{{hatnote|This article is about the game state struct in Sly 1. For the game state in Sly 2 and 3, see [[DAG]].}}


'''GS''' ('''G'''ame '''S'''tate) is a data structure in {{Sly 1}}. It stores an array of [[WS|World States]], which in turn each store an array of [[LS|Level States]].
'''GS''' ('''G'''ame '''S'''tate) is a data structure in {{Sly 1}}. It stores information about the current save file, including an array of [[WS|World States]] which in turn each store an array of [[LS|Level States]].


== Structure ==
== Structure ==
Line 34: Line 34:


<code>aws</code> is an array of 5 <code>WS</code> structs, one for each world. In the release build, the order is as follows:
<code>aws</code> is an array of 5 <code>WS</code> structs, one for each world. In the release build, the order is as follows:
* 0: Intro
* 0: {{Sly 1|Intro}}
* 1: Underwater
* 1: {{Sly 1|Underwater}}
* 2: Mesa
* 2: {{Sly 1|Mesa}}
* 3: Voodoo
* 3: {{Sly 1|Voodoo}}
* 4: Snow
* 4: {{Sly 1|Snow}}
* 5: Clockwerk
* 5: {{Sly 1|The Cold Heart of Hate|Clockwerk}}


== Unlockable flags ==
== Unlockable flags ==
Line 58: Line 58:
The current game state is represented by the <code>FGS</code> enum, which has the following possible values:
The current game state is represented by the <code>FGS</code> enum, which has the following possible values:
{| class="wikitable"
{| class="wikitable"
! Name
|FGS_FirstClue
! Value
|-
|FGS::FirstClue
|0x1
|0x1
|-
|-
|FGS::HalfClues
|FGS_HalfClues
|0x2
|0x2
|-
|-
|FGS::AllClues
|FGS_AllClues
|0x4
|0x4
|-
|-
|FGS::FirstVault
|FGS_FirstVault
|0x8
|0x8
|-
|-
|FGS::SecondVault
|FGS_SecondVault
|0x10
|0x10
|}
|}

Revision as of 21:46, 8 August 2022

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 stores information about the current save file, including an array of World States which in turn each store an array of Level States.

Structure

The GS struct is declared as follows:

struct GS {
    int gsv;
    int cbThis; /* Size of this struct in bytes */
    int nChecksum; /* Unknown */
    float dt; /* Time spent in game (secs) */
    struct WS aws[6]; /* Saves for each world */
    enum GAMEWORLD gameworldCur; /* Current gameworld */
    enum WORLDLEVEL worldlevelCur; /* Current worldlevel */
    int clife; /* Lives count */
    int ccharm; /* Charms count */
    int ccoin; /* Coins count */
    GRFGS grfgs; /* Settings flags? */
    GRFVAULT grfvault; /* Powerup flags */
    uint unlocked_cutscenes; /* Cutscene flags (name is not official) */
    enum FGS fgs; /* Game state flags */
    int last_powerup; /* Last selected powerup (name is not official) */
};

World states array

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

Unlockable flags

There are three[check] sets of flags after the world states.

Settings flags (GRFGS)

There is a set of flags of type GRFGS whose purpose is unclear. At least some of the bits appear to be used for game settings. GRFGS is an alias of int and occupies 4 bytes, or 32 bits.

Powerup flags (GRFVAULT)

There is a set of flags of type GRFVAULT for the unlocked powerups, with each bit corresponding to a particular powerup being unlocked. GRFVAULT is an alias of int and occupies 4 bytes, or 32 bits.

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

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

Name Value
FGS::FirstClue 0x1
FGS::HalfClues 0x2
FGS::AllClues 0x4
FGS::FirstVault 0x8
FGS::SecondVault 0x10