![]() |
Routines |
| Prev: B6ED | Up: Map | Next: B791 |
|
Used by the routine at ADJ_FOR_OUT_OF_BOUNDS.
Tries the object's box against all 54 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 that can be pushed (bit 2 of its +$07) is given the mover's whole intended dU, so it moves off on its own update.
|
||||||||||||||||||
| ADJ_DU_FOR_OBJ_INTERSECT | B742 | LD IY,OBJECTS | IY = the first record; 54 of them | |||||||||||||||
| B746 | LD B,$36 | |||||||||||||||||
| ADJ_DU_FOR_OBJ_INTERSECT_0 | B748 | CALL IS_OBJECT_NOT_IGNORED | empty, or marked to be ignored | |||||||||||||||
| B74B | JR Z,DU_OBJ_NEXT | |||||||||||||||||
| B74D | CALL DO_OBJS_INTERSECT_ON_V | not overlapping in V, or not in Z | ||||||||||||||||
| B750 | JR NC,DU_OBJ_NEXT | |||||||||||||||||
| B752 | CALL DO_OBJS_INTERSECT_ON_Z | |||||||||||||||||
| B755 | JR NC,DU_OBJ_NEXT | |||||||||||||||||
| DU_OBJ_HIT_TEST | B757 | CALL DO_OBJS_INTERSECT_ON_U | no overlap in U after the move: the next object | |||||||||||||||
| B75A | JR NC,DU_OBJ_NEXT | |||||||||||||||||
| B75C | SET 0,(IX+$0C) | stopped in U | ||||||||||||||||
| B760 | LD A,(IX+$0D) | the mover's bit 7 becomes the obstacle's bit 6 | ||||||||||||||||
| B763 | RRCA | |||||||||||||||||
| B764 | AND $40 | |||||||||||||||||
| B766 | OR (IY+$0D) | |||||||||||||||||
| B769 | LD (IY+$0D),A | |||||||||||||||||
| B76C | RLCA | the obstacle's bit 5 becomes the mover's bit 6 | ||||||||||||||||
| B76D | AND $40 | |||||||||||||||||
| B76F | OR (IX+$0D) | |||||||||||||||||
| B772 | LD (IX+$0D),A | |||||||||||||||||
| B775 | BIT 2,(IY+$07) | a pushable obstacle takes on our dU | ||||||||||||||||
| B779 | JR Z,ADJ_DU_FOR_OBJ_INTERSECT_1 | |||||||||||||||||
| B77B | LD A,(IX+$09) | |||||||||||||||||
| B77E | LD (IY+$09),A | |||||||||||||||||
| ADJ_DU_FOR_OBJ_INTERSECT_1 | B781 | LD A,C | a unit shorter; none left, done; else the same object again | |||||||||||||||
| B782 | CALL SHORTEN_DELTA | |||||||||||||||||
| B785 | LD C,A | |||||||||||||||||
| B786 | RET Z | |||||||||||||||||
| B787 | JR DU_OBJ_HIT_TEST | |||||||||||||||||
| DU_OBJ_NEXT | B789 | LD DE,$0020 | the next of 54 | |||||||||||||||
| B78C | ADD IY,DE | |||||||||||||||||
| B78E | DJNZ ADJ_DU_FOR_OBJ_INTERSECT_0 | |||||||||||||||||
| B790 | RET | |||||||||||||||||
| Prev: B6ED | Up: Map | Next: B791 |