![]() |
Routines |
| Prev: 57970 | Up: Map | Next: 58059 |
|
Checks whether an object is touching Sabreman.
Nothing is touched if the sprite id of Sabreman is 29 or more (he is dying or being carried), or if bit 6 of his redraw flags is set (he is being carried).
There is contact when the two are in the same room, the x positions differ by less than 16 and the y position of Sabreman, less four, differs from that of the object by less than 10. A tone is played on contact (see Play_Position_Sound).
|
||||||||||||
| Check_Sabreman_Contact | 57989 | LD C,0 | Clear the contact result. | |||||||||
| 57991 | LD A,(36634) | Fetch the sprite id of Sabreman. | ||||||||||
| 57994 | CP 29 | Return if it is 29 or more. | ||||||||||
| 57996 | RET NC | |||||||||||
|
This entry point is used by the routine at Handle_Guardian.
|
||||||||||||
| Check_Sabreman_Contact_Clear_Result | 57997 | LD C,0 | Clear the contact result. | |||||||||
| 57999 | LD A,(36649) | Fetch the redraw flags of Sabreman. | ||||||||||
| 58002 | AND %01000000 | Keep only bit 6. | ||||||||||
| 58004 | RET NZ | Return if Sabreman is being carried. | ||||||||||
| 58005 | LD HL,36635 | Point HL at Sabreman_X_Position. | ||||||||||
| 58008 | LD A,(HL) | Fetch the x position of Sabreman. | ||||||||||
| 58009 | SUB (IX+1) | Subtract the x position of the object, and jump to Check_Sabreman_Contact_Check_Width if Sabreman is not to the left of it. | ||||||||||
| 58012 | JP P,Check_Sabreman_Contact_Check_Width | |||||||||||
| 58015 | SET 7,C | Set bit 7 of the contact result, as Sabreman is to the left of the object. | ||||||||||
| 58017 | NEG | Make the difference positive. | ||||||||||
| Check_Sabreman_Contact_Check_Width | 58019 | CP 16 | Return if the difference is 16 or more. | |||||||||
| 58021 | RET NC | |||||||||||
| 58022 | INC HL | Point HL at the room x of Sabreman. | ||||||||||
| 58023 | LD A,(HL) | Fetch the room x of Sabreman. | ||||||||||
| 58024 | CP (IX+2) | Return if Sabreman is in a different room x from the object. | ||||||||||
| 58027 | RET NZ | |||||||||||
| 58028 | INC HL | Point HL at the y position of Sabreman. | ||||||||||
| 58029 | LD A,(HL) | Fetch the y position of Sabreman. | ||||||||||
| 58030 | SUB 4 | Subtract four. | ||||||||||
| 58032 | SUB (IX+3) | Subtract the y position of the object, and jump to Check_Sabreman_Contact_Check_Height if Sabreman is not above it. | ||||||||||
| 58035 | JP P,Check_Sabreman_Contact_Check_Height | |||||||||||
| 58038 | NEG | Make the difference positive. | ||||||||||
| 58040 | SET 1,C | Set bit 1 of the contact result, as Sabreman is above the object. | ||||||||||
| Check_Sabreman_Contact_Check_Height | 58042 | CP 10 | Return if the difference is 10 or more. | |||||||||
| 58044 | RET NC | |||||||||||
| 58045 | INC HL | Point HL at the room y of Sabreman. | ||||||||||
| 58046 | LD A,(HL) | Fetch the room y of Sabreman. | ||||||||||
| 58047 | CP (IX+4) | Return if Sabreman is in a different room y from the object. | ||||||||||
| 58050 | RET NZ | |||||||||||
| 58051 | SET 2,C | Set bit 2 of the contact result (contact). | ||||||||||
| 58053 | PUSH BC | Stash the contact result. | ||||||||||
| 58054 | CALL Play_Position_Sound | Play a tone. | ||||||||||
| 58057 | POP BC | Restore the contact result. | ||||||||||
| 58058 | RET | Return. | ||||||||||
| Prev: 57970 | Up: Map | Next: 58059 |