Prev: DBED Up: Map Next: DC69
DBEE: Dan has fallen in the river
Used by the routine at CFD9.
DBEE LD HL,$DA8A Get the current sound state. (DA8A)
DBF1 RES 1,(HL) Reset bit 1 to mark "losing a life".
DBF3 LD HL,$C874 Get some flags. (C874)
DBF6 RES 5,(HL) Reset bit 5, Dan will at least lose a life.
DBF8 XOR A Set the frames in the "touched moving object" sequence (C880) to 0.
DBF9 LD ($C880),A
DBFC LD HL,$DBED Get Dan's height above the river. (DBED)
DBFF DEC (HL) Decrease it by 1.
DC00 JR NZ,$DC0A Skip the next bit if it is not yet zero.
Play the "drowned" tune.
DC02 LD HL,$EE63 Point HL at the tune.
DC05 CALL $DB0B Play it.
DC08 JR $DC18 Skip the next bit.
Dan has not hit the river bottom yet, so update his position.
DC0A LD A,(HL) Put the height above the river in A.
DC0B CP $0F Is it greater than 0F?
DC0D JR NC,$DC18 Jump forward if it is.
DC0F LD A,($C872) Put Dan's Y co-ordinate (C872) in A.
DC12 CALL $D61E Fall one frame through the air
DC15 JP $D1CE Redraw Dan and check for any collision detection.
DC18 CP $DC Is the height above the river DC?
DC1A JR NZ,$DC45 Jump forward if it isn't.
DC1C LD A,$0E Set Dan's height above the river to 0E.
DC1E LD ($DBED),A
Dan can survive falling in the river if he has an oxygen tank AND if he doesn't have the plans.
DC21 LD HL,$C87E Get some flags. (C87E)
DC24 BIT 6,(HL) Does Dan have an oxygen tank?
DC26 JR Z,$DC41 Jump forward if not.
DC28 BIT 1,(HL) Does Dan have the plans?
DC2A JR NZ,$DC41 Jump forward if so.
Dan has survived the river.
DC2C RES 6,(HL) Remove the oxygen tank as it has been used.
DC2E LD HL,$1016 Reset Dan's position to inside the blimp.
DC31 LD ($C872),HL
DC34 LD HL,$C874 Point HL at some flags. (C874)
DC37 LD A,(HL) Reset all flags except bit 1.
DC38 AND $02
DC3A LD (HL),A
DC3B LD A,$2B Put Dan back in the start room and return.
DC3D CALL $CBBD
DC40 RET
Dan has drowned. Game over.
DC41 POP HL Tidy up the stack.
DC42 JP $CDDA Display the "game over" screen.
Dan is submerged; display the "air bubble" graphic while drowning
DC45 LD A,($DBED) Get Dan's height above the waterline.
DC48 CPL Invert the bits and shift left to give an index between 00 and 07F.
DC49 SRL A
DC4B CP $0C If the index is above 00C, use 00B instead.
DC4D JR C,$DC51
DC4F LD A,$0B
Got a graphic index between 0 and 00B, so display it.
DC51 ADD A,A Multiply by 8 to get a suitable offset.
DC52 ADD A,A
DC53 ADD A,A
DC54 LD C,A Put this in BC.
DC55 LD B,$00
DC57 LD HL,$F485 Add the base address of the "drowning" graphic (F485)
DC5A ADD HL,BC
DC5B LD A,($C873) Get Dan's X co-ordinate.
DC5E INC A Set one more than this as the column.
DC5F LD D,A
DC60 LD E,$12 Row is always 12.
DC62 LD BC,$0101 Size is always 1x1.
DC65 CALL $E87A Put the graphic on screen and return.
DC68 RET
Prev: DBED Up: Map Next: DC69