Prev: 47072 Up: Map Next: 47248
47206: Push Object On Block
Used by the routine at BlockMovementInZ.
Pushes an object that stands on a moving block. The type of the block gives the direction of the push, in the low two bits, and the object is pushed on every other frame. The pushes are in a table of pairs of speeds at ConveyorPushes.
A block is not pushed if it already has something on it, so the first thing on it does the pushing.
Input
A Type of the block
IX Object record
IY Block record
Return if the block already has something on it.
PushObjectOnBlock 47206 BIT 3,(IY+13) Return if the block already has something on it.
47210 RET NZ
Find the push for this direction.
47211 AND %00000011 Keep the two bits that give the direction.
47213 ADD A,A Double it, to get an offset into the table of pairs.
47214 PUSH DE Stash DE and HL on the stack.
47215 PUSH HL
47216 LD D,0 Set DE to the offset.
47218 LD E,A
Push on every other frame.
47219 LD A,(42773) Fetch the frame counter.
47222 AND %00000001 Keep only bit 0.
47224 JR Z,PushObjectOnBlock_Done Jump to PushObjectOnBlock_Done if it is an even frame.
47226 LD HL,54026 Use the table of pushes, ConveyorPushes.
47229 ADD HL,DE Add the offset.
47230 LD A,(HL) Fetch the push along x.
47231 ADD A,(IX+9) Add it to the speed of the object along x.
47234 LD (IX+9),A Write it back.
47237 INC HL Move on to the push along y.
47238 LD A,(HL) Fetch it.
47239 ADD A,(IX+10) Add it to the speed of the object along y.
47242 LD (IX+10),A Write it back.
PushObjectOnBlock_Done 47245 POP HL Restore HL and DE from the stack.
47246 POP DE
47247 RET Return.
Prev: 47072 Up: Map Next: 47248