Prev: 26683 Up: Map Next: 26784
26747: Display Lives
Used by the routine at CreateWindow.
Draws one car icon in the bottom row of the sidebar for each life remaining in Player_Lives.
Before After
display-lives-before display-lives-after
DisplayPlayerLives 26747 LD A,(24125) Return if there are no lives left (Player_Lives).
26750 AND A
26751 RET Z
26752 LD B,A Set the lives counter to the number of lives (Player_Lives).
26753 LD HL,48136 HL=48136 (pixel co-ordinates: H is the Y position and L is the X position of the first car).
26756 XOR A Write 0 to NewSpriteShift.
26757 LD (24129),A
DisplayPlayerLives_Loop 26760 LD DE,31958 Point DE at the car sprite (Sprite_Car_1).
26763 CALL DisplayPlayerLives_Print Print a car using DisplayPlayerLives_Print.
26766 DJNZ DisplayPlayerLives_Loop Decrease the lives counter by one and loop back to DisplayPlayerLives_Loop until a car has been shown for every life.
26768 RET Return.
Print the player sprite.
DisplayPlayerLives_Print 26769 PUSH BC Stash the lives counter and the pixel co-ordinates on the stack.
26770 PUSH HL
26771 CALL PrepareActorSprite_Shift Call PrepareActorSprite_Shift to set up the sprite at the co-ordinates in HL.
26774 CALL DrawEntity_NoOldSprite Call DrawEntity_NoOldSprite to draw the sprite.
26777 POP HL Restore the pixel co-ordinates and the lives counter from the stack.
26778 POP BC
Move onto the next life "slot".
26779 LD A,L Add 16 to the X position, ready for the next car.
26780 ADD A,16
26782 LD L,A
26783 RET Return.
View the equivalent code in;
Prev: 26683 Up: Map Next: 26784