![]() |
Routines |
| Prev: BF48 | Up: Map | Next: BFF1 |
|
Used by the routine at NEW_GAME.
When the low byte of TURNS comes round to zero, the first monster record that is not in the knight's cell or next to it becomes the creature (graphic 136) -- empty or not: a monster further off is simply replaced. It is put in the knight's cell, at a random place 64-191 across it each way, with a half-size of 16 each way; if that place already touches him (TOUCHING_KNIGHT) it is a puff (graphic 12) instead, and harmless. If all six records are within a cell of him, the first becomes the creature wherever it is, with only its graphic changed.
Measured: in a game left to run, a monster record held the creature every time the turn counter's low byte was zero; and with all six records empty and so at cell (0,0), next to a knight in cell (1,1), the first record got graphic 136 and nothing else.
|
||||
| SPAWN_CREATURE | BF95 | LD A,(TURNS) | not the 256th turn: nothing | |
| BF98 | AND A | |||
| BF99 | RET NZ | |||
| BF9A | LD IX,MONSTERS | the first monster record not within a cell of the knight | ||
| BF9E | LD DE,$0010 | |||
| BFA1 | LD B,$06 | |||
| SPAWN_CREATURE_0 | BFA3 | LD C,$02 | ||
| BFA5 | CALL NEAR_KNIGHT | |||
| BFA8 | JR NC,SPAWN_CREATURE_1 | |||
| BFAA | ADD IX,DE | |||
| BFAC | DJNZ SPAWN_CREATURE_0 | |||
| BFAE | LD A,$88 | all six are: the first becomes the creature where it is | ||
| BFB0 | LD (MONSTERS),A | |||
| BFB3 | RET | |||
| SPAWN_CREATURE_1 | BFB4 | LD A,(RANDOM) | in the knight's cell, at a random place in it | |
| BFB7 | AND $7F | |||
| BFB9 | ADD A,$40 | |||
| BFBB | LD (IX+$01),A | |||
| BFBE | LD A,(KNIGHT_COLUMN) | |||
| BFC1 | LD (IX+$02),A | |||
| BFC4 | LD A,($BBAB) | |||
| BFC7 | AND $7F | |||
| BFC9 | ADD A,$40 | |||
| BFCB | LD (IX+$03),A | |||
| BFCE | LD A,(KNIGHT_ROW) | |||
| BFD1 | LD (IX+$04),A | |||
| BFD4 | LD (IX+$08),$10 | half-size 16 each way; the drawing offset | ||
| BFD8 | LD (IX+$09),$10 | |||
| BFDC | LD (IX+$0C),$F4 | |||
| BFE0 | LD (IX+$0D),$04 | |||
| BFE4 | CALL TOUCHING_KNIGHT | touching him already? a puff (12); otherwise the creature (136) | ||
| BFE7 | LD A,$0C | |||
| BFE9 | JR C,SPAWN_CREATURE_2 | |||
| BFEB | ADD A,$7C | |||
| SPAWN_CREATURE_2 | BFED | LD (IX+$00),A | ||
| BFF0 | RET | |||
| Prev: BF48 | Up: Map | Next: BFF1 |