![]() |
Routines |
| Prev: 59429 | Up: Map | Next: 59515 |
|
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 16 and the y positions by less than 20.
The result in C starts as 128 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 10 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 | 59443 | LD BC,128 | Set BC to 128. | |||||||||||
| 59446 | LD A,(36666) | Fetch the type of the stalactite. | ||||||||||||
| 59449 | AND A | Return if there is no falling stalactite. | ||||||||||||
| 59450 | RET Z | |||||||||||||
| 59451 | LD A,(36590) | Fetch the gem timer. | ||||||||||||
| 59454 | AND A | Return if it is not zero. | ||||||||||||
| 59455 | RET NZ | |||||||||||||
| 59456 | LD A,(36668) | Fetch the room x of the stalactite. | ||||||||||||
| 59459 | CP (IX+2) | Return if it is different. | ||||||||||||
| 59462 | RET NZ | |||||||||||||
| 59463 | LD A,(36670) | Fetch the room y of the stalactite. | ||||||||||||
| 59466 | CP (IX+4) | Return if it is different. | ||||||||||||
| 59469 | RET NZ | |||||||||||||
| 59470 | LD A,(36667) | Fetch the x position of the stalactite. | ||||||||||||
| 59473 | SUB (IX+1) | Jump to Check_Stalactite_Contact_Check_Width if the stalactite is level with or to the right of the object. | ||||||||||||
| 59476 | JP P,Check_Stalactite_Contact_Check_Width | |||||||||||||
| 59479 | NEG | Make the difference positive. | ||||||||||||
| 59481 | RES 7,C | Reset bit 7 of the contact result. | ||||||||||||
| Check_Stalactite_Contact_Check_Width | 59483 | CP 16 | Return if the difference is 16 or more. | |||||||||||
| 59485 | RET NC | |||||||||||||
| 59486 | CP 10 | Jump to Check_Stalactite_Contact_Check_Height if the difference is less than 10. | ||||||||||||
| 59488 | JR C,Check_Stalactite_Contact_Check_Height | |||||||||||||
| 59490 | SET 0,C | Set bit 0 of the contact result. | ||||||||||||
| Check_Stalactite_Contact_Check_Height | 59492 | LD A,(36669) | Fetch the y position of the stalactite. | |||||||||||
| 59495 | SUB (IX+3) | Jump to Check_Stalactite_Contact_Check_Contact if the stalactite is below the object. | ||||||||||||
| 59498 | JP P,Check_Stalactite_Contact_Check_Contact | |||||||||||||
| 59501 | NEG | Make the difference positive. | ||||||||||||
| 59503 | SET 1,C | Set bit 1 of the contact result. | ||||||||||||
| Check_Stalactite_Contact_Check_Contact | 59505 | CP 20 | Return if the difference is 20 or more. | |||||||||||
| 59507 | RET NC | |||||||||||||
| 59508 | SET 2,C | Set bit 2 of the contact result (contact). | ||||||||||||
| 59510 | LD A,(36675) | Fetch the y velocity of the stalactite. | ||||||||||||
| 59513 | LD B,A | Store it in B. | ||||||||||||
| 59514 | RET | Return. | ||||||||||||
| Prev: 59429 | Up: Map | Next: 59515 |