Prev: 54865 Up: Map Next: 54948
54907: Prepare a warlock to appear in the room
Input
B Warlock number (1-7) - calculated from lookup table at 50852
warlock appearing in the room
The previous routine has determined that it's time for a warlock to appear in the room.
As long as this level's warlock hasn't been destroyed, the routine sets the warlock's screen position, movement direction, and speed.
54907 LD A,B Get warlock number (between 1 and 7 from table at 27772)
54908 CALL 57706 Set up warlock data in working buffer at 60227
54911 LD HL,60150 Get address holding the room's vertical pixel position
54914 INC HL Held in next (high) byte, so advance one address
54915 LD A,(HL) Get the room position byte (top of room)
54916 ADD A,28 Add 28 pixels - the warlock's vertical position remains the same, even as it floats across the screen between the side and back walls
54918 LD (60234),A Store this value as the warlock's vertical pixel position
Determine warlock's (horizontal) speed and direction. Values can be between -3 and +4. A value of 0 means the warlock stays in one place.
54921 AND 7 The A register contains the vertical room pixel position, used here to provide the variety for the warlock's movement. Keep bits 0-2 (values 0-7)
54923 SUB 3 Subtract 3, to give a possible values of -3 to +4 (negative numbers = left, positive numbers = right)
54925 LD (60236),A Store as warlock's (horizontal) speed (and direction)
54928 LD HL,(60228) Address pointer to this warlock's data set (at 27772)
54931 INC HL
54932 LD A,(HL) Get the second byte of the warlock's data set
54933 CP 0
54935 JR NZ,54991 The second byte tells us if the warlock is still alive on this level. If this byte ISN'T 0, it means Maroc has destroyed it, so jump out of the routine here if this is the case
54937 INC HL Move the address pointer along to the sixth byte of the warlock's data set.
54938 INC HL
54939 INC HL
54940 INC HL
54941 LD A,(HL) This is this warlock's "aggression" stat, which affects
- the likelihood of it appearing
- the frequency of missiles being fired
54942 LD (60333),A Store in warlock active data buffer
54945 JP 54960
Prev: 54865 Up: Map Next: 54948