Prev: 51069 Up: Map Next: 51151
51092: Draw Lives Display
Used by the routines at CheckScoreAwardLife and RenderHUD.
Refreshes the on-screen life icons. Runs 7 passes of Erase_Life_Icon_Cells (masked clear) with glyph code 27 vertical seed *Wave and step *Lives_Display_Vertical_Step. If *Lives is zero, returns; else D is the lives count capped at 7 the vertical seed is reloaded from *Wave, and that many OR-blits run via Draw_Life_Icon_Cells with the same glyph and stride. Called from RenderHUD and CheckScoreAwardLife.
DrawLivesDisplay 51092 LD D,7 D=7 (fixed passes for the clear / background phase).
51094 LD A,(50198) E=*Wave (initial vertical parameter for the first phase).
51097 LD E,A
Seven stacked clears using Erase_Life_Icon_Cells (CPL and AND into the display file).
DrawLivesDisplay_ClearLoop 51098 PUSH DE Stash DE on the stack.
51099 LD A,27 A=27 (life-icon character / glyph selector).
51101 LD B,E B=E (vertical argument for the blit helper).
51102 LD C,0 C=0.
51104 CALL Erase_Life_Icon_Cells Call Erase_Life_Icon_Cells (masked clear at this cell).
51107 POP DE Restore DE from the stack.
51108 LD A,(50199) A=*Lives_Display_Vertical_Step (vertical spacing between stacked slots).
51111 ADD A,E Add E to A.
51112 LD E,A E=A (advance the vertical parameter).
51113 DEC D Decrement D.
51114 JP NZ,DrawLivesDisplay_ClearLoop Loop back to DrawLivesDisplay_ClearLoop until all 7 clear passes finish.
51117 LD HL,50197 HL=Lives (lives counter).
51120 LD A,(HL) A=*HL.
51121 AND A Return if there are no lives to draw.
51122 RET Z
51123 CP 8 Compare with 8.
51125 JR C,DrawLivesDisplay_CountReady Jump to DrawLivesDisplay_CountReady if the count is below 8 (use it as-is).
51127 LD A,7 A=7 (cap at seven visible life icons).
DrawLivesDisplay_CountReady 51129 LD D,A D=A (number of OR-blits to perform).
51130 INC HL Advance HL to Wave (vertical seed for the draw phase).
51131 LD E,(HL) E=*HL.
Each iteration OR-merges a life glyph via Draw_Life_Icon_Cells (see Draw_Life_Icon_Cells).
DrawLivesDisplay_DrawLoop 51132 PUSH DE Stash DE on the stack.
51133 LD A,27 A=27.
51135 LD B,E B=E.
51136 LD C,0 C=0.
51138 CALL Draw_Life_Icon_Cells Call Draw_Life_Icon_Cells (OR-blit at this cell).
51141 POP DE Restore DE from the stack.
51142 LD A,(50199) A=*Lives_Display_Vertical_Step.
51145 ADD A,E Add E to A.
51146 LD E,A E=A (advance the vertical parameter).
51147 DEC D Decrement D.
51148 JR NZ,DrawLivesDisplay_DrawLoop Loop back to DrawLivesDisplay_DrawLoop while more icons remain.
51150 RET Return.
Prev: 51069 Up: Map Next: 51151