MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Update

Method Update

code/cgame/FxPrimitives.cpp:161–244  ·  view source on GitHub ↗

---------------------------- Update ----------------------------

Source from the content-addressed store, hash-verified

159// Update
160//----------------------------
161bool 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 &cent = 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 );

Callers 1

FX_AddFunction · 0.45

Calls 13

vectoanglesFunction · 0.85
AngleVectorsFunction · 0.85
VectorScaleFunction · 0.85
VectorAddFunction · 0.85
VectorCopyFunction · 0.85
VectorCompareFunction · 0.85
GetOriginFunction · 0.70
GetDirFunction · 0.70
VectorMAFunction · 0.50
IsValidMethod · 0.45
GetOriginAxisFromBoltMethod · 0.45
TraceMethod · 0.45

Tested by

no test coverage detected