Prev: 37586 Up: Map Next: 37718
37639: Update the state of a spider (level 1)
Used by the routine at 37586.
Input
IX Address of complex state data for a (level 1) spider (43749, 43762 or 43775)
37639 LD A,(34208) If reset-spiders-to-initial-state flag is reset...
37642 BIT 3,A ...
37644 JR Z,37662 ...then skip ahead to 37662
37646 LD A,27 Reset complex state data for right-hand spider to that stored in initial-state table...
37648 CALL 53987 ...
37651 LD A,28 Reset complex state data for middle spider to that stored in initial-state table...
37653 CALL 53987 ...
37656 LD A,29 Reset complex state data for left-hand spider to that stored in initial-state table...
37658 CALL 53987 ...
37661 RET Return
37662 BIT 2,A If Berk-has-been-killed flag is set...
37664 RET NZ ...then return
37665 CALL 54764 Check entity at IX for collision with another entity at next depth level out of screen whose interaction-(11,6) flag is set...
37668 CP 31 ...and if collision was not with entity of class 31 (Berk)...
37670 JR NZ,37685 ...then skip ahead to 37685
37672 CALL 53667 Set Berk-has-been-killed flag
37675 LD A,(34223) Increase count of number of times a spider has killed Berk...
37678 INC A ...
37679 LD (34223),A ...
37682 JP 48096 Advance HL to next script instruction and execute
37685 LD IY,(34240) Load IY with address of current level's complex state data for Berk
37689 BIT 0,(IX+9) If spider's must-process-current-script-data flag is set...
37693 JP NZ,48096 ...then jump to 48096 (advance HL to next script instruction and execute)
37696 LD A,(IX+0) If the spider and Berk are in different rooms...
37699 CP (IY+0) ...
37702 RET NZ ...then return
37703 LD A,(IX+7) Load A with the x-coordinate of the spider's right side...
37706 ADD A,4 ...plus 4...
37708 CP (IY+5) ...and if the x-coordinate of Berk's left side is greater than this...
37711 RET C ...then return
37712 LD HL,37800 Point HL at script data for spider moving down...
37715 JP 48098 ...and execute
Prev: 37586 Up: Map Next: 37718