Prev: 39673 Up: Map Next: 39735
39693: Choose Position
Used by the routine at StartNastie.
Chooses a random position for an actor which is about to appear in the player's room, both the X and Y coordinates are between 48 and 175. The position is rejected if the actor would overlap the player (see TestPlayerTouchingActor) or an object in the room (see SlideActorPastObjects).
Input
IX Actor record
Output
DE The Y and X position (D and E)
F Carry flag set if the position is unsuitable
Use a random X position.
ChoosePosition 39693 LD A,(38549) Fetch the random seed from RandomNumber.
39696 AND %01111111 Keep only bits 0-6.
39698 ADD A,48 Add 48.
39700 LD E,A Copy the X position to E.
39701 LD (IX+3),A Set the X position of the actor.
This entry point is used by the routine at PlaceFlame.
Use a Y position based on the frame counter.
ChoosePosition_SetY 39704 LD A,(23672) Fetch the frame counter from FRAMES.
39707 AND %01111111 Keep only bits 0-6.
39709 ADD A,48 Add 48.
39711 LD D,A Copy the Y position to D.
39712 LD (IX+4),A Set the Y position of the actor.
This entry point is used by the routine at PlaceFlame_InRow.
Put the actor in the player's room and test the position.
ChoosePosition_Test 39715 LD A,(38659) Fetch the player's room from 38659.
39718 LD (IX+1),A Set the room of the actor to the player's room.
39721 LD BC,5911 Set the height and width of the actor in B and C to 23.
39724 CALL TestPlayerTouchingActor Check whether the actor overlaps the player.
39727 RET C Return if the actor would overlap the player.
39728 LD BC,5911 Set the height and width of the actor in B and C to 23.
39731 CALL SlideActorPastObjects Check whether the actor overlaps an object in the room.
39734 RET Return.
Prev: 39673 Up: Map Next: 39735