//=============================================================================
//
//=============================================================================
class AssaultRifle_inf extends AssaultRifle_yarm;
var float RotYawScale, YawGoalScale, RotPitchScale, PitchGoalScale;
var float SightDrift;
// edited temporarily to allow better placing of the weapons by using the editactor command realtime in game
simulated event RenderOverlays( Canvas Canvas ){
local int m;
local float dt;
local vector NewScale3D;
local rotator CenteredRotation, NewRotation, FinalRotation;
//local float PawnWalkSpeed;
if (Instigator == None)
return;
//----------------------------------------------------------------
// added back from AssaultRifle_yarm
//----------------------------------------------------------------
if(bAimMode && bUseScopeView){
Canvas.Style = 255;
Canvas.SetDrawColor (255, 255, 255, 255);
Canvas.SetPos(0,0);
if(bScopeEffect)Canvas.DrawTile( ScopeEffectTex, Canvas.SizeX, Canvas.SizeY, 0.0, 0.0, ScopeTexSize, ScopeTexSize );
Canvas.DrawTile( ScopeTex, Canvas.SizeX, Canvas.SizeY, 0.0, 0.0, ScopeTexSize, ScopeTexSize );
}
//----------------------------------------------------------------
if ( Instigator.Controller != None )
Hand = Instigator.Controller.Handedness;
if ((Hand < -1.0) || (Hand > 1.0))
return;
// smoothly transition aiming
if(AimOffScale != AimOffDesScale){
dt=level.timeseconds-LastAimTime;
if(AimOffScale > AimOffDesScale){
AimOffScale = FClamp(AimOffScale-4*dt, AimOffDesScale, 1.0);
}
else{
AimOffScale = FClamp(AimOffScale+4*dt, 0,AimOffDesScale);
}
if (abs(AimOffScale-AimOffDesScale)< 0.05) AimOffScale = AimOffDesScale;
}
LastAimTime=level.timeseconds;//must be out here in order to catch the last aimtime
// draw muzzleflashes/smoke for all fire modes so idle state won't
// cause emitters to just disappear
//Canvas.DrawActor(None, false, true); // amb: Clear the z-buffer here
for (m = 0; m < NUM_FIRE_MODES; m++){
if (FireMode[m] != None){
FireMode[m].DrawMuzzleFlash(Canvas);
}
}
if ( Hand != RenderedHand )
{
newScale3D = Default.DrawScale3D;
if ( Hand != 0 )
newScale3D.Y *= Hand;
SetDrawScale3D(newScale3D);
if ( Hand == 0 )
{
PlayerViewPivot.Roll = Default.PlayerViewPivot.Roll;
PlayerViewPivot.Yaw = Default.PlayerViewPivot.Yaw;
}
else
{
PlayerViewPivot.Roll = Default.PlayerViewPivot.Roll * Hand;
PlayerViewPivot.Yaw = Default.PlayerViewPivot.Yaw * Hand;
}
RenderedHand = Hand;
}
//if ( class'PlayerController'.Default.bSmallWeapons || Level.bClassicView )
// PlayerViewOffset = SmallViewOffset;
if(default.AimMethod==2) //still needs work // || VSize(Instigator.velocity) > 80.0
AimDiff = (AimOffsetScale*HighAimOffset) - Default.PlayerViewOffset;
else if(default.AimMethod==1)
AimDiff = (AimOffsetScale*IronAimOffset) - Default.PlayerViewOffset;
//else
PlayerViewOffset = Default.PlayerViewOffset + AimOffScale*AimDiff;
if ( Hand == 0 )
PlayerViewOffset.Y = CenteredOffsetY;
else
PlayerViewOffset.Y *= Hand;
//this sets the mesh location
SetLocation( Instigator.Location + Instigator.CalcDrawOffset(self) );
// ROTATION
NewRotation = Instigator.GetViewRotation();
// Add some rotation leading
//FinalRotation.Yaw = LeadRot(NewRotation.Yaw & 65535, LastRotation.Yaw & 65535, MaxYawLag, 0);
//FinalRotation.Pitch = LeadRot(NewRotation.Pitch & 65535, LastRotation.Pitch & 65535, MaxPitchLag, 1);
//--------------------------------------------------------------
//Ibex added sight drift code 1/13/2009
//--------------------------------------------------------------
/*
//This bit is commented out since rate of drift was constant, the large ones were
//always to slow and small ones always to fast.
//So just go with 100 for now till a less crude method for drift is found.
if(Instigator.IsHumanControlled())
{
if (bAimMode || bHighAimMode)
{
PawnWalkSpeed = ((Instigator.GroundSpeed * Instigator.WalkingPct) +1);
//============================================================
// set the current SightDrift depending on stance and movment
//============================================================
//would be nice for when not in bAimMode to have a large drift amount
//unfortunately higher numbers like 4000 do nothing noticeable???
//if (!bAimMode) SightDrift = 300;
//else SightDrift = 200;
if(yarmPawn(Instigator)!=none && yarmPawn(Instigator).bIsProne && Vsize(Instigator.Velocity) <= 0 ){
SightDrift = 50;
//DriftRate=Low;
}else if ( instigator.bIsCrouched && Vsize(Instigator.Velocity) <= 0 ){
SightDrift = 75;
//DriftRate=medium;
}else if ( Vsize(Instigator.Velocity) <= (PawnWalkSpeed/2) ){
SightDrift = 100;
//DriftRate=fast;
}else{
SightDrift = 125;
//DriftRate=fast;
}
//============================================================
}
}
*/
//crude rotation updating method, must be a better way to do this with more
//controll over the speed rate and drift amount.
//This is where the sights get a little constant random rotation added to them,
//to simulate variations caused by muscles motion transfer and breathing.
//first we calc the amount for Yaw
if (RotYawScale < YawGoalScale)
RotYawScale += 1;
else if (RotYawScale > YawGoalScale)
RotYawScale -= 1;
else if (RotYawScale == YawGoalScale )
YawGoalScale = Rand(SightDrift);
//then we calc the amount for Pitch
if (RotPitchScale < PitchGoalScale)
RotPitchScale += 1;
else if (RotPitchScale > PitchGoalScale)
RotPitchScale -= 1;
else if (RotPitchScale == PitchGoalScale)
PitchGoalScale = Rand(SightDrift);
//now we subtract half the amount of sight drift, this is so the middle area of
//the random Goal will be at the center of the screen, so we get
//an even amout of drift to each side
NewRotation.Yaw -= (SightDrift/2);
//then we add in the Scale as it heads towards the goal value
FinalRotation.Yaw = (NewRotation.Yaw += RotYawScale);
NewRotation.Pitch -= (SightDrift/2);
FinalRotation.Pitch = (NewRotation.Pitch += RotPitchScale);
//end of Ibex new sight drift code
//---------------------------------------------------------------
//---------------------------------------------------------------
LastRotUpdate = Level.TimeSeconds;
LastRotation = NewRotation;
if ( Hand == 0 )
{
//CenteredRotation = Instigator.GetViewRotation();
CenteredRotation = NewRotation;
CenteredRotation.Yaw += CenteredYaw;
CenteredRotation.Roll = CenteredRoll;
SetRotation(CenteredRotation);
}
else
SetRotation( FinalRotation);
bDrawingFirstPerson = true;
Canvas.DrawActor(self, false, false, DisplayFOV);
if(bRenderKnife){
MeleeKnife.RenderOverlays(Canvas);// draw the melee knife attack
//RealKnife.RenderOverlays(Canvas);
}
bDrawingFirstPerson = false;
if ( Hand == 0 )
PlayerViewOffset.Y = 0;
}
defaultproperties
{
BobDamping=1.250000
SightDrift=100.000000
}