![]() |
Routines |
Prev: 43224 | Up: Map | Next: 43671 |
Used by the routine at Controller_DrawRoom.
|
||||
Clear the screen to BLACK.
|
||||
DrawRoom | 43264 | LD A,0 | Write BLACK to *ATTR_P. | |
43266 | LD (23693),A | |||
43269 | CALL ClearRoomBuffer | Call ClearRoomBuffer. | ||
43272 | LD A,(23505) | A=*ActiveRoom_PaperColour. | ||
43275 | SLA A | Convert a PAPER value (using bits 3, 4 and 5) to an "INK" value (shifted left to bits 0, 1 and 2). | ||
43277 | SLA A | |||
43279 | SLA A | |||
43281 | LD (23693),A | Write A to *ATTR_P. | ||
43284 | LD A,17 | Set PAPER: *ActiveRoom_PaperColour. | ||
43286 | RST 16 | |||
43287 | LD A,(23505) | |||
43290 | RST 16 | |||
Set the UDG graphics pointer.
|
||||
43291 | LD HL,33656 | Write 33656 (Graphics_RoomScaffolding_Empty) to *CHARS. | ||
43294 | LD (23606),HL | |||
Set the attributes for drawing the room scaffolding (i.e. ceilings and floors).
|
||||
43297 | LD A,16 | Set INK: *ActiveRoom_ScaffoldingColour. | ||
43299 | RST 16 | |||
43300 | LD A,(23503) | |||
43303 | RST 16 | |||
Fetch the address of the current room data buffer.
|
||||
43304 | LD HL,(23528) | HL=*PointerCurrentRoomBuffer. | ||
Draw the ceilings/ floors.
|
||||
DrawRoomScaffolding | 43307 | LD C,(HL) | Get the screen co-ordinates where the scaffolding will begin printing from the current room data buffer and store them in BC. | |
43308 | INC HL | |||
43309 | LD B,(HL) | |||
43310 | INC HL | Increment the current room data buffer by one. | ||
43311 | LD A,255 | Jump to DrawRoomLadders if the terminator character has been received (255). | ||
43313 | CP C | |||
43314 | JR Z,DrawRoomLadders | |||
43316 | PUSH HL | Stash the current room data buffer on the stack. | ||
43317 | CALL 43118 | Call 43118. | ||
Set the co-ordinates of where we're going to PRINT AT.
|
||||
43320 | CALL 3545 | Call CL_SET. | ||
43323 | POP HL | Restore the current room data buffer from the stack. | ||
43324 | LD B,(HL) | Fetch the length counter and store it in B. | ||
43325 | INC HL | Increment the current room data buffer by one. | ||
All scaffolding is two bytes wide, alternating between Graphics_RoomScaffolding_Top1 and Graphics_RoomScaffolding_Top2.
|
||||
DrawRoomScaffolding_Loop | 43326 | LD A,33 | A=Graphics_RoomScaffolding_Top1 (33). | |
43328 | CALL PopulateRoomBuffer | Call PopulateRoomBuffer. | ||
43331 | CALL PrintUDG | Call PrintUDG. | ||
43334 | LD A,34 | A=Graphics_RoomScaffolding_Top2 (34). | ||
43336 | CALL PopulateRoomBuffer | Call PopulateRoomBuffer. | ||
43339 | CALL PrintUDG | Call PrintUDG. | ||
43342 | DJNZ DrawRoomScaffolding_Loop | Decrease counter by one and loop back to DrawRoomScaffolding_Loop until counter is zero. | ||
43344 | JR DrawRoomScaffolding | Jump to DrawRoomScaffolding. | ||
Draw the ladders.
|
||||
DrawRoomLadders | 43346 | LD A,16 | Set INK: *ActiveRoom_LadderColour. | |
43348 | RST 16 | |||
43349 | LD A,(23506) | |||
43352 | RST 16 | |||
43353 | LD HL,(23512) | HL=*ReferenceLadders. | ||
DrawRoomLadders_Loop | 43356 | LD A,(HL) | A=*HL. | |
43357 | CP 255 | Jump to DrawRoomDoors if the room data is the termination byte (255). | ||
43359 | JR Z,DrawRoomDoors | |||
43361 | LD C,A | C=A. | ||
43362 | INC HL | Increment HL by one. | ||
43363 | LD B,(HL) | B=*HL. | ||
43364 | INC HL | Increment HL by one. | ||
43365 | LD A,47 | A=Graphics_Ladder (47). | ||
43367 | LD E,2 | E=Sprite width (2). | ||
43369 | LD D,5 | D=Sprite height (5). | ||
43371 | CALL 43071 | Call 43071. | ||
43374 | CALL 43183 | Call 43183. | ||
43377 | JR DrawRoomLadders_Loop | Jump to DrawRoomLadders_Loop. | ||
Draws the front facing doors which lead to other rooms.
|
||||
DrawRoomDoors | 43379 | LD HL,(23510) | HL=*ReferenceDoors. | |
DrawRoomDoors_Loop | 43382 | LD C,(HL) | C=*HL. | |
43383 | INC HL | Increment HL by one. | ||
43384 | LD B,(HL) | B=*HL. | ||
43385 | INC HL | Increment HL by one. | ||
43386 | LD A,(HL) | A=*HL. | ||
43387 | INC HL | Increment HL by two. | ||
43388 | INC HL | |||
43389 | PUSH AF | Stash AF on the stack. | ||
43390 | LD A,255 | Jump to DrawRoomKeysAndLockedDoors if 255 is equal to C. | ||
43392 | CP C | |||
43393 | JR Z,DrawRoomKeysAndLockedDoors | |||
43395 | LD A,16 | Set INK to ... | ||
43397 | RST 16 | |||
43398 | POP AF | Restore AF from the stack. | ||
43399 | RST 16 | ... the value held in A (from the stack). | ||
43400 | LD A,35 | A=Graphics_Door (35). | ||
43402 | LD E,3 | E=Sprite width (3). | ||
43404 | LD D,4 | D=Sprite height (4). | ||
43406 | CALL 43071 | Call 43071. | ||
43409 | CALL 43183 | Call 43183. | ||
43412 | JR DrawRoomDoors_Loop | Jump to DrawRoomDoors_Loop. | ||
Draws the numbered keys and locked doors which correlate to them.
|
||||
DrawRoomKeysAndLockedDoors | 43414 | POP AF | Restore AF from the stack. | |
43415 | LD A,16 | Set INK: *ActiveRoom_ScaffoldingColour. | ||
43417 | RST 16 | |||
43418 | LD A,(23503) | |||
43421 | RST 16 | |||
43422 | LD IX,(23514) | IX=*ReferenceKeysAndLockedDoors. | ||
DrawRoomKeysAndLockedDoors_Loop | 43426 | LD C,(IX+0) | C=*IX+0. | |
43429 | LD A,255 | Jump to DrawRoomItems if 255 is equal to C. | ||
43431 | CP C | |||
43432 | JR Z,DrawRoomItems | |||
43434 | LD A,(IX+5) | Jump to DrawRoomKeysAndLockedDoors_Next if *IX+5 is equal to 0. | ||
43437 | CP 0 | |||
43439 | JR Z,DrawRoomKeysAndLockedDoors_Next | |||
43441 | LD (IX+5),3 | Write 3 to *IX+5. | ||
43445 | LD B,(IX+1) | B=*IX+1. | ||
43448 | PUSH BC | Stash BC on the stack. | ||
43449 | CALL 43118 | Call 43118. | ||
43452 | CALL 3545 | Call CL_SET. | ||
43455 | LD A,16 | Set INK: *ActiveRoom_ScaffoldingColour. | ||
43457 | RST 16 | |||
43458 | LD A,(23503) | |||
43461 | RST 16 | |||
43462 | LD A,(IX+4) | A=*IX+4. | ||
43465 | ADD A,56 | A+=56. | ||
43467 | CALL PopulateRoomBuffer | Call PopulateRoomBuffer. | ||
43470 | CALL PrintUDG | Call PrintUDG. | ||
43473 | LD A,16 | Set INK: *ActiveRoom_ClosedDoorColour. | ||
43475 | RST 16 | |||
43476 | LD A,(23501) | |||
43479 | RST 16 | |||
43480 | POP BC | Restore BC from the stack. | ||
43481 | DEC B | Decrease B by one. | ||
43482 | LD A,76 | A=Graphics_DoorClosed (76). | ||
43484 | LD E,1 | E=Sprite width (1). | ||
43486 | LD D,4 | D=Sprite height (4). | ||
43488 | CALL 43071 | Call 43071. | ||
43491 | CALL 43183 | Call 43183. | ||
43494 | LD C,(IX+2) | C=*IX+2. | ||
43497 | LD B,(IX+3) | B=*IX+3. | ||
43500 | PUSH BC | Stash BC on the stack. | ||
43501 | CALL 43118 | Call 43118. | ||
43504 | CALL 3545 | Call CL_SET. | ||
43507 | LD A,16 | Set INK: *ActiveRoom_KeyColour. | ||
43509 | RST 16 | |||
43510 | LD A,(23500) | |||
43513 | RST 16 | |||
43514 | LD A,(IX+4) | A=*IX+4. | ||
43517 | ADD A,65 | A+=65. | ||
43519 | CALL PopulateRoomBuffer | Call PopulateRoomBuffer. | ||
43522 | CALL PrintUDG | Call PrintUDG. | ||
43525 | POP BC | Restore BC from the stack. | ||
43526 | DEC B | Decrease B by one. | ||
43527 | CALL 43118 | Call 43118. | ||
43530 | CALL 3545 | Call CL_SET. | ||
All the keys share the same bottom half.
|
||||
43533 | LD A,75 | A=Graphics_KeyBottom (75). | ||
43535 | CALL PopulateRoomBuffer | Call PopulateRoomBuffer. | ||
43538 | CALL PrintUDG | Call PrintUDG. | ||
DrawRoomKeysAndLockedDoors_Next | 43541 | LD DE,6 | IX+=0006. | |
43544 | ADD IX,DE | |||
43546 | JR DrawRoomKeysAndLockedDoors_Loop | Jump to DrawRoomKeysAndLockedDoors_Loop. | ||
Draw room items.
|
||||
DrawRoomItems | 43548 | LD IX,(23520) | IX=*ReferenceItems. | |
DrawRoomItems_Loop | 43552 | LD A,(IX+0) | Jump to DrawRoomFurniture if *IX+0 is equal to 255. | |
43555 | CP 255 | |||
43557 | JR Z,DrawRoomFurniture | |||
43559 | LD A,(IX+5) | Jump to DrawRoomItems_Next if *IX+5 is equal to 0. | ||
43562 | CP 0 | |||
43564 | JR Z,DrawRoomItems_Next | |||
43566 | LD A,16 | Set INK: *IX+4. | ||
43568 | RST 16 | |||
43569 | LD A,(IX+4) | |||
43572 | RST 16 | |||
43573 | LD C,(IX+0) | C=*IX+0. | ||
43576 | LD B,(IX+1) | B=*IX+1. | ||
43579 | LD D,2 | D=Sprite height (2). | ||
43581 | LD E,2 | E=Sprite width (2). | ||
43583 | LD A,(IX+6) | A=*IX+6. | ||
43586 | CALL 43071 | Call 43071. | ||
43589 | CALL 43183 | Call 43183. | ||
DrawRoomItems_Next | 43592 | LD DE,7 | IX+=0007. | |
43595 | ADD IX,DE | |||
43597 | JR DrawRoomItems_Loop | Jump to DrawRoomItems_Loop. | ||
Draw all the room "furniture", like the barrels and stacks of crates.
|
||||
DrawRoomFurniture | 43599 | LD HL,34424 | Write 34424 (Graphics_Barrels) to *CHARS. | |
43602 | LD (23606),HL | |||
43605 | LD IX,(23522) | IX=*ReferenceFurniture. | ||
DrawRoomFurniture_Loop | 43609 | LD A,(IX+0) | Jump to WriteRoomAttributes if *IX+0 is equal to 255. | |
43612 | CP 255 | |||
43614 | JR Z,WriteRoomAttributes | |||
43616 | LD A,16 | Set INK: *IX+3. | ||
43618 | RST 16 | |||
43619 | LD A,(IX+3) | |||
43622 | RST 16 | |||
43623 | LD C,(IX+0) | C=*IX+0. | ||
43626 | LD B,(IX+1) | B=*IX+1. | ||
43629 | LD D,4 | D=Sprite height (4). | ||
43631 | LD E,6 | E=Sprite width (6). | ||
43633 | LD A,(IX+2) | A=*IX+2. | ||
43636 | OR %10000000 | Set bit 7. | ||
43638 | CALL 43071 | Call 43071. | ||
43641 | AND %01111111 | Keep only bits 0-6. | ||
43643 | CALL 43183 | Call 43183. | ||
43646 | LD DE,4 | IX+=0004. | ||
43649 | ADD IX,DE | |||
43651 | JR DrawRoomFurniture_Loop | Jump to DrawRoomFurniture_Loop. | ||
Copy the room attributes buffer to the screen.
|
||||
WriteRoomAttributes | 43653 | LD DE,22528 | Copy 768 bytes of data from BufferRoomAttributes to the attribute buffer. | |
43656 | LD HL,42212 | |||
43659 | LD BC,768 | |||
43662 | LDIR | |||
43664 | LD A,(23504) | Set the border to *Active_BorderColour using BORDER. | ||
43667 | CALL 8859 | |||
43670 | RET | Return. |
Prev: 43224 | Up: Map | Next: 43671 |