class menu_Old extends PopupPageBase transient; var(DEBUG) transient array cachedStaticMeshes; var(DEBUG) transient array cachedLights; var(DEBUG) transient array cachedEmitters; var(DEBUG) transient array cachedDecorations; var(DEBUG) transient array cachedMovers; var(DEBUG) transient array cachedProjectors; // KFBloodSplatter var(DEBUG) transient array cachedRotatingMeshActors; // terraininfo var PlayerController PC; var editinline array CloseKey; var ActortListController ALC; var string mapName; var automated GUIButton b_HideAllActors, b_ShowAllActors, b_CacheAllActors, b_UncacheAllActors, b_RefreshScreen, b_DisplayCachedActors, b_ValidateCachedActors, b_ClearCache, b_ActivateInteraction; var automated BackgroundArea a_List; var automated GUIListBox lb_ActortListsList; var GUIList li_ActortListsList; var automated GUILabel l_WeaponList; var string colorG, colorB, colorY, colorW; simulated function InitComponent(GUIController MyController, GUIComponent MyOwner) { super.InitComponent(MyController,MyOwner); 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); } event Opened(GUIComponent Sender) { local int i; local string KeyName; local array KeyNames; local array ActortListNames; super.Opened(Sender); PC = PlayerOwner(); // write in KeyNames all bind keys that onen this window to use 'closeWindowWithBind()' then CloseKey.Remove(0, CloseKey.Length); KeyName = PC.ConsoleCommand("BINDINGTOKEY hideMenu"); Split(KeyName, ",", KeyNames); for (i = 0; i < KeyNames.Length; i++) CloseKey[CloseKey.Length] = byte(PC.ConsoleCommand("KEYNUMBER"@KeyNames[i])); mapName = class'KFGameType'.static.GetCurrentMapName(PC.Level); // in case of 255.255.225.228:8080/KF-WestLondon i = InStr(mapName, "/") + 1; MapName = Mid(MapName, i, Len(MapName) - i); l_WeaponList.caption = MapName; // refresh list with ActortLists GetALL().clear(); ActortListNames = GetALC().GetAllActortLists(); for (i = 0; i < ActortListNames.Length; i++) { if (Left(ActortListNames[i], Len(MapName)) ~= MapName) GetALL().add(ActortListNames[i]); } } simulated function Closed(GUIComponent Sender, bool bCancelled) { super.Closed(Sender, bCancelled); b_CacheAllActors.MenuState=MSAT_Disabled; b_UncacheAllActors.MenuState=MSAT_Disabled; } // safe cleanup event Free() { // all automated components are cleaned in super code pc = none; ALC = none; li_ActortListsList = none; // clear all arrays clearCache(); super.Free(); } // ============================================================================= // getters for safe calls final private function PCMsg(coerce string s, optional Name Type) { if (pc != none) PC.ClientMessage(s, Type); } final private function ActortListController GetALC() { if (ALC == none) ALC = new class'ActortListController'; return ALC; } final private function GUIList GetALL() { if (li_ActortListsList == none) { li_ActortListsList = lb_ActortListsList.List; li_ActortListsList.TextAlign = TXTA_Left; li_ActortListsList.OnClick = ActivateAllButtons; li_ActortListsList.bMultiSelect = true; li_ActortListsList.bDropSource = true; li_ActortListsList.bDropTarget = true; } return li_ActortListsList; } // ============================================================================= simulated function bool ButtonClicked(GUIComponent Sender) { // local StaticMeshActor tempActor; // local Emitter tempEmitter; // local Light tempLight; // local mover tempMover; // local array uselessActors; // local int i, count; switch (Sender) { case b_CacheAllActors: cacheStaticMeshes(); cacheLights(); cacheEmitters(); cacheDecorations(); cacheMovers(); cacheRotatingMeshActors(); break; case b_UncacheAllActors: // UNCACHE break; case b_HideAllActors: checkAvailability(); PCMsg(colorW$"----------------------------------------"); PCMsg(colorG$"Following actors were hided:"); hideStaticMeshes(); hideLights(); hideEmitters(); hideDecorations(); hideMovers(); hideRotatingMeshActors(); PCMsg(colorW$"----------------------------------------"); break; case b_ShowAllActors: checkAvailability(); PCMsg(colorW$"----------------------------------------"); PCMsg(colorG$"Following actors were unhided:"); showStaticMeshes(); showLights(); showEmitters(); showDecorations(); showMovers(); showRotatingMeshActors(); PCMsg(colorW$"----------------------------------------"); break; case b_RefreshScreen: hideSMeshesWithoutColliding(); break; case b_DisplayCachedActors: checkAvailability(); PCMsg(colorW$"----------------------------------------"); PCMsg(colorG$"Cached actors:"); displayCachedStaticMeshes(); displayCachedLights(); displayCachedEmitters(); displayCachedDecorations(); displayCachedMovers(); displayCachedRotatingMeshActors(); PCMsg(colorW$"----------------------------------------"); break; case b_ClearCache: clearCache(); break; case b_ActivateInteraction: // runInteraction(); closeInteraction(); break; default: return false; } return true; } simulated function runInteraction() { // local int i; local PlayerController dude; dude = PlayerOwner(); if (dude != none) { // dude.Player.LocalInteractions[dude.Player.LocalInteractions.Length] = none; // for(i = 0; i < dude.Player.LocalInteractions.Length; i++) // PCMsg(colorW$string(dude.Player.LocalInteractions[i].name)); dude.Player.LocalInteractions[0] = new class(DynamicLoadObject(string(class'HideMutInteraction'), class'Class', true)); dude.Player.LocalInteractions[0].ViewportOwner = dude.Player; } // dude.Player.InteractionMaster.AddInteraction(string(class'HideMutInteraction'), dude.Player); } simulated function closeInteraction() { PlayerOwner().Player.LocalInteractions[0].ViewportOwner = none; PlayerOwner().Player.LocalInteractions.Remove(0, 1); } // STATIC MESHES simulated function cacheStaticMeshes() { local StaticMeshActor tempSM; local array uselessStaticMeshes; local int i, count; uselessStaticMeshes = GetALC().getUselessStaticMeshes(GetALL().get(false)); PCMsg("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; } } } PCMsg("Meshes added:"$count); PCMsg(colorG$"All static meshes were cached sucessfully."); } simulated function hideStaticMeshes() { local int i; PCMsg(colorB$"Static meshes"); for (i = 0; i < cachedStaticMeshes.length; i++) { if (cachedStaticMeshes[i].bHidden == false) { cachedStaticMeshes[i].bHidden = true; cachedStaticMeshes[i].ResetStaticFilterState(); PCMsg(colorY$" "@string(cachedStaticMeshes[i].name)); } } } simulated function showStaticMeshes() { local int i; PCMsg(colorB$"Static meshes"); for (i = 0; i < cachedStaticMeshes.length; i++) { if (cachedStaticMeshes[i].bHidden == true) { cachedStaticMeshes[i].bHidden = false; cachedStaticMeshes[i].ResetStaticFilterState(); PCMsg(colorY$" "@string(cachedStaticMeshes[i].name)); } } } simulated function displayCachedStaticMeshes() { local int i; PCMsg(colorB$"Static meshes ["$cachedStaticMeshes.length$"]"); for (i = 0; i < cachedStaticMeshes.length; i++) PCMsg(colorY$" "@string(cachedStaticMeshes[i].name)); } // LIGHTS simulated function cacheLights() { local Light tempL; local array uselessLights; local int i; uselessLights = GetALC().getUselessLights(GetALL().get(false)); 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; } } } PCMsg(colorG$"All lights were cached sucessfully."); } simulated function hideLights() { local int i; PCMsg(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(); PCMsg(colorY$" "@string(cachedLights[i].name)); } } } simulated function showLights() { local int i; PCMsg(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(); PCMsg(colorY$" "@string(cachedLights[i].name)); } } simulated function displayCachedLights() { local int i; PCMsg(colorB$"Lights ["$cachedLights.length$"]"); for(i = 0; i < cachedLights.length; i++) PCMsg(colorY$" "@string(cachedLights[i].name)); } /*EMITTERS*/ simulated function cacheEmitters() { local Emitter tempE; local array uselessEmitters; local int i; uselessEmitters = GetALC().getUselessEmitters(GetALL().get(false)); 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; } } } PCMsg(colorG$"All emitters were cached sucessfully."); } simulated function hideEmitters() { local int i; PCMsg(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(); // PCMsg(colorY$" "@string(cachedEmitters[i].name)); } } simulated function showEmitters() { local int i; PCMsg(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(); // PCMsg(colorY$" "@string(cachedEmitters[i].name)); } } simulated function displayCachedEmitters() { local int i; PCMsg(colorB$"Emitters ["$cachedEmitters.length$"]"); for(i = 0; i < cachedEmitters.length; i++) PCMsg(colorY$" "@string(cachedEmitters[i].name)); } // DECORATIONS simulated function cacheDecorations() { local Decoration tempD; local array uselessDecorations; local int i; uselessDecorations = GetALC().getUselessDecorations(GetALL().get(false)); 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; } } } PCMsg(colorG$"All decorations were cached sucessfully."); } simulated function hideDecorations() { local int i; PCMsg(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(); PCMsg(colorY$" "@string(cachedDecorations[i].name)); } } simulated function showDecorations() { local int i; PCMsg(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(); PCMsg(colorY$" "@string(cachedDecorations[i].name)); } } simulated function displayCachedDecorations() { local int i; PCMsg(colorB$"Decorations ["$cachedDecorations.length$"]"); for (i = 0; i < cachedDecorations.length; i++) PCMsg(colorY$" "@string(cachedDecorations[i].name)); } // MOVERS simulated function cacheMovers() { local Mover tempM; local array uselessMovers; local int i; uselessMovers = GetALC().getUselessMovers(GetALL().get(false)); 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; } } } PCMsg(colorG$"All movers were cached sucessfully."); } simulated function hideMovers() { local int i; PCMsg(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(); PCMsg(colorY$" "@string(cachedMovers[i].name)); } } simulated function showMovers() { local int i; PCMsg(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(); PCMsg(colorY$" "@string(cachedMovers[i].name)); } } simulated function displayCachedMovers() { local int i; PCMsg(colorB$"Movers ["$cachedMovers.length$"]"); for (i = 0; i < cachedMovers.length; i++) PCMsg(colorY$" "@string(cachedMovers[i].name)); } // KF_RotatingMeshActor // Chaos code simulated function cacheRotatingMeshActors() { local KF_RotatingMeshActor tempRM; local array uselessRotatingMeshActors; local int i, count; uselessRotatingMeshActors = GetALC().getuselessRotatingMeshActors(GetALL().get(false)); PCMsg("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; } } } PCMsg("RotatingMeshActors added:"$count); PCMsg(colorG$"All RotatingMeshActors were cached sucessfully."); } simulated function hideRotatingMeshActors() { local int i; PCMsg(colorB$"RotatingMeshActors"); for (i = 0; i < cachedRotatingMeshActors.length; i++) if (cachedRotatingMeshActors[i].bHidden == false) { cachedRotatingMeshActors[i].bHidden = true; cachedRotatingMeshActors[i].ResetStaticFilterState(); PCMsg(colorY$" "@string(cachedRotatingMeshActors[i].name)); } } simulated function showRotatingMeshActors() { local int i; PCMsg(colorB$"RotatingMeshActors"); for (i = 0; i < cachedRotatingMeshActors.length; i++) if (cachedRotatingMeshActors[i].bHidden == true) { cachedRotatingMeshActors[i].bHidden = false; cachedRotatingMeshActors[i].ResetStaticFilterState(); PCMsg(colorY$" "@string(cachedRotatingMeshActors[i].name)); } } simulated function displayCachedRotatingMeshActors() { local int i; PCMsg(colorB$"RotatingMeshActors ["$cachedRotatingMeshActors.length$"]"); for (i = 0; i < cachedRotatingMeshActors.length; i++) PCMsg(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); PCMsg(colorG$"The cache was cleared."); } simulated function bool closeWindowWithBind(out byte Key, out byte State, float delta) { local int i; for (i = 0; i < CloseKey.Length; i++) if (Key == CloseKey[i]) { Controller.CloseMenu(false); return true; } } simulated function bool ActivateAllButtons(GUIComponent Sender) { GetALL().InternalOnClick(Sender); b_CacheAllActors.MenuState=MSAT_Blurry; // b_UncacheAllActors.MenuState=MSAT_Blurry; return true; } simulated function hideSMeshesWithoutColliding() { local StaticMeshActor tempMesh; local Emitter tempE; local Light tempL; local Decoration tempD; local Mover tempM; local KF_RotatingMeshActor tempR; forEach AllObjects (class'StaticMeshActor', tempMesh) { if(tempMesh.bBlockActors == false && tempMesh.bBlockZeroExtentTraces == false) { tempMesh.bHidden = true; tempMesh.ResetStaticFilterState(); cachedStaticMeshes[cachedStaticMeshes.length] = tempMesh; } } forEach AllObjects (class'Emitter', tempE) { if(tempE.Instigator == none) { tempE.bHidden = true; if(tempE.bStatic) tempE.ResetStaticFilterState(); cachedEmitters[cachedEmitters.length] = tempE; } } forEach AllObjects (class'Light', tempL) { if(tempL.bCorona == true) { tempL.bCorona = false; if(tempL.bStatic) tempL.ResetStaticFilterState(); cachedLights[cachedLights.length] = tempL; } } forEach AllObjects (class'Decoration', tempD) { tempD.bHidden = true; if(tempD.bStatic) tempD.ResetStaticFilterState(); cachedDecorations[cachedDecorations.length] = tempD; } forEach AllObjects (class'Mover', tempM) { if(tempM.bBlockActors == false && tempM.bBlockZeroExtentTraces == false) { tempM.bHidden = true; if(tempM.bStatic) tempM.ResetStaticFilterState(); cachedMovers[cachedMovers.length] = tempM; } } // TODO:Check it later forEach AllObjects (class'KF_RotatingMeshActor', tempR) { if(tempR.bBlockActors == false) { tempR.bHidden = true; if(tempR.bStatic) tempR.ResetStaticFilterState(); cachedRotatingMeshActors[cachedRotatingMeshActors.length] = tempR; } } } simulated function checkAvailability() { local int i; if (cachedStaticMeshes.length > 0) { for (i = 0; i < cachedStaticMeshes.length && cachedStaticMeshes[i] == none; i++) cachedStaticMeshes.remove(i, 1); } if (cachedLights.length > 0) { for (i = 0; i < cachedLights.length && cachedLights[i] == none; i++) cachedLights.remove(i, 1); } if (cachedEmitters.length > 0) { for (i = 0; i < cachedEmitters.length && (cachedEmitters[i] == none || cachedEmitters[i].bDeleteMe); i++) cachedEmitters.remove(i, 1); } if (cachedDecorations.length > 0) { for (i = 0; i < cachedDecorations.length && cachedDecorations[i] == none; i++) cachedDecorations.remove(i, 1); } if (cachedMovers.length > 0) { for (i = 0; i < cachedMovers.length && cachedMovers[i] == none; i++) cachedMovers.remove(i, 1); } } defaultproperties { Begin Object Class=GUIButton Name=HideAllActorsButton Caption="Hide cached" WinTop=0.722000 WinLeft=0.605000 WinWidth=0.090000 WinHeight=0.080000 OnClick=menu_Old.ButtonClicked OnKeyEvent=HideAllActorsButton.InternalOnKeyEvent End Object b_HideAllActors=GUIButton'HideMut.menu_Old.HideAllActorsButton' Begin Object Class=GUIButton Name=ShowAllActorsButton Caption="Unhide cached" WinTop=0.722000 WinLeft=0.700000 WinWidth=0.090000 WinHeight=0.080000 OnClick=menu_Old.ButtonClicked OnKeyEvent=ShowAllActorsButton.InternalOnKeyEvent End Object b_ShowAllActors=GUIButton'HideMut.menu_Old.ShowAllActorsButton' Begin Object Class=GUIButton Name=CacheAllActorsButton Caption="Cache" MenuState=MSAT_Disabled WinTop=0.712000 WinLeft=0.405000 WinWidth=0.090000 WinHeight=0.080000 OnClick=menu_Old.ButtonClicked OnKeyEvent=CacheAllActorsButton.InternalOnKeyEvent End Object b_CacheAllActors=GUIButton'HideMut.menu_Old.CacheAllActorsButton' Begin Object Class=GUIButton Name=UncacheAllActorsButton Caption="Uncache" MenuState=MSAT_Disabled WinTop=0.712000 WinLeft=0.505000 WinWidth=0.090000 WinHeight=0.080000 OnClick=menu_Old.ButtonClicked OnKeyEvent=UncacheAllActorsButton.InternalOnKeyEvent End Object b_UncacheAllActors=GUIButton'HideMut.menu_Old.UncacheAllActorsButton' Begin Object Class=GUIButton Name=RefreshScreenButton Caption="Just button" WinTop=0.722000 WinLeft=0.795000 WinWidth=0.090000 WinHeight=0.080000 OnClick=menu_Old.ButtonClicked OnKeyEvent=RefreshScreenButton.InternalOnKeyEvent End Object b_RefreshScreen=GUIButton'HideMut.menu_Old.RefreshScreenButton' Begin Object Class=GUIButton Name=DisplayCachedActorsButton Caption="Display cached" WinTop=0.722000 WinLeft=0.305000 WinWidth=0.090000 WinHeight=0.080000 OnClick=menu_Old.ButtonClicked OnKeyEvent=DisplayCachedActorsButton.InternalOnKeyEvent End Object b_DisplayCachedActors=GUIButton'HideMut.menu_Old.DisplayCachedActorsButton' Begin Object Class=GUIButton Name=ValidateCachedActorsButton Caption="Validate cache" MenuState=MSAT_Disabled WinTop=0.722000 WinLeft=0.210000 WinWidth=0.090000 WinHeight=0.080000 OnClick=menu_Old.ButtonClicked OnKeyEvent=ValidateCachedActorsButton.InternalOnKeyEvent End Object b_ValidateCachedActors=GUIButton'HideMut.menu_Old.ValidateCachedActorsButton' Begin Object Class=GUIButton Name=ClearCacheButton Caption="Clear cache" WinTop=0.722000 WinLeft=0.115000 WinWidth=0.090000 WinHeight=0.080000 OnClick=menu_Old.ButtonClicked OnKeyEvent=ClearCacheButton.InternalOnKeyEvent End Object b_ClearCache=GUIButton'HideMut.menu_Old.ClearCacheButton' Begin Object Class=GUIButton Name=ActivateInteractionButton Caption="Run interaction" WinTop=0.712000 WinLeft=0.015000 WinWidth=0.090000 WinHeight=0.080000 OnClick=menu_Old.ButtonClicked OnKeyEvent=ActivateInteractionButton.InternalOnKeyEvent End Object b_ActivateInteraction=GUIButton'HideMut.menu_Old.ActivateInteractionButton' Begin Object Class=BackgroundArea Name=ListArea WinTop=0.550000 WinLeft=0.400000 WinWidth=0.200000 WinHeight=0.150000 End Object a_List=BackgroundArea'HideMut.menu_Old.ListArea' Begin Object Class=GUIListBox Name=ActortListsListBox bVisibleWhenEmpty=True OnCreateComponent=ActortListsListBox.InternalOnCreateComponent WinTop=0.557000 WinLeft=0.403000 WinWidth=0.194000 WinHeight=0.140000 End Object lb_ActortListsList=GUIListBox'HideMut.menu_Old.ActortListsListBox' Begin Object Class=GUILabel Name=WeaponListLabel Caption="Current map" TextAlign=TXTA_Center VertAlign=TXTA_Center StyleName="TextLabel" Hint="Current map" WinTop=0.530000 WinLeft=0.400000 WinWidth=0.200000 WinHeight=0.020000 End Object l_WeaponList=GUILabel'HideMut.menu_Old.WeaponListLabel' bPersistent=True bAllowedAsLast=True WinTop=0.700000 WinLeft=0.400000 WinWidth=0.200000 WinHeight=0.100000 OnKeyEvent=menu_Old.closeWindowWithBind }