![]() |
Routines |
| Prev: 41575 | Up: Map | Next: 41949 |
|
Handler for the object types 1 to 8 which Sabreman has while he hangs on and swings from the rope (the type 23 object, see Handle_Rope). The sprites are the ones that are called swimming (1 to 4 when he moves to the left and 5 to 8 when he moves to the right; the frame follows the x position).
If bit 3 or bit 6 of the redraw flags is set, he lets go at Handle_Sabreman_On_Rope_Let_Go. Otherwise the routine checks for contact with the bubbles, the creatures and the falling stalactite, any of which sends him to Knock_Sabreman_Off_Rope with B=16. Next it moves the rope with Update_Rope and, if he stays in the same room, reads the controls: a bottom row key (or the joystick fire button) makes him let go at Handle_Sabreman_On_Rope_Let_Go, and the fire key throws a weapon.
The position and the velocity of the end of the rope (see Line_Step_Count) are then converted to the position and the velocity of Sabreman. If the y position is 159 or more and the room has a floor, he lets go and stands on the floor at Stand_Sabreman_On_Floor.
|
||||||||
| Handle_Sabreman_On_Rope | 41750 | CALL StoreEntity | Remember the position and sprite id of Sabreman (see StoreEntity). | |||||
| 41753 | LD A,(IX+15) | Fetch the redraw flags of Sabreman. | ||||||
| 41756 | AND %01001000 | Keep only bit 3 (the special state) and bit 6 (being carried). | ||||||
| 41758 | JP NZ,Handle_Sabreman_On_Rope_Let_Go | Jump to Handle_Sabreman_On_Rope_Let_Go and let go of the rope if either of them is set. | ||||||
| 41761 | CALL Check_Bubble_Contact | Check for contact with the bubbles. | ||||||
| 41764 | BIT 2,C | Jump to Handle_Sabreman_On_Rope_Hit if Sabreman touches a bubble (bit 2 of C). | ||||||
| 41766 | JR NZ,Handle_Sabreman_On_Rope_Hit | |||||||
| 41768 | CALL Check_Decoration_Contact | Check for contact with the creatures. | ||||||
| 41771 | BIT 2,C | Test bit 2 of C (set if Sabreman touches one). | ||||||
| Handle_Sabreman_On_Rope_Hit | 41773 | LD B,16 | Set B to 16 (this is not changed by the contact test above). | |||||
| 41775 | JP NZ,Knock_Sabreman_Off_Rope | Jump to Knock_Sabreman_Off_Rope to knock Sabreman off the rope if he touches a bubble or a creature. | ||||||
| 41778 | CALL Check_Stalactite_Contact | Check for contact with the falling stalactite. | ||||||
| 41781 | BIT 2,C | Jump to Knock_Sabreman_Off_Rope to knock Sabreman off the rope if the stalactite hits him. | ||||||
| 41783 | JP NZ,Knock_Sabreman_Off_Rope | |||||||
| 41786 | LD L,(IX+2) | Fetch the room x of Sabreman. | ||||||
| 41789 | LD H,(IX+4) | Fetch the room y of Sabreman. | ||||||
| 41792 | PUSH HL | Stash the room of Sabreman on the stack. | ||||||
| 41793 | CALL Update_Rope | Move the rope (see Update_Rope). | ||||||
| 41796 | POP HL | Restore the room that Sabreman was in before the rope moved. | ||||||
| 41797 | LD E,(IX+2) | Fetch the room x that Sabreman is in now. | ||||||
| 41800 | LD D,(IX+4) | Fetch the room y that Sabreman is in now. | ||||||
| 41803 | AND A | Compare the old room with the new room. | ||||||
| 41804 | SBC HL,DE | |||||||
| 41806 | JR NZ,Set_Position_From_Rope | Jump to Set_Position_From_Rope if the swing of the rope has taken him to a different room. | ||||||
| 41808 | CALL ReadControls | Read the controls. | ||||||
| 41811 | BIT 5,A | Jump to Handle_Sabreman_On_Rope_Let_Go and let go of the rope if the "bottom row key" bit of the controls (bit 5) is clear. | ||||||
| 41813 | JR Z,Handle_Sabreman_On_Rope_Let_Go | |||||||
| 41815 | BIT 4,A | Jump to Handle_Sabreman_On_Rope_Fire_Released if the fire key is not pressed (bit 4 of the controls is set). | ||||||
| 41817 | JR NZ,Handle_Sabreman_On_Rope_Fire_Released | |||||||
| 41819 | CALL Throw_Weapon | Throw a weapon (see Throw_Weapon). | ||||||
| 41822 | JR Set_Position_From_Rope | Jump to Set_Position_From_Rope. | ||||||
| Handle_Sabreman_On_Rope_Fire_Released | 41824 | LD A,255 | Set the flag for the released fire key (Fire_Key_Flag) to 255. | |||||
| 41826 | LD (43691),A | |||||||
|
This entry point is used by the routine at Handle_Sabreman_Falling.
Set the position of Sabreman from the position of the end of the rope.
|
||||||||
| Set_Position_From_Rope | 41829 | LD HL,(43669) | Fetch the position of the end of the rope (x position in L, y position in H). | |||||
| 41832 | LD DE,63500 | Set the offset from the end of the rope to Sabreman (12 pixels to the left and 8 pixels down). | ||||||
| 41835 | AND A | Work out the position of Sabreman from the end of the rope and stash it on the stack. | ||||||
| 41836 | SBC HL,DE | |||||||
| 41838 | PUSH HL | |||||||
| 41839 | CALL Read_World_Map | Read the world map entry of the room. | ||||||
| 41842 | LD A,E | Copy the room flags to A. | ||||||
| 41843 | LD (43692),A | Store the room flags in Room_Flags. | ||||||
| 41846 | POP HL | Restore the position of Sabreman. | ||||||
| 41847 | LD (IX+1),L | Set the x position of Sabreman. | ||||||
| 41850 | LD (IX+3),H | Set the y position of Sabreman. | ||||||
| 41853 | LD A,H | Copy the y position of Sabreman to A. | ||||||
| 41854 | CP 159 | Is Sabreman at or below the height of the floor (y position 159)? | ||||||
| 41856 | LD A,(43682) | Fetch the x velocity of the end of the rope. | ||||||
| 41859 | LD (IX+6),A | Give Sabreman the x velocity of the end of the rope. | ||||||
| 41862 | JR C,Handle_Sabreman_On_Rope_Choose_Frame | Jump to Handle_Sabreman_On_Rope_Choose_Frame if Sabreman is still above the floor. | ||||||
| 41864 | BIT 4,E | Jump to Stand_Sabreman_On_Floor if the room has a floor and Sabreman has reached it (bit 4 of the room flags). | ||||||
| 41866 | JP NZ,Stand_Sabreman_On_Floor | |||||||
| Handle_Sabreman_On_Rope_Choose_Frame | 41869 | LD A,L | Copy the x position of Sabreman to A. | |||||
| 41870 | RRA | Divide the x position by eight (the frame of the swimming animation follows the x position). | ||||||
| 41871 | RRA | |||||||
| 41872 | RRA | |||||||
| 41873 | AND %00000011 | Keep only the two low bits. | ||||||
| 41875 | INC A | Add one to make a frame from 1 to 4. | ||||||
| 41876 | BIT 7,(IX+6) | Jump to Handle_Sabreman_On_Rope_Set_Sprite if he is swinging to the left (the x velocity is negative). | ||||||
| 41880 | JR NZ,Handle_Sabreman_On_Rope_Set_Sprite | |||||||
| 41882 | ADD A,4 | Add four to use the frames for swinging to the right. | ||||||
| Handle_Sabreman_On_Rope_Set_Sprite | 41884 | LD (IX+0),A | Set the sprite id. | |||||
| 41887 | CALL Update_Object_Sprite | Update the sprite of the object (see Update_Object_Sprite). | ||||||
| 41890 | JP Draw_Rope | Jump to Draw_Rope. | ||||||
|
Sabreman is hit or lets go of the rope, and starts to fall from the position of the end of the rope. The velocities are taken from the change in that position and the sprite id becomes 21 or 22 (falling).
|
||||||||
| Handle_Sabreman_On_Rope_Let_Go | 41893 | LD HL,(43669) | Fetch the position of the end of the rope. | |||||
| 41896 | LD DE,(43671) | Fetch the previous position of the end of the rope. | ||||||
| 41900 | LD A,H | Copy the y position of the end of the rope to A. | ||||||
| 41901 | SUB D | Subtract the previous y position to get how far the end of the rope moved. | ||||||
| 41902 | SLA A | Multiply the movement by eight to get the y velocity. | ||||||
| 41904 | SLA A | |||||||
| 41906 | SLA A | |||||||
| 41908 | LD (IX+9),A | Give Sabreman the y velocity. | ||||||
| 41911 | LD A,L | Copy the x position of the end of the rope to A. | ||||||
| 41912 | SUB E | Subtract the previous x position to get how far the end of the rope moved. | ||||||
| 41913 | LD (IX+6),A | Give Sabreman that as his x velocity. | ||||||
| 41916 | LD A,21 | Use the sprite id for falling to the left (21). | ||||||
| 41918 | BIT 7,(IX+6) | Jump to Handle_Sabreman_On_Rope_Let_Go_Set_Sprite if he is moving to the left (the x velocity is negative). | ||||||
| 41922 | JR NZ,Handle_Sabreman_On_Rope_Let_Go_Set_Sprite | |||||||
| 41924 | ADD A,1 | Use the sprite id for falling to the right (22). | ||||||
| Handle_Sabreman_On_Rope_Let_Go_Set_Sprite | 41926 | LD (IX+0),A | Set the sprite id. | |||||
| 41929 | LD (IX+10),32 | Set the countdown to 32. | ||||||
| 41933 | LD A,(IX+6) | Fetch the x velocity. | ||||||
| 41936 | OR (IX+9) | Combine it with the y velocity to see if Sabreman is moving at all. | ||||||
| 41939 | JP NZ,Restore_Type_17_Object | Jump to Restore_Type_17_Object to start him falling if Sabreman is moving. | ||||||
| 41942 | LD (IX+9),16 | Set the y velocity to 16 so that he falls. | ||||||
| 41946 | JP Restore_Type_17_Object | Jump to Restore_Type_17_Object. | ||||||
| Prev: 41575 | Up: Map | Next: 41949 |