Prev: D815 Up: Map Next: D951
D895: React to what Dan is standing on
Used by the routine at CFD9.
D895 LD A,($C87B) Get the lift flags. (C87B)
D898 BIT 2,A Is Dan standing on the lift?
D89A JP NZ,$D92C Jump forward if so.
D89D LD DE,($C872) Get Dan's co-ordinate (C872, C873)
D8A1 LD A,$1A Add 1A to the Y co-ordinate and store it in E. This will make DE hold a valid screen address.
D8A3 ADD A,E
D8A4 LD E,A
D8A5 CALL $E909 Convert this into an attribute address.
D8A8 LD A,($C875) Get Dan's current animation frame.
D8AB CP $04 Jump forward if is it 4 or less than 2.
D8AD JR Z,$D8B4
D8AF CP $03
D8B1 JR C,$D8B4
D8B3 INC E Otherwise move to the next column.
D8B4 LD A,(DE) Put the attribute found here in B.
D8B5 LD B,A
D8B6 INC E Move to the next column.
D8B7 LD A,(DE) Put the attribute found here in C.
D8B8 LD C,A
See if there is a floor here.
D8B9 LD HL,$CFCC Point HL to the list of global floor attributes.
D8BC LD D,$07 7 entries to check.
D8BE LD E,(HL) Get the attribute.
D8BF CALL $D9AA Does either attribute Dan's standing by match?
D8C2 JR Z,$D917 Jump forward if it does.
D8C4 INC HL Move to the next entry.
D8C5 DEC D Loop while there are more entries to check.
D8C6 JR NZ,$D8BE
Check for Dan passing over special items.
D8C8 LD A,($CFC9) Put the food attribute for this room in E.
D8CB LD E,A
D8CC CALL $D9AA Is Dan near enough the food?
D8CF JP Z,$DBB8 Jump forward if so.
D8D2 LD E,$38 Is Dan standing by an oxygen tank?
D8D4 CALL $D9AA
D8D7 JP Z,$DE0B Jump forward if so.
D8DA LD E,$68 Is Dan standing by a bank card?
D8DC CALL $D9AA
D8DF JP Z,$DE1B Jump forward if so.
D8E2 LD E,$60 Is Dan standing by an aerosol?
D8E4 CALL $D9AA
D8E7 JP Z,$DE28 Jump if so.
D8EA LD E,$02 Is Dan standing on something red on black?
D8EC CALL $D9AA
D8EF JR NZ,$D8FE Jump if not.
Dan's standing on a red on black object. On the bottom 8 screens, this is the raft - elsewhere it's a trampoline.
D8F1 LD A,($CFCA) Get the current room. (CFCA)
D8F4 CP $08 Is it less than 8?
D8F6 JP NC,$D2F0 Jump forward if it isn't - it's a trampoline.
Dan's standing on the raft.
D8F9 LD A,$0D Set the height above the water to 0D.
D8FB JP $D919 Jump forward.
D8FE LD E,$4F Has Dan hit the river?
D900 CALL $D9AA
D903 JR Z,$D938 Jump forward if so.
D905 LD A,($C874) Put some flags (C874) in B.
D908 LD B,A
D909 AND $51 Reset all flags except bits 0 (jumping), 4 (rising off a trampoline) and 6 (mid-air).
D90B JR NZ,$D912 Jump forward if no flags remain.
D90D LD A,$18 Set the note to play while in mid-air (CFCB) to 18.
D90F LD ($CFCB),A
D912 LD A,B Get a copy of the flags from earlier.
D913 SET 6,A Set bit 6 (in mid-air and falling).
D915 JR $D94D Move forward to write the flags to memory.
D917 LD A,$0E Set the height above the water to 0D.
D919 LD ($DBED),A
D91C LD A,($C872) Get the lowest 3 bits of the Y co-ordinate.
D91F AND $07
D921 CP $06 Are only bits 2 and 3 set?
D923 JR NZ,$D950 Jump forward if not the case.
D925 LD A,($C874) Get some flags. (C874)
D928 AND $11 Reset all flags except bits 0 (jumping) and 4 (rising off trampoline)
D92A JR NZ,$D944 Jump forward if flags remain.
Check Dan hasn't fallen too far.
D92C LD A,($C876) Get the height fallen by. (C876)
D92F CP $1C It is less than 1C?
D931 JR C,$D944 Jump forward if so.
D933 CALL $CD8A Otherwise, Dan has fallen too far, so lose a life.
D936 JR $D944 Jump forward to set the flags.
Dan has fallen in the river. Oh dear.
D938 LD A,$0D Set the height above the river to 0D.
D93A LD ($DBED),A
D93D LD A,($C874) Get some flags. (C874)
D940 SET 7,A Set bit 7 (drowning)
D942 JR $D94D Jump forward to write the flags to memory.
Dan has landed safely, so reset the height fallen.
D944 XOR A Set the height to 0.
D945 LD ($C876),A
D948 LD A,($C874) Get some flags. (C874)
D94B AND $22 Reset everything except bit 1 (facing right) and 5 (safe).
D94D LD ($C874),A Write the flags back to memory.
This entry point is used by the routine at D2F0.
D950 RET
Prev: D815 Up: Map Next: D951