Prev: 39601 Up: Map Next: 39760
39699: Count coloured creatures in slots and return if all are home
Used by the routine at 39601.
Output
H Number of coloured creatures in correct slots
L Number of coloured creatures in slots
39699 LD IX,44894 Load IX with address of complex state data for first coloured creature (level 3)
39703 LD HL,0 Load HL with zero
39706 LD B,3 Load B with 3 (as there are 3 creatures)
39708 LD A,(IX+6) If y-coordinate of bottom of current creature is not 114...
39711 CP 114 ...
39713 RET NZ ...then return
39714 INC L Increase L (number of creatures in slots)
39715 LD A,(IX+8) If current entity class is not 13 (red coloured creature, level 3)...
39718 CP 13 ...
39720 JR NZ,39726 ...then skip ahead to 39726
39722 LD A,108 Load A with 108 (x-coordinate of left-most slot)
39724 JR 39736 Skip ahead to 39736
39726 CP 14 If current entity class is not 14 (yellow coloured creature, level 3)...
39728 JR NZ,39734 ...then skip ahead to 39734
39730 LD A,115 Load A with 115 (x-coordinate of middle slot)
39732 JR 39736 Skip ahead to 39736
39734 LD A,122 Load A with 122 (x-coordinate of right-most slot)
39736 CP (IX+5) If x-coordinate of slot in A is not the same as x-coordinate of current creature's left...
39739 JR NZ,39742 ...then skip ahead to 39742
39741 INC H Increase H (number of creatures at correct x-coordinate for their respective coloured slots)
39742 LD DE,13 Advance IX to next entity...
39745 ADD IX,DE ...
39747 DJNZ 39708 Loop back to 39708 for next creature
39749 LD A,H If H is not 3 (i.e. at least one creature not at correct x-coordinates)...
39750 CP 3 ...
39752 RET NZ ...then return
39753 LD A,2 Set all-coloured-creatures-home flag
39755 LD (44903),A ...
39758 POP BC Return to routine that called the calling routine...
39759 RET ...
Prev: 39601 Up: Map Next: 39760