38 static Sound* thruster_resource = 0;
39 static Sound* thruster_sound = 0;
44 #define CLAMP(x, a, b) if (x < (a)) x = (a); else if (x > (b)) x = (b);
49 : type(t),
loc(l), flare(0), trail(0), fire(f), burn(0), scale(s)
60 static int sys_value = 2;
65 :
System(DRIVE, dtype,
"Thruster", sys_value,
66 max_thrust, max_thrust, max_thrust),
67 ship(0), thrust(1.0f), scale(flare_scale),
68 avail_x(1.0f), avail_y(1.0f), avail_z(1.0f)
86 thrust(1.0f), scale(t.scale),
87 avail_x(1.0f), avail_y(1.0f), avail_z(1.0f)
95 for (
int i = 0; i < t.
ports.
size(); i++) {
108 if (thruster_sound && thruster_sound->
IsPlaying()) {
109 thruster_sound->
Stop();
118 static int initialized = 0;
119 if (initialized)
return;
129 loader->
LoadSound(
"thruster.wav", thruster_resource, SOUND_FLAGS);
132 if (thruster_resource)
141 delete thruster_resource;
142 thruster_resource = 0;
144 if (thruster_sound) {
145 thruster_sound->
Stop();
157 bool hide_all =
false;
176 Point projector = (p->
loc * orientation) + ship_loc;
182 double intensity = p->
burn;
184 if (intensity > 0.5 && !hide_all) {
186 double len = -50 * p->
scale * intensity;
197 default: t->
Hide();
break;
217 double rr = 0, pr = 0, yr = 0;
218 double rd = 0, pd = 0, yd = 0;
287 const double ROLL_SPEED =
PI * 0.0400;
288 const double PITCH_SPEED =
PI * 0.0250;
289 const double YAW_SPEED =
PI * 0.0250;
308 double agility = design->
agility;
342 if (thruster_sound && thruster_sound->
IsPlaying())
343 thruster_sound->
Stop();
354 bool sound_on =
false;
355 bool show_flare =
true;
406 for (
int i = 0; i < 12; i++) {
421 for (
int n = 0; n < 12; n++) {
462 if (!thruster_sound) {
463 if (thruster_resource)
464 thruster_sound = thruster_resource->
Duplicate();
467 if (thruster_sound) {
475 if (volume > max_vol)
478 if (dist < thruster_sound->GetMaxDistance()) {
481 thruster_sound->
Play();
484 thruster_sound->
Stop();
488 thruster_sound->
Stop();
504 if (flare_scale == 0) flare_scale =
scale;
516 Sprite* flare_rep =
new(__FILE__,__LINE__)
Sprite(flare_bmp);
517 flare_rep->
Scale(flare_scale * 0.667f);
520 Bolt* trail_rep =
new(__FILE__,__LINE__)
Bolt(flare_scale * 30, flare_scale * 8, trail_bmp,
true);
523 port->
flare = flare_rep;
524 port->
trail = trail_rep;
540 if (engine >= 0 && engine <
ports.
size())
541 return ports[engine]->flare;
549 if (engine >= 0 && engine <
ports.
size())
550 return ports[engine]->trail;
589 for (
int i = 0; i < 12; i++)