Compare commits
2 Commits
a54152cfea
...
778af82724
Author | SHA1 | Date | |
---|---|---|---|
778af82724 | |||
122e839ea8 |
8
Makefile
8
Makefile
@ -16,7 +16,7 @@ ITCH_CHANNEL_LINUX=linux-x64
|
||||
ITCH_CHANNEL_WINDOWS=windows-x64
|
||||
ITCH_CHANNEL_MAC=mac
|
||||
|
||||
.PHONY: clean run butler_upload build_levels build_images
|
||||
.PHONY: clean clean_game clean_assets run butler_upload build_levels build_images
|
||||
|
||||
run: $(GAME)_linux build_levels build_images
|
||||
SKIP_INTRO=1 ./$(GAME)_linux
|
||||
@ -53,17 +53,21 @@ $(GAME)_windows.exe: *.c
|
||||
$(GAME)_mac: *.c
|
||||
$(CC) *.c $(CFLAGS) -o $(GAME)_mac
|
||||
|
||||
clean:
|
||||
clean_game:
|
||||
rm -f ./$(GAME)_linux
|
||||
rm -f ./$(GAME)_linux.zip
|
||||
rm -f ./$(GAME)_windows.exe
|
||||
rm -f ./$(GAME)_windows.zip
|
||||
rm -f ./$(GAME)_mac
|
||||
rm -f ./$(GAME)_mac.zip
|
||||
|
||||
clean_assets:
|
||||
rm -f ./levels/*.csv
|
||||
rm -f ./img/*.png
|
||||
rm -f ./tilesets/*.png
|
||||
|
||||
clean: clean_game clean_assets
|
||||
|
||||
$(GAME)_linux.zip: $(GAME)_linux
|
||||
rm -f ./$(GAME)_linux.zip
|
||||
zip -r $(GAME)_linux.zip $(GAME)_linux COPYING img/*.png img/LICENSE
|
||||
|
15
level.c
15
level.c
@ -13,20 +13,25 @@ void init_level(Game *g, Level *l, char *filepath) {
|
||||
l->data_size = 0;
|
||||
do {
|
||||
l->data[l->data_size++] = atoi(datum);
|
||||
} while (datum = strtok_r(NULL, ",", &other_guy));
|
||||
} while ((datum = strtok_r(NULL, ",", &other_guy)));
|
||||
l->width = l->data_size;
|
||||
|
||||
while (first_line = strtok_r(NULL, "\n", &line)) {
|
||||
while ((first_line = strtok_r(NULL, "\n", &line))) {
|
||||
datum = strtok_r(first_line, ",", &other_guy);
|
||||
do {
|
||||
l->data[l->data_size++] = (char)atoi(datum);
|
||||
} while (datum = strtok_r(NULL, ",", &other_guy));
|
||||
} while ((datum = strtok_r(NULL, ",", &other_guy)));
|
||||
}
|
||||
l->length = l->data_size / l->width;
|
||||
|
||||
printf("Loaded level from '%s': %dx%d = %d total bytes\n", filepath, l->length, l->width, l->data_size);
|
||||
printf(
|
||||
"Loaded level from '%s': %dx%d = %zd total bytes\n",
|
||||
filepath,
|
||||
l->length,
|
||||
l->width,
|
||||
l->data_size);
|
||||
UnloadFileText(file_text);
|
||||
|
||||
|
||||
l->game = g;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user