Prev: 54272 Up: Map Next: 54371
54307: Draw Reward
Used by the routine at DrawTownPanel.
Draws the reward for the outlaw on the poster, from OutlawRewards for Level. It is three bytes of packed decimal digits, without the zeroes at the start. The digits are drawn from one byte before Font_Digits, so they are drawn one line lower.
reward
Find the reward for the level.
DrawReward 54307 LD A,(41568) Fetch Level, and keep it in C.
54310 LD C,A
54311 ADD A,A Multiply it by 3.
54312 ADD A,C
54313 LD HL,46446 Point HL at OutlawRewards.
54316 CALL AddAToHL Call AddAToHL.
54319 EX DE,HL Put the address in DE.
Set the screen address.
54320 LD HL,18562 Point HL at 18562 (in the screen buffer).
54323 LD B,3 Set a count of 3 bytes.
Skip the leading zeroes.
DrawReward_Skip 54325 LD A,(DE) Fetch the byte.
54326 AND %11110000 Keep the upper digit.
54328 JR NZ,DrawReward_Upper Jump to DrawReward_Upper if it is not zero.
54330 LD A,(DE) Fetch the byte.
54331 AND %00001111 Keep the lower digit.
54333 JR NZ,DrawReward_Lower Jump to DrawReward_Lower if it is not zero.
54335 INC DE Move on to the next byte.
54336 DJNZ DrawReward_Skip Jump to DrawReward_Skip if there are any left.
54338 RET Return.
Draw the upper digit.
DrawReward_Upper 54339 LD A,(DE) Fetch the byte.
54340 RRCA Move the upper digit into the lower four bits.
54341 RRCA
54342 RRCA
54343 RRCA
54344 AND %00001111 Keep only bits 0-3.
54346 PUSH BC Stash the counter on the stack.
54347 LD BC,36527 Point BC one byte before Font_Digits.
Draw the digit.
54350 CALL DrawTilePixels Call DrawTilePixels.
54353 INC L Move on to the next column.
54354 POP BC Restore the counter from the stack.
Draw the lower digit.
DrawReward_Lower 54355 PUSH BC Stash the counter on the stack.
54356 LD BC,36527 Point BC one byte before Font_Digits.
54359 LD A,(DE) Fetch the byte and move to the next one.
54360 INC DE
54361 AND %00001111 Keep only bits 0-3.
Draw the digit.
54363 CALL DrawTilePixels Call DrawTilePixels.
54366 INC L Move on to the next column.
54367 POP BC Restore the counter from the stack.
54368 DJNZ DrawReward_Upper Jump to DrawReward_Upper if there are any left.
54370 RET Return.
Prev: 54272 Up: Map Next: 54371