Prev: 48854 Up: Map Next: 48943
48864: Handle Extra Life
The handler for an extra life (object 12). When the player touches it the object turns into a sparkle, it is removed from the table of special objects, the egg tops are allowed to move again and a life is added and printed in the panel. An extra life which has not been touched is moved with gravity and makes a sound when it moves.
Input
IX The address of the object
Test whether the player is near.
HandleExtraLife 48864 CALL SetPixelAdjustments_ExtraLife Call SetPixelAdjustments_ExtraLife.
48867 PUSH IX Copy IX to IY (using the stack).
48869 POP IY
48871 LD IX,23432 Point IX at PlayerBottomObject.
48875 INC (IX+4) Make the player a little wider.
48878 INC (IX+5) Make the player a little deeper.
48881 CALL TestNearObject Call TestNearObject.
48884 DEC (IX+4) Put the width of the player back.
48887 DEC (IX+5) Put the depth of the player back.
48890 PUSH IY Copy IY to IX (using the stack).
48892 POP IX
48894 JR NC,HandleExtraLife_Move Jump to HandleExtraLife_Move if the player is not near.
Collect the extra life.
48896 LD (IX+0),64 Set the sprite number to 64.
48900 CALL SetPixelAdjustments_Sparkle Call SetPixelAdjustments_Sparkle.
48903 LD L,(IX+16) Fetch the low byte of the table entry address.
48906 LD H,(IX+17) Fetch the high byte.
48909 XOR A Write 0 to the table entry and to *EggTopDisabledFlag.
48910 LD (HL),A
48911 LD (23355),A
48914 LD HL,23322 Add one life to Lives.
48917 INC (HL)
48918 CALL PlayLowBeep Call PlayLowBeep.
48921 CALL PrintLives Call PrintLives.
48924 LD BC,128 Copy the lives to the screen at (128, 0).
48927 CALL CopyAreaToScreen
Move the extra life if it was not collected.
HandleExtraLife_Move 48930 CALL ApplyGravityAndMove Call ApplyGravityAndMove.
48933 CALL TestObjectMoving Call TestObjectMoving.
48936 RET Z Return if the object is not moving.
48937 CALL ClearSpeed Call ClearSpeed.
48940 JP PlaySoundAndRedraw Jump to PlaySoundAndRedraw.
View the equivalent code in;
Prev: 48854 Up: Map Next: 48943