![]() |
Routines |
| Prev: ED2E | Up: Map | Next: EDB4 |
|
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 88.
The formation is a triangle with its point at the bottom, which is centred on the x position 80. The half width of the triangle at the height of the object is 9A less the y position of the object, divided by four (the half width is larger when the object is higher) and then 08 is added. An object touches the formation when it is not below 90 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 | ED8A | LD C,$00 | Clear the contact result. | |||||||||
| ED8C | LD B,$01 | B=01. | ||||||||||
| ED8E | LD A,(IX+$03) | Fetch the y position of the object. | ||||||||||
| ED91 | CP $90 | Return if the object is 90 or more pixels down, as it is below the formation. | ||||||||||
| ED93 | RET NC | |||||||||||
| ED94 | NEG | Negate the y position. | ||||||||||
| ED96 | SUB $66 | Subtract 66 which gives 9A less the y position. | ||||||||||
| ED98 | SRL A | Divide the result by four. | ||||||||||
| ED9A | SRL A | |||||||||||
| ED9C | ADD A,$08 | Add 08. | ||||||||||
| ED9E | LD D,A | Store the half width in D. | ||||||||||
| ED9F | LD A,$80 | Set the centre of the formation, 80. | ||||||||||
| EDA1 | SUB (IX+$01) | Jump to Check_Rock_Formation_Contact_Test_Width if the object is on the left of the centre. | ||||||||||
| EDA4 | JP P,Check_Rock_Formation_Contact_Test_Width | |||||||||||
| EDA7 | NEG | Make the distance positive. | ||||||||||
| EDA9 | SET 7,C | Set bit 7 of the result, as the object is on the right. | ||||||||||
| Check_Rock_Formation_Contact_Test_Width | EDAB | CP D | Jump to Check_Object_Contact_None if the distance is the half width or more, as the objects do not touch. | |||||||||
| EDAC | JP NC,Check_Object_Contact_None | |||||||||||
| EDAF | SET 0,C | Set bit 0 of the result, as the object is outside the middle. | ||||||||||
| EDB1 | SET 2,C | Set bit 2 of the result, as the objects touch. | ||||||||||
| EDB3 | RET | Return. | ||||||||||
| Prev: ED2E | Up: Map | Next: EDB4 |