-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathces.h
86 lines (62 loc) · 1.55 KB
/
ces.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
// ces.h, Component-Entity-System header
#ifndef __COMPONENT_H
#define __COMPONENT_H
typedef struct ComponentLocation
{
double Y;
double X;
} ComponentLocation;
typedef struct ComponentHealth
{
int Health;
} ComponentHealth;
typedef struct ComponentAttack
{
int Attack;
} ComponentAttack;
typedef struct ComponentMovement
{
int Speed;
int State;
} ComponentMovement;
typedef struct ComponentXPValue
{
int XP;
} ComponentXPValue;
typedef struct ComponentTarget
{
int dY;
int dX;
int distance;
} ComponentTarget;
typedef enum
{
COMPONENT_NONE = 0,
COMPONENT_LOCATION = 1 << 1,
COMPONENT_HEALTH = 1 << 2,
COMPONENT_ATTACK = 1 << 3,
COMPONENT_MOVEMENT = 1 << 4,
COMPONENT_XPVALUE = 1 << 5,
COMPONENT_ANIMAL = 1 << 6,
COMPONENT_PROTECTOR = 1 << 7,
COMPONENT_TARGET = 1 << 8,
} Component;
#define NUMBER_OF_ANIMALS 40
#define NUMBER_OF_PROTECTORS 20
#define NUMBER_OF_PROJECTILES 5
#define MAX_ENTITIES ( NUMBER_OF_ANIMALS + \
NUMBER_OF_PROTECTORS + \
NUMBER_OF_PROJECTILES )
typedef struct World
{
int mask[ MAX_ENTITIES ];
int id[ MAX_ENTITIES ];
ComponentLocation location [ MAX_ENTITIES ];
ComponentHealth health [ MAX_ENTITIES ];
ComponentAttack attack [ MAX_ENTITIES ];
ComponentMovement movement [ MAX_ENTITIES ];
ComponentXPValue XPValue [ MAX_ENTITIES ];
ComponentTarget target [ MAX_ENTITIES ];
} World;
void InitEntities( );
#endif // __COMPONENT_H