Prev: C5BD Up: Map Next: C61D
C5D3: Handle Player Top
The handler of the body of the player, which are the object types 28 to 2F. 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 C5D3 CALL SetSpriteOffset_Minus12_Minus8 Call SetSpriteOffset_Minus12_Minus8 to set where the sprite is drawn.
C5D6 BIT 6,(IX+$0D) Jump to StartExplosion to make the body explode if something dangerous has touched it.
C5DA JP NZ,StartExplosion
Copy the position and flags from the legs.
C5DD PUSH IX Take the body, using the stack.
C5DF POP DE
C5E0 LD HL,$FFE0 Set the distance back to the legs, which is one record, in HL.
C5E3 ADD HL,DE Move back to the legs.
C5E4 PUSH HL Take the legs, using the stack.
C5E5 POP IY
C5E7 INC DE Move on to the second byte of each of them.
C5E8 INC HL
C5E9 LD BC,$0007 Set the number of bytes to copy in BC to 07.
C5EC LDIR Copy the position, sizes and flags of the legs to the body.
C5EE LD (IX+$06),$00 Set the size of the body along z to 00.
C5F2 SET 1,(IX+$07) Flag the body as being moved.
Leave the type alone while a countdown is running.
C5F6 LD A,(IX+$0D) Fetch the hit flags of the body.
C5F9 AND %00001111 Keep only the lowest four bits, which are a countdown.
C5FB JR Z,HandlePlayerTop_Type Jump to HandlePlayerTop_Type if it is not running.
C5FD DEC (IX+$0D) Take one off the countdown.
C600 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 C602 LD A,(IY+$00) Fetch the type of the legs.
C605 ADD A,$08 Add eight to it.
C607 LD (IX+$00),A Set it as the type of the body.
Raise the body a little above the legs.
HandlePlayerTop_Height C60A LD A,(IY+$00) Fetch the type of the legs.
C60D AND %00000100 Keep only bit 2 of it.
C60F XOR %00000100 Flip it.
C611 ADD A,$08 Add 08 to it.
C613 ADD A,(IY+$03) Add the height of the legs.
C616 LD (IX+$03),A Set the height of the body.
C619 CALL FlagOverlappingObjects Call FlagOverlappingObjects to mark the objects that overlap the body to be drawn.
C61C RET Return.
View the equivalent code in;
Prev: C5BD Up: Map Next: C61D