![]() |
Routines |
| Prev: E825 | Up: Map | Next: E87B |
|
Used by the routines at Handle_Sabreman_On_Rope, Handle_Sabreman_Walking and Handle_Sabreman_Falling.
Checks whether an object is touching the falling stalactite (the record at Falling_Stalactite_Record, see Handle_Falling_Stalactite).
Nothing is touched when there is no falling stalactite, while the gem timer at Gem_Timer is not zero, or if the stalactite is in a different room. The two are touching when the x positions differ by less than 10 and the y positions by less than 14.
The result in C starts as 80 and is: bit 7 set if the stalactite is level with or to the right of the object, bit 0 set if the x positions differ by 0A or more, bit 1 set if the stalactite is above the object, and bit 2 set if they are touching. B is the y velocity of the stalactite.
|
||||||||||||||
| Check_Stalactite_Contact | E833 | LD BC,$0080 | Set BC to 80. | |||||||||||
| E836 | LD A,($8F3A) | Fetch the type of the stalactite. | ||||||||||||
| E839 | AND A | Return if there is no falling stalactite. | ||||||||||||
| E83A | RET Z | |||||||||||||
| E83B | LD A,($8EEE) | Fetch the gem timer. | ||||||||||||
| E83E | AND A | Return if it is not zero. | ||||||||||||
| E83F | RET NZ | |||||||||||||
| E840 | LD A,($8F3C) | Fetch the room x of the stalactite. | ||||||||||||
| E843 | CP (IX+$02) | Return if it is different. | ||||||||||||
| E846 | RET NZ | |||||||||||||
| E847 | LD A,($8F3E) | Fetch the room y of the stalactite. | ||||||||||||
| E84A | CP (IX+$04) | Return if it is different. | ||||||||||||
| E84D | RET NZ | |||||||||||||
| E84E | LD A,($8F3B) | Fetch the x position of the stalactite. | ||||||||||||
| E851 | SUB (IX+$01) | Jump to Check_Stalactite_Contact_Check_Width if the stalactite is level with or to the right of the object. | ||||||||||||
| E854 | JP P,Check_Stalactite_Contact_Check_Width | |||||||||||||
| E857 | NEG | Make the difference positive. | ||||||||||||
| E859 | RES 7,C | Reset bit 7 of the contact result. | ||||||||||||
| Check_Stalactite_Contact_Check_Width | E85B | CP $10 | Return if the difference is 10 or more. | |||||||||||
| E85D | RET NC | |||||||||||||
| E85E | CP $0A | Jump to Check_Stalactite_Contact_Check_Height if the difference is less than 0A. | ||||||||||||
| E860 | JR C,Check_Stalactite_Contact_Check_Height | |||||||||||||
| E862 | SET 0,C | Set bit 0 of the contact result. | ||||||||||||
| Check_Stalactite_Contact_Check_Height | E864 | LD A,($8F3D) | Fetch the y position of the stalactite. | |||||||||||
| E867 | SUB (IX+$03) | Jump to Check_Stalactite_Contact_Check_Contact if the stalactite is below the object. | ||||||||||||
| E86A | JP P,Check_Stalactite_Contact_Check_Contact | |||||||||||||
| E86D | NEG | Make the difference positive. | ||||||||||||
| E86F | SET 1,C | Set bit 1 of the contact result. | ||||||||||||
| Check_Stalactite_Contact_Check_Contact | E871 | CP $14 | Return if the difference is 14 or more. | |||||||||||
| E873 | RET NC | |||||||||||||
| E874 | SET 2,C | Set bit 2 of the contact result (contact). | ||||||||||||
| E876 | LD A,($8F43) | Fetch the y velocity of the stalactite. | ||||||||||||
| E879 | LD B,A | Store it in B. | ||||||||||||
| E87A | RET | Return. | ||||||||||||
| Prev: E825 | Up: Map | Next: E87B |