Prev: 49679 Up: Map Next: 49808
49765: Check for and set up back wall brickwork/rock scenery
Used by the routine at 49679.
Input
C Contains either 0, indicating a 'blank' section of wall, or 2, indicating some brickwork.
Bit 0 has already been checked and is zero, indicating there isn't a door in this room position.
Checks for any brickwork scenery that needs to be set up. See Trivia: Setting the scene(ry) for an explanation of how DOORS and BRICKWORK are evaluated from the room data set.
Decoration for the back wall - scenery graphics that appears on the walls of 'brick' levels (40680) or 'cavern' levels (41013)
brickwork pattern 2 brickwork pattern 2 brickwork pattern 3 brickwork pattern 4
back wall scenery 1 back wall scenery 2 back wall scenery 3 back wall scenery 4
First, check if bit 1 is set - if so, there's brickwork at this position:
49765 LD A,C
49766 AND 2 Check bit 1. If it's set, there's BRICKWORK to set up at this room position.
49768 JR Z,49808 If it's NOT set, skip over the next routine.
Brickwork identified. Set up graphics pointers & data for one of 8 back wall brickwork ('brick' levels) or rock ('cavern level') patterns
49770 LD A,1 Graphics type = 1 (fixed scenery item)
49772 LD (60227),A
49775 LD A,(60280) Horizontal room position of item (in half-character/4-pixel increments). Copy into data buffer ready to be transferred into a room item data set (at 31744)
49778 LD (60232),A
49781 RRA Use this byte by shifting into the lowest 3 bits...
49782 RRA
49783 RRA
49784 AND 3 ...To provide one of 4 values (0-3), used to pick one of the four brickwork/decoration types
49786 INC A Incremented so number set correctly at 1-4
49787 LD (60240),A Store as graphics pointer offset
49790 LD A,L Use bits 0-4 of the low byte (L) of the HL register pair to set variable heights for the decoration. At the start of this routine, HL is typically at the start of one of the data bank sets at 31744, meaning the height (in relation to the top of the room, in pixels) will be either 0 or 16 pixels. However, this routine can be reached with HL pointing somewhere in the room data at 25001, so the height of the brickwork can be be quite varied.
49791 AND 31
49793 LD (60234),A
49796 LD C,23 Offset for brickwork graphics at 38851, pointing to 38895
49798 LD A,(60279) Add graphic offset if Maroc is on a 'cavern' level, to use the second set of rock graphics (38919) instead of the the bricks
49801 ADD A,C
49802 CALL 57538 Call setup graphics routine (copy graphics address pointers and mirror any relevant graphic data)
49805 CALL 57520 Copy the 16 bytes of graphic data for the brickwork scenery from the data buffer at 60227 to one of the room data sets at 31744.
Prev: 49679 Up: Map Next: 49808