Sly 1:LOCKG: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
TheOnlyZac (talk | contribs) (Started struct fields table) |
TheOnlyZac (talk | contribs) (Fix fields, move image to infobox) |
||
Line 1: | Line 1: | ||
{{Infobox data structure |
{{Infobox data structure |
||
| image= [[File:Sly 1 SDC 3key unlocking.png]] |
|||
| sly1= y |
|||
| official= y |
| official= y |
||
}} |
}} |
||
Line 11: | Line 11: | ||
The LOCKG struct has the following fields: |
The LOCKG struct has the following fields: |
||
{{Struct top}} |
{{Struct top}} |
||
{{Struct field| |
{{Struct field||4|int|grfws|Bitfield OR'd with the grfws on the global {{Sly 1|GS}} struct when triggered}} |
||
{{Struct field|offset=|size= |
{{Struct field|offset=|size=4|type=struct SMA*|name=psma|description=The SMA activated when triggered}} |
||
{{Struct field|offset=|size=4|type=struct |
{{Struct field|offset=|size=4|type=struct SM*|name=psm|description='''Unknown''' SM pointer}} |
||
{{Struct field||4|int|coidLock|Count of lock OIDs}} |
|||
{{Struct field||32|enum OID[8]|aoidLock|Array of lock OIDs |
|||
{{Struct field|offset=|size=4|type=int|name=cplock|description=Count of locks in the group}} |
|||
{{Struct field|offset=|size=32|type=LOCK*[8]|name=aplock|description=Array of lock pointers}} |
|||
{{Struct bottom}} |
{{Struct bottom}} |
||
Line 20: | Line 24: | ||
== Implementation == |
== Implementation == |
||
⚫ | |||
[[File:Sly 1 SDC 3key unlocking.png|thumb|The cutscene after triggering a LOCKG in {{Sly 1|The Swamp's Dark Center}}]] |
|||
⚫ | |||
At some point a message with ID 0xXXX{{check}} is sent to the |
At some point a message with ID 0xXXX{{check}} is sent to the {{Sly 1|JT}} struct. This message is processed by <code>HandleJtMessage</code>, which checks if the <code>ckey</code> on the current {{Sly 1|WS|world state}} is greater than the <code>cppock</code>{{check}} on the LOCKG (i.e. it checks if you have enough keys to open the lock). |
||
If the check passes, it uses the <code>LOCKG->FWS</code> as a bitmask to set the corresponding flag on the FWS of the current WS. It then unlocks the locks and sets the |
If the check passes, it uses the <code>LOCKG->FWS</code> as a bitmask to set the corresponding flag on the FWS of the current WS. It then unlocks the locks and sets the {{Sly 1|SMA}} based on the <code>LOCKG-> sma</code> pointer. The SMA is processed by {{Sly 1|Splice}} to trigger whatever scripted event happens as a result of the locks being unlocked. |
||
Once all locks complete their unlock |
Once all locks complete their unlock {{Sly 1|ASEG|animation}}, the associated locks disappear from the world. |
||
== Example == |
== Example == |
||
In Prowling the Grounds, the LOCKG which handles unlocking the cannon is based at address 0xXXXXXX{{check}}. It’s <code> |
In Prowling the Grounds, the LOCKG which handles unlocking the cannon is based at address 0xXXXXXX{{check}}. It’s <code>cplock</code>{{check}} value is 7, meaning there are 7 locks in the <code>aplock</code> array, so when you approach the cannon it checks if you have 7 keys. |
||
If the check fails, nothing happens. If the check passes, it sets the SMA goal to 0xXXXXXX{{check}}, which seems to handle removing the lid from the cannon. |
If the check fails, nothing happens. If the check passes, it sets the SMA goal to 0xXXXXXX{{check}}, which seems to handle removing the lid from the cannon. |
||
Line 37: | Line 40: | ||
== Notes == |
== Notes == |
||
* The <code> |
* The <code>aplock</code> field is an array of 8 LOCK pointers. You can change these to point to any other entity in the level and they key will fly to and delete that entity instead. If you use this method to delete JT, the cutscene can’t complete and the game softlocks. |
||
{{Navbox Sly 1}} |
{{Navbox Sly 1}} |