Prev: BB0B Up: Map Next: BBB4
BB3A: Give Reward
Used by the routine at HandleDyingOutlaw.
Called when the outlaw has finished dying. Plays a tune and adds the reward for this outlaw to the player's bounty, then adds a life to make up for the one which the next stage takes, and moves on to the next level. The skill level goes up every second level, to a maximum of seven. Levels past the nineteenth go back to the sixteenth. After every fourth level the player plays a bonus stage in which money bags fall; otherwise the stage ends.
GiveReward BB3A LD DE,$B0A9 Point DE at RewardTune.
BB3D CALL PlayMusic Call PlayMusic.
BB40 LD A,($A260) Fetch the level.
BB43 LD C,A Multiply it by three.
BB44 ADD A,A
BB45 ADD A,C
BB46 LD HL,$B56E Point HL at OutlawRewards.
BB49 CALL AddAToHL Point HL at the reward for the level.
BB4C INC HL Move on to the last byte of the reward.
BB4D INC HL
BB4E LD C,(HL) Fetch the last byte into C.
BB4F DEC HL Move back a byte.
BB50 LD B,(HL) Fetch the middle byte into B.
BB51 DEC HL Move back to the first byte.
BB52 EX DE,HL Keep its address in DE.
BB53 CALL AddToBounty Add BC to the bounty.
BB56 LD A,(DE) Add the first byte of the reward to the most significant byte of the bounty.
BB57 ADD A,(HL)
BB58 DAA
BB59 LD (HL),A
BB5A CALL DrawBountyDigits Print the bounty.
BB5D LD HL,$A263 Add one to the number of lives, to make up for the one which the next stage takes.
BB60 INC (HL)
BB61 LD HL,$A260 Move on to the next level.
BB64 INC (HL)
BB65 LD A,(HL) Fetch the level.
BB66 CP $14 Jump to GiveReward_Skill if there are more levels.
BB68 JR C,GiveReward_Skill
BB6A LD A,$10 Go back to the sixteenth level.
BB6C LD (HL),A
GiveReward_Skill BB6D AND %00000001 Test whether the level is odd.
BB6F JR NZ,GiveReward_CheckLevel Jump if it is.
BB71 LD HL,$A261 Point HL at Skill.
BB74 LD A,(HL) Fetch the skill level.
BB75 CP $07 Jump to GiveReward_CheckLevel if it is already as high as it goes.
BB77 JR Z,GiveReward_CheckLevel
BB79 INC (HL) Raise the skill level.
GiveReward_CheckLevel BB7A LD A,($A260) Fetch the level.
BB7D AND %00000011 Test whether this is the fourth level.
BB7F JP NZ,EndDuel_EndStage End the stage if it is not.
Show the bonus message, play a fanfare and set up the stage of money bags.
BB82 CALL ClearBuffer Clear the buffer.
BB85 CALL CopyBufferAndClear Draw the buffer on the screen, which blanks it, and clear it again.
Print the bonus message.
BB88 LD HL,$40EB Point HL at 40EB (in the screen buffer).
BB8B LD DE,$BBB4 Point DE at BonusMessage.
BB8E CALL PrintLargeText Print the message.
BB91 LD DE,$B1E0 Point DE at FanfareTune.
BB94 CALL PlayMusic Play the fanfare.
BB97 LD B,$02 Set the length of the delay.
BB99 LD HL,$0000 Set the longest wait, which is a count of zero.
BB9C CALL WaitForAWhile Wait for a while.
BB9F LD HL,$0114 Set TargetsLeft to 14 bags and StageKind to the money-bag stage.
BBA2 LD ($A264),HL
BBA5 CALL RemoveAllObjects Remove all of the objects.
BBA8 LD A,$46 Set A to INK:YELLOW, PAPER:BLACK (BRIGHT).
BBAA LD ($A266),A Store it as the screen colour.
BBAD LD HL,$A263 Add another, to make up for the one which the bonus stage takes.
BBB0 INC (HL)
BBB1 JP StartStage Start the stage.
Prev: BB0B Up: Map Next: BBB4