![]() |
Routines |
Prev: 58609 | Up: Map | Next: 58868 |
Used by the routine at InitialiseGame.
|
||||
Handler_DisappearingFloors | 58753 | LD IX,(23526) | IX=*ReferenceDisappearingFloors. | |
Are we done?
|
||||
Handler_DisappearingFloors_Loop | 58757 | LD A,(IX+0) | Return if the terminator character has been received instead of a co-ordinate (255). | |
58760 | CP 255 | |||
58762 | RET Z | |||
Bit 7 of *IX+2 holds the floor "state".
Is the floor currently visible?
|
||||
58763 | LD A,(IX+2) | A=Sprite width+state (*IX+2). | ||
58766 | AND %10000000 | Keep only the current "state". | ||
58768 | JP Z,DisplayFloor | Jump to DisplayFloor if the floor should be visible. | ||
We didn't jump, so the floor is currently NOT visible.
The game uses a bunch of 0 bytes at Graphics_MaskSprite to "print empty space" - this is how we remove sprites.
|
||||
58771 | LD HL,40812 | Write 40812 (Graphics_MaskSprite) to *CHARS. | ||
58774 | LD (23606),HL | |||
58777 | INC (IX+5) | Increment the the floor change timer (*IX+5) by one. | ||
Check the current floor change timer against the max. count for how long the floor should stay disappeared for.
|
||||
58780 | LD A,(IX+4) | Jump to PrintDisappearedFloor if the current floor change timer has not yet reached the maximum value set in the disappeared timer count. | ||
58783 | CP (IX+5) | |||
58786 | JR NZ,PrintDisappearedFloor | |||
The timer for how long the floor should be "disappeared" has elapsed.
|
||||
58788 | LD A,(IX+2) | A=Sprite width+state (*IX+2). | ||
58791 | AND %01111111 | Strip off bit 7 (which is the current "state") as we need to unset it so the floor will display next cycle. | ||
58793 | LD (IX+2),A | Write this value back to sprite width+state (*IX+2). | ||
58796 | LD (IX+5),0 | Reset the the floor change timer back to 0. | ||
Whilst this routine could also print the floor as well, the game needs to update other buffers when it changes, so this version is a lot simpler.
|
||||
PrintDisappearedFloor | 58800 | LD C,(IX+0) | C=Horizontal position (*IX+0). | |
58803 | LD B,(IX+1) | B=Vertical position (*IX+1). | ||
Bits 0-6 of *IX+2 hold the floor width.
|
||||
58806 | LD A,(IX+2) | A=Sprite width+state (*IX+2). | ||
58809 | AND %01111111 | Strip off bit 7 (which is the current "state") as we need the actual width to render the empty space where the floor should be. | ||
58811 | LD E,A | E=Sprite width (A). | ||
58812 | LD D,1 | D=Sprite height (always 1). | ||
58814 | LD A,32 | A=base sprite ID (32). | ||
58816 | CALL PrintSprite | Call PrintSprite. | ||
58819 | JR DisappearingFloors_Next | Jump to DisappearingFloors_Next. | ||
The floor is currently visible so handle checking the current floor change timer against the max. count for how long the floor should stay visible for.
|
||||
DisplayFloor | 58821 | LD A,(IX+3) | Fetch the maximum visible count value. | |
58824 | INC (IX+5) | Increment the the floor change timer by one. | ||
58827 | CP (IX+5) | Jump to PrintVisibleFloor if the current floor change timer has not yet reached the maximum value set in the visible timer count. | ||
58830 | JR NZ,PrintVisibleFloor | |||
The timer for how long the floor should be "visible" has elapsed.
|
||||
58832 | LD A,(IX+2) | A=Sprite width+state (*IX+2). | ||
58835 | OR %10000000 | Set bit 7 (which is the current "state") so the floor will disappear next cycle. | ||
58837 | LD (IX+2),A | Write this value back to sprite width+state (*IX+2). | ||
58840 | LD (IX+5),0 | Reset the the floor change timer back to 0. | ||
Display the visible floor. Note the similarity to PrintDisappearedFloor.
|
||||
PrintVisibleFloor | 58844 | LD C,(IX+0) | C=Horizontal position (*IX+0). | |
58847 | LD B,(IX+1) | B=Vertical position (*IX+1). | ||
Bits 0-6 of *IX+2 hold the floor width.
|
||||
58850 | LD A,(IX+2) | A=Sprite width+state (*IX+2). | ||
58853 | AND %01111111 | Strip off bit 7 (which is the current "state") as we need the actual width to render the floor. | ||
58855 | LD E,A | E=Sprite width (A). | ||
58856 | LD D,1 | D=Sprite height (always 1). | ||
58858 | CALL PrintSpriteUpdateBuffer | Call PrintSpriteUpdateBuffer. | ||
Move onto the next disappearing floor data.
|
||||
DisappearingFloors_Next | 58861 | LD DE,6 | IX+=0006. | |
58864 | ADD IX,DE | |||
58866 | JR Handler_DisappearingFloors_Loop | Jump to Handler_DisappearingFloors_Loop. |
Prev: 58609 | Up: Map | Next: 58868 |