Пример #1
0
//----------------------------
bool CEmitter::Update()
{
	// Game pausing can cause dumb time things to happen, so kill the effect in this instance
	if ( mTimeStart > theFxHelper.mTime )
	{
		return false;
	}
		
	// Use this to track if we've stopped moving
	VectorCopy( mOrigin1, mOldOrigin );
	VectorCopy( mVel, mOldVelocity );

	if (( mTimeStart < theFxHelper.mTime ) && UpdateOrigin() == false )
	{
		// we are marked for death
		return false;
	}

	// If the thing is no longer moving, kill the angle delta, but don't do it too quickly or it will
	//	look very artificial.  Don't do it too slowly or it will look like there is no friction.
	if ( VectorCompare( mOldOrigin, mOrigin1 ))
	{
		VectorScale( mAngleDelta, 0.7f, mAngleDelta );
	}

	UpdateAngles();
	UpdateSize();
//	UpdateRGB();	// had wanted to do something slick whereby an emitted effect could somehow inherit these
//	UpdateAlpha();	// values, but it's not a priority right now.

	Draw();

	return true;
}
Пример #2
0
//----------------------------
// Update
//----------------------------
bool COrientedParticle::Update()
{
	// Game pausing can cause dumb time things to happen, so kill the effect in this instance
	if ( mTimeStart > theFxHelper.mTime )
	{
		return false;
	}
		
	if (( mTimeStart < theFxHelper.mTime ) && UpdateOrigin() == false )
	{
		// we are marked for death
		return false;
	}

	if ( !Cull())
	{
		UpdateSize();
		UpdateRGB();
		UpdateAlpha();
		UpdateRotation();

		Draw();
	}

	return true;
}
Пример #3
0
bool FXPrimitive::Update( void )
{
	//Move the object
	UpdateOrigin();

	UpdateScale();
	UpdateAlpha();
	UpdateRGB();

	return true;
}
Пример #4
0
bool FXTrail::Update( void )
{
	//Move the object
	UpdateOrigin();

	UpdateTailPoint();

	UpdateScale();
	UpdateAlpha();
	UpdateRGB();

	return true;
}
Пример #5
0
bool FXSprite::Update( void )
{
	if (m_start_time > cg.time)
	{//i was created in the future, right after un-pausing
		return false;
	}
	//Move the object
	UpdateOrigin();

	UpdateRoll();
	UpdateScale();
	UpdateAlpha();
	UpdateRGB();

	return true;
}
Пример #6
0
//----------------------------
// Update
//----------------------------
bool CPoly::Update()
{
	vec3_t mOldOrigin;
	
	// Game pausing can cause dumb time things to happen, so kill the effect in this instance
	if ( mTimeStart > theFxHelper.mTime )
	{
		return false;
	}

	// If our timestamp hasn't exired yet, we won't even consider doing any kind of motion
	if ( theFxHelper.mTime > mTimeStamp )
	{
		VectorCopy( mOrigin1, mOldOrigin );

		if (( mTimeStart < theFxHelper.mTime ) && UpdateOrigin() == false )
		{
			// we are marked for death
			return false;
		}
	}

	if ( !Cull() )
	{
		// only rotate when our start timestamp has expired
		if ( theFxHelper.mTime > mTimeStamp )
		{
			// Only rotate whilst moving
			if ( !VectorCompare( mOldOrigin, mOrigin1 ))
			{
				Rotate();
			}
		}

		UpdateRGB();
		UpdateAlpha();

		Draw();
	}

	return true;
}
Пример #7
0
bool FXSpawner::Update( void )
{
	UpdateOrigin();
	UpdateVelocity();
	UpdateScale();
	UpdateAlpha();
	
	//FIXME: This is being double called...
	if ( Cull() == false )
	{
		if ( m_nextThink < cg.time )
		{
			if (Think != NULL)
				Think( m_origin, m_angles, m_velocity, m_startRGB );

			m_nextThink = cg.time + ( ( m_delay + ( m_variance * crandom() )) );

			if ( m_flags & FXF_SPAWN_ONCE )
				return false;
		}
	}
	
	return true;
}
Пример #8
0
//----------------------------
bool CTail::Update()
{
	// Game pausing can cause dumb time things to happen, so kill the effect in this instance
	if ( mTimeStart > theFxHelper.mTime )
	{
		return false;
	}
	
	if ( !fx_freeze.integer )
	{
		VectorCopy( mOrigin1, mOldOrigin );
	}

	if ( mFlags & FX_RELATIVE )
	{
		if ( mClientID < 0 || mClientID >= ENTITYNUM_WORLD )
		{
			// the thing we are bolted to is no longer valid, so we may as well just die.
			return false;
		}

		vec3_t	dir, org;
//		vec3_t	right, up;
		vec3_t 	realVel, realAccel;

		// Get our current position and direction
		GetOrigin( mClientID, org );
		GetDir( mClientID, dir );

		vec3_t ang, ax[3];

		vectoangles( dir, ang );
		AngleVectors( ang, ax[0], ax[1], ax[2] );

		VectorMA( org, mOrgOffset[0], ax[0], org );
		VectorMA( org, mOrgOffset[1], ax[1], org );
		VectorMA( org, mOrgOffset[2], ax[2], org );

		// calc the real velocity and accel vectors
		// FIXME: if you want right and up movement in addition to the forward movement, you'll have to convert dir into a set of perp. axes and do some extra work
		VectorScale( ax[0], mVel[0], realVel );
		VectorMA( realVel, mVel[1], ax[1], realVel );
		VectorMA( realVel, mVel[2], ax[2], realVel );

		VectorScale( ax[0], mAccel[0], realAccel );
		VectorMA( realAccel, mAccel[1], ax[1], realAccel );
		VectorMA( realAccel, mAccel[2], ax[2], realAccel );

		// Get our real velocity at the current time, taking into account the effects of acceleration.  NOTE: not sure if this is even 100% correct math-wise
		VectorMA( realVel, (theFxHelper.mTime - mTimeStart) * 0.001f, realAccel, realVel );

		// Now move us to where we should be at the given time
		VectorMA( org, (theFxHelper.mTime - mTimeStart) * 0.001f, realVel, mOrigin1 );

		// Just calc an old point some time in the past, doesn't really matter when
		VectorMA( org, ((theFxHelper.mTime - mTimeStart) - 3) * 0.001f, realVel, mOldOrigin );
	}
	else if (( mTimeStart < theFxHelper.mTime ) && UpdateOrigin() == false )
	{
		// we are marked for death
		return false;
	}

	if ( !Cull() )
	{
		UpdateSize();
		UpdateLength();
		UpdateRGB();
		UpdateAlpha();

		CalcNewEndpoint();

		Draw();
	}

	return true;
}
Пример #9
0
//----------------------------
// Update
//----------------------------
bool CParticle::Update()
{
	// Game pausing can cause dumb time things to happen, so kill the effect in this instance
	if ( mTimeStart > theFxHelper.mTime )
	{
		return false;
	}

	if ( mFlags & FX_RELATIVE )
	{
		if ( mClientID < 0 || mClientID >= ENTITYNUM_WORLD )
		{
			// we are somehow not bolted even though the flag is on?
			return false;
		}

		vec3_t	dir, org;
		vec3_t 	realVel, realAccel;
		float	time = (theFxHelper.mTime - mTimeStart) * 0.001f;

		// Get our current position and direction
		GetOrigin( mClientID, org );
		GetDir( mClientID, dir );
	
		vec3_t ang, ax[3];

		vectoangles( dir, ang );
		AngleVectors( ang, ax[0], ax[1], ax[2] );
//		VectorCopy( dir, ax[0] );

//		CrossProduct( up, ax[0], ax[1] );
//		VectorNormalize( ax[1] );
//		CrossProduct( ax[0], ax[1], ax[2] );

		VectorMA( org, mOrgOffset[0], ax[0], org );
		VectorMA( org, mOrgOffset[1], ax[1], org );
		VectorMA( org, mOrgOffset[2], ax[2], org );

		// calc the real velocity and accel vectors
		VectorScale( ax[0], mVel[0], realVel );
		VectorMA( realVel, mVel[1], ax[1], realVel );
		VectorMA( realVel, mVel[2], ax[2], realVel );
		realVel[2] += 0.5f * mGravity * time;

		VectorScale( ax[0], mAccel[0], realAccel );
		VectorMA( realAccel, mAccel[1], ax[1], realAccel );
		VectorMA( realAccel, mAccel[2], ax[2], realAccel );

		// Get our real velocity at the current time, taking into account the effects of acceleartion.  NOTE: not sure if this is even 100% correct math-wise
		VectorMA( realVel, time, realAccel, realVel );

		// Now move us to where we should be at the given time
		VectorMA( org, time, realVel, mOrigin1 );
		
	}
	else if (( mTimeStart < theFxHelper.mTime ) && UpdateOrigin() == false )
	{
		// we are marked for death
		return false;
	}

	if ( !Cull())
	{
		UpdateSize();
		UpdateRGB();
		UpdateAlpha();
		UpdateRotation();

		Draw();
	}

	return true;
}
Пример #10
0
// read solutions -----------------------------------------------------------
void __fastcall TPlot::ReadSol(TStrings *files, int sel)
{
    solbuf_t sol={0};
    AnsiString s;
    gtime_t ts,te;
    double tint;
    int i,n=0;
    char *paths[MAXNFILE]={""};
    
    trace(3,"ReadSol: sel=%d\n",sel);
    
    if (files->Count<=0) return;
    
    ReadWaitStart();
    
    for (i=0;i<files->Count&&n<MAXNFILE;i++) {
        paths[n++]=files->Strings[i].c_str();
    }
    TimeSpan(&ts,&te,&tint);
    
    ShowMsg(s.sprintf("reading %s...",paths[0]));
    ShowLegend(NULL);
    
    if (!readsolt(paths,n,ts,te,tint,0,&sol)) {
        ShowMsg(s.sprintf("no solution data : %s...",paths[0]));
        ShowLegend(NULL);
        ReadWaitEnd();
        return;
    }
    freesolbuf(SolData+sel);
    SolData[sel]=sol;
    
    if (SolFiles[sel]!=files) {
        SolFiles[sel]->Assign(files);
    }
    Caption="";
    
    ReadSolStat(files,sel);
    
    for (i=0;i<2;i++) {
        if (SolFiles[i]->Count==0) continue;
        Caption=Caption+SolFiles[i]->Strings[0]+(SolFiles[i]->Count>1?"... ":" ");
    }
    BtnSol12->Down=False;
    if (sel==0) BtnSol1->Down=true;
    else        BtnSol2->Down=true;
    
    if (sel==0||SolData[0].n<=0) {
        time2gpst(SolData[sel].data[0].time,&Week);
        UpdateOrigin();
    }
    SolIndex[0]=SolIndex[1]=ObsIndex=0;
    
    if (PlotType>PLOT_NSAT) {
        UpdateType(PLOT_TRK);
    }
    else {
        UpdatePlotType();
    }
    FitTime();
    if (AutoScale&&PlotType<=PLOT_SOLA) {
        FitRange(1);
    }
    else {
        SetRange(1,YRange);
    }
    UpdateTime();
    UpdatePlot();
    
    ReadWaitEnd();
}