![]() |
Routines |
| Prev: 58710 | Up: Map | Next: 58914 |
|
Handler for the object types 96 to 99 which are the sprites of Sabreman while an eagle carries him (see Handle_Carrying_Eagle). Bit 1 of the type is set when he moves to the left and bit 0 follows bit 1 of the tick counter.
His position is taken from bytes 8 (x) and 9 (y) of his record, which the eagle sets. If bit 7 of the redraw flags is set (he has been hit) bit 5 is set to ask the eagle to let go, and the countdown in byte 10 is set to 15.
If no eagle was carrying him in the last pass of the main loop (see Previous_Type_5C_Active_Flag) he drops, and so does he when bit 6 of the redraw flags is set (see Release_Sabreman). He starts to tumble, with the sprite id 24 and a y velocity of 16.
Touching a decoration puts him on top of it when he is on top of it or near its middle. If he touches the side of one he sets bit 5 to ask the eagle to let go. He is kept within the walls of the room. If the fire key is pressed he throws a weapon (see Throw_Weapon).
|
||||||||
| Handle_Carried_Sabreman | 58736 | CALL StoreEntity | Save the state of Sabreman. | |||||
| 58739 | BIT 7,(IX+15) | Jump to Handle_Carried_Sabreman_Update if bit 7 of the redraw flags is reset. | ||||||
| 58743 | JP Z,Handle_Carried_Sabreman_Update | |||||||
| 58746 | SET 5,(IX+15) | Set bit 5 of the redraw flags, to ask the eagle to let go. | ||||||
| 58750 | LD (IX+10),15 | Set the countdown to 15. | ||||||
|
This entry point is used by the routine at Start_Being_Carried.
|
||||||||
| Handle_Carried_Sabreman_Update | 58754 | LD A,(IX+8) | Fetch the x position that the eagle has set. | |||||
| 58757 | SUB (IX+1) | Subtract the current x position. | ||||||
| 58760 | RLCA | Rotate bit 6 of the result into bit 1. | ||||||
| 58761 | RLCA | |||||||
| 58762 | AND %00000010 | Keep only bit 1, which is set when he is moving to the left. | ||||||
| 58764 | LD C,A | Store the result in C. | ||||||
| 58765 | LD A,(36566) | Fetch the tick counter. | ||||||
| 58768 | RRA | Move bit 1 into bit 0. | ||||||
| 58769 | AND %00000001 | Keep only that bit. | ||||||
| 58771 | ADD A,C | Add the direction bit. | ||||||
| 58772 | LD C,A | Store the result in C. | ||||||
| 58773 | LD A,(IX+0) | Fetch the type. | ||||||
| 58776 | AND %11111100 | Reset bits 0 and 1. | ||||||
| 58778 | ADD A,C | Add the frame and direction bits. | ||||||
| 58779 | LD (IX+0),A | Store the type. | ||||||
| 58782 | LD A,(IX+9) | Fetch the y position that the eagle has set. | ||||||
| 58785 | LD (IX+3),A | Set the y position of Sabreman. | ||||||
| 58788 | LD A,(IX+8) | Fetch the x position that the eagle has set. | ||||||
| 58791 | LD (IX+1),A | Set the x position of Sabreman. | ||||||
| 58794 | LD A,(36594) | Fetch the flag at Previous_Type_5C_Active_Flag. | ||||||
| 58797 | AND A | Jump to Handle_Carried_Sabreman_Drop if no eagle was carrying him. | ||||||
| 58798 | JR Z,Handle_Carried_Sabreman_Drop | |||||||
| 58800 | CALL Check_Decoration_Contact | Check for contact with the decorations. | ||||||
| 58803 | BIT 2,C | Jump to Handle_Carried_Sabreman_Check_Walls if he is not touching a decoration. | ||||||
| 58805 | JR Z,Handle_Carried_Sabreman_Check_Walls | |||||||
| 58807 | BIT 1,C | Jump to Handle_Carried_Sabreman_Stand if he is on top of it. | ||||||
| 58809 | JR NZ,Handle_Carried_Sabreman_Stand | |||||||
| 58811 | BIT 0,C | Jump to Handle_Carried_Sabreman_Stand if he is near the middle of it. | ||||||
| 58813 | JR Z,Handle_Carried_Sabreman_Stand | |||||||
| 58815 | SET 5,(IX+15) | Set bit 5 of the redraw flags, to ask the eagle to let go. | ||||||
| Handle_Carried_Sabreman_Check_Walls | 58819 | CALL Read_World_Map | Read the world map entry of the room that he is in. The flags of the room are returned in E. | |||||
| 58822 | LD A,(IX+1) | Fetch the x position. | ||||||
| 58825 | CP 207 | Jump to Handle_Carried_Sabreman_Check_Right_Wall if it is 207 or more. | ||||||
| 58827 | JR NC,Handle_Carried_Sabreman_Check_Right_Wall | |||||||
| 58829 | CP 24 | Jump to Handle_Carried_Sabreman_Check_Release if it is 24 or more. | ||||||
| 58831 | JR NC,Handle_Carried_Sabreman_Check_Release | |||||||
| 58833 | BIT 6,E | Jump to Handle_Carried_Sabreman_Check_Floor if the room has no wall on the left. | ||||||
| 58835 | JR Z,Handle_Carried_Sabreman_Check_Floor | |||||||
| 58837 | LD (IX+1),24 | Set the x position to 24. | ||||||
| 58841 | JR Handle_Carried_Sabreman_Check_Floor | Jump to Handle_Carried_Sabreman_Check_Floor. | ||||||
| Handle_Carried_Sabreman_Check_Right_Wall | 58843 | BIT 2,E | Jump to Handle_Carried_Sabreman_Check_Floor if the room has no wall on the right. | |||||
| 58845 | JR Z,Handle_Carried_Sabreman_Check_Floor | |||||||
| 58847 | LD (IX+1),207 | Set the x position to 207. | ||||||
| Handle_Carried_Sabreman_Check_Floor | 58851 | BIT 4,E | Jump to Handle_Carried_Sabreman_Check_Release if the room has a floor. | |||||
| 58853 | JR NZ,Handle_Carried_Sabreman_Check_Release | |||||||
| 58855 | LD A,(IX+3) | Fetch the y position. | ||||||
| 58858 | CP 159 | Jump to Handle_Carried_Sabreman_Check_Release if it is less than 159. | ||||||
| 58860 | JR C,Handle_Carried_Sabreman_Check_Release | |||||||
| 58862 | LD (IX+3),159 | Set the y position to 159. | ||||||
| Handle_Carried_Sabreman_Check_Release | 58866 | BIT 6,(IX+15) | Jump to Handle_Carried_Sabreman_Drop if bit 6 of the redraw flags is set, as the eagle has let go. | |||||
| 58870 | JR NZ,Handle_Carried_Sabreman_Drop | |||||||
| 58872 | CALL ReadControls | Read the controls. | ||||||
| 58875 | BIT 4,A | Jump to Update_Object_Sprite if the fire key is not pressed. | ||||||
| 58877 | JP NZ,Update_Object_Sprite | |||||||
| 58880 | CALL Throw_Weapon | Throw a weapon. | ||||||
| 58883 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
| Handle_Carried_Sabreman_Drop | 58886 | DI | Disable interrupts. | |||||
| 58887 | RES 6,(IX+15) | Reset bit 6 of the redraw flags. | ||||||
| 58891 | LD (IX+0),24 | Set the sprite id to 24 (tumbling). | ||||||
| 58895 | LD (IX+9),16 | Set the y velocity to 16. | ||||||
| 58899 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
| Handle_Carried_Sabreman_Stand | 58902 | LD A,B | Copy 160 less the y position of the top of the decoration to A. | |||||
| 58903 | DEC A | Subtract one. | ||||||
| 58904 | NEG | Negate it. | ||||||
| 58906 | ADD A,160 | Add 160 to get the y position just below the top of the decoration. | ||||||
| 58908 | LD (IX+3),A | Set the y position of Sabreman. | ||||||
| 58911 | JP Update_Object_Sprite | Jump to Update_Object_Sprite. | ||||||
| Prev: 58710 | Up: Map | Next: 58914 |