2 Copyright (C) 1998 BJ Eirich (aka vecna)
\r
3 This program is free software; you can redistribute it and/or
\r
4 modify it under the terms of the GNU General Public License
\r
5 as published by the Free Software Foundation; either version 2
\r
6 of the License, or (at your option) any later version.
\r
7 This program is distributed in the hope that it will be useful,
\r
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\r
10 See the GNU General Public Lic
\r
11 See the GNU General Public License for more details.
\r
12 You should have received a copy of the GNU General Public License
\r
13 along with this program; if not, write to the Free Software
\r
14 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
\r
25 #include "smalfont.h"
\r
27 // ================================= Data ====================================
\r
32 char vm=0; // Video mode
\r
33 char white=0, black=0; // Color definitions
\r
34 char pad=0; // Padding mode in tile selector.
\r
35 char th=0, mh=0; // tile-highlight, map highlight
\r
37 // GUI default colors
\r
45 // ------------------
\r
47 extern char scrollmode, vcedprog[80];
\r
48 extern int difficulty;
\r
50 // ================================= Code ====================================
\r
52 void InitializeDefaults()
\r
62 memcpy(vcedprog,"edit",5);
\r
65 void GetConfig(char *fname)
\r
67 strbuf=(char *) valloc(2000,"strbuf!",0);
\r
68 InitializeDefaults();
\r
69 if (!(cfg=fopen(fname,"r")))
\r
71 printf("Unable to open config file. Using defaults... \n");
\r
77 fscanf(cfg,"%s",strbuf);
\r
79 if (!strcmp(strbuf,"difficulty"))
\r
80 { fscanf(cfg,"%s",strbuf);
\r
81 difficulty=atoi(strbuf); continue; }
\r
82 if (!strcmp(strbuf,"nocdaudio"))
\r
87 if (!strcmp(strbuf,"vidmode"))
\r
88 { fscanf(cfg,"%s",strbuf);
\r
89 vm=atoi(strbuf); continue; }
\r
90 if (!strcmp(strbuf,"white"))
\r
91 { fscanf(cfg,"%s",strbuf);
\r
92 white=atoi(strbuf); brightw=atoi(strbuf);
\r
93 TextColor(atoi(strbuf)); continue; }
\r
94 if (!strcmp(strbuf,"black"))
\r
95 { fscanf(cfg,"%s",strbuf);
\r
96 black=atoi(strbuf); continue; }
\r
97 if (!strcmp(strbuf,"winbg"))
\r
98 { fscanf(cfg,"%s",strbuf);
\r
99 winbg=atoi(strbuf); continue; }
\r
100 if (!strcmp(strbuf,"shadow"))
\r
101 { fscanf(cfg,"%s",strbuf);
\r
102 darkw=atoi(strbuf); continue; }
\r
103 if (!strcmp(strbuf,"darkred"))
\r
104 { fscanf(cfg,"%s",strbuf);
\r
105 darkred=atoi(strbuf); continue; }
\r
106 if (!strcmp(strbuf,"titlebg"))
\r
107 { fscanf(cfg,"%s",strbuf);
\r
108 titlebg=atoi(strbuf); continue; }
\r
109 if (!strcmp(strbuf,"pad"))
\r
110 { fscanf(cfg,"%s",strbuf);
\r
111 pad=atoi(strbuf); continue; }
\r
112 if (!strcmp(strbuf, "scrollmode"))
\r
113 { fscanf(cfg,"%s",strbuf);
\r
114 scrollmode=atoi(strbuf); continue; }
\r
116 if (!strcmp(strbuf, "mouse_scroll"))
\r
117 { fscanf(cfg,"%s",strbuf);
\r
118 mouse_scroll=atoi(strbuf)&1; continue; }
\r
119 if (!strcmp(strbuf, "md_device"))
\r
120 { fscanf(cfg, "%s", strbuf);
\r
121 md_device=atoi(strbuf); continue; }
\r
122 if (!strcmp(strbuf, "th"))
\r
123 { fscanf(cfg,"%s",strbuf);
\r
124 th=atoi(strbuf); continue; }
\r
125 if (!strcmp(strbuf, "mh"))
\r
126 { fscanf(cfg,"%s",strbuf);
\r
127 mh=atoi(strbuf); continue; }
\r
128 if (!strcmp(strbuf, "amxofs"))
\r
129 { fscanf(cfg,"%s",strbuf);
\r
130 amxofs=atoi(strbuf); continue; }
\r
131 if (!strcmp(strbuf, "amyofs"))
\r
132 { fscanf(cfg,"%s",strbuf);
\r
133 amyofs=atoi(strbuf); continue; }
\r
134 if (!strcmp(strbuf, "mmxofs"))
\r
135 { fscanf(cfg,"%s",strbuf);
\r
136 mmxofs=atoi(strbuf); continue; }
\r
137 if (!strcmp(strbuf, "mmyofs"))
\r
138 { fscanf(cfg,"%s",strbuf);
\r
139 mmyofs=atoi(strbuf); continue; }
\r
140 if (!strcmp(strbuf, "cnxofs"))
\r
141 { fscanf(cfg,"%s",strbuf);
\r
142 cnxofs=atoi(strbuf); continue; }
\r
143 if (!strcmp(strbuf, "cnyofs"))
\r
144 { fscanf(cfg,"%s",strbuf);
\r
145 cnyofs=atoi(strbuf); continue; }
\r
146 if (!strcmp(strbuf, "lmxofs"))
\r
147 { fscanf(cfg,"%s",strbuf);
\r
148 lmyofs=atoi(strbuf); continue; }
\r
149 if (!strcmp(strbuf, "lmyofs"))
\r
150 { fscanf(cfg,"%s",strbuf);
\r
151 lmyofs=atoi(strbuf); continue; }
\r
152 if (!strcmp(strbuf, "lvxofs"))
\r
153 { fscanf(cfg,"%s",strbuf);
\r
154 lvxofs=atoi(strbuf); continue; }
\r
155 if (!strcmp(strbuf, "lvyofs"))
\r
156 { fscanf(cfg,"%s",strbuf);
\r
157 lvyofs=atoi(strbuf); continue; }
\r
158 if (!strcmp(strbuf, "mpxofs"))
\r
159 { fscanf(cfg,"%s",strbuf);
\r
160 mpxofs=atoi(strbuf); continue; }
\r
161 if (!strcmp(strbuf, "mpyofs"))
\r
162 { fscanf(cfg,"%s",strbuf);
\r
163 mpyofs=atoi(strbuf); continue; }
\r
164 if (!strcmp(strbuf, "vaxofs"))
\r
165 { fscanf(cfg,"%s",strbuf);
\r
166 vaxofs=atoi(strbuf); continue; }
\r
167 if (!strcmp(strbuf, "vayofs"))
\r
168 { fscanf(cfg,"%s",strbuf);
\r
169 vayofs=atoi(strbuf); continue; }
\r
170 if (!strcmp(strbuf, "zexofs"))
\r
171 { fscanf(cfg,"%s",strbuf);
\r
172 zexofs=atoi(strbuf); continue; }
\r
173 if (!strcmp(strbuf, "zeyofs"))
\r
174 { fscanf(cfg,"%s",strbuf);
\r
175 zeyofs=atoi(strbuf); continue; }
\r
176 if (!strcmp(strbuf, "exofs"))
\r
177 { fscanf(cfg,"%s",strbuf);
\r
178 exofs=atoi(strbuf); continue; }
\r
179 if (!strcmp(strbuf, "eyofs"))
\r
180 { fscanf(cfg,"%s",strbuf);
\r
181 eyofs=atoi(strbuf); continue; }
\r
182 if (!strcmp(strbuf, "prxofs"))
\r
183 { fscanf(cfg,"%s",strbuf);
\r
184 prxofs=atoi(strbuf); continue; }
\r
185 if (!strcmp(strbuf, "pryofs"))
\r
186 { fscanf(cfg,"%s",strbuf);
\r
187 pryofs=atoi(strbuf); continue; }
\r
188 if (!strcmp(strbuf, "rsxofs"))
\r
189 { fscanf(cfg,"%s",strbuf);
\r
190 rsxofs=atoi(strbuf); continue; }
\r
191 if (!strcmp(strbuf, "rsyofs"))
\r
192 { fscanf(cfg,"%s",strbuf);
\r
193 rsyofs=atoi(strbuf); continue; }
\r
194 if (!strcmp(strbuf,"vcedprog"))
\r
195 { fscanf(cfg,"%s",vcedprog);
\r