Sly 1:LOCKG

LOCKG (likely short for Lock Goal) is a data structure in that handles interaction between Sly and obstacles locked with treasure keys.

Structure
The structure of a LOCKG is as follows:

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.

At some point a message with ID 0xXXX 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 on the LOCKG (ie. it checks if you have enough keys to open the lock).

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).

Once all locks have are unlocked, they are removed from from the game world along with the LOCKG itself.

Example
In Prowling the Grounds, the LOCKG which handles for unlocking the cannon is based at address 0xXXXXXX. It’s cpLock value is 7, meaning there are 7 locks, 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, which apparently to handles removing the lid from the cannon.