Prev: 8963 Up: Map Next: 89D4
8964: Update a type 2 (single direction) nasty
Used by the routine at 887D.
Input
A Status flag for this nasty.
8964 CP $03 Is the nasty invisible?
8966 JP Z,$8857 Jump if so.
8969 LD A,(IX+$10) Decrement the current distance.
896C DEC A
896D JP NZ,$8762 Jump if it is not zero.
The nasty needs to be redrawn.
8970 LD A,(IX+$0E) Get the width or height.
8973 LD (IX+$10),A Set this to the current distance travelled.
8976 LD (IX+$00),$03 Make the nasty invisible in its current position.
897A LD A,(IX+$0A) Get the index.
897D ADD A,A Convert this to an offset to the nasty table.
897E ADD A,A
897F LD B,A
8980 ADD A,A
8981 ADD A,A
8982 ADD A,B
8983 LD E,A
8984 LD D,$00
8986 LD HL,$C596
8989 ADD HL,DE
898A LD A,$02 Set that this is a unidirectional nasty (should already be set).
898C LD (HL),A
898D LD B,(IX+$0E) Multiply the distance covered by the speed to denote the offset to move back to the initial position and store it in B.
8990 DEC B
8991 LD C,(IX+$11)
8994 XOR A
8995 ADD A,C
8996 DJNZ $8995
8998 LD B,A
8999 LD A,(IX+$0B) Get the current direction.
899C OR A Is the nasty moving up?
899D JR NZ,$89A9 Jump forward if not.
899F LD A,(IX+$0D) Move the Y co-ordinate down by the appropriate distance and move forward.
89A2 SUB B
89A3 LD (IX+$0D),A
89A6 JP $8857
89A9 CP $01 Is the nasty moving up?
89AB JR NZ,$89B7 Jump forward if not.
89AD LD A,(IX+$0D) Move the Y co-ordinate up by the appropriate distance and move forward.
89B0 ADD A,B
89B1 LD (IX+$0D),A
89B4 JP $8857
89B7 CP $02 Is the nasty moving left?
89B9 JR NZ,$89C5 Jump forward if not.
89BB LD A,(IX+$0C) Move the X co-ordinate right by the appropriate distance and move forward.
89BE ADD A,B
89BF LD (IX+$0C),A
89C2 JP $8857
89C5 CP $03 Is the nasty moving right?
89C7 JP NZ,$8857 Jump forward if not.
89CA LD A,(IX+$0C) Move the X co-ordinate left by the appropriate distance and move forward.
89CD SUB B
89CE LD (IX+$0C),A
89D1 JP $8857
Prev: 8963 Up: Map Next: 89D4