![]() |
Routines |
| Prev: B2CF | Up: Map | Next: B3D4 |
|
Used by the routines at Handle_Flying_Creature, Move_Creature_Horizontally, Handle_Jellyfish and Handle_Gargoyle.
Moves a creature one step closer to Sabreman's room when it is in a different room y (and the same room x). It works like Move_Creature_Horizontally but vertically. It is entered with the carry flag set if Sabreman's room y is less than the room y of the creature.
The creature is removed if the room has a floor and it is above Sabreman's room (or a ceiling and it is below), as it cannot get through. The x position is kept between 18 and E0.
|
||||||||||
| Move_Creature_Vertically | B358 | LD (IX+$0F),$01 | Set the redraw flags to 01 so that the creature is drawn without being erased when it arrives. | |||||||
| B35C | LD (IX+$0B),$00 | Clear the contact flags. | ||||||||
| B360 | JR C,Move_Creature_Vertically_Move_Up | Jump to Move_Creature_Vertically_Move_Up if Sabreman is above the creature. | ||||||||
| B362 | BIT 4,E | Jump to Move_Creature_Horizontally_Remove_Creature if the room has a floor. | ||||||||
| B364 | JR NZ,Move_Creature_Horizontally_Remove_Creature | |||||||||
| B366 | LD A,(IX+$09) | Fetch the y velocity. | ||||||||
| B369 | ADD A,$02 | Accelerate downwards by adding two. | ||||||||
| B36B | BIT 7,A | Jump to Move_Creature_Vertically_Store_Velocity if the y velocity is negative. | ||||||||
| B36D | JR NZ,Move_Creature_Vertically_Store_Velocity | |||||||||
| B36F | CP $31 | Jump to Move_Creature_Vertically_Move_Down if the y velocity has reached 31. | ||||||||
| B371 | JR NC,Move_Creature_Vertically_Move_Down | |||||||||
| Move_Creature_Vertically_Store_Velocity | B373 | LD (IX+$09),A | Store the y velocity. | |||||||
| Move_Creature_Vertically_Move_Down | B376 | LD A,(IX+$09) | Fetch the y velocity. | |||||||
| B379 | SRA A | Divide it by sixteen, keeping the sign. | ||||||||
| B37B | SRA A | |||||||||
| B37D | SRA A | |||||||||
| B37F | SRA A | |||||||||
| B381 | ADD A,(IX+$03) | Add the y position of the creature. | ||||||||
| B384 | CP $9F | Jump to Move_Creature_Vertically_Store_Y if the y position is less than 9F. | ||||||||
| B386 | JR C,Move_Creature_Vertically_Store_Y | |||||||||
| B388 | INC (IX+$04) | Move the creature to the room below. | ||||||||
| B38B | LD A,$2C | Set the y position to 2C. | ||||||||
| Move_Creature_Vertically_Store_Y | B38D | LD (IX+$03),A | Store the y position. | |||||||
|
Keep the x position between 18 and E0.
|
||||||||||
| Move_Creature_Vertically_Adjust_X | B390 | LD A,(IX+$01) | Fetch the x position. | |||||||
| B393 | CP $18 | Jump to Move_Creature_Vertically_Test_Right if the x position is 18 or more. | ||||||||
| B395 | JR NC,Move_Creature_Vertically_Test_Right | |||||||||
| B397 | LD (IX+$01),$18 | Set the x position to 18. | ||||||||
| Move_Creature_Vertically_Test_Right | B39B | CP $E0 | Return if the x position is less than E0. | |||||||
| B39D | RET C | |||||||||
| B39E | LD (IX+$01),$E0 | Set the x position to E0. | ||||||||
| B3A2 | RET | Return. | ||||||||
|
Sabreman is above the creature.
|
||||||||||
| Move_Creature_Vertically_Move_Up | B3A3 | BIT 0,E | Jump to Move_Creature_Horizontally_Remove_Creature if the room has a ceiling. | |||||||
| B3A5 | JP NZ,Move_Creature_Horizontally_Remove_Creature | |||||||||
| B3A8 | LD A,(IX+$09) | Fetch the y velocity. | ||||||||
| B3AB | SUB $02 | Accelerate upwards by subtracting two. | ||||||||
| B3AD | BIT 7,A | Jump to Move_Creature_Vertically_Store_Up_Velocity if the y velocity is positive. | ||||||||
| B3AF | JR Z,Move_Creature_Vertically_Store_Up_Velocity | |||||||||
| B3B1 | CP $D0 | Jump to Move_Creature_Vertically_Add_Up_Velocity if the y velocity is less than D0. | ||||||||
| B3B3 | JR C,Move_Creature_Vertically_Add_Up_Velocity | |||||||||
| Move_Creature_Vertically_Store_Up_Velocity | B3B5 | LD (IX+$09),A | Store the y velocity. | |||||||
| Move_Creature_Vertically_Add_Up_Velocity | B3B8 | LD A,(IX+$09) | Fetch the y velocity. | |||||||
| B3BB | SRA A | Divide it by sixteen, keeping the sign. | ||||||||
| B3BD | SRA A | |||||||||
| B3BF | SRA A | |||||||||
| B3C1 | SRA A | |||||||||
| B3C3 | ADD A,(IX+$03) | Add the y position of the creature. | ||||||||
| B3C6 | CP $40 | Jump to Move_Creature_Vertically_Store_Up_Y if the y position is 40 or more. | ||||||||
| B3C8 | JR NC,Move_Creature_Vertically_Store_Up_Y | |||||||||
| B3CA | DEC (IX+$04) | Move the creature to the room above. | ||||||||
| B3CD | LD A,$BF | Set the y position to BF. | ||||||||
| Move_Creature_Vertically_Store_Up_Y | B3CF | LD (IX+$03),A | Store the y position. | |||||||
| B3D2 | JR Move_Creature_Vertically_Adjust_X | Jump to Move_Creature_Vertically_Adjust_X. | ||||||||
| Prev: B2CF | Up: Map | Next: B3D4 |