![]() |
Routines |
| Prev: FA79 | Up: Map | Next: FC07 |
|
Used by the routine at OBJECTS_MEET.
The last case of OBJECTS_MEET: a behaviour-9 guard that runs into a decoy (kind 8) takes it. The decoy vanishes, its entry goes to room $FE, and THINGS_NOTED is cleared, so that CHE3D finds any other decoy afresh and until then the guard chases the knight (ZOOMIN). Anything else, and a move into a door (BUMPED), comes to BLOCKED_MOVE.
BLOCKED_MOVE works out how much of the move the other object stops, trying the move against that one object only (TEST_OTHER) from where the mover was. Each axis that is moving is tried alone: x (+6), y (+7, the height) and z (+8). One that collides is taken out of the move, and the mover's direction on it is turned round if the mover bounces (bit 0 of its direction, +13) or cleared if it does not. Two collisions do something else. Running along x into a kind-3 object, or along z into a kind-2 one, marks a climb (bit 6 of STEP_AXES): those are the invisible steps of a staircase, and ANIMATE_AND_MOVE lifts the mover for three passes. Coming down onto the other marks a landing (bit 5); and if what the mover lands on is moving -- by its own behaviour, or coasting (bit 7 of +14) -- the mover rides it: bit 4 of the mover's +14 is set and the other's direction (+13, or +18 if coasting) goes to RIDE_DIRECTION, which ANIMATE_AND_MOVE gives the mover. Nothing rides a door.
Then the pairs, from where the mover was: x with y colliding takes y out; x with z takes both out; y with z takes y out. If all three axes are still in the move after that, only the whole move collides, and none of it is made.
Last, a push. Unless the mover landed on the other or it is a door, and unless the other is still (nothing in the low five bits of +16, which for a thing that moves are 16 more than its weight), the other is pushed if it is no more than 5 heavier than the mover: it coasts (bit 7 of +14) for the mover's +16 less its own, plus 6, passes (+15), heading (+18) the way the mover asked to go (ASKED_DIRECTION), keeping its own bounce and rise bits. The knight's +16 is 18, so he pushes anything of 23 or less. What is left of the move is then tried again (ANIMATE_AND_MOVE), and may run into something else.
|
||||||||||
| MEET_DECOY | FA83 | CP $08 | A decoy, and the mover a behaviour-9 guard? | |||||||
| FA85 | JR NZ,BLOCKED_MOVE | |||||||||
| FA87 | LD A,(WORK_BEHAVIOUR) | |||||||||
| FA8A | AND $0F | |||||||||
| FA8C | CP $09 | |||||||||
| FA8E | JR NZ,BLOCKED_MOVE | |||||||||
| FA90 | LD C,$FE | The decoy leaves the game (room $FE); look for decoys again | ||||||||
| FA92 | CALL SET_THING_ROOM | |||||||||
| FA95 | LD (IY+THINGS_NOTED-V),$00 | |||||||||
| FA99 | JP OTHER_VANISHES | It vanishes (OBJECTS_MEET) | ||||||||
|
This entry point is used by the routines at BUMPED and OBJECTS_MEET.
|
||||||||||
| BLOCKED_MOVE | FA9C | CALL WORKING_POSITION | BLOCKED_MOVE: B, D, H = the mover's x, y and z before the move; C, E, L its lengths | |||||||
| FA9F | CALL WORKING_SIZES | |||||||||
| FAA2 | LD C,(IY+STEP_AXES-V) | C = the axes moving (STEP_AXES) | ||||||||
| FAA5 | CALL STEP_ALONG_X | x alone | ||||||||
| FAA8 | CALL TEST_OTHER | |||||||||
| FAAB | JR NC,MEET_DECOY_3 | |||||||||
| FAAD | RES 0,C | Blocked: x out of the move | ||||||||
| FAAF | LD A,(IX+OBJ_KIND) | Along x into a kind-3 step: a climb | ||||||||
| FAB2 | AND $0F | |||||||||
| FAB4 | CP $03 | |||||||||
| FAB6 | JR NZ,MEET_DECOY_0 | |||||||||
| FAB8 | SET 6,C | |||||||||
| FABA | JR MEET_DECOY_3 | |||||||||
| MEET_DECOY_0 | FABC | LD A,(WORK_DIRECTION) | Otherwise turn round on x if the mover bounces, or stop on x | |||||||
| FABF | BIT 0,A | |||||||||
| FAC1 | JR NZ,MEET_DECOY_1 | |||||||||
| FAC3 | AND $F3 | |||||||||
| FAC5 | JR MEET_DECOY_2 | |||||||||
| MEET_DECOY_1 | FAC7 | XOR $0C | ||||||||
| MEET_DECOY_2 | FAC9 | LD (WORK_DIRECTION),A | ||||||||
| MEET_DECOY_3 | FACC | LD B,(IY+LINE_PAGE-V) | y alone, x back where it was | |||||||
| FACF | CALL STEP_ALONG_Y | |||||||||
| FAD2 | CALL TEST_OTHER | |||||||||
| FAD5 | JR NC,MEET_DECOY_8 | |||||||||
| FAD7 | RES 1,C | Blocked: y out | ||||||||
| FAD9 | BIT 7,C | Nothing rides a door | ||||||||
| FADB | JR NZ,MEET_DECOY_5 | |||||||||
| FADD | LD D,(IX+OBJ_STATE) | Coming down onto it (bit 5 of the direction)? | ||||||||
| FAE0 | BIT 5,(IY+WORK_DIRECTION-V) | |||||||||
| FAE4 | JR Z,MEET_DECOY_5 | |||||||||
| FAE6 | SET 5,C | A landing | ||||||||
| FAE8 | LD A,D | What it lands on has a behaviour: ride with its direction (+13) | ||||||||
| FAE9 | AND $1F | |||||||||
| FAEB | LD A,(IX+OBJ_DIRECTION) | |||||||||
| FAEE | JR NZ,MEET_DECOY_4 | |||||||||
| FAF0 | BIT 7,D | Or is coasting: ride with its heading (+18) | ||||||||
| FAF2 | JR Z,MEET_DECOY_5 | |||||||||
| FAF4 | LD A,(IX+OBJ_COURSE) | |||||||||
| MEET_DECOY_4 | FAF7 | SET 4,(IY+WORK_BEHAVIOUR-V) | Riding: bit 4 of the mover's +14, and the way to go | |||||||
| FAFB | LD (RIDE_DIRECTION),A | |||||||||
| MEET_DECOY_5 | FAFE | LD A,(WORK_DIRECTION) | Turn round on y if the mover bounces, or stop on y | |||||||
| FB01 | BIT 0,A | |||||||||
| FB03 | JR NZ,MEET_DECOY_6 | |||||||||
| FB05 | AND $CF | |||||||||
| FB07 | JR MEET_DECOY_7 | |||||||||
| MEET_DECOY_6 | FB09 | XOR $30 | ||||||||
| MEET_DECOY_7 | FB0B | LD (WORK_DIRECTION),A | ||||||||
| MEET_DECOY_8 | FB0E | LD D,(IY+MODE-V) | z alone, y back where it was | |||||||
| FB11 | CALL STEP_ALONG_Z | |||||||||
| FB14 | CALL TEST_OTHER | |||||||||
| FB17 | JR NC,MEET_DECOY_12 | |||||||||
| FB19 | RES 2,C | Blocked: z out | ||||||||
| FB1B | LD A,(IX+OBJ_KIND) | Along z into a kind-2 step: a climb | ||||||||
| FB1E | AND $0F | |||||||||
| FB20 | CP $02 | |||||||||
| FB22 | JR NZ,MEET_DECOY_9 | |||||||||
| FB24 | SET 6,C | |||||||||
| FB26 | JR MEET_DECOY_12 | |||||||||
| MEET_DECOY_9 | FB28 | LD A,(WORK_DIRECTION) | Otherwise turn round on z, or stop on z | |||||||
| FB2B | BIT 0,A | |||||||||
| FB2D | JR NZ,MEET_DECOY_10 | |||||||||
| FB2F | AND $3F | |||||||||
| FB31 | JR MEET_DECOY_11 | |||||||||
| MEET_DECOY_10 | FB33 | XOR $C0 | ||||||||
| MEET_DECOY_11 | FB35 | LD (WORK_DIRECTION),A | ||||||||
| MEET_DECOY_12 | FB38 | LD H,(IY+REPEATS-V) | Back to where the mover was | |||||||
| FB3B | CALL WORKING_POSITION | |||||||||
| FB3E | LD A,C | x and y together | ||||||||
| FB3F | AND $03 | |||||||||
| FB41 | CP $03 | |||||||||
| FB43 | JR NZ,MEET_DECOY_16 | |||||||||
| FB45 | CALL STEP_ALONG_X | |||||||||
| FB48 | CALL STEP_ALONG_Y | |||||||||
| FB4B | CALL TEST_OTHER | |||||||||
| FB4E | JR NC,MEET_DECOY_15 | |||||||||
| FB50 | RES 1,C | Blocked: y out, turned round or stopped | ||||||||
| FB52 | LD A,(WORK_DIRECTION) | |||||||||
| FB55 | BIT 0,A | |||||||||
| FB57 | JR NZ,MEET_DECOY_13 | |||||||||
| FB59 | AND $CF | |||||||||
| FB5B | JR MEET_DECOY_14 | |||||||||
| MEET_DECOY_13 | FB5D | XOR $30 | ||||||||
| MEET_DECOY_14 | FB5F | LD (WORK_DIRECTION),A | ||||||||
| MEET_DECOY_15 | FB62 | CALL WORKING_POSITION | Back again | |||||||
| MEET_DECOY_16 | FB65 | LD A,C | x and z together | |||||||
| FB66 | AND $05 | |||||||||
| FB68 | CP $05 | |||||||||
| FB6A | JR NZ,MEET_DECOY_20 | |||||||||
| FB6C | CALL STEP_ALONG_X | |||||||||
| FB6F | CALL STEP_ALONG_Z | |||||||||
| FB72 | CALL TEST_OTHER | |||||||||
| FB75 | JR NC,MEET_DECOY_19 | |||||||||
| FB77 | RES 0,C | Blocked: both out, both turned round or stopped | ||||||||
| FB79 | RES 2,C | |||||||||
| FB7B | LD A,(WORK_DIRECTION) | |||||||||
| FB7E | BIT 0,A | |||||||||
| FB80 | JR NZ,MEET_DECOY_17 | |||||||||
| FB82 | AND $33 | |||||||||
| FB84 | JR MEET_DECOY_18 | |||||||||
| MEET_DECOY_17 | FB86 | XOR $CC | ||||||||
| MEET_DECOY_18 | FB88 | LD (WORK_DIRECTION),A | ||||||||
| MEET_DECOY_19 | FB8B | CALL WORKING_POSITION | Back again | |||||||
| MEET_DECOY_20 | FB8E | LD A,C | y and z together | |||||||
| FB8F | AND $06 | |||||||||
| FB91 | CP $06 | |||||||||
| FB93 | JR NZ,MEET_DECOY_24 | |||||||||
| FB95 | CALL STEP_ALONG_Y | |||||||||
| FB98 | CALL STEP_ALONG_Z | |||||||||
| FB9B | CALL TEST_OTHER | |||||||||
| FB9E | JR NC,MEET_DECOY_23 | |||||||||
| FBA0 | RES 1,C | Blocked: y out | ||||||||
| FBA2 | LD A,(WORK_DIRECTION) | |||||||||
| FBA5 | BIT 0,A | |||||||||
| FBA7 | JR NZ,MEET_DECOY_21 | |||||||||
| FBA9 | AND $CF | |||||||||
| FBAB | JR MEET_DECOY_22 | |||||||||
| MEET_DECOY_21 | FBAD | XOR $30 | ||||||||
| MEET_DECOY_22 | FBAF | LD (WORK_DIRECTION),A | ||||||||
| MEET_DECOY_23 | FBB2 | CALL WORKING_POSITION | Back again | |||||||
| MEET_DECOY_24 | FBB5 | LD A,C | All three still moving? Then only the whole move collides... | |||||||
| FBB6 | AND $07 | |||||||||
| FBB8 | CP $07 | |||||||||
| FBBA | JR NZ,MEET_DECOY_27 | |||||||||
| FBBC | LD A,C | ...so none of it is made | ||||||||
| FBBD | AND $F8 | |||||||||
| FBBF | LD C,A | |||||||||
| FBC0 | LD A,(WORK_DIRECTION) | |||||||||
| FBC3 | BIT 0,A | |||||||||
| FBC5 | JR NZ,MEET_DECOY_25 | |||||||||
| FBC7 | AND $03 | |||||||||
| FBC9 | JR MEET_DECOY_26 | |||||||||
| MEET_DECOY_25 | FBCB | XOR $FC | ||||||||
| MEET_DECOY_26 | FBCD | LD (WORK_DIRECTION),A | ||||||||
| MEET_DECOY_27 | FBD0 | LD A,C | What is left of the move, the landing and door bits dropped | |||||||
| FBD1 | AND $5F | |||||||||
| FBD3 | LD (STEP_AXES),A | |||||||||
| FBD6 | LD A,C | No push after a landing or into a door | ||||||||
| FBD7 | AND $A0 | |||||||||
| FBD9 | JR NZ,MEET_DECOY_28 | |||||||||
| FBDB | LD A,(IX+OBJ_WEIGHT) | Nor of a still thing | ||||||||
| FBDE | AND $1F | |||||||||
| FBE0 | JR Z,MEET_DECOY_28 | |||||||||
| FBE2 | LD B,A | Pushed if no more than 5 heavier than the mover | ||||||||
| FBE3 | LD A,(WORK_WEIGHT) | |||||||||
| FBE6 | AND $1F | |||||||||
| FBE8 | ADD A,$05 | |||||||||
| FBEA | SUB B | |||||||||
| FBEB | JR C,MEET_DECOY_28 | |||||||||
| FBED | INC A | Coasting for the difference plus 6 passes | ||||||||
| FBEE | LD (IX+OBJ_COUNT),A | |||||||||
| FBF1 | SET 7,(IX+OBJ_STATE) | |||||||||
| FBF5 | LD A,(ASKED_DIRECTION) | heading the way the mover asked to go, with its own bounce and rise bits | ||||||||
| FBF8 | AND $FC | |||||||||
| FBFA | LD B,A | |||||||||
| FBFB | LD A,(IX+OBJ_DIRECTION) | |||||||||
| FBFE | AND $03 | |||||||||
| FC00 | OR B | |||||||||
| FC01 | LD (IX+OBJ_COURSE),A | |||||||||
| MEET_DECOY_28 | FC04 | JP TRY_STEP | Try what is left of the move again | |||||||
| Prev: FA79 | Up: Map | Next: FC07 |