Compare commits

...

2 Commits

Author SHA1 Message Date
778af82724 Clear some warnings 2025-03-08 13:36:05 -05:00
122e839ea8 Split clean steps 2025-03-08 13:35:58 -05:00
2 changed files with 16 additions and 7 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 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 run: $(GAME)_linux build_levels build_images
SKIP_INTRO=1 ./$(GAME)_linux SKIP_INTRO=1 ./$(GAME)_linux
@ -53,17 +53,21 @@ $(GAME)_windows.exe: *.c
$(GAME)_mac: *.c $(GAME)_mac: *.c
$(CC) *.c $(CFLAGS) -o $(GAME)_mac $(CC) *.c $(CFLAGS) -o $(GAME)_mac
clean: clean_game:
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,20 +13,25 @@ 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("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); UnloadFileText(file_text);
l->game = g; l->game = g;
} }