Prev: 84F3 Up: Map Next: 850E
84F4: Calculate final game percentage score.
Used by the routine at Game_DisplayFinalScore.
Input
A Holds the total score / percent on exit.
Output
Calculates the overall percentage score using how many rooms visited and which objects collected.
Game_CalculateScore 84F4 LD B,$20 Table holding which objects collected and percentage values of each object.
84F6 LD HL,Object_FoundTable
84F9 XOR A Total percent.
Game_CalculateScore_0 84FA DEC (HL) See if objects has been picked up.
84FB JR NZ,Game_CalculateScore_1
84FD INC HL If it has, then add value of object to total percentage.
84FE ADD A,(HL)
84FF DAA Keep in decimal by using BCD.
8500 JR Game_CalculateScore_2
Game_CalculateScore_1 8502 INC HL Skip object (if not marked as carried)
Game_CalculateScore_2 8503 INC HL Next object in table.
8504 DJNZ Game_CalculateScore_0
8506 LD B,$1E Number of rooms.
Game_CalculateScore_3 8508 ADD A,(HL) 1 percent for each room visited.
8509 DAA Again keep decimal.
850A INC HL Next room flag.
850B DJNZ Game_CalculateScore_3
850D RET
Prev: 84F3 Up: Map Next: 850E