class menu_c_HideMut extends GUI2K4.MidGamePanel
  config(HideMut);

//===============================================================Strructs

// struct for useless map objects to hide and etc
struct UselessStuff
{
  var string MapName;
  var string ProfileName;
  var array<string> uselessStaticMeshes;
  var array<string> uselessEmitters;
  var array<string> uselessLights;
  var array<string> uselessDecorations;
  var array<string> uselessMovers;
  var array<string> uselessProjectors;
  var array<string> uselessRotatingMeshActors;
};

// struct for culled static meshes
struct DefaultCulling
{
  var transient array<StaticMeshActor> cullStaticMeshes;
  var array<float> cullDistanceSt;
};

// for ambient sounds
struct SoundDefault
{
  var transient array<AmbientSound> AmbientSoundName;
  var transient array<Sound> AmbientSound;
  var array<float> SoundPitch;
  var array<float> SoundVolume;
  var array<float> TransientSoundRadius;
  var array<float> TransientSoundVolume;
};

//===============================================================Strructs
var(DEBUG) transient array<StaticMeshActor>      cachedStaticMeshes;  //Caches
var(DEBUG) transient array<Light>                cachedLights;
var(DEBUG) transient array<Emitter>              cachedEmitters;
var(DEBUG) transient array<Decoration>           cachedDecorations;
var(DEBUG) transient array<Mover>                cachedMovers;
var(DEBUG) transient array<Projector>            cachedProjectors;    //KFBloodSplatter
var(DEBUG) transient array<KF_RotatingMeshActor> cachedRotatingMeshActors;

var transient array<StaticMeshActor>  justStatic;
var transient array<Emitter>       justEmitter;
var transient array<Decoration>      justDecos;
var transient array<Mover>        justMover;

var bool first_Run, first_sounds, bCached, bShow, bDoNotDoShit, bNoEmitters;        //sound and culling system

var soundDefault OriginalSound;

var DefaultCulling DefaultCullMeshes;      //For default Culling
var DefaultCulling CulledStaticMeshes;      //For modified culling

//=================================================================Interface section
var automated GUISectionBackground   sb_HideStaticMesh_List, sb_Misc, sb_HideStaticMesh,
                                     sb_Collision_Flagz, sb_HideActors, sb_Log;

var    automated  GUIButton     b_HideAllActors, b_CacheAllActors,
                                     b_JustButton, b_DisplayCachedActors,
                                     b_ClearCache, b_ActivateInteraction,
                                     b_KillEmitters,
                                     b_CullDistance,
                                     b_Disabler,
                                     b_NoAnimShit,
                                     b_SaveConfigSettings,
                                     b_LoadConfigSettings,
                                     b_ClearLog,
                                     b_StartMapOptimizer;

var automated MOCheckBox        ch_HideNiggaz, ch_HideEmitters,
                                     ch_HideTerrain,ch_HideStaticMeshes,
                                     ch_muteAll,
                                     ch_BlockActors, ch_BlockZeroExtentTraces,
                                     ch_HideStaticMeshesWithNoCollision,
                                     ch_HideDecosWithNoCollision,
                                     ch_HideEmittersWithNoInstigator,
                                     ch_KillAllEmitters, ch_RemoveAnimatedShit,
                                     ch_HideMoversWithNoCollision;


var automated moFloatEdit fl_CullDistance;

var PlayerController PC;
/*
var     Automated   GUIListBox       lb_ActortListsList;
var     GUIList                      Mo_Profiles;
*/
var Automated MoComboBox Mo_Profiles, Mo_Logic;

var array<GUIButton> LColumn;

var automated GUIScrollTextBox lb_Actions;

//==========================================================Interface section end

var string mapName;
var array<int> ProfileIndexes;
var a_MapOptimizer MapOpt;
//==========================================================Config variables

var config array<string> AnimatedMeshesNames;
var config array<UselessStuff> MapSpecificObj;
var config array<string> uselessSM, uselessEmitter, uselessMover, uselessDecoration;
var config bool bHideNiggaz, bHideEmitters, bHideTerrain,bHideStaticMeshes, bmuteAll, bBlockActors, bBlockZeroExtentTraces,
                bHideStaticMeshesWithNoCollision,
                bHideDecosWithNoCollision,
                bHideEmittersWithNoInstigator,
                bHideMoversWithNoCollision;
var config float StaticMesh_CullDistance;
var config string MoLogic;
var config bool bApplyTweaks,  bKillAllEmitters;
var bool bConfigLoaded, bRemoveAnimatedShit;
//==========================================================Config variables end
var string colorG, colorB, colorY, colorW;    //Colors


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

  super.InitComponent(MyController, MyOwner);
  //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;
        }
  }

  PC = PlayerOwner();

  colorG=chr(27)$chr(1)$chr(240)$chr(1);
  colorB=chr(27)$chr(90)$chr(90)$chr(240);
  colorY=chr(27)$chr(127)$chr(127)$chr(1);
  colorW=chr(27)$chr(255)$chr(255)$chr(255);

  sb_Log.ManageComponent(lb_Actions);
  sb_Log.ManageComponent(b_ClearLog);

  sb_Misc.ManageComponent(ch_HideNiggaz);
  sb_Misc.ManageComponent(ch_HideEmitters);
  sb_Misc.ManageComponent(ch_HideTerrain);
  sb_Misc.ManageComponent(ch_HideStaticMeshes);
  sb_Misc.ManageComponent(ch_KillAllEmitters);
  sb_Misc.ManageComponent(b_KillEmitters);
  sb_Misc.ManageComponent(fl_CullDistance);
  sb_Misc.ManageComponent(b_CullDistance);
  sb_Misc.ManageComponent(b_Disabler);

  sb_HideStaticMesh_List.ManageComponent(Mo_Profiles);

  sb_HideStaticMesh_List.ManageComponent(b_CacheAllActors);
  sb_HideStaticMesh_List.ManageComponent(b_HideAllActors);
  sb_HideStaticMesh_List.ManageComponent(b_DisplayCachedActors);
  sb_HideStaticMesh_List.ManageComponent(b_ClearCache);
  sb_HideStaticMesh_List.ManageComponent(b_SaveConfigSettings);
  sb_HideStaticMesh_List.ManageComponent(b_LoadConfigSettings);

  LColumn[0]= b_CacheAllActors;
  LColumn[1]= b_HideAllActors;
  LColumn[2] = b_DisplayCachedActors;
  LColumn[3] = b_ClearCache;

  Mo_Logic.AddItem("And");
  Mo_Logic.AddItem("Or");

  sb_HideStaticMesh.ManageComponent(b_ActivateInteraction);
  sb_HideStaticMesh.ManageComponent(ch_RemoveAnimatedShit);
  sb_HideStaticMesh.ManageComponent(b_NoAnimShit);
  sb_HideStaticMesh.ManageComponent(ch_muteAll);

  sb_HideStaticMesh.ManageComponent(b_StartMapOptimizer);

  sb_Collision_Flagz.ManageComponent(Mo_Logic);
  sb_Collision_Flagz.ManageComponent(ch_BlockActors);
  sb_Collision_Flagz.ManageComponent(ch_BlockZeroExtentTraces);

  sb_HideActors.ManageComponent(ch_HideStaticMeshesWithNoCollision);
  sb_HideActors.ManageComponent(ch_HideDecosWithNoCollision);
  sb_HideActors.ManageComponent(ch_HideEmittersWithNoInstigator);
  sb_HideActors.ManageComponent(ch_HideMoversWithNoCollision);
  sb_HideActors.ManageComponent(b_JustButton);
}

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

//====================Config params
function SaveConfigParams()
{
  bHideNiggaz = ch_HideNiggaz.IsChecked();
  bHideEmitters = ch_HideEmitters.IsChecked();
  bHideTerrain = ch_HideTerrain.IsChecked();
  bHideStaticMeshes = ch_HideStaticMeshes.IsChecked();
  bmuteAll = ch_muteAll.IsChecked();
  bBlockActors = ch_BlockActors.IsChecked();
  bBlockZeroExtentTraces = ch_BlockZeroExtentTraces.IsChecked();
  bHideStaticMeshesWithNoCollision = ch_HideStaticMeshesWithNoCollision.IsChecked();
  bHideDecosWithNoCollision = ch_HideDecosWithNoCollision.IsChecked();
  bHideEmittersWithNoInstigator = ch_HideEmittersWithNoInstigator.IsChecked();
  bHideMoversWithNoCollision = ch_HideMoversWithNoCollision.IsChecked();
  StaticMesh_CullDistance = fl_CullDistance.GetValue();
  bRemoveAnimatedShit = ch_RemoveAnimatedShit.IsChecked();
  bKillAllEmitters = ch_KillAllEmitters.IsChecked();
  MoLogic = Mo_Logic.GetText();
  lb_Actions.Addtext("Saving parameters to config...");
  SaveConfig();
}

function LoadConfigParams()
{
  bDoNotDoShit = true;    //Do not let menu do something that we don't want aka multiple config loads and other shit
  lb_Actions.Addtext("Loading params from config...");
  lb_Actions.Addtext("Apply tweaks is" @ bApplyTweaks @ ". Check your config if you want to apply tweaks at runtime...");
  ch_HideNiggaz.Checked(bHideNiggaz);
  ch_HideEmitters.Checked(bHideEmitters);
  ch_HideTerrain.Checked(bHideTerrain);
  ch_HideStaticMeshes.Checked(bHideStaticMeshes);
  ch_muteAll.Checked(bmuteAll);
  Mo_Logic.SetIndex(Mo_Logic.FindIndex(MoLogic));
  ch_BlockActors.Checked(bBlockActors);
  ch_BlockZeroExtentTraces.Checked(bBlockZeroExtentTraces);
  ch_HideStaticMeshesWithNoCollision.Checked(bHideStaticMeshesWithNoCollision);
  ch_HideDecosWithNoCollision.Checked(bHideDecosWithNoCollision);
  ch_HideEmittersWithNoInstigator.Checked(bHideEmittersWithNoInstigator);
  ch_HideMoversWithNoCollision.Checked(bHideMoversWithNoCollision);
  fl_CullDistance.SetValue(StaticMesh_CullDistance);
  ch_RemoveAnimatedShit.Checked(bRemoveAnimatedShit);
  ch_KillAllEmitters.Checked(bKillAllEmitters);

  if (bApplyTweaks && !bConfigLoaded)  //Do not apply tweaks if user decided to mash load settings button
  {
    lb_Actions.Addtext("Applying tweaks....");
    bDoNotDoShit = false;
        if (bHideNiggaz)
            removeBlackBitch(bHideNiggaz);
        if (bHideEmitters)
            hideAllEmitters(bHideEmitters);
        if (bHideTerrain)
            hideTerrain(bHideTerrain);
        if (bHideStaticMeshes)
            hideAllStaticMeshes(bHideStaticMeshes);
        if (bmuteAll)
            {
                if (!first_sounds)
                grabDefaultSounds();
            MuteAll();
            }
        if (bHideStaticMeshesWithNoCollision || bHideDecosWithNoCollision || bHideEmittersWithNoInstigator || bHideMoversWithNoCollision)
            toggleMeshesWithNoCollision();
        if (bKillAllEmitters)
            KillAllEmitters();
        if (StaticMesh_CullDistance > 0 && bApplyTweaks)
        {
            if (DefaultCullMeshes.cullStaticMeshes.length == 0)
                GrabCullDistances();
            CullDistanceSetAllStaticMeshes();
        }
        if (bRemoveAnimatedShit)
        NoAnimShit();
    }
  bDoNotDoShit = false;
}


//====================================================
function bool InternalOnPreDraw(Canvas C)
{
  // local int i;
  // local float x,w,h;

  // w = b_CacheAllActors.ActualWidth();
  // h = b_CacheAllActors.ActualHeight();

  // for (i = 0; i < LColumn.length; i++)
  //     LColumn[i].SetPosition(x, LColumn[i].ActualTop(), w, h, true);

  // x = sb_HideStaticMesh_List.ActualLeft() + sb_HideStaticMesh_List.ActualWidth() - LColumn[0].ActualLeft() - w;

  // // Right column for stat meshes list

  // for (i = 0; i < LColumn.length; i++)
  // // RColumn[i].SetPosition(x/1.5, LColumn[i].ActualTop(), w, h, true);

  // return false;

  // ADDITION
  return false;
}


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;
}

event Opened(GUIComponent Sender)
{
  local int i,k;

  super.Opened(Sender);
  PC = PlayerOwner();

  mapName = PC.Level.GetURLMap();
  b_CacheAllActors.MenuState=MSAT_Disabled;
  b_HideAllActors.MenuState=MSAT_Disabled;
  b_DisplayCachedActors.MenuState=MSAT_Disabled;

  //refresh list with ActortLists
  Mo_Profiles.ResetComponent();

  if (MapSpecificObj.Length == 0)    //just in case of empty config
    return;

  //======================================
  /*
    Stfu.MapName="KF-ThrillsChills";
    Stfu.ProfileName = "Optimize map";

    for ( i = 0; i < uselessSM.Length; i++ )
    {
    if (i < 31)
    Stfu.uselessStaticMeshes[i] = uselessSM[i];
    else if (i>31)
    Stfu.uselessEmitters[i] = uselessSM[i];
    else if (i>62)
    Stfu.uselessDecorations[i] = uselessSM[i];
    else if (i>92)
    Stfu.uselessMovers[i] = uselessSM[i];
    else if (i>92)
    Stfu.uselessProjectors[i] = uselessSM[i];

    lb_Actions.Addtext(Stfu.uselessStaticMeshes[i]);
    lb_Actions.Addtext(uselessSM[i]);
    lb_Actions.Addtext(i);
    }
    /*
    for ( i = 0; i < uselessEmitter.Length; i++ )
    {
    Stfu.uselessEmitters[i] = uselessEmitter[i];
    }

    for ( i = 0; i < uselessDecoration.Length; i++ )
    {
    Stfu.uselessDecorations[i] = uselessDecoration[i];
    }

    for ( i = 0; i < uselessMover.Length; i++ )
    {
    Stfu.uselessMovers[i] = uselessMover[i];
    }
    */

    MapSpecificObj[MapSpecificObj.Length] = Stfu;

    for ( i = 0; i < STFU.uselessStaticMeshes.Length; i++ )
    {
    lb_Actions.Addtext(Stfu.uselessStaticMeshes[i]);
    }
    SaveConfig();
    */
    //==============================================

    for ( i = 0; i < MapSpecificObj.Length; i++ )
        {

        //lb_Actions.Addtext(MapSpecificObj[i].uselessStaticMeshes[0] @ MapSpecificObj[i].uselessStaticMeshes[1] @ MapSpecificObj[i].uselessStaticMeshes[2]);
        if (CAPS(MapSpecificObj[i].MapName) == CAPS(MapName))
            {
            Mo_Profiles.addItem(MapSpecificObj[i].ProfileName);    //Adding profile name to list

            ProfileIndexes[k] = i;        //Add indexes(id) profiles for our array
            k++;
            b_CacheAllActors.MenuState=MSAT_Blurry;
            }
        }
    if (!bConfigLoaded)
    {
    LoadConfigParams();
    bConfigLoaded = true;
    }
}


simulated function Closed(GUIComponent Sender, bool bCancelled)
{
  super.Closed(Sender, bCancelled);
}


simulated function bool ButtonClicked(GUIComponent Sender)
{
  switch (Sender)
  {
    case b_CacheAllActors:
      bCached = true;
      b_HideAllActors.MenuState=MSAT_Blurry;
      b_HideAllActors.MenuState=MSAT_Blurry;
      b_DisplayCachedActors.MenuState=MSAT_Blurry;
      cacheStaticMeshes();
      cacheLights();
      cacheEmitters();
      cacheDecorations();
      cacheMovers();
      cacheRotatingMeshActors();
      break;
    case b_KillEmitters:
      KillAllEmitters();
      break;
    case b_Disabler:
      break;
    case b_HideAllActors:
      if (bCached)    //We have cached elements
      {
        checkAvailability();    //none elements clear
        if (!bShow)    //Show or hide cached elements
        {
          bShow = true;
          lb_Actions.Addtext(colorW$"----------------------------------------");
          lb_Actions.Addtext(colorG$"Following actors were hided:");
          hideStaticMeshes();
          hideLights();
          hideEmitters();
          hideDecorations();
          hideMovers();
          hideRotatingMeshActors();
          lb_Actions.Addtext(colorW$"----------------------------------------");
        }
        else
        {
          bShow = false;
          lb_Actions.Addtext(colorW$"----------------------------------------");
          lb_Actions.Addtext(colorG$"Following actors were showed:");
          showStaticMeshes();
          showLights();
          showEmitters();
          showDecorations();
          showMovers();
          showRotatingMeshActors();
          lb_Actions.Addtext(colorW$"----------------------------------------");
          break;
        }
      }
      else
      {
        lb_Actions.Addtext(colorW$"Cache is empty....");
      }

    case b_JustButton:
      toggleMeshesWithNoCollision();
      break;

    case b_DisplayCachedActors:
      checkAvailability();
      lb_Actions.Addtext(colorW$"----------------------------------------");
      lb_Actions.Addtext(colorG$"Cached actors:");
      displayCachedStaticMeshes();
      displayCachedLights();
      displayCachedEmitters();
      displayCachedDecorations();
      displayCachedMovers();
      displayCachedRotatingMeshActors();
      lb_Actions.Addtext(colorW$"----------------------------------------");
      break;

    case b_ClearCache:
      clearCache();
      b_HideAllActors.MenuState=MSAT_Disabled;
      break;

    case b_CullDistance:
      if (DefaultCullMeshes.cullStaticMeshes.length == 0)
        GrabCullDistances();
      CullDistanceSetAllStaticMeshes();
      break;

    case b_NoAnimShit:
      NoAnimShit();
      break;

    case b_ActivateInteraction:
      break;

    case b_SaveConfigSettings:
      SaveConfigParams();
      break;

    case b_LoadConfigSettings:
      LoadConfigParams();
      break;

    case b_StartMapOptimizer:
      StartStopMapOptimizer();
      break;

    default:
      return false;
  }
  return true;
}


// Toggle map optimizer on off
simulated function StartStopMapOptimizer()
{
  if (MapOpt == none)
  {
    MapOpt = PC.Spawn(class'a_MapOptimizer', PC);
    MapOpt.StartMapOptimizer();
  }
  else
  {
    MapOpt.StopMapOptimizer();
    MapOpt.Destroy();
    MapOpt = none;
  }
}

// STATIC MESHES
simulated function cacheStaticMeshes()
{
  local StaticMeshActor tempSM;
  local array<string> uselessStaticMeshes;
  local int i, count;

  uselessStaticMeshes = MapSpecificObj[ProfileIndexes[Mo_Profiles.getIndex()]].uselessStaticMeshes;

  //ALC.getUselessStaticMeshes(Mo_Profiles.get(false));

  lb_Actions.Addtext("Meshes in ini file:"$uselessStaticMeshes.length);

  forEach AllObjects (class'StaticMeshActor', tempSM)
  {
    for(i = 0; i < uselessStaticMeshes.length; i++)
    {
      if(string(tempSM.name) == uselessStaticMeshes[i])
      {
        cachedStaticMeshes[cachedStaticMeshes.length] = tempSM;
        uselessStaticMeshes.remove(i,1);
        count++;
        break;
      }
    }
  }
  lb_Actions.Addtext("Meshes added:"$count);
  lb_Actions.Addtext(colorG$"All static meshes were cached sucessfully.");
}


simulated function hideStaticMeshes()
{
  local int i;

  lb_Actions.Addtext(colorB$"Static meshes");

  for(i = 0; i < cachedStaticMeshes.length; i++)
  {
    if(cachedStaticMeshes[i].bHidden == false)
    {
      cachedStaticMeshes[i].bHidden = true;
      if (cachedStaticMeshes[i].bStatic)
        cachedStaticMeshes[i].ResetStaticFilterState();
      lb_Actions.Addtext(colorY$"  "@string(cachedStaticMeshes[i].name));
    }
  }
}


simulated function showStaticMeshes()
{
  local int i;

  lb_Actions.Addtext(colorB$"Static meshes");

  for(i = 0; i < cachedStaticMeshes.length; i++)
  {
    if(cachedStaticMeshes[i].bHidden == true)
    {
      cachedStaticMeshes[i].bHidden = false;
      if (cachedStaticMeshes[i].bStatic)
        cachedStaticMeshes[i].ResetStaticFilterState();
      lb_Actions.Addtext(colorY$"  "@string(cachedStaticMeshes[i].name));
    }
  }
}


//=========================================================All Static meshes
simulated function hideAllStaticMeshes(bool Flag)
{
  local StaticMeshActor tempSM;

  forEach AllObjects (class'StaticMeshActor', tempSM)
  {
    tempSM.bHidden = Flag;
    tempSM.ResetStaticFilterState();
  }

  if (Flag)
    lb_Actions.Addtext(colorB$"All Static meshes, decoratins and movers were hidden");
  else
    lb_Actions.Addtext(colorB$"All Static meshes were shown");
}


simulated function hideAllDecorations(bool Flag)
{
  local Decoration tempD;

  forEach AllObjects(class'Decoration', tempD)
  {
    tempD.bHidden = Flag;
    if(tempD.bStatic)
      tempD.ResetStaticFilterState();
  }

  if (Flag)
    lb_Actions.Addtext(colorB$"All Static meshes, decoratins and movers were hidden");
  else
    lb_Actions.Addtext(colorB$"All Static meshes were shown");
}


simulated function hideAllMovers(bool Flag)
{
  local Mover tempM;

  forEach AllObjects (class'Mover', tempM)
  {
    //if(tempM.bBlockActors == false && tempM.bBlockZeroExtentTraces == false)
    tempM.bHidden = Flag;
    if (tempM.bStatic)
      tempM.ResetStaticFilterState();
  }

  if (Flag)
    lb_Actions.Addtext(colorB$"All Static meshes, decoratins and movers were hidden");
  else
    lb_Actions.Addtext(colorB$"All Static meshes were shown");
}


simulated function hideAllRotatingMeshActors(bool Flag)
{
  local KF_RotatingMeshActor tempR;

  forEach AllObjects (class'KF_RotatingMeshActor', tempR)
  {
    tempR.bHidden = Flag;
    if (tempR.bStatic)
      tempR.ResetStaticFilterState();
  }

  if (Flag)
    lb_Actions.Addtext(colorB$"All Static meshes, decoratins and movers were hidden");
  else
    lb_Actions.Addtext(colorB$"All Static meshes were shown");
}


//=========================================================All Static meshes
//=========================================================All Emitters
simulated function hideAllEmitters(bool Flag)
{
  local Emitter tempE;

  if (Flag)      //Hide Emitters
  {
    forEach AllObjects (class'Emitter', tempE)
    {
      tempE.bHidden = true;
      tempE.ResetStaticFilterState();
    }
    lb_Actions.Addtext(colorB$"All fucking emitters were hidden");
  }
  else
  {
    forEach AllObjects (class'Emitter', tempE)
    {
      tempE.bHidden = false;
      tempE.ResetStaticFilterState();
    }
    lb_Actions.Addtext(colorB$"All fucking emitters were shown");
  }
}


simulated function KillAllEmitters()      //Bye-bye faggots
{
  local Emitter tempE;

  forEach AllObjects (class'Emitter', tempE)
  {
    tempE.Kill();
  }
  bNoEmitters = true; //BugFix for native-related crash
}


//=========================================================Emitters
//=========================================================Terrain Hide for heavy mapz
simulated function hideTerrain(bool Flag)
{
  local ZoneInfo zoneE;

  forEach AllObjects (class'ZoneInfo', zoneE)
  {
    zoneE.bTerrainZone = !Flag;
    zoneE.ResetStaticFilterState();
  }

  if (flag)
    lb_Actions.Addtext(colorB$"All terrain were hided");
  else
    lb_Actions.Addtext(colorB$"All terrain were shown");
}


//=========================================================Niggaz hide/show
simulated function removeBlackBitch(bool Flag)
{
  local WeaponLocker Nigga;

  forEach AllObjects(class'WeaponLocker', Nigga)
  {
    Nigga.bHidden = Flag;
  }

  if (flag)
    lb_Actions.Addtext("All niggaz are hided");
  else
    lb_Actions.Addtext("All niggaz were shown");
}


//=========================================================Niggaz hide/show
//=========================================================Experimental culldistance set
simulated function CullDistanceSetAllStaticMeshes()
{
  local StaticMeshActor tempSM;
  local float cullDistance;
  local int i;

  cullDistance = fl_CullDistance.GetValue();
  if (cullDistance == -1 && CulledStaticMeshes.cullStaticMeshes.length != 0)
  {
    RestoreCullDistanceSetAllStaticMeshes();
    return;
  }

  forEach AllObjects (class'StaticMeshActor', tempSM)
  {
    if (!tempSM.bHidden)
    {
      tempSM.culldistance = culldistance;
      tempSM.ResetStaticFilterState();
      i++;
    }
  }

  lb_Actions.Addtext(colorB$"Cull distance for all statice meshes set to " @ string(cullDistance));
}


simulated function RestoreCullDistanceSetAllStaticMeshes()
{
  local StaticMeshActor tempSM;
  local int i;

  for (i=0; i<CulledStaticMeshes.cullStaticMeshes.length; i++)
  {
    tempSM = CulledStaticMeshes.cullStaticMeshes[i];
    if (tempSM.bHidden == false)
    {
      tempSM.culldistance = CulledStaticMeshes.cullDistanceSt[i];
      tempSM.ResetStaticFilterState();
    }
  }
  lb_Actions.Addtext(colorB$"Cull distance for all static meshes restored to default");
}


simulated function GrabCullDistances()
{
  local StaticMeshActor tempSM;
  local int i;

  forEach AllObjects (class'StaticMeshActor', tempSM)
  {
    if (!tempSM.bHidden)
    {
      DefaultCullMeshes.cullStaticMeshes[DefaultCullMeshes.cullStaticMeshes.length] = tempSM;
      DefaultCullMeshes.cullDistanceSt[DefaultCullMeshes.cullDistanceSt.length] = tempSM.cullDistance;
    }
  }

  if (DefaultCullMeshes.cullStaticMeshes.length != 0)
        For (i=0; i<DefaultCullMeshes.cullStaticMeshes.length; i++)
            if (DefaultCullMeshes.cullStaticMeshes[i] == none)
            DefaultCullMeshes.cullStaticMeshes.Remove(i,1);
  else
    lb_Actions.Addtext(colorB$"No static mesh on map!");
}

//=========================================================Experimental culldistance set
simulated function displayCachedStaticMeshes()
{
  local int i;

  lb_Actions.Addtext(colorB$"Static meshes ["$cachedStaticMeshes.length$"]");

  for(i = 0; i < cachedStaticMeshes.length; i++)
    lb_Actions.Addtext(colorY$"  "@string(cachedStaticMeshes[i].name));
}

/*LIGHTS*/
simulated function cacheLights()
{
    local Light tempL;
    local array<string> uselessLights;
    local int i;

    //uselessLights = ALC.getUselessLights(Mo_Profiles.get(false));
    uselessLights = MapSpecificObj[ProfileIndexes[Mo_Profiles.getIndex()]].uselessLights;

    forEach AllObjects (class'Light', tempL)
    {

        for(i = 0; i < uselessLights.length; i++)
        {
            if(string(tempL.name) == uselessLights[i])
            {
                cachedLights[cachedLights.length] = tempL;
                uselessLights.remove(i,1);
                break;
            }
        }
    }
    lb_Actions.Addtext(colorG$"All lights were cached sucessfully.");
}


simulated function hideLights()
{
  local int i;

  lb_Actions.Addtext(colorB$"Lights[coronas]");

  for (i = 0; i < cachedLights.length; i++)
  {
    if (cachedLights[i].bCorona == true)
    {
      cachedLights[i].bCorona = false;
      if (cachedLights[i].bStatic)
        cachedLights[i].ResetStaticFilterState();
      lb_Actions.Addtext(colorY$"  "@string(cachedLights[i].name));
    }
  }
}


simulated function showLights()
{
  local int i;

  lb_Actions.Addtext(colorB$"Lights[coronas]");

  for (i = 0; i < cachedLights.length; i++)
  {
    if (cachedLights[i].bCorona == false)
    {
      cachedLights[i].bCorona = true;
      if (cachedLights[i].bStatic)
        cachedLights[i].ResetStaticFilterState();
      lb_Actions.Addtext(colorY$"  "@string(cachedLights[i].name));
    }
  }
}


simulated function displayCachedLights()
{
  local int i;

  lb_Actions.Addtext(colorB$"Lights ["$cachedLights.length$"]");

  for (i = 0; i < cachedLights.length; i++)
    lb_Actions.Addtext(colorY$"  "@string(cachedLights[i].name));
}


// EMITTERS
simulated function cacheEmitters()
{
  local Emitter tempE;
  local array<string> uselessEmitters;
  local int i;

  // uselessEmitters = ALC.getUselessEmitters(Mo_Profiles.get(false));
  uselessEmitters = MapSpecificObj[ProfileIndexes[Mo_Profiles.getIndex()]].uselessEmitters;

  forEach AllObjects (class'Emitter', tempE)
  {
    for (i = 0; i < uselessEmitters.length; i++)
    {
      if (string(tempE.name) == uselessEmitters[i])
      {
        cachedEmitters[cachedEmitters.length] = tempE;
        uselessEmitters.remove(i,1);
        break;
      }
    }
  }
  lb_Actions.Addtext(colorG$"All emitters were cached sucessfully.");
}


simulated function hideEmitters()
{
  local int i;

  lb_Actions.Addtext(colorB$"Emitters");

  for (i = 0; i < cachedEmitters.length; i++)
  {
    if (cachedEmitters[i].bHidden == false)
    {
      cachedEmitters[i].bHidden = true;
      if (cachedEmitters[i].bStatic)
        cachedEmitters[i].ResetStaticFilterState();
      // lb_Actions.Addtext(colorY$"  "@string(cachedEmitters[i].name));
    }
  }
}


simulated function showEmitters()
{
  local int i;

  lb_Actions.Addtext(colorB$"Emitters");

  for (i = 0; i < cachedEmitters.length; i++)
  {
    if (cachedEmitters[i].bHidden == true)
    {
      cachedEmitters[i].bHidden = false;
      if (cachedEmitters[i].bStatic)
        cachedEmitters[i].ResetStaticFilterState();
      // lb_Actions.Addtext(colorY$"  "@string(cachedEmitters[i].name));
    }
  }
}


simulated function displayCachedEmitters()
{
  local int i;

  lb_Actions.Addtext(colorB$"Emitters ["$cachedEmitters.length$"]");

  for (i = 0; i < cachedEmitters.length; i++)
    lb_Actions.Addtext(colorY$"  "@string(cachedEmitters[i].name));
}


// DECORATIONS
simulated function cacheDecorations()
{
  local Decoration tempD;
  local array<string> uselessDecorations;
  local int i;

  // uselessDecorations = ALC.getUselessDecorations(Mo_Profiles.get(false));
  uselessDecorations = MapSpecificObj[ProfileIndexes[Mo_Profiles.getIndex()]].uselessDecorations;

  forEach AllObjects(class'Decoration', tempD)
  {
    for (i = 0; i < uselessDecorations.length; i++)
    {
      if (string(tempD.name) == uselessDecorations[i])
      {
        cachedDecorations[cachedDecorations.length] = tempD;
        uselessDecorations.remove(i,1);
        break;
      }
    }
  }
  lb_Actions.Addtext(colorG$"All decorations were cached sucessfully.");
}


simulated function hideDecorations()
{
  local int i;

  lb_Actions.Addtext(colorB$"Decorations");

  for (i = 0; i < cachedDecorations.length; i++)
  {
    if (cachedDecorations[i].bHidden == false)
    {
      cachedDecorations[i].bHidden = true;
      if (cachedDecorations[i].bStatic)
        cachedDecorations[i].ResetStaticFilterState();
      lb_Actions.Addtext(colorY$"  "@string(cachedDecorations[i].name));
    }
  }
}


simulated function showDecorations()
{
  local int i;

  lb_Actions.Addtext(colorB$"Decorations");

  for (i = 0; i < cachedDecorations.length; i++)
  {
    if (cachedDecorations[i].bHidden == true)
    {
      cachedDecorations[i].bHidden = false;
      if (cachedDecorations[i].bStatic)
        cachedDecorations[i].ResetStaticFilterState();
      lb_Actions.Addtext(colorY$"  "@string(cachedDecorations[i].name));
    }
  }
}


simulated function displayCachedDecorations()
{
  local int i;

  lb_Actions.Addtext(colorB$"Decorations ["$cachedDecorations.length$"]");

  for (i = 0; i < cachedDecorations.length; i++)
    lb_Actions.Addtext(colorY$"  "@string(cachedDecorations[i].name));
}


// MOVERS
simulated function cacheMovers()
{
  local Mover tempM;
  local array<string> uselessMovers;
  local int i;

  // uselessMovers = ALC.getUselessMovers(Mo_Profiles.get(false));
  uselessMovers = MapSpecificObj[ProfileIndexes[Mo_Profiles.getIndex()]].uselessMovers;

  forEach AllObjects(class'Mover', tempM)
  {
    for (i = 0; i < uselessMovers.length; i++)
    {
      if (string(tempM.name) == uselessMovers[i])
      {
        cachedMovers[cachedMovers.length] = tempM;
        uselessMovers.remove(i,1);
        break;
      }
    }
  }
  lb_Actions.Addtext(colorG$"All movers were cached sucessfully.");
}


simulated function hideMovers()
{
  local int i;

  lb_Actions.Addtext(colorB$"Movers");

  for (i = 0; i < cachedMovers.length; i++)
  {
    if (cachedMovers[i].bHidden == false)
    {
      cachedMovers[i].bHidden = true;
      if(cachedMovers[i].bStatic)
        cachedMovers[i].ResetStaticFilterState();
      lb_Actions.Addtext(colorY$"  "@string(cachedMovers[i].name));
    }
  }
}


simulated function showMovers()
{
  local int i;

  lb_Actions.Addtext(colorB$"Movers");

  for (i = 0; i < cachedMovers.length; i++)
  {
    if (cachedMovers[i].bHidden == true)
    {
      cachedMovers[i].bHidden = false;
      if (cachedMovers[i].bStatic)
        cachedMovers[i].ResetStaticFilterState();
      lb_Actions.Addtext(colorY$"  "@string(cachedMovers[i].name));
    }
  }
}


simulated function displayCachedMovers()
{
  local int i;

  lb_Actions.Addtext(colorB$"Movers ["$cachedMovers.length$"]");

  for (i = 0; i < cachedMovers.length; i++)
    lb_Actions.Addtext(colorY$"  "@string(cachedMovers[i].name));
}


/*KF_RotatingMeshActor*/
/*Chaos code*/
simulated function cacheRotatingMeshActors()
{
  local KF_RotatingMeshActor tempRM;
  local array<string> uselessRotatingMeshActors;
  local int i, count;

  // uselessRotatingMeshActors = ALC.getuselessRotatingMeshActors(Mo_Profiles.get(false));
  uselessRotatingMeshActors = MapSpecificObj[ProfileIndexes[Mo_Profiles.getIndex()]].uselessRotatingMeshActors;

  lb_Actions.Addtext("Rotating Movers in ini file:"$uselessRotatingMeshActors.length);

  forEach AllObjects (class'KF_RotatingMeshActor', tempRM)
  {
    for(i = 0; i < uselessRotatingMeshActors.length; i++)
    {
      if (string(tempRM.name) == uselessRotatingMeshActors[i])
      {
        cachedRotatingMeshActors[cachedRotatingMeshActors.length] = tempRM;
        uselessRotatingMeshActors.remove(i,1);
        count++;
        break;
      }
    }
  }
  lb_Actions.Addtext("RotatingMeshActors added:"$count);
  lb_Actions.Addtext(colorG$"All RotatingMeshActors were cached sucessfully.");
}


simulated function hideRotatingMeshActors()
{
  local int i;

  lb_Actions.Addtext(colorB$"RotatingMeshActors");

  for(i = 0; i < cachedRotatingMeshActors.length; i++)
  {
    if (cachedRotatingMeshActors[i].bHidden == false)
    {
      cachedRotatingMeshActors[i].bHidden = true;
      cachedRotatingMeshActors[i].ResetStaticFilterState();
      lb_Actions.Addtext(colorY$"  "@string(cachedRotatingMeshActors[i].name));
    }
  }
}


simulated function showRotatingMeshActors()
{
  local int i;

  lb_Actions.Addtext(colorB$"RotatingMeshActors");

  for (i = 0; i < cachedRotatingMeshActors.length; i++)
  {
    if (cachedRotatingMeshActors[i].bHidden == true)
    {
      cachedRotatingMeshActors[i].bHidden = false;
      cachedRotatingMeshActors[i].ResetStaticFilterState();
      lb_Actions.Addtext(colorY$"  "@string(cachedRotatingMeshActors[i].name));
    }
  }
}

simulated function displayCachedRotatingMeshActors()
{
  local int i;

  lb_Actions.Addtext(colorB$"RotatingMeshActors ["$cachedRotatingMeshActors.length$"]");

  for (i = 0; i < cachedRotatingMeshActors.length; i++)
    lb_Actions.Addtext(colorY$"  "@string(cachedRotatingMeshActors[i].name));
}


// Chaos code
simulated function clearCache()
{
  if (cachedStaticMeshes.length > 0)
    cachedStaticMeshes.remove(0,cachedStaticMeshes.length);

  if (cachedLights.length > 0)
    cachedLights.remove(0,cachedLights.length);

  if (cachedEmitters.length > 0)
    cachedEmitters.remove(0,cachedEmitters.length);

  if (cachedDecorations.length > 0)
    cachedDecorations.remove(0,cachedDecorations.length);

  if (cachedMovers.length > 0)
     cachedMovers.remove(0,cachedMovers.length);

  if (cachedProjectors.length > 0)
    cachedProjectors.remove(0,cachedProjectors.length);

  if (cachedRotatingMeshActors.length > 0)
    cachedRotatingMeshActors.remove(0,cachedRotatingMeshActors.length);

  bCached = false;
  b_HideAllActors.MenuState=MSAT_Disabled;
  b_DisplayCachedActors.MenuState=MSAT_Disabled;
  lb_Actions.Addtext(colorG$"The cache was cleared.");
}


simulated function bool ActivateAllButtons(GUIComponent Sender)
{
  b_CacheAllActors.MenuState=MSAT_Blurry;
  return true;
}


simulated function toggleMeshesWithNoCollision()
{
  local StaticMeshActor tempMesh;
  // local Emitter tempE;
  local Decoration tempD;
  local Mover tempM;
  local int i;

  if (justStatic.length != 0 || justEmitter.length != 0 || justDecos.length != 0 || justMover.length != 0)
  {
    for (i=0; i<justStatic.length; i++)
    {
      justStatic[i].bHidden = false;
      justStatic[i].ResetStaticFilterState();
    }

    if (!bNoEmitters)
    {
      for (i=0; i<justEmitter.length; i++)
        justEmitter[i].bHidden = false;
    }
    else
      justEmitter.length = 0;

    for (i=0; i<justDecos.length; i++)
      justDecos[i].bHidden = false;

    for (i=0; i<justMover.length; i++)
      justMover[i].bHidden = false;

    justStatic.length = 0;
    justEmitter.length = 0;
    justDecos.length = 0;
    justMover.length = 0;

    sb_Collision_Flagz.DisableMe();
    sb_HideActors.DisableMe();
    b_JustButton.Caption = "Hide elements";

    return;
  }

  if (Mo_Logic.GetIndex() == 0 && ch_HideStaticMeshesWithNoCollision.IsChecked())
  {
    forEach AllObjects (class'StaticMeshActor', tempMesh)
    {
      if (tempMesh.bBlockActors == ch_BlockActors.IsChecked() && tempMesh.bBlockZeroExtentTraces == ch_BlockZeroExtentTraces.IsChecked())
      {
        justStatic[justStatic.length] = tempMesh;
        tempMesh.bHidden = true;
        tempMesh.ResetStaticFilterState();
      }
    }
  }
  else if (Mo_Logic.GetIndex() == 1 && ch_HideStaticMeshesWithNoCollision.IsChecked())
  {
    forEach AllObjects (class'StaticMeshActor', tempMesh)
    {
      if (tempMesh.bBlockActors == ch_BlockActors.IsChecked() || tempMesh.bBlockZeroExtentTraces == ch_BlockZeroExtentTraces.IsChecked())
      {
        justStatic[justStatic.length] = tempMesh;
        tempMesh.bHidden = true;
        tempMesh.ResetStaticFilterState();
      }
    }
  }

  if (Mo_Logic.GetIndex() == 0 && ch_HideDecosWithNoCollision.IsChecked())
  {
    forEach AllObjects (class'Decoration', tempD)
    {
      if (tempD.bBlockActors == ch_BlockActors.IsChecked() && tempD.bBlockZeroExtentTraces == ch_BlockZeroExtentTraces.IsChecked())
      {
        justDecos[justDecos.length] = tempD;
        tempD.bHidden = true;
      }
    }
  }
  else if (Mo_Logic.GetIndex() == 1 && ch_HideDecosWithNoCollision.IsChecked())
  {
    forEach AllObjects (class'Decoration', tempD)
    {
      if (tempD.bBlockActors == ch_BlockActors.IsChecked() || tempD.bBlockZeroExtentTraces == ch_BlockZeroExtentTraces.IsChecked())
      {
        justDecos[justDecos.length] = tempD;
        tempD.bHidden = true;
      }
    }
  }

  if (Mo_Logic.GetIndex() == 0 && ch_HideMoversWithNoCollision.IsChecked())
  {
    forEach AllObjects (class'Mover', tempM)
    {
      if (tempM.bBlockActors == ch_BlockActors.IsChecked() && tempM.bBlockZeroExtentTraces == ch_BlockZeroExtentTraces.IsChecked())
      {
        justMover[justMover.length] = tempM;
        tempM.bHidden = true;
      }
    }
  }
  else if (Mo_Logic.GetIndex() == 1 && ch_HideMoversWithNoCollision.IsChecked())
  {
    forEach AllObjects (class'Mover', tempM)
    {
      if (tempM.bBlockActors == ch_BlockActors.IsChecked() || tempM.bBlockZeroExtentTraces == ch_BlockZeroExtentTraces.IsChecked())
      {
        justMover[justMover.length] = tempM;
        tempM.bHidden = true;
        if (tempM.bStatic)
          tempM.ResetStaticFilterState();
      }
    }
  }

  if (justStatic.length != 0 || justEmitter.length != 0 || justDecos.length != 0 || justMover.length != 0)
  {
    sb_Collision_Flagz.EnableMe();
    sb_HideActors.EnableMe();
    b_JustButton.Caption = "Show elements";
  }
}


simulated function checkAvailability()
{
  local int i;

  if (cachedStaticMeshes.length > 0)
  {
    for (i = cachedStaticMeshes.length; i >= 0 ; i--)
    {
      if (cachedStaticMeshes[i] == none)
        cachedStaticMeshes.remove(i,1);
    }
  }

  if(cachedLights.length > 0)
        for(i = cachedLights.length; i >= 0 ; i--)
            if(cachedLights[i] == none)
                cachedLights.remove(i,1);

    if(cachedEmitters.length > 0)
        for(i = cachedEmitters.length; i >= 0 ; i--)
        {
            if(cachedEmitters[i] == none)
            {
                cachedEmitters.remove(i,1);
            }
            else if(cachedEmitters[i].bDeleteMe)
            {
                cachedEmitters.remove(i,1);
            }
        }

    if(cachedDecorations.length > 0)
        for(i = cachedDecorations.length; i >= 0 ; i--)
            if(cachedDecorations[i] == none)
                cachedDecorations.remove(i,1);

    if(cachedMovers.length > 0)
        for(i = cachedMovers.length; i >= 0 ; i--)
            if(cachedMovers[i] == none)
                cachedMovers.remove(i,1);
}


simulated function checkAvailabilitySingle(array<Actor> tempArray)
{
  local int i;

  if (tempArray.length > 0)
  {
    for (i = tempArray.length; i >= 0 ; i--)
    {
      if (tempArray[i] != none)
        tempArray.remove(i,1);
    }
  }
}


//============================================================================================
//===========================================================Sound remover + Anim Shit remover
simulated function NoAnimShit()
{
  local Actor A;
  local KF_RotatingMeshActor SMR;
  local int i,count;

  if (AnimatedMeshesNames.length == 0)
    return;

  forEach AllObjects (class'Actor', A)
  {
    for (i=0; i<AnimatedMeshesNames.length; i++)
    {
      if (Instr(CAPS(string(A.Mesh)),CAPS(AnimatedMeshesNames[i])) != -1
                || Instr(CAPS(string(A.StaticMesh)),CAPS(AnimatedMeshesNames[i])) != -1)
      {
        A.bHidden = true;
        A.bUnlit = true;
        if (A.bStatic)
          A.ResetStaticFilterState();
        count++;
      }
    }
  }

  forEach AllObjects (class'KF_RotatingMeshActor', SMR)
  {
    SmR.bHidden = true;
    if (SMR.bStatic)
      SMR.ResetStaticFilterState();
    count++;
  }

  lb_Actions.Addtext("Were hided" @ count @ "actors");
}


simulated function grabDefaultSounds()
{
  local AmbientSound AS;
  local int i;

  first_sounds = true;
  forEach AllObjects (class'AmbientSound', AS)
  {
    OriginalSound.AmbientSoundName[i] = AS;
    OriginalSound.AmbientSound[i] = AS.AmbientSound;
    OriginalSound.SoundPitch[i] = AS.SoundPitch;
    OriginalSound.SoundVolume[i] = AS.SoundVolume;
    OriginalSound.TransientSoundRadius[i] = AS.TransientSoundRadius;
    OriginalSound.TransientSoundVolume[i] = AS.TransientSoundVolume;
    i++;
  }
}


simulated function restoreDefaultSounds()
{
  local AmbientSound AS;
  local int i;
  local CrossbuzzsawBlade CRB;

  for (i=0; i<OriginalSound.AmbientSoundName.length; i++)
  {
    AS = OriginalSound.AmbientSoundName[i];
    AS.AmbientSound = OriginalSound.AmbientSound[i];
    AS.SoundPitch = OriginalSound.SoundPitch[i];
    AS.SoundVolume = OriginalSound.SoundVolume[i];
    AS.TransientSoundRadius = OriginalSound.TransientSoundRadius[i];
    AS.TransientSoundVolume = OriginalSound.TransientSoundVolume[i];
  }
  // restore IJC bullshit
  class'CrossbuzzsawBlade'.default.SoundVolume=175;
  class'CrossbuzzsawBlade'.default.SoundRadius=250;

  forEach PC.AllActors(class'CrossbuzzsawBlade', CRB)
  {
    CRB.SoundVolume=175;
    CRB.SoundRadius=250;
  }
}


simulated function muteAll()
{
  local int i;
  local AmbientSound AS;
  local CrossbuzzsawBlade CRB;
  local KFMusicTrigger KFMT;
  local KFDoorMover KFMov;
  local ScriptedTrigger Script;

  forEach AllObjects (class'AmbientSound', AS)
  {
    AS.AmbientSound = none;
    AS.SoundPitch = 0;
    AS.SoundVolume = 0;
    AS.TransientSoundRadius = 0.0;
    AS.TransientSoundVolume = 0.0;
    if (AS.bstatic)
      AS.ResetStaticFilterState();
  }

  class'CrossbuzzsawBlade'.default.SoundVolume=0;  //175
  class'CrossbuzzsawBlade'.default.SoundRadius=0;  //250

  // shutup fucking wankers
  forEach PC.AllActors(class'CrossbuzzsawBlade', CRB)
  {
    CRB.SoundVolume=0;
    CRB.SoundRadius=0;
  }

  PC.StopAllMusic();  //just incase of some bloody music playing

  //shadup
  forEach PC.AllActors(class'KFMusicTrigger', KFMT)
  {
    if (KFMT.Song != "")
      KFMT.Song = "";
    if (KFMT.CombatSong != "")
      KFMT.CombatSong = "";
    KFMT.WaveBasedSongs.length = 0;      //Bloody wankers
  }

  forEach PC.AllActors(class'KFDoorMover', KFMov)    //ferenos maps signals
  {
    if (Instr(string(KFMov.OpenedSound),"loop") != -1)
      KFMov.OpenedSound = none;
  }

  forEach PC.AllActors(class'ScriptedTrigger', Script)    //scripted trigger signals
  {
    for (i=0;i<Script.Actions.length;i++)
    {
      if (Instr(Script.Actions[i].ActionString, "PlaySound") != -1)
        Script.Actions[i] = none;
    }
  }
}


//===========================================================
simulated function InternalOnChange(GUIComponent Sender)
{
  if (!bDoNotDoShit)
  {
    switch (Sender)
    {
      case ch_HideNiggaz:
        removeBlackBitch(ch_HideNiggaz.IsChecked());
        break;
      case ch_HideEmitters:
        hideAllEmitters(ch_HideEmitters.IsChecked());
        break;
      case ch_HideTerrain:
        hideTerrain(ch_HideTerrain.IsChecked());
        break;
      case ch_HideStaticMeshes:
        hideAllStaticMeshes(ch_HideStaticMeshes.IsChecked());
        break;
      case ch_muteAll:
        if (ch_muteAll.IsChecked())
        {
          if (!first_sounds)
            grabDefaultSounds();
          MuteAll();
        }
        else
          restoreDefaultSounds();
    }
  }
}

defaultproperties
{
     Begin Object Class=GUISectionBackground Name=BGHideStaticMesh_List
         bFillClient=True
         Caption="List of  StaticMeshes to hide"
         LeftPadding=0.000000
         RightPadding=0.000000
         TopPadding=0.000000
         BottomPadding=0.000000
         WinTop=0.028147
         WinLeft=0.268163
         WinWidth=0.407029
         WinHeight=0.414421
         OnPreDraw=BGHideStaticMesh_List.InternalPreDraw
     End Object
     sb_HideStaticMesh_List=GUISectionBackground'HideMut.menu_c_HideMut.BGHideStaticMesh_List'

     Begin Object Class=GUISectionBackground Name=BGMisc
         bFillClient=True
         Caption="Misc. functions"
         LeftPadding=0.000000
         RightPadding=0.000000
         TopPadding=0.000000
         BottomPadding=0.000000
         WinTop=0.441551
         WinWidth=0.351252
         WinHeight=0.509144
         OnPreDraw=BGMisc.InternalPreDraw
     End Object
     sb_Misc=GUISectionBackground'HideMut.menu_c_HideMut.BGMisc'

     Begin Object Class=GUISectionBackground Name=BGHideStaticMesh
         bFillClient=True
         Caption="Hide StaticMeshes and etc."
         LeftPadding=0.000000
         RightPadding=0.000000
         TopPadding=0.000000
         BottomPadding=0.000000
         WinTop=0.443169
         WinLeft=0.351495
         WinWidth=0.649011
         WinHeight=0.496685
         OnPreDraw=BGHideStaticMesh.InternalPreDraw
     End Object
     sb_HideStaticMesh=GUISectionBackground'HideMut.menu_c_HideMut.BGHideStaticMesh'

     Begin Object Class=GUISectionBackground Name=BGCollision_Flagz
         bFillClient=True
         Caption="Collision flagz"
         LeftPadding=0.000000
         RightPadding=0.000000
         TopPadding=0.000000
         BottomPadding=0.000000
         WinTop=0.028147
         WinLeft=0.675871
         WinWidth=0.324147
         WinHeight=0.150000
         OnPreDraw=BGCollision_Flagz.InternalPreDraw
     End Object
     sb_Collision_Flagz=GUISectionBackground'HideMut.menu_c_HideMut.BGCollision_Flagz'

     Begin Object Class=GUISectionBackground Name=BGHideActors
         bFillClient=True
         Caption="Collision flagz targets"
         LeftPadding=0.000000
         RightPadding=0.000000
         TopPadding=0.000000
         BottomPadding=0.000000
         WinTop=0.179881
         WinLeft=0.676939
         WinWidth=0.322544
         WinHeight=0.250000
         OnPreDraw=BGHideActors.InternalPreDraw
     End Object
     sb_HideActors=GUISectionBackground'HideMut.menu_c_HideMut.BGHideActors'

     Begin Object Class=GUISectionBackground Name=BGLog
         bFillClient=True
         Caption="Logged actions"
         Hint="All your actions will be listed here..."
         WinTop=0.027159
         WinLeft=0.001678
         WinWidth=0.266496
         WinHeight=0.412818
         OnPreDraw=BGLog.InternalPreDraw
     End Object
     sb_Log=GUISectionBackground'HideMut.menu_c_HideMut.BGLog'

     Begin Object Class=GUIButton Name=HideAllActorsButton
         Caption="Hide cached"
         OnClick=menu_c_HideMut.ButtonClicked
         OnKeyEvent=HideAllActorsButton.InternalOnKeyEvent
     End Object
     b_HideAllActors=GUIButton'HideMut.menu_c_HideMut.HideAllActorsButton'

     Begin Object Class=GUIButton Name=CacheAllActorsButton
         Caption="Cache"
         MenuState=MSAT_Disabled
         OnClick=menu_c_HideMut.ButtonClicked
         OnKeyEvent=CacheAllActorsButton.InternalOnKeyEvent
     End Object
     b_CacheAllActors=GUIButton'HideMut.menu_c_HideMut.CacheAllActorsButton'

     Begin Object Class=GUIButton Name=RefreshScreenButton
         Caption="Hide elements"
         OnClick=menu_c_HideMut.ButtonClicked
         OnKeyEvent=RefreshScreenButton.InternalOnKeyEvent
     End Object
     b_JustButton=GUIButton'HideMut.menu_c_HideMut.RefreshScreenButton'

     Begin Object Class=GUIButton Name=DisplayCachedActorsButton
         Caption="Display cached"
         OnClick=menu_c_HideMut.ButtonClicked
         OnKeyEvent=DisplayCachedActorsButton.InternalOnKeyEvent
     End Object
     b_DisplayCachedActors=GUIButton'HideMut.menu_c_HideMut.DisplayCachedActorsButton'

     Begin Object Class=GUIButton Name=ClearCacheButton
         Caption="Clear cache"
         OnClick=menu_c_HideMut.ButtonClicked
         OnKeyEvent=ClearCacheButton.InternalOnKeyEvent
     End Object
     b_ClearCache=GUIButton'HideMut.menu_c_HideMut.ClearCacheButton'

     Begin Object Class=GUIButton Name=ActivateInteractionButton
         Caption="/////////WIP////////////"
         OnClick=menu_c_HideMut.ButtonClicked
         OnKeyEvent=ActivateInteractionButton.InternalOnKeyEvent
     End Object
     b_ActivateInteraction=GUIButton'HideMut.menu_c_HideMut.ActivateInteractionButton'

     Begin Object Class=GUIButton Name=KillEmitters
         Caption="Kill annoying emitters"
         Hint="WARNING: Can't be UNDONE!"
         OnClick=menu_c_HideMut.ButtonClicked
         OnKeyEvent=KillEmitters.InternalOnKeyEvent
     End Object
     b_KillEmitters=GUIButton'HideMut.menu_c_HideMut.KillEmitters'

     Begin Object Class=GUIButton Name=CullDistanceButton
         Caption="Cull it !"
         Hint="Apply your culldistance to ALL static meshes. NOTE: Culldistance -1 to reset to def. values"
         OnClick=menu_c_HideMut.ButtonClicked
         OnKeyEvent=CullDistanceButton.InternalOnKeyEvent
     End Object
     b_CullDistance=GUIButton'HideMut.menu_c_HideMut.CullDistanceButton'

     Begin Object Class=GUIButton Name=Disabler
         OnClick=menu_c_HideMut.ButtonClicked
         OnKeyEvent=Disabler.InternalOnKeyEvent
     End Object
     b_Disabler=GUIButton'HideMut.menu_c_HideMut.Disabler'

     Begin Object Class=GUIButton Name=bNoAnimShit
         Caption="Disable ALL Animated Shit on map"
         Hint="Disables ALL Animated Shit on map: animated wheels and etc. Config: hidemut.ini, section ~ [Animated]"
         OnClick=menu_c_HideMut.ButtonClicked
         OnKeyEvent=bNoAnimShit.InternalOnKeyEvent
     End Object
     b_NoAnimShit=GUIButton'HideMut.menu_c_HideMut.bNoAnimShit'

     Begin Object Class=GUIButton Name=SaveConfigSettings
         Caption="Save config parameters"
         Hint="Save config parameters"
         OnClick=menu_c_HideMut.ButtonClicked
         OnKeyEvent=SaveConfigSettings.InternalOnKeyEvent
     End Object
     b_SaveConfigSettings=GUIButton'HideMut.menu_c_HideMut.SaveConfigSettings'

     Begin Object Class=GUIButton Name=LoadConfigSettings
         Caption="Load config parameters"
         Hint="Load config parameters"
         OnClick=menu_c_HideMut.ButtonClicked
         OnKeyEvent=LoadConfigSettings.InternalOnKeyEvent
     End Object
     b_LoadConfigSettings=GUIButton'HideMut.menu_c_HideMut.LoadConfigSettings'

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

     Begin Object Class=GUIButton Name=bStartMapOptimizer
         Caption="Start map optimizer"
         OnClick=menu_c_HideMut.ButtonClicked
         OnKeyEvent=bStartMapOptimizer.InternalOnKeyEvent
     End Object
     b_StartMapOptimizer=GUIButton'HideMut.menu_c_HideMut.bStartMapOptimizer'

     Begin Object Class=moCheckBox Name=HideNiggaz
         Caption="Hides nigga trader or not"
         OnCreateComponent=HideNiggaz.InternalOnCreateComponent
         Hint="edgyedgyedgyedgyedgy Hides/shows nigga trader for you. edgyedgyedgyedgyedgyedgy"
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     ch_HideNiggaz=moCheckBox'HideMut.menu_c_HideMut.HideNiggaz'

     Begin Object Class=moCheckBox Name=moHideEmitters
         Caption="Hides/shows emitters"
         OnCreateComponent=moHideEmitters.InternalOnCreateComponent
         Hint="Hides/shows emitters"
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     ch_HideEmitters=moCheckBox'HideMut.menu_c_HideMut.moHideEmitters'

     Begin Object Class=moCheckBox Name=moHideTerrain
         Caption="Hides/shows terrain"
         OnCreateComponent=moHideTerrain.InternalOnCreateComponent
         Hint="Hides/shows terrain in all zones. NOTE: PLZ do not do this in solo or listen server."
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     ch_HideTerrain=moCheckBox'HideMut.menu_c_HideMut.moHideTerrain'

     Begin Object Class=moCheckBox Name=moHideStaticMeshes
         Caption="Hides/shows ALL static meshes"
         OnCreateComponent=moHideStaticMeshes.InternalOnCreateComponent
         Hint="Hides/shows all static meshes(decos and etc) for debugging purposes."
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     ch_HideStaticMeshes=moCheckBox'HideMut.menu_c_HideMut.moHideStaticMeshes'

     Begin Object Class=moCheckBox Name=moMuteAll
         Caption="Mute all amb. sounds"
         OnCreateComponent=moMuteAll.InternalOnCreateComponent
         Hint="Mute all annoying ambient sound on map(rain drops, wind howls and other shit).NOTE: Can be undone"
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     ch_muteAll=moCheckBox'HideMut.menu_c_HideMut.moMuteAll'

     Begin Object Class=moCheckBox Name=moBlockActors
         Caption="Collision: block actors"
         OnCreateComponent=moBlockActors.InternalOnCreateComponent
         Hint="Collision flag bBlockActors == should block actors."
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     ch_BlockActors=moCheckBox'HideMut.menu_c_HideMut.moBlockActors'

     Begin Object Class=moCheckBox Name=moBlockZeroExtentTraces
         Caption="Collision: block Zero extent traces"
         OnCreateComponent=moBlockZeroExtentTraces.InternalOnCreateComponent
         Hint="Collision flag bBlockActors == should block bullets and etc."
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     ch_BlockZeroExtentTraces=moCheckBox'HideMut.menu_c_HideMut.moBlockZeroExtentTraces'

     Begin Object Class=moCheckBox Name=moHideStaticMeshesWithNoCollision
         Caption="Hides/shows static meshes with collision flags."
         OnCreateComponent=moHideStaticMeshesWithNoCollision.InternalOnCreateComponent
         Hint="Hides/shows all static meshes collision flags."
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     ch_HideStaticMeshesWithNoCollision=moCheckBox'HideMut.menu_c_HideMut.moHideStaticMeshesWithNoCollision'

     Begin Object Class=moCheckBox Name=moDecosWithNoCollision
         Caption="Hides/shows Decos with collision flags."
         OnCreateComponent=moDecosWithNoCollision.InternalOnCreateComponent
         Hint="Hides/shows all Decos with collision flags."
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     ch_HideDecosWithNoCollision=moCheckBox'HideMut.menu_c_HideMut.moDecosWithNoCollision'

     Begin Object Class=moCheckBox Name=moEmittersWithNoInstigator
         Caption="Hides/shows Emitters with collision flags."
         OnCreateComponent=moEmittersWithNoInstigator.InternalOnCreateComponent
         Hint="Hides/shows all Emitters with collision flags."
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     ch_HideEmittersWithNoInstigator=moCheckBox'HideMut.menu_c_HideMut.moEmittersWithNoInstigator'

     Begin Object Class=moCheckBox Name=moKillAllEmitters
         Caption="Kill emitters at startup"
         OnCreateComponent=moKillAllEmitters.InternalOnCreateComponent
         Hint="Kill emitters at startup(config variable). PLz save config if you want this actually work"
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     ch_KillAllEmitters=moCheckBox'HideMut.menu_c_HideMut.moKillAllEmitters'

     Begin Object Class=moCheckBox Name=moRemoveAnimatedShit
         Caption="Remove animated shit on startup"
         OnCreateComponent=moRemoveAnimatedShit.InternalOnCreateComponent
         Hint="Remove animated shit on startup(config variable). PLz save config if you want this actually work"
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     ch_RemoveAnimatedShit=moCheckBox'HideMut.menu_c_HideMut.moRemoveAnimatedShit'

     Begin Object Class=moCheckBox Name=moMoversWithNoCollision
         Caption="Hides/shows Movers with collision flags."
         OnCreateComponent=moMoversWithNoCollision.InternalOnCreateComponent
         Hint="Hides/shows all Movers collision flags."
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     ch_HideMoversWithNoCollision=moCheckBox'HideMut.menu_c_HideMut.moMoversWithNoCollision'

     Begin Object Class=moFloatEdit Name=CullDistance
         MinValue=-1.000000
         MaxValue=20000.000000
         Caption="Cull Distance"
         OnCreateComponent=CullDistance.InternalOnCreateComponent
         Hint="Adjust the cullDistances for static meshes. -1 to return to default values"
     End Object
     fl_CullDistance=moFloatEdit'HideMut.menu_c_HideMut.CullDistance'

     Begin Object Class=moComboBox Name=coProfiles
         Caption="Map profiles"
         OnCreateComponent=coProfiles.InternalOnCreateComponent
         Hint="Map profiles with static meshes to hide and etc."
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     Mo_Profiles=moComboBox'HideMut.menu_c_HideMut.coProfiles'

     Begin Object Class=moComboBox Name=coLogic
         Caption="Logic"
         OnCreateComponent=coLogic.InternalOnCreateComponent
         Hint="Logical operator"
         OnChange=menu_c_HideMut.InternalOnChange
     End Object
     Mo_Logic=moComboBox'HideMut.menu_c_HideMut.coLogic'

     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.menu_c_HideMut.lbActions'

     PropagateVisibility=False
     WinHeight=1.000000
     OnPreDraw=menu_c_HideMut.InternalOnPreDraw
}
