Prev: 41961 Up: Map Next: 42233
42064: Update states of drips (level 4)
Used by the routine at 41211.
42064 LD IX,45521 Load IX with address of complex state data for first drip (level 4)
42068 LD B,6 Load B with 6 (as there are 6 drips to process)
42070 PUSH BC Store BC (B = remaining number of drips to process)
42071 LD A,(IX+12) If current drip's velocity factor is not zero...
42074 OR A ...
42075 JR NZ,42128 ...then skip ahead to 42128 (handle drip's fall)
42077 LD A,(IX+9) If current drip's stage is not 8...
42080 CP 8 ...
42082 JR NZ,42092 ...then skip ahead to 42092
42084 LD A,(IX+8) Reset current drip's complex state data to values stored in table of initial-state data...
42087 CALL 53994 ...
42090 JR 42119 Advance IX to next entry in complex state data and loop back to 42070
42092 CP 7 If drip's stage is not 7...
42094 JR NZ,42102 ...then skip ahead to 42102
42096 LD (IX+12),1 Set current drip's velocity factor to 1
42100 JR 42119 Advance IX to next entry in complex state data and loop back to 42070
42102 LD C,A Load drip's stage into C
42103 LD A,15 Load A with a random number, 0-14...
42105 CALL 54222 ...
42108 OR A If A is not zero (14 in 15 chance)...
42109 JR NZ,42119 ...then advance IX to next entry in complex state data and loop back to 42070
42111 LD A,C Load drip's stage back into A...
42112 INC A ...and add one
42113 LD (IX+9),A Store updated drip stage value
42116 CALL 42251 Set drip's graphic layout data pointer to stage A graphic
42119 LD DE,13 Load DE with 13 (as entries are 13 bytes wide)
42122 ADD IX,DE Advance IX to next drip's complex state data
42124 POP BC Restore BC (B = remaining number of drips to process)
42125 DJNZ 42070 Loop back to 42070
42127 RET Return
Drip's velocity factor is not zero
42128 INC (IX+12) Increase drip's velocity factor
42131 LD (IX+1),1 Set drip's depth to 1
42135 LD IY,45508 Load IY with address of complex state data for cannon (level 4)
42139 LD B,A Load B with drip's velocity factor
42140 LD A,(IY+0) Load cannon's current room
42143 CP (IX+0) If cannon is in a different room to the drip...
42146 JR NZ,42190 ...then skip ahead to 42190
42148 LD A,(IY+1) If cannon's depth is not 1...
42151 CP 1 ...
42153 JR NZ,42190 ...then skip ahead to 42190
42155 LD A,(IY+5) If x-coordinate of cannon's left side...
42158 INC A ...plus one...
42159 CP (IX+5) ...is not the same as the x-coordinate of the drip's left side...
42162 JR NZ,42190 ...then skip ahead to 42190
42164 LD A,(IY+4) If y-coordinate of top cannon's top...
42167 CP (IX+4) ...is not the same as the y-coordinate of the drip's top...
42170 JR NZ,42215 ...then skip ahead to 42215
42172 LD A,(34209) Increase cannon's ammunition level by 10...
42175 ADD A,10 ...
42177 LD (34209),A ...
42180 SET 2,(IY+9) Set cannon's just-loaded flag
42184 LD (IY+12),20 Set cannon's fire timer to 20
42188 JR 42084 Reset current drip's state and loop back to 42070 for next drip
42190 CALL 54768 Check entity at IX for collision with another entity at same depth whose interaction-(11,6) flag is set...
42193 CP 31 ...and if collision was not with entity of class 31 (Berk)...
42195 JR NZ,42215 ...then skip ahead to 42215
42197 CALL 53667 Set Berk-has-been-killed flag
42200 LD A,8 Set drip's graphical stage to 8 (exploding on contact)...
42202 LD (IX+9),A ...and also set drip's stage to 8...
42205 CALL 42251 ...
42208 LD (IX+12),0 Set drip's velocity factor to zero
42212 JP 42119 Advance IX to next entry in complex state data and loop back to 42070
42215 LD A,(IX+4) If y-coordinate of top of drip is 120...
42218 CP 120 ...
42220 JR Z,42200 ...then loop back to 42200 (make drip explode and process next drip)
42222 INC (IX+4) Move drip down one character...
42225 INC (IX+6) ...
42228 DJNZ 42140 Decrease B (velocity factor) and loop back to 42140 if not zero
42230 JP 42119 Advance IX to next entry in complex state data and loop back to 42070
Prev: 41961 Up: Map Next: 42233