![]() |
Routines |
| Prev: 42616 | Up: Map | Next: 43247 |
|
Handler for the object types 21 and 22 which are the falling sprites of Sabreman (21 when he falls to the left and 22 when he falls to the right). It is also where he lands from a jump or a fall.
The routine checks for contact with the falling stalactite, deals with the special states in the same way as Handle_Sabreman_Walking, lets him steer while he is not moving sideways, checks for contact with the bubbles and the creatures, moves him sideways and then applies the pull of gravity to the y velocity, which is increased by 2 each time up to a limit of 76. The y position changes by one sixteenth of the y velocity.
He lands when the y position reaches 159. Landing after a fall that reaches a y velocity of 116 or more kills him (see Start_Dying).
|
||||||||
| Handle_Sabreman_Falling | 42662 | CALL StoreEntity | Remember the position and sprite id of Sabreman. | |||||
|
Check for contact with the falling stalactite. If it touches him, the routine ends at Knock_Sabreman_Down_Set_Velocity.
|
||||||||
| 42665 | CALL Check_Stalactite_Contact | Check for contact with the falling stalactite. | ||||||
| 42668 | BIT 2,C | Jump to Knock_Sabreman_Down_Set_Velocity to knock him down if the falling stalactite touches him (bit 2 of C is set). | ||||||
| 42670 | JP NZ,Knock_Sabreman_Down_Set_Velocity | |||||||
| 42673 | BIT 6,(IX+15) | Jump to Start_Being_Carried if Sabreman is being carried (bit 6 of the redraw flags). | ||||||
| 42677 | JP NZ,Start_Being_Carried | |||||||
| 42680 | BIT 7,(IX+15) | Jump to Start_Tumbling if Sabreman is tumbling (bit 7 of the redraw flags). | ||||||
| 42684 | JP NZ,Start_Tumbling | |||||||
| 42687 | BIT 3,(IX+15) | Jump to Tumble_Sabreman if Sabreman is in the special state (bit 3 of the redraw flags is set). | ||||||
| 42691 | JP NZ,Tumble_Sabreman | |||||||
|
Read the controls. While he is not moving sideways, bit 0 clear makes the sprite id 22 and bit 1 clear makes it 21. A clear bit 4 throws a weapon, otherwise the flag for the released fire key is set.
|
||||||||
| 42694 | CALL ReadControls | Read the controls. | ||||||
| 42697 | LD C,A | Keep the state of the controls in C. | ||||||
| 42698 | LD A,(IX+6) | Fetch the x velocity of Sabreman. | ||||||
| 42701 | AND A | Jump to Handle_Sabreman_Falling_Check_Fire if he is moving sideways (the x velocity is not zero). | ||||||
| 42702 | JR NZ,Handle_Sabreman_Falling_Check_Fire | |||||||
| 42704 | BIT 0,C | Jump to Handle_Sabreman_Falling_Check_Left_Key if the right control is not used (bit 0 of the controls is set). | ||||||
| 42706 | JR NZ,Handle_Sabreman_Falling_Check_Left_Key | |||||||
| 42708 | LD (IX+0),22 | Set the sprite id to 22 (falling to the right). | ||||||
| Handle_Sabreman_Falling_Check_Left_Key | 42712 | BIT 1,C | Jump to Handle_Sabreman_Falling_Check_Fire if the left control is not used (bit 1 of the controls is set). | |||||
| 42714 | JR NZ,Handle_Sabreman_Falling_Check_Fire | |||||||
| 42716 | LD (IX+0),21 | Set the sprite id to 21 (falling to the left). | ||||||
| Handle_Sabreman_Falling_Check_Fire | 42720 | BIT 4,C | Jump to Handle_Sabreman_Falling_Fire_Released if the fire control is not used (bit 4 of the controls is set). | |||||
| 42722 | JR NZ,Handle_Sabreman_Falling_Fire_Released | |||||||
| 42724 | CALL Throw_Weapon | Throw a weapon (see Throw_Weapon). | ||||||
| 42727 | JR Handle_Sabreman_Falling_Check_Contact | Jump to Handle_Sabreman_Falling_Check_Contact. | ||||||
| Handle_Sabreman_Falling_Fire_Released | 42729 | LD A,255 | Set the flag for the released fire key (Fire_Key_Flag) to 255. | |||||
| 42731 | LD (43691),A | |||||||
|
Check for contact with the bubbles and then the creatures. The contact result is in C. With bit 1 clear he is pushed away sideways with an x velocity of 2 or 254 a tone is played and he tumbles at Continue_Sabreman_Tumbling. With bit 1 set he lands on top of the object at Land_Sabreman when bit 0 is clear, and nothing happens when bit 0 is set.
|
||||||||
| Handle_Sabreman_Falling_Check_Contact | 42734 | CALL Read_World_Map | Read the world map entry of the room. | |||||
| 42737 | LD A,E | Store the room flags in Room_Flags. | ||||||
| 42738 | LD (43692),A | |||||||
| 42741 | CALL Check_Bubble_Contact | Check for contact with the bubbles. | ||||||
| 42744 | BIT 2,C | Jump to Handle_Sabreman_Falling_Bubble_Contact if Sabreman touches a bubble (bit 2 of C is set). | ||||||
| 42746 | JR NZ,Handle_Sabreman_Falling_Bubble_Contact | |||||||
| 42748 | PUSH DE | Stash the world map entry on the stack. | ||||||
| 42749 | CALL Check_Decoration_Contact | Check for contact with the creatures. | ||||||
| 42752 | POP DE | Restore the world map entry from the stack. | ||||||
| 42753 | BIT 2,C | Jump to Handle_Sabreman_Falling_Move_Sideways if Sabreman touches no creature (bit 2 of C is not set). | ||||||
| 42755 | JR Z,Handle_Sabreman_Falling_Move_Sideways | |||||||
| Handle_Sabreman_Falling_Bubble_Contact | 42757 | BIT 0,C | Jump to Handle_Sabreman_Falling_Land_On_Bubble if he is touching the middle of it (bit 0 of C is clear). | |||||
| 42759 | JR Z,Handle_Sabreman_Falling_Land_On_Bubble | |||||||
| 42761 | BIT 1,C | Jump to Handle_Sabreman_Falling_Move_Sideways to carry on falling if he is on top of the edge of it (bit 1 of C is set). | ||||||
| 42763 | JR NZ,Handle_Sabreman_Falling_Move_Sideways | |||||||
| Handle_Sabreman_Falling_Push_Sideways | 42765 | CALL Start_Tumbling_Inside_Walls | Make Sabreman tumble inside the walls (see Start_Tumbling_Inside_Walls). | |||||
| 42768 | BIT 7,C | Jump to Handle_Sabreman_Falling_Push_Left if he is on the left of it (bit 7 of C is clear). | ||||||
| 42770 | JR Z,Handle_Sabreman_Falling_Push_Left | |||||||
| 42772 | LD (IX+6),2 | Push him to the right by setting the x velocity to 2. | ||||||
| 42776 | JR Handle_Sabreman_Falling_Push_Play_Tone | Jump to Handle_Sabreman_Falling_Push_Play_Tone. | ||||||
| Handle_Sabreman_Falling_Push_Left | 42778 | LD (IX+6),254 | Push him to the left by setting the x velocity to 254. | |||||
| Handle_Sabreman_Falling_Push_Play_Tone | 42782 | CALL Play_Low_Tone | Play a low tone. | |||||
| 42785 | JP Continue_Sabreman_Tumbling | Jump to Continue_Sabreman_Tumbling. | ||||||
| Handle_Sabreman_Falling_Land_On_Bubble | 42788 | BIT 1,C | Jump to Handle_Sabreman_Falling_Push_Sideways and push him away sideways if he is not on top of it (bit 1 of C is clear). | |||||
| 42790 | JR Z,Handle_Sabreman_Falling_Push_Sideways | |||||||
| 42792 | LD A,B | Set the y position so that Sabreman stands on top of the bubble. | ||||||
| 42793 | NEG | |||||||
| 42795 | ADD A,161 | |||||||
| 42797 | LD (IX+3),A | |||||||
| 42800 | JP Land_Sabreman | Jump to Land_Sabreman. | ||||||
|
Move Sabreman sideways by the x velocity. At the left-hand side of the room (x position less than 24) a solid left wall stops him and reverses the x velocity so that he tumbles. Without a wall, he enters the room on the left when the x position is less than 8.
|
||||||||
| Handle_Sabreman_Falling_Move_Sideways | 42803 | LD A,E | Combine the contact flags of Sabreman with the contact flags of the room. | |||||
| 42804 | OR (IX+11) | |||||||
| 42807 | LD E,A | |||||||
| 42808 | XOR A | Clear the contact flags of Sabreman. | ||||||
| 42809 | LD (IX+11),A | |||||||
| 42812 | LD A,(IX+1) | Fetch the x position of Sabreman. | ||||||
| 42815 | ADD A,(IX+6) | Add the x velocity of Sabreman. | ||||||
| 42818 | LD (IX+1),A | Store the new x position of Sabreman. | ||||||
| 42821 | BIT 7,A | Jump to Handle_Falling_At_Right_Edge if he is in the right half of the room (bit 7 of the x position is set). | ||||||
| 42823 | JP NZ,Handle_Falling_At_Right_Edge | |||||||
| 42826 | CP 24 | Jump to Handle_Sabreman_Falling_Apply_Gravity if he is clear of the left wall (x position 24 or more). | ||||||
| 42828 | JR NC,Handle_Sabreman_Falling_Apply_Gravity | |||||||
| 42830 | BIT 6,E | Jump to Handle_Sabreman_Falling_No_Left_Wall if the left wall is not solid (bit 6 of E is clear). | ||||||
| 42832 | JR Z,Handle_Sabreman_Falling_No_Left_Wall | |||||||
| 42834 | LD (IX+1),24 | Stop him at the left wall by setting the x position to 24. | ||||||
|
This entry point is used by the routine at Handle_Falling_At_Right_Edge.
|
||||||||
| Handle_Sabreman_Falling_Reverse_Velocity | 42838 | LD A,(IX+6) | Reverse the x velocity, so that he bounces off the wall. | |||||
| 42841 | NEG | |||||||
| 42843 | LD (IX+6),A | |||||||
| 42846 | JP Continue_Sabreman_Tumbling | Jump to Continue_Sabreman_Tumbling to tumble. | ||||||
| Handle_Sabreman_Falling_No_Left_Wall | 42849 | EX AF,AF' | Mark the ceiling and the floor as solid (bits 0 and 4 of the contact flags of Sabreman), as he is in the gap in the wall, keeping the new x position in AF'. | |||||
| 42850 | LD A,17 | |||||||
| 42852 | OR (IX+11) | |||||||
| 42855 | LD (IX+11),A | |||||||
| 42858 | EX AF,AF' | |||||||
| 42859 | SET 4,E | Mark the room as having a floor (bit 4 of E). | ||||||
| 42861 | CP 8 | Jump to Handle_Sabreman_Falling_Apply_Gravity if he has not left the room (x position 8 or more). | ||||||
| 42863 | JR NC,Handle_Sabreman_Falling_Apply_Gravity | |||||||
| 42865 | DEC (IX+2) | Decrease the room x, to go to the room on the left. | ||||||
| 42868 | LD (IX+1),240 | Put him at the right edge of the next room (x position 240). | ||||||
| 42872 | CALL Draw_Room | Draw the new room. | ||||||
| 42875 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
|
This entry point is used by the routine at Handle_Falling_At_Right_Edge.
Apply gravity. If the y velocity is positive and has reached 76 it is left as it is, otherwise it is increased by 2. The y position is then changed by the y velocity divided by 16.
If the new y position is 159 or more, the contact flags are given the bits 68 and he lands at Handle_Sabreman_Falling_Reach_Floor when the room has a floor or goes down to the room below at Handle_Sabreman_Falling_Check_Bottom_Edge when it does not.
|
||||||||
| Handle_Sabreman_Falling_Apply_Gravity | 42878 | LD A,(IX+9) | Fetch the y velocity of Sabreman. | |||||
| 42881 | BIT 7,A | Jump to Handle_Sabreman_Falling_Increase_Velocity if he is moving upwards (bit 7 of the y velocity is set). | ||||||
| 42883 | JR NZ,Handle_Sabreman_Falling_Increase_Velocity | |||||||
| 42885 | CP 76 | Jump to Handle_Sabreman_Falling_Increase_Velocity if he is not yet falling at full speed (the y velocity is less than 76). | ||||||
| 42887 | JR C,Handle_Sabreman_Falling_Increase_Velocity | |||||||
| 42889 | CALL Start_Tumbling_Inside_Walls | Make Sabreman tumble inside the walls (see Start_Tumbling_Inside_Walls). | ||||||
| 42892 | JR Handle_Sabreman_Falling_Move_Vertically | Jump to Handle_Sabreman_Falling_Move_Vertically. | ||||||
| Handle_Sabreman_Falling_Increase_Velocity | 42894 | INC (IX+9) | Increase the y velocity (gravity pulls him down). | |||||
| 42897 | INC (IX+9) | Increase the y velocity again. | ||||||
| Handle_Sabreman_Falling_Move_Vertically | 42900 | SRA A | Divide the y velocity by sixteen, keeping the sign. | |||||
| 42902 | SRA A | |||||||
| 42904 | SRA A | |||||||
| 42906 | SRA A | |||||||
| 42908 | ADD A,(IX+3) | Add the y position of Sabreman to get the new y position. | ||||||
| 42911 | CP 159 | Jump to Handle_Sabreman_Falling_Above_Floor if he has not reached the bottom of the room (the new y position is less than 159). | ||||||
| 42913 | JR C,Handle_Sabreman_Falling_Above_Floor | |||||||
| 42915 | EX AF,AF' | Set bits 2 and 6 of the contact flags of Sabreman (both side walls are solid), keeping the new y position in the alternate AF'. | ||||||
| 42916 | LD A,68 | |||||||
| 42918 | OR (IX+11) | |||||||
| 42921 | LD (IX+11),A | |||||||
| 42924 | EX AF,AF' | |||||||
| 42925 | BIT 4,E | Jump to Handle_Sabreman_Falling_Check_Bottom_Edge if the room has no floor (bit 4 of E is clear), to go down to the room below. | ||||||
| 42927 | JP Z,Handle_Sabreman_Falling_Check_Bottom_Edge | |||||||
| 42930 | JP Handle_Sabreman_Falling_Reach_Floor | Jump to Handle_Sabreman_Falling_Reach_Floor to land on the floor. | ||||||
|
This entry point is used by the routine at Handle_Sabreman_Tumbling.
The y position is above 159. If it is less than 72 and the room has a ceiling (bit 0 of E), a negative y velocity is made positive and the y position is set to 72. If it is less than 72 and the room has no ceiling, the contact flags are given the bits 68 and, when the y position is less than 40 he moves up to the room above.
|
||||||||
| Handle_Sabreman_Falling_Above_Floor | 42933 | CP 72 | Jump to Handle_Sabreman_Falling_Store_Y_Position if he is below the top of the room (y position 72 or more). | |||||
| 42935 | JR NC,Handle_Sabreman_Falling_Store_Y_Position | |||||||
| 42937 | BIT 0,E | Jump to Handle_Sabreman_Falling_No_Ceiling if the room has no ceiling (bit 0 of E is clear). | ||||||
| 42939 | JR Z,Handle_Sabreman_Falling_No_Ceiling | |||||||
| 42941 | CALL Start_Tumbling_Inside_Walls | Make Sabreman tumble inside the walls (see Start_Tumbling_Inside_Walls). | ||||||
| 42944 | LD A,(IX+9) | Fetch the y velocity of Sabreman. | ||||||
| 42947 | BIT 7,A | Jump to Handle_Sabreman_Falling_Set_Ceiling_Position if he is moving down (bit 7 of the y velocity is clear). | ||||||
| 42949 | JR Z,Handle_Sabreman_Falling_Set_Ceiling_Position | |||||||
| 42951 | NEG | Negate the y velocity, so that he bounces off the ceiling. | ||||||
| 42953 | LD (IX+9),A | Store the new y velocity of Sabreman. | ||||||
| Handle_Sabreman_Falling_Set_Ceiling_Position | 42956 | LD A,72 | Set the y position to 72 just below the ceiling. | |||||
|
Store the y position and make C the y position less 55 (with a minimum of 2). While the countdown is not zero it is decreased and the routine ends.
|
||||||||
| Handle_Sabreman_Falling_Store_Y_Position | 42958 | LD (IX+3),A | Store the y position of Sabreman. | |||||
| 42961 | SUB 55 | Work out the length of rope needed to reach him (the y position less 55) and jump to Handle_Sabreman_Falling_Set_Threshold unless that is negative. | ||||||
| 42963 | JR NC,Handle_Sabreman_Falling_Set_Threshold | |||||||
| 42965 | LD A,2 | Use the shortest length of 2 instead. | ||||||
| Handle_Sabreman_Falling_Set_Threshold | 42967 | LD C,A | Keep the length of rope needed in C. | |||||
| 42968 | LD A,(IX+10) | Fetch the countdown of Sabreman. | ||||||
| 42971 | AND A | Jump to Handle_Sabreman_Falling_Check_Rope if the countdown is zero. | ||||||
| 42972 | JR Z,Handle_Sabreman_Falling_Check_Rope | |||||||
| 42974 | DEC (IX+10) | Decrease the countdown of Sabreman. | ||||||
| 42977 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
| Handle_Sabreman_Falling_No_Ceiling | 42980 | EX AF,AF' | Switch to the shadow registers. | |||||
| 42981 | LD A,(IX+11) | Fetch the contact flags of Sabreman. | ||||||
| 42984 | OR %01000100 | Set bits 2 and 6 (both side walls are solid). | ||||||
| 42986 | LD (IX+11),A | Store the contact flags of Sabreman. | ||||||
| 42989 | EX AF,AF' | Switch back to the main registers. | ||||||
| 42990 | CP 40 | Jump to Handle_Sabreman_Falling_Store_Y_Position if he has not left the top of the room (y position 40 or more). | ||||||
| 42992 | JR NC,Handle_Sabreman_Falling_Store_Y_Position | |||||||
| 42994 | DEC (IX+4) | Decrease the room y, to go to the room above. | ||||||
| 42997 | LD (IX+3),186 | Put him at the bottom of the room above (y position 186). | ||||||
| 43001 | CALL Draw_Room | Draw the new room. | ||||||
| 43004 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
|
The countdown is zero. Now the routine checks whether he is falling onto the rope (the type 23 object, see Handle_Rope). The conditions are that the room y is 16 or more, that the number in Rope_Length (the length of the rope) is not less than C, that his x position is within 16 of 120 (where the rope hangs), and that record 3 holds the rope and Rope_Displacement_Pixels is zero. When they hold, he grabs the rope: the sprite id is set to 1 record 3 is cleared (from then on Handle_Sabreman_On_Rope looks after the rope), and the second byte of the world map entry of each room below him is cleared down to the first room that has a floor.
|
||||||||
| Handle_Sabreman_Falling_Check_Rope | 43007 | LD A,(IX+4) | Fetch the room y of Sabreman. | |||||
| 43010 | CP 16 | Jump to Update_Object_Sprite if he is in a special room (the room y is less than 16), as there is no rope there. | ||||||
| 43012 | JP C,Update_Object_Sprite | |||||||
| 43015 | LD A,(43685) | Fetch the length of the rope from Rope_Length. | ||||||
| 43018 | AND %01111111 | Keep only the length (bits 0 to 6). | ||||||
| 43020 | CP C | Jump to Update_Object_Sprite if the rope is too short to reach him (the length is less than C). | ||||||
| 43021 | JP C,Update_Object_Sprite | |||||||
| 43024 | LD A,(IX+15) | Fetch the redraw flags of Sabreman. | ||||||
| 43027 | AND %10100111 | Keep only bits 0, 1, 2, 5 and 7 (this clears bits 3, 4 and 6). | ||||||
| 43029 | LD (IX+15),A | Store the redraw flags of Sabreman. | ||||||
| 43032 | LD A,(IX+1) | Fetch the x position of Sabreman. | ||||||
| 43035 | SUB 120 | Work out how far he is from the rope (x position 120) and jump to Handle_Sabreman_Falling_Check_Rope_Distance if he is on the right of it. | ||||||
| 43037 | JP P,Handle_Sabreman_Falling_Check_Rope_Distance | |||||||
| 43040 | NEG | Make the distance positive. | ||||||
| Handle_Sabreman_Falling_Check_Rope_Distance | 43042 | CP 16 | Jump to Update_Object_Sprite if he is too far from the rope (the distance is 16 or more). | |||||
| 43044 | JP NC,Update_Object_Sprite | |||||||
| 43047 | LD A,(36650) | Fetch the type of record 3 (the rope). | ||||||
| 43050 | AND A | Jump to Handle_Sabreman_Falling_No_Rope if the rope has not been set up. | ||||||
| 43051 | JP Z,Handle_Sabreman_Falling_No_Rope | |||||||
| 43054 | LD A,(43684) | Fetch the displacement of the rope from Rope_Displacement_Pixels. | ||||||
| 43057 | AND A | Jump to Update_Object_Sprite if the rope is swinging (the displacement is not zero). | ||||||
| 43058 | JP NZ,Update_Object_Sprite | |||||||
| Handle_Sabreman_Falling_Catch_Rope | 43061 | LD B,C | Copy the length of rope needed to B. | |||||
| 43062 | BIT 7,B | Jump to Update_Object_Sprite if the length of rope needed is too long (bit 7 of B is set). | ||||||
| 43064 | JP NZ,Update_Object_Sprite | |||||||
| 43067 | LD A,(43685) | Fetch the length of the rope from Rope_Length. | ||||||
| 43070 | AND %10000000 | Keep only bit 7 (the flag of the rope). | ||||||
| 43072 | OR B | Combine the flag with the length of rope needed. | ||||||
| 43073 | LD (43685),A | Set the length of the rope to the length needed to reach him. | ||||||
| 43076 | LD (IX+0),1 | Set the sprite id to 1 (hanging on the rope). | ||||||
| 43080 | LD A,(IX+6) | Fetch the x velocity of Sabreman. | ||||||
| 43083 | SLA A | Multiply the x velocity by eight. | ||||||
| 43085 | SLA A | |||||||
| 43087 | SLA A | |||||||
| 43089 | LD (43682),A | Set the x velocity of the end of the rope (Rope_Velocity) so that it swings the way that he was moving. | ||||||
| 43092 | XOR A | Clear the type of record 3 (the rope), as Sabreman is now holding it. | ||||||
| 43093 | LD (36650),A | |||||||
| 43096 | CALL Find_World_Map_Address | Find the world map entry of the room. | ||||||
| 43099 | LD BC,32 | Set the offset to the room below (32). | ||||||
| Handle_Sabreman_Falling_Find_Rope_Row_Loop | 43102 | BIT 4,(HL) | Jump to Handle_Sabreman_Falling_Move_Rope if this room has a floor (bit 4 of the room flags). | |||||
| 43104 | JR NZ,Handle_Sabreman_Falling_Move_Rope | |||||||
| 43106 | ADD HL,BC | Add the offset to move to the entry of the room below. | ||||||
| 43107 | INC HL | Move on to the second byte of the entry. | ||||||
| 43108 | LD (HL),0 | Clear the second byte of the entry. | ||||||
| 43110 | DEC HL | Move back to the first byte of the entry. | ||||||
| 43111 | JR Handle_Sabreman_Falling_Find_Rope_Row_Loop | Jump to Handle_Sabreman_Falling_Find_Rope_Row_Loop. | ||||||
| Handle_Sabreman_Falling_Move_Rope | 43113 | CALL Update_Rope | Move the rope (see Update_Rope). | |||||
| 43116 | JP Set_Position_From_Rope | Jump to Set_Position_From_Rope to position Sabreman on the rope. | ||||||
| Handle_Sabreman_Falling_Check_Bottom_Edge | 43119 | CP 188 | Jump to Handle_Sabreman_Falling_Above_Floor if he has not reached the bottom of the room (the y position is less than 188). | |||||
| 43121 | JP C,Handle_Sabreman_Falling_Above_Floor | |||||||
| 43124 | INC (IX+4) | Increase the room y, to go to the room below. | ||||||
| 43127 | LD (IX+3),42 | Put him at the top of the room below (y position 42). | ||||||
| 43131 | CALL Draw_Room | Draw the new room. | ||||||
| 43134 | JP Handle_Sabreman_Falling_Above_Floor | Jump to Handle_Sabreman_Falling_Above_Floor. | ||||||
|
There is no rope in record 3. If the room has a ceiling (bit 0 of E) and no floor (bit 4), the second byte of the world map entry of the room is set to 8 the rope end positions in Line_Step_Count are cleared and the code above carries on, so that he grabs a rope that is just long enough.
|
||||||||
| Handle_Sabreman_Falling_No_Rope | 43137 | BIT 0,E | Jump to Update_Object_Sprite if the room has no ceiling (bit 0 of E is clear). | |||||
| 43139 | JP Z,Update_Object_Sprite | |||||||
| 43142 | BIT 4,E | Jump to Update_Object_Sprite if the room has a floor (bit 4 of E is set). | ||||||
| 43144 | JP NZ,Update_Object_Sprite | |||||||
| 43147 | CALL Find_World_Map_Address | Find the world map entry of the room. | ||||||
| 43150 | INC HL | Move on to the second byte of the entry. | ||||||
| 43151 | LD (HL),8 | Write 8 to the second byte of the entry. | ||||||
| 43153 | LD HL,0 | Clear the length of the rope (Rope_Length) and the word at Previous_Rope_End_Position. | ||||||
| 43156 | LD (43671),HL | |||||||
| 43159 | LD (43685),HL | |||||||
| 43162 | JR Handle_Sabreman_Falling_Catch_Rope | Jump to Handle_Sabreman_Falling_Catch_Rope to grab the new rope. | ||||||
|
This entry point is used by the routine at Handle_Sabreman_Tumbling.
|
||||||||
| Handle_Sabreman_Falling_Reach_Floor | 43164 | LD (IX+3),159 | Put him on the floor by setting the y position to 159. | |||||
|
This entry point is used by the routine at Handle_Sabreman_Tumbling.
Sabreman lands. If the y velocity is positive and 116 or more (and the gem timer at Gem_Timer is zero) he dies at Start_Dying. Otherwise a low tone is played and the sprite id becomes 9 (when he faced left) or 13 (when he faced right), which are the walking sprites.
|
||||||||
| Land_Sabreman | 43168 | LD A,(36590) | Fetch the gem timer from Gem_Timer. | |||||
| 43171 | AND A | Jump to Land_Sabreman_Play_Tone if the gem timer is running (it is not zero), as he cannot be hurt. | ||||||
| 43172 | JR NZ,Land_Sabreman_Play_Tone | |||||||
| 43174 | LD A,(IX+9) | Fetch the y velocity of Sabreman. | ||||||
| 43177 | BIT 7,A | Jump to Land_Sabreman_Play_Tone if he is moving up (bit 7 of the y velocity is set). | ||||||
| 43179 | JR NZ,Land_Sabreman_Play_Tone | |||||||
| 43181 | CP 116 | Jump to Start_Dying and kill him if he has fallen too fast (the y velocity is 116 or more). | ||||||
| 43183 | JP NC,Start_Dying | |||||||
| Land_Sabreman_Play_Tone | 43186 | CALL Play_Low_Tone | Play a low tone. | |||||
| 43189 | LD A,(IX+0) | Fetch the sprite id of Sabreman. | ||||||
| 43192 | DEC A | Decrease the sprite id so that bit 0 tells which way he was falling. | ||||||
| 43193 | RLA | Rotate the direction up to bit 2. | ||||||
| 43194 | RLA | |||||||
| 43195 | AND %00000100 | Keep only bit 2 (set when he faced right). | ||||||
| 43197 | ADD A,9 | Add 9 to make the sprite id for walking in that direction. | ||||||
| 43199 | LD (IX+0),A | Set the sprite id of Sabreman. | ||||||
| 43202 | RES 7,(IX+15) | Stop him tumbling by resetting bit 7 of the redraw flags. | ||||||
| 43206 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
|
This entry point is used by the routine at Handle_Sabreman_On_Rope.
Sabreman comes down from the rope onto the floor at y position 159. The sprite id becomes 9 (when the x velocity is negative) or 13.
|
||||||||
| Stand_Sabreman_On_Floor | 43209 | LD (IX+3),159 | Put him on the floor by setting the y position to 159. | |||||
| 43213 | LD A,9 | Start with the sprite id 9 (walking to the left). | ||||||
| 43215 | BIT 7,(IX+6) | Jump to Stand_Sabreman_On_Floor_Set_Sprite if he is moving to the left (bit 7 of the x velocity is set). | ||||||
| 43219 | JR NZ,Stand_Sabreman_On_Floor_Set_Sprite | |||||||
| 43221 | ADD A,4 | Add 4 to make the sprite id 13 (walking to the right). | ||||||
| Stand_Sabreman_On_Floor_Set_Sprite | 43223 | LD (IX+0),A | Set the sprite id of Sabreman. | |||||
|
This entry point is used by the routines at Handle_Sabreman_On_Rope and Knock_Sabreman_Off_Rope.
Record 3 is made a type 23 object again, with its x velocity (byte 6) set to 3.
|
||||||||
| Restore_Type_17_Object | 43226 | LD A,23 | Set the type of record 3 (the rope) to 23. | |||||
| 43228 | LD (36650),A | |||||||
| 43231 | LD A,3 | Set the x velocity of the rope to 3. | ||||||
| 43233 | LD (36656),A | |||||||
| 43236 | LD A,(IX+15) | Fetch the redraw flags of Sabreman. | ||||||
| 43239 | AND %01000000 | Keep only bit 6 (being carried). | ||||||
| 43241 | JP NZ,Start_Being_Carried | Jump to Start_Being_Carried if Sabreman is being carried by an eagle. | ||||||
| 43244 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
| Prev: 42616 | Up: Map | Next: 43247 |