void main(void) { int iPos=0; if(!bLoadImage()) return; ColorAdjust(); CalcContour(); _asm mov ax,13h _asm int 10h outp(0x3c8, 0); for(iPos=0; iPos < 768; iPos++) outp(0x3c9, acPalette[iPos]); iPos=0; while(!kbhit()) { for(iPos=0; (iPos < 128) && !kbhit(); iPos++) { CalcSmooth(iPos); Draw(); } for(iPos=128; (iPos > 0) && !kbhit(); iPos--) { CalcSmooth(iPos); Draw(); } } getch(); _asm mov ax, 3h _asm int 10h }
float4 r3dTimeGradient2::GetValue(float time) const { float4 res; assert(NumValues >= 2); //assert(time >= 0.0f && time <= 1.1f); if(time <= 0.0f) return *(float4*)Values[0].val; if(time >= 1.0f) return *(float4*)Values[NumValues-1].val; int i; for(i=0; i<NumValues; i++) { if(Values[i].time >= time) break; } assert(i); const val_s& v1 = Values[i-1]; const val_s& v2 = Values[i]; float delta = (time - v1.time) / (v2.time - v1.time); if( Smooth ) { res.x = CalcSmooth( v1.val[0], v2.val[0], delta ); res.y = CalcSmooth( v1.val[1], v2.val[1], delta ); res.z = CalcSmooth( v1.val[2], v2.val[2], delta ); } else { res.x = v1.val[0] + (v2.val[0] - v1.val[0]) * delta; res.y = v1.val[1] + (v2.val[1] - v1.val[1]) * delta; res.z = v1.val[2] + (v2.val[2] - v1.val[2]) * delta; } return res; }
bool Aiming::Aim(double deltaT, Vector3 const camOrigin, double & yPitch, double & zYaw, double & xRoll) { if(deltaT <= 0) { return false; } bool camRotationChanged = false; m_Deactivating = Active || m_Deactivating && SoftDeactivate; double targetYPitch = yPitch; double targetZYaw = zYaw; double targetXRoll = xRoll; if(Active) { IClientEntity_csgo * ce = g_Entitylist_csgo->GetClientEntity(EntityIndex); C_BaseEntity_csgo * be = ce ? ce->GetBaseEntity() : 0; if(ce) { Vector o = be && O_View == Origin ? be->EyePosition() : ce->GetAbsOrigin(); QAngle a = be && A_View == Angles ? be->EyeAngles() : ce->GetAbsAngles(); double forward[3], right[3], up[3]; MakeVectors(a.z, a.x, a.y, forward, right, up); LastTargetOrigin = Vector3( o.x +OffSet.X * forward[0] + OffSet.Y * right[0] +OffSet.Z * up[0], o.y +OffSet.X * forward[1] + OffSet.Y * right[1] +OffSet.Z * up[1], o.z +OffSet.X * forward[2] + OffSet.Y * right[2] +OffSet.Z * up[2] ); } } else { LastTargetOrigin = camOrigin; } if(Active || m_Deactivating) { if(Active) { LookAnglesFromTo(camOrigin, LastTargetOrigin, LastYPitch, LastZYaw, targetYPitch, targetZYaw); targetXRoll = U_World == Up ? 0 : targetXRoll; } if(SnapTo) { yPitch = targetYPitch; zYaw = targetZYaw; xRoll = targetXRoll; camRotationChanged = true; m_Deactivating = false; } else { double reaimYPitch = targetYPitch -LastYPitch; double reaimZYaw = targetZYaw -LastZYaw; double reaimXRoll = targetXRoll -LastXRoll; // Force reaim angles to be in [-180°, 180°) reaimYPitch = fmod(reaimYPitch + 180.0, 360.0) -180.0; reaimZYaw = fmod(reaimZYaw + 180.0, 360.0) -180.0; reaimXRoll = fmod(reaimXRoll + 180.0, 360.0) -180.0; m_Deactivating = Active || abs(reaimYPitch) > AFX_MATH_EPS || abs(reaimZYaw) > AFX_MATH_EPS || abs(reaimXRoll) > AFX_MATH_EPS; // apply re-aiming: //Tier0_Msg("+++pitch+++\n"); CalcSmooth(deltaT, LastYPitch +reaimYPitch, LastYPitch, m_YPitchVelocity); yPitch = LastYPitch; //Tier0_Msg("+++yaw+++\n"); CalcSmooth(deltaT, LastZYaw +reaimZYaw, LastZYaw, m_ZYawVelocity); zYaw = LastZYaw; //Tier0_Msg("+++roll+++\n"); CalcSmooth(deltaT, LastXRoll +reaimXRoll, LastXRoll, m_XRollVelocity); xRoll = LastXRoll; camRotationChanged = true; } } else { m_YPitchVelocity = 0; m_ZYawVelocity = 0; m_XRollVelocity = 0; } // Force remembered angels to be in [-180°, 180°) LastYPitch = fmod(yPitch +180.0, 360.0) -180.0; LastZYaw = fmod(zYaw +180.0, 360.0) -180.0; LastXRoll = fmod(xRoll +180.0, 360.0) -180.0; return camRotationChanged; }