Sly 1:GS: Difference between revisions
TheOnlyZac (talk | contribs) (Added infobox) |
TheOnlyZac (talk | contribs) (Fix field types) |
||
(6 intermediate revisions by the same user not shown) | |||
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''' ( |
'''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:<syntaxhighlight lang="c++"> |
|||
The GS struct has the following fields |
|||
{{Struct top}} |
|||
{{Struct field|0x0|0x4|int|gsv|'''Unknown'''}} |
|||
{{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++"> |
|||
struct GS { |
struct GS { |
||
int gsv; |
int gsv; |
||
Line 27: | Line 48: | ||
int last_powerup; /* Last selected powerup (name is not official) */ |
int last_powerup; /* Last selected powerup (name is not official) */ |
||
}; |
}; |
||
</syntaxhighlight>--> |
|||
<code>GRFGS</code> and <code>GRFVAULT</code> are aliases of <code>int</code>. |
|||
</syntaxhighlight> |
|||
== World states array == |
== World states array == |
||
Line 34: | Line 56: | ||
<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}} |
||
== |
== Bitfields == |
||
{{todo|Add tables showing the value of each bit}} |
{{todo|Add tables showing the value of each bit}} |
||
There are three |
There are three sets of bitfields/flags after the world states. |
||
=== Settings flags (GRFGS) === |
=== Settings flags (GRFGS) === |
||
The purpose of <code>grfgs</code> is unclear. At least some of the bits appear to be used for game settings. |
|||
=== Powerup flags (GRFVAULT) === |
=== 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. It is probably also stored as a typedef alias of <code>int</code> but the type is currently unknown. |
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" |
|||
== Game state flags == |
|||
|+ GRFGS bitfield |
|||
The current game state is represented by the <code>FGS</code> enum, which has the following possible values: |
|||
{| class="wikitable" |
|||
|FGS_FirstClue |
|||
|0x1 |
|||
|- |
|- |
||
! Bit !! Usage |
|||
|FGS_HalfClues |
|||
|0x2 |
|||
|- |
|- |
||
| 0 || Example |
|||
|FGS_AllClues |
|||
|0x4 |
|||
|- |
|- |
||
| 1 || Example |
|||
|FGS_FirstVault |
|||
|0x8 |
|||
|- |
|- |
||
| 2 || Example |
|||
|FGS_SecondVault |
|||
|- |
|||
|0x10 |
|||
| 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: |
|||
{{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}} |
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 |