Prev: AE71 Up: Map Next: AEB9
AE81: 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 17).
The length of the rope is stored in Rope_Length. It is half of the sum of FF (or A0 if bit 2 is reset) and 0100 times the two low bits of the second byte.
Set_Up_Rope AE81 CALL Read_World_Map Read the world map entry of the room into DE.
AE84 LD A,E Copy the room flags to A.
AE85 LD ($AAAC),A Store the room flags in Room_Flags.
AE88 XOR A Clear the displacement of the end of the rope in pixels (Rope_Displacement_Pixels).
AE89 LD ($AAA4),A
AE8C LD ($AAA3),A Clear the fraction of the displacement of the end of the rope (Rope_Displacement).
AE8F 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).
AE91 JR Z,Set_Up_Rope_Remove_Rope
AE93 LD A,$17 Use the type of the rope (17).
AE95 LD ($8F2A),A Store it as the type of record 3 (the rope).
AE98 LD HL,$0000 Clear the previous position of the end of the rope (Previous_Rope_End_Position).
AE9B LD ($AA97),HL
AE9E 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).
AEA0 JR Z,Set_Up_Rope_Set_Length
AEA2 LD L,$FF Set the low byte of the length of a long rope to FF.
Set_Up_Rope_Fetch_Second_Byte AEA4 LD A,D Fetch the second byte of the world map entry.
AEA5 AND %00000011 Keep only the two low bits (the number of rooms down the rope).
AEA7 LD H,A Store them in the high byte of the length.
AEA8 SRA H Halve the length of the rope.
AEAA RR L
AEAC LD ($AAA5),HL Store the length of the rope in Rope_Length.
AEAF RET Return.
Set_Up_Rope_Remove_Rope AEB0 XOR A Remove the rope by clearing the type of record 3.
AEB1 LD ($8F2A),A
AEB4 RET Return.
Set_Up_Rope_Set_Length AEB5 LD L,$A0 Set the low byte of the length of a short rope to A0.
AEB7 JR Set_Up_Rope_Fetch_Second_Byte Jump to Set_Up_Rope_Fetch_Second_Byte.
Prev: AE71 Up: Map Next: AEB9