Prev: 50621 Up: Map Next: 50717
50643: Handle Player Top
The handler of the body of the player, which are the object types 40 to 47. The body is the second of the two objects of the player. It only follows the legs: it takes the position and flags from the legs, has a type that is eight more than the type of the legs, and is a little higher than the legs.
Input
IX Record of the body
Explode if something dangerous has touched the body.
HandlePlayerTop 50643 CALL SetSpriteOffset_Minus12_Minus8 Call SetSpriteOffset_Minus12_Minus8 to set where the sprite is drawn.
50646 BIT 6,(IX+13) Jump to StartExplosion to make the body explode if something dangerous has touched it.
50650 JP NZ,StartExplosion
Copy the position and flags from the legs.
50653 PUSH IX Take the body, using the stack.
50655 POP DE
50656 LD HL,65504 Set the distance back to the legs, which is one record, in HL.
50659 ADD HL,DE Move back to the legs.
50660 PUSH HL Take the legs, using the stack.
50661 POP IY
50663 INC DE Move on to the second byte of each of them.
50664 INC HL
50665 LD BC,7 Set the number of bytes to copy in BC to 7.
50668 LDIR Copy the position, sizes and flags of the legs to the body.
50670 LD (IX+6),0 Set the size of the body along z to 0.
50674 SET 1,(IX+7) Flag the body as being moved.
Leave the type alone while a countdown is running.
50678 LD A,(IX+13) Fetch the hit flags of the body.
50681 AND %00001111 Keep only the lowest four bits, which are a countdown.
50683 JR Z,HandlePlayerTop_Type Jump to HandlePlayerTop_Type if it is not running.
50685 DEC (IX+13) Take one off the countdown.
50688 JR HandlePlayerTop_Height Jump to HandlePlayerTop_Height to leave the type of the body as it is.
Set the type of the body to eight more than the legs.
HandlePlayerTop_Type 50690 LD A,(IY+0) Fetch the type of the legs.
50693 ADD A,8 Add eight to it.
50695 LD (IX+0),A Set it as the type of the body.
Raise the body a little above the legs.
HandlePlayerTop_Height 50698 LD A,(IY+0) Fetch the type of the legs.
50701 AND %00000100 Keep only bit 2 of it.
50703 XOR %00000100 Flip it.
50705 ADD A,8 Add 8 to it.
50707 ADD A,(IY+3) Add the height of the legs.
50710 LD (IX+3),A Set the height of the body.
50713 CALL FlagOverlappingObjects Call FlagOverlappingObjects to mark the objects that overlap the body to be drawn.
50716 RET Return.
View the equivalent code in;
Prev: 50621 Up: Map Next: 50717