diff options
author | UnavailableDev <ggwildplay@gmail.com> | 2023-04-03 10:09:40 +0200 |
---|---|---|
committer | UnavailableDev <ggwildplay@gmail.com> | 2023-04-03 10:09:40 +0200 |
commit | 05504df10934cac60b774fb10e86593ec3897510 (patch) | |
tree | 89a418bb7477904f394e460d5e661c3047117030 /src/engine/level_const.c | |
parent | 54c3e1139e3e0e328f7ce3e8a2a61b0bf530a772 (diff) | |
parent | 0a014f39c375c0cf28de70ebaab6cb0a5266f3c2 (diff) |
Merge branch 'dev' of https://github.com/UnavailableDev/avans-arcade into dev
Diffstat (limited to 'src/engine/level_const.c')
-rw-r--r-- | src/engine/level_const.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/engine/level_const.c b/src/engine/level_const.c new file mode 100644 index 0000000..5ba0187 --- /dev/null +++ b/src/engine/level_const.c @@ -0,0 +1,37 @@ +#include "engine/level_const.h" + + +hh_g_all_levels hh_init_game_levels(){ + hh_g_all_levels levels; + levels.current_level=0; + + levels.level[0].size.x=40; + levels.level[0].size.y=100; + levels.level[0].hh_level_completed=false; + + levels.level[1].size.x=100; + levels.level[1].size.y=28; + levels.level[1].hh_level_completed=false; + + FILE *fp = fopen("../test/bin/level1_test.bin", "rb"); + fseek(fp, 0, SEEK_END); + int size = ftell(fp) / sizeof(int); + fseek(fp, (0 * sizeof(int)) + sizeof(int), SEEK_SET); + int* hh_game_level1 = malloc(size * sizeof(int)); + fread(hh_game_level1, sizeof(int), size, fp); + fclose(fp); + + FILE *lvl2 = fopen("../test/bin/level2_test.bin", "rb"); + fseek(lvl2, 0, SEEK_END); + size = ftell(lvl2) / sizeof(int); + fseek(lvl2, (0 * sizeof(int)) + sizeof(int), SEEK_SET); + int* hh_game_level2 = malloc(size * sizeof(int)); + fread(hh_game_level2, sizeof(int), size, lvl2); + fclose(lvl2); + + levels.level[0].place = hh_game_level1; + levels.level[1].place = hh_game_level2; + + return levels; +} + |