![]() |
Routines |
| Prev: 98DF | Up: Map | Next: 998F |
|
Used by the routines at Run_Game, Handle_Sabreman_Walking, Handle_Falling_At_Right_Edge, Handle_Sabreman_Falling, Handle_Tumbling_At_Right_Edge, Handle_Sabreman_Tumbling, Lower_Rope, Raise_Rope, Check_Bubble_Contact, Move_Eagle_To_Next_Room and Handle_Death.
Draws the room that Sabreman is in and then carries on with the main loop. It does not return to its caller: it resets the stack.
First the play area is cleared. Then, for the rooms in the lower part of the map (the room y is 10 or more), the eight parts of the frame of the room are drawn, in the order of the bits of the first byte of the world map entry (see Draw_Ceiling), the objects of the room are set up and the room is marked as visited.
The rooms with a room y below 10 are special rooms, which are drawn by Draw_Special_Room_Frame, and which get their decorations from Load_Room_Decorations. A room y of FF is the way out of the Underwurlde and shows the ending (see Show_Ending_Screen).
|
||||||||
| Draw_Room | 9906 | DI | Disable interrupts. | |||||
| 9907 | CALL Clear_Play_Area | Clear the play area. | ||||||
| 990A | LD HL,$0000 | Clear the word at Previous_Rope_End_Position. | ||||||
| 990D | LD ($AA97),HL | |||||||
| 9910 | CALL Read_World_Map | Read the world map entry of the room into DE. | ||||||
| 9913 | LD A,(IX+$04) | Fetch the room y of Sabreman. | ||||||
| 9916 | CP $FF | Show the ending screen if the room y is FF. | ||||||
| 9918 | JP Z,Show_Ending_Screen | |||||||
| 991B | CP $10 | Jump to Draw_Room_Draw_Special_Room if the room y is below 10. | ||||||
| 991D | JP C,Draw_Room_Draw_Special_Room | |||||||
|
Draw the eight parts of the frame of the room. Each of the routines draws its part if the matching bit of E is set and clears the area if it is not.
|
||||||||
| 9920 | CALL Draw_Ceiling | Draw the ceiling (bit 0). | ||||||
| 9923 | CALL Draw_Top_Right_Corner | Draw the top right corner (bit 1). | ||||||
| 9926 | CALL Draw_Right_Wall | Draw the right wall (bit 2). | ||||||
| 9929 | CALL Draw_Bottom_Right_Corner | Draw the bottom right corner (bit 3). | ||||||
| 992C | CALL Draw_Floor | Draw the floor (bit 4). | ||||||
| 992F | CALL Draw_Bottom_Left_Corner | Draw the bottom left corner (bit 5). | ||||||
| 9932 | CALL Draw_Left_Wall | Draw the left wall (bit 6). | ||||||
| 9935 | CALL Draw_Top_Left_Corner | Draw the top left corner (bit 7). | ||||||
| 9938 | CALL Set_Up_Room_Objects | Set up the objects of the room (see Set_Up_Room_Objects). | ||||||
|
Mark the room as visited and set up the rest of the room.
|
||||||||
| Finish_Room | 993B | CALL Read_Room_State | Find the entry of the room in the room visit table. | |||||
| 993E | LD A,(HL) | Fetch the first byte of the entry. | ||||||
| 993F | AND A | Jump to Draw_Room_Print_Depth if the room has been visited before. | ||||||
| 9940 | JR NZ,Draw_Room_Print_Depth | |||||||
| 9942 | LD (HL),$01 | Mark the room as visited. | ||||||
| Draw_Room_Print_Depth | 9944 | CALL Print_Depth_From_Object | Print the depth of the room. | |||||
| 9947 | CALL Flag_Objects_For_Redraw | Flag all of the object records for redrawing. | ||||||
| 994A | CALL Flag_Small_Objects_For_Redraw | Flag the small object records for redrawing. | ||||||
| 994D | CALL Place_Special_Object | Place the collectable of the room, if it has one and it has not been collected. | ||||||
| 9950 | XOR A | Write 00 to Room_Flags. | ||||||
| 9951 | LD ($AAAC),A | |||||||
| 9954 | LD A,($8F29) | Fetch the redraw flags of Sabreman. | ||||||
| 9957 | OR %00000001 | Set bit 0 so that he is drawn without erasing. | ||||||
| 9959 | LD ($8F29),A | Store the redraw flags of Sabreman. | ||||||
| 995C | LD ($8F39),A | Store them in the redraw flags of the rope record too. | ||||||
| 995F | LD ($8EF0),A | Store them in the room redrawn flag at Room_Redrawn_Flag. | ||||||
| 9962 | LD A,($8F1A) | Fetch the type of Sabreman. | ||||||
| 9965 | CP $09 | Jump to Draw_Room_Reset_Stack if the type is below 09. | ||||||
| 9967 | JR C,Draw_Room_Reset_Stack | |||||||
| 9969 | CALL Set_Up_Rope | Set up the rope of the room. | ||||||
| Draw_Room_Reset_Stack | 996C | LD SP,$6000 | Reset the stack pointer to 6000 as this routine does not return. | |||||
| 996F | LD IX,$8F2A | Point at the object record of the rope (Rope_Record). | ||||||
| 9973 | LD HL,($5C78) | Fetch the frame counter. | ||||||
| 9976 | DEC HL | Subtract one. | ||||||
| 9977 | LD ($8EDF),HL | Store it in LastFrame so that the priority records are handled. | ||||||
| 997A | JP Run_Object_Handler | Jump to Run_Object_Handler to handle the rope record. | ||||||
|
The room is a special room.
|
||||||||
| Draw_Room_Draw_Special_Room | 997D | CALL Draw_Special_Room_Frame | Draw the special room. | |||||
| 9980 | LD HL,$8F9A | Point at the twelfth object record (Object_Record_10). | ||||||
| 9983 | LD B,$40 | Set the size of four records to 40. | ||||||
| Draw_Room_Clear_Records_Loop | 9985 | LD (HL),$00 | Write 00 to the byte. | |||||
| 9987 | INC HL | Move on to the next byte. | ||||||
| 9988 | DJNZ Draw_Room_Clear_Records_Loop | Decrease the counter and loop back until the four records are empty. | ||||||
| 998A | CALL Load_Room_Decorations | Load the decorations of the room. | ||||||
| 998D | JR Finish_Room | Jump to Finish_Room. | ||||||
| Prev: 98DF | Up: Map | Next: 998F |