Prev: 46111 Up: Map Next: 46186
46142: Check Decoration Contact
Checks whether an object touches one of the decorations, using Check_Object_Contact. In the special rooms (a room y below 16) the four records that start at Object_Record_8 are checked. In the cave rooms the two records that start at Object_Record_10 are checked. The check stops at the first decoration that the object touches.
Interrupts are disabled while the check is made, as the result is kept in AF'.
Input
IX Object record
Output
B 160 less the y position of the top of the decoration
C Contact result (see Check_Object_Contact)
Check_Decoration_Contact 46142 DI Disable interrupts.
46143 PUSH IY Stash IY on the stack.
46145 LD A,(IX+4) Fetch the room y of the object.
46148 CP 16 Jump to Check_Decoration_Contact_Cave_Room if the object is in a cave room.
46150 JR NC,Check_Decoration_Contact_Cave_Room
46152 LD IY,36730 Point IY at Object_Record_8.
46156 LD B,4 Set a counter in B for the four records.
46158 JR Check_Decoration_Contact_Set_Record_Size Jump to Check_Decoration_Contact_Set_Record_Size.
Check_Decoration_Contact_Cave_Room 46160 LD IY,36762 Point IY at the first of the two records that are used in a cave room.
46164 LD B,2 Set a counter in B for the two records.
Check_Decoration_Contact_Set_Record_Size 46166 LD DE,16 Set the size of an object record.
Check_Decoration_Contact_Loop 46169 CALL Check_Object_Contact Check for contact with the object.
46172 BIT 2,C Jump to Check_Decoration_Contact_Done if the object touches the decoration.
46174 JR NZ,Check_Decoration_Contact_Done
46176 ADD IY,DE Move on to the next record.
46178 DJNZ Check_Decoration_Contact_Loop Decrease the record counter and loop back for the next record.
Check_Decoration_Contact_Done 46180 POP IY Restore IY from the stack.
46182 EX AF,AF' Swap in the height that Check_Object_Contact left in AF'.
46183 LD B,A Copy it to B.
46184 EI Enable interrupts.
46185 RET Return.
Prev: 46111 Up: Map Next: 46186