Permalink
Browse files

Added particle manifest generation

Expirimental, will merge to main branch when done
  • Loading branch information...
Exactol committed Dec 20, 2017
1 parent ac72ca7 commit 78bf26674d02b65a4aa15dd5d1c79f03b79a0621
@@ -14,7 +14,7 @@ x64/
build/
[Bb]in/
[Oo]bj/
.vs/
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/
@@ -155,3 +155,5 @@ $RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
/packages
*.dat
*.ide
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2002
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompilePalX", "CompilePalX\CompilePalX.csproj", "{03C40819-A7CD-41F6-889F-6D4EB2B5AD07}"
EndProject
@@ -19,4 +19,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {67A5A7E2-8BC2-4D96-A9B7-E121A027CE20}
EndGlobalSection
EndGlobal
@@ -79,6 +79,10 @@
<Compile Include="Compilers\BSPPack\BSP.cs" />
<Compile Include="Compilers\BSPPack\PakFile.cs" />
<Compile Include="Compilers\BSPPack\Pack.cs" />
<Compile Include="Compilers\BSPPack\ConflictWindow.xaml.cs">
<DependentUpon>ConflictWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Compilers\BSPPack\ParticleUtils.cs" />
<Compile Include="Compilers\CompileExecutable.cs" />
<Compile Include="Compilers\ShutdownProcess.cs" />
<Compile Include="Compilers\NavProcess.cs" />
@@ -101,6 +105,10 @@
</Compile>
<Compile Include="PersistenceManager.cs" />
<Compile Include="Updating\UpdateManager.cs" />
<Page Include="Compilers\BSPPack\ConflictWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Compiling\ErrorWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -363,7 +371,9 @@
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
@@ -390,7 +390,7 @@ public static void findBspPakDependencies(BSP bsp, string tempdir)
bsp.TextureList.Add(material);
}
public static void findBspUtilityFiles(BSP bsp, List<string> sourceDirectories, bool renamenav)
public static void findBspUtilityFiles(BSP bsp, List<string> sourceDirectories, bool renamenav, bool genparticlemanifest)
{
// Utility files are other files that are not assets and are sometimes not referenced in the bsp
// those are manifests, soundscapes, nav, radar and detail files
@@ -551,15 +551,21 @@ public static void findBspUtilityFiles(BSP bsp, List<string> sourceDirectories,
if (dir.Exists)
foreach (FileInfo f in dir.GetFiles(searchPattern))
// particle files
if (f.Name.StartsWith(name + "_particles") || f.Name.StartsWith(name + "_manifest"))
bsp.particleManifest = new KeyValuePair<string, string>(internalDir + f.Name, externalDir + f.Name);
{
// particle files if particle manifest is not being generated
if (!genparticlemanifest)
if (f.Name.StartsWith(name + "_particles") || f.Name.StartsWith(name + "_manifest"))
bsp.particleManifest =
new KeyValuePair<string, string>(internalDir + f.Name, externalDir + f.Name);
// soundscript
else if (f.Name.StartsWith(name + "_level_sounds"))
bsp.soundscript = new KeyValuePair<string, string>(internalDir + f.Name, externalDir + f.Name);
if (f.Name.StartsWith(name + "_level_sounds"))
bsp.soundscript =
new KeyValuePair<string, string>(internalDir + f.Name, externalDir + f.Name);
// presumably language files
else
langfiles.Add(new KeyValuePair<string, string>(internalDir + f.Name, externalDir + f.Name));
}
}
bsp.languages = langfiles;
}
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
@@ -19,9 +20,12 @@ class BSP
public List<int>[] modelSkinList { get; private set; }
public List<string> ModelList { get; private set; }
public List<string> ModelList { get; private set; }
public List<string> EntModelList { get; private set; }
public List<string> ParticleList { get; private set; }
public List<string> TextureList { get; private set; }
public List<string> EntTextureList { get; private set; }
@@ -63,6 +67,8 @@ public BSP(FileInfo file)
buildEntModelList();
buildModelList();
buildParticleList();
buildEntTextureList();
buildTextureList();
@@ -146,12 +152,16 @@ public void buildEntTextureList()
{
List<string> materials = new List<string>();
foreach (KeyValuePair<string, string> prop in ent)
{
//Console.WriteLine(prop.Key + ": " + prop.Value);
if (Keys.vmfMaterialKeys.Contains(prop.Key.ToLower()))
{
materials.Add(prop.Value);
if (prop.Key.ToLower().StartsWith("team_icon"))
materials.Add(prop.Value + "_locked");
}
}
// special condition for sprites
if (ent["classname"].Contains("sprite") && ent.ContainsKey("model"))
@@ -273,5 +283,14 @@ public void buildEntSoundList()
if (Keys.vmfSoundKeys.Contains(prop.Key))
EntSoundList.Add("sound/" + prop.Value);
}
public void buildParticleList()
{
ParticleList = new List<string>();
foreach (Dictionary<string, string> ent in entityList)
foreach (KeyValuePair<string, string> particle in ent)
if (particle.Key.ToLower() == "effect_name")
ParticleList.Add(particle.Value);
}
}
}
@@ -0,0 +1,97 @@
<controls:MetroWindow x:Class="CompilePalX.Compilers.BSPPack.ConflictWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
Loaded="OnLoaded"
Title="Particle Manifest Conflict"
IconEdgeMode="Aliased" ShowIconOnTitleBar="False" ResizeMode="NoResize"
Height="250" Width="800"
MinHeight="250" MinWidth="800"
BorderBrush="{DynamicResource AccentColorBrush}" BorderThickness="1" >
<Grid>
<StackPanel>
<TextBlock Padding="10, 10, 10, 10" FontSize="25">Conflicting Particles</TextBlock>
<RichTextBox Padding="10, 0, 10, 0" BorderThickness="0" IsReadOnly="True">
<FlowDocument>
<Paragraph Margin="0" Foreground="Gray">CompilePal was unable to determine which file was being used due to two files containing the same particle names</Paragraph>
<Paragraph Margin="0" Foreground="Gray">Please select one or both PCFs</Paragraph>
</FlowDocument>
</RichTextBox>
<ListBox x:Name="fileBox" SelectionMode="Extended" MinHeight="40" Height="60" Margin="10, 10, 10, 10" BorderBrush="{DynamicResource AccentColorBrush}" BorderThickness="1"></ListBox>
<Grid>
<Button Click="SelectClicked " Margin="10, 10, 10, 10" Width="100" HorizontalAlignment="Right">Select</Button>
<ToggleButton Background ="White" BorderThickness="0" Height="30" Width="250" Click="ShowInfo" IsChecked="False" x:Name="advancedButton">
Show Advanced Information
<ToggleButton.Style>
<Style TargetType="{x:Type ToggleButton}">
<Setter Property="Foreground" Value="Gray"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="Crimson"></Setter>
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
</Grid>
<Grid Visibility="Hidden" x:Name="advancedInfo">
<Grid.RowDefinitions>
<RowDefinition Height="100" MinHeight="100"/>
<RowDefinition Height="250" MinHeight="60"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<RichTextBox Grid.Row="0" Grid.Column="0" FontSize="20" IsReadOnly="True" BorderThickness="0" Padding="10, 10, 10, 10" HorizontalAlignment="Center" x:Name="fileLeft">
<RichTextBox.Resources>
<Style TargetType="{x:Type Paragraph}">
<Setter Property="Margin" Value="0"></Setter>
</Style>
</RichTextBox.Resources>
</RichTextBox>
<RichTextBox Grid.Row="0" Grid.Column="1" FontSize="20" IsReadOnly="True" BorderThickness="0" Padding="10, 10, 10, 10" HorizontalAlignment="Center" x:Name="fileRight">
<RichTextBox.Resources>
<Style TargetType="{x:Type Paragraph}">
<Setter Property="Margin" Value="0"></Setter>
</Style>
</RichTextBox.Resources>
</RichTextBox>
<RichTextBox Grid.Row="1" Grid.Column="0" Margin="10,10,10,10" BorderBrush="{DynamicResource AccentColorBrush}" BorderThickness="1" x:Name="particlesLeft" IsReadOnly="True" VerticalScrollBarVisibility="Auto">
<RichTextBox.Resources>
<Style TargetType="{x:Type Paragraph}">
<Setter Property="Margin" Value="0"></Setter>
</Style>
</RichTextBox.Resources>
</RichTextBox>
<RichTextBox Grid.Row="1" Grid.Column="1" Margin="10,10,10,10" BorderBrush="{DynamicResource AccentColorBrush}" BorderThickness="1" x:Name="particlesRight" IsReadOnly="True" VerticalScrollBarVisibility="Auto">
<RichTextBox.Resources>
<Style TargetType="{x:Type Paragraph}">
<Setter Property="Margin" Value="0"></Setter>
</Style>
</RichTextBox.Resources>
</RichTextBox>
</Grid>
<TextBox Visibility="Collapsed" x:Name="advancedInfoTip" IsReadOnly="True" BorderThickness="0" HorizontalAlignment="Center" Margin="10, 0, 10, 10" Foreground="Gray">Conflicting particles are highlighted in red</TextBox>
</StackPanel>
</Grid>
</controls:MetroWindow>
Oops, something went wrong.

0 comments on commit 78bf266

Please sign in to comment.