Prev: 29142 Up: Map Next: 29272
29174: Paint room layout data entry's terrain interaction parameters then advance to next entry (room drawing)
Used by the routine at 28070.
See also analogous routine at 28938 (RLE attribute data painting)
Input
HL Points to entry in lookup table for RLE terrain interaction data (room layout graphics) (at 52397)
29174 PUSH HL Store HL (pointer to entry in lookup table for RLE terrain interaction data)
29175 LD HL,23495 Modify instruction at 29220 to load x-coordinate of graphic's right edge into A...
29178 LD (29221),HL ...i.e. set end x-coordinate for painting left-to-right
29181 LD HL,29241 Modify instruction at 29224 to jump to 29241...
29184 LD (29225),HL ...i.e. advance HL down one character row in terrain interaction data table at 24064
29187 LD A,35 Modify instruction at 29227 with opcode 35 (INC HL)...
29189 LD (29227),A ...
29192 POP HL Restore HL (pointer to entry in lookup table for RLE terrain interaction data)
29193 CALL 29036 Store coordinates of area to be coloured and point IX at RLE terrain interaction data
29196 LD BC,(23493) Load BC with x- and y-coordinates (top-left) defined in current room layout data entry
This entry point is used by the routines at 29082, 29110 and 29142.
At this point, BC holds the initial coordinates in characters, from which to start painting terrain interaction parameters. IX points to the required RLE terrain interaction data.
29200 PUSH BC Store BC (B = current y-coordinate, C = initial x-coordinate)
29201 CALL 54162 Point HL at terrain interaction data table address for character coordinates x=C, y=B
29204 LD A,(IX+0) Load A with repeat count value
29207 OR A If repeat count is zero...
29208 JP Z,29237 ...then jump to 29237
29211 LD B,A Load B with repeat count
29212 LD C,(IX+1) Load C with terrain interaction parameter to paint
29215 LD (HL),C Apply terrain interaction parameter in C to current terrain interaction data table location in HL
29216 LD A,L Load E with x-coordinate (characters) of current terrain interaction data location...
29217 AND 31 ...
29219 LD E,A ...
The operand of the instruction at 29220 is modified by instructions at 29086, 29114, 29146, 29178, to 23493 (x-coordinate of left edge), 23495 (x-coordinate of right edge), 23493 (x-coordinate of left edge), or 23495 (x-coordinate of right edge) respectively.
29220 LD A,(23495) Load A with end x-coordinate for painting...
29223 CP E ...and if this is the same as the x-coordinate...
The operand of the instruction at 29224 (i.e. the destination of the jump) is modified by the instructions at 29092, 29120, 29152 and 29184 to be 29262 (move up one character row), 29262 (move up one character row), 29241 (move down one character row) or 29241 (move down one character row) respectively.
29224 JP Z,29241 ...then jump to routine to move up or down one character row
The instruction at 29227 is modified by the instructions at 29097, 29125, 29157 and 29189 to 43 (DEC HL), 35 (INC HL), 43 (DEC HL) or 35 (INC HL) respectively.
29227 INC HL Advance HL to next (or previous) byte in terrain interaction data table
29228 DJNZ 29215 Decrease B (repeat count) and loop back to 29215 if not zero
29230 INC IX Advance IX by two bytes in RLE terrain interaction data...
29232 INC IX ...
29234 JP 29204 Loop back to 29204 for this new data
29237 POP BC Restore BC (B = current y-coordinate, C = initial x-coordinate)
29238 JP 28095 Advance IX to start of next room layout data entry and jump back to 27989 to paint its attributes / terrain interaction data
Move down one character row
29241 EXX Switch registers
29242 LD A,(23496) Load A with one more than y-coordinate of bottom edge of area to paint...
29245 INC A ...
29246 POP BC Restore BC (B = current y-coordinate, C = initial x-coordinate)
29247 INC B Increase B (i.e. move down a character row)
29248 PUSH BC Store BC (B = updated y-coordinate, C = initial x-coordinate)
29249 CP B If B is the same as A (i.e. we are now outside the area to be painted)...
29250 JP Z,29237 ...then jump to 29237
29253 CALL 54162 Load HL with terrain interaction data table address for coordinates (C, B) and load E with x-coordinate (characters)
29256 PUSH HL Store HL (new terrain interaction data table address)
29257 EXX Switch registers
29258 POP HL Restore HL (new terrain interaction data table address)
29259 JP 29228 Jump back to 29228 and continue painting
Move up one character row
29262 EXX Switch registers
29263 LD A,(23494) Load A with one less than y-coordinate of top edge of area to paint...
29266 DEC A ...
29267 POP BC Restore BC (B = current y-coordinate, C = initial x-coordinate)
29268 DEC B Increase B (i.e. move down a character row)
29269 JP 29248 Jump back to 29248
Prev: 29142 Up: Map Next: 29272