-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructs.h
101 lines (83 loc) · 2.16 KB
/
structs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef _STRUCTS_H_
#define _STRUCTS_H_
#include "fixpoint.h"
constexpr uint8_t TIMED_LAPS = 5;
#define LEVEL_CACHE 10 // Tiles in cache
struct Vec3 {
FIXPOINT x,y;
FIXPOINT direction;
FIXPOINT force;
FIXPOINT time;
};
struct Player {
FIXPOINT X,Y,XVec,YVec;
double rotation;
Vec3 acceleration;
bool offRoad = false;
};
struct CheckPoint {
uint8_t x;
uint8_t y;
bool passed;
CheckPoint *nextcheckpoint;
};
constexpr uint8_t LEVELS = 20; // 10 original Levels, 10 fx levels
struct SaveData
{
uint16_t BestLapTimes[LEVELS];
uint8_t maxLevel = 1;
uint8_t music = 1;
uint8_t sound = 1;
uint8_t map = 1;
uint8_t car_maxspeed = 4;
uint8_t car_acceleration = 4;
uint8_t car_turn = 4;
};
struct GameState {
uint8_t currentKeyPress = 0;
bool desiredActivated = false;
uint8_t level;
__uint24 levelMap;
uint8_t levelSize;
bool mapDisplay[LEVEL_CACHE*LEVEL_CACHE];
int levelMapXMod = -1;
int levelMapYMod = -1;
uint8_t lasttile;
uint8_t lastx;
uint8_t lasty;
uint8_t car_tune_total = 12;
uint32_t laptimes[TIMED_LAPS];
uint32_t bestLap;
bool newbestLap;
CheckPoint *levelCheckPoints;
bool laptimer;
bool paused;
bool startCross;
bool enter;
uint8_t curlap;
uint8_t checkpoints;
uint8_t checkpointpassed;
Player player1;
FIXPOINT StageX = FIXP_TO_INT(0), StageY = FIXP_TO_INT(0);
uint8_t mode = 0;
uint8_t lastmode = -1;
uint8_t menuItem = 0;
int timeout;
// Car setup
// Fixed car variables
static const FIXPOINT offroad_pen = FLOAT_TO_FIXP(0.01f);
static const FIXPOINT drag = FLOAT_TO_FIXP(0.04f / 30.0f);
static const double default_max_turn_speed = 0.003;
static const FIXPOINT default_max_speed = FLOAT_TO_FIXP(2.5f);
static const FIXPOINT default_acceleration = FLOAT_TO_FIXP(0.003f);
static const double mod_turn = 0.0003;
static const FIXPOINT mod_max_speed = FLOAT_TO_FIXP(0.25f);
static const FIXPOINT mod_acceleration = FLOAT_TO_FIXP(0.0003f);
// Modified by car tuning
double max_turn_speed = 0.003;
FIXPOINT max_speed = FLOAT_TO_FIXP(2.2f);
FIXPOINT acceleration = FLOAT_TO_FIXP(0.003f);
FIXPOINT offroad = max_speed/3;
FIXPOINT offroad_neg = max_speed/3;
};
#endif