1 /***************************************************************************
2     Level Object Logic
3 
4     This class handles rendering most of the objects that comprise a typical
5     level.
6 
7     - Configures rendering properties (co-ordinates, zoom etc.)
8     - Object specific logic, including collision checks & start lights etc.
9 
10     The original codebase contains a large amount of code duplication,
11     much of which is duplicated here.
12 
13     Copyright Chris White.
14     See license.txt for more details.
15 ***************************************************************************/
16 
17 #pragma once
18 
19 #include "outrun.hpp"
20 
21 class OLevelObjs
22 {
23     public:
24         // Spray Counter (Going Through Water).
25         uint16_t spray_counter;
26 
27         // Wheel Spray Type
28         // 00 = Water
29         // 04 = Yellow Stuff
30         // 08 = Green Stuff
31         // 0c = Pink stuff
32         // 10 = Smoke
33         uint16_t spray_type;
34 
35 	    //	Collision With Sprite Has Ocurred
36 	    //
37 	    // 0 = No Collision
38 	    // 1 = Collision (and increments for every additional collision in this crash cycle)
39 	    uint8_t collision_sprite;
40 
41 	    // Sprite Collision Counter (Hitting Scenery)
42 	    int16_t sprite_collision_counter;
43 
44         OLevelObjs(void);
45         ~OLevelObjs(void);
46 
47         void init_startline_sprites();
48         void init_timetrial_sprites();
49         void init_hiscore_sprites();
50         void setup_sprites(uint32_t);
51         void do_sprite_routine();
52         void hide_sprite(oentry*);
53 
54     private:
55         // Default sprite entries for stage 1 initialization
56         const static uint8_t DEF_SPRITE_ENTRIES = 0x44;
57 
58         // Hi-Score Sprite Entries
59         const static uint8_t HISCORE_SPRITE_ENTRIES = 0x40;
60 
61         const static uint8_t COLLISION_RESET = 4;
62         const static uint16_t SPRAY_RESET = 0xC;
63 
64         void init_entries(uint32_t, const uint8_t start_index, const uint8_t);
65 	    void setup_sprite(oentry*, uint32_t);
66 	    void setup_sprite_routine(oentry*);
67         void sprite_collision_z1c(oentry*);
68         void sprite_lights(oentry*);
69         void sprite_lights_countdown(oentry*);
70         void sprite_grass(oentry* sprite);
71         void sprite_water(oentry* sprite);
72         void sprite_rocks(oentry* sprite);
73         void sprite_debris(oentry* sprite);
74         void sprite_minitree(oentry* sprite);
75         void do_thickness_sprite(oentry* sprite, const uint32_t);
76         void sprite_clouds(oentry* sprite);
77 	    void sprite_normal(oentry*, uint8_t);
78 	    void set_spr_zoom_priority(oentry*, uint8_t);
79         void set_spr_zoom_priority2(oentry*, uint8_t);
80         void set_spr_zoom_priority_rocks(oentry*, uint8_t);
81 };
82 
83 extern OLevelObjs olevelobjs;