Prev: 38165 Up: Map Next: 38377
38219: Update state of Bubo's projectile
Used by the routine at 38009.
38219 LD IX,44214 Load IX with address of complex state data for Bubo's projectile (level 2)
38223 BIT 1,(IX+9) If projectile's fired flag is reset...
38227 RET Z ...then return
38228 BIT 2,(IX+9) If projectile's has-hit-target flag is reset...
38232 JR Z,38252 ...then update position of projectile and knock key down if appropriate
38234 LD BC,39131 Point BC at graphic layout data for Bubo's projectile...
38237 LD (IX+2),C ...and set this as the graphic lookup address for the projectile's complex state data entry...
38240 LD (IX+3),B ...
38243 LD (IX+9),0 Reset projectile's has-hit-target flag and fired flag
38247 LD (IX+1),0 Set projectile's depth to zero
38251 RET Return
38252 LD IY,44227 Point IY at complex state data for Bubo (level 2)
38256 LD A,(IX+12) If projectile's velocity factor is not zero...
38259 OR A ...
38260 JR NZ,38267 ...then skip ahead to 38267
38262 CALL 38377 Start level 2 key falling if Bubo's projectile is in place below it
38265 JR 38361 Jump to 38361 (increase velocity and handle landing if appropriate)
38267 BIT 7,A If bit 7 of projectile's velocity factor is set (i.e. negative, moving upwards)...
38269 JR NZ,38336 ...then skip ahead to 38336
38271 CP 6 If projectile's velocity factor is less than 6...
38273 JR C,38277 ...then skip ahead to 38277
38275 LD A,5 Load A with 5 (terminal velocity)
38277 LD B,A Load B with velocity value
38278 PUSH BC Store BC (B = remaining velocity value)
38279 CALL 54768 Check entity at IX for collision with another entity at same depth whose interaction-(11,6) flag is set...
38282 JR C,38328 ...and if no collision occurred, then skip ahead to 38328
38284 CP 31 If collision was not with entity of class 31 (Berk)...
38286 JR NZ,38293 ...then skip ahead to 38293
38288 CALL 53667 Set Berk-has-been-killed flag
38291 JR 38328 Skip ahead to 38328
38293 CP 25 If collision was not with entity of class 25 (ape-beast, level 2)...
38295 JR NZ,38328 ...then skip ahead to 38328
38297 LD A,(34218) Load A with current character's current room...
38300 CP (IX+0) ...and if this is not the same as the projectile's room...
38303 JR NZ,38328 ...then skip ahead to 38328
38305 LD (IY+1),0 Set ape-beast's depth to zero
38309 LD (IY+11),0 Reset ape-beast's flags
38313 LD BC,51483 Point BC at graphic layout data for explosion (Bubo's projectile / fallen drips, level 4)...
38316 LD (IX+2),C ...and set this as the graphic lookup address for the projectile's complex state data entry...
38319 LD (IX+3),B ...
38322 SET 2,(IX+9) Set projectile's has-hit-target flag
38326 POP BC Restore BC (B = current velocity factor)
38327 RET Return
38328 CALL 38756 Move projectile down one character
38331 POP BC Restore BC (B = current velocity factor)
38332 DJNZ 38278 Decrease remaining velocity value and loop back to 38278 if not zero
38334 JR 38361 Skip ahead to 38361 (increase velocity and handle landing if appropriate)
Projectile moving upwards
38336 NEG Multiply projectile's velocity factor by -1
38338 CP 6 If projectile's velocity factor is now less than 6...
38340 JR C,38344 ...then skip ahead to 38344 (change projectile's y-coordinate based upon velocity)
38342 LD A,5 Load A with 5 (i.e. cap velocity magnitude at 5)
38344 NEG Multiply value in A by -1...
38346 LD E,A ...and load value (capped velocity) into E
38347 LD A,(IX+4) Decrease projectile's y-coordinate by value in E...
38350 ADD A,E ...
38351 LD (IX+4),A ...
38354 LD A,(IX+6) ...
38357 ADD A,E ...
38358 LD (IX+6),A ...
38361 LD A,(IX+4) If projectile's y-coordinate is at least 124...
38364 CP 124 ...
38366 JR NC,38372 ...then skip ahead to 38372 (reset projectile's fired flag and return)
38368 INC (IX+12) Increase projectile's velocity factor by one
38371 RET Return
38372 RES 1,(IX+9) Reset projectile's fired flag
38376 RET Return
Prev: 38165 Up: Map Next: 38377