Prev: 47883 Up: Map Next: 48052
47930: 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 47930 LD DE,45225 Point DE at RewardTune.
47933 CALL PlayMusic Call PlayMusic.
47936 LD A,(41568) Fetch the level.
47939 LD C,A Multiply it by three.
47940 ADD A,A
47941 ADD A,C
47942 LD HL,46446 Point HL at OutlawRewards.
47945 CALL AddAToHL Point HL at the reward for the level.
47948 INC HL Move on to the last byte of the reward.
47949 INC HL
47950 LD C,(HL) Fetch the last byte into C.
47951 DEC HL Move back a byte.
47952 LD B,(HL) Fetch the middle byte into B.
47953 DEC HL Move back to the first byte.
47954 EX DE,HL Keep its address in DE.
47955 CALL AddToBounty Add BC to the bounty.
47958 LD A,(DE) Add the first byte of the reward to the most significant byte of the bounty.
47959 ADD A,(HL)
47960 DAA
47961 LD (HL),A
47962 CALL DrawBountyDigits Print the bounty.
47965 LD HL,41571 Add one to the number of lives, to make up for the one which the next stage takes.
47968 INC (HL)
47969 LD HL,41568 Move on to the next level.
47972 INC (HL)
47973 LD A,(HL) Fetch the level.
47974 CP 20 Jump to GiveReward_Skill if there are more levels.
47976 JR C,GiveReward_Skill
47978 LD A,16 Go back to the sixteenth level.
47980 LD (HL),A
GiveReward_Skill 47981 AND %00000001 Test whether the level is odd.
47983 JR NZ,GiveReward_CheckLevel Jump if it is.
47985 LD HL,41569 Point HL at Skill.
47988 LD A,(HL) Fetch the skill level.
47989 CP 7 Jump to GiveReward_CheckLevel if it is already as high as it goes.
47991 JR Z,GiveReward_CheckLevel
47993 INC (HL) Raise the skill level.
GiveReward_CheckLevel 47994 LD A,(41568) Fetch the level.
47997 AND %00000011 Test whether this is the fourth level.
47999 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.
48002 CALL ClearBuffer Clear the buffer.
48005 CALL CopyBufferAndClear Draw the buffer on the screen, which blanks it, and clear it again.
Print the bonus message.
48008 LD HL,16619 Point HL at 16619 (in the screen buffer).
48011 LD DE,48052 Point DE at BonusMessage.
48014 CALL PrintLargeText Print the message.
48017 LD DE,45536 Point DE at FanfareTune.
48020 CALL PlayMusic Play the fanfare.
48023 LD B,2 Set the length of the delay.
48025 LD HL,0 Set the longest wait, which is a count of zero.
48028 CALL WaitForAWhile Wait for a while.
48031 LD HL,276 Set TargetsLeft to 20 bags and StageKind to the money-bag stage.
48034 LD (41572),HL
48037 CALL RemoveAllObjects Remove all of the objects.
48040 LD A,70 Set A to INK:YELLOW, PAPER:BLACK (BRIGHT).
48042 LD (41574),A Store it as the screen colour.
48045 LD HL,41571 Add another, to make up for the one which the bonus stage takes.
48048 INC (HL)
48049 JP StartStage Start the stage.
Prev: 47883 Up: Map Next: 48052