Sly 1:LOCKG: Difference between revisions
m
Fix typo
TheOnlyZac (talk | contribs) (Created article for data structure) |
TheOnlyZac (talk | contribs) m (Fix typo) |
||
(14 intermediate revisions by the same user not shown) | |||
Line 1:
{{Infobox data structure
| image= File:Sly 1 SDC 3key unlocking.png
'''LOCKG''' (likely short for Lock Goal) is a data structure in {{Sly 1}} that handles interaction between Sly and obstacles locked with treasure keys.▼
| official= y
}}
▲'''LOCKG''' (
{{Todo|Replace all the XXX placeholders throughout the article with the actual values}}
== Fields ==
The LOCKG struct has the following fields:
{{Struct top}}
{{Struct field||4|int|grfws|Bitfield OR'd with the grfws on the global {{Sly 1|GS}} struct when triggered}}
{{Struct field|offset=|size=4|type=struct SMA*|name=psma|description=The SMA activated when triggered}}
{{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}}
{{Investigate}}
== Implementation ==
When the trigger volume associated with a LOCKG is triggered it sets off a sequence of events. It starts with the animation that spawns a KEY for each LOCK in the apLock array. These keys fly to their assigned locks and then despawn.▼
▲When the trigger volume associated with a LOCKG is triggered it sets off a sequence of events. It starts with the animation that spawns a {{Sly 1|KEY}} for each {{Sly 1:LOCK}} in the
At some point a message with ID 0xXXX{{check}} is sent to the JT struct. This message is processed by HandleJtMessage, which checks if the ckey on the current WS (World State) is greater than the cpLock{{check}} on the LOCKG (ie. it checks if you have enough keys to open the lock).▼
▲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
If the check passes, it uses the LOCKG’s FWS as a bit mask to set the corresponding flag on the current WS’ FWS. It then unlocks the locks and sets the SMA goal based on the LOCKG’s smaGoal pointer. The SMA goal, which seems to be processed by Splice, determines the outcome (ie. what happens as a result of the locks being opened).▼
▲If the check passes, it uses the
Once all locks complete their unlock {{Sly 1|ASEG|animation}}, the associated locks disappear from the world.
== Example ==
In Prowling the Grounds, the LOCKG which handles for unlocking the cannon is based at address 0xXXXXXX{{check}}. It’s cpLock{{check}} value is 7, meaning there are 7 locks, so when you approach the cannon, it checks if you have 7 keys.▼
▲In Prowling the Grounds, the LOCKG which handles
If the check fails, nothing happens. If the check passes, it sets the SMA goal to 0xXXXXXX{{check}}, which apparently to handles 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
== Notes ==
* The apLock 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 soft locks.▼
▲* The
{{Navbox Sly 1}}
|