diff --git a/CHANGES.txt b/CHANGES.txt index 2e3c3bc..de7a446 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,10 +5,10 @@ Bill Kendrick http://www.newbreedsoftware.com/firefighter/ 0.1-beta-2 (2023-08-22): - * Gas leaks don't appear instantly, giving you a - chance to walk through them if using one joystick - (where you cannot walk while spraying). + * Gas leaks don't appear instantly, giving you a chance to walk through + them if using one joystick (where you cannot walk while spraying). (h/t phigan & JLsoft on AtariAge forums for reporting) + * Stick setting & latest level saved as config file on disk (ATR) version 0.1-beta-1 (2023-08-22): * First public beta release diff --git a/Makefile b/Makefile index e5b429c..fa987d1 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ CC65_FLAGS=-Osir --add-source ## Sources LEVEL_FILES=$(wildcard levels/level*.txt) OBJECTS=obj/firefite.o obj/segments.o obj/title.o obj/game.o obj/draw_text.o obj/dli.o -OBJECTS_DISK=obj/firefite_disk.o obj/segments.o obj/title_disk.o obj/game.o obj/draw_text.o obj/dli.o obj/help.o +OBJECTS_DISK=obj/firefite_disk.o obj/segments.o obj/title_disk.o obj/game.o obj/draw_text.o obj/dli.o obj/help.o obj/config.o TMP=tmp-README.html @@ -129,6 +129,12 @@ obj/help.o: asm/help.s asm/help.s: src/help.c src/help.h src/draw_text.h ${CC65} ${CC65_FLAGS} -I "${CC65_INC}" -t atari src/help.c -o asm/help.s +obj/config.o: asm/config.s + ${CA65} -I "${CC65_ASMINC}" -t atari asm/config.s -o obj/config.o + +asm/config.s: src/config.c src/config.h src/draw_text.h + ${CC65} ${CC65_FLAGS} -I "${CC65_INC}" -t atari src/config.c -o asm/config.s + # Game loop: # ---------- obj/game.o: asm/game.s diff --git a/src/config.c b/src/config.c new file mode 100644 index 0000000..17c2114 --- /dev/null +++ b/src/config.c @@ -0,0 +1,39 @@ +/* + Firefighting game for the Atari 8-bit + Bill Kendrick + http://www.newbreedsoftware.com/firefighter/ + + 2023-08-22 - 2023-08-22 +*/ + +#include +#include +#include +#include "config.h" + +extern char level; +extern char main_stick; + +/* FIXME */ +void load_config() { + FILE * fi; + + fi = fopen("FIREFITE.CFG", "rb"); + if (fi != NULL) { + level = (char) fgetc(fi); + main_stick = (char) fgetc(fi); + fclose(fi); + } +} + +/* FIXME */ +void save_config() { + FILE * fi; + + fi = fopen("FIREFITE.CFG", "wb"); + if (fi != NULL) { + fputc((int) level, fi); + fputc((int) main_stick, fi); + fclose(fi); + } +} diff --git a/src/config.h b/src/config.h new file mode 100644 index 0000000..2f24709 --- /dev/null +++ b/src/config.h @@ -0,0 +1,10 @@ +/* + Firefighting game for the Atari 8-bit + Bill Kendrick + http://www.newbreedsoftware.com/firefighter/ + + 2023-08-22 - 2023-08-22 +*/ + +void load_config(void); +void save_config(void); diff --git a/src/firefite.c b/src/firefite.c index ff535d8..95f2f5c 100644 --- a/src/firefite.c +++ b/src/firefite.c @@ -14,6 +14,7 @@ #ifdef DISK #include "help.h" +#include "config.h" #endif extern unsigned char scr_mem[]; @@ -31,6 +32,10 @@ void main(void) { main_stick = STICK_LEFT; level = 1; +#ifdef DISK + load_config(); +#endif + do { do { want_help = show_title(); diff --git a/src/title.c b/src/title.c index 862b041..e9c03a2 100644 --- a/src/title.c +++ b/src/title.c @@ -15,6 +15,10 @@ #include "dli.h" #include "game.h" +#ifdef DISK +#include "config.h" +#endif + extern unsigned char font1_data[]; // extern unsigned char font2_data[]; /* Not actually referenced */ @@ -23,9 +27,9 @@ extern unsigned char levels_data[]; extern unsigned char * dlist; extern char level; +extern char main_stick; extern unsigned long int high_score; extern char high_score_name[4]; -extern char main_stick; void show_controls(void); @@ -284,6 +288,10 @@ char show_title(void) { #endif } while (OS.strig0 == 1 && OS.strig1 == 1 && CONSOL_START(GTIA_READ.consol) == 0 && !want_help); +#ifdef DISK + save_config(); +#endif + OS.ch = KEY_NONE; /* FIXME: quiet() */