-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.h
198 lines (153 loc) · 3.7 KB
/
types.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#ifndef LI_TYPES_H
#define LI_TYPES_H
#define MAX_QUICK_ITEMS 8
#define MAX_BACKPACK_ITEMS 32
//Bande morte sur l'axe X (ignorée par les tests de collision)
#define PLAYER_X_BDM 3
//Idem axe Y mais seulement en haut (les pieds sont sur le sol)
#define PLAYER_Y_BDM 4
typedef struct Vector2
{
float x;
float y;
} Vector2;
typedef struct TPos
{
float pX, pY;
int worldX, worldY;
float speedX, speedY;
float newX, newY;
int8_t direction;
int XFront;
int YDown;
int YUp;
} ;
typedef struct TInventoryItem
{
uint8_t typeItem;
uint8_t nbStack;
uint8_t life;
};
typedef struct TPlayer
{
TPos pos;
uint8_t anim_frame;
uint8_t current_framerate;
uint8_t stateAnim;
struct {
uint8_t anim_frame;
uint8_t current_framerate;
uint8_t stateAnim;
int8_t direction;
uint8_t waterLevel;
int pX;
int pY;
int speedX;
int speedY;
} FX;
bool bCanMove;
bool bCanFlip;
bool bHasWallJumped;
bool bJumping;
float jumpTimer;
bool bDoubleJumping;
bool bWallJumping;
float wallJumpTimer;
int8_t lastWallJumpDirection;
bool bOnGround;
float onGroundTimer;
bool bTouchingWall;
bool bTouchingLedge;
bool bLedgeDetected;
bool bClimbingLedge;
//Pour monter sur les bords
Vector2 ledgePosTop;
Vector2 ledgePos1;
Vector2 ledgePos2;
float turnTimer;
bool bDying;
bool bWallSliding;
bool bWallClimbing;
bool bFalling;
bool bWalking;
bool bMovingUpDown;
bool bLanding; //On vient de tomber a pleine vitesse de falling
bool bTouched;
float fTouchCountDown;
uint8_t waterLevel;
bool bSplashIn;
bool bSplashOut;
bool bUnderWater;
int wantedHorizontalDirection;
int wantedVerticalDirection;
bool bWantWalk;
bool bWantJump;
bool bWantDoubleJump;
int cible_wX, cible_wY;
int cible_pX, cible_pY;
uint8_t currentItemSelected;
TInventoryItem quick_inventory[MAX_QUICK_ITEMS];
TInventoryItem inventory[MAX_BACKPACK_ITEMS];
unsigned char state;
unsigned char action, action_cooldown, action_perf;
unsigned char depth;
int health;
int max_health;
unsigned char level;
unsigned char stars_kills;
unsigned short armour_weapon;
} TPlayer;
typedef struct Enemy
{
TPos pos;
int type;
int anim_frame;
int current_framerate;
int stateAnim;
int cible_wX, cible_wY;
int cible_pX, cible_pY;
bool bDying;
bool bJumping;
bool bFalling;
bool bWalking;
bool bOnGround;
bool bTouched;
int fTouchCountDown;
bool bIsActive;
int bIsAlive; //de 0 a 127 : zombi, apres 127 vivant
unsigned char state;
unsigned char action, action_cooldown, action_perf;
unsigned char health;
unsigned char level;
} Enemy;
#define BLOCK_LIFE_NA 0 //Aucune ou infinie
#define BLOCK_LIFE_1 1
#define BLOCK_LIFE_2 2
#define BLOCK_LIFE_3 3
#define BLOCK_LIFE_4 4
#define BLOCK_LIFE_5 5
#define BLOCK_LIFE_6 6
#define BLOCK_LIFE_7 7
//On multiplie la life par x pour plus de precision lors du minage
#define TILE_LIFE_PRECISION 10
typedef struct {
uint8_t id;
uint8_t traversable:1;
uint8_t opaque:1;
//uint8_t underground:1; //pour le moment on stocke le underground par rapport a la hauteur originelle..a voir..
//uint8_t animated:1;
uint8_t life:4;
//Water simu
uint8_t Direction:2;
uint8_t Level:3;
//1 si en cours de minage, pour effets divers
uint8_t hit:1;
//permet de changer l'apparence en gardant le meme type (arbres)
uint8_t spriteVariation:2;
uint8_t contour:4;
#ifdef USE_FOV
uint8_t light_hit:1;
#endif
//AU TOTAL ON PEDS DEUX BITS....apres l'alignement nous fait perdre 1 byte...
} TworldTile;
#endif