1 /***************************************************************************
2     Bonus Points Code.
3 
4     This is the code that displays your bonus points on completing the game.
5 
6     Copyright Chris White.
7     See license.txt for more details.
8 ***************************************************************************/
9 
10 #pragma once
11 
12 #include "outrun.hpp"
13 
14 class OBonus
15 {
16 public:
17     // Bonus Control
18     int8_t bonus_control;
19     enum
20     {
21         BONUS_DISABLE = 0x0,    // 0  = Bonus Mode Disabled
22         BONUS_INIT = 0x4,       // 4  = Init Bonus Mode
23         BONUS_TICK = 0x8,       // 8  = Tick Down Bonus Time
24         BONUS_SEQ0 = 0xC,       // C  = End Seq Animation Stage #0 - Stages used to set Ferrari frames
25         BONUS_SEQ1 = 0x10,      // 10 = End Seq Animation Stage #1
26         BONUS_SEQ2 = 0x14,      // 14 = End Seq Animation Stage #2
27         BONUS_SEQ3 = 0x18,      // 18 = End Seq Animation Stage #3
28         BONUS_END = 0x1C,       // 1C = End Bonus Sequence
29     };
30 
31     // Bonus State
32     //
33     // 0 = Init Bonus Points Text & Calculate Bonus Score
34     // 1 = Decrement Bonus Seconds
35     // 2 = Clear Bonus Text
36     // 3 = Do Not Execute Bonus Text Block
37     int8_t bonus_state;
38     enum
39     {
40         BONUS_TEXT_INIT = 0,
41         BONUS_TEXT_SECONDS = 1,
42         BONUS_TEXT_CLEAR = 2,
43         BONUS_TEXT_DONE = 3,
44     };
45 
46     // Timer used by bonus mode logic (Added from Rev. A onwards)
47     int16_t bonus_timer;
48 
49     OBonus(void);
50     ~OBonus(void);
51     void init();
52 
53     void do_bonus_text();
54 
55 private:
56     // Bonus seconds (for seconds countdown at bonus stage)
57     //
58     // Stored as hex, but should be converted to decimal for true value.
59     //
60     // So 0x314 would be 78.8 seconds
61     int16_t bonus_secs;
62 
63     // Timing counter used in bonus code logic
64     int16_t bonus_counter;
65 
66     void init_bonus_text();
67     void blit_bonus_secs();
68     void decrement_bonus_secs();
69 };
70 
71 extern OBonus obonus;
72 
73