![]() |
Routines |
| Prev: C442 | Up: Map | Next: C4E6 |
|
Used by the routine at ADJ_FOR_OUT_OF_BOUNDS.
Tries the object's box against all 56 records. For each one it already overlaps in V and Z, with the moves accepted so far, an overlap in U after the move means dU has to be shortened, a unit at a time, until the boxes no longer meet; if dU reaches zero the scan stops.
Every such meeting sets bit 0 of +$0C and passes harm between the two: bit 6 of +$0D means killed, and the obstacle gets it if the mover has bit 7 (kills what it moves into), the mover if the obstacle has bit 5 (kills what touches it). An obstacle with bit 2 of its flags set, a thing that can be pushed, is given the mover's whole intended dU, which its own update then moves it by.
|
||||||||||||||||||
| ADJ_DU_FOR_OBJ_INTERSECT | C497 | LD IY,OBJECTS | IY = the first record; 56 of them | |||||||||||||||
| C49B | LD B,$38 | |||||||||||||||||
| ADJ_DU_FOR_OBJ_INTERSECT_0 | C49D | CALL IS_OBJECT_NOT_IGNORED | Empty, or out of the collision tests | |||||||||||||||
| C4A0 | JR Z,DU_OBJ_NEXT | |||||||||||||||||
| C4A2 | CALL DO_OBJS_INTERSECT_ON_V | Not overlapping in V, or not in Z | ||||||||||||||||
| C4A5 | JR NC,DU_OBJ_NEXT | |||||||||||||||||
| C4A7 | CALL DO_OBJS_INTERSECT_ON_Z | |||||||||||||||||
| C4AA | JR NC,DU_OBJ_NEXT | |||||||||||||||||
| DU_OBJ_HIT_TEST | C4AC | CALL DO_OBJS_INTERSECT_ON_U | No overlap in U after the move: the next object | |||||||||||||||
| C4AF | JR NC,DU_OBJ_NEXT | |||||||||||||||||
| C4B1 | SET 0,(IX+$0C) | Stopped in U | ||||||||||||||||
| C4B5 | LD A,(IX+$0D) | The mover's bit 7 becomes the obstacle's bit 6 | ||||||||||||||||
| C4B8 | RRCA | |||||||||||||||||
| C4B9 | AND $40 | |||||||||||||||||
| C4BB | OR (IY+$0D) | |||||||||||||||||
| C4BE | LD (IY+$0D),A | |||||||||||||||||
| C4C1 | RLCA | The obstacle's bit 5 becomes the mover's bit 6 | ||||||||||||||||
| C4C2 | AND $40 | |||||||||||||||||
| C4C4 | OR (IX+$0D) | |||||||||||||||||
| C4C7 | LD (IX+$0D),A | |||||||||||||||||
| C4CA | BIT 2,(IY+$07) | A pushable obstacle takes on our dU | ||||||||||||||||
| C4CE | JR Z,ADJ_DU_FOR_OBJ_INTERSECT_1 | |||||||||||||||||
| C4D0 | LD A,(IX+$09) | |||||||||||||||||
| C4D3 | LD (IY+$09),A | |||||||||||||||||
| ADJ_DU_FOR_OBJ_INTERSECT_1 | C4D6 | LD A,C | A unit shorter; none left, done; else the same object again | |||||||||||||||
| C4D7 | CALL SHORTEN_DELTA | |||||||||||||||||
| C4DA | LD C,A | |||||||||||||||||
| C4DB | RET Z | |||||||||||||||||
| C4DC | JR DU_OBJ_HIT_TEST | |||||||||||||||||
| DU_OBJ_NEXT | C4DE | LD DE,$0020 | The next of 56 | |||||||||||||||
| C4E1 | ADD IY,DE | |||||||||||||||||
| C4E3 | DJNZ ADJ_DU_FOR_OBJ_INTERSECT_0 | |||||||||||||||||
| C4E5 | RET | |||||||||||||||||
| Prev: C442 | Up: Map | Next: C4E6 |