class u_RenderHelper extends Object;

var float LastRunTime;


//=============================================================================
// stalker and Pat visibility hax
final static function RevealStalkers(out KFHumanPawn p)
{
  local KFMonster m;

  if (p == none || p.Level.TimeSeconds < default.LastRunTime)
    return;

  default.LastRunTime = p.Level.TimeSeconds + 1.0f;

  // VisibleCollidingActors must be as fast
  foreach p.CollidingActors(class'KFMonster', m, 2000)
  {
    if (m == none || m.Health <= 0 || M.bDeleteMe || m.IsInState('Dying'))
      continue;

    if (ClassIsChildOf(m.class, class'ZombieStalker'))
      m.SetOverlayMaterial(Material'KFX.StalkerGlow', 999, true);
    if (ClassIsChildOf(m.class, class'ZombieBoss'))
      m.SetOverlayMaterial(Material'KFZED_FX_T.Energy.ZED_overlay_Hit_Shdr', 999, true);
  }
}


//=============================================================================
// zed health
final static function DrawHealthBars(out KFHumanPawn p, out Canvas C, out float f)
{
  local HUDKillingFloor KFH;
  local KFMonster m;

  KFH = HUDKillingFloor(C.ViewPort.Actor.myHUD);
  // this draws debug sphere for pawns
  // HKF.DrawPointSphere();
  // draw dem bars, using the fastest iterator at least up to 2000UU
  if (p == none || KFH == none)
    return;

  foreach p.CollidingActors(class'KFMonster', m, f)
  {
    if(m == none || m.Health <= 0)
      continue;
    KFH.DrawHealthBar(C, m, m.Health, m.HealthMax , 50.0);
  }
}


//=============================================================================
// crosshair
final static function DrawXhair(out Canvas C, out Color cl, out float l, out float w)
{
  C.SetPos((float(C.sizeX) - w) / 2, (float(C.sizeY) - l) / 2);
  C.DrawColor = cl;
  C.DrawTile(Texture'Engine.WhiteSquareTexture', w, l, 0, 0, 2, 2);
  C.SetPos((float(C.sizeX) - l) / 2, (float(C.sizeY) - w) / 2);
  C.DrawTile(Texture'Engine.WhiteSquareTexture', l, w, 0, 0, 2, 2);
}


//=============================================================================
// paths
final static function ShowPaths(out KFPlayerController pc, optional bool b)
{
	local NavigationPoint P;
	local int i;
	local ReachSpec Spec;
	local vector SpecColor;

  if (!b)
  {
    pc.ClearStayingDebugLines();
    return;
  }

	for (P = pc.Level.NavigationPointList; P != none; P = P.NextNavigationPoint )
	{
		log( "Checking "$P$" with pathlist length "$P.Pathlist.Length );
		for( i = 0; i < P.PathList.Length; i++ )
		{
			Spec = P.PathList[ i ];
			SpecColor = vect( 0,255,0 );
			// 260 = MAXVEHICLERADIUS 80 = MINCOMMONHEIGHT
			if (( Spec.CollisionRadius >= 260 ) && (Spec.CollisionHeight >= 80))
			{
				SpecColor = vect( 255,255,255 );
			}
			// Jump spec
			else if( ( Spec.reachFlags & 8 ) == Spec.reachFlags )
			{
				SpecColor = vect( 191, 165, 99 );
			}
			// Proscribed
			else if( ( Spec.reachFlags & 128 ) == Spec.reachFlags )
			{
				SpecColor = vect( 255, 0, 0 );
			}
			// Forced
			else if( ( Spec.reachFlags & 256 ) == Spec.reachFlags )
			{
				SpecColor = vect( 255, 255, 0 );
			}
			// Blue (narrow)
			else if( ( Spec.CollisionRadius < 72 || Spec.CollisionHeight < 80 ) )
			{
				SpecColor = vect( 0, 0, 255 );
			}

			pc.DrawStayingDebugLine( P.PathList[ i ].Start.Location, P.PathList[ i ].End.Location, SpecColor.X, SpecColor.Y, SpecColor.Z );
		}
	}
}


//=============================================================================
defaultproperties
{
  LastRunTime=1.0
}