Prev: 38054 Up: Map Next: 38165
38074: Update state of Bubo
Used by the routine at 38054.
Input
IX Address of complex state data for Bubo (level 2)
38074 BIT 3,(IX+9) If Bubo's harmless flag is set...
38078 JR NZ,38101 ...then skip ahead to 38101
38080 LD A,(34220) If Berk's current power is not immunity to Bubo (level 2)...
38083 CP 9 ...
38085 JR NZ,38093 ...then skip ahead to 38093
38087 SET 3,(IX+9) Set Bubo's harmless flag
38091 JR 38101 Skip ahead to 38101
38093 CALL 54768 Check entity at IX for collision with another entity at same depth whose interaction-(11,6) flag is set...
38096 CP 31 ...and if collision was with entity of class 31 (Berk)...
38098 CALL Z,53667 ...then set Berk-has-been-killed flag
38101 LD IY,44214 Load IY with address of complex state data for Bubo's projectile (level 2)
38105 BIT 0,(IX+9) If Bubo's must-process-current-script-data flag is set (Bubo firing)...
38109 JP NZ,48096 ...then jump to 48096 (advance HL to next script instruction and execute)
38112 BIT 1,(IY+9) If projectile's fired flag is set...
38116 JP NZ,48096 ...then jump to 48096 (advance HL to next script instruction and execute)
38119 BIT 5,(IX+10) If Bubo is not being carried...
38123 JR Z,38132 ...then skip ahead to 38132
38125 SET 2,(IX+9) Set Bubo's waiting-to-fire flag
38129 JP 48096 Advance HL to next script instruction and execute
The code block below is only entered if Bubo's must-process-current-script-data flag is reset (i.e. he is not firing), the projectile's fired flag is reset and Bubo is not being carried.
38132 LD A,(IX+1) If Bubo has a depth of 2...
38135 CP 2 ...
38137 JP Z,48096 ...then jump to 48096 (advance HL to next script instruction and execute)
38140 BIT 2,(IX+9) If Bubo's waiting-to-fire flag is set, i.e. he has just been dropped...
38144 JR NZ,38155 ...then skip ahead to 38155 (make Bubo fire)
38146 LD A,60 Load A with a random number, 0-59...
38148 CALL 54222 ...
38151 OR A ...and if this is not zero (59 in 60 chance)...
38152 JP NZ,48096 ...then jump to 48096 (advance HL to next script instruction and execute)
38155 RES 2,(IX+9) Reset Bubo's waiting-to-fire flag
38159 LD HL,38032 Point HL at script data for Bubo firing...
38162 JP 48098 ...and execute
Prev: 38054 Up: Map Next: 38165