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
|
#include "level11.h"
#include "game.h"
#include "world.h"
#include "entity.h"
#include "entityGrouping.h"
void initLevel11(Game * game, Levels * levels) {
int i;
const EntityType possibleTypes[] = {ENTITY_SOLDATO, ENTITY_SOLDATO, ENTITY_SOLDATO, ENTITY_CAPORALE, ENTITY_SERGENTE, ENTITY_MARESCIALLO, ENTITY_GENERALE};
size_t possibleTypesSize = sizeof(possibleTypes) / sizeof(EntityType);
addEntryToWorld(&game->world, game, (WorldEntry){ENTITY_ANTIFA, (Vector3){0.0, 0.0, 0.0}, QuaternionIdentity()});
// Add lots of random entities to world.
// This level is ment to be fucking annoying hehehe.
SetRandomSeed(time(NULL));
int randomEntityCount = GetRandomValue(LEVEL11_MIN_ENTITY_COUNT, LEVEL11_MAX_ENTITY_COUNT);
WorldEntry entries[randomEntityCount];
for (i = 0; i < randomEntityCount; ++i) {
// Get random direction then push out to a random distance for a position.
Vector3 position = (Vector3){
(float)GetRandomValue(-UCHAR_MAX, UCHAR_MAX) / UCHAR_MAX,
(float)GetRandomValue(-UCHAR_MAX, UCHAR_MAX) / UCHAR_MAX,
(float)GetRandomValue(-UCHAR_MAX, UCHAR_MAX) / UCHAR_MAX
};
float distance = GetRandomValue(LEVEL11_MIN_ENTITY_DISTANCE, LEVEL11_MAX_ENTITY_DISTANCE);
distance = (GetRandomValue(0, 1) == 0) ? distance : -distance;
position = Vector3Scale(position, distance);
// Add entry.
entries[i] = (WorldEntry){
possibleTypes[GetRandomValue(0, possibleTypesSize - 1)],
position,
QuaternionIdentity()
};
}
addEntriesToWorld(
&game->world,
game,
entries,
sizeof(entries) / sizeof(WorldEntry)
);
}
void closelevel11(Levels * levels) {
}
bool updateLevel11(Game * game, Levels * levels) {
return game->world.entitiesCount == 1;
}
|