static void MouseMotion(AG_Event *event) { AG_HSVPal *pal = AG_SELF(); int x = AG_INT(1); int y = AG_INT(2); switch (pal->state) { case AG_HSVPAL_SEL_NONE: break; case AG_HSVPAL_SEL_H: UpdateHue(pal, x - pal->circle.x, y - pal->circle.y); break; case AG_HSVPAL_SEL_SV: UpdateSV(pal, x, y); break; case AG_HSVPAL_SEL_A: UpdateAlpha(pal, x); break; default: break; } }
//----------------------------------------------------------------------------- // Purpose: Simulate motion and render all child particles // Input : *pInParticle - // *pDraw - // &sortKey - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CSimpleEmitter::SimulateAndRender( Particle *pInParticle, ParticleDraw *pDraw, float &sortKey) { SimpleParticle *pParticle = (SimpleParticle *) pInParticle; float timeDelta = pDraw->GetTimeDelta(); //Render Vector tPos; TransformParticle( g_ParticleMgr.GetModelView(), pParticle->m_Pos, tPos ); sortKey = (int) tPos.z; //Render it RenderParticle_ColorSizeAngle( pDraw, tPos, UpdateColor( pParticle, timeDelta ), UpdateAlpha( pParticle, timeDelta ) * GetAlphaDistanceFade( tPos, m_flNearClipMin, m_flNearClipMax ), UpdateScale( pParticle, timeDelta ), UpdateRoll( pParticle, timeDelta ) ); //Update velocity UpdateVelocity( pParticle, timeDelta ); pParticle->m_Pos += pParticle->m_vecVelocity * timeDelta; //Should this particle die? pParticle->m_flLifetime += timeDelta; if ( pParticle->m_flLifetime >= pParticle->m_flDieTime ) return false; return true; }
bool FXBezier::Update( void ) { vec3_t new_origin; float ftime, time2; VectorMA( m_control1_velocity, cg.frametime * 0.001f, m_control1_acceleration, m_control1_velocity ); VectorMA( m_control2_velocity, cg.frametime * 0.001f, m_control2_acceleration, m_control2_velocity ); ftime = cg.frametime * 0.001f; time2 = ftime * ftime * 0.5f; for ( int i = 0 ; i < 3 ; i++ ) { new_origin[i] = m_control1[i] + ftime * m_control1_velocity[i] + time2 * m_control1_velocity[i]; } VectorCopy( new_origin, m_control1 ); for ( i = 0 ; i < 3 ; i++ ) { new_origin[i] = m_control2[i] + ftime * m_control2_velocity[i] + time2 * m_control2_velocity[i]; } VectorCopy( new_origin, m_control2 ); UpdateAlpha(); UpdateScale(); UpdateRGB(); return true; }
//---------------------------- // 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; }
void CLocalSpaceEmitter::RenderParticles( CParticleRenderIterator *pIterator ) { const matrix3x4_t &mLocalToWorld = GetTransformMatrix(); const VMatrix &mModelView = ParticleMgr()->GetModelView(); const SimpleParticle *pParticle = (const SimpleParticle *)pIterator->GetFirst(); while ( pParticle ) { // Transform it Vector screenPos, worldPos; VectorTransform( pParticle->m_Pos, mLocalToWorld, worldPos ); // Correct viewmodel squashing if ( m_fFlags & FLE_VIEWMODEL ) { FormatViewModelAttachment( NULL, worldPos, false ); } TransformParticle( mModelView, worldPos, screenPos ); float sortKey = (int) screenPos.z; // Render it RenderParticle_ColorSizeAngle( pIterator->GetParticleDraw(), screenPos, UpdateColor( pParticle ), UpdateAlpha( pParticle ) * GetAlphaDistanceFade( screenPos, m_flNearClipMin, m_flNearClipMax ), UpdateScale( pParticle ), pParticle->m_flRoll ); pParticle = (const SimpleParticle *)pIterator->GetNext( sortKey ); } }
bool FXQuad::Update( void ) { UpdateRoll(); UpdateScale(); UpdateAlpha(); UpdateRGB(); return true; }
bool FXCylinder::Update( void ) { UpdateScale(); UpdateHeight(); UpdateAlpha(); UpdateRGB(); return true; }
bool FXPrimitive::Update( void ) { //Move the object UpdateOrigin(); UpdateScale(); UpdateAlpha(); UpdateRGB(); return true; }
bool FXTrail::Update( void ) { //Move the object UpdateOrigin(); UpdateTailPoint(); UpdateScale(); UpdateAlpha(); UpdateRGB(); return true; }
//---------------------------- bool CLine::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, end; trace_t trace; // Get our current position and direction GetOrigin( mClientID, mOrigin1 ); GetDir( mClientID, dir ); if ( mFlags & FX_APPLY_PHYSICS ) { VectorMA( mOrigin1, 2048, dir, end ); theFxHelper.Trace( &trace, mOrigin1, NULL, NULL, end, mClientID, MASK_SHOT ); VectorCopy( trace.endpos, mOrigin2 ); if ( mImpactFxID > 0 ) { theFxScheduler.PlayEffect( mImpactFxID, trace.endpos, trace.plane.normal ); } } else { VectorMA( mOrigin1, mOrgOffset[0], dir, mOrigin2 ); } } UpdateSize(); UpdateRGB(); UpdateAlpha(); Draw(); return true; }
//---------------------------- bool CElectricity::Update() { // Game pausing can cause dumb time things to happen, so kill the effect in this instance if ( mTimeStart > theFxHelper.mTime ) { return false; } UpdateSize(); UpdateRGB(); UpdateAlpha(); Draw(); return true; }
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; }
//---------------------------- // 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; }
bool UCameraModifier_CameraShake::ModifyCamera(class APlayerCameraManager* Camera, float DeltaTime, FMinimalViewInfo& InOutPOV) { // Update the alpha UpdateAlpha(Camera, DeltaTime); // Call super where modifier may be disabled Super::ModifyCamera(Camera, DeltaTime, InOutPOV); // If no alpha, exit early if( Alpha <= 0.f ) { return false; } // Update Screen Shakes array if( ActiveShakes.Num() > 0 ) { for(int32 i=0; i<ActiveShakes.Num(); i++) { UpdateCameraShake(DeltaTime, ActiveShakes[i], InOutPOV); } // Delete any obsolete shakes for(int32 i=ActiveShakes.Num()-1; i>=0; i--) { FCameraShakeInstance& ShakeInst = ActiveShakes[i]; if( !ShakeInst.SourceShake || ( (ShakeInst.OscillatorTimeRemaining == 0.f) && ((ShakeInst.AnimInst == NULL) || (ShakeInst.AnimInst->bFinished == true)) ) ) { ActiveShakes.RemoveAt(i,1); } } } // If ModifyCamera returns true, exit loop // Allows high priority things to dictate if they are // the last modifier to be applied // Returning true causes to stop adding another modifier! // Returning false is the right behavior since this is not high priority modifier. return false; }
//---------------------------- bool CBezier::Update( void ) { float ftime, time2; ftime = cg.frametime * 0.001f; time2 = ftime * ftime * 0.5f; for ( int i = 0; i < 3; i++ ) { mControl1[i] = mControl1[i] + ftime * mControl1Vel[i] + time2 * mControl1Vel[i]; mControl2[i] = mControl2[i] + ftime * mControl2Vel[i] + time2 * mControl2Vel[i]; } UpdateSize(); UpdateRGB(); UpdateAlpha(); Draw(); return true; }
static void MouseButtonDown(AG_Event *event) { AG_HSVPal *pal = AG_SELF(); int btn = AG_INT(1); int x = AG_INT(2); int y = AG_INT(3); float r; if (!AG_WidgetIsFocused(pal)) AG_WidgetFocus(pal); switch (btn) { case AG_MOUSE_LEFT: if (y > pal->rAlpha.y) { UpdateAlpha(pal, x); pal->state = AG_HSVPAL_SEL_A; } else { x -= pal->circle.x; y -= pal->circle.y; r = Hypot((float)x, (float)y); if (r > (float)pal->circle.rin) { UpdateHue(pal, x, y); pal->state = AG_HSVPAL_SEL_H; } else { UpdateSV(pal, AG_INT(2), AG_INT(3)); pal->state = AG_HSVPAL_SEL_SV; } } AG_Redraw(pal); break; case AG_MOUSE_MIDDLE: case AG_MOUSE_RIGHT: OpenMenu(pal, x,y); break; } }
void CSimpleEmitter::RenderParticles( CParticleRenderIterator *pIterator ) { const SimpleParticle *pParticle = (const SimpleParticle *)pIterator->GetFirst(); while ( pParticle ) { //Render Vector tPos; TransformParticle( ParticleMgr()->GetModelView(), pParticle->m_Pos, tPos ); float sortKey = (int) tPos.z; //Render it RenderParticle_ColorSizeAngle( pIterator->GetParticleDraw(), tPos, UpdateColor( pParticle ), UpdateAlpha( pParticle ) * GetAlphaDistanceFade( tPos, m_flNearClipMin, m_flNearClipMax ), UpdateScale( pParticle ), pParticle->m_flRoll ); pParticle = (const SimpleParticle *)pIterator->GetNext( sortKey ); } }
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; }
// Main window program int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprev, PSTR cmdline, int ishow) { HWND hwnd = NULL; MSG msg = {0}; WNDCLASSEX wndclassex = {0}; // Init fields we care about wndclassex.cbSize = sizeof(WNDCLASSEX); // Always set to size of WNDCLASSEX wndclassex.style = CS_HREDRAW | CS_VREDRAW; wndclassex.lpfnWndProc = WinProc; wndclassex.hInstance = hinstance; wndclassex.lpszClassName = kClassName; wndclassex.hCursor = (HCURSOR)LoadImage(NULL, MAKEINTRESOURCE(IDC_ARROW), IMAGE_CURSOR, 0, 0, LR_SHARED); RegisterClassEx(&wndclassex); // Register the WNDCLASSEX RECT rect = { 0, 0, kWinWid, kWinHgt }; // Desired window client rect DWORD winStyleEx = WS_EX_CLIENTEDGE; DWORD winStyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; // Adjust window rect so it gives us our desired client rect when we // create the window AdjustWindowRectEx(&rect, winStyle, false, winStyleEx); // Create the window hwnd = CreateWindowEx(winStyleEx, // Window extended style kClassName, "www.GameTutorials.com -- Transparency", winStyle, // Window style CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, hinstance, NULL); // Init our global 3D object if(g3D->init(hwnd) == false) return EXIT_FAILURE; // There's been an error, lets get out of this joint // Get the client rect and make sure our client is the size we want GetClientRect(hwnd, &rect); assert(rect.right == kWinWid && rect.bottom == kWinHgt); // Set the perspective matrix once since it will never change g3D->setProjMatrix(DEG2RAD(60), (float)rect.right / (float)rect.bottom, 1.0f, 8192.0f); // Set our view matrix once since it will never change g3D->setViewMatrix(CPos(0.0f, 0.0f, -5.0f), CPos(0.0f, 0.0f, 0.0f)); ShowWindow(hwnd, ishow); UpdateWindow(hwnd); // While the app is running... while(1) { // Handle messages from the OS if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { if(msg.message == WM_QUIT) break; TranslateMessage(&msg); DispatchMessage(&msg); } else if(LockFrameRate()) // If it's time to render, do so { DrawAndRotateCube(); UpdateAlpha(); } else Sleep(1); // Otherwise, give the OS a bit of time to do other things } // end of while(1) g3D->deinit(); // Free up CD3DObj UnregisterClass(kClassName,hinstance); // Free up WNDCLASSEX return EXIT_SUCCESS; // Application was a success }
//---------------------------- 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; }
int CEdit::MsgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { switch (msg) { case WM_INITDIALOG: break; case WM_PAINT: { PAINTSTRUCT ps; BeginPaint(hWnd,&ps); Redraw(); EndPaint(hWnd,&ps); } break; case WM_LBUTTONUP: lbutton=false; HandleMouse(LOWORD(lParam),HIWORD(lParam),wParam); PostMessage(hWnd,WM_PAINT,0,0); break; case WM_LBUTTONDOWN: lbutton=true; HandleMouse(LOWORD(lParam),HIWORD(lParam),wParam); PostMessage(hWnd,WM_PAINT,0,0); break; case WM_RBUTTONUP: rbutton=false; HandleMouse(LOWORD(lParam),HIWORD(lParam),wParam); PostMessage(hWnd,WM_PAINT,0,0); break; case WM_RBUTTONDOWN: rbutton=true; HandleMouse(LOWORD(lParam),HIWORD(lParam),wParam); PostMessage(hWnd,WM_PAINT,0,0); break; case WM_MOUSEMOVE: HandleMouse(LOWORD(lParam),HIWORD(lParam),wParam); break; case WM_VSCROLL: if((HWND)lParam == GetDlgItem(hWnd, IDC_LUMINABAR)) { switch(LOWORD(wParam)) { case SB_TOP: nLumina=0; break; case SB_BOTTOM: nLumina=255; break; case SB_LINEUP: if (nLumina) nLumina--; break; case SB_LINEDOWN: if (nLumina<255) nLumina++; break; case SB_PAGEUP: nLumina-=10; if (nLumina<0) nLumina=0; break; case SB_PAGEDOWN: nLumina+=10; if (nLumina>255) nLumina=255; break; case SB_THUMBPOSITION: case SB_THUMBTRACK: nLumina=HIWORD(wParam); break; } UpdateLumina((HWND)lParam); } else if ((HWND)lParam == GetDlgItem(hWnd, IDC_ALPHABAR)) { switch(LOWORD(wParam)) { case SB_TOP: nAlpha=0; break; case SB_BOTTOM: nAlpha=255; break; case SB_LINEUP: if (nAlpha) nAlpha--; break; case SB_LINEDOWN: if (nAlpha<255) nAlpha++; break; case SB_PAGEUP: nAlpha-=10; if (nAlpha<0) nAlpha=0; break; case SB_PAGEDOWN: nAlpha+=10; if (nAlpha>255) nAlpha=255; break; case SB_THUMBPOSITION: case SB_THUMBTRACK: nAlpha=HIWORD(wParam); break; } UpdateAlpha((HWND)lParam); } PostMessage(hWnd,WM_PAINT,0,0); break; case WM_COMMAND: switch(LOWORD(wParam)) { case ID_TILEED_NEXT: GoNext(); break; case ID_TILEED_PREV: GoPrev(); break; case ID_TILEED_UNDO: Undo(); break; case ID_TILEED_REDO: Redo(); break; case ID_TILEED_CLEAR: curimage.Clear(nCurcolour[1]); break; case ID_TILEED_ROTATE: curimage.Rotate(); break; case ID_TILEED_FLIP: curimage.Flip(); break; case ID_TILEED_MIRROR: curimage.Mirror(); break; case ID_TILEED_EXIT: PostMessage(hWnd, WM_CLOSE, 0, 0); break; default: return HandleCommand(hWnd,wParam); // unknown message? Pass it down to the derived class } PostMessage(hWnd,WM_PAINT,0,0); break; case WM_CLOSE: EndDialog(hWnd,0); break; } return 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; }
//----------------------------------------------------------------------------- // Purpose: Update state + render //----------------------------------------------------------------------------- bool CBasePlasmaProjectile::SimulateAndRender(Particle *pInParticle, ParticleDraw *pDraw, float &sortKey) { if ( IsDormantPredictable() ) return true; if ( GetMoveType() == MOVETYPE_NONE ) return true; // Update the particle position pInParticle->m_Pos = GetAbsOrigin(); // Add our blended offset if ( gpGlobals->curtime < m_Shared.GetSpawnTime() + REMAP_BLEND_TIME ) { float frac = ( gpGlobals->curtime - m_Shared.GetSpawnTime() ) / REMAP_BLEND_TIME; frac = 1.0f - clamp( frac, 0.0f, 1.0f ); Vector scaledOffset; VectorScale( m_vecGunOriginOffset, frac, scaledOffset ); pInParticle->m_Pos += scaledOffset; } float timeDelta = pDraw->GetTimeDelta(); // Render the head particle if ( pInParticle == m_pHeadParticle ) { SimpleParticle *pParticle = (SimpleParticle *) pInParticle; pParticle->m_flLifetime += timeDelta; // Render Vector tPos, vecOrigin; RemapPosition( m_pPreviousPositions[MAX_HISTORY-1].m_Position, m_pPreviousPositions[MAX_HISTORY-1].m_Time, vecOrigin ); TransformParticle( ParticleMgr()->GetModelView(), vecOrigin, tPos ); sortKey = (int) tPos.z; //Render it RenderParticle_ColorSizeAngle( pDraw, tPos, UpdateColor( pParticle, timeDelta ), UpdateAlpha( pParticle, timeDelta ) * GetAlphaDistanceFade( tPos, 16, 64 ), UpdateScale( pParticle, timeDelta ), UpdateRoll( pParticle, timeDelta ) ); /* if ( m_flNextSparkEffect < gpGlobals->curtime ) { // Drop sparks? if ( GetTeamNumber() == TEAM_HUMANS ) { g_pEffects->Sparks( pInParticle->m_Pos, 1, 3 ); } else { g_pEffects->EnergySplash( pInParticle->m_Pos, vec3_origin ); } m_flNextSparkEffect = gpGlobals->curtime + RandomFloat( 0.5, 2 ); } */ return true; } // Render the trail TrailParticle *pParticle = (TrailParticle *) pInParticle; pParticle->m_flLifetime += timeDelta; Vector vecScreenStart, vecScreenDelta; sortKey = pParticle->m_Pos.z; // NOTE: We need to do everything in screen space float flFragmentLength = (MAX_HISTORY > 1) ? 1.0 / (float)(MAX_HISTORY-1) : 1.0; for ( int i = 0; i < (MAX_HISTORY-1); i++ ) { Vector vecWorldStart, vecWorldEnd, vecScreenEnd; float flStartV, flEndV; // Did we just appear? if ( m_pPreviousPositions[i].m_Time == 0 ) continue; RemapPosition( m_pPreviousPositions[i+1].m_Position, m_pPreviousPositions[i+1].m_Time, vecWorldStart ); RemapPosition( m_pPreviousPositions[i].m_Position, m_pPreviousPositions[i].m_Time, vecWorldEnd ); // Texture wrapping flStartV = (flFragmentLength * (i+1)); flEndV = (flFragmentLength * i); TransformParticle( ParticleMgr()->GetModelView(), vecWorldStart, vecScreenStart ); TransformParticle( ParticleMgr()->GetModelView(), vecWorldEnd, vecScreenEnd ); Vector vecScreenDelta = (vecScreenEnd - vecScreenStart); if ( vecScreenDelta == vec3_origin ) continue; /* Vector vecForward, vecRight; AngleVectors( MainViewAngles(), &vecForward, &vecRight, NULL ); Vector vecWorldDelta = ( vecWorldEnd - vecWorldStart ); VectorNormalize( vecWorldDelta ); float flDot = fabs(DotProduct( vecWorldDelta, vecForward )); if ( flDot > 0.99 ) { // Remap alpha pParticle->m_flColor[3] = 1.0 - min( 1.0, RemapVal( flDot, 0.99, 1.0, 0, 1 ) ); } */ // See if we should fade float color[4]; Color32ToFloat4( color, pParticle->m_color ); Tracer_Draw( pDraw, vecScreenStart, vecScreenDelta, pParticle->m_flWidth, color, flStartV, flEndV ); } return true; }