1 /*
2  * Triplane Classic - a side-scrolling dogfighting game.
3  * Copyright (C) 1996,1997,2009  Dodekaedron Software Creations Oy
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  * tjt@users.sourceforge.net
19  */
20 
21 #ifndef SETTINGS_H
22 #define SETTINGS_H
23 #include <stdio.h>
24 
25 #define ROSTER_FILENAME "roster.dta"
26 #define MAX_PLAYERS_IN_ROSTER 150
27 #define CONFIGURATION_FILENAME "triplane.cfg"
28 #define KEYSET_FILENAME "keyset.dta"
29 
30 struct keymap {
31     int32_t up;
32     int32_t down;
33     int32_t roll;
34     int32_t power;
35     int32_t guns;
36     int32_t bombs;
37 };
38 
39 extern keymap player_keys[4];
40 
41 //\\ Rosterdata
42 
43 #define ROSTERI_MAGIC 0x5a409187
44 #define ROSTERI_VERSION 0
45 
46 struct rosteri_header {
47     uint32_t magic;
48     uint32_t version;
49 };
50 
51 struct rosteri {
52     char pilotname[32];
53     int32_t solo_mis_flown;
54     int32_t solo_mis_success;
55     int32_t solo_mis_drops;
56     int32_t solo_mis_shotsf;
57     int32_t solo_mis_shotshit;
58     int32_t solo_mis_bombs;
59     int32_t solo_mis_bombshit;
60     int32_t solo_mis_totals;
61     int32_t solo_mis_dropped;
62     int32_t solo_mis_scores[4][7];
63 
64     int32_t multi_mis_flown;
65     int32_t multi_mis_success;
66     int32_t multi_mis_drops;
67     int32_t multi_mis_shotsf;
68     int32_t multi_mis_shotshit;
69     int32_t multi_mis_bombs;
70     int32_t multi_mis_bombshit;
71     int32_t multi_mis_totals;
72     int32_t multi_mis_dropped;
73 
74     int32_t up;
75     int32_t down;
76     int32_t roll;
77     int32_t power;
78     int32_t guns;
79     int32_t bombs;
80 };
81 
82 struct dos_roster {
83     char pilotname[32];
84     int32_t solo_mis_flown;
85     int32_t solo_mis_success;
86     int32_t solo_mis_drops;
87     int32_t solo_mis_shotsf;
88     int32_t solo_mis_shotshit;
89     int32_t solo_mis_bombs;
90     int32_t solo_mis_bombshit;
91     int32_t solo_mis_totals;
92     int32_t solo_mis_dropped;
93     int32_t solo_mis_scores[4][7];
94 
95     int32_t multi_mis_flown;
96     int32_t multi_mis_success;
97     int32_t multi_mis_drops;
98     int32_t multi_mis_shotsf;
99     int32_t multi_mis_shotshit;
100     int32_t multi_mis_bombs;
101     int32_t multi_mis_bombshit;
102     int32_t multi_mis_totals;
103     int32_t multi_mis_dropped;
104 
105     uint8_t up;
106     uint8_t down;
107     uint8_t roll;
108     uint8_t power;
109     uint8_t guns;
110     uint8_t bombs;
111 };
112 
113 
114 extern rosteri roster[MAX_PLAYERS_IN_ROSTER];
115 
116 struct configuration {
117     int32_t current_multilevel;
118     int32_t player_type[4];
119     int32_t player_number[4];
120 
121     // Graphics
122     int32_t shots_visible;
123     int32_t it_shots_visible;
124     int32_t aa_mg_shots_visible;
125     int32_t flags;
126     int32_t flames;
127     int32_t structure_smoke;
128     int32_t svga;
129 
130     // Audio
131     int32_t sound_on;
132     int32_t music_on;
133     int32_t sfx_on;
134     int32_t explosion_sounds;
135     int32_t gunshot_sounds;
136     int32_t ground_i_sounds;
137     int32_t splash;
138     int32_t infantry_sounds;
139 
140     // General Flying
141     int32_t poweronoff;
142     int32_t powerrev;
143 
144     // Multiplayer Game
145     int32_t all_planes_are;
146     int32_t nocollision;
147     int32_t partcollision;
148     int32_t stop;
149     int32_t alliance;
150     int32_t aa_mgs;
151     int32_t it_guns;
152     int32_t infantry;
153     int32_t unlimited_ammo;
154     int32_t unlimited_gas;
155 
156     int32_t joystick[2];
157     int32_t joystick_calibrated[2];
158 
159 
160 };
161 
162 extern configuration config;
163 
164 void load_keyset(void);
165 void save_keyset(void);
166 int select_key(int player, int old);
167 void wait_relase(void);
168 
169 void load_roster(void);
170 void save_roster(void);
171 
172 void load_config(void);
173 void save_config(void);
174 
175 FILE *settings_open(const char *filename, const char *mode);
176 #endif
177