Sly 1:WS: Difference between revisions
Fix field type
TheOnlyZac (talk | contribs) (Updated struct fields and enum tables) |
TheOnlyZac (talk | contribs) (Fix field type) |
||
(One intermediate revision by the same user not shown) | |||
Line 5:
| sly1= y
}}
'''WS''' (world state) is a data structure in {{Sly 1}}. It is responsible for tracking the state of
== Fields ==
Line 14 ⟶ 13:
{{Struct top}}
{{Struct field|offset=0x0|size=0x438|type=LS[9]|name=als|description=Level states array}}
{{Struct field|offset=0x438|size=
{{Struct field|offset=0x43c|size=
{{Struct field|offset=0x440|size=
{{Struct field|offset=0x444|size=4|type=float|name=dt|description=Time spent in world}}
{{Struct field|offset=0x448|size=4|type=
{{Struct bottom}}
<!--
struct WS {
struct LS als[9]; /* Level states array */
Line 30 ⟶ 29:
enum FWS fws; /* World state flags */
};
</syntaxhighlight
-->
== Level states array ==
{{See also|Sly 1:LS}}
Each <code>WS</code> has an array of 9 <code>LS</code> structs, even if the world has fewer than 9 levels.
▲* <code>als[0]</code>: Intro level
▲* <code>als[1]</code>: Hub level
▲* <code>als[2]</code> - <code>als[7]</code>: Generic levels
▲* <code>als[8]</code>: Boss fight
== World state flags (FWS) ==▼
▲== World state flags ==
The current state of the world is defined by the FWS enum, which has the following possible values:
{{Enum top}}
{{Enum value|FWS_Visited|0x1|World is unlocked and can be selected in {{Sly 1|The Hideout}}}}
{{Enum value|FWS_Lock_0|0x2|Corresponds to a particular {{Sly 1|LOCKG}} in the world being unlocked}}
{{Enum value|FWS_Lock_1|0x4|"}}
{{Enum value|FWS_Lock_2|0x8|"}}
{{Enum value|FWS_Lock_3|0x10|"}}
{{Enum value|GRFWS_Lock_All|0x1e|All of the locks in the world have been unlocked}}
{{Enum bottom}}
The <tt>fws</tt> 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 <code>fws</code> gets set when it gets unlocked.
== See also ==
* {{Sly 2|DAG}}
{{Navbox Sly 1}}
|