1 #ifndef __UNIT_PHYSICS_CPP__
2 #define __UNIT_PHYSICS_CPP__
35 #include "gfx/planetary_transform.h"
48 template <
class UnitType >
60 UnitType::UpdatePhysics2( trans, old_physical_state, accel, difficulty, transmat, cum_vel, lastframe, uc );
70 ClientState cstmp( this->serial, this->curr_physical_state, this->Velocity, accel, this->AngularVelocity, 0 );
73 this->AddVelocity( difficulty );
79 this->AddVelocity( difficulty );
82 this->AddVelocity( difficulty );
88 this->AddVelocity( difficulty );
90 #ifdef DEPRECATEDPLANETSTUFF
93 curr_physical_state.to_matrix( this->cumulative_transformation_matrix );
96 planet->trans->InvTransformBasis( this->cumulative_transformation_matrix, p, q, r, c );
100 this->cumulative_transformation = this->curr_physical_state;
101 this->cumulative_transformation.Compose( trans, transmat );
102 this->cumulative_transformation.to_matrix( this->cumulative_transformation_matrix );
103 this->cumulative_velocity =
TransformNormal( transmat, this->Velocity )+cum_vel;
108 for (i = 0; i < this->meshdata.size(); i++) {
109 if (!this->meshdata[i])
111 tmp |= this->meshdata[i]->HasBeenDrawn();
112 if ( !this->meshdata[i]->HasBeenDrawn() )
114 this->meshdata[i]->UnDraw();
117 if (!tmp && this->hull < 0)
125 template <
class UnitType >
128 if (this->afterburntype == 0)
129 afterburn = afterburn && this->energy > this->afterburnenergy*
SIMULATION_ATOM;
130 if (this->afterburntype == 1)
131 afterburn = afterburn && this->fuel > 0;
132 if (this->afterburntype == 2)
133 afterburn = afterburn && this->warpenergy > 0;
136 static bool must_afterburn_to_buzz =
140 "player_afterburner",
141 "sfx10.wav" ), true );
149 }
else if (afterburn || !must_afterburn_to_buzz) {
157 playa ) < buzzingdistance && playa->
owner !=
this && this->owner != playa
160 if (ttime-lastbuzz > buzzingtime) {
162 Vector vel = this->GetVelocity();
165 float dotprod = vel.Dot( pvel );
168 AUDPlay( this->sound->engine, this->Position(), this->GetVelocity(), 1 );
176 template <
class UnitType >
179 #ifndef PERFRAMESOUND
180 AUDAdjustSound( this->sound->engine, this->cumulative_transformation.position, this->cumulative_velocity );