Prev: 37062 Up: Map Next: 37205
37085: Update state of bat (level 1)
Used by the routine at 37062.
Input
IX (always 43463, entry in level 1 complex state data for bat)
HL Current position in bat's script data
37085 CALL 54768 Check entity at IX for collision with another entity at same depth whose interaction-(11,6) flag is set...
37088 JR C,37104 ...and if no collision occurred, then skip ahead to 37104
37090 CP 31 If collision was not with entity of class 31 (Berk)...
37092 JR NZ,37100 ...then skip ahead to 37100
37094 CALL 53667 Set Berk-has-been-killed flag
37097 JP 48096 Advance HL to next script instruction and execute
37100 CP 18 If collision was with entity of class 18 (Drutt)...
37102 JR Z,37111 ...then skip ahead to 37111
37104 CALL 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 and if collision was not with entity of class 18 (Drutt) then skip ahead to 37128
37107 CP 18
37109 JR NZ,37128
37111 BIT 6,(IY+10) If Drutt's can-fall flag is set...
37115 JR NZ,37128 ...then skip ahead to 37128
37117 SET 6,(IY+10) Set Drutt's can-fall flag
37121 LD (IY+12),2 Set Drutt's velocity factor to 2
37125 JP 48096 Advance HL to next script instruction and execute
37128 BIT 0,(IX+9) If bat's must-process-current-script-data flag is set...
37132 JP NZ,48096 ...then jump to 48096 (advance HL to next script instruction and execute)
37135 LD A,(34208) If Drutt-mode flag is set...
37138 BIT 0,A ...
37140 JR NZ,37148 ...then skip ahead to 37148
37142 LD IY,(34240) Load IY with address of current level's complex state data for Berk
37146 JR 37152 Skip ahead to 37152
37148 LD IY,(34242) Load IY with address of current level's complex state data for Drutt
At this point, IY points to the complex state data entry for the current character.
37152 LD A,(IY+0) If current character's current room is not the same as the bat's...
37155 CP (IX+0) ...
37158 JP NZ,48096 ...then jump to 48096 (advance HL to next script instruction and execute)
37161 LD A,(IY+7) If the current character's right side...
37164 CP (IX+5) ...is to the left of the bat's left side...
37167 JR C,37194 ...then skip ahead to 37194
37169 LD A,(IX+7) If the bat's right side...
37172 CP (IY+5) ...is to the left of the current character's left side...
37175 JR C,37183 ...then skip ahead to 37183
37177 LD HL,37024 Point HL at script data for bat attacking...
37180 JP 48098 ...and execute
37183 LD A,(IX+7) If the x-coordinate of the bat's right side is less than 130...
37186 CP 130 ...
37188 JP C,48615 ...then move bat right by one character
37191 JP 48096 Advance HL to next script instruction and execute
37194 LD A,101 If the x-coordinate of the bat's left side is greater than 101...
37196 CP (IX+5) ...
37199 JP C,48660 ...then move bat left by one character
37202 JP 48096 Advance HL to next script instruction and execute
Prev: 37062 Up: Map Next: 37205