Prev: 41617 Up: Map Next: 41767
41633: Update state of ghost
Used by the routine at 41211.
41633 LD IX,45794 Load IX with address of complex state data for ghost (level 4)
41637 CALL 54768 Check entity at IX for collision with another entity at same depth whose interaction-(11,6) flag is set...
41640 CP 31 ...and if collision was not with entity of class 31 (Berk)...
41642 JR NZ,41653 ...then skip ahead to 41653
If collision was with Berk, then IY will point to Berk's complex state data
41644 BIT 6,(IY+9) If Berk is not flying...
41648 JR Z,41653 ...then skip ahead to 41653
41650 CALL 53667 Set Berk-has-been-killed flag
41653 LD A,(34218) Load E with current character's current room index...
41656 LD E,A ...
41657 LD A,(IX+0) Load A with ghost's current room index
41660 LD C,(IX+4) Load C with y-coordinate of ghost's top edge
41663 LD B,(IX+6) Load B with y-coordinate of ghost's bottom edge
41666 BIT 0,(IX+9) If ghost's moving-upwards flag is set...
41670 JR NZ,41716 ...then skip ahead to 41716
41672 CP 4 If ghost's current room is 4 (room above pit)...
41674 JR Z,41687 ...then skip ahead to 41687
41676 LD A,B If y-coordinate of ghost's bottom edge...
41677 CP 119 ...is not 119...
41679 JP NZ,42360 ...then move ghost down one character and return
41682 SET 0,(IX+9) Set ghost's moving-upwards flag
41686 RET Return
Ghost's current room is 4 (room above pit)
41687 CP E If current character is in the same room as the ghost...
41688 JR Z,41703 ...then skip ahead to 41703
41690 LD A,B If y-coordinate of ghost's bottom edge...
41691 CP 119 ...is not 119...
41693 JP NZ,42360 ...then move ghost down one character and return
41696 INC (IX+0) Increase index of ghost's current room (to 5, pit)
41699 LD A,94 Position ghost such that the y-coordinate of its top edge is 115...
41701 JR 41758 ...and return
Current character and ghost in same room (room above pit)
41703 LD A,C If y-coordinate of ghost's top edge...
41704 CP 121 ...is not 121...
41706 JP NZ,42360 ...then move ghost down one character and return
41709 INC (IX+0) Increase index of ghost's current room (to 5, pit)
41712 LD A,100 Position ghost such that the y-coordinate of its top edge is 100...
41714 JR 41758 ...and return
Ghost's moving-upwards flag is set
41716 CP 5 If ghost's current room is 5 (pit)...
41718 JR Z,41731 ...then skip ahead to 41731
41720 LD A,C If y-coordinate of ghost's top edge...
41721 CP 101 ...is not 101...
41723 JP NZ,42374 ...then move ghost up one character and return
41726 RES 0,(IX+9) Reset ghost's moving-upwards flag (i.e. moving downwards)
41730 RET Return
Ghost's current room is 5 (pit)
41731 CP E If current character is in the same room as the ghost...
41732 JR Z,41747 ...then skip ahead to 41747
41734 LD A,C If y-coordinate of ghost's top edge...
41735 CP 101 ...is not 101...
41737 JP NZ,42374 ...then move ghost up one character and return
41740 DEC (IX+0) Decrease index of ghost's current room (to 4, room above pit)
41743 LD A,121 Position ghost such that the y-coordinate of its top edge is 121...
41745 JR 41758 ...and return
Current character and ghost in same room (pit)
41747 LD A,B If y-coordinate of ghost's bottom edge...
41748 CP 100 ...is not 100...
41750 JP NZ,42374 ...then move ghost up one character and return
41753 DEC (IX+0) Decrease index of ghost's current room (to 4, room above pit)
41756 LD A,115 Prepare to set y-coordinate of ghost's top edge to 115
41758 LD (IX+4),A Set y-coordinate of ghost's top edge to value in A
41761 ADD A,6 Add 6 to value in A (as ghost is 6 characters tall)...
41763 LD (IX+6),A ...and set y-coordinate of ghost's bottom edge to value in A
41766 RET Return
Prev: 41617 Up: Map Next: 41767