![]() |
Routines |
| Prev: 42035 | Up: Map | Next: 42616 |
|
Handler for the object types 17 to 20 which are the jumping sprites of Sabreman (17 and 18 when he jumps to the left and 19 and 20 when he jumps to the right).
The countdown in the object record is decreased on every call. When it reaches 3 the sprite moves on to the next frame, and when it reaches zero the jump is over and the sprite becomes 21 or 22 (falling), so that Handle_Sabreman_Falling takes over. The controls steer him left or right while he is in the air.
At the end of the jump the y position is moved up by 4 and the countdown is set to 12. If that takes him into the top part of the room and the room has a ceiling, he hits it and tumbles at Continue_Sabreman_Tumbling.
|
||||||||
|
Save the state of the object, then deal with the special states in the same way as Handle_Sabreman_Walking.
|
||||||||
| Handle_Sabreman_Jumping | 42481 | CALL StoreEntity | Remember the position and sprite id of Sabreman. | |||||
| 42484 | BIT 6,(IX+15) | Jump to Start_Being_Carried if Sabreman is being carried (bit 6 of the redraw flags). | ||||||
| 42488 | JP NZ,Start_Being_Carried | |||||||
| 42491 | BIT 7,(IX+15) | Jump to Start_Tumbling if Sabreman is tumbling (bit 7 of the redraw flags). | ||||||
| 42495 | JP NZ,Start_Tumbling | |||||||
| 42498 | CALL Read_World_Map | Read the world map entry of the room. | ||||||
| 42501 | CALL Check_Bubble_Contact | Check for contact with the bubbles. | ||||||
|
Decrease the countdown. When it reaches zero the jump ends at Handle_Sabreman_Jumping_Finish.
|
||||||||
| 42504 | DEC (IX+10) | Decrease the jump countdown and jump to Handle_Sabreman_Jumping_Finish if the jump is over. | ||||||
| 42507 | JR Z,Handle_Sabreman_Jumping_Finish | |||||||
| 42509 | LD A,(IX+10) | Fetch the jump countdown and jump to Handle_Sabreman_Jumping_Read_Controls unless it has reached 3. | ||||||
| 42512 | CP 3 | |||||||
| 42514 | JR NZ,Handle_Sabreman_Jumping_Read_Controls | |||||||
| 42516 | INC (IX+0) | Move on to the next frame of the jumping sprite, as he is at the top of the jump. | ||||||
|
Read the controls. Bit 0 clear sets an x velocity of 2 and moves to the frames for jumping to the right. Bit 1 clear sets an x velocity of 254 and moves to the frames for jumping to the left. If neither is clear the velocity is unchanged.
|
||||||||
| Handle_Sabreman_Jumping_Read_Controls | 42519 | CALL ReadControls | Read the controls. | |||||
| 42522 | BIT 0,A | Jump to Handle_Sabreman_Jumping_Move_Right if the right control is used (bit 0 of the controls is clear). | ||||||
| 42524 | JR Z,Handle_Sabreman_Jumping_Move_Right | |||||||
| 42526 | BIT 1,A | Jump to Update_Object_Sprite if the left control is not used either (bit 1 of the controls is set). | ||||||
| 42528 | JP NZ,Update_Object_Sprite | |||||||
| 42531 | LD (IX+6),254 | Set the x velocity of Sabreman to 254 (moving left). | ||||||
| 42535 | LD A,(IX+0) | Switch to the frame for jumping to the left. | ||||||
| 42538 | DEC A | |||||||
| 42539 | RES 1,A | |||||||
| 42541 | INC A | |||||||
| 42542 | LD (IX+0),A | Set the sprite id. | ||||||
| 42545 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
| Handle_Sabreman_Jumping_Move_Right | 42548 | LD (IX+6),2 | Set the x velocity of Sabreman to 2 (moving right). | |||||
| 42552 | LD A,(IX+0) | Switch to the frame for jumping to the right. | ||||||
| 42555 | DEC A | |||||||
| 42556 | SET 1,A | |||||||
| 42558 | INC A | |||||||
| 42559 | LD (IX+0),A | Set the sprite id. | ||||||
| 42562 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
|
The jump is over. The sprite id becomes 21 (when the jump was to the left) or 22 (when it was to the right).
|
||||||||
| Handle_Sabreman_Jumping_Finish | 42565 | LD A,(IX+0) | Fetch the sprite id of Sabreman. | |||||
| 42568 | DEC A | Decrease the sprite id. | ||||||
| 42569 | RRA | Rotate it right, which leaves the direction in bit 0. | ||||||
| 42570 | AND %00000001 | Keep only the direction (0 for left, 1 for right). | ||||||
| 42572 | ADD A,21 | Add 21 to make the sprite id for falling in that direction. | ||||||
| 42574 | LD (IX+0),A | Set the sprite id. | ||||||
| 42577 | CALL Read_World_Map | Read the world map entry of the room. | ||||||
| 42580 | LD A,(IX+11) | Fetch the contact flags of Sabreman. | ||||||
| 42583 | OR E | Combine the contact flags of Sabreman with the contact flags of the room. | ||||||
| 42584 | LD E,A | |||||||
| 42585 | LD A,(IX+3) | Fetch the y position of Sabreman. | ||||||
| 42588 | SUB 4 | Take 4 off the y position of Sabreman. | ||||||
| 42590 | CP 73 | Jump to Handle_Sabreman_Jumping_Land if he is not in the top part of the room (y position of at least 73). | ||||||
| 42592 | JR NC,Handle_Sabreman_Jumping_Land | |||||||
| 42594 | LD (IX+11),68 | Mark the walls on both sides as solid by setting the contact flags to 68 as he is in the upper part of the room. | ||||||
| 42598 | BIT 0,E | Jump to Continue_Sabreman_Tumbling if he hits the ceiling (bit 0 of the contact flags is set). | ||||||
| 42600 | JP NZ,Continue_Sabreman_Tumbling | |||||||
| Handle_Sabreman_Jumping_Land | 42603 | LD (IX+3),A | Store the new y position of Sabreman. | |||||
| 42606 | LD (IX+10),12 | Set the countdown of Sabreman to 12. | ||||||
| 42610 | CALL SoundsSword | Play the sword sound (see SoundsSword). | ||||||
| 42613 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
| Prev: 42035 | Up: Map | Next: 42616 |