Prev: 25562 Up: Map Next: 25690
25599: Handler: Pick Up Cup
Used by the routine at CollectCup.
Awards the points for a cup, which are 512 for the first cup up to 5632 for the eighth (the number of cups already collected plus one, doubled, in hundreds). If this was the last of the eight cups then the "congratulations" messaging is shown along with the time taken, "Best Time Today" is updated if it has been beaten, and a new round starts (without resetting the lives). Otherwise the number of cups collected is displayed.
Calculate number of points to award.
HandlerCup 25599 LD A,(24124) Fetch the number of cups collected so far (Cups_Collected).
25602 INC A Work out the points as (cups collected + 1) * 2 in BCD.
25603 ADD A,A
25604 DAA
Adds points to score.
25605 LD B,A Set the points to award, in hundreds (as BCD).
25606 LD C,0 Set the units and tens of the points to 0.
25608 CALL AddPointsToScore Add the points to the score using AddPointsToScore.
Handle incrementing the cup counter.
25611 LD HL,24124 Increment Cups_Collected by one.
25614 INC (HL)
Have all the cups been collected?
25615 LD A,(HL) Fetch the number of cups collected.
25616 CP 8 If fewer than 8 cups have been collected then jump to DisplayCupsCollected to display the count.
25618 JR C,DisplayCupsCollected
All cups have been collected, display the "congratulations" messaging.
25620 CALL SetDayAttributes Switch to day time using SetDayAttributes.
25623 CALL CreateWindow Create the game window using CreateWindow.
25626 CALL DisplayCongratsMessaging Display the congratulations message using DisplayCongratsMessaging.
Writes the line "YOUR TIME WAS".
25629 LD HL,22632 HL=22632 (pixel co-ordinates: H is the Y position and L is the X position).
25632 LD DE,25571 Point DE at the "YOUR TIME WAS" text (Message_YourTime).
25635 CALL MenuWriteText Print the text using MenuWriteText.
Set HL to where the time itself will display.
25638 LD HL,26752 HL=26752 (pixel co-ordinates: H is the Y position and L is the X position).
25641 CALL ScreenAddress Call ScreenAddress to convert this into a screen address.
25644 CALL DisplayTime_Minutes Display the time taken using DisplayTime_Minutes.
Has a "Best Time Today" been set yet?
25647 LD A,(24067) If Flag_BestTime is zero then jump to BestTime_Set.
25650 AND A
25651 JR Z,BestTime_Set
25653 CALL DisplayBestTime Display the best time so far using DisplayBestTime.
Compare the time taken with the best time, one byte at a time starting with the most significant.
25656 LD HL,24064 Point HL at the best time (BestTime_1).
25659 LD DE,24113 Point DE at the time taken (Time_1).
25662 LD B,3 Set the byte counter to 3.
BestTime_Compare 25664 LD A,(DE) Compare the byte of the time at DE against the byte of the best time at HL.
25665 CP (HL)
25666 JR C,BestTime_Update If the time is less than the best time then jump to BestTime_Update.
25668 JR Z,BestTime_Compare_Next If the bytes are the same then jump to BestTime_Compare_Next.
25670 JR HandlerCup_Delay The time is more than the best time, so jump to HandlerCup_Delay.
BestTime_Compare_Next 25672 INC HL Move onto the next BestTime_1 byte.
25673 INC DE Move onto the next Time_1 byte.
25674 DJNZ BestTime_Compare Decrease the byte counter by one and loop back to BestTime_Compare until all of the bytes have been compared.
This entry point is used by the routine at BestTime_Set.
Create a short pause, then start the next round.
HandlerCup_Delay 25676 LD B,12 Set the delay count to 12.
25678 CALL Delay Pause using Delay.
25681 CALL NewGame_ResetCups Call NewGame_ResetCups to reset the cups and set up a new car, which returns here.
25684 LD SP,24064 Set the stack pointer to 24064.
25687 JP MainLoop_NewPass Jump to MainLoop_NewPass.
Prev: 25562 Up: Map Next: 25690