![]() |
Routines |
| Prev: 60718 | Up: Map | Next: 60852 |
|
Used by the routine at Check_Object_Contact.
Checks whether an object touches the rock formation (see Handle_Rock_Formation). It is used by Check_Object_Contact in place of the usual test when the obstacle is of the type 136.
The formation is a triangle with its point at the bottom, which is centred on the x position 128. The half width of the triangle at the height of the object is 154 less the y position of the object, divided by four (the half width is larger when the object is higher) and then 8 is added. An object touches the formation when it is not below 144 and its distance from the centre is less than that.
The result has bits 0 and 2 set when the object touches the formation, and bit 7 as well when the object is on the right of the centre. The object is never standing on the formation.
|
||||||||||||
| Check_Rock_Formation_Contact | 60810 | LD C,0 | Clear the contact result. | |||||||||
| 60812 | LD B,1 | B=1. | ||||||||||
| 60814 | LD A,(IX+3) | Fetch the y position of the object. | ||||||||||
| 60817 | CP 144 | Return if the object is 144 or more pixels down, as it is below the formation. | ||||||||||
| 60819 | RET NC | |||||||||||
| 60820 | NEG | Negate the y position. | ||||||||||
| 60822 | SUB 102 | Subtract 102 which gives 154 less the y position. | ||||||||||
| 60824 | SRL A | Divide the result by four. | ||||||||||
| 60826 | SRL A | |||||||||||
| 60828 | ADD A,8 | Add 8. | ||||||||||
| 60830 | LD D,A | Store the half width in D. | ||||||||||
| 60831 | LD A,128 | Set the centre of the formation, 128. | ||||||||||
| 60833 | SUB (IX+1) | Jump to Check_Rock_Formation_Contact_Test_Width if the object is on the left of the centre. | ||||||||||
| 60836 | JP P,Check_Rock_Formation_Contact_Test_Width | |||||||||||
| 60839 | NEG | Make the distance positive. | ||||||||||
| 60841 | SET 7,C | Set bit 7 of the result, as the object is on the right. | ||||||||||
| Check_Rock_Formation_Contact_Test_Width | 60843 | CP D | Jump to Check_Object_Contact_None if the distance is the half width or more, as the objects do not touch. | |||||||||
| 60844 | JP NC,Check_Object_Contact_None | |||||||||||
| 60847 | SET 0,C | Set bit 0 of the result, as the object is outside the middle. | ||||||||||
| 60849 | SET 2,C | Set bit 2 of the result, as the objects touch. | ||||||||||
| 60851 | RET | Return. | ||||||||||
| Prev: 60718 | Up: Map | Next: 60852 |