Skip to content

Commit

Permalink
Stick setting & latest level saved as config file...
Browse files Browse the repository at this point in the history
... on disk (ATR) version
  • Loading branch information
billkendrick committed Aug 23, 2023
1 parent 686adca commit b1e6ef6
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 5 deletions.
6 changes: 3 additions & 3 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Bill Kendrick <bill@newbreedsoftware.com>
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
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
39 changes: 39 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
Firefighting game for the Atari 8-bit
Bill Kendrick <bill@newbreedsoftware.com>
http://www.newbreedsoftware.com/firefighter/
2023-08-22 - 2023-08-22
*/

#include <atari.h>
#include <string.h>
#include <stdio.h>
#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);
}
}
10 changes: 10 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
Firefighting game for the Atari 8-bit
Bill Kendrick <bill@newbreedsoftware.com>
http://www.newbreedsoftware.com/firefighter/
2023-08-22 - 2023-08-22
*/

void load_config(void);
void save_config(void);
5 changes: 5 additions & 0 deletions src/firefite.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#ifdef DISK
#include "help.h"
#include "config.h"
#endif

extern unsigned char scr_mem[];
Expand All @@ -31,6 +32,10 @@ void main(void) {
main_stick = STICK_LEFT;
level = 1;

#ifdef DISK
load_config();
#endif

do {
do {
want_help = show_title();
Expand Down
10 changes: 9 additions & 1 deletion src/title.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand All @@ -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);

Expand Down Expand Up @@ -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() */
Expand Down

0 comments on commit b1e6ef6

Please sign in to comment.