Prev: CDBB Up: Map Next: CE9A
CE31: The update routine for a thing that bobs up and down
Used by the routine at DEADLY_BOBBER.
Used by graphic 86 through DEADLY_BOBBER, which makes it deadly first; graphic 85 comes here directly, but no room places one. It keeps its state in bit 2 of +D, which the kill bits (5 to 7) leave free: clear while it falls, set while it rises.
Falling, it drops one unit a turn; when it lands on something it starts rising, one unit a turn (the 2 it stores on landing is overwritten with 1 before any move uses it; measured in room 88: one unit a turn from the first), until its height reaches 176, when it falls again. If something above stops it rising, it falls at once. When the player (or the heavy block) is standing on it the rise is three a turn; a jump by him clears that.
Measured in the simulator in room 11 (graphic 86, nothing on it): it rose one unit a turn to 176 and fell back one a turn to where it had landed, over and over.
Input
IX the object record
BOBBER CE31 CALL DRAW_AT_L16_D8 the drawing nudge
CE34 XOR A no sideways step; rising?
CE35 LD (IX+$09),A
CE38 LD (IX+$0A),A
CE3B BIT 2,(IX+$0D)
CE3F JR NZ,BOBBER_1
CE41 LD (IX+$0B),A falling: one unit a turn
CE44 CALL DEC_DZ_AND_UPDATE_UVZ
CE47 BIT 2,(IX+$0C) landed: start rising (the 2 stored here is replaced before it is used)
CE4B JR Z,BOBBER_0
CE4D SET 2,(IX+$0D)
CE51 LD (IX+$0B),$02
BOBBER_0 CE55 XOR A no sideways step; redraw it
CE56 LD (IX+$09),A
CE59 LD (IX+$0A),A
CE5C JP SET_WIPE_AND_DRAW_FLAGS
BOBBER_1 CE5F LD A,(PLAYER_BUMPED) rising: if he has jumped, he is no longer on it
CE62 AND $08
CE64 JR Z,BOBBER_2
CE66 RES 7,(IX+$17)
BOBBER_2 CE6A LD A,(IX+$0B) he is on it, or it is moving: carry on up; stopped: fall
CE6D AND A
CE6E BIT 7,(IX+$17)
CE72 JR NZ,BOBBER_3
CE74 AND A
CE75 JR Z,BOBBER_5
BOBBER_3 CE77 LD A,$01 one unit a turn up, or three with him on it (the sign of what was tested last)
CE79 JP P,BOBBER_4
CE7C ADD A,$02
BOBBER_4 CE7E LD (IX+$0B),A
CE81 CALL CLIP_AND_MOVE move; at 176 or above, fall from now on
CE84 LD A,(IX+$03)
CE87 CP $B0
CE89 JR C,BOBBER_0
CE8B RES 2,(IX+$0D)
CE8F JR BOBBER_0
BOBBER_5 CE91 CALL DEC_DZ_AND_UPDATE_UVZ stopped from above: fall
CE94 RES 2,(IX+$0D)
CE98 JR BOBBER_0
Prev: CDBB Up: Map Next: CE9A