23 #define HALO_SMOOTHING_UP_FACTOR (0.02)
24 #define HALO_SMOOTHING_DOWN_FACTOR (0.01)
25 #define HALO_STEERING_UP_FACTOR (0.00)
26 #define HALO_STEERING_DOWN_FACTOR (0.01)
27 #define HALO_STABILIZATION_RANGE (0.25)
43 if (i < RAND_MAX*percent*scale) {
45 float r1 = rand()/( (
float) RAND_MAX*.5 )-1;
46 float r2 = rand()/( (
float) RAND_MAX*.5 )-1;
47 float r3 = rand()/( (
float) RAND_MAX*.5 )-1;
49 pp.
loc = pos+rand*radial_size*flare;
58 absspeed )*spread+absspeed)+velocity*sspeed,
59 fixed_size ? sciz : (
sqrt( particle_size )*sciz) );
75 unsigned int whichvert = seed%numvert;
87 unsigned int siz = (
unsigned int) ( 2*mush->
rSize() );
119 float activation_accel )
122 ani.push_back(
new Animation(
"flare6.ani", 1, .1,
MIPMAP,
true,
true, col ) );
123 ani.back()->SetDimensions( size.i, size.j );
124 ani.back()->SetPosition( loc );
131 activation = activation_accel*gs;
136 halo.push_back(
MyIndHalo( loc,
Vector( size.i*engine_scale, size.j*engine_scale, size.k*engine_length ) ) );
137 return halo.size()-1;
142 halo[which].size =
size;
144 ani[which]->SetDimensions( size.i, size.j );
149 halo[which].loc = loc;
151 ani[which]->SetPosition( loc );
156 return a > b ? b :
a;
160 return a > b ? a :
b;
164 linaccel =
mymax( 0,
mymin( maxlinaccel, linaccel ) );
167 if (linaccel > olinaccel)
172 linaccel = (1-phase)*linaccel+phase*olinaccel2;
173 linaccel =
mymax( 0,
mymin( maxlinaccel, linaccel ) );
184 if (halo.size() == 0)
187 Vector thrustvector = trans.
getR().Normalize();
188 if (halos_by_velocity) {
189 float linvel = velocity.Dot( thrustvector );
190 return linvel > activation;
192 if (maxaccel <= 0) maxaccel = 1;
193 if (maxvelocity <= 0) maxvelocity = 1;
194 float linaccel =
HaloAccelSmooth( accel.Dot( thrustvector )/maxaccel, oscale, 1.0f );
195 return linaccel > activation*maxaccel;
210 for (
unsigned int i = 0;
i < ani.size(); ++
i) {
211 int bitwise = scale.j;
217 if ( (typ ==
CAR::BRAKE && scale.k < .01 && scale.k > -.01) )
228 float blink_prob = .8;
231 if (rand() < RAND_MAX*blink_prob)
235 if (rand() < RAND_MAX*blink_prob)
238 ani[
i]->SetPosition(
Transform( trans, halo[
i].loc ) );
239 ani[
i]->SetDimensions( scale.i, scale.i );
244 if (halo_alpha >= 0) {
246 if ( (halo_alpha&0x1) == 0 )
251 Vector thrustvector = trans.
getR().Normalize();
252 if (maxaccel <= 0) maxaccel = 1;
253 if (maxvelocity <= 0) maxvelocity = 1;
254 float value, maxvalue, minvalue;
255 if (halos_by_velocity) {
256 value = velocity.Dot( thrustvector );
257 maxvalue =
sqrt( maxvelocity );
258 minvalue = activation;
260 oscale =
HaloAccelSmooth( accel.Dot( thrustvector )/maxaccel, oscale, 1.0f );
263 minvalue = activation/maxaccel;
265 if ( (value > minvalue) && (scale.k > 0) ) {
266 vector< MyIndHalo >::iterator
i = halo.begin();
267 for (; i != halo.end(); ++i) {
269 ScaleMatrix( m,
Vector( scale.i*i->size.i, scale.j*i->size.j, scale.k*i->size.k*value/maxvalue ) );
280 if (value>maxvalue*percentColorChange) {
281 float test=value-maxvalue*percentColorChange;
282 test/=maxvalue*percentColorChange;
283 if (!(test<1.0)) test=1.0;
284 blend=
GFXColor(abRedness*test+percentRedness*(1.0-test),abGreenness*test+percentGreenness*(1.0-test),abBlueness*test+percentBlueness*(1.0-test),1.0);
294 mesh->
Draw( 50000000000000.0, m, 1, halo_alpha, nebdist, 0,
false,&xtraFX );
295 if (hullpercent < .99) {
298 int spawn = (
int) (sparkle_accum);
299 sparkle_accum -= spawn;
310 for (
unsigned int i = 0;
i < ani.size();
i++)