| The Hobbit (v1.0) | Routines |
| Prev: A268 | Up: Map | Next: A28E |
|
Shared by the LOCK and UNLOCK handlers of the locked doors; on entry B is the object number of the key that fits (for example 15, the red key, from A264).
If the instrument is that key, the door is locked or unlocked (93CD, 93ED). If the instrument is one of the game's other keys - object 2 (the small curious key), object 4 (the large key) or object 15 (the red key) - the game says 'the key does not fit this lock.' Anything else, such as trying to unlock a door with the sword, gets 'I cannot do that.'
|
||||||||
| A26A | LD A,($B5DA) | A = the object being used as the key | ||||||
| A26D | CP B | Is it the key that fits this door? | ||||||
| A26E | JR NZ,$A27B | No: see what it is | ||||||
| A270 | LD A,($B5D8) | Yes. Is the action LOCK (action 37)? | ||||||
| A273 | CP $25 | |||||||
| A275 | JP Z,$93CD | Yes: lock the door | ||||||
| A278 | JP $93ED | No: unlock it | ||||||
| A27B | CP $02 | Is the object the small curious key (object 2)... | ||||||
| A27D | JR Z,$A288 | |||||||
| A27F | CP $04 | ...the large key (object 4)... | ||||||
| A281 | JR Z,$A288 | |||||||
| A283 | CP $0F | ...or the red key (object 15)? | ||||||
| A285 | JP NZ,$72C5 | None of these: "I cannot do that." | ||||||
| A288 | LD HL,$AF1F | A key, but the wrong one: "the key does not fit this lock." | ||||||
| A28B | JP $72D4 | |||||||
| Prev: A268 | Up: Map | Next: A28E |