forked from olls/maze-interpreter-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
no-gui.cpp
91 lines (72 loc) · 1.78 KB
/
no-gui.cpp
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
#define DEBUG
// #define DEBUG_BLOCK_COLORS
#include "engine/engine-includes.h"
#include "logging-channels.h"
#include "functions.h"
#include "world-position.h"
#include "particles.h"
#include "cells-storage.h"
#include "cars-storage.h"
#include "cars.h"
#include "parser.h"
#include "ui.h"
#include "cells.h"
#include "serialize.h"
#include "input.h"
#include "opengl-cells-instancing.h"
#include "maze-interpreter.h"
#include "logging-channels.cpp"
#include "functions.cpp"
#include "world-position.cpp"
#include "particles.cpp"
#include "cells-storage.cpp"
#include "cars-storage.cpp"
#include "parser.cpp"
#include "ui.cpp"
#include "cars.cpp"
#include "cells.cpp"
#include "serialize.cpp"
#include "input.cpp"
#include "opengl-cells-instancing.cpp"
#include "maze-interpreter.cpp"
int
main(int argc, char const *argv[])
{
register_game_logging_channels(GAME_LOGGING_CHANNEL_DEFINITIONS);
Memory memory;
memory.total = TOTAL_MEMORY;
memory.memory = (u8 *)malloc(memory.total);
memory.used = 0;
GameState gs;
GameState *game_state = &gs;
game_state->init = true;
game_state->ui.car_inputs = 0;
game_state->single_step = false;
game_state->sim_ticks_per_s = 5;
if (argc > 1)
{
game_state->filename = (u8*)argv[1];
}
else
{
printf("Error: No Maze filename supplied.\n");
return 0;
}
b32 success = load_maze(&memory, game_state/*, argc, argv*/);
if (!success)
{
printf("Error: Couldn't load maze.\n");
return 0;
}
game_state->cars.first_block = 0;
game_state->cars.free_chain = 0;
do
{
perform_cells_sim_tick(&memory, game_state, &(game_state->maze.tree), 0);
perform_cars_sim_tick(&memory, game_state, 0);
move_cars(game_state);
++game_state->sim_steps;
}
while (game_state->cars.first_block != 0);
return 0;
}