Prev: CFD3 Up: Map Next: D079
CFD9: Update Dan's status and check for movement
Used by the routine at C800.
CFD9 LD A,($C87E) Get some flags. (C87E)
CFDC BIT 7,A Is bit 7 (Dan has the plans) reset?
CFDE RET NZ Return if so - once Dan's in the blimp, no need to move.
CFDF LD A,($C874) Get some more flags. (C874)
CFE2 BIT 7,A Is Dan drowning?
CFE4 JP NZ,$DBEE Jump forward if so.
CFE7 BIT 5,A Is Dan in a safe spot?
CFE9 CALL NZ,$CD9A If not, he must be in trouble, so update a frame of the "lose a life" sequence.
CFEC LD A,($C87F) Get some more flags. (C87F)
CFEF BIT 0,A Is bit 0 (rainbow lifts operating) set?
CFF1 JP NZ,$D08A Jump forward if it is.
CFF4 CALL $DC71 Check if Dan is standing by a lift.
CFF7 CALL $D895 Respond to anything Dan is standing on.
CFFA LD A,($C87A) Get the time for the lift to move. (C87A)
CFFD AND A Is it zero?
CFFE JR NZ,$D008 Jump forward if not.
The lift needs moving.
D000 LD A,($C87B) Get the lift flags. (C87B)
D003 BIT 2,A Is Dan standing on the lift?
D005 JP NZ,$D16F If so, move him on it.
See if Dan has passed over any special objects.
D008 LD A,($C874) Get some more flags. (C874)
D00B BIT 4,A Is bit 4 (Dan on a trampoline) set?
D00D JP NZ,$D0DC Jump forward if it is.
D010 BIT 7,A Is bit 7 (Dan drowning) set?
D012 JP NZ,$DBEE Jump forward if it is.
D015 BIT 0,A Is bit 0 (Dan jumping) set?
D017 JP NZ,$D123 Jump foward if it is.
D01A BIT 6,A Is bit 6 (Dan falling) set?
D01C JR NZ,$D079 Jump foward if it is
D01E CALL $E9BC Get the player input and put it in A.
D021 LD A,C
D022 CP $05 Is there no action?
D024 JR Z,$D076 Jump forward if so.
D026 CP $04 Is Dan jumping straight ahead?
D028 JR Z,$D044 Jump forward if so.
D02A CP $03 Is Dan moving left?
D02C JR Z,$D03E Jump forward if so.
D02E CP $02 Is Dan jumping left?
D030 JR Z,$D05B Jump forward if so.
D032 CP $01 Is Dan moving right?
D034 JR Z,$D038 Jump forward if so.
D036 JR $D04B Otherwise Dan must be jumping right.
Move right
D038 CALL $D4B5 Move Dan right.
D03B JP $D1CE Draw Dan and check for any collision detection.
Move left
D03E CALL $D3EC Move Dan left.
D041 JP $D1CE Draw Dan and check for any collision detection.
Jump
D044 LD HL,$C874 Get some flags (C874)
D047 SET 0,(HL) Set bit 0 (Dan is jumping)
D049 JR $D069 Move forward to do the jump.
Jump right
D04B LD A,($C874) Get some flags (C874)
D04E BIT 1,A Is Dan facing right?
D050 JR Z,$D038 If not, just do a normal jump.
D052 AND $20 Turn off all flags except bit 5 (Dan safe).
D054 ADD A,$0B Set bits 0 (jumping), 1 (facing right) and 4 (trampolining)
D056 LD ($C874),A
D059 JR $D069 Move forward to do the jump.
Jump left
D05B LD A,($C874) Get some flags (C874)
D05E BIT 1,A Is Dan facing right?
D060 JR NZ,$D03E If so, just do a normal jump.
D062 AND $20 Turn off all flags except bit 5 (Dan safe).
D064 ADD A,$09 Set bits 0 (jumping) and 4 (trampolining).
D066 LD ($C874),A
Dan has jumped.
D069 LD A,$0C Set the current note to play while jumping (CFCB) to the default of 0C.
D06B LD ($CFCB),A
D06E LD A,$0E Set Dan to be 0E lines above the river. (DBED).
D070 LD ($DBED),A
D073 JP $D123 Make Dan jump.
No action
D076 JP $D1CE Draw Dan and check for any collision detection.
Prev: CFD3 Up: Map Next: D079