34 static int drive_value[] = {
35 1, 1, 1, 1, 1, 1, 1, 1
38 static float drive_light[] = {
39 10.0f, 100.0f, 5.0f, 1.0e3f, 100.0f, 10.0f, 0.0f, 0.0f
46 static Sound* sound_resource[3] = { 0, 0, 0 };
48 #define CLAMP(x, a, b) if (x < (a)) x = (a); else if (x > (b)) x = (b);
53 : loc(l), flare(0), trail(0), scale(s)
65 :
System(DRIVE, drive_type,
"Drive", drive_value[drive_type],
66 max_thrust*2, max_thrust*2, max_thrust*2),
67 thrust(max_thrust), augmenter(max_aug), scale(0.0f),
68 throttle(0.0f), augmenter_throttle(0.0f), intensity(0.0f),
69 sound(0), burner_sound(0), show_trail(show)
94 :
System(d), thrust(d.thrust), augmenter(d.augmenter), scale(d.scale),
95 throttle(0.0f), augmenter_throttle(0.0f), intensity(0.0f),
96 sound(0), burner_sound(0), show_trail(d.show_trail)
103 for (
int i = 0; i < d.
ports.
size(); i++) {
134 static int initialized = 0;
135 if (initialized)
return;
166 loader->
LoadSound(
"engine.wav", sound_resource[0], SOUND_FLAGS);
167 loader->
LoadSound(
"burner2.wav", sound_resource[1], SOUND_FLAGS);
168 loader->
LoadSound(
"rumble.wav", sound_resource[2], SOUND_FLAGS);
171 if (sound_resource[0])
174 if (sound_resource[1])
177 if (sound_resource[2])
188 for (
int i = 0; i < 3; i++) {
189 delete sound_resource[i];
190 sound_resource[i] = 0;
206 if (flare_scale == 0) flare_scale =
scale;
220 if (flare_scale <= 0)
224 glow_bmp = drive_glow_bitmap[
subtype];
231 flare_rep->
Scale(flare_scale * 1.5);
233 port->
flare = flare_rep;
237 Bolt* trail_rep =
new(__FILE__,__LINE__)
Bolt(flare_scale * 30, flare_scale * 8, trail_bmp,
true);
238 port->
trail = trail_rep;
258 Point projector = (p->
loc * orientation) + ship_loc;
284 static double drive_seconds=0;
289 double spool = 1.2 * drive_seconds;
290 double throttle_request = t / 100;
293 if (throttle_request-
throttle < spool) {
294 throttle = (float) throttle_request;
301 else if (
throttle > throttle_request) {
302 if (
throttle - throttle_request < spool) {
303 throttle = (float) throttle_request;
360 return ports[port]->flare;
370 return ports[port]->trail;
381 drive_seconds = seconds;
401 int vol_aug = -10000;
402 double fraction = output /
thrust;
418 vol = (int) ((
intensity - 1.0) * 10000.0);
419 CLAMP(vol, -10000, -1500);
423 CLAMP(vol_aug, -10000, -1000);
446 if (sound_resource[sound_index])
451 if (sound_resource[1])
458 if (
sound && dist < sound->GetMaxDistance()) {
471 if (vol_aug > max_vol)