Prev: 54814 Up: Map Next: 55070
54884: Draw Doors
Preps door frame 1.
Draw_DoorFrame1 54884 LD HL,54961 Calls Door_Attributes using Door_Attributes_01.
54887 CALL Door_Attributes
54890 LD DE,47744 DE=Door_Frame_01.
Referencing the door frame index, work out the screen position and send it to the Draw_DoorFrame routine.
Prep_Door_Frame 54893 LD A,(52762) A=Door_Frame_Reference.
54896 LD HL,16514 Determines which screen address to use for the door reference index currently held in A.
A Screen Address
1 $4082
2 $408D
3 $4098
Jump to Draw_DoorFrame.
54899 DEC A
54900 JP Z,Draw_DoorFrame
54903 LD HL,16525
54906 DEC A
54907 JP Z,Draw_DoorFrame
54910 LD HL,16536
54913 JP Draw_DoorFrame
Copies attributes for the current door frame index.
Door_Attributes 54916 PUSH AF Stash the accumulator for later.
54917 LD A,(52762) A=Door_Frame_Reference.
54920 LD DE,22658
A Screen Address
1 $5882
2 $588D
3 $5898
...continue from Door_Attributes_Skip.
54923 DEC A
54924 JR Z,Door_Attributes_Skip
54926 LD DE,22669
54929 DEC A
54930 JR Z,Door_Attributes_Skip
54932 LD DE,22680
Door_Attributes_Skip 54935 LD B,11 Sets the height of the door image.
Door_Attributes_Loop 54937 PUSH BC Stash the references for later and call Door_Attributes_Copy.
54938 PUSH HL
54939 PUSH DE
54940 CALL Door_Attributes_Copy
54943 POP DE Moves the screen attribute address down to the next attribute row.
54944 LD HL,32
54947 ADD HL,DE
54948 EX DE,HL
54949 POP HL Restore the counter and loop back to Door_Attributes_Loop until complete.
54950 POP BC
54951 DJNZ Door_Attributes_Loop
54953 POP AF Restore the accumulator and return.
54954 RET
Simple helper copy routine for sending attribute data to the screen attribute buffer.
Door_Attributes_Copy 54955 LD BC,7 Set the door width, copy the attribute data to the screen and return.
54958 LDIR
54960 RET
Door frame attribute data.
Door_Attributes_01 54961 DEFB 48,48,48,48,48,48,48,48 Attribute data for door frame 1.
Door_Attributes_02 54969 DEFB 40,40,48,48,48,48,48,48 Attribute data for door frame 2.
Door_Attributes_03 54977 DEFB 40,40,40,40,48,48,48,48 Attribute data for door frame 3.
Door_Attributes_04 54985 DEFB 40,40,40,40,40,40,48,40 Attribute data for door frame 4.
Preps door frame 2.
Draw_DoorFrame02 54993 LD HL,54969 Calls Door_Attributes using Door_Attributes_02.
54996 CALL Door_Attributes
54999 CALL Character_Door_Frame_02 Prepare the character/ door image by calling Character_Door_Frame_02. Then pass Door_Buffer to Prep_Door_Frame which will draw it to the screen.
55002 LD DE,60048
55005 JR Prep_Door_Frame
Preps door frame 3.
Draw_DoorFrame03 55007 LD HL,54977 Calls Door_Attributes using Door_Attributes_03.
55010 CALL Door_Attributes
55013 CALL Character_Door_Frame_03 Prepare the character/ door image by calling Character_Door_Frame_03. Then pass Door_Buffer to Prep_Door_Frame which will draw it to the screen.
55016 LD DE,60048
55019 JR Prep_Door_Frame
Preps door frame 4.
Draw_DoorFrame04 55021 LD HL,54985 Calls Door_Attributes using Door_Attributes_04.
55024 CALL Door_Attributes
55027 CALL Draw_CharacterInDoorway The door is fully open so draw the whole character in the doorway directly.
55030 LD B,88 Reference Door_Frame_04 and the dimensions for the copy routine.
55032 LD C,1
55034 LD DE,49064
55037 LD A,(52762) A=Door_Frame_Reference.
55040 LD HL,16520 Determines which screen address to use for the door reference index currently held in A.
A Screen Address
1 $4088
2 $4093
3 $409E
Jump to Copy_Routine.
55043 DEC A
55044 JP Z,Copy_Routine
55047 LD HL,16531
55050 DEC A
55051 JP Z,Copy_Routine
55054 LD HL,16542
55057 JP Copy_Routine
55060 LD DE,60048 DE=Door_Buffer.
Draw_DoorFrame 55063 LD B,88 Draws the image pointed at by DE to the screen address in HL using Copy_Routine.
55065 LD C,7
55067 JP Copy_Routine
Prev: 54814 Up: Map Next: 55070