Routines |
Prev: AFA3 | Up: Map | Next: B00B |
AFC4 | LD (IY+$37),$01 | Set that the character is mid-air. | ||
AFC8 | LD A,(IY+$0F) | Get the current room. | ||
AFCB | LD E,A | Put it in DE. | ||
AFCC | LD D,$00 | |||
AFCE | LD HL,$AFA3 | Add the basic address for the room platform IDs. (AFA3) | ||
AFD1 | ADD HL,DE | |||
AFD2 | LD A,(HL) | Get the platform ID. | ||
AFD3 | ADD A,A | Double it to get a word offset. | ||
AFD4 | LD E,A | Put this in E. (D already is 0) | ||
AFD5 | LD HL,$AF8F | Add the basic address for the platform table. | ||
AFD8 | ADD HL,DE | |||
AFD9 | LD E,(HL) | Put the actual address in DE. | ||
AFDA | INC HL | |||
AFDB | LD D,(HL) | |||
AFDC | EX DE,HL | Exhange DE and HL. | ||
AFDD | LD A,(IY+$0A) | Get the current Y co-ordinate. | ||
AFE0 | CP $98 | Is it the floor? | ||
AFE2 | JR Z,$B006 | Jump forward if so, nowhere to fall. | ||
The player is in mid-air. Can they land on a platform?
|
||||
AFE4 | ADD A,$20 | Drop down a row. | ||
AFE6 | LD B,A | Put this in B. | ||
AFE7 | LD A,(HL) | Get the Y co-ordinate. | ||
AFE8 | CP $FF | Is it an end-marker instead. | ||
AFEA | RET Z | Return if it is, nothing to do here. | ||
There are platforms in the room, is the player near any?
|
||||
AFEB | CP B | Does the Y co-ordinate match? | ||
AFEC | JR Z,$AFF3 | Jump forward if it does. | ||
AFEE | INC HL | Move to the next entry and try it. | ||
AFEF | INC HL | |||
AFF0 | INC HL | |||
AFF1 | JR $AFE7 | |||
The player is on the right Y axis for a platform, what about the X axis?
|
||||
AFF3 | INC HL | Move to the leftmost co-ordinate. | ||
AFF4 | LD A,(IY+$05) | Get the X co-ordinate. | ||
AFF7 | ADD A,$08 | Reduce it to an offset between 00 and 1F. | ||
AFF9 | SRL A | |||
AFFB | SRL A | |||
AFFD | SRL A | |||
AFFF | CP (HL) | Is the current X co-ordinate greater or equal than the one in this table? | ||
B000 | JR C,$AFEF | No, so loop back and try the next one. | ||
B002 | INC HL | Point HL to the rightmost co-ordinate. | ||
B003 | CP (HL) | Is the current X co-ordinate less or equal than the one in this table? | ||
B004 | JR NC,$AFF0 | No, so loop back and try the next one. | ||
At this point, the player has either landed on the ground or a platform.
|
||||
B006 | LD (IY+$37),$00 | Reset the "mid-air" flag and return. | ||
B00A | RET |
Prev: AFA3 | Up: Map | Next: B00B |