Prev: 54878 Up: Map Next: 55002
54890: Check entity at IX for collision with another entity (in reverse order) at next depth level into screen whose interaction-(11,7) flag is set
The address stored at 34246 is the address of complex state data for the entity to start with when doing collision checks in reverse order. On levels 2, 3 and 4, the value stored here is the address of the complex state data of the last entity, which means that on these levels, all entities are checked. On level 1, however, the value stored is the address of the complex state data of the sixth-last entity. The remaining five entities after this address on level 1 are the three spiders, their webs and their arches. This means that on level 1, these spiders, webs and arches are excluded from certain collision checks.
Used by the routines at 35735, 37085 and 52315.
Input
IX Address of complex state data for an entity
C (Entry at 54899 only) Depth offset
Output
F Carry flag set if no entity found, reset otherwise
A Class of entity, if found, otherwise 254
IY Address of complex state data for colliding entity
54890 LD C,1 Set depth offset to 1 (i.e. check entities at next depth level into screen)
54892 LD DE,65523 Load DE with -13 (as entries in complex state data are 13 bytes wide)
54895 LD IY,(34246) Load IY with current level's start address for reverse-order collision checks
54899 LD A,(IX+0) If room of entity at IX is not the same as room of entity at IY...
54902 CP (IY+0) ...
54905 JR NZ,54987 ...then move IY back to previous entity
54907 BIT 5,(IY+10) If current entity at IY has its is-being-carried flag set...
54911 JP NZ,54987 ...then move IY back to previous entity
54914 LD A,(IY+8) If current entity at IY has a class which is the same as the entity at IX...
54917 CP (IX+8) ...
54920 JR Z,54987 ...then move IY back to previous entity
54922 BIT 7,A If entity at IY has its spans-full-depth flag set...
54924 JR NZ,54935 ...then skip over depth check to 54935
54926 LD A,(IY+1) If entity at IY has a depth which is not the same as the depth of the entity at IX...
54929 SUB C ...minus depth offset...
54930 CP (IX+1) ...
54933 JR NZ,54987 ...then move IY back to previous entity
54935 LD A,(IY+11) If entity at IY has its interaction-(11,7) flag reset...
54938 AND 128 ...
54940 JP Z,54987 ...then move IY back to previous entity
54943 LD A,(IX+6) If the bottom of the entity at IX...
54946 CP (IY+4) ...is above the top of the entity at IY...
54949 JR C,54987 ...then move IY back to previous entity
54951 LD A,(IY+6) If the bottom of the entity at IY...
54954 CP (IX+4) ...is above the top of the entity at IX...
54957 JR C,54987 ...then move IY back to previous entity
54959 LD A,(IX+7) If the right side of entity IX...
54962 CP (IY+5) ...is to the left of the left side of the entity at IY...
54965 JR C,54987 ...then move IY back to previous entity
54967 LD A,(IY+7) If the right side of entity IY...
54970 CP (IX+5) ...is to the left of the left side of the entity at IX...
54973 JR C,54987 ...then move IY back to previous entity
54975 XOR A Set A to zero to reset carry flag
54976 LD (34258),IY Store pointer to current entity at 34258
54980 LD A,(IY+8) Load A with class of entity at IY
54983 RET Return
54984 LD DE,65523 Load DE with -13
This entry point is used by the routine at 54878.
54987 LD A,(IY-1) If byte before current IY position is 254 (i.e. end marker for simple state data)...
54990 CP 254 ...
54992 JP Z,55000 ...then skip ahead to 55000
54995 ADD IY,DE Move IY back 13 bytes (i.e. to start of previous entry)
54997 JP 54899 Jump to 54899
55000 SCF Set carry flag
55001 RET Return
Prev: 54878 Up: Map Next: 55002