![]() |
Routines |
| Prev: C152 | Up: Map | Next: C19C |
|
The routine for objects of type 80 to 83, the balls. A ball changes through four frames and then turns into a creature (type 70 to 7F) or, at random, into a type 40 to 4F object. The kind is that of the monster that is nearest to the ball.
|
||||
|
Animate the ball, and play its sound if it is in the view.
|
||||
| UpdateBall | C164 | BIT 1,(IX+$07) | Test whether the ball has been drawn in the view. | |
| C168 | RES 1,(IX+$07) | Clear the flag. | ||
| C16C | CALL NZ,PlayObjectSound | Play the sound of the ball if it was drawn. | ||
| C16F | INC (IX+$00) | Move on to the next frame of animation. | ||
| C172 | LD A,(IX+$00) | Fetch the type of the ball, and return unless the frame number has wrapped round to zero. | ||
| C175 | AND $03 | |||
| C177 | RET NZ | |||
|
Become a type 40 to 4F object, or a creature.
|
||||
| C178 | LD A,($BBAA) | Jump to UpdateBall_Creature if a random number is less than 80. | ||
| C17B | CP $80 | |||
| C17D | JR C,UpdateBall_Creature | |||
| C17F | CALL FindNearestMonster | Find the nearest living monster. | ||
| C182 | ADD A,A | Multiply its number by four to get its kind. | ||
| C183 | ADD A,A | |||
| C184 | OR %01000000 | Make it a type 40 to 4F object. | ||
| C186 | LD (IX+$00),A | Set the new type. | ||
| C189 | CP $4C | Return unless the type is 4C. | ||
| C18B | RET NZ | |||
| C18C | LD (IX+$09),$18 | Set the depth of the object to 18 (type 4C only). | ||
| C190 | RET | Return. | ||
|
Turn the ball into a creature of the nearest monster's kind.
|
||||
| UpdateBall_Creature | C191 | CALL FindNearestMonster | Find the nearest living monster. | |
| C194 | ADD A,A | Multiply its number by four to get its kind. | ||
| C195 | ADD A,A | |||
| C196 | OR %01110000 | Make it a creature (70 to 7F). | ||
| C198 | LD (IX+$00),A | Set the new type. | ||
| C19B | RET | Return. | ||
| Prev: C152 | Up: Map | Next: C19C |