The Engine Features > KeySrc and Engine Features > KeyDst properties are the properties which control the behavior of keys and the things they can lock/unlock. The KeySrc property is placed on the key, the KeyDst property is placed on the door/lockbox/container/whatever the key will be associated with. When a key is used on a lockable object, the properties will be compared, and if they match, then the Engine Features > Locked property of the lockable object will be changed (from true to false or false to true, depending on its previous state).
The first stage of the comparison is a test on the RegionMasks fields. These are entered in binary form - 16 bits in Thief 1, 32 bits in Thief 2. Negative numbers will be converted using Two's Compliment (e.g. -1 will be converted to 1111111111111111 in Thief 1). Note that only the significant digits will be shown (e.g. 0000000000010010 will be displayed as 10010. This is also how the numbers are written in this document). If non-binary digits are entered, everything beyond that point will be ignored (e.g. 10121 becomes 101).
Each bit in this field represents a region. A key and door will pass this first stage if they have at least one region in common. Consider the following three examples:
Key's RegionMask 101 1001 1101
Lock's RegionMask AND 110 AND 100 AND 1011
--- ---- ----
Result 100 (match) 0000 (no match) 1001 (match)
The following table may also be useful (note that this is a simple version, using only the first three regions).
| Lock 0 Mask: 000 | Lock 1 Mask: 001 | Lock 2 Mask: 010 | Lock 3 Mask: 011 | Lock 4 Mask: 100 | Lock 5 Mask: 101 | Lock 6 Mask: 110 | Lock 7 Mask: 111 | |
| Key 0 Mask: 000 | ||||||||
| Key 1 Mask: 001 | ||||||||
| Key 2 Mask: 010 | ||||||||
| Key 3 Mask: 011 | ||||||||
| Key 4 Mask: 100 | ||||||||
| Key 5 Mask: 101 | ||||||||
| Key 6 Mask: 110 | ||||||||
| Key 7 Mask: 111 |
If the RegionMask test results in a match, the MasterBit field will be checked. If it is set on the key, the key matches the lock and no further testing is needed. Otherwise, the LockID will be tested. If the key and door have identical LockID fields, the key matches the door, otherwise it does not. LockID is a decimal field, not a binary field. Its range is 0-255 in both DromEd for Thief 1 and DromEd for Thief 2. Entering a value x outside this range will set the field to x mod 256 (e.g. 300 will set the field to 44).
Setting the MasterBit field on a lock does not appear to have any effect on whether any specific key can open it or not.