Prev: C152 Up: Map Next: C19C
C164: The update routine for a monster appearing (graphics 128-131)
Four turns of appearing, with a note that rises each turn it is on the screen (APPEAR_SOUND). Then it becomes a monster of the kind of the villain nearest it (NEAREST_VILLAIN): of graphics 112-127 or, as often, of 64-79 -- the random number decides. Graphic 76, the monster of the first villain's kind, is given a half-size of 24 in V.
Input
IX the record
APPEARING_UPDATE C164 BIT 1,(IX+$07) the note, if it was drawn last turn
C168 RES 1,(IX+$07)
C16C CALL NZ,APPEAR_SOUND
C16F INC (IX+$00) the next frame; after the fourth, a monster
C172 LD A,(IX+$00)
C175 AND $03
C177 RET NZ
C178 LD A,(RANDOM) which sort, by the random number
C17B CP $80
C17D JR C,APPEARING_UPDATE_0
C17F CALL NEAREST_VILLAIN one of 64-79, of the nearest villain's kind
C182 ADD A,A
C183 ADD A,A
C184 OR $40
C186 LD (IX+$00),A
C189 CP $4C graphic 76 is 24 deep in V
C18B RET NZ
C18C LD (IX+$09),$18
C190 RET
APPEARING_UPDATE_0 C191 CALL NEAREST_VILLAIN one of 112-127, of the nearest villain's kind
C194 ADD A,A
C195 ADD A,A
C196 OR $70
C198 LD (IX+$00),A
C19B RET
Prev: C152 Up: Map Next: C19C