Compare commits

..

No commits in common. "778af827248ad0d53316112684c3d83920a8c6e4" and "a54152cfea34f9411305d7ec783e6eb467616b00" have entirely different histories.

2 changed files with 7 additions and 16 deletions

View File

@ -16,7 +16,7 @@ ITCH_CHANNEL_LINUX=linux-x64
ITCH_CHANNEL_WINDOWS=windows-x64 ITCH_CHANNEL_WINDOWS=windows-x64
ITCH_CHANNEL_MAC=mac ITCH_CHANNEL_MAC=mac
.PHONY: clean clean_game clean_assets run butler_upload build_levels build_images .PHONY: clean run butler_upload build_levels build_images
run: $(GAME)_linux build_levels build_images run: $(GAME)_linux build_levels build_images
SKIP_INTRO=1 ./$(GAME)_linux SKIP_INTRO=1 ./$(GAME)_linux
@ -53,21 +53,17 @@ $(GAME)_windows.exe: *.c
$(GAME)_mac: *.c $(GAME)_mac: *.c
$(CC) *.c $(CFLAGS) -o $(GAME)_mac $(CC) *.c $(CFLAGS) -o $(GAME)_mac
clean_game: clean:
rm -f ./$(GAME)_linux rm -f ./$(GAME)_linux
rm -f ./$(GAME)_linux.zip rm -f ./$(GAME)_linux.zip
rm -f ./$(GAME)_windows.exe rm -f ./$(GAME)_windows.exe
rm -f ./$(GAME)_windows.zip rm -f ./$(GAME)_windows.zip
rm -f ./$(GAME)_mac rm -f ./$(GAME)_mac
rm -f ./$(GAME)_mac.zip rm -f ./$(GAME)_mac.zip
clean_assets:
rm -f ./levels/*.csv rm -f ./levels/*.csv
rm -f ./img/*.png rm -f ./img/*.png
rm -f ./tilesets/*.png rm -f ./tilesets/*.png
clean: clean_game clean_assets
$(GAME)_linux.zip: $(GAME)_linux $(GAME)_linux.zip: $(GAME)_linux
rm -f ./$(GAME)_linux.zip rm -f ./$(GAME)_linux.zip
zip -r $(GAME)_linux.zip $(GAME)_linux COPYING img/*.png img/LICENSE zip -r $(GAME)_linux.zip $(GAME)_linux COPYING img/*.png img/LICENSE

15
level.c
View File

@ -13,25 +13,20 @@ void init_level(Game *g, Level *l, char *filepath) {
l->data_size = 0; l->data_size = 0;
do { do {
l->data[l->data_size++] = atoi(datum); 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; 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); datum = strtok_r(first_line, ",", &other_guy);
do { do {
l->data[l->data_size++] = (char)atoi(datum); 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; l->length = l->data_size / l->width;
printf( printf("Loaded level from '%s': %dx%d = %d total bytes\n", filepath, l->length, l->width, l->data_size);
"Loaded level from '%s': %dx%d = %zd total bytes\n",
filepath,
l->length,
l->width,
l->data_size);
UnloadFileText(file_text); UnloadFileText(file_text);
l->game = g; l->game = g;
} }