Prev: B217 Up: Map Next: B29C
B219: Display number of steps and total percentage score.
Used by the routine at Screen_FinalScore.
Input
Output
Game_DisplayFinalScore B219 LD HL,Steps_Count_Upper Start at the lowest byte which is the highest digit.
B21C LD DE,$0708 Start position (Y,x) of first character.
B21F LD C,$46 Attribute colour of characters.
B221 LD B,$04
Game_DisplayFinalScore_0 B223 LD A,(HL) Get next the upper digit of the next two digit BCD value.
B224 SRL A
B226 SRL A
B228 SRL A
B22A SRL A
B22C OR A If greater than zero go ahead and draw it.
B22D JR NZ,Game_DisplayFinalScore_1
B22F LD A,(Digit_LeadZeroFlag) If digit is zero and no digits have been drawn skip as we do not want any leading zeroes.
B232 OR A
B233 JR Z,Game_DisplayFinalScore_2
Game_DisplayFinalScore_1 B235 ADD A,$30 Offset digit value into its tile bitmap index.
B237 CALL Tile_BlitDoubleHeight Draw digit as a double height character.
B23A LD A,$01 Set leading zero bit to show a non-zero digit has been drawn.
B23C LD (Digit_LeadZeroFlag),A
Game_DisplayFinalScore_2 B23F INC E Move onto the next column.
B240 LD A,(HL) Get lower digit from same BCD value.
B241 AND $0F
B243 OR A If its not zero just blit it.
B244 JR NZ,Game_DisplayFinalScore_3
B246 LD A,(Digit_LeadZeroFlag) Check leading zero bit and don't allow a draw if no digit has been drawn yet due to leading zeroes.
B249 OR A
B24A JR Z,Game_DisplayFinalScore_4
Game_DisplayFinalScore_3 B24C ADD A,$30 Adjust digits value int a tile index and draw.
B24E CALL Tile_BlitDoubleHeight
B251 LD A,$01 Set flag to show a digit has been drawn.
B253 LD (Digit_LeadZeroFlag),A
Game_DisplayFinalScore_4 B256 INC E Next column.
B257 DEC HL Next digit in number of steps.
B258 DJNZ Game_DisplayFinalScore_0
B25A XOR A Clear leading zero flag.
B25B LD (Digit_LeadZeroFlag),A
B25E LD A,($84F3) Get ** TODO ** score.
B261 LD C,A
B262 CALL Game_CalculateScore Calculate te players overall score as a percentage.
B265 LD DE,$100E Position (Y,X) of first character.
B268 ADD A,C Add ** to overall score.
B269 DAA
B26A LD C,$47 Attribute colour.
B26C CP $99 See if player has 99%
B26E JR NZ,Game_DisplayFinalScore_5
B270 LD A,$31 If so display as 100%
B272 CALL Tile_BlitDoubleHeight
B275 LD A,$30
B277 INC E
B278 CALL Tile_BlitDoubleHeight
B27B INC E
B27C CALL Tile_BlitDoubleHeight
B27F RET
Display value of score.
Game_DisplayFinalScore_5 B280 LD ($84F3),A Store value for second digit.
B283 SRL A Display Upper digit.
B285 SRL A
B287 SRL A
B289 SRL A
B28B ADD A,$30
B28D CALL Tile_BlitDoubleHeight
B290 INC E
B291 LD A,($84F3) Display lower digit.
B294 AND $0F
B296 ADD A,$30
B298 CALL Tile_BlitDoubleHeight
B29B RET
Prev: B217 Up: Map Next: B29C