1 /***************************************************************************
2     Course Map Logic & Rendering.
3 
4     This is the full-screen map that is displayed at the end of the game.
5 
6     The logo is built from multiple sprite components.
7 
8     The course map itself is made up of sprites and pieced together.
9     It's not a tilemap.
10 
11     Copyright Chris White.
12     See license.txt for more details.
13 ***************************************************************************/
14 
15 #pragma once
16 
17 #include "outrun.hpp"
18 
19 class OMap
20 {
21 public:
22     // Load Sprites Needed for Course Map
23     bool init_sprites;
24 
25     OMap(void);
26     ~OMap(void);
27 
28     void init();
29     void tick();
30     void blit();
31     void load_sprites();
32     void draw_course_map();
33     void position_ferrari(uint8_t index);
34 
35 private:
36     // Total sprite pieces that comprise course map. 3c
37     const static uint8_t MAP_PIECES = 0x3C;
38 
39     uint8_t map_state;
40 
41     enum
42     {
43         MAP_INIT  = 0,
44         // Do Route [Note map is displayed from this point on]
45         MAP_ROUTE = 0x4,
46         // Do Final Segment Of Route [Car still moving]
47         MAP_ROUTE_FINAL = 0x08,
48         // Route Concluded
49         MAP_ROUTE_DONE = 0x0C,
50         // Init Delay Counter For Map Display
51         MAP_INIT_DELAY = 0x10,
52         // Display Map
53         MAP_DISPLAY = 0x14,
54         // Clear Course Map
55         MAP_CLEAR = 0x18,
56     };
57 
58     // Direction to move on mini-map
59 
60     // Bit 0: 0 = Up   (Left Route)
61     //        1 = Down (Right Route)
62     uint8_t map_route;
63 
64     // Minimap Position (Per Segment Basis)
65     int16_t map_pos;
66 
67     // Minimap Position (Final Segment)
68     int16_t map_pos_final;
69 
70     // Map Delay Counter
71     int16_t map_delay;
72 
73     // Stage counter for course map screen. [Increments]
74     int16_t map_stage1;
75 
76     // Stage counter for course map screen. [Decrements]
77     // Loaded with stage, then counts down as course map logic runs.
78     int16_t map_stage2;
79 
80     // Minicar Movement Enabled (set = enabled)
81     uint8_t minicar_enable;
82 
83     void draw_horiz_end(oentry*);
84     void draw_vert_bottom(oentry*);
85     void draw_vert_top(oentry*);
86     void draw_piece(oentry*, uint32_t);
87     void do_route_final();
88     void end_route();
89     void init_map_delay();
90     void map_display();
91     void move_mini_car(oentry*);  ;
92 };
93 
94 extern OMap omap;