//----------------------------------------------------------------------------- // This will change things so the abs position matches the requested spot //----------------------------------------------------------------------------- void CBeam::SetAbsStartPos( const Vector &pos ) { if (!GetMoveParent()) { SetStartPos( pos ); return; } Vector vecLocalPos; matrix3x4_t worldToBeam; MatrixInvert( EntityToWorldTransform(), worldToBeam ); VectorTransform( pos, worldToBeam, vecLocalPos ); SetStartPos( vecLocalPos ); }
void CLogicBall::SetBallState( BALL_STATE eState, SVector vecInitPos, SVector vecInitVel, float fTimeElapsed) { m_ePreState = m_eCurState; m_eCurState = eState; if( eState == STATE_USEBALL_SHOOT ) { m_pShootSolution->SetStartPosition( vecInitPos ); m_fTimeElapsed = fTimeElapsed; SetStartVelocity(vecInitVel); m_f3SecondElap = 0.0f; } else if( eState == STATE_LOSEBALL ) { SetStartPos(vecInitPos); SetStartVelocity(vecInitVel); m_fTimeElapsed = fTimeElapsed; m_f3SecondElap = 0.0f; /* CInterfaceLayer *pInterfaceLayer_Game = m_pGSystem->GetResourceSys()->GetInterfaceLayer(FACTORY_ID_INTERFACELAYER_GAME); B_COM_INIT(); int nAdd = -1; B_COM_ADD_VALUE(nAdd); B_COM_SEND(pInterfaceLayer_Game, CInterfaceLayer_Game::Com_BallerID); */ } }
void CBeam::HoseInit( const Vector &start, const Vector &direction ) { SetType( BEAM_HOSE ); SetStartPos( start ); SetEndPos( direction ); SetStartAttachment( 0 ); SetEndAttachment( 0 ); RelinkBeam(); }
void CBeam::PointEntInit( const Vector &start, int endIndex ) { SetType( BEAM_ENTPOINT ); SetStartPos( start ); SetEndEntity( endIndex ); SetStartAttachment( 0 ); SetEndAttachment( 0 ); RelinkBeam(); }
void CBeam::PointsInit( const Vector &start, const Vector &end ) { SetType( BEAM_POINTS ); SetStartPos( start ); SetEndPos( end ); SetStartAttachment( 0 ); SetEndAttachment( 0 ); RelinkBeam(); }
void CLogicBall::SetState_LoseBall(SVector vecInitPos, SVector vecInitVel, float fTimeElapsed) { m_eCurState = STATE_LOSEBALL; SetStartPos(vecInitPos); SetStartVelocity(vecInitVel); m_fTimeElapsed = fTimeElapsed; }
void CBeam::PointEntInit( const Vector &start, CBaseEntity *pEndEntity ) { SetType( BEAM_ENTPOINT ); m_nNumBeamEnts = 2; SetStartPos( start ); SetEndEntity( pEndEntity ); SetStartAttachment( 0 ); SetEndAttachment( 0 ); RelinkBeam(); }
void Tank::TrackAnimation() { ++_TrackUpdateFrame; if (_TrackUpdateFrame == FPS * TRACKPOINT_CREATE_CYCLE) { auto trackPoint = TrackPoint::Create(); trackPoint->SetPosition(_Bullet->GetPosition()); trackPoint->SetVisible(false); this->AddChild(trackPoint); _Track.push_back(trackPoint); _TrackUpdateFrame = 0; } for (auto iter = _Track.begin(); iter != _Track.end();) { auto trackPoint = *iter; trackPoint->SetStartPos(_Bullet->GetPosition()); trackPoint->SetLife(TRACKPOINT_LIFE); trackPoint->SetPower(_Power); trackPoint->SetAngle(D3DXToRadian(_DegreeAngle)); trackPoint->Update(); if (!trackPoint->IsActive()) { trackPoint->Release(); iter = _Track.erase(iter); } else { ++iter; } } }
void CLightning::BeamUpdateVars( void ) { int beamType; int pointStart, pointEnd; edict_t *pStart = FIND_ENTITY_BY_TARGETNAME ( NULL, STRING(m_iszStartEntity) ); edict_t *pEnd = FIND_ENTITY_BY_TARGETNAME ( NULL, STRING(m_iszEndEntity) ); pointStart = IsPointEntity( CBaseEntity::Instance(pStart) ); pointEnd = IsPointEntity( CBaseEntity::Instance(pEnd) ); pev->skin = 0; pev->sequence = 0; pev->rendermode = 0; pev->flags |= FL_CUSTOMENTITY; pev->model = m_iszSpriteName; SetTexture( m_spriteTexture ); beamType = BEAM_ENTS; if ( pointStart || pointEnd ) { if ( !pointStart ) // One point entity must be in pStart { edict_t *pTemp; // Swap start & end pTemp = pStart; pStart = pEnd; pEnd = pTemp; int swap = pointStart; pointStart = pointEnd; pointEnd = swap; } if ( !pointEnd ) beamType = BEAM_ENTPOINT; else beamType = BEAM_POINTS; } SetType( beamType ); if ( beamType == BEAM_POINTS || beamType == BEAM_ENTPOINT || beamType == BEAM_HOSE ) { SetStartPos( pStart->v.origin ); if ( beamType == BEAM_POINTS || beamType == BEAM_HOSE ) SetEndPos( pEnd->v.origin ); else SetEndEntity( ENTINDEX(pEnd) ); } else { SetStartEntity( ENTINDEX(pStart) ); SetEndEntity( ENTINDEX(pEnd) ); } RelinkBeam(); SetWidth( m_boltWidth ); SetNoise( m_noiseAmplitude ); SetFrame( m_frameStart ); SetScrollRate( m_speed ); if ( pev->spawnflags & SF_BEAM_SHADEIN ) SetFlags( BEAM_FSHADEIN ); else if ( pev->spawnflags & SF_BEAM_SHADEOUT ) SetFlags( BEAM_FSHADEOUT ); }