![]() |
Routines |
| Prev: DE6A | Up: Map | Next: DED3 |
|
The record's front edge is at V plus its half-size in V (+9), from U less its half-size in U (+8) to U plus it. The cell under each front corner is tested (CUT_STEP_PLUS_V: the record, moved by its step, against the boxes of that cell's type); the second only if it is a different cell from the first. Then, if the step carries the front edge into the next row of cells, the cells it goes into are tested too. The first test to find a box in the way trims the V step to touch it, sets the wall flag, and returns with carry set.
Only the cells under the front edge are chosen; which boxes are hit is decided by the whole record against the whole box, so a box reaching into the cell from its side still counts. CLIP_PLUS_U and CLIP_MINUS_V are the same for +U and -V, and CLIP_MINUS_U for -U.
|
||||||||||||
| CLIP_PLUS_V | DE72 | LD L,(IX+$01) | DE: U less the half-size, the left of the front edge | |||||||||
| DE75 | LD H,(IX+$02) | |||||||||||
| DE78 | LD C,(IX+$08) | |||||||||||
| DE7B | LD B,$00 | |||||||||||
| DE7D | AND A | |||||||||||
| DE7E | SBC HL,BC | |||||||||||
| DE80 | EX DE,HL | |||||||||||
| DE81 | LD L,(IX+$03) | HL: V plus the half-size, the front edge | ||||||||||
| DE84 | LD H,(IX+$04) | |||||||||||
| DE87 | LD C,(IX+$09) | |||||||||||
| DE8A | ADD HL,BC | |||||||||||
| DE8B | PUSH DE | Test the cell under the front left corner; done if a wall | ||||||||||
| DE8C | PUSH HL | |||||||||||
| DE8D | CALL CUT_STEP_PLUS_V | |||||||||||
| DE90 | POP DE | |||||||||||
| DE91 | POP HL | |||||||||||
| DE92 | RET C | |||||||||||
| DE93 | PUSH HL | The right corner, U plus the half-size: in the same cell? | ||||||||||
| DE94 | PUSH DE | |||||||||||
| DE95 | LD C,(IX+$08) | |||||||||||
| DE98 | SLA C | |||||||||||
| DE9A | LD B,$00 | |||||||||||
| DE9C | LD A,H | |||||||||||
| DE9D | ADD HL,BC | |||||||||||
| DE9E | CP H | |||||||||||
| DE9F | JR Z,CLIP_PLUS_V_0 | |||||||||||
| DEA1 | EX DE,HL | No: test its cell too | ||||||||||
| DEA2 | CALL CUT_STEP_PLUS_V | |||||||||||
| DEA5 | POP HL | |||||||||||
| DEA6 | POP DE | |||||||||||
| DEA7 | RET C | |||||||||||
| DEA8 | LD C,(IX+$0B) | Does the step take the front edge into the next row of cells? Done if not | ||||||||||
| DEAB | LD B,$00 | |||||||||||
| DEAD | LD A,H | |||||||||||
| DEAE | ADD HL,BC | |||||||||||
| DEAF | CP H | |||||||||||
| DEB0 | RET Z | |||||||||||
| DEB1 | PUSH DE | Yes: test the cell the left corner goes into... | ||||||||||
| DEB2 | PUSH HL | |||||||||||
| DEB3 | CALL CUT_STEP_PLUS_V | |||||||||||
| DEB6 | POP DE | |||||||||||
| DEB7 | POP HL | |||||||||||
| DEB8 | RET C | |||||||||||
| DEB9 | LD C,(IX+$08) | ...and the one the right corner goes into | ||||||||||
| DEBC | SLA C | |||||||||||
| DEBE | LD B,$00 | |||||||||||
| DEC0 | ADD HL,BC | |||||||||||
| DEC1 | EX DE,HL | |||||||||||
| DEC2 | JP CUT_STEP_PLUS_V | |||||||||||
| CLIP_PLUS_V_0 | DEC5 | POP HL | Both corners in one cell: test only the cell the step goes into, if another | |||||||||
| DEC6 | POP DE | |||||||||||
| DEC7 | LD C,(IX+$0B) | |||||||||||
| DECA | LD B,$00 | |||||||||||
| DECC | LD A,H | |||||||||||
| DECD | ADD HL,BC | |||||||||||
| DECE | CP H | |||||||||||
| DECF | RET Z | |||||||||||
| DED0 | JP CUT_STEP_PLUS_V | |||||||||||
| Prev: DE6A | Up: Map | Next: DED3 |