Prev: D019 Up: Map Next: D065
D04B: Creature collision check with room boundary and Maroc
Used by the routines at CDD7, CED4, CF0B, CF3E and CF58.
Check if a creature has collided with a room boundary or Maroc:
  • Uses the generic room boundary check routine at E039 which checks for collision with the room walls, and if so, adjusts the creature's position
  • Checks if a creature is at Maroc's position on screen/in room
  • If so, reduce Maroc's energy based on the damage that creature type deals (last byte of creature data set at 6CB4)
  • If the creature is a WRAITH, check if the WRAITHBANE spell is active & if so destroy the wraith
D04B LD A,($EC9C) FREEZE spell timer counter (> 0 means the FREEZE spell is in effect)
D04E CP $00
D050 JR NZ,$D090 Maroc doesn't lose energy if he touches stationary creatures when the FREEZE spell is in effect
Check creature is within room wall boundary, adjusting if needed:
D052 LD A,($EB4A) Creature's vertical pixel position in room
D055 ADD A,$08 Adjust the vertical point to check for collisions 8 pixels down, towards the middle of the creature, rather than the top
D057 LD E,A Store in E register, which is what the room boundary is checked against
D058 CALL $E039 Run room boundary checks for creature, adjusting position accordingly if needed
Check collision detection with Maroc
D05B LD C,$00 Collision event type 0 = collision with Maroc
D05D CALL $DFCD Run collision check
D060 CP $00 The A register is returned with 1 = collision, or 0 = no collision
D062 JP Z,$D27D If no collision, can jump out of the entire routine here
The next routine follows if a creature has collided with Maroc
Prev: D019 Up: Map Next: D065