Prev: D5BD Up: Map Next: D647
D5DF: Collect Item
Used by the routine at TestEntityPair.
Deals with an entity touching an entity of the type 0F. Nothing happens while the counter in the high nibble of field 16 of the other entity is running, or while its frame (the low five bits of field 01) is below 04. Frames 04 and 05 burst the touching entity (see StartBurst) and free the other entity. Frames of 06 or more are collected if the touching entity is the player: 0100 points are added to the score and the other entity starts to disappear. Frame 07 also gives an extra life, which is printed, and plays the rising sweep. Frame 08 gives 0900 more points, and the other frames give 0150 more points and fill the first gauge. Purpose of the individual frames is not yet known.
Input
IX The entity that is moved
IY The entity of type 0F
CollectItem D5DF LD A,(IY+$16) Read field 16 of the other entity.
D5E2 AND %11110000 Keep the counter in bits 4-7.
D5E4 RET NZ Return if the counter is running.
D5E5 LD A,(IY+$01) Fetch the frame of the other entity.
D5E8 AND %00011111 Keep the number of the frame.
D5EA CP $04 Compare it with 04.
D5EC RET C Return if the frame is lower.
D5ED CP $06 Jump to CollectItem_Collect if the frame is 06 or more.
D5EF JR NC,CollectItem_Collect
D5F1 CALL StartBurst Burst the touching entity.
D5F4 LD (IY+$00),$00 Free the other entity...
D5F8 LD (IY+$01),$80 ...and hide it.
D5FC RET Return.
CollectItem_Collect D5FD LD A,(IX+$00) Fetch the type of the touching entity.
D600 DEC A Decrease it by one.
D601 RET NZ Return if it is not the player.
D602 LD BC,$0100 Set the points to 0100.
D605 CALL AddScore Add them to the score.
D608 SET 7,(IY+$16) Start the counter in field 16 of the other entity.
D60C LD (IY+$20),$0F Set field 20 of the other entity to 0F.
D610 LD A,(IY+$01) Fetch the frame of the other entity.
D613 AND %00011111 Keep the number of the frame.
D615 CP $07 Jump to CollectItem_Frame if it is not the frame that gives an extra life.
D617 JR NZ,CollectItem_Frame
This entry point is used by the routines at AddScore and PrintScore.
CollectItem_ExtraLife D619 LD A,($DEDE) Fetch the number of lives.
D61C INC A Add one.
D61D LD ($DEDE),A Store it.
D620 DEC A Take away one to find the number of lives that are to be shown.
D621 CALL GetDigits Convert it into digits.
D624 LD ($E1A9),HL Store them in the text record of the lives.
D627 LD DE,$E1A5 Point DE at LivesTextPlayerOne_Record.
D62A CALL PrintText Print it.
D62D JP PlayRisingSweep Jump to PlayRisingSweep.
CollectItem_Frame D630 CP $08 Jump to CollectItem_Other if it is not that frame.
D632 JR NZ,CollectItem_Other
D634 LD BC,$0900 Set the points to 0900.
D637 JP AddScore Jump to AddScore.
CollectItem_Other D63A LD BC,$0150 Set the points to 0150.
D63D CALL AddScore Add them to the score.
D640 LD HL,$6000 HL is 6000 a full gauge.
D643 LD ($A59F),HL Fill the first gauge.
D646 RET Return.
Prev: D5BD Up: Map Next: D647