![]() |
Routines |
| Prev: FA83 | Up: Map |
|
Used by the routine at FAE3. Returns with the zero flag set if the falling character has struck another character, and knocks that other character over.
|
||||||||||
| FAA2 | LD L,$01 | Point HL at byte 0x01 of the falling character's buffer | ||||||||
| FAA4 | LD E,(HL) | E=falling character's x-coordinate | ||||||||
| FAA5 | DEC E | Decrement this | ||||||||
| FAA6 | INC L | L=0x02 | ||||||||
| FAA7 | LD D,(HL) | D=falling character's y-coordinate | ||||||||
| FAA8 | INC D | Add 3 to this | ||||||||
| FAA9 | INC D | |||||||||
| FAAA | INC D | |||||||||
| FAAB | LD HL,$D702 | H=0xD7 (first potential target character to check), L=0x02 | ||||||||
|
The following loop compares the falling character's coordinates with those of every other character to see if there was a collision.
|
||||||||||
| FAAE | LD A,D | A=3+falling character's y-coordinate | ||||||||
| FAAF | CP (HL) | Does it match the potential target's y-coordinate? | ||||||||
| FAB0 | JR NZ,$FAD0 | Jump if not to check the next potential target | ||||||||
| FAB2 | DEC L | L=0x01 | ||||||||
| FAB3 | LD A,(HL) | A=T (potential target character's x-coordinate) | ||||||||
| FAB4 | SUB E | A=T-x+1 (where x is the falling character's x-coordinate) | ||||||||
| FAB5 | CP $03 | Is this less than 3? | ||||||||
| FAB7 | JR NC,$FACE | Jump if not to check the next potential target | ||||||||
| FAB9 | LD BC,$FA05 | Point BC at the uninterruptible subcommand routine at FA05 | ||||||||
| FABC | RRCA | Does T=x? | ||||||||
| FABD | JR NC,$FAC1 | Jump if not | ||||||||
| FABF | LD C,$09 | BC=FA09 | ||||||||
| FAC1 | DEC L | L=0x00 | ||||||||
| FAC2 | LD A,(HL) | A=target character's animatory state | ||||||||
| FAC3 | AND $07 | Keep only bits 0-2 | ||||||||
| FAC5 | CP $04 | Is the target character in standing/walking animation phase 1-4? | ||||||||
| FAC7 | JR NC,$FACE | Jump if not to check the next potential target | ||||||||
| FAC9 | LD A,H | A=target character's character number | ||||||||
| FACA | CALL $F9ED | Attempt to place the address of the uninterruptible subcommand routine at FA05 (if T=x-1 or x+1) or FA09 (if T=x) into bytes 0x12 and 0x13 of the target character's buffer | ||||||||
| FACD | RET Z | Return with the zero flag set if the attempt was successful (the target character was not already occupied by some other uninterruptible subcommand) | ||||||||
| FACE | LD L,$02 | Point HL at byte 0x02 of the target character's buffer | ||||||||
| FAD0 | INC H | Next potential target character to check | ||||||||
| FAD1 | LD A,H | A=next target character number | ||||||||
| FAD2 | CP $E7 | Have we checked every potential target? | ||||||||
| FAD4 | JR NZ,$FAAE | Jump back if not | ||||||||
| FAD6 | ADD A,A | Reset the zero flag (no one was struck by the falling character) | ||||||||
| FAD7 | RET | |||||||||
| Prev: FA83 | Up: Map |