Prev: 40658 Up: Map Next: 40729
40664: Room drawing: Read graphic definition from room layout data and draw
Used by the routine at 38841.
Input
A Index of graphic to draw
C Mirror options (bit 0 = apply vertical mirror, bit 1 = apply horizontal mirror)
H y-coordinate (characters)
L x-coordinate (characters)
40664 PUSH BC Store BC (C = horizontal / vertical mirror options)
40665 PUSH HL Store HL (H = y-coordinate, L = x-coordinate)
40666 LD L,A Load four times index of graphic to draw into HL...
40667 LD H,0 ...
40669 ADD HL,HL ...
40670 ADD HL,HL ...
40671 LD BC,29272 ...and add (in HL) to address of start of graphics data lookup table at 29272 as an offset...
40674 ADD HL,BC ...
40675 LD C,(HL) Load width & height at this location into BC...
40676 INC HL ...
40677 LD B,(HL) ...
40678 INC HL ...
40679 LD A,(HL) Load address of graphic data into HL...
40680 INC HL ...
40681 LD H,(HL) ...
40682 LD L,A ...
40683 LD (23447),HL ...and store at 23447
40686 POP HL Restore HL (H = y-coordinate, L = x-coordinate)...
40687 LD (23408),HL ...and store at 23408
40690 ADD HL,BC Add width and height to get coordinates (x+1, y+1) of bottom right of graphic to draw...
40691 LD (23410),HL ...and store at 23410
40694 POP BC Restore BC (C = horizontal / vertical mirror options)
40695 LD A,C If both mirror options are switched off...
40696 AND 3 ...
40698 JP Z,40717 ...then skip ahead to 40717
40701 CP 1 If only the apply-vertical-mirror option is switched on...
40703 JP Z,40720 ...then skip ahead to 40720
40706 CP 2 If only the apply-horizontal-mirror option is switched on...
40708 JP Z,40723 ...then skip ahead to 40723
40711 CP 3 If both mirror options are switched on...
40713 JP Z,40726 ...then skip ahead to 40726
40716 RET Return
40717 JP 61214 Reset apply-vertical-mirror flag, reset apply-horizontal-mirror flag, draw the graphic and return
40720 JP 61236 Set apply-vertical-mirror flag, reset apply-horizontal-mirror flag, draw the graphic and return
40723 JP 61267 Reset apply-vertical-mirror flag, set apply-horizontal-mirror flag, draw the graphic and return
40726 JP 61297 Set apply-vertical-mirror flag, set apply-horizontal-mirror flag, draw the graphic and return
Prev: 40658 Up: Map Next: 40729