| ← C9A2 | Map | CA54 → |
CA08: Classify one tile-map cell and update the step-collision flags
|
Reads the cell at the probe-tile pointer plus the given offset and updates the flags for the step collision test. A passable cell leaves the flags untouched. A wall or border sets both the step-blocked flag and the wall flag. A brick sets the step-blocked flag and records the brick hit-type. It then registers the hit through the brick-hit routine.
|
|||||||||
|
|||||||||
| sample_step_tile | CA08 | PUSH HL | Offset the probe pointer, save the result as the sampled-tile pointer, and read the tile there. | ||||||
| CA09 | LD HL,(probe_tile_ptr) | ||||||||
| CA0C | LD E,A | ||||||||
| CA0D | LD D,$00 | ||||||||
| CA0F | ADD HL,DE | ||||||||
| CA10 | LD (sample_tile_ptr),HL | ||||||||
| CA13 | LD A,(HL) | ||||||||
| CA14 | POP HL | ||||||||
| CA15 | CP $20 | Empty space: passable, nothing to flag. | |||||||
| CA17 | RET Z | ||||||||
| CA18 | CP $45 | Below the passable tiles: a wall or border tile | |||||||
| CA1A | JR NC,sample_tile_brick | ||||||||
| CA1C | LD A,$01 | A wall or border: set both result flags. | |||||||
| CA1E | LD (step_blocked),A | ||||||||
| CA21 | LD (step_hit_wall),A | ||||||||
| CA24 | RET | ||||||||
| sample_tile_brick | CA25 | CP $59 | Not a brick: passable, nothing to flag | ||||||
| CA27 | RET C | ||||||||
| CA28 | CP $E4 | ||||||||
| CA2A | RET NC | ||||||||
| CA2B | LD A,$01 | A brick: mark it blocked and record the hit type. | |||||||
| CA2D | LD (step_blocked),A | ||||||||
| CA30 | LD (hit_params),A | ||||||||
| CA33 | LD A,(IY+$08) | The starburst gets its own hit type, which clears any brick, the golden one included. Every other inhabitant keeps the default hit type, which spares golden. | |||||||
| CA36 | CP $0F | ||||||||
| CA38 | JR NZ,sample_brick_hit | ||||||||
| CA3A | LD A,$02 | ||||||||
| CA3C | LD (hit_params),A | ||||||||
| sample_brick_hit | CA3F | PUSH HL | Register the hit on the struck brick, and keep all registers. | ||||||
| CA40 | PUSH BC | ||||||||
| CA41 | PUSH DE | ||||||||
| CA42 | PUSH IX | ||||||||
| CA44 | PUSH IY | ||||||||
| CA46 | LD HL,(sample_tile_ptr) | ||||||||
| CA49 | CALL hit_brick | ||||||||
| CA4C | POP IY | ||||||||
| CA4E | POP IX | ||||||||
| CA50 | POP DE | ||||||||
| CA51 | POP BC | ||||||||
| CA52 | POP HL | ||||||||
| CA53 | RET | ||||||||
| ← C9A2 | Map | CA54 → |
