Prev: 44657 Up: Map Next: 44729
44673: Set Up Rope
Used by the routine at Draw_Room.
Sets up the rope for the room that has just been drawn, using the map entry of the room (see Read_World_Map). Bit 3 of the second byte says whether the room has a rope.
The rope is the object in record 3 (type 23).
The length of the rope is stored in Rope_Length. It is half of the sum of 255 (or 160 if bit 2 is reset) and 256 times the two low bits of the second byte.
Set_Up_Rope 44673 CALL Read_World_Map Read the world map entry of the room into DE.
44676 LD A,E Copy the room flags to A.
44677 LD (43692),A Store the room flags in Room_Flags.
44680 XOR A Clear the displacement of the end of the rope in pixels (Rope_Displacement_Pixels).
44681 LD (43684),A
44684 LD (43683),A Clear the fraction of the displacement of the end of the rope (Rope_Displacement).
44687 BIT 3,D Jump to Set_Up_Rope_Remove_Rope if there is no rope in this room (bit 3 of the second byte of the world map entry is clear).
44689 JR Z,Set_Up_Rope_Remove_Rope
44691 LD A,23 Use the type of the rope (23).
44693 LD (36650),A Store it as the type of record 3 (the rope).
44696 LD HL,0 Clear the previous position of the end of the rope (Previous_Rope_End_Position).
44699 LD (43671),HL
44702 BIT 2,D Jump to Set_Up_Rope_Set_Length if the rope is a short one (bit 2 of the second byte of the world map entry is clear).
44704 JR Z,Set_Up_Rope_Set_Length
44706 LD L,255 Set the low byte of the length of a long rope to 255.
Set_Up_Rope_Fetch_Second_Byte 44708 LD A,D Fetch the second byte of the world map entry.
44709 AND %00000011 Keep only the two low bits (the number of rooms down the rope).
44711 LD H,A Store them in the high byte of the length.
44712 SRA H Halve the length of the rope.
44714 RR L
44716 LD (43685),HL Store the length of the rope in Rope_Length.
44719 RET Return.
Set_Up_Rope_Remove_Rope 44720 XOR A Remove the rope by clearing the type of record 3.
44721 LD (36650),A
44724 RET Return.
Set_Up_Rope_Set_Length 44725 LD L,160 Set the low byte of the length of a short rope to 160.
44727 JR Set_Up_Rope_Fetch_Second_Byte Jump to Set_Up_Rope_Fetch_Second_Byte.
Prev: 44657 Up: Map Next: 44729