diff -up keen/src/main.c~ keen/src/main.c
--- keen/src/main.c~ 2007-10-25 21:47:38.000000000 +0200
+++ keen/src/main.c 2007-10-25 21:47:38.000000000 +0200
@@ -126,6 +126,48 @@ void SetDefaultOptions(void)
setoption(OPT_CHEATS, "Enable all cheats", 0);
}
+void LoadConfig(void)
+{
+ FILE *f;
+ char *colon, buf[512];
+ int i;
+
+ f = fopen("clonekeen.cfg", "r");
+ if (!f)
+ return;
+
+ /* skip leading comment line */
+ fgets(buf, sizeof(buf), f);
+
+ for (i = 1; i < NUM_OPTIONS; i++)
+ {
+ if (!fgets(buf, sizeof(buf), f))
+ break;
+ colon = strrchr(buf, ':');
+ if (colon)
+ options[i].value = strtol(colon + 1, NULL, 10);
+ }
+
+ fclose(f);
+}
+
+void SaveConfig(void)
+{
+ int i;
+ FILE *f = fopen("clonekeen.cfg", "w");
+
+ if (!f)
+ return;
+
+ fprintf(f,
+ "# Do not change the order of the settings below, nor remove this line!\n");
+
+ for (i = 1; i < NUM_OPTIONS; i++)
+ fprintf(f, "%s: %d\n", options[i].name, (int)options[i].value);
+
+ fclose(f);
+}
+
int main(int argc, char **argv)
{
int i,c;
@@ -159,9 +201,10 @@ int main(int argc, char **argv)
// set default config-menu options
SetDefaultOptions();
- setoption(OPT_FULLSCREEN, "SDL Fullscreen Mode", 0);
- setoption(OPT_ZOOM, "Image Zoom", 1);
+ setoption(OPT_FULLSCREEN, "SDL Fullscreen Mode", 1);
+ setoption(OPT_ZOOM, "Image Zoom", 2);
setoption(OPT_FRAMESKIP, "Frameskip", 2);
+ LoadConfig();
/* process command line options */
VidDrv_printf("Processing command-line options.\n");
@@ -414,6 +457,7 @@ directtomap: ;
ok: ;
cleanup();
+ SaveConfig();
banner();
VidDrv_printf("\nThanks for playing!\n\n");
if (crashflag)