Sly 1:LOCKG

LOCKG (likely short for "lock goal") is a data structure in that handles interaction between Sly and treasure key locks.

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 Sly 1:KEY for each Sly 1:LOCK in the  array. Each key flies to its assigned lock and then despawns.

At some point a message with ID 0xXXX is sent to the JT struct. This message is processed by, which checks if the   on the current  is greater than the   on the LOCKG (i.e. it checks if you have enough keys to open the lock).

If the check passes, it uses the  as a bitmask to set the corresponding flag on the FWS of the current WS. It then unlocks the locks and sets the SmaGoal based on the  pointer. The SMA goal, is processed by to trigger whatever scripted event happens as a result of the locks being unlocked.

Once all locks complete their unlock animation, the associated locks disappear from the world.

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