---------------------------- Update ----------------------------
| 159 | // Update |
| 160 | //---------------------------- |
| 161 | bool CParticle::Update() |
| 162 | { |
| 163 | // Game pausing can cause dumb time things to happen, so kill the effect in this instance |
| 164 | if ( mTimeStart > theFxHelper.mTime ) |
| 165 | { |
| 166 | return false; |
| 167 | } |
| 168 | |
| 169 | if ( mFlags & FX_RELATIVE ) |
| 170 | { |
| 171 | if ( mClientID < 0 || mClientID >= ENTITYNUM_WORLD ) |
| 172 | { // we are somehow not bolted even though the flag is on? |
| 173 | return false; |
| 174 | } |
| 175 | |
| 176 | vec3_t org; |
| 177 | vec3_t ax[3]; |
| 178 | |
| 179 | // Get our current position and direction |
| 180 | if (mModelNum>=0 && mBoltNum>=0) //bolt style |
| 181 | { |
| 182 | const centity_t ¢ = cg_entities[mClientID]; |
| 183 | if (!cent.gent->ghoul2.IsValid()) |
| 184 | { |
| 185 | return false; |
| 186 | } |
| 187 | |
| 188 | if (!theFxHelper.GetOriginAxisFromBolt(cent, mModelNum, mBoltNum, org, ax)) |
| 189 | { //could not get bolt |
| 190 | return false; |
| 191 | } |
| 192 | } |
| 193 | else |
| 194 | {//fixme change this to bolt style... |
| 195 | vec3_t dir, ang; |
| 196 | |
| 197 | GetOrigin( mClientID, org ); |
| 198 | GetDir( mClientID, dir ); |
| 199 | |
| 200 | vectoangles( dir, ang ); |
| 201 | AngleVectors( ang, ax[0], ax[1], ax[2] ); |
| 202 | } |
| 203 | vec3_t realVel, realAccel; |
| 204 | |
| 205 | VectorMA( org, mOrgOffset[0], ax[0], org ); |
| 206 | VectorMA( org, mOrgOffset[1], ax[1], org ); |
| 207 | VectorMA( org, mOrgOffset[2], ax[2], org ); |
| 208 | |
| 209 | const float time = (theFxHelper.mTime - mTimeStart) * 0.001f; |
| 210 | // calc the real velocity and accel vectors |
| 211 | VectorScale( ax[0], mVel[0], realVel ); |
| 212 | VectorMA( realVel, mVel[1], ax[1], realVel ); |
| 213 | VectorMA( realVel, mVel[2], ax[2], realVel ); |
| 214 | realVel[2] += 0.5f * mGravity * time; |
| 215 | |
| 216 | VectorScale( ax[0], mAccel[0], realAccel ); |
| 217 | VectorMA( realAccel, mAccel[1], ax[1], realAccel ); |
| 218 | VectorMA( realAccel, mAccel[2], ax[2], realAccel ); |
no test coverage detected