[go: up one dir, main page]

File: a.spc

package info (click to toggle)
sabre 0.2.3-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 4,876 kB
  • ctags: 5,106
  • sloc: cpp: 25,581; ansic: 7,439; sh: 2,063; makefile: 92
file content (224 lines) | stat: -rw-r--r-- 8,137 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
	{
		10500 5200 679 450
		0.865 0.36 0.01
		0.004 1000.0
		0.001 0.001 0.8
		0.03 0.05 0.005
		0.06 0.045 0.33
		5.0 12.0
		5.224 12.224 6.6
		0.03 0.03 0.08
		180 0.003 0.01 20
		0.05 0.05
		12.0
		0.01 0.003
		0.1 2.0
		9.9 0.5
		200
		<0 0 0> 0.03
		1 0
		SABRE
	}
 #define PROP_TYPE 0
 #define JET_TYPE 1
 #define JET_AB_TYPE 2
 #define TURBO_JET_TYPE 3
 #define RADAR_TYPE_MASK 0x07L
 #define PROP_TYPE 0
 #define JET_TYPE 1
 #define JET_AB_TYPE 2
 #define TURBO_JET_TYPE 3
 #define RADAR_TYPE_MASK 0x07L
 class Flight_Specs
 {
public:
	float weight;      /* weight in pounds */
	float mass;        /* mass in slugs (calculated, not in spec file) */
	float max_thrust;  /* maximum thrust in lbs/ft */
	float max_speed;   /* maximum speed in kts */
	float corner_speed; /* optimal control speed */
	float drag_factor; /* drag constant */
	float idrag_factor; /* constant for induced drag */
	float lift_factor; /* lift constant */
	float wing_aoa;	 /* aoa of wing */
	float max_aoa;     /* beyond which, lift is 0 */
	/* Factors increasing drag */
	float drag_aoa, // drag produced by angle of attack
			drag_yaw, // drag produced by yaw
			drag_wb,  // wheel brakes drag
			drag_gr,  // landing gear drag
			drag_ab,  // air brakes drag
			drag_whls; // drag of wheels on ground
	/* Rotational factors */
	// Control factors
	float control_pitch;	// pitching moment produced by elevators/trim,
								// proportional to elevator positon (-30...+30)
	float control_yaw;   // yawing moment produced by rudders
								// proportional to rudder position (-30...+30)
	float control_roll;	// rolling moment produced by ailerons
								// proportional to ailerons (-30...+30)
	// Longitudinal & lattitidunal stability are
	// effected by these
	float return_pitch;	// pitching moment produced to return to 0 angle of attack,
								// proportional to angle of attack
	float return_yaw;		// yawing moment produced to return to 0 yaw
								// proportional to yaw
	// Rotational drag factors
	float pitch_drag;
	float yaw_drag;
	float roll_drag;
	// Damping limits
	float pitch_damp;
	float yaw_damp;
	float roll_damp;
	// landing limits
	float lspeed;  					// maximum speed on ground
	float l_z;     					// minimum vertical velocity
	float l_aoa_max;              // max aoa
	float max_wb;						// max vel for wheel brakes
	// Adverse yaw & roll factors
	float adv_yaw;						// Adverse yaw produced by roll
	float adv_roll;					// Adverse roll produced by yaw
	// More stuff!
	float g_height;               // height above ground, w/ gear down
	float flap_lift;   			   // how much flaps contrib to lift
	float flap_drag;					//   and how much to drag
	float damp_time;					// how much time before applying damp ...
	float wb_damp;						// damping factor for wheel brakes
	float g_limit;						// limit on g's pulled
	float stall_spin;					// adverse spin produced by stalling
	int max_damage;					// Maximum amount of punishment
	// And even more stuff!!
	R_3DPoint view_point;			// Where we look from when we're in
											// the cockpit (in 'port' coords)
	float max_aoa_factor;			// for calc'ing max aoa as a function of vel
	int engine_type;					// 0 = prop, 1 = jet, 2 = jet with afterburner
	long flags;							// general-purpose flags
	char model[9];

	is >> fs.weight >> fs.max_thrust >> fs.max_speed >> fs.corner_speed;
	is >> fs.lift_factor >> fs.max_aoa >> fs.wing_aoa;
	is >> fs.drag_factor >> fs.idrag_factor ;
	is >> fs.drag_aoa >> fs.drag_yaw >> fs.drag_wb;
	is >> fs.drag_gr >> fs.drag_ab >> fs.drag_whls;
	is >> fs.control_pitch >> fs.control_yaw >> fs.control_roll;
	is >> fs.return_pitch >> fs.return_yaw;
	is >> fs.pitch_drag >> fs.yaw_drag >> fs.roll_drag;
	is >> fs.pitch_damp >> fs.yaw_damp >> fs.roll_damp;
	is >> fs.lspeed >> fs.l_z >> fs.l_aoa_max >> fs.max_wb;
	is >> fs.adv_yaw >> fs.adv_roll >> fs.g_height ;
	is >> fs.flap_lift >> fs.flap_drag;
	is >> fs.damp_time >> fs.wb_damp;
	is >> fs.g_limit >> fs.stall_spin;
	is >> fs.max_damage;
	is >> fs.view_point >> fs.max_aoa_factor;
	is >> fs.engine_type >> fs.flags;
	is >> fs.model;
	fs.model[8] = '\0';
 #define PROP_TYPE 0
 #define JET_TYPE 1
 #define JET_AB_TYPE 2
 #define TURBO_JET_TYPE 3
 #define RADAR_TYPE_MASK 0x07L
 class Flight_Specs
 {
public:
	float weight;      /* weight in pounds */
	float mass;        /* mass in slugs (calculated, not in spec file) */
	float max_thrust;  /* maximum thrust in lbs/ft */
	float max_speed;   /* maximum speed in kts */
	float corner_speed; /* optimal control speed */
	float drag_factor; /* drag constant */
	float idrag_factor; /* constant for induced drag */
	float lift_factor; /* lift constant */
	float wing_aoa;	 /* aoa of wing */
	float max_aoa;     /* beyond which, lift is 0 */
	/* Factors increasing drag */
	float drag_aoa, // drag produced by angle of attack
			drag_yaw, // drag produced by yaw
			drag_wb,  // wheel brakes drag
			drag_gr,  // landing gear drag
			drag_ab,  // air brakes drag
			drag_whls; // drag of wheels on ground
	/* Rotational factors */
	// Control factors
	float control_pitch;	// pitching moment produced by elevators/trim,
								// proportional to elevator positon (-30...+30)
	float control_yaw;   // yawing moment produced by rudders
								// proportional to rudder position (-30...+30)
	float control_roll;	// rolling moment produced by ailerons
								// proportional to ailerons (-30...+30)
	// Longitudinal & lattitidunal stability are
	// effected by these
	float return_pitch;	// pitching moment produced to return to 0 angle of attack,
								// proportional to angle of attack
	float return_yaw;		// yawing moment produced to return to 0 yaw
								// proportional to yaw
	// Rotational drag factors
	float pitch_drag;
	float yaw_drag;
	float roll_drag;
	// Damping limits
	float pitch_damp;
	float yaw_damp;
	float roll_damp;
	// landing limits
	float lspeed;  					// maximum speed on ground
	float l_z;     					// minimum vertical velocity
	float l_aoa_max;              // max aoa
	float max_wb;						// max vel for wheel brakes
	// Adverse yaw & roll factors
	float adv_yaw;						// Adverse yaw produced by roll
	float adv_roll;					// Adverse roll produced by yaw
	// More stuff!
	float g_height;               // height above ground, w/ gear down
	float flap_lift;   			   // how much flaps contrib to lift
	float flap_drag;					//   and how much to drag
	float damp_time;					// how much time before applying damp ...
	float wb_damp;						// damping factor for wheel brakes
	float g_limit;						// limit on g's pulled
	float stall_spin;					// adverse spin produced by stalling
	int max_damage;					// Maximum amount of punishment
	// And even more stuff!!
	R_3DPoint view_point;			// Where we look from when we're in
											// the cockpit (in 'port' coords)
	float max_aoa_factor;			// for calc'ing max aoa as a function of vel
	int engine_type;					// 0 = prop, 1 = jet, 2 = jet with afterburner
	long flags;							// general-purpose flags
};
istream & operator >>(istream & is, Flight_Specs &fs)
{
	char c = ' ';
	while (is && c != '{')
		is >> c;
	if (!is)
		return is;

	is >> fs.weight >> fs.max_thrust >> fs.max_speed >> fs.corner_speed;
	is >> fs.lift_factor >> fs.max_aoa >> fs.wing_aoa;
	is >> fs.drag_factor >> fs.idrag_factor ;
	is >> fs.drag_aoa >> fs.drag_yaw >> fs.drag_wb;
	is >> fs.drag_gr >> fs.drag_ab >> fs.drag_whls;
	is >> fs.control_pitch >> fs.control_yaw >> fs.control_roll;
	is >> fs.return_pitch >> fs.return_yaw;
	is >> fs.pitch_drag >> fs.yaw_drag >> fs.roll_drag;
	is >> fs.pitch_damp >> fs.yaw_damp >> fs.roll_damp;
	is >> fs.lspeed >> fs.l_z >> fs.l_aoa_max >> fs.max_wb;
	is >> fs.adv_yaw >> fs.adv_roll >> fs.g_height ;
	is >> fs.flap_lift >> fs.flap_drag;
	is >> fs.damp_time >> fs.wb_damp;
	is >> fs.g_limit >> fs.stall_spin;
	is >> fs.max_damage;
	is >> fs.view_point >> fs.max_aoa_factor;
	is >> fs.engine_type >> fs.flags;
	// m = W/g
	fs.mass = fs.weight / g;
	fs.max_speed = kts2fps(fs.max_speed);
	fs.corner_speed = kts2fps(fs.corner_speed);
	fs.lspeed = kts2fps(fs.lspeed);
	fs.max_wb = kts2fps(fs.max_wb);
	fs.g_height *= world_scale;
	while (is && (c != '}'))
		is >> c;
	return is;
}