Routines |
Prev: B4B6 | Up: Map | Next: B4D0 |
This is the common end of the previous three routines.
Used by the routines at action_red_key and action_yellow_key.
|
||||||||
action_key | B4B8 | PUSH AF | Preserve the room number while we get the nearest door | |||||
B4B9 | CALL get_nearest_door | Return the nearest door in range of the hero in HL | ||||||
B4BC | POP BC | Restore the room number | ||||||
B4BD | RET NZ | Return if no door was nearby | ||||||
B4BE | LD A,(HL) | Fetch door index + flag | ||||||
B4BF | AND $7F | Mask off door_LOCKED flag to get door index alone | ||||||
B4C1 | CP B | Are they equal? | ||||||
B4C2 | LD B,$07 | Set B to message_INCORRECT_KEY irrespectively | ||||||
B4C4 | JR NZ,action_key_0 | Jump if not equal | ||||||
B4C6 | RES 7,(HL) | Unlock the door by resetting door_LOCKED ($80) | ||||||
B4C8 | CALL increase_morale_by_10_score_by_50 | Increase morale by 10, score by 50 | ||||||
B4CB | LD B,$06 | Set B to message_IT_IS_OPEN | ||||||
action_key_0 | B4CD | JP queue_message | Queue the message identified by B |
Prev: B4B6 | Up: Map | Next: B4D0 |