class LightMenu extends GUI2K4.MidGamePanel
  config(HideMut);

// =================================================================Interface section
var automated GUISectionBackground		sb_ControlsAllMap, sb_Stats, sb_Tweaker;
var automated moNumericEdit 	    	nu_Radius, nu_newRadius, nu_maxRadius, nu_LightCone, nu_LightPeriod, nu_LightBrightness,
                    nu_LightHue, nu_LightSaturation, nu_LightEffect, nu_LightType;


var automated MOCheckBox 			 ch_Optimize, ch_RemoveFlickering, ch_FlickeringToStatic,
                   ch_ActorShadows, ch_AttenByLife, ch_bCorona,
                   ch_bDirectionalCorona, ch_bDynamicLight, ch_bLightingVisibility,
                   ch_bSpecialLit;
var automated GUIScrollTextBox	lb_Actions;

var		automated	GUIButton		 b_HideLights, b_OptAllLights, b_MakeAllLightVisible, b_DisableCoronas,
                   b_SaveConfig, b_OptStatic, b_ClearLog;
// ====================================================================End of interface section

var transient array<Light> CachedLights;					// Cached lights for checks, stats and etc.
var transient array<TriggerLight> CachedTriggerLights;	// Cached trigger lights just in case
var transient array<int> LightColors;						// Unique light colors
var bool bCached;								// Prevents multiple caching
var int maxRadius_L, maxRadius_TL;								// Max radius for light sources(trigger light and lights)

// ==========================================config variables
var config bool bActorShadows, bAttenByLife, bLightingVisibility, bCorona, bDirectionalCorona,
        bSpecialLit,
        // Tweaker
        Optimize, RemoveFlickering, FlickeringToStatic;


var config int NewRadius, maxRadius;

var config byte byteRadius, byteLightBrightness, byteLightHue, byteLightSaturation, byteLightType,
        byteLightEffect, byteLightCone, byteLightPeriod;


// ==========================================end of config variables
var PlayerController PC;
var bool IsUnlited, bConfigLoaded;

simulated function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
  local GUIButton B;
  local string s;
  local int i;

  super.InitComponent(MyController,MyOwner);

  PC = PlayerOwner();

  sb_Stats.ManageComponent(lb_Actions);
  sb_Stats.ManageComponent(b_ClearLog);

  sb_Tweaker.ManageComponent(nu_newRadius);
  sb_Tweaker.ManageComponent(nu_maxRadius);
  sb_Tweaker.ManageComponent(ch_Optimize);
  sb_Tweaker.ManageComponent(ch_RemoveFlickering);
  sb_Tweaker.ManageComponent(ch_FlickeringToStatic);
  sb_Tweaker.ManageComponent(b_HideLights);
  sb_Tweaker.ManageComponent(b_DisableCoronas);
  sb_Tweaker.ManageComponent(b_OptStatic);

  sb_ControlsAllMap.ManageComponent(nu_Radius);
  sb_ControlsAllMap.ManageComponent(nu_LightCone);
  sb_ControlsAllMap.ManageComponent(nu_LightPeriod);
  sb_ControlsAllMap.ManageComponent(nu_LightBrightness);
  sb_ControlsAllMap.ManageComponent(nu_LightHue);
  sb_ControlsAllMap.ManageComponent(nu_LightSaturation);
  sb_ControlsAllMap.ManageComponent(nu_LightEffect);
  sb_ControlsAllMap.ManageComponent(nu_LightType);
  sb_ControlsAllMap.ManageComponent(ch_ActorShadows);
  sb_ControlsAllMap.ManageComponent(ch_AttenByLife);
  sb_ControlsAllMap.ManageComponent(ch_bCorona);
  sb_ControlsAllMap.ManageComponent(ch_bDirectionalCorona);
  sb_ControlsAllMap.ManageComponent(ch_bDynamicLight);
  sb_ControlsAllMap.ManageComponent(ch_bLightingVisibility);
  sb_ControlsAllMap.ManageComponent(ch_bSpecialLit);
  sb_ControlsAllMap.ManageComponent(b_OptAllLights);
  sb_ControlsAllMap.ManageComponent(b_SaveConfig);
  sb_ControlsAllMap.ManageComponent(b_MakeAllLightVisible);

  // For resizing buttons
  s = GetSizingCaption();

  for (i = 0; i < Controls.length; i++)
  {
    B = GUIButton(Controls[i]);
    if (B != None)
    {
      B.bAutoSize = true;
      B.SizingCaption = s;
      B.AutoSizePadding.HorzPerc = 0.04;
      B.AutoSizePadding.VertPerc = 0.8;
    }
  }

  ch_ActorShadows.Checked(bActorShadows);
  ch_AttenByLife.Checked(bAttenByLife);
  nu_Radius.SetValue(byteRadius);
  ch_bLightingVisibility.Checked(bLightingVisibility);
  ch_bCorona.Checked(bCorona);
  ch_bDirectionalCorona.Checked(bDirectionalCorona);
  nu_LightBrightness.SetValue(byteLightBrightness);
  nu_LightHue.SetValue(byteLightHue);
  nu_LightSaturation.SetValue(byteLightSaturation);
  ch_bSpecialLit.Checked(bSpecialLit);
  nu_LightType.SetValue(byteLightType);
  nu_LightEffect.SetValue(byteLightEffect);
  nu_LightCone.SetValue(byteLightCone);
  nu_LightPeriod.SetValue(byteLightPeriod);
}


function string GetSizingCaption()
{
  local int i;
  local string S;

  for (i = 0; i < Controls.length; i++)
    if (GUIButton(Controls[i]) != None)
      if (S == "" || Len(GUIButton(Controls[i]).Caption) > Len(S))
        S = GUIButton(Controls[i]).Caption;

  return S;
}


function ShowPanel(bool bShow)
{
  super.ShowPanel(bShow);

  if (bShow)
    CacheLights();
}


event Opened(GUIComponent Sender)
{
  super.Opened(Sender);

  // Caching lights
  if (!bCached)
  {
    CacheLights();
  }

  if (!bConfigLoaded)
  {
    LoadLightConfig();
    bConfigLoaded = True;
  }
}


simulated function bool ButtonClicked(GUIComponent Sender)
{
  // Caching lights
  if (!bCached)
  {
    CacheLights();
  }

  switch (Sender)
  {
    case b_HideLights:
      OptLights(nu_newRadius.GetValue(), nu_maxRadius.GetValue(), ch_Optimize.IsChecked(), ch_RemoveFlickering.IsChecked(), ch_FlickeringToStatic.IsChecked());
      break;

    case b_OptAllLights:
      OptAllLights();
      break;

    case b_MakeAllLightVisible:
      AllLightVisible();
      break;

    case b_DisableCoronas:
      RemoveCoronas();
      break;

    case b_SaveConfig:
      SaveLightConfig();
      break;

    case b_OptStatic:
      OptimizeStaticMeshes();
      break;

    case b_ClearLog:
      lb_Actions.SetContent("");
      break;
  }

  // Get lighting statistics
  StatLights();
  return true;
}


simulated function SaveLightConfig()
{
  bActorShadows = ch_ActorShadows.IsChecked();
  bAttenByLife = ch_AttenByLife.IsChecked();
  byteRadius = nu_Radius.GetValue();
  bLightingVisibility = ch_bLightingVisibility.IsChecked();
  bCorona = ch_bCorona.IsChecked();
  bDirectionalCorona = ch_bDirectionalCorona.IsChecked();
  byteLightBrightness = nu_LightBrightness.GetValue();
  byteLightHue = nu_LightHue.GetValue();
  byteLightSaturation = nu_LightSaturation.GetValue();
  bSpecialLit = ch_bSpecialLit.IsChecked();
  byteLightType = nu_LightType.GetValue();
  byteLightEffect = nu_LightEffect.GetValue();
  byteLightCone = nu_LightCone.GetValue();
  byteLightPeriod = nu_LightPeriod.GetValue();

  NewRadius = nu_newRadius.GetValue();
  maxRadius = nu_maxRadius.GetValue();
  Optimize = ch_Optimize.IsChecked();
  RemoveFlickering = ch_RemoveFlickering.IsChecked();
  FlickeringToStatic = ch_FlickeringToStatic.IsChecked();
  SaveConfig();
}


simulated function LoadLightConfig()
{
  ch_ActorShadows.Checked(bActorShadows);
  ch_AttenByLife.Checked(bAttenByLife);
  nu_Radius.SetValue(byteRadius);
  ch_bLightingVisibility.Checked(bLightingVisibility);
  ch_bCorona.Checked(bCorona);
  ch_bDirectionalCorona.Checked(bDirectionalCorona);
  nu_LightBrightness.SetValue(byteLightBrightness);
  nu_LightHue.SetValue(byteLightHue);
  nu_LightSaturation.SetValue(byteLightSaturation);
  ch_bSpecialLit.Checked(bSpecialLit);
  nu_LightType.SetValue(byteLightType);
  nu_LightEffect.SetValue(byteLightEffect);
  nu_LightCone.SetValue(byteLightCone);
  nu_LightPeriod.SetValue(byteLightPeriod );

  nu_newRadius.SetValue(NewRadius);
  nu_maxRadius.SetValue(maxRadius);
  ch_Optimize.Checked(Optimize);
  ch_RemoveFlickering.Checked(RemoveFlickering);
  ch_FlickeringToStatic.Checked(FlickeringToStatic);
}


simulated function AllLightVisible()		// Toggle lights visibility
{
  local int i;

  for (i=0;i<CachedLights.length;i++)
  {
    if (CachedLights[i].bHidden)
      CachedLights[i].bHidden = False;
    else
      CachedLights[i].bHidden = True;

    if (CachedLights[i].bStatic)
      CachedLights[i].ResetStaticFilterState();
  }
}


simulated function CacheLights() // Cache lights
{
  local Light LE;
  local TriggerLight TL;
  local int i;

  // Cached lights for checks, stats and etc.
  forEach AllObjects (class'Light', LE)
  {
    CachedLights[i] = LE;
    i++;
  }
  i=0;

  // Cached TriggerLights
  forEach AllObjects (class'TriggerLight', TL)
  {
    CachedTriggerLights[i] = TL;
    i++;
  }

  // Empty lights check
  if (CachedLights.length > 0 || CachedTriggerLights.Length > 0)
    bCached = True;
}


// Clear cache
simulated function ClearCache()
{
  CachedLights.Remove(0,CachedLights.Length);
  CachedTriggerLights.Remove(0,CachedTriggerLights.Length);
  bCached = False;
}


// Get max radius of light sources and triggerlight
simulated function MaxRad(out int MRad, out int TlMRad)
{
  local int i;

  if (CachedLights.length == 0)
    return;

  MRad = CachedLights[0].LightRadius;

  // Find max radius
  for (i=0;i<CachedLights.length; i++)
  {
    if (CachedLights[i].LightRadius  > MRad)
    {
      MRad = CachedLights[i].LightRadius ;
    }
  }

  if (CachedTriggerLights.length == 0)
    return;

  TlMRad = CachedTriggerLights[0].LightRadius;

  // Find max radius
  for(i=0;i<CachedTriggerLights.length; i++)
  {
    if (CachedLights[i].LightRadius  > TlMRad)
    {
      TlMRad = CachedLights[i].LightRadius;
    }
  }
}


simulated function GetUniqueColorsLights()
{
  local int i, k, count;
  local bool bAlreadyIsIn;

  if (CachedLights.Length == 0)
    return;

  if (LightColors.Length == 0)
  {
    LightColors[0] = CachedLights[0].LightHue;
    count++;
  }

  for (i=0; i < CachedLights.length; i++)
  {
    for (k=0; k < LightColors.length; k++)	// Finding unique color
    {
        if (LightColors[k] == CachedLights[i].LightHue)
        {
        bAlreadyIsIn = True;
        break;				// Already having dat color
        }
    }

    if (!bAlreadyIsIn)
    {
      LightColors[count] = CachedLights[i].LightHue;		// Adding unique light
      count++;
    }
    bAlreadyIsIn = False;	// Next iteration
  }
}


// Statistics
simulated function StatLights()	// Get light statistics
{
  local int i, maxRadiusCountL, maxRadiusCountTL, SpecialLit_CountL, SpecialLit_CountTL;

  if (maxRadius_TL==0 || maxRadius_L==0)
  {
    MaxRad(maxRadius_L, maxRadius_TL);
  }

  if (CachedTriggerLights.length > 0)
  {
    for (i=0; i < cachedTriggerLights.length; i++)
    {
      if (CachedTriggerLights[i].bSpecialLit)
        SpecialLit_CountTL++;
      if (CachedTriggerLights[i].LightRadius  == maxRadius_TL)
        maxRadiusCountTL++;
    }
  }

  if (CachedLights.length == 0)		// if no lights on map == fuckoff
    return;

  for (i=0; i < CachedLights.length; i++)
  {
    if (CachedLights[i].bSpecialLit)
      SpecialLit_CountL++;
    if (CachedLights[i].LightRadius  == maxRadius_L)
      maxRadiusCountL++;
  }

  LightColors.Length = 0;
  GetUniqueColorsLights();
  lb_Actions.Addtext("There are" @ CachedLights.length @ "light sources" @ "and" @ cachedTriggerLights.length @ "Trigger light sources");
  lb_Actions.Addtext("Max Radius for light source is " @ maxRadius_L @ ". Light sources that uses max radius:" @ maxRadiusCountL
    @ "Max Radius for triggerlight source is " @ maxRadius_TL @ ". TriggerLight sources that uses max radius:" @ maxRadiusCountTL);

  lb_Actions.Addtext("Detected" @ LightColors.length @ "unique lights");

  lb_Actions.Addtext("Detected" @ SpecialLit_CountL @ " SpecialLit lights"
    @ "Detected" @ SpecialLit_CountTL @ " SpecialLit triggerlights");
}


// =======Lights
// Light Optimization
simulated function OptLights(Int Radius, Int maxRadius, bool Optimize, bool RemoveFlickering, bool FlickeringToStatic)
{
  local Light LE;
  local TriggerLight TL;
  local int i, count;

  if (Radius == 0 || maxRadius == 0)
    return;

  forEach AllObjects (class'Light', LE)
  {
    if (LE.LightRadius > maxRadius)
    {
      LE.bSpecialLit = Optimize;
      LE.LightRadius = Radius;
      i++;
    }

    if (RemoveFlickering)
    {
        switch (LE.LightType)
        {
        case LT_Pulse:			// 3 Laggy types of lights
        LE.LightType = LT_Steady;		// Replace this to steady light
        count++;
        if (FlickeringToStatic)
        {
           LE.bSpecialLit = True;
           LE.bLightingVisibility = False;
        }

        break;
        case LT_Blink:
        LE.LightType = LT_Steady;		// Replace this to steady light
        count++;
        if (FlickeringToStatic)
        {
           LE.bSpecialLit = True;
           LE.bLightingVisibility = False;
        }
        break;
        case LT_Flicker:
        LE.LightType = LT_Steady;		// Replace this to steady light
        count++;
        if (FlickeringToStatic)
        {
           LE.bSpecialLit = True;
           LE.bLightingVisibility = False;
        }
        break;
        default:
        break;
        }
    }

      LE.bLightChanged=True;	// Recalculate light now
      if (LE.bStatic)
         LE.ResetStaticFilterState();

  }

  forEach AllObjects (class'TriggerLight', TL)
  {
        if (TL.LightRadius > maxRadius)
      {
      TL.bSpecialLit = Optimize;
      TL.LightRadius = Radius;
      i++;
      }
      if (RemoveFlickering)
      {
        switch (TL.LightType)
        {
        case LT_Pulse:			// 3 Laggy types of lights
        TL.LightType = LT_Steady;		// Replace this to steady light
        TL.InitialState = '';
        count++;
        if (FlickeringToStatic)
        {
           TL.bSpecialLit = True;
           TL.bLightingVisibility = False;
        }
        break;
        case LT_Blink:
        TL.LightType = LT_Steady;		// Replace this to steady light
        TL.InitialState = '';
        count++;
        if (FlickeringToStatic)
        {
           TL.bSpecialLit = True;
           TL.bLightingVisibility = False;
        }
        break;
        case LT_Flicker:
        TL.LightType = LT_Steady;		// Replace this to steady light
        TL.InitialState = '';
        count++;
        if (FlickeringToStatic)
        {
           TL.bSpecialLit = True;
           TL.bLightingVisibility = False;
        }
        break;
        default:
        break;
        }
      }
      TL.bLightChanged=True;	// Recalculate light now
      if (TL.bStatic)
         TL.ResetStaticFilterState();
  }

  if (Optimize)
    lb_Actions.Addtext("Laggy lights are now fully static.");
  lb_Actions.Addtext("Radius for " @ i @ " lights set to " @ Radius @ ".Removed" @ count @ " flickering/pulsing/blinking light sources");

  foreach AllObjects(class'Light', LE)
  if (LE.bLightChanged)
  LE.bLightChanged = False;
}


// RemoveCoronas
simulated function RemoveCoronas()
{
  local Light tempL;

  // Corona will be rendered because map author decide to force dis. No freedom for players...
  // Somehow this slow down Mesh lighting quite a bit(x2, x3)...
  forEach AllObjects (class'Light', tempL)
  {
    if(tempL.bCorona == true)
    {
      tempL.bCorona = false;
      if(tempL.bStatic)
        tempL.ResetStaticFilterState();
    }
  }
  lb_Actions.Addtext("All coronas disabled!");
}


simulated function OptimizeStaticMeshes()
{
  local StaticMeshActor SMA;
  local Decoration Deco;

  IsUnlited = !IsUnlited;

  foreach AllObjects(class'StaticMeshActor', SMA)
  {
    SMA.bUnlit = IsUnlited;
    SMA.ResetStaticFilterstate();
  }

  foreach AllObjects(class'Decoration', Deco)
  {
    Deco.bUnlit = IsUnlited;
    if (Deco.bStatic)
      Deco.ResetStaticFilterstate();
  }
}


simulated function OptAllLights()
{
  local int i;
  local light L;

  for (i=0; i<CachedLights.length; i++)
  {
    CachedLights[i].bActorShadows = ch_ActorShadows.IsChecked();
    CachedLights[i].bAttenByLife = ch_AttenByLife.IsChecked();
    CachedLights[i].LightRadius = nu_Radius.GetValue();
    CachedLights[i].bLightingVisibility = ch_bLightingVisibility.IsChecked();
    CachedLights[i].bCorona = ch_bCorona.IsChecked();			// Must be tweak
    CachedLights[i].bDirectionalCorona = ch_bDirectionalCorona.IsChecked();

    CachedLights[i].LightBrightness = nu_LightBrightness.GetValue();

    CachedLights[i].LightHue = nu_LightHue.GetValue();
    CachedLights[i].LightSaturation = nu_LightSaturation.GetValue();

    CachedLights[i].bSpecialLit = ch_bSpecialLit.IsChecked();
    CachedLights[i].LightType = ELightType(nu_LightType.GetValue());
    CachedLights[i].LightEffect = ELightEffect(nu_LightEffect.GetValue());
    CachedLights[i].LightCone = nu_LightCone.GetValue();
    CachedLights[i].LightPeriod = nu_LightPeriod.GetValue();

    CachedLights[i].bDynamicLight=ch_bDynamicLight.IsChecked();

    CachedLights[i].bLightChanged=True;	// Recalculate light now

    CachedLights[i].Style = STY_Additive; // Enabling bDeferRendering

    CachedLights[i].bDeferRendering = True;
    CachedLights[i].bUnlit = True;
    CachedLights[i].bStaticLighting = False;

    if (CachedLights[i].bStatic)
      CachedLights[i].ResetStaticFilterState();
  }

  lb_Actions.Addtext("All lights on map set to given parameters");

  if (CachedTriggerLights.length == 0)
    return;

  for (i=0; i<CachedTriggerLights.length; i++)
  {
    CachedTriggerLights[i].bActorShadows = ch_ActorShadows.IsChecked();
    CachedTriggerLights[i].bAttenByLife = ch_AttenByLife.IsChecked();
    CachedTriggerLights[i].LightCone = nu_Radius.GetValue();
    CachedTriggerLights[i].bLightingVisibility = ch_bLightingVisibility.IsChecked();
    CachedTriggerLights[i].bCorona = ch_bCorona.IsChecked();			// Must be tweak
    CachedTriggerLights[i].bDirectionalCorona = ch_bDirectionalCorona.IsChecked();
    CachedTriggerLights[i].LightBrightness = nu_LightBrightness.GetValue();
    CachedTriggerLights[i].LightHue = nu_LightHue.GetValue();
    CachedTriggerLights[i].LightSaturation = nu_LightSaturation.GetValue();
    CachedTriggerLights[i].bSpecialLit = ch_bSpecialLit.IsChecked();
    CachedTriggerLights[i].LightType = ELightType(nu_LightType.GetValue());
    CachedTriggerLights[i].LightEffect = ELightEffect(nu_LightEffect.GetValue());
    CachedTriggerLights[i].LightCone = nu_LightCone.GetValue();
    CachedTriggerLights[i].LightPeriod = nu_LightPeriod.GetValue();

    CachedTriggerLights[i].bDynamicLight=ch_bDynamicLight.IsChecked();
    CachedTriggerLights[i].bLightChanged=True;	// Recalculate light now

    if (CachedTriggerLights[i].bStatic)
      CachedTriggerLights[i].ResetStaticFilterState();
  }

  foreach AllObjects(class'Light', L)
  if (L.bLightChanged)
  L.bLightChanged = False;
}


// ===================================================================
simulated function InternalOnChange(GUIComponent Sender)
{
  /*
  switch (Sender) {
      case ch_HideNiggaz:
      break;
    }
  */
}

defaultproperties
{
     Begin Object Class=GUISectionBackground Name=BGControlsAllMap
         bFillClient=True
         Caption="Control of light sources and shadows on all map"
         WinTop=0.010000
         WinLeft=0.400000
         WinWidth=0.500000
         WinHeight=0.900000
         OnPreDraw=BGControlsAllMap.InternalPreDraw
     End Object
     sb_ControlsAllMap=GUISectionBackground'hidemut.LightMenu.BGControlsAllMap'

     Begin Object Class=GUISectionBackground Name=BGStats
         bFillClient=True
         Caption="Statistics of light sources on current map"
         WinTop=0.510000
         WinWidth=0.400000
         WinHeight=0.460000
         OnPreDraw=BGStats.InternalPreDraw
     End Object
     sb_Stats=GUISectionBackground'hidemut.LightMenu.BGStats'

     Begin Object Class=GUISectionBackground Name=BGTweaker
         bFillClient=True
         Caption="Various lighting tweaks"
         WinTop=0.010000
         WinWidth=0.400000
         WinHeight=0.500000
         OnPreDraw=BGTweaker.InternalPreDraw
     End Object
     sb_Tweaker=GUISectionBackground'hidemut.LightMenu.BGTweaker'

     Begin Object Class=moNumericEdit Name=Radius
         MinValue=0
         MaxValue=1024
         Caption="Light Radius"
         OnCreateComponent=Radius.InternalOnCreateComponent
         Hint="Light radius for all lights"
         OnChange=LightMenu.InternalOnChange
     End Object
     nu_Radius=moNumericEdit'hidemut.LightMenu.Radius'

     Begin Object Class=moNumericEdit Name=LightnewRadius
         MinValue=0
         MaxValue=512
         Caption="New Light radius"
         OnCreateComponent=LightnewRadius.InternalOnCreateComponent
         Hint="New Light radius for laggy lights"
         OnChange=LightMenu.InternalOnChange
     End Object
     nu_newRadius=moNumericEdit'hidemut.LightMenu.LightnewRadius'

     Begin Object Class=moNumericEdit Name=LightmaxRadius
         MinValue=1
         MaxValue=1024
         Caption="Max light Radius"
         OnCreateComponent=LightmaxRadius.InternalOnCreateComponent
         Hint="Max Light radius for laggy lights"
         OnChange=LightMenu.InternalOnChange
     End Object
     nu_maxRadius=moNumericEdit'hidemut.LightMenu.LightmaxRadius'

     Begin Object Class=moNumericEdit Name=LightCone
         MinValue=0
         MaxValue=255
         Caption="LightCone"
         OnCreateComponent=LightCone.InternalOnCreateComponent
         Hint="Changes the size of the lightbeam in specific lights such as the spotlight."
         OnChange=LightMenu.InternalOnChange
     End Object
     nu_LightCone=moNumericEdit'hidemut.LightMenu.LightCone'

     Begin Object Class=moNumericEdit Name=LightPeriod
         MinValue=0
         MaxValue=255
         Caption="LightPeriod"
         OnCreateComponent=LightPeriod.InternalOnCreateComponent
         Hint="Sets speed of selected LightType and/or LightEffect."
         OnChange=LightMenu.InternalOnChange
     End Object
     nu_LightPeriod=moNumericEdit'hidemut.LightMenu.LightPeriod'

     Begin Object Class=moNumericEdit Name=LightBrightness
         MinValue=0
         MaxValue=255
         Caption="LightBrightness"
         OnCreateComponent=LightPeriod.InternalOnCreateComponent
         Hint="How bright the light should be from source and outwards."
         OnChange=LightMenu.InternalOnChange
     End Object
     nu_LightBrightness=moNumericEdit'hidemut.LightMenu.LightBrightness'

     Begin Object Class=moNumericEdit Name=LightHue
         MinValue=0
         MaxValue=255
         Caption="LightHue"
         OnCreateComponent=LightPeriod.InternalOnCreateComponent
         Hint="Allows you to select a color through the default color spectrum. Affects the color chosen."
         OnChange=LightMenu.InternalOnChange
     End Object
     nu_LightHue=moNumericEdit'hidemut.LightMenu.LightHue'

     Begin Object Class=moNumericEdit Name=LightSaturation
         MinValue=0
         MaxValue=255
         Caption="LightSaturation"
         OnCreateComponent=LightSaturation.InternalOnCreateComponent
         Hint="This value sets the amount of white light to mix with the color selected. If the value is set to 0, it will be the pure color. The higher the value, the less rich the color becomes. This is very effective when creating realistic lighting schemes. The default saturation is 127. Affects the chosen color."
         OnChange=LightMenu.InternalOnChange
     End Object
     nu_LightSaturation=moNumericEdit'hidemut.LightMenu.LightSaturation'

     Begin Object Class=moNumericEdit Name=LightEffect
         MinValue=0
         MaxValue=15
         Caption="LightEffect"
         OnCreateComponent=LightEffect.InternalOnCreateComponent
         Hint="Adds an animation to the light."
         OnChange=LightMenu.InternalOnChange
     End Object
     nu_LightEffect=moNumericEdit'hidemut.LightMenu.LightEffect'

     Begin Object Class=moNumericEdit Name=LightType
         MinValue=0
         MaxValue=8
         Caption="LightType"
         OnCreateComponent=LightType.InternalOnCreateComponent
         Hint="Light types affect the brightness and darkness values of a lights' lighteffect."
         OnChange=LightMenu.InternalOnChange
     End Object
     nu_LightType=moNumericEdit'hidemut.LightMenu.LightType'

     Begin Object Class=moCheckBox Name=moOptimize
         Caption="Toggle static lighting on laggy lights"
         OnCreateComponent=moOptimize.InternalOnCreateComponent
         Hint="Toggle static lighting on laggy lights(if they are >maxRadus)"
         OnChange=LightMenu.InternalOnChange
     End Object
     ch_Optimize=moCheckBox'hidemut.LightMenu.moOptimize'

     Begin Object Class=moCheckBox Name=moRemoveFlickering
         Caption="Remove flickering lights"
         OnCreateComponent=moRemoveFlickering.InternalOnCreateComponent
         Hint="Remove flickering, blinking, pulse lights cuz fuk TWI optimization bullcrap"
         OnChange=LightMenu.InternalOnChange
     End Object
     ch_RemoveFlickering=moCheckBox'hidemut.LightMenu.moRemoveFlickering'

     Begin Object Class=moCheckBox Name=moFlickeringToStatic
         Caption="Flickering to Static lighting"
         OnCreateComponent=moFlickeringToStatic.InternalOnCreateComponent
         Hint="Makes all flickering lights static and steady"
         OnChange=LightMenu.InternalOnChange
     End Object
     ch_FlickeringToStatic=moCheckBox'hidemut.LightMenu.moFlickeringToStatic'

     Begin Object Class=moCheckBox Name=moActorShadows
         Caption="Actor Shadows"
         OnCreateComponent=moActorShadows.InternalOnCreateComponent
         Hint="Light casts actor shadows."
         OnChange=LightMenu.InternalOnChange
     End Object
     ch_ActorShadows=moCheckBox'hidemut.LightMenu.moActorShadows'

     Begin Object Class=moCheckBox Name=moAttenByLife
         Caption="Attenuate light"
         OnCreateComponent=moAttenByLife.InternalOnCreateComponent
         Hint="Attenuate light by diminishing lifespan"
         OnChange=LightMenu.InternalOnChange
     End Object
     ch_AttenByLife=moCheckBox'hidemut.LightMenu.moAttenByLife'

     Begin Object Class=moCheckBox Name=moCorona
         Caption="Light Corona"
         OnCreateComponent=moCorona.InternalOnCreateComponent
         Hint="Toggle Coronas"
         OnChange=LightMenu.InternalOnChange
     End Object
     ch_bCorona=moCheckBox'hidemut.LightMenu.moCorona'

     Begin Object Class=moCheckBox Name=moDirectionalCorona
         Caption="Directional Corona"
         OnCreateComponent=moDirectionalCorona.InternalOnCreateComponent
         Hint="(if bCorona) Make corona bigger if it faces you, and zero and 90 degrees or beyond."
         OnChange=LightMenu.InternalOnChange
     End Object
     ch_bDirectionalCorona=moCheckBox'hidemut.LightMenu.moDirectionalCorona'

     Begin Object Class=moCheckBox Name=moDynamicLight
         Caption="DynamicLight"
         OnCreateComponent=moDirectionalCorona.InternalOnCreateComponent
         Hint="Use dynamic light on lightsources"
         OnChange=LightMenu.InternalOnChange
     End Object
     ch_bDynamicLight=moCheckBox'hidemut.LightMenu.moDynamicLight'

     Begin Object Class=moCheckBox Name=moLightingVisibility
         Caption="LightingVisibility"
         OnCreateComponent=moDirectionalCorona.InternalOnCreateComponent
         Hint="Calculate Lighting Visibility by using line checks"
         OnChange=LightMenu.InternalOnChange
     End Object
     ch_bLightingVisibility=moCheckBox'hidemut.LightMenu.moLightingVisibility'

     Begin Object Class=moCheckBox Name=moSpecialLit
         Caption="SpecialLit"
         OnCreateComponent=moDirectionalCorona.InternalOnCreateComponent
         Hint="Special Lit adds another layer of lighting used to isolate lighting to specific surfaces."
         OnChange=LightMenu.InternalOnChange
     End Object
     ch_bSpecialLit=moCheckBox'hidemut.LightMenu.moSpecialLit'

     Begin Object Class=GUIScrollTextBox Name=lbActions
         bNoTeletype=True
         CharDelay=0.000000
         EOLDelay=0.000000
         RepeatDelay=0.000000
         OnCreateComponent=lbActions.InternalOnCreateComponent
         FontScale=FNS_Small
         bNeverFocus=True
     End Object
     lb_Actions=GUIScrollTextBox'hidemut.LightMenu.lbActions'

     Begin Object Class=GUIButton Name=HideLights_Button
         Caption="Optimize lights!"
         Hint="Optimize light radius to your value(if light radius >maxRadius)"
         OnClick=LightMenu.ButtonClicked
         OnKeyEvent=HideLights_Button.InternalOnKeyEvent
     End Object
     b_HideLights=GUIButton'hidemut.LightMenu.HideLights_Button'

     Begin Object Class=GUIButton Name=OptAllLights_Button
         Caption="Optimize all lights!"
         Hint="Optimize all lights on map by given parameters"
         OnClick=LightMenu.ButtonClicked
         OnKeyEvent=OptAllLights_Button.InternalOnKeyEvent
     End Object
     b_OptAllLights=GUIButton'hidemut.LightMenu.OptAllLights_Button'

     Begin Object Class=GUIButton Name=MakeAllLightVisible_Button
         Caption="Make all lights visible to player(debug)"
         Hint="Debug light sources"
         OnClick=LightMenu.ButtonClicked
         OnKeyEvent=MakeAllLightVisible_Button.InternalOnKeyEvent
     End Object
     b_MakeAllLightVisible=GUIButton'hidemut.LightMenu.MakeAllLightVisible_Button'

     Begin Object Class=GUIButton Name=DisableCoronas_Button
         Caption="Remove coronas"
         Hint="Remove coronas from light sources"
         OnClick=LightMenu.ButtonClicked
         OnKeyEvent=DisableCoronas_Button.InternalOnKeyEvent
     End Object
     b_DisableCoronas=GUIButton'hidemut.LightMenu.DisableCoronas_Button'

     Begin Object Class=GUIButton Name=SaveConfig_Button
         Caption="Save config variables"
         Hint="Remove coronas from light sources"
         OnClick=LightMenu.ButtonClicked
         OnKeyEvent=SaveConfig_Button.InternalOnKeyEvent
     End Object
     b_SaveConfig=GUIButton'hidemut.LightMenu.SaveConfig_Button'

     Begin Object Class=GUIButton Name=OptStatic_Button
         Caption="Optimize lighting on static meshes"
         Hint="Apply bUnlit to all static meshes. Fixes retarded light calculate render to static meshes"
         OnClick=LightMenu.ButtonClicked
         OnKeyEvent=OptStatic_Button.InternalOnKeyEvent
     End Object
     b_OptStatic=GUIButton'hidemut.LightMenu.OptStatic_Button'

     Begin Object Class=GUIButton Name=clearLog
         Caption="Clear log spam"
         Hint="Clear log"
         OnClick=LightMenu.ButtonClicked
         OnKeyEvent=clearLog.InternalOnKeyEvent
     End Object
     b_ClearLog=GUIButton'hidemut.LightMenu.clearLog'

     PropagateVisibility=False
     WinHeight=1.000000
}