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

Method UpdateOrigin

code/cgame/FxPrimitives.cpp:249–356  ·  view source on GitHub ↗

---------------------------- Update Origin ----------------------------

Source from the content-addressed store, hash-verified

247// Update Origin
248//----------------------------
249bool CParticle::UpdateOrigin()
250{
251 vec3_t new_origin;
252// float ftime, time2;
253
254 UpdateVelocity();
255
256 // Calc the time differences
257// ftime = theFxHelper.mFrameTime * 0.001f;
258 //time2 = ftime * ftime * 0.5f;
259// time2=0;
260
261 // Predict the new position
262 new_origin[0] = mOrigin1[0] + theFxHelper.mFloatFrameTime * mVel[0];// + time2 * mVel[0];
263 new_origin[1] = mOrigin1[1] + theFxHelper.mFloatFrameTime * mVel[1];// + time2 * mVel[1];
264 new_origin[2] = mOrigin1[2] + theFxHelper.mFloatFrameTime * mVel[2];// + time2 * mVel[2];
265
266 // Only perform physics if this object is tagged to do so
267 if ( (mFlags & FX_APPLY_PHYSICS) )
268 {
269 bool solid;
270
271 if ( (mFlags&FX_EXPENSIVE_PHYSICS)
272 && fx_expensivePhysics.integer )
273 {
274 solid = true; // by setting this to true, we force a real trace to happen
275 }
276 else
277 {
278 // if this returns solid, we need to do a trace
279 solid = !!(CG_PointContents( new_origin, ENTITYNUM_WORLD ) & ( MASK_SHOT | CONTENTS_WATER ));
280 }
281
282 if ( solid )
283 {
284 trace_t trace;
285 float dot;
286
287 if ( mFlags & FX_USE_BBOX )
288 {
289 if (mFlags & FX_GHOUL2_TRACE)
290 {
291 theFxHelper.G2Trace( &trace, mOrigin1, mMin, mMax, new_origin, ENTITYNUM_NONE, ( MASK_SHOT | CONTENTS_WATER ) );
292 }
293 else
294 {
295 theFxHelper.Trace( &trace, mOrigin1, mMin, mMax, new_origin, -1, ( MASK_SHOT | CONTENTS_WATER ) );
296 }
297 }
298 else
299 {
300 if (mFlags & FX_GHOUL2_TRACE)
301 {
302 theFxHelper.G2Trace( &trace, mOrigin1, NULL, NULL, new_origin, ENTITYNUM_NONE, ( MASK_SHOT | CONTENTS_WATER ) );
303 }
304 else
305 {
306 theFxHelper.Trace( &trace, mOrigin1, NULL, NULL, new_origin, -1, ( MASK_SHOT | CONTENTS_WATER ) );

Callers

nothing calls this directly

Calls 9

DotProductFunction · 0.85
VectorScaleFunction · 0.85
VectorClearFunction · 0.85
VectorCopyFunction · 0.85
CG_PointContentsFunction · 0.70
VectorMAFunction · 0.50
G2TraceMethod · 0.45
TraceMethod · 0.45
PlayEffectMethod · 0.45

Tested by

no test coverage detected