![]() |
Routines |
| Prev: 39135 | Up: Map | Next: 39311 |
|
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 16 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 16 are special rooms, which are drawn by Draw_Special_Room_Frame, and which get their decorations from Load_Room_Decorations. A room y of 255 is the way out of the Underwurlde and shows the ending (see Show_Ending_Screen).
|
||||||||
| Draw_Room | 39174 | DI | Disable interrupts. | |||||
| 39175 | CALL Clear_Play_Area | Clear the play area. | ||||||
| 39178 | LD HL,0 | Clear the word at Previous_Rope_End_Position. | ||||||
| 39181 | LD (43671),HL | |||||||
| 39184 | CALL Read_World_Map | Read the world map entry of the room into DE. | ||||||
| 39187 | LD A,(IX+4) | Fetch the room y of Sabreman. | ||||||
| 39190 | CP 255 | Show the ending screen if the room y is 255. | ||||||
| 39192 | JP Z,Show_Ending_Screen | |||||||
| 39195 | CP 16 | Jump to Draw_Room_Draw_Special_Room if the room y is below 16. | ||||||
| 39197 | 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.
|
||||||||
| 39200 | CALL Draw_Ceiling | Draw the ceiling (bit 0). | ||||||
| 39203 | CALL Draw_Top_Right_Corner | Draw the top right corner (bit 1). | ||||||
| 39206 | CALL Draw_Right_Wall | Draw the right wall (bit 2). | ||||||
| 39209 | CALL Draw_Bottom_Right_Corner | Draw the bottom right corner (bit 3). | ||||||
| 39212 | CALL Draw_Floor | Draw the floor (bit 4). | ||||||
| 39215 | CALL Draw_Bottom_Left_Corner | Draw the bottom left corner (bit 5). | ||||||
| 39218 | CALL Draw_Left_Wall | Draw the left wall (bit 6). | ||||||
| 39221 | CALL Draw_Top_Left_Corner | Draw the top left corner (bit 7). | ||||||
| 39224 | 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 | 39227 | CALL Read_Room_State | Find the entry of the room in the room visit table. | |||||
| 39230 | LD A,(HL) | Fetch the first byte of the entry. | ||||||
| 39231 | AND A | Jump to Draw_Room_Print_Depth if the room has been visited before. | ||||||
| 39232 | JR NZ,Draw_Room_Print_Depth | |||||||
| 39234 | LD (HL),1 | Mark the room as visited. | ||||||
| Draw_Room_Print_Depth | 39236 | CALL Print_Depth_From_Object | Print the depth of the room. | |||||
| 39239 | CALL Flag_Objects_For_Redraw | Flag all of the object records for redrawing. | ||||||
| 39242 | CALL Flag_Small_Objects_For_Redraw | Flag the small object records for redrawing. | ||||||
| 39245 | CALL Place_Special_Object | Place the collectable of the room, if it has one and it has not been collected. | ||||||
| 39248 | XOR A | Write 0 to Room_Flags. | ||||||
| 39249 | LD (43692),A | |||||||
| 39252 | LD A,(36649) | Fetch the redraw flags of Sabreman. | ||||||
| 39255 | OR %00000001 | Set bit 0 so that he is drawn without erasing. | ||||||
| 39257 | LD (36649),A | Store the redraw flags of Sabreman. | ||||||
| 39260 | LD (36665),A | Store them in the redraw flags of the rope record too. | ||||||
| 39263 | LD (36592),A | Store them in the room redrawn flag at Room_Redrawn_Flag. | ||||||
| 39266 | LD A,(36634) | Fetch the type of Sabreman. | ||||||
| 39269 | CP 9 | Jump to Draw_Room_Reset_Stack if the type is below 9. | ||||||
| 39271 | JR C,Draw_Room_Reset_Stack | |||||||
| 39273 | CALL Set_Up_Rope | Set up the rope of the room. | ||||||
| Draw_Room_Reset_Stack | 39276 | LD SP,24576 | Reset the stack pointer to 24576 as this routine does not return. | |||||
| 39279 | LD IX,36650 | Point at the object record of the rope (Rope_Record). | ||||||
| 39283 | LD HL,(23672) | Fetch the frame counter. | ||||||
| 39286 | DEC HL | Subtract one. | ||||||
| 39287 | LD (36575),HL | Store it in LastFrame so that the priority records are handled. | ||||||
| 39290 | 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 | 39293 | CALL Draw_Special_Room_Frame | Draw the special room. | |||||
| 39296 | LD HL,36762 | Point at the twelfth object record (Object_Record_10). | ||||||
| 39299 | LD B,64 | Set the size of four records to 64. | ||||||
| Draw_Room_Clear_Records_Loop | 39301 | LD (HL),0 | Write 0 to the byte. | |||||
| 39303 | INC HL | Move on to the next byte. | ||||||
| 39304 | DJNZ Draw_Room_Clear_Records_Loop | Decrease the counter and loop back until the four records are empty. | ||||||
| 39306 | CALL Load_Room_Decorations | Load the decorations of the room. | ||||||
| 39309 | JR Finish_Room | Jump to Finish_Room. | ||||||
| Prev: 39135 | Up: Map | Next: 39311 |