Prev: 39475 Up: Map Next: 39574
39507: Draw Top Right Corner
Used by the routine at Draw_Room.
Draws the top right corner of the frame of the room if bit 1 of the frame flags is set, or clears its area if it is not.
The corner is three bytes wide and 32 lines high and is drawn at x position 232 y position 16. The shape depends on whether the ceiling (bit 0) and the right wall (bit 2) are present, and on the room x and y: the table at Top_Right_Corner_Table has a set of four shapes for each of four combinations of the room coordinates. The routine also draws the other corners, which jump to Draw_Corner_Shape.
Input
DE Frame flags of the room in E
IX Object record of Sabreman
Draw_Top_Right_Corner 39507 PUSH DE Stash the frame flags on the stack.
39508 LD HL,4328 Set the x position to 232 and the y position to 16 (4328).
39511 LD A,E Copy the frame flags to A.
39512 LD DE,39574 Point at the table of corner shapes (Top_Right_Corner_Table).
39515 BIT 1,A Jump to 39522 to clear the area if the corner is not present.
39517 JP Z,Clear_Panel
39519 SBC A,C
Draw_Corner 39520 PUSH HL Stash the position on the stack.
39521 EX DE,HL Exchange the registers so that HL holds the address of the table.
39522 BIT 0,A Jump to Draw_Top_Right_Corner_Check_Right_Wall if the ceiling is not present.
39524 JR Z,Draw_Top_Right_Corner_Check_Right_Wall
39526 INC HL Skip the shapes for a ceiling.
39527 INC HL
Draw_Top_Right_Corner_Check_Right_Wall 39528 BIT 2,A Jump to Draw_Corner_Shape if the right wall is not present.
39530 JR Z,Draw_Corner_Shape
39532 INC HL Skip the shapes for a right wall.
39533 INC HL
39534 INC HL
39535 INC HL
This entry point is used by the routines at Draw_Bottom_Right_Corner, Draw_Bottom_Left_Corner and Draw_Top_Left_Corner.
Draw_Corner_Shape 39536 LD A,(IX+2) Fetch the room x of Sabreman.
39539 ADD A,(IX+4) Add the room y of Sabreman.
39542 ADD A,A Multiply the sum by eight.
39543 ADD A,A
39544 ADD A,A
39545 AND %00011000 Keep only bits 3 and 4.
39547 LD C,A Store the offset in C.
39548 LD B,0 Clear the high byte of the offset.
39550 ADD HL,BC Add the offset to the address in the table.
39551 LD A,(HL) Fetch the low byte of the address of the shape.
39552 INC HL Move on to the high byte.
39553 LD H,(HL) Fetch the high byte of the address of the shape.
39554 LD L,A Copy the low byte to L.
39555 EX DE,HL Exchange the registers so that DE holds the address of the shape.
39556 LD BC,800 Set the size of the area to three bytes wide, 32 lines high (800).
39559 CALL ScreenAddress Convert the position into a screen address.
39562 CALL Draw_Tile_Without_Header Draw the shape.
39565 POP HL Restore the position from the stack.
39566 LD BC,800 Set the size of the area to 800.
39569 CALL Set_Area_Attributes Set the attributes of the area.
39572 POP DE Restore the frame flags from the stack.
39573 RET Return.
Prev: 39475 Up: Map Next: 39574