Sly 1:GS: Difference between revisions
TheOnlyZac (talk | contribs) m (→World States: Fixed typo) |
TheOnlyZac (talk | contribs) (Fix field types) |
||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Infobox data structure |
|||
{{hatnote|This article is about the game state for Sly 1. For the data structure that controls the game state in Sly 2 and 3, see [[DAG]].}} |
|||
| name= GS |
|||
| official= y |
|||
| sly1= y |
|||
}} |
|||
{{Distinguish|Graphics Synthesizer}} |
|||
GS ( |
'''GS''' (game state) is a data structure in {{Sly 1}}. It contains information about the current state of the game world, including an array of {{Sly 1|WS|world states}} which, in turn, each contain an array of {{Sly 1|LS|level states}}. |
||
== |
== Fields == |
||
The GS struct is declared as follows: |
|||
The GS struct has the following fields |
|||
{{todo|Add the C++ struct declaration}} |
|||
{{Struct top}} |
|||
== Game State Flags == |
|||
{{Struct field|0x0|0x4|int|gsv|'''Unknown'''}} |
|||
The current game state is represented the FGS enum, which has the following possible values: |
|||
{{Struct field|0x4|0x4|int|cbThis|Size of this struct in bytes}} |
|||
{{Struct field|0x8|0x4|int|nChecksum|Unknown, possibly compared against <tt>cbThis</tt> for integrity check}} |
|||
{{Struct field|0xc|0x4|float|dt|Total time spent in game (secs)}} |
|||
{{Struct field|0x10|0x19c8|struct WS[6]|aws|Array of {{Sly 1|WS|world states}}}} |
|||
{{Struct field|0x19d8|0x4|enum GAMEWORLD|gameworldCur|Current gameworld}} |
|||
{{Struct field|0x19dc|0x4|enum WORLDLEVEL|worldlevelCur|Current worldlevel}} |
|||
{{Struct field|0x19e0|0x4|int|clife|Lives count}} |
|||
{{Struct field|0x19e4|0x4|int|ccharm|Charm count}} |
|||
{{Struct field|0x19e8|0x4|int|ccoin|Coin count}} |
|||
{{Struct field|0c19ec|0x4|int|grfgs|'''Unknown bitfield''', possibly settings flags}} |
|||
{{Struct field|0x19f0|0x4|int|grfvault|Bitfield of unlocked powerups}} |
|||
{{Struct field|0x19f4|0x4|int|grfmovie|Unofficial name, probably called something else internally}} |
|||
{{Struct field|0x19f8|0x4|enum FGS|fgs|Game state flags}} |
|||
{{Struct field|0x19fc|0x4|int|last powerup?|Unofficial name, may be wrong}} |
|||
{{Struct bottom}} |
|||
<!--<syntaxhighlight lang="c++"> |
|||
{{todo|Add the FLS enum values}} |
|||
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) */ |
|||
}; |
|||
</syntaxhighlight>--> |
|||
<code>GRFGS</code> and <code>GRFVAULT</code> are aliases of <code>int</code>. |
|||
== World States == |
|||
== World states array == |
|||
{{main|WS}} |
{{main|WS}} |
||
<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}} |
||
== Bitfields == |
|||
{{todo|Add tables showing the value of each bit}} |
|||
There are three sets of bitfields/flags after the world states. |
|||
== Unlockable flags == |
|||
{{todo|Add the meaning corresponding to each bit/enum value}} |
|||
=== Settings flags (GRFGS) === |
|||
There are three{{check}} sets of flags after the world states. |
|||
The purpose of <code>grfgs</code> is unclear. At least some of the bits appear to be used for game settings. |
|||
=== Powerup flags === |
=== Powerup flags (GRFVAULT) === |
||
<code>grfvault</code> is a bitfield representing unlocked [[powerups]]. Each bit corresponding to a particular powerup being unlocked. |
|||
<!-- |
|||
{| class="wikitable mw-collapsible mw-collapsed" |
|||
|+ GRFGS bitfield |
|||
|- |
|||
! Bit !! Usage |
|||
|- |
|||
| 0 || Example |
|||
|- |
|||
| 1 || Example |
|||
|- |
|||
| 2 || Example |
|||
|- |
|||
| 3 || Example |
|||
|- |
|||
| 4 || Example |
|||
|- |
|||
| 5 || Example |
|||
|- |
|||
| 6 || Example |
|||
|- |
|||
| 7 || Example |
|||
|- |
|||
| 8 || Example |
|||
|- |
|||
| 9 || Example |
|||
|- |
|||
| 10 || Example |
|||
|- |
|||
| 11 || Example |
|||
|- |
|||
| 12 || Example |
|||
|- |
|||
| 13 || Example |
|||
|- |
|||
| 14 || Example |
|||
|- |
|||
| 15 || Example |
|||
|- |
|||
| 16 || Example |
|||
|- |
|||
| 17 || Example |
|||
|- |
|||
| 18 || Example |
|||
|- |
|||
| 19 || Example |
|||
|- |
|||
| 20 || Example |
|||
|- |
|||
| 21 || Example |
|||
|- |
|||
| 22|| Example |
|||
|- |
|||
| 23 || Example |
|||
|- |
|||
| 24|| Example |
|||
|- |
|||
| 25 || Example |
|||
|- |
|||
| 26 || Example |
|||
|- |
|||
| 27 || Example |
|||
|- |
|||
| 28 || Example |
|||
|- |
|||
| 29 || Example |
|||
|- |
|||
| 30 || Example |
|||
|- |
|||
| 31 || Example |
|||
|} |
|||
--> |
|||
=== Cutscene flags === |
=== Cutscene flags === |
||
There are 16 bits for the cutscene flags, with each bit corresponding to a particular cutscene being unlocked. |
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 <code>int</code> but the type is currently unknown. |
||
<!-- |
|||
{| class="wikitable mw-collapsible mw-collapsed" |
|||
|+ GRFGS bitfield |
|||
|- |
|||
! Bit !! Usage |
|||
|- |
|||
| 0 || Example |
|||
|- |
|||
| 1 || Example |
|||
|- |
|||
| 2 || Example |
|||
|- |
|||
| 3 || Example |
|||
|- |
|||
| 4 || Example |
|||
|- |
|||
| 5 || Example |
|||
|- |
|||
| 6 || Example |
|||
|- |
|||
| 7 || Example |
|||
|- |
|||
| 8 || Example |
|||
|- |
|||
| 9 || Example |
|||
|- |
|||
| 10 || Example |
|||
|- |
|||
| 11 || Example |
|||
|- |
|||
| 12 || Example |
|||
|- |
|||
| 13 || Example |
|||
|- |
|||
| 14 || Example |
|||
|- |
|||
| 15 || Example |
|||
|} |
|||
--> |
|||
== Game state flags (FGS)== |
|||
The current game state is represented by the <code>FGS</code> enum, which has the following possible values: |
|||
There is a set of flags defined by the GRFGS enum whose purpose is unclear. At least some of the bits appear to be used for game settings. |
|||
{{Enum top}} |
|||
{{Enum value|FGS_FirstClue|0x1}} |
|||
{{Enum value|FGS_HalfClues|0x2}} |
|||
{{Enum value|FGS_AllClues|0x4}} |
|||
{{Enum value|FGS_FirstVault|0x8}} |
|||
{{Enum value|FGS_SecondVault|0x10}} |
|||
{{Enum bottom}} |
|||
{{Navbox Sly 1}} |
|||
[[Category:Game mechanics]] |
|||
[[Category:Game mechanics in Sly 1]] |
Latest revision as of 03:39, 26 September 2023
Data Structure | |
---|---|
Game | Sly Cooper and the Thievius Raccoonus |
Official Name | Yes |
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
To Do: Add tables showing the value of each bit |
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 |