Prev: 58609 Up: Map Next: 58868
58753: Handler: Disappearing Floors
Used by the routine at InitialiseGame.
Handler_DisappearingFloors 58753 LD IX,(23526) Point IX at *ReferenceDisappearingFloors.
Walk the disappearing-floor table.
Handler_DisappearingFloors_Loop 58757 LD A,(IX+0) Return if this floor entry is the terminator (255).
58760 CP 255
58762 RET Z
Bit 7 of the width byte holds whether the floor is visible.
58763 LD A,(IX+2) A=this floor's width and visibility state.
58766 AND %10000000 Keep only the visibility state.
58768 JP Z,DisplayFloor Jump to DisplayFloor if the floor is currently visible.
The floor is hidden; print empty space from Graphics_MaskSprite.
58771 LD HL,40812 Write 40812 to *CHARS.
58774 LD (23606),HL
58777 INC (IX+5) Advance this floor's change timer.
Stay hidden until the disappeared-timer count elapses.
58780 LD A,(IX+4) Jump to PrintDisappearedFloor if the hidden timer has not elapsed.
58783 CP (IX+5)
58786 JR NZ,PrintDisappearedFloor
Time to bring the floor back.
58788 LD A,(IX+2) A=this floor's width and visibility state.
58791 AND %01111111 Clear the hidden state so the floor will show next cycle.
58793 LD (IX+2),A Write the updated width and state back.
58796 LD (IX+5),0 Reset this floor's change timer.
Print blank tiles where the floor should be. The visible path at PrintVisibleFloor also updates the room buffer.
PrintDisappearedFloor 58800 LD C,(IX+0) C=the floor's horizontal co-ordinate.
58803 LD B,(IX+1) B=the floor's vertical co-ordinate.
Bits 0-6 hold the floor width.
58806 LD A,(IX+2) A=this floor's width and visibility state.
58809 AND %01111111 Keep only the width.
58811 LD E,A E=the floor width.
58812 LD D,1 D=1 (floors are one row high).
58814 LD A,32 A=a blank tile.
58816 CALL PrintSprite Print the empty floor space.
58819 JR DisappearingFloors_Next Jump to DisappearingFloors_Next.
The floor is visible; count down until it should vanish.
DisplayFloor 58821 LD A,(IX+3) Fetch how long this floor stays visible.
58824 INC (IX+5) Advance this floor's change timer.
58827 CP (IX+5) Jump to PrintVisibleFloor if the visible timer has not elapsed.
58830 JR NZ,PrintVisibleFloor
Time to hide the floor.
58832 LD A,(IX+2) A=this floor's width and visibility state.
58835 OR %10000000 Set the hidden state so the floor will vanish next cycle.
58837 LD (IX+2),A Write the updated width and state back.
58840 LD (IX+5),0 Reset this floor's change timer.
Draw the floor and update the room buffer.
PrintVisibleFloor 58844 LD C,(IX+0) C=the floor's horizontal co-ordinate.
58847 LD B,(IX+1) B=the floor's vertical co-ordinate.
Bits 0-6 hold the floor width.
58850 LD A,(IX+2) A=this floor's width and visibility state.
58853 AND %01111111 Keep only the width.
58855 LD E,A E=the floor width.
58856 LD D,1 D=1 (floors are one row high).
58858 CALL PrintSpriteUpdateBuffer Print the floor and update the room buffer.
Move onto the next disappearing floor.
DisappearingFloors_Next 58861 LD DE,6 Move IX on to the next six-byte floor entry.
58864 ADD IX,DE
58866 JR Handler_DisappearingFloors_Loop Jump to Handler_DisappearingFloors_Loop.
Prev: 58609 Up: Map Next: 58868