Prev: 8EED Up: Map Next: 8F43
8EEE: Room handler for the Castle combination lock room.
This is the room with the rotating letters that act as a comination lock in the Castle.
Input
Output
Room_CastleLock 8EEE LD HL,(Room_CurrentDataPtr) Gets a pointer to the store holding the three characters being displayed.
8EF1 LD DE,$0009
8EF4 ADD HL,DE
8EF5 LD DE,(Room_CurrentInfoDataPtr) Get a pointer to the current room info.
8EF9 LD IX,Combinator_Handler Data used to rotate and display the letters.
8EFD LD B,$03 Three roating letter locks to handle.
Room_CastleLock_0 8EFF PUSH BC
8F00 INC DE Move room pointer onto next object in the room.
8F01 LD A,(IX+$03) Get counter
8F04 CP $0D
8F06 JR NC,Room_CastleLock_1
8F08 LD A,(DE) See if an object has been placed on a locks plinth.
8F09 AND A
8F0A LD A,$00
8F0C JR NZ,Room_CastleLock_4
No object on plinth.
Room_CastleLock_1 8F0E LD A,(IX+$03) Increase counter if there is no object to stop the lock rotating.
8F11 INC A
8F12 CP $14
8F14 JR C,Room_CastleLock_3 Less than $14,
8F16 LD A,(HL) Get the next letter to rotate to.
8F17 INC A
8F18 CP $7B check to see if we have reached 'Z'
8F1A JR C,Room_CastleLock_2
8F1C LD A,$61 Reset to 'A' if reached.
Room_CastleLock_2 8F1E LD (HL),A and store new letter value.
8F1F XOR A
8F20 LD (IX+$04),A Reset bitmap offset counter.
8F23 JR Room_CastleLock_4
Rotate letter image.
Room_CastleLock_3 8F25 CP $11 Only rotate letter if the counter if $11 or more.
8F27 JR C,Room_CastleLock_4
8F29 INC (IX+$04) Increase bitmap offset to rotate the letter image.
8F2C INC (IX+$04)
Room_CastleLock_4 8F2F LD (IX+$03),A Store new counter value.
8F32 LD A,(HL) Get current letter value, store in sprite info and draw the letter.
8F33 LD (IX+$00),A
8F36 CALL char_BlitScrolledVert
8F39 LD BC,$000C Shift onto next lock information.
8F3C ADD IX,BC
8F3E INC HL
8F3F POP BC
8F40 DJNZ Room_CastleLock_0
8F42 RET
Prev: 8EED Up: Map Next: 8F43