mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-07-18 17:38:16 +08:00
First version of the SOurce SDK 2013
This commit is contained in:
246
EverythingMP_SDK-2010.sln
Normal file
246
EverythingMP_SDK-2010.sln
Normal file
@ -0,0 +1,246 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client (HL2)", "game\client\client_hl2-2010.vcxproj", "{09E5D61D-4897-7B98-288B-C87442D14BFF}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{F69B3672-C5E8-CD1A-257F-253A25B5B939} = {F69B3672-C5E8-CD1A-257F-253A25B5B939}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client (HL2MP)", "game\client\client_hl2mp-2010.vcxproj", "{17BCE59A-9037-EC8D-433E-F81339E2F1BA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{F69B3672-C5E8-CD1A-257F-253A25B5B939} = {F69B3672-C5E8-CD1A-257F-253A25B5B939}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Server (HL2)", "game\server\server_hl2-2010.vcxproj", "{C3EE918E-6836-5578-1FA2-5703048552B9}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Server (HL2MP)", "game\server\server_hl2mp-2010.vcxproj", "{33B7DFDC-BECB-3678-1190-6C951E393EB3}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mathlib", "mathlib\mathlib-2010.vcxproj", "{BAB92FF0-D72A-D7E5-1988-74628D39B94F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tier1", "tier1\tier1-2010.vcxproj", "{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Captioncompiler", "utils\captioncompiler\captioncompiler-2010.vcxproj", "{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Glview", "utils\glview\glview-2010.vcxproj", "{DC76828F-1DD4-7E83-371E-EA4058FEE050}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Height2normal", "utils\height2normal\height2normal-2010.vcxproj", "{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Motionmapper", "utils\motionmapper\motionmapper-2010.vcxproj", "{C805838C-256D-6672-3417-589B6AF7D95E}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Phonemeextractor", "utils\phonemeextractor\phonemeextractor-2010.vcxproj", "{079933D6-F849-3176-49FC-D50E4B461AC4}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QC_Eyes", "utils\qc_eyes\qc_eyes-2010.vcxproj", "{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Serverplugin_empty", "utils\serverplugin_sample\serverplugin_empty-2010.vcxproj", "{394B82B6-3999-E576-5458-2D2EB4229509}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tgadiff", "utils\tgadiff\tgadiff-2010.vcxproj", "{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vbsp", "utils\vbsp\vbsp-2010.vcxproj", "{E4F39B89-9731-571D-B69D-C1B8FE56C056}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vice", "utils\vice\vice-2010.vcxproj", "{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vrad_dll", "utils\vrad\vrad_dll-2010.vcxproj", "{90A78BD4-2532-39D9-6D34-7A3C2648508C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vrad_launcher", "utils\vrad_launcher\vrad_launcher-2010.vcxproj", "{0B6929D0-4447-E035-E47A-EBFCE557D5B3}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{F69B3672-C5E8-CD1A-257F-253A25B5B939} = {F69B3672-C5E8-CD1A-257F-253A25B5B939}
|
||||
{90A78BD4-2532-39D9-6D34-7A3C2648508C} = {90A78BD4-2532-39D9-6D34-7A3C2648508C}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vtf2tga", "utils\vtf2tga\vtf2tga-2010.vcxproj", "{6B017447-F682-A137-8DF4-4608281F2C9F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vtfdiff", "utils\vtfdiff\vtfdiff-2010.vcxproj", "{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vvis_dll", "utils\vvis\vvis_dll-2010.vcxproj", "{AC70A841-561F-4DAE-7864-E50541AD99ED}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Vvis_launcher", "utils\vvis_launcher\vvis_launcher-2010.vcxproj", "{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{AC70A841-561F-4DAE-7864-E50541AD99ED} = {AC70A841-561F-4DAE-7864-E50541AD99ED}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vgui_controls", "vgui2\vgui_controls\vgui_controls-2010.vcxproj", "{F69B3672-C5E8-CD1A-257F-253A25B5B939}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC} = {EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F} = {BAB92FF0-D72A-D7E5-1988-74628D39B94F}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client (Episodic)", "game\client\client_episodic-2010.vcxproj", "{353A799F-E73F-7A69-07AD-B2AD57F3B775}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Server (Episodic)", "game\server\server_episodic-2010.vcxproj", "{7855B476-B6D4-535D-F7A9-D623245F8B07}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{09E5D61D-4897-7B98-288B-C87442D14BFF}.Release|Win32.Build.0 = Release|Win32
|
||||
{17BCE59A-9037-EC8D-433E-F81339E2F1BA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{17BCE59A-9037-EC8D-433E-F81339E2F1BA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{17BCE59A-9037-EC8D-433E-F81339E2F1BA}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{17BCE59A-9037-EC8D-433E-F81339E2F1BA}.Release|Win32.Build.0 = Release|Win32
|
||||
{C3EE918E-6836-5578-1FA2-5703048552B9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C3EE918E-6836-5578-1FA2-5703048552B9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C3EE918E-6836-5578-1FA2-5703048552B9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C3EE918E-6836-5578-1FA2-5703048552B9}.Release|Win32.Build.0 = Release|Win32
|
||||
{33B7DFDC-BECB-3678-1190-6C951E393EB3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{33B7DFDC-BECB-3678-1190-6C951E393EB3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{33B7DFDC-BECB-3678-1190-6C951E393EB3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{33B7DFDC-BECB-3678-1190-6C951E393EB3}.Release|Win32.Build.0 = Release|Win32
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BAB92FF0-D72A-D7E5-1988-74628D39B94F}.Release|Win32.Build.0 = Release|Win32
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{EC1C516D-E1D9-BC0A-F79D-E91E954ED8EC}.Release|Win32.Build.0 = Release|Win32
|
||||
{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E85D01E5-DA1B-00A2-5D72-A9B6DEA9A995}.Release|Win32.Build.0 = Release|Win32
|
||||
{DC76828F-1DD4-7E83-371E-EA4058FEE050}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{DC76828F-1DD4-7E83-371E-EA4058FEE050}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DC76828F-1DD4-7E83-371E-EA4058FEE050}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{DC76828F-1DD4-7E83-371E-EA4058FEE050}.Release|Win32.Build.0 = Release|Win32
|
||||
{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{129A563E-9F48-79D9-E0C5-EE2DAF7FEAB7}.Release|Win32.Build.0 = Release|Win32
|
||||
{C805838C-256D-6672-3417-589B6AF7D95E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C805838C-256D-6672-3417-589B6AF7D95E}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C805838C-256D-6672-3417-589B6AF7D95E}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C805838C-256D-6672-3417-589B6AF7D95E}.Release|Win32.Build.0 = Release|Win32
|
||||
{079933D6-F849-3176-49FC-D50E4B461AC4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{079933D6-F849-3176-49FC-D50E4B461AC4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{079933D6-F849-3176-49FC-D50E4B461AC4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{079933D6-F849-3176-49FC-D50E4B461AC4}.Release|Win32.Build.0 = Release|Win32
|
||||
{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{EA02FAE0-2A4F-C7C8-6176-5DEDA8E139E9}.Release|Win32.Build.0 = Release|Win32
|
||||
{394B82B6-3999-E576-5458-2D2EB4229509}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{394B82B6-3999-E576-5458-2D2EB4229509}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{394B82B6-3999-E576-5458-2D2EB4229509}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{394B82B6-3999-E576-5458-2D2EB4229509}.Release|Win32.Build.0 = Release|Win32
|
||||
{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C6A1B4E3-DFD8-CD7B-5CBF-D3267A96FF21}.Release|Win32.Build.0 = Release|Win32
|
||||
{E4F39B89-9731-571D-B69D-C1B8FE56C056}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E4F39B89-9731-571D-B69D-C1B8FE56C056}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E4F39B89-9731-571D-B69D-C1B8FE56C056}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E4F39B89-9731-571D-B69D-C1B8FE56C056}.Release|Win32.Build.0 = Release|Win32
|
||||
{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{03F753C0-8BA5-FF2B-D7D2-EE230B4683B1}.Release|Win32.Build.0 = Release|Win32
|
||||
{90A78BD4-2532-39D9-6D34-7A3C2648508C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{90A78BD4-2532-39D9-6D34-7A3C2648508C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{90A78BD4-2532-39D9-6D34-7A3C2648508C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{90A78BD4-2532-39D9-6D34-7A3C2648508C}.Release|Win32.Build.0 = Release|Win32
|
||||
{0B6929D0-4447-E035-E47A-EBFCE557D5B3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0B6929D0-4447-E035-E47A-EBFCE557D5B3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0B6929D0-4447-E035-E47A-EBFCE557D5B3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0B6929D0-4447-E035-E47A-EBFCE557D5B3}.Release|Win32.Build.0 = Release|Win32
|
||||
{6B017447-F682-A137-8DF4-4608281F2C9F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6B017447-F682-A137-8DF4-4608281F2C9F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6B017447-F682-A137-8DF4-4608281F2C9F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6B017447-F682-A137-8DF4-4608281F2C9F}.Release|Win32.Build.0 = Release|Win32
|
||||
{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{81EE9F71-4DFD-8670-B3EA-7B4E931E9845}.Release|Win32.Build.0 = Release|Win32
|
||||
{AC70A841-561F-4DAE-7864-E50541AD99ED}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AC70A841-561F-4DAE-7864-E50541AD99ED}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AC70A841-561F-4DAE-7864-E50541AD99ED}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AC70A841-561F-4DAE-7864-E50541AD99ED}.Release|Win32.Build.0 = Release|Win32
|
||||
{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E3E2CF1C-9EE4-3173-C39F-D0D4F5483CB6}.Release|Win32.Build.0 = Release|Win32
|
||||
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F69B3672-C5E8-CD1A-257F-253A25B5B939}.Release|Win32.Build.0 = Release|Win32
|
||||
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{353A799F-E73F-7A69-07AD-B2AD57F3B775}.Release|Win32.Build.0 = Release|Win32
|
||||
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{7855B476-B6D4-535D-F7A9-D623245F8B07}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
26
Game_HL2MP-2010.sln
Normal file
26
Game_HL2MP-2010.sln
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Client (HL2MP)", "game\client\client_hl2mp-2010.vcxproj", "{17BCE59A-9037-EC8D-433E-F81339E2F1BA}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Server (HL2MP)", "game\server\server_hl2mp-2010.vcxproj", "{33B7DFDC-BECB-3678-1190-6C951E393EB3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{17BCE59A-9037-EC8D-433E-F81339E2F1BA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{17BCE59A-9037-EC8D-433E-F81339E2F1BA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{17BCE59A-9037-EC8D-433E-F81339E2F1BA}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{17BCE59A-9037-EC8D-433E-F81339E2F1BA}.Release|Win32.Build.0 = Release|Win32
|
||||
{33B7DFDC-BECB-3678-1190-6C951E393EB3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{33B7DFDC-BECB-3678-1190-6C951E393EB3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{33B7DFDC-BECB-3678-1190-6C951E393EB3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{33B7DFDC-BECB-3678-1190-6C951E393EB3}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
121
common/GameUI/IGameUI.h
Normal file
121
common/GameUI/IGameUI.h
Normal file
@ -0,0 +1,121 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef IGAMEUI_H
|
||||
#define IGAMEUI_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
#include "vgui/IPanel.h"
|
||||
|
||||
#if !defined( _X360 )
|
||||
#include "xbox/xboxstubs.h"
|
||||
#endif
|
||||
|
||||
// reasons why the user can't connect to a game server
|
||||
enum ESteamLoginFailure
|
||||
{
|
||||
STEAMLOGINFAILURE_NONE,
|
||||
STEAMLOGINFAILURE_BADTICKET,
|
||||
STEAMLOGINFAILURE_NOSTEAMLOGIN,
|
||||
STEAMLOGINFAILURE_VACBANNED,
|
||||
STEAMLOGINFAILURE_LOGGED_IN_ELSEWHERE
|
||||
};
|
||||
|
||||
enum ESystemNotify
|
||||
{
|
||||
SYSTEMNOTIFY_STORAGEDEVICES_CHANGED,
|
||||
SYSTEMNOTIFY_USER_SIGNEDIN,
|
||||
SYSTEMNOTIFY_USER_SIGNEDOUT,
|
||||
SYSTEMNOTIFY_XUIOPENING,
|
||||
SYSTEMNOTIFY_XUICLOSED,
|
||||
SYSTEMNOTIFY_INVITE_SHUTDOWN, // Cross-game invite is causing us to shutdown
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: contains all the functions that the GameUI dll exports
|
||||
//-----------------------------------------------------------------------------
|
||||
abstract_class IGameUI
|
||||
{
|
||||
public:
|
||||
// initialization/shutdown
|
||||
virtual void Initialize( CreateInterfaceFn appFactory ) = 0;
|
||||
virtual void PostInit() = 0;
|
||||
|
||||
// connect to other interfaces at the same level (gameui.dll/server.dll/client.dll)
|
||||
virtual void Connect( CreateInterfaceFn gameFactory ) = 0;
|
||||
|
||||
virtual void Start() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
virtual void RunFrame() = 0;
|
||||
|
||||
// notifications
|
||||
virtual void OnGameUIActivated() = 0;
|
||||
virtual void OnGameUIHidden() = 0;
|
||||
|
||||
// OLD: Use OnConnectToServer2
|
||||
virtual void OLD_OnConnectToServer(const char *game, int IP, int port) = 0;
|
||||
|
||||
virtual void OnDisconnectFromServer_OLD( uint8 eSteamLoginFailure, const char *username ) = 0;
|
||||
virtual void OnLevelLoadingStarted(bool bShowProgressDialog) = 0;
|
||||
virtual void OnLevelLoadingFinished(bool bError, const char *failureReason, const char *extendedReason) = 0;
|
||||
|
||||
// level loading progress, returns true if the screen needs updating
|
||||
virtual bool UpdateProgressBar(float progress, const char *statusText) = 0;
|
||||
// Shows progress desc, returns previous setting... (used with custom progress bars )
|
||||
virtual bool SetShowProgressText( bool show ) = 0;
|
||||
|
||||
// !!!!!!!!!members added after "GameUI011" initial release!!!!!!!!!!!!!!!!!!!
|
||||
virtual void ShowNewGameDialog( int chapter ) = 0;
|
||||
|
||||
// Xbox 360
|
||||
virtual void SessionNotification( const int notification, const int param = 0 ) = 0;
|
||||
virtual void SystemNotification( const int notification ) = 0;
|
||||
virtual void ShowMessageDialog( const uint nType, vgui::Panel *pOwner ) = 0;
|
||||
virtual void UpdatePlayerInfo( uint64 nPlayerId, const char *pName, int nTeam, byte cVoiceState, int nPlayersNeeded, bool bHost ) = 0;
|
||||
virtual void SessionSearchResult( int searchIdx, void *pHostData, XSESSION_SEARCHRESULT *pResult, int ping ) = 0;
|
||||
virtual void OnCreditsFinished( void ) = 0;
|
||||
|
||||
// inserts specified panel as background for level load dialog
|
||||
virtual void SetLoadingBackgroundDialog( vgui::VPANEL panel ) = 0;
|
||||
|
||||
// Bonus maps interfaces
|
||||
virtual void BonusMapUnlock( const char *pchFileName = NULL, const char *pchMapName = NULL ) = 0;
|
||||
virtual void BonusMapComplete( const char *pchFileName = NULL, const char *pchMapName = NULL ) = 0;
|
||||
virtual void BonusMapChallengeUpdate( const char *pchFileName, const char *pchMapName, const char *pchChallengeName, int iBest ) = 0;
|
||||
virtual void BonusMapChallengeNames( char *pchFileName, char *pchMapName, char *pchChallengeName ) = 0;
|
||||
virtual void BonusMapChallengeObjectives( int &iBronze, int &iSilver, int &iGold ) = 0;
|
||||
virtual void BonusMapDatabaseSave( void ) = 0;
|
||||
virtual int BonusMapNumAdvancedCompleted( void ) = 0;
|
||||
virtual void BonusMapNumMedals( int piNumMedals[ 3 ] ) = 0;
|
||||
|
||||
virtual void OnConnectToServer2(const char *game, int IP, int connectionPort, int queryPort) = 0;
|
||||
|
||||
// X360 Storage device validation:
|
||||
// returns true right away if storage device has been previously selected.
|
||||
// otherwise returns false and will set the variable pointed by pStorageDeviceValidated to 1
|
||||
// once the storage device is selected by user.
|
||||
virtual bool ValidateStorageDevice( int *pStorageDeviceValidated ) = 0;
|
||||
|
||||
virtual void SetProgressOnStart() = 0;
|
||||
virtual void OnDisconnectFromServer( uint8 eSteamLoginFailure ) = 0;
|
||||
|
||||
virtual void OnConfirmQuit( void ) = 0;
|
||||
|
||||
virtual bool IsMainMenuVisible( void ) = 0;
|
||||
|
||||
// Client DLL is providing us with a panel that it wants to replace the main menu with
|
||||
virtual void SetMainMenuOverride( vgui::VPANEL panel ) = 0;
|
||||
// Client DLL is telling us that a main menu command was issued, probably from its custom main menu panel
|
||||
virtual void SendMainMenuCommand( const char *pszCommand ) = 0;
|
||||
};
|
||||
|
||||
#define GAMEUI_INTERFACE_VERSION "GameUI011"
|
||||
|
||||
#endif // IGAMEUI_H
|
103
common/compiledcaptionswap.cpp
Normal file
103
common/compiledcaptionswap.cpp
Normal file
@ -0,0 +1,103 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Swap a compiled caption file.
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#include "utlbuffer.h"
|
||||
#include "byteswap.h"
|
||||
#include "filesystem.h"
|
||||
#include "tier2/fileutils.h"
|
||||
#include "captioncompiler.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
BEGIN_BYTESWAP_DATADESC( CompiledCaptionHeader_t )
|
||||
DEFINE_FIELD( magic, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( version, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( numblocks, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( blocksize, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( directorysize, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( dataoffset, FIELD_INTEGER ),
|
||||
END_BYTESWAP_DATADESC()
|
||||
|
||||
BEGIN_BYTESWAP_DATADESC( CaptionLookup_t )
|
||||
DEFINE_FIELD( hash, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( blockNum, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( offset, FIELD_SHORT ),
|
||||
DEFINE_FIELD( length, FIELD_SHORT ),
|
||||
END_BYTESWAP_DATADESC()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Swap a compiled closecaption file
|
||||
//-----------------------------------------------------------------------------
|
||||
bool SwapClosecaptionFile( void *pData )
|
||||
{
|
||||
CByteswap swap;
|
||||
swap.ActivateByteSwapping( true );
|
||||
|
||||
CompiledCaptionHeader_t *pHdr = (CompiledCaptionHeader_t*)pData;
|
||||
|
||||
if ( IsX360() )
|
||||
{
|
||||
// pre-swap file header
|
||||
swap.SwapFieldsToTargetEndian( pHdr );
|
||||
}
|
||||
|
||||
if ( pHdr->magic != COMPILED_CAPTION_FILEID || pHdr->version != COMPILED_CAPTION_VERSION )
|
||||
{
|
||||
// bad data
|
||||
return false;
|
||||
}
|
||||
|
||||
// lookup headers
|
||||
pData = (byte*)pData + sizeof(CompiledCaptionHeader_t);
|
||||
swap.SwapFieldsToTargetEndian( (CaptionLookup_t*)pData, pHdr->directorysize );
|
||||
|
||||
// unicode data
|
||||
pData = (byte*)pHdr + pHdr->dataoffset;
|
||||
swap.SwapBufferToTargetEndian( (wchar_t*)pData, (wchar_t*)pData, pHdr->numblocks * pHdr->blocksize / sizeof(wchar_t) );
|
||||
|
||||
if ( IsPC() )
|
||||
{
|
||||
// post-swap file header
|
||||
swap.SwapFieldsToTargetEndian( pHdr );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined( CLIENT_DLL )
|
||||
//-----------------------------------------------------------------------------
|
||||
// Callback for UpdateOrCreate - generates .360 file
|
||||
//-----------------------------------------------------------------------------
|
||||
static bool CaptionCreateCallback( const char *pSourceName, const char *pTargetName, const char *pPathID, void *pExtraData )
|
||||
{
|
||||
// Generate the file
|
||||
CUtlBuffer buf;
|
||||
bool bOk = g_pFullFileSystem->ReadFile( pSourceName, pPathID, buf );
|
||||
if ( bOk )
|
||||
{
|
||||
bOk = SwapClosecaptionFile( buf.Base() );
|
||||
if ( bOk )
|
||||
{
|
||||
bOk = g_pFullFileSystem->WriteFile( pTargetName, pPathID, buf );
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning( "Failed to create %s\n", pTargetName );
|
||||
}
|
||||
}
|
||||
return bOk;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Calls utility function UpdateOrCreate
|
||||
//-----------------------------------------------------------------------------
|
||||
int UpdateOrCreateCaptionFile( const char *pSourceName, char *pTargetName, int maxLen, bool bForce )
|
||||
{
|
||||
return ::UpdateOrCreate( pSourceName, pTargetName, maxLen, "GAME", CaptionCreateCallback, bForce );
|
||||
}
|
||||
#endif
|
370
common/hl2orange.spa.h
Normal file
370
common/hl2orange.spa.h
Normal file
@ -0,0 +1,370 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// hl2orange.spa.h
|
||||
//
|
||||
// Auto-generated on Thursday, 13 September 2007 at 16:59:17
|
||||
// XLAST project version 1.0.402.0
|
||||
// SPA Compiler version 2.0.6274.0
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __THE_ORANGE_BOX_SPA_H__
|
||||
#define __THE_ORANGE_BOX_SPA_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//
|
||||
// Title info
|
||||
//
|
||||
|
||||
#define TITLEID_THE_ORANGE_BOX 0x4541080F
|
||||
|
||||
//
|
||||
// Context ids
|
||||
//
|
||||
// These values are passed as the dwContextId to XUserSetContext.
|
||||
//
|
||||
|
||||
#define CONTEXT_CHAPTER_HL2 0
|
||||
#define CONTEXT_SCENARIO 1
|
||||
#define CONTEXT_GAME 2
|
||||
#define CONTEXT_CHAPTER_EP1 3
|
||||
#define CONTEXT_CHAPTER_EP2 4
|
||||
#define CONTEXT_CHAPTER_PORTAL 5
|
||||
|
||||
//
|
||||
// Context values
|
||||
//
|
||||
// These values are passed as the dwContextValue to XUserSetContext.
|
||||
//
|
||||
|
||||
// Values for CONTEXT_CHAPTER_HL2
|
||||
|
||||
#define CONTEXT_CHAPTER_HL2_POINT_INSERTION 0
|
||||
#define CONTEXT_CHAPTER_HL2_A_RED_LETTER_DAY 1
|
||||
#define CONTEXT_CHAPTER_HL2_ROUTE_KANAL 2
|
||||
#define CONTEXT_CHAPTER_HL2_WATER_HAZARD 3
|
||||
#define CONTEXT_CHAPTER_HL2_BLACK_MESA_EAST 4
|
||||
#define CONTEXT_CHAPTER_HL2_RAVENHOLM 5
|
||||
#define CONTEXT_CHAPTER_HL2_HIGHWAY_17 6
|
||||
#define CONTEXT_CHAPTER_HL2_SANDTRAPS 7
|
||||
#define CONTEXT_CHAPTER_HL2_NOVA_PROSPEKT 8
|
||||
#define CONTEXT_CHAPTER_HL2_ENTANGLEMENT 9
|
||||
#define CONTEXT_CHAPTER_HL2_ANTICITIZEN_ONE 10
|
||||
#define CONTEXT_CHAPTER_HL2_FOLLOW_FREEMAN 11
|
||||
#define CONTEXT_CHAPTER_HL2_OUR_BENEFACTORS 12
|
||||
#define CONTEXT_CHAPTER_HL2_DARK_ENERGY 13
|
||||
|
||||
// Values for CONTEXT_SCENARIO
|
||||
|
||||
#define CONTEXT_SCENARIO_CTF_2FORT 0
|
||||
#define CONTEXT_SCENARIO_CP_DUSTBOWL 1
|
||||
#define CONTEXT_SCENARIO_CP_GRANARY 2
|
||||
#define CONTEXT_SCENARIO_CP_WELL 3
|
||||
#define CONTEXT_SCENARIO_CP_GRAVELPIT 4
|
||||
#define CONTEXT_SCENARIO_TC_HYDRO 5
|
||||
#define CONTEXT_SCENARIO_CTF_CLOAK 6
|
||||
#define CONTEXT_SCENARIO_CP_CLOAK 7
|
||||
|
||||
// Values for CONTEXT_GAME
|
||||
|
||||
#define CONTEXT_GAME_GAME_HALF_LIFE_2 0
|
||||
#define CONTEXT_GAME_GAME_EPISODE_ONE 1
|
||||
#define CONTEXT_GAME_GAME_EPISODE_TWO 2
|
||||
#define CONTEXT_GAME_GAME_PORTAL 3
|
||||
#define CONTEXT_GAME_GAME_TEAM_FORTRESS 4
|
||||
|
||||
// Values for CONTEXT_CHAPTER_EP1
|
||||
|
||||
#define CONTEXT_CHAPTER_EP1_UNDUE_ALARM 0
|
||||
#define CONTEXT_CHAPTER_EP1_DIRECT_INTERVENTION 1
|
||||
#define CONTEXT_CHAPTER_EP1_LOWLIFE 2
|
||||
#define CONTEXT_CHAPTER_EP1_URBAN_FLIGHT 3
|
||||
#define CONTEXT_CHAPTER_EP1_EXIT_17 4
|
||||
|
||||
// Values for CONTEXT_CHAPTER_EP2
|
||||
|
||||
#define CONTEXT_CHAPTER_EP2_TO_THE_WHITE_FOREST 0
|
||||
#define CONTEXT_CHAPTER_EP2_THIS_VORTAL_COIL 1
|
||||
#define CONTEXT_CHAPTER_EP2_FREEMAN_PONTIFEX 2
|
||||
#define CONTEXT_CHAPTER_EP2_RIDING_SHOTGUN 3
|
||||
#define CONTEXT_CHAPTER_EP2_UNDER_THE_RADAR 4
|
||||
#define CONTEXT_CHAPTER_EP2_OUR_MUTUAL_FIEND 5
|
||||
#define CONTEXT_CHAPTER_EP2_T_MINUS_ONE 6
|
||||
|
||||
// Values for CONTEXT_CHAPTER_PORTAL
|
||||
|
||||
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_00 0
|
||||
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_04 1
|
||||
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_08 2
|
||||
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_10 3
|
||||
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_13 4
|
||||
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_14 5
|
||||
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_15 6
|
||||
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_16 7
|
||||
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_17 8
|
||||
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_18 9
|
||||
#define CONTEXT_CHAPTER_PORTAL_TESTCHAMBER_19 10
|
||||
|
||||
// Values for X_CONTEXT_PRESENCE
|
||||
|
||||
#define CONTEXT_PRESENCE_TF_CP 0
|
||||
#define CONTEXT_PRESENCE_TF_CTF_LOSING 1
|
||||
#define CONTEXT_PRESENCE_TF_CTF_TIED 2
|
||||
#define CONTEXT_PRESENCE_TF_CTF_WINNING 3
|
||||
#define CONTEXT_PRESENCE_APPCHOOSER 4
|
||||
#define CONTEXT_PRESENCE_MENU 5
|
||||
#define CONTEXT_PRESENCE_EP1_INGAME 6
|
||||
#define CONTEXT_PRESENCE_HL2_INGAME 7
|
||||
#define CONTEXT_PRESENCE_EP2_INGAME 8
|
||||
#define CONTEXT_PRESENCE_PORTAL_INGAME 9
|
||||
#define CONTEXT_PRESENCE_COMMENTARY 10
|
||||
#define CONTEXT_PRESENCE_IDLE 11
|
||||
|
||||
// Values for X_CONTEXT_GAME_MODE
|
||||
|
||||
#define CONTEXT_GAME_MODE_MULTIPLAYER 0
|
||||
#define CONTEXT_GAME_MODE_SINGLEPLAYER 1
|
||||
|
||||
//
|
||||
// Property ids
|
||||
//
|
||||
// These values are passed as the dwPropertyId value to XUserSetProperty
|
||||
// and as the dwPropertyId value in the XUSER_PROPERTY structure.
|
||||
//
|
||||
|
||||
#define PROPERTY_CAPS_OWNED 0x10000000
|
||||
#define PROPERTY_CAPS_TOTAL 0x10000001
|
||||
#define PROPERTY_PLAYER_TEAM_SCORE 0x10000002
|
||||
#define PROPERTY_OPPONENT_TEAM_SCORE 0x10000003
|
||||
#define PROPERTY_FLAG_CAPTURE_LIMIT 0x1000000B
|
||||
#define PROPERTY_NUMBER_OF_ROUNDS 0x1000000C
|
||||
#define PROPERTY_GAME_SIZE 0x1000000D
|
||||
#define PROPERTY_AUTOBALANCE 0x1000000E
|
||||
#define PROPERTY_PRIVATE_SLOTS 0x1000000F
|
||||
#define PROPERTY_MAX_GAME_TIME 0x10000010
|
||||
#define PROPERTY_NUMBER_OF_KILLS 0x10000011
|
||||
#define PROPERTY_DAMAGE_DEALT 0x10000012
|
||||
#define PROPERTY_PLAY_TIME 0x10000013
|
||||
#define PROPERTY_POINT_CAPTURES 0x10000014
|
||||
#define PROPERTY_POINT_DEFENSES 0x10000015
|
||||
#define PROPERTY_DOMINATIONS 0x10000016
|
||||
#define PROPERTY_REVENGE 0x10000017
|
||||
#define PROPERTY_BUILDINGS_DESTROYED 0x10000019
|
||||
#define PROPERTY_HEADSHOTS 0x1000001A
|
||||
#define PROPERTY_HEALTH_POINTS_HEALED 0x1000001B
|
||||
#define PROPERTY_INVULNS 0x1000001C
|
||||
#define PROPERTY_KILL_ASSISTS 0x1000001D
|
||||
#define PROPERTY_BACKSTABS 0x1000001E
|
||||
#define PROPERTY_HEALTH_POINTS_LEACHED 0x1000001F
|
||||
#define PROPERTY_BUILDINGS_BUILT 0x10000020
|
||||
#define PROPERTY_SENTRY_KILLS 0x10000021
|
||||
#define PROPERTY_TELEPORTS 0x10000022
|
||||
#define PROPERTY_KILLS 0x10000023
|
||||
#define PROPERTY_NUMBER_OF_TEAMS 0x10000025
|
||||
#define PROPERTY_TEAM_RED 0x10000026
|
||||
#define PROPERTY_TEAM_BLUE 0x10000027
|
||||
#define PROPERTY_TEAM_SPECTATOR 0x10000028
|
||||
#define PROPERTY_TEAM 0x10000029
|
||||
#define PROPERTY_WIN_LIMIT 0x1000002A
|
||||
#define PROPERTY_RANKING_TEST 0x2000000A
|
||||
#define PROPERTY_POINTS_SCORED 0x20000018
|
||||
|
||||
//
|
||||
// Achievement ids
|
||||
//
|
||||
// These values are used in the dwAchievementId member of the
|
||||
// XUSER_ACHIEVEMENT structure that is used with
|
||||
// XUserWriteAchievements and XUserCreateAchievementEnumerator.
|
||||
//
|
||||
|
||||
#define ACHIEVEMENT_HLX_KILL_ENEMIES_WITHPHYSICS 43
|
||||
#define ACHIEVEMENT_HLX_KILL_ENEMY_WITHHOPPERMINE 44
|
||||
#define ACHIEVEMENT_HLX_KILL_ENEMIES_WITHMANHACK 45
|
||||
#define ACHIEVEMENT_HLX_KILL_SOLDIER_WITHHISGRENADE 46
|
||||
#define ACHIEVEMENT_HLX_KILL_ENEMIES_WITHONEENERGYBALL 47
|
||||
#define ACHIEVEMENT_HLX_KILL_ELITESOLDIER_WITHHISENERGYBALL 48
|
||||
#define ACHIEVEMENT_EPX_GET_ZOMBINEGRENADE 50
|
||||
#define ACHIEVEMENT_EPX_KILL_ZOMBIES_WITHFLARES 51
|
||||
#define ACHIEVEMENT_HL2_HIT_CANCOP_WITHCAN 52
|
||||
#define ACHIEVEMENT_HL2_PUT_CANINTRASH 53
|
||||
#define ACHIEVEMENT_HL2_ESCAPE_APARTMENTRAID 54
|
||||
#define ACHIEVEMENT_HL2_BREAK_MINITELEPORTER 55
|
||||
#define ACHIEVEMENT_HL2_GET_CROWBAR 56
|
||||
#define ACHIEVEMENT_HL2_KILL_BARNACLESWITHBARREL 57
|
||||
#define ACHIEVEMENT_HL2_GET_AIRBOAT 58
|
||||
#define ACHIEVEMENT_HL2_GET_AIRBOATGUN 60
|
||||
#define ACHIEVEMENT_HL2_FIND_VORTIGAUNTCAVE 61
|
||||
#define ACHIEVEMENT_HL2_KILL_CHOPPER 62
|
||||
#define ACHIEVEMENT_HL2_FIND_HEVFACEPLATE 63
|
||||
#define ACHIEVEMENT_HL2_GET_GRAVITYGUN 64
|
||||
#define ACHIEVEMENT_HL2_MAKEABASKET 65
|
||||
#define ACHIEVEMENT_HL2_BEAT_RAVENHOLM_NOWEAPONS 66
|
||||
#define ACHIEVEMENT_HL2_BEAT_CEMETERY 67
|
||||
#define ACHIEVEMENT_HL2_KILL_ENEMIES_WITHCRANE 68
|
||||
#define ACHIEVEMENT_HL2_PIN_SOLDIER_TOBILLBOARD 69
|
||||
#define ACHIEVEMENT_HL2_KILL_ODESSAGUNSHIP 70
|
||||
#define ACHIEVEMENT_HL2_KILL_THREEGUNSHIPS 71
|
||||
#define ACHIEVEMENT_HL2_BEAT_DONTTOUCHSAND 72
|
||||
#define ACHIEVEMENT_HL2_KILL_ENEMIES_WITHANTLIONS 74
|
||||
#define ACHIEVEMENT_HL2_KILL_ENEMY_WITHTOILET 75
|
||||
#define ACHIEVEMENT_HL2_BEAT_TURRETSTANDOFF2 76
|
||||
#define ACHIEVEMENT_HL2_BEAT_TOXICTUNNEL 78
|
||||
#define ACHIEVEMENT_HL2_BEAT_PLAZASTANDOFF 79
|
||||
#define ACHIEVEMENT_HL2_KILL_ALLC1709SNIPERS 80
|
||||
#define ACHIEVEMENT_HL2_BEAT_SUPRESSIONDEVICE 81
|
||||
#define ACHIEVEMENT_HL2_BEAT_C1713STRIDERSTANDOFF 82
|
||||
#define ACHIEVEMENT_HL2_BEAT_GAME 84
|
||||
#define ACHIEVEMENT_HL2_FIND_ALLLAMBDAS 86
|
||||
#define ACHIEVEMENT_EP1_BEAT_MAINELEVATOR 87
|
||||
#define ACHIEVEMENT_EP1_BEAT_CITADELCORE 88
|
||||
#define ACHIEVEMENT_EP1_BEAT_CITADELCORE_NOSTALKERKILLS 89
|
||||
#define ACHIEVEMENT_EP1_KILL_ANTLIONS_WITHCARS 90
|
||||
#define ACHIEVEMENT_EP1_BEAT_GARAGEELEVATORSTANDOFF 91
|
||||
#define ACHIEVEMENT_EP1_KILL_ENEMIES_WITHSNIPERALYX 92
|
||||
#define ACHIEVEMENT_EP1_BEAT_HOSPITALATTICGUNSHIP 93
|
||||
#define ACHIEVEMENT_EP1_BEAT_CITIZENESCORT_NOCITIZENDEATHS 94
|
||||
#define ACHIEVEMENT_EP1_BEAT_GAME 95
|
||||
#define ACHIEVEMENT_EP1_BEAT_GAME_ONEBULLET 96
|
||||
#define ACHIEVEMENT_EP2_KILL_POISONANTLION 97
|
||||
#define ACHIEVEMENT_EP2_KILL_ALLGRUBS 98
|
||||
#define ACHIEVEMENT_EP2_BREAK_ALLWEBS 99
|
||||
#define ACHIEVEMENT_EP2_BEAT_ANTLIONINVASION 100
|
||||
#define ACHIEVEMENT_EP2_BEAT_ANTLIONGUARDS 101
|
||||
#define ACHIEVEMENT_EP2_KILL_ENEMIES_WITHCAR 102
|
||||
#define ACHIEVEMENT_EP2_BEAT_HUNTERAMBUSH 103
|
||||
#define ACHIEVEMENT_EP2_KILL_CHOPPER_NOMISSES 104
|
||||
#define ACHIEVEMENT_EP2_KILL_COMBINECANNON 105
|
||||
#define ACHIEVEMENT_EP2_FIND_ALLRADARCACHES 106
|
||||
#define ACHIEVEMENT_EP2_BEAT_ROCKETCACHEPUZZLE 107
|
||||
#define ACHIEVEMENT_EP2_BEAT_RACEWITHDOG 108
|
||||
#define ACHIEVEMENT_EP2_BEAT_WHITEFORESTINN 109
|
||||
#define ACHIEVEMENT_EP2_PUT_ITEMINROCKET 110
|
||||
#define ACHIEVEMENT_EP2_BEAT_MISSILESILO2 111
|
||||
#define ACHIEVEMENT_EP2_BEAT_OUTLAND12_NOBUILDINGSDESTROYED 112
|
||||
#define ACHIEVEMENT_EP2_BEAT_GAME 113
|
||||
#define ACHIEVEMENT_EP2_KILL_HUNTER_WITHFLECHETTES 114
|
||||
#define ACHIEVEMENT_PORTAL_GET_PORTALGUNS 115
|
||||
#define ACHIEVEMENT_PORTAL_KILL_COMPANIONCUBE 116
|
||||
#define ACHIEVEMENT_PORTAL_ESCAPE_TESTCHAMBERS 117
|
||||
#define ACHIEVEMENT_PORTAL_BEAT_GAME 118
|
||||
#define ACHIEVEMENT_PORTAL_INFINITEFALL 119
|
||||
#define ACHIEVEMENT_PORTAL_LONGJUMP 120
|
||||
#define ACHIEVEMENT_PORTAL_BEAT_2ADVANCEDMAPS 121
|
||||
#define ACHIEVEMENT_PORTAL_BEAT_4ADVANCEDMAPS 122
|
||||
#define ACHIEVEMENT_PORTAL_BEAT_6ADVANCEDMAPS 123
|
||||
#define ACHIEVEMENT_PORTAL_GET_ALLBRONZE 124
|
||||
#define ACHIEVEMENT_PORTAL_GET_ALLSILVER 125
|
||||
#define ACHIEVEMENT_PORTAL_GET_ALLGOLD 126
|
||||
#define ACHIEVEMENT_TF_GET_TURRETKILLS 127
|
||||
#define ACHIEVEMENT_TF_KILL_NEMESIS 128
|
||||
#define ACHIEVEMENT_TF_GET_CONSECUTIVEKILLS_NODEATHS 129
|
||||
#define ACHIEVEMENT_TF_GET_HEALED_BYENEMY 130
|
||||
#define ACHIEVEMENT_TF_PLAY_GAME_FRIENDSONLY 131
|
||||
#define ACHIEVEMENT_TF_WIN_MULTIPLEGAMES 132
|
||||
#define ACHIEVEMENT_TF_GET_MULTIPLEKILLS 133
|
||||
#define ACHIEVEMENT_TF_WIN_2FORT_NOENEMYCAPS 134
|
||||
#define ACHIEVEMENT_TF_WIN_WELL_MINIMUMTIME 135
|
||||
#define ACHIEVEMENT_TF_WIN_HYDRO_NOENEMYCAPS 136
|
||||
#define ACHIEVEMENT_TF_WIN_DUSTBOWL_NOENEMYCAPS 137
|
||||
#define ACHIEVEMENT_TF_WIN_GRAVELPIT_NOENEMYCAPS 138
|
||||
#define ACHIEVEMENT_TF_PLAY_GAME_EVERYCLASS 139
|
||||
#define ACHIEVEMENT_TF_PLAY_GAME_EVERYMAP 140
|
||||
#define ACHIEVEMENT_TF_GET_HEALPOINTS 141
|
||||
#define ACHIEVEMENT_TF_BURN_PLAYERSINMINIMIMTIME 142
|
||||
#define ACHIEVEMENT_HL2_DISINTEGRATE_SOLDIERSINFIELD 143
|
||||
#define ACHIEVEMENT_HL2_FOLLOW_FREEMAN 144
|
||||
#define ACHIEVEMENT_TF_GET_HEADSHOTS 145
|
||||
#define ACHIEVEMENT_PORTAL_DETACH_ALL_CAMERAS 146
|
||||
#define ACHIEVEMENT_PORTAL_HIT_TURRET_WITH_TURRET 148
|
||||
|
||||
#ifndef _XBOX
|
||||
#define ACHIEVEMENT_PORTAL_TRANSMISSION_RECEIVED 149
|
||||
#define ACHIEVEMENT_TF_GENERAL_KILL_ENEMIES_AFTER_TELEPORTING 150
|
||||
#endif // _XBOX
|
||||
|
||||
#define ACHIEVEMENT_TF_LAST_ORANGEBOX 150
|
||||
|
||||
//
|
||||
// Stats view ids
|
||||
//
|
||||
// These are used in the dwViewId member of the XUSER_STATS_SPEC structure
|
||||
// passed to the XUserReadStats* and XUserCreateStatsEnumerator* functions.
|
||||
//
|
||||
|
||||
// Skill leaderboards for ranked game modes
|
||||
|
||||
#define STATS_VIEW_SKILL_RANKED_MULTIPLAYER 0xFFFF0000
|
||||
#define STATS_VIEW_SKILL_RANKED_SINGLEPLAYER 0xFFFF0001
|
||||
|
||||
// Skill leaderboards for unranked (standard) game modes
|
||||
|
||||
#define STATS_VIEW_SKILL_STANDARD_MULTIPLAYER 0xFFFE0000
|
||||
#define STATS_VIEW_SKILL_STANDARD_SINGLEPLAYER 0xFFFE0001
|
||||
|
||||
// Title defined leaderboards
|
||||
|
||||
#define STATS_VIEW_PLAYER_MAX_UNRANKED 1
|
||||
#define STATS_VIEW_PLAYER_MAX_RANKED 2
|
||||
|
||||
//
|
||||
// Stats view column ids
|
||||
//
|
||||
// These ids are used to read columns of stats views. They are specified in
|
||||
// the rgwColumnIds array of the XUSER_STATS_SPEC structure. Rank, rating
|
||||
// and gamertag are not retrieved as custom columns and so are not included
|
||||
// in the following definitions. They can be retrieved from each row's
|
||||
// header (e.g., pStatsResults->pViews[x].pRows[y].dwRank, etc.).
|
||||
//
|
||||
|
||||
// Column ids for PLAYER_MAX_UNRANKED
|
||||
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_POINTS_SCORED 2
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_KILLS 3
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_POINTS_CAPPED 1
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_DAMAGE_DEALT 4
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_PLAY_TIME 5
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_POINT_DEFENSES 6
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_DOMINATIONS 7
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_REVENGE 8
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_BUILDINGS_DESTROYED 9
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_HEADSHOTS 10
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_HEALTH_POINTS_HEALED 11
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_INVULNS 12
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_KILL_ASSISTS 13
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_BACKSTABS 14
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_HEALTH_POINTS_LEACHED 15
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_BUILDINGS_BUILT 16
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_SENTRY_KILLS 17
|
||||
#define STATS_COLUMN_PLAYER_MAX_UNRANKED_TELEPORTS 18
|
||||
|
||||
// Column ids for PLAYER_MAX_RANKED
|
||||
|
||||
#define STATS_COLUMN_PLAYER_MAX_RANKED_POINTS_SCORED 2
|
||||
|
||||
//
|
||||
// Matchmaking queries
|
||||
//
|
||||
// These values are passed as the dwProcedureIndex parameter to
|
||||
// XSessionSearch to indicate which matchmaking query to run.
|
||||
//
|
||||
|
||||
#define SESSION_MATCH_QUERY_PLAYER_MATCH 0
|
||||
|
||||
//
|
||||
// Gamer pictures
|
||||
//
|
||||
// These ids are passed as the dwPictureId parameter to XUserAwardGamerTile.
|
||||
//
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __THE_ORANGE_BOX_SPA_H__
|
||||
|
||||
|
217
common/language.cpp
Normal file
217
common/language.cpp
Normal file
@ -0,0 +1,217 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: languages definition
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#include "language.h"
|
||||
#include "tier0/dbg.h"
|
||||
#include "tier1/strtools.h"
|
||||
|
||||
// NOTE: This has to be the last file included!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
struct Language_t
|
||||
{
|
||||
const char *m_pchName;
|
||||
const char *m_pchShortName;
|
||||
const char *m_pchVGUILocalizationName;
|
||||
const char *m_pchICUName; // used by osx; ISO-639-1 + ISO-3166-1 alpha-2. http://userguide.icu-project.org/locale/examples
|
||||
ELanguage m_ELanguage;
|
||||
int m_LanguageCodeID;
|
||||
};
|
||||
|
||||
|
||||
// REVIEW
|
||||
// es_ES - use new world spanish country code instead?
|
||||
// zh_CN - validate that SC date formats come through
|
||||
// bt_BR - assume we should use Brazilian rather than Iberian portguese
|
||||
|
||||
static const Language_t s_LanguageNames[] =
|
||||
{
|
||||
{ "None", "none", "None", "none", k_Lang_None, 0 },
|
||||
{ "English", "english", "#GameUI_Language_English", "en_US", k_Lang_English, 1033 },
|
||||
{ "German", "german", "#GameUI_Language_German", "de_DE", k_Lang_German, 1031 } ,
|
||||
{ "French", "french", "#GameUI_Language_French", "fr_FR", k_Lang_French, 1036 } ,
|
||||
{ "Italian", "italian", "#GameUI_Language_Italian", "it_IT", k_Lang_Italian, 1040 } ,
|
||||
{ "Korean", "koreana", "#GameUI_Language_Korean", "ko_KR", k_Lang_Korean, 1042 } ,
|
||||
{ "Spanish", "spanish", "#GameUI_Language_Spanish", "es_ES", k_Lang_Spanish, 1034 },
|
||||
{ "Simplified_Chinese", "schinese", "#GameUI_Language_Simplified_Chinese", "zh_CN", k_Lang_Simplified_Chinese, 2052 },
|
||||
{ "Traditional_Chinese", "tchinese", "#GameUI_Language_Traditional_Chinese", "zh_TW", k_Lang_Traditional_Chinese, 1028 },
|
||||
{ "Russian", "russian", "#GameUI_Language_Russian", "ru_RU", k_Lang_Russian, 1049 } ,
|
||||
{ "Thai", "thai", "#GameUI_Language_Thai", "th_TH", k_Lang_Thai, 1054 } ,
|
||||
{ "Japanese", "japanese", "#GameUI_Language_Japanese", "ja_JP", k_Lang_Japanese, 1041 } ,
|
||||
{ "Portuguese", "portuguese", "#GameUI_Language_Portuguese", "pt_PT", k_Lang_Portuguese, 2070 } ,
|
||||
{ "Polish", "polish", "#GameUI_Language_Polish", "pl_PL", k_Lang_Polish, 1045 } ,
|
||||
{ "Danish", "danish", "#GameUI_Language_Danish", "da_DK", k_Lang_Danish, 1030 } ,
|
||||
{ "Dutch", "dutch", "#GameUI_Language_Dutch", "nl_NL", k_Lang_Dutch, 1043 } ,
|
||||
{ "Finnish", "finnish", "#GameUI_Language_Finnish", "fi_FI", k_Lang_Finnish, 1035 } ,
|
||||
{ "Norwegian", "norwegian", "#GameUI_Language_Norwegian", "no_NO", k_Lang_Norwegian, 1044 } ,
|
||||
{ "Swedish", "swedish", "#GameUI_Language_Swedish", "sv_SE", k_Lang_Swedish, 1053 } ,
|
||||
{ "Romanian", "romanian", "#GameUI_Language_Romanian", "ro_RO", k_Lang_Romanian, 1048 } ,
|
||||
{ "Turkish", "turkish", "#GameUI_Language_Turkish", "tr_TR", k_Lang_Turkish, 1055 } ,
|
||||
{ "Hungarian", "hungarian", "#GameUI_Language_Hungarian", "hu_HU", k_Lang_Hungarian, 1038 } ,
|
||||
{ "Czech", "czech", "#GameUI_Language_Czech", "cs_CZ", k_Lang_Czech, 1029 } ,
|
||||
{ "Brazilian", "brazilian", "#GameUI_Language_Brazilian", "pt_BR", k_Lang_Brazilian, 1046 } ,
|
||||
{ "Bulgarian", "bulgarian", "#GameUI_Language_Bulgarian", "bg_BG", k_Lang_Bulgarian, 1026 } ,
|
||||
{ "Greek", "greek", "#GameUI_Language_Greek", "el_GR", k_Lang_Greek, 1032 },
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: translate language enum into closests windows language code ID
|
||||
//-----------------------------------------------------------------------------
|
||||
int GetLanguageCodeID(ELanguage eLang)
|
||||
{
|
||||
for ( uint iLang = 0; iLang < Q_ARRAYSIZE(s_LanguageNames); ++iLang )
|
||||
{
|
||||
if ( s_LanguageNames[iLang].m_ELanguage == eLang )
|
||||
return s_LanguageNames[iLang].m_LanguageCodeID;
|
||||
}
|
||||
|
||||
// default to English
|
||||
return 1033;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: find the language by name
|
||||
//-----------------------------------------------------------------------------
|
||||
ELanguage PchLanguageToELanguage( const char *pchShortName, ELanguage eDefault )
|
||||
{
|
||||
Assert( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 );
|
||||
if ( !pchShortName )
|
||||
return eDefault;
|
||||
|
||||
for ( uint iLang = 0; iLang < Q_ARRAYSIZE(s_LanguageNames); ++iLang )
|
||||
{
|
||||
if ( !Q_stricmp( pchShortName, s_LanguageNames[iLang].m_pchShortName ) )
|
||||
{
|
||||
return s_LanguageNames[iLang].m_ELanguage;
|
||||
}
|
||||
}
|
||||
|
||||
// return default
|
||||
return eDefault;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: find the language by ICU short code
|
||||
//-----------------------------------------------------------------------------
|
||||
ELanguage PchLanguageICUCodeToELanguage( const char *pchICUCode, ELanguage eDefault )
|
||||
{
|
||||
Assert( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 );
|
||||
if ( !pchICUCode )
|
||||
return eDefault;
|
||||
|
||||
// Match to no more than the param length so either a short 'en' or
|
||||
// full 'zh-Hant' can match
|
||||
int nLen = Q_strlen( pchICUCode );
|
||||
|
||||
// we only have 5 character ICU codes so this should be enough room
|
||||
char rchCleanedCode[ 6 ];
|
||||
Q_strncpy( rchCleanedCode, pchICUCode, Q_ARRAYSIZE( rchCleanedCode ) );
|
||||
if( nLen >= 3 && rchCleanedCode[ 2 ] == '-' )
|
||||
{
|
||||
rchCleanedCode[ 2 ] = '_';
|
||||
}
|
||||
|
||||
for ( uint iLang = 0; iLang < Q_ARRAYSIZE(s_LanguageNames); ++iLang )
|
||||
{
|
||||
if ( !Q_strnicmp( rchCleanedCode, s_LanguageNames[iLang].m_pchICUName, nLen ) )
|
||||
{
|
||||
return s_LanguageNames[iLang].m_ELanguage;
|
||||
}
|
||||
}
|
||||
|
||||
// return default
|
||||
return eDefault;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: return the short string name used for this language by SteamUI
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *GetLanguageShortName( ELanguage eLang )
|
||||
{
|
||||
COMPILE_TIME_ASSERT( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 );
|
||||
if ( s_LanguageNames[ eLang + 1 ].m_ELanguage == eLang )
|
||||
{
|
||||
Assert( eLang + 1 < ARRAYSIZE(s_LanguageNames) );
|
||||
return s_LanguageNames[ eLang + 1 ].m_pchShortName;
|
||||
}
|
||||
|
||||
Assert( !"enum ELanguage order mismatched from Language_t s_LanguageNames, fix it!" );
|
||||
return s_LanguageNames[0].m_pchShortName;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: return the ICU code used for this language by SteamUI
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *GetLanguageICUName( ELanguage eLang )
|
||||
{
|
||||
COMPILE_TIME_ASSERT( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 );
|
||||
if ( s_LanguageNames[ eLang + 1 ].m_ELanguage == eLang )
|
||||
{
|
||||
Assert( eLang + 1 < ARRAYSIZE(s_LanguageNames) );
|
||||
return s_LanguageNames[ eLang + 1 ].m_pchICUName;
|
||||
}
|
||||
|
||||
Assert( !"enum ELanguage order mismatched from Language_t s_LanguageNames, fix it!" );
|
||||
return s_LanguageNames[0].m_pchICUName;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: return the CLocale name that works with setlocale()
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *GetLangugeCLocaleName( ELanguage eLang )
|
||||
{
|
||||
if ( eLang == k_Lang_None )
|
||||
return "";
|
||||
|
||||
#ifdef _WIN32
|
||||
// table for Win32 is here: http://msdn.microsoft.com/en-us/library/hzz3tw78(v=VS.80).aspx
|
||||
// shortname works except for chinese
|
||||
|
||||
switch ( eLang )
|
||||
{
|
||||
case k_Lang_Simplified_Chinese:
|
||||
return "chs"; // or "chinese-simplified"
|
||||
case k_Lang_Traditional_Chinese:
|
||||
return "cht"; // or "chinese-traditional"
|
||||
case k_Lang_Korean:
|
||||
return "korean"; // steam likes "koreana" for the name for some reason.
|
||||
default:
|
||||
return GetLanguageShortName( eLang );
|
||||
}
|
||||
|
||||
#else
|
||||
switch ( eLang )
|
||||
{
|
||||
case k_Lang_Simplified_Chinese:
|
||||
case k_Lang_Traditional_Chinese:
|
||||
return "zh_CN";
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
// ICU codes work on linux/osx
|
||||
return GetLanguageICUName( eLang );
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: return the short string name used for this language by SteamUI
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *GetLanguageVGUILocalization( ELanguage eLang )
|
||||
{
|
||||
COMPILE_TIME_ASSERT( Q_ARRAYSIZE(s_LanguageNames) == k_Lang_MAX + 1 );
|
||||
if ( s_LanguageNames[ eLang + 1 ].m_ELanguage == eLang )
|
||||
{
|
||||
Assert( eLang + 1 < ARRAYSIZE(s_LanguageNames) );
|
||||
return s_LanguageNames[ eLang + 1 ].m_pchVGUILocalizationName;
|
||||
}
|
||||
|
||||
Assert( !"enum ELanguage order mismatched from Language_t s_LanguageNames, fix it!" );
|
||||
return s_LanguageNames[0].m_pchVGUILocalizationName;
|
||||
}
|
||||
|
55
common/language.h
Normal file
55
common/language.h
Normal file
@ -0,0 +1,55 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: represent a canonical list of the languages we support,
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef LANG_H
|
||||
#define LANG_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// if you change this enum also change language.cpp:s_LanguageNames
|
||||
enum ELanguage
|
||||
{
|
||||
k_Lang_None = -1,
|
||||
k_Lang_First = 0,
|
||||
k_Lang_English = 0,
|
||||
k_Lang_German,
|
||||
k_Lang_French,
|
||||
k_Lang_Italian,
|
||||
k_Lang_Korean,
|
||||
k_Lang_Spanish,
|
||||
k_Lang_Simplified_Chinese,
|
||||
k_Lang_Traditional_Chinese,
|
||||
k_Lang_Russian,
|
||||
k_Lang_Thai,
|
||||
k_Lang_Japanese,
|
||||
k_Lang_Portuguese,
|
||||
k_Lang_Polish,
|
||||
k_Lang_Danish,
|
||||
k_Lang_Dutch,
|
||||
k_Lang_Finnish,
|
||||
k_Lang_Norwegian,
|
||||
k_Lang_Swedish,
|
||||
k_Lang_Romanian,
|
||||
k_Lang_Turkish,
|
||||
k_Lang_Hungarian,
|
||||
k_Lang_Czech,
|
||||
k_Lang_Brazilian,
|
||||
k_Lang_Bulgarian,
|
||||
k_Lang_Greek,
|
||||
k_Lang_MAX
|
||||
};
|
||||
|
||||
#define FOR_EACH_LANGUAGE( eLang ) for ( int eLang = (int)k_Lang_First; eLang < k_Lang_MAX; ++eLang )
|
||||
|
||||
ELanguage PchLanguageToELanguage(const char *pchShortName, ELanguage eDefault = k_Lang_English);
|
||||
ELanguage PchLanguageICUCodeToELanguage( const char *pchICUCode, ELanguage eDefault = k_Lang_English );
|
||||
const char *GetLanguageShortName( ELanguage eLang );
|
||||
const char *GetLanguageICUName( ELanguage eLang );
|
||||
const char *GetLanguageVGUILocalization( ELanguage eLang );
|
||||
const char *GetLanguageName( ELanguage eLang );
|
||||
|
||||
#endif /* LANG_H */
|
49
common/proto_version.h
Normal file
49
common/proto_version.h
Normal file
@ -0,0 +1,49 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//=============================================================================//
|
||||
#if !defined( PROTO_VERSION_H )
|
||||
#define PROTO_VERSION_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// The current network protocol version. Changing this makes clients and servers incompatible
|
||||
#define PROTOCOL_VERSION 24
|
||||
|
||||
#define DEMO_BACKWARDCOMPATABILITY
|
||||
|
||||
// For backward compatibility of demo files (NET_MAX_PAYLOAD_BITS went away)
|
||||
#define PROTOCOL_VERSION_23 23
|
||||
|
||||
// For backward compatibility of demo files (sound index bits used to = 13 )
|
||||
#define PROTOCOL_VERSION_22 22
|
||||
|
||||
// For backward compatibility of demo files (before the special DSP was shipped to public)
|
||||
#define PROTOCOL_VERSION_21 21
|
||||
|
||||
// For backward compatibility of demo files (old-style dynamic model loading)
|
||||
#define PROTOCOL_VERSION_20 20
|
||||
|
||||
// For backward compatibility of demo files (post Halloween sound flag extra bit)
|
||||
#define PROTOCOL_VERSION_19 19
|
||||
|
||||
// For backward compatibility of demo files (pre Halloween sound flag extra bit)
|
||||
#define PROTOCOL_VERSION_18 18
|
||||
|
||||
// For backward compatibility of demo files (MD5 in map version)
|
||||
#define PROTOCOL_VERSION_17 17
|
||||
|
||||
// For backward compatibility of demo files (create string tables compression flag)
|
||||
#define PROTOCOL_VERSION_14 14
|
||||
|
||||
// For backward compatibility of demo files
|
||||
#define PROTOCOL_VERSION_12 12
|
||||
|
||||
// The PROTOCOL_VERSION when replay shipped to public
|
||||
#define PROTOCOL_VERSION_REPLAY 16
|
||||
|
||||
#endif
|
35
common/qlimits.h
Normal file
35
common/qlimits.h
Normal file
@ -0,0 +1,35 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef QLIMITS_H
|
||||
#define QLIMITS_H
|
||||
|
||||
#if defined( _WIN32 )
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// DATA STRUCTURE INFO
|
||||
|
||||
#define MAX_NUM_ARGVS 50
|
||||
|
||||
// SYSTEM INFO
|
||||
#define MAX_QPATH 96 // max length of a game pathname
|
||||
#define MAX_OSPATH 260 // max length of a filesystem pathname
|
||||
|
||||
#define ON_EPSILON 0.1 // point on plane side epsilon
|
||||
|
||||
|
||||
// Resource counts;
|
||||
#define MAX_MODEL_INDEX_BITS 11 // sent as a short
|
||||
#define MAX_MODELS (1<<MAX_MODEL_INDEX_BITS)
|
||||
|
||||
#define MAX_GENERIC_INDEX_BITS 9
|
||||
#define MAX_GENERIC (1<<MAX_GENERIC_INDEX_BITS)
|
||||
#define MAX_DECAL_INDEX_BITS 9
|
||||
#define MAX_BASE_DECALS (1<<MAX_DECAL_INDEX_BITS)
|
||||
|
||||
#endif // QLIMITS_H
|
27
common/randoverride.cpp
Normal file
27
common/randoverride.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
#if !defined(_STATIC_LINKED) || defined(_SHARED_LIB)
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "vstdlib/random.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
#ifdef GNUC
|
||||
#define __cdecl
|
||||
#endif
|
||||
|
||||
void __cdecl srand(unsigned int)
|
||||
{
|
||||
}
|
||||
|
||||
int __cdecl rand()
|
||||
{
|
||||
return RandomInt( 0, VALVE_RAND_MAX );
|
||||
}
|
||||
|
||||
#endif // !_STATIC_LINKED || _SHARED_LIB
|
43
common/replay/basereplayserializeable.h
Normal file
43
common/replay/basereplayserializeable.h
Normal file
@ -0,0 +1,43 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef REPLAYSERIALIIZEABLE_H
|
||||
#define REPLAYSERIALIIZEABLE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "replay/ireplayserializeable.h"
|
||||
#include "replay/replayhandle.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CBaseReplaySerializeable : public IReplaySerializeable
|
||||
{
|
||||
public:
|
||||
CBaseReplaySerializeable();
|
||||
|
||||
virtual void SetHandle( ReplayHandle_t h );
|
||||
virtual ReplayHandle_t GetHandle() const;
|
||||
virtual bool Read( KeyValues *pIn );
|
||||
virtual void Write( KeyValues *pOut );
|
||||
virtual const char *GetFilename() const;
|
||||
virtual const char *GetFullFilename() const;
|
||||
virtual const char *GetDebugName() const;
|
||||
virtual void SetLocked( bool bLocked );
|
||||
virtual bool IsLocked() const;
|
||||
virtual void OnDelete();
|
||||
virtual void OnUnload();
|
||||
virtual void OnAddedToDirtyList();
|
||||
|
||||
private:
|
||||
ReplayHandle_t m_hThis;
|
||||
bool m_bLocked;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // REPLAYSERIALIIZEABLE_H
|
64
common/replay/iclientreplay.h
Normal file
64
common/replay/iclientreplay.h
Normal file
@ -0,0 +1,64 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef ICLIENTREPLAY_H
|
||||
#define ICLIENTREPLAY_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
#include "replay/replayhandle.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define CLIENT_REPLAY_INTERFACE_VERSION "ClientReplay001"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayFactory;
|
||||
class IReplayScreenshotSystem;
|
||||
class IReplayPerformancePlaybackHandler;
|
||||
class KeyValues;
|
||||
class IReplayCamera;
|
||||
class CReplayPerformance;
|
||||
struct RenderMovieParams_t;
|
||||
class IGameEvent;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Allows the replay and engine DLL's to talk to the client.
|
||||
//
|
||||
class IClientReplay : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual uint64 GetServerSessionId() = 0;
|
||||
virtual bool CacheReplayRagdolls( const char* pFilename, int nStartTick ) = 0; // Cache replay ragdolls
|
||||
virtual IReplayScreenshotSystem *GetReplayScreenshotSystem() = 0; // Get the client's replay screenshot system
|
||||
virtual IReplayPerformancePlaybackHandler *GetPerformancePlaybackHandler() = 0;
|
||||
virtual IReplayCamera *GetReplayCamera() = 0;
|
||||
virtual void DisplayReplayMessage( const char *pLocalizeStr, bool bUrgent, bool bDlg, const char *pSound ) = 0;
|
||||
virtual void DisplayReplayMessage( const wchar_t *pText, bool bUrgent, bool bDlg, const char *pSound ) = 0;
|
||||
virtual void InitPerformanceEditor( ReplayHandle_t hReplay ) = 0;
|
||||
virtual void HidePerformanceEditor() = 0;
|
||||
virtual bool ShouldRender() = 0;
|
||||
virtual void PlaySound( const char *pSound ) = 0;
|
||||
virtual void UploadOgsData( KeyValues *pData, bool bIncludeTimeField ) = 0;
|
||||
virtual bool ShouldCompletePendingReplay( IGameEvent *pEvent ) = 0;
|
||||
|
||||
virtual void OnSaveReplay( ReplayHandle_t hNewReplay, bool bShowInputDlg ) = 0;
|
||||
virtual void OnDeleteReplay( ReplayHandle_t hReplay ) = 0; // Called before replay is actually removed from the replay manager
|
||||
virtual void OnPlaybackComplete( ReplayHandle_t hReplay, int iPerformance ) = 0;
|
||||
virtual void OnRenderStart() = 0;
|
||||
virtual void OnRenderComplete( const RenderMovieParams_t &RenderParams, bool bCancelled, bool bSuccess, bool bShowBrowser ) = 0;
|
||||
virtual bool OnConfirmQuit() = 0;
|
||||
virtual bool OnEndOfReplayReached() = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // ICLIENTREPLAY_H
|
58
common/replay/iclientreplaycontext.h
Normal file
58
common/replay/iclientreplaycontext.h
Normal file
@ -0,0 +1,58 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef ICLIENTREPLAYCONTEXT_H
|
||||
#define ICLIENTREPLAYCONTEXT_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "replay/ireplaycontext.h"
|
||||
#include "replay/replayhandle.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define REPLAYHISTORYMANAGER_INTERFACE_VERSION_CLIENT "VENGINE_CLIENT_REPLAY_HISTORY_MANAGER_001"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplay;
|
||||
class CReplayPerformance;
|
||||
class IReplayManager;
|
||||
class IReplayMovieManager;
|
||||
class IReplayMovieRenderer;
|
||||
class IReplayScreenshotManager;
|
||||
class IReplayPerformanceManager;
|
||||
class IReplayPerformanceController;
|
||||
class IReplayRenderQueue;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IClientReplayContext : public IReplayContext
|
||||
{
|
||||
public:
|
||||
virtual CReplay *GetReplay( ReplayHandle_t hReplay ) = 0; // Shorthand to GetReplayManager()->GetReplay()
|
||||
virtual IReplayManager *GetReplayManager() = 0;
|
||||
virtual IReplayMovieRenderer *GetMovieRenderer() = 0;
|
||||
virtual IReplayMovieManager *GetMovieManager() = 0;
|
||||
virtual IReplayScreenshotManager *GetScreenshotManager() = 0;
|
||||
virtual IReplayPerformanceManager *GetPerformanceManager() = 0;
|
||||
virtual IReplayPerformanceController *GetPerformanceController() = 0;
|
||||
virtual IReplayRenderQueue *GetRenderQueue() = 0;
|
||||
virtual void SetMovieRenderer( IReplayMovieRenderer *pRenderer ) = 0; // Set to be the panel that renders replay movies, or NULL when nothing is rendering
|
||||
virtual void OnSignonStateFull() = 0;
|
||||
virtual void OnClientSideDisconnect() = 0; // Called when client disconnects
|
||||
virtual void PlayReplay( ReplayHandle_t hReplay, int iPerformance, bool bPlaySound ) = 0; // Play the given replay, from spawn tick to death tick
|
||||
virtual bool ReconstructReplayIfNecessary( CReplay *pReplay ) = 0;
|
||||
virtual void OnPlayerSpawn() = 0; // Called on the client when player is spawned
|
||||
virtual void OnPlayerClassChanged() = 0; // Called when the player's class changes - we use this instead of an event for immediacy
|
||||
virtual void GetPlaybackTimes( float &flOutTime, float &flOutLength, const CReplay *pReplay, const CReplayPerformance *pPerformance ) = 0; // Calculate the current time and length of a replay or performance - takes in tick and out tick into account for performances - flCurTime should be gpGlobals->curtime. pPerformance can be NULL.
|
||||
virtual uint64 GetServerSessionId( ReplayHandle_t hReplay ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // ICLIENTREPLAYCONTEXT_H
|
104
common/replay/iclientreplayhistorymanager.h
Normal file
104
common/replay/iclientreplayhistorymanager.h
Normal file
@ -0,0 +1,104 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef ICLIENTREPLAYHISTORYMANAGER_H
|
||||
#define ICLIENTREPLAYHISTORYMANAGER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "replay/replayhandle.h"
|
||||
#include "replay/screenshot.h"
|
||||
#include "interface.h"
|
||||
#include "qlimits.h"
|
||||
#include "convar.h"
|
||||
#include "engine/http.h"
|
||||
#include "tier1/utllinkedlist.h"
|
||||
#include "tier1/checksum_crc.h"
|
||||
#include <time.h>
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayDownloadGroup;
|
||||
class IReplayDownloadGroupHelper;
|
||||
class CDmxElement;
|
||||
class KeyValues;
|
||||
struct CaptureScreenshotParams_t;
|
||||
struct RenderMovieParams_t;
|
||||
class CBaseReplay;
|
||||
class CReplay;
|
||||
class IReplayMovieRenderer;
|
||||
class IReplayMovieManager;
|
||||
class IReplayMovie;
|
||||
class IReplayPerformanceManager;
|
||||
class IGameEvent;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IClientReplayHistoryManager : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual bool Init( CreateInterfaceFn fnCreateFactory ) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
virtual void Think() = 0;
|
||||
|
||||
virtual bool IsInitialized() const = 0;
|
||||
virtual bool Commit( CBaseReplay *pNewReplay ) = 0;
|
||||
|
||||
virtual void Save() = 0; // Write the entire index and any replays/groups/movies that are marked as dirty
|
||||
virtual void FlagReplayForFlush( CBaseReplay *pReplay, bool bForceImmediateWrite ) = 0; // Mark the given replay as dirty - flush to disk at the next opportunity (see CBaseReplayHistoryManager::FlushThink())
|
||||
|
||||
virtual void Nuke() = 0;
|
||||
|
||||
virtual void DeleteReplay( ReplayHandle_t hReplay, bool bNotifyUI ) = 0;
|
||||
virtual CBaseReplay *GetReplay( ReplayHandle_t hReplay ) = 0;
|
||||
|
||||
virtual const char *GetBaseDirectory() = 0; // Returns full directory to wherever replays.dmx lives, e.g. c:\program files (x86)\steam\steamapps\someuser\team fortress 2\game\tf\replays\client\ (or server\) - NOTE: includes trailing slash
|
||||
virtual const char *GetReplaysSubDir() = 0; // Returns "client" or "server"
|
||||
|
||||
// For loop through all replays - indices should not be cached
|
||||
virtual int GetReplayCount() const = 0;
|
||||
// virtual CBaseReplay *GetReplayAtIndex( int nIndex ) = 0;
|
||||
|
||||
virtual const char *GetFullReplayPath() = 0; // Get c:\...\game\tf\replays\<client or server>\
|
||||
|
||||
// Client-specific
|
||||
virtual int GetAdjustedDeathTick( CReplay *pReplay ) = 0;
|
||||
virtual void FlagDownloadGroupForFlush( IReplayDownloadGroup *pGroup, bool bForceImmediate ) = 0;
|
||||
virtual void FlagMovieForFlush( IReplayMovie *pMovie, bool bForceImmediate ) = 0; // Flag the movie for flush - if pMovie is NULL, mark the index for flush
|
||||
virtual void SetMovieRenderer( IReplayMovieRenderer *pRenderer ) = 0; // Set to be the panel that renders replay movies, or NULL when nothing is rendering
|
||||
virtual bool ShouldGameRenderView() = 0; // Called from V_RenderView() to determine whether the game should render - used during movie rendering
|
||||
virtual int GetUnrenderedReplayCount() = 0; // Get the number of unrendered replays
|
||||
virtual void UpdateCurrentReplayDataFromServer() = 0; // Updates start tick, current file url, demo filename
|
||||
virtual void LinkReplayToDownloadGroup() = 0;
|
||||
virtual void CaptureScreenshot( CaptureScreenshotParams_t ¶ms ) = 0; // Schedules a screenshot capture at flDelay seconds in the future
|
||||
virtual void DoCaptureScreenshot() = 0; // Takes the screenshot right now
|
||||
virtual bool ShouldCaptureScreenshot() = 0; // Is screenshot scheduled to be taken right now?
|
||||
virtual void GetUnpaddedScreenshotSize( int &nWidth, int &nHeight ) = 0; // Get the dimensions for a screenshot if we take one right now, based on replay_screenshotresolution and the current aspect ratio
|
||||
virtual void DeleteScreenshotsForReplay( CReplay *pReplay ) = 0; // Deletes all screenshots associated with the given replay
|
||||
virtual void PlayReplay( ReplayHandle_t hReplay ) = 0; // Play the given replay, from spawn tick to death tick
|
||||
virtual void RenderMovie( RenderMovieParams_t const& params ) = 0; // Renders the given replay - or if params.hReplay is -1, render all unrendered replays
|
||||
virtual void CompleteRender( bool bSuccess ) = 0;
|
||||
virtual void OnClientSideDisconnect() = 0; // Called when client disconnects
|
||||
virtual void OnSignonStateFull() = 0;
|
||||
virtual void OnPlayerSpawn() = 0; // Called on the client when player is spawned
|
||||
virtual void OnPlayerClassChanged() = 0; // Called when the player's class changes - we use this instead of an event for immediacy
|
||||
virtual void OnReplayRecordingCvarChanged() = 0; // Called (on client only) when replay_recording is set to 1
|
||||
virtual void OnGroupDeleted() = 0;
|
||||
virtual CReplay *GetPlayingReplay() = 0; // Get the currently playing replay, otherwise NULL if one isn't playing
|
||||
virtual CReplay *GetReplayForCurrentLife() = 0; // Gets the current replay (constant from local player spawn until next spawn/disconnect/exit)
|
||||
virtual bool IsRendering() = 0; // Are we currently rendering a movie?
|
||||
virtual void CancelRender() = 0; // If we're currently rendering, cancel
|
||||
virtual IReplayMovieManager *GetMovieManager() = 0;
|
||||
virtual IReplayMovieRenderer *GetMovieRenderer() = 0;
|
||||
virtual const RenderMovieParams_t *GetRenderSettings() = 0;
|
||||
virtual IReplayDownloadGroupHelper *GetDownloadGroupHelper() = 0;
|
||||
virtual IReplayPerformanceManager *GetPerformanceManager() = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // ICLIENTREPLAYHISTORYMANAGER_H
|
116
common/replay/ienginereplay.h
Normal file
116
common/replay/ienginereplay.h
Normal file
@ -0,0 +1,116 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IENGINEREPLAY_H
|
||||
#define IENGINEREPLAY_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define ENGINE_REPLAY_INTERFACE_VERSION "EngineReplay001"
|
||||
|
||||
#if !defined( DEDICATED )
|
||||
# define ENGINE_REPLAY_CLIENT_INTERFACE_VERSION "EngineClientReplay001"
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IServer;
|
||||
class INetChannel;
|
||||
class IReplayServer;
|
||||
class IClientEntityList;
|
||||
class IClientReplay;
|
||||
struct demoheader_t;
|
||||
class CGlobalVarsBase;
|
||||
class IDemoBuffer;
|
||||
class CBaseRecordingSessionBlock;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Allows the replay, client & server DLL's to talk to the engine
|
||||
//
|
||||
class IEngineReplay : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual bool IsSupportedModAndPlatform() = 0;
|
||||
|
||||
virtual float GetHostTime() = 0;
|
||||
virtual int GetHostTickCount() = 0;
|
||||
virtual int TimeToTicks( float flTime ) = 0;
|
||||
virtual float TicksToTime( int nTick ) = 0;
|
||||
|
||||
virtual bool ReadDemoHeader( const char *pFilename, demoheader_t &header ) = 0;
|
||||
virtual const char *GetGameDir() = 0;
|
||||
virtual void Cbuf_AddText( const char *pCmd ) = 0;
|
||||
virtual void Cbuf_Execute() = 0;
|
||||
virtual void Host_Disconnect( bool bShowMainMenu ) = 0;
|
||||
virtual void HostState_Shutdown() = 0;
|
||||
virtual const char *GetModDir() = 0;
|
||||
|
||||
virtual bool CopyFile( const char *pSource, const char *pDest ) = 0;
|
||||
|
||||
virtual bool LZSS_Compress( char *pDest, unsigned int *pDestLen, const char *pSource, unsigned int nSourceLen ) = 0;
|
||||
virtual bool LZSS_Decompress( char *pDest, unsigned int *pDestLen, const char *pSource, unsigned int nSourceLen ) = 0;
|
||||
|
||||
virtual bool MD5_HashBuffer( unsigned char pDigest[16], const unsigned char *pBuffer, int nSize, unsigned int pSeed[4] ) = 0;
|
||||
|
||||
// Server-specific
|
||||
virtual IReplayServer *GetReplayServer() = 0;
|
||||
virtual IServer *GetReplayServerAsIServer() = 0;
|
||||
virtual IServer *GetGameServer() = 0;
|
||||
virtual bool GetSessionRecordBuffer( uint8 **ppSessionBuffer, int *pSize ) = 0;
|
||||
virtual bool IsDedicated() = 0;
|
||||
virtual void ResetReplayRecordBuffer() = 0;
|
||||
virtual demoheader_t *GetReplayDemoHeader() = 0;
|
||||
virtual void RecalculateTags() = 0;
|
||||
virtual bool NET_GetHostnameAsIP( const char *pHostname, char *pOut, int nOutSize ) = 0;
|
||||
};
|
||||
|
||||
//
|
||||
// Allows the replay and client DLL's to talk to the engine
|
||||
//
|
||||
#if !defined( DEDICATED )
|
||||
class IEngineClientReplay : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual INetChannel *GetNetChannel() = 0;
|
||||
virtual bool IsConnected() = 0;
|
||||
virtual bool IsListenServer() = 0;
|
||||
virtual float GetLastServerTickTime() = 0;
|
||||
virtual const char *GetLevelName() = 0;
|
||||
virtual const char *GetLevelNameShort() = 0;
|
||||
virtual int GetPlayerSlot() = 0;
|
||||
virtual bool IsPlayingReplayDemo() = 0;
|
||||
virtual IClientEntityList *GetClientEntityList() = 0;
|
||||
virtual IClientReplay *GetClientReplayInt() = 0;
|
||||
virtual uint32 GetClientSteamID() = 0;
|
||||
virtual void Con_NPrintf( int nPos, PRINTF_FORMAT_STRING const char *pFormat, ... ) = 0;
|
||||
virtual CGlobalVarsBase *GetClientGlobalVars() = 0;
|
||||
virtual void VGui_PlaySound( const char *pSound ) = 0;
|
||||
virtual void EngineVGui_ConfirmQuit() = 0;
|
||||
virtual int GetScreenWidth() = 0;
|
||||
virtual int GetScreenHeight() = 0;
|
||||
virtual bool IsDemoPlayingBack() = 0;
|
||||
virtual bool IsGamePathValidAndSafeForDownload( const char *pGamePath ) = 0;
|
||||
virtual bool IsInGame() = 0;
|
||||
|
||||
virtual void InitSoundRecord() = 0;
|
||||
|
||||
virtual void Wave_CreateTmpFile( const char *pFilename ) = 0;
|
||||
virtual void Wave_AppendTmpFile( const char *pFilename, void *pBuffer, int nNumSamples ) = 0;
|
||||
virtual void Wave_FixupTmpFile( const char *pFilename ) = 0;
|
||||
|
||||
};
|
||||
#endif // !defined( DEDICATED )
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IENGINEREPLAY_H
|
46
common/replay/iqueryablereplayitem.h
Normal file
46
common/replay/iqueryablereplayitem.h
Normal file
@ -0,0 +1,46 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IQUERYABLEREPLAYITEM_H
|
||||
#define IQUERYABLEREPLAYITEM_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
#include "iqueryablereplayitem.h"
|
||||
#include "replay/replayhandle.h"
|
||||
#include "replay/replaytime.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplay;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
typedef int QueryableReplayItemHandle_t;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
abstract_class IQueryableReplayItem : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual const CReplayTime &GetItemDate() const = 0;
|
||||
virtual bool IsItemRendered() const = 0;
|
||||
virtual CReplay *GetItemReplay() = 0;
|
||||
virtual ReplayHandle_t GetItemReplayHandle() const = 0;
|
||||
virtual QueryableReplayItemHandle_t GetItemHandle() const = 0; // Get the handle of this item
|
||||
virtual const wchar_t *GetItemTitle() const = 0;
|
||||
virtual void SetItemTitle( const wchar_t *pTitle ) = 0;
|
||||
virtual float GetItemLength() const = 0;
|
||||
virtual void *GetUserData() = 0;
|
||||
virtual void SetUserData( void *pUserData ) = 0;
|
||||
virtual bool IsItemAMovie() const = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IQUERYABLEREPLAYITEM_H
|
27
common/replay/irecordingsession.h
Normal file
27
common/replay/irecordingsession.h
Normal file
@ -0,0 +1,27 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IRECORDINGSESSION_H
|
||||
#define IRECORDINGSESSION_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CBaseRecordingSessionBlock;
|
||||
|
||||
class IRecordingSession : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void AddBlock( CBaseRecordingSessionBlock *pBlock ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IRECORDINGSESSION_H
|
30
common/replay/irecordingsessionblockmanager.h
Normal file
30
common/replay/irecordingsessionblockmanager.h
Normal file
@ -0,0 +1,30 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IRECORDINGSESSIONBLOCKMANAGER_H
|
||||
#define IRECORDINGSESSIONBLOCKMANAGER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
#include "replay/replayhandle.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IRecordingSessionBlockManager : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual CBaseRecordingSessionBlock *GetBlock( ReplayHandle_t hBlock ) = 0;
|
||||
virtual void DeleteBlock( CBaseRecordingSessionBlock *pBlock ) = 0;
|
||||
virtual void UnloadBlock( CBaseRecordingSessionBlock *pBlock ) = 0;
|
||||
virtual const char *GetBlockPath() const = 0;
|
||||
virtual void LoadBlockFromFileName( const char *pFilename, IRecordingSession *pSession ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IRECORDINGSESSIONBLOCKMANAGER_H
|
33
common/replay/irecordingsessionmanager.h
Normal file
33
common/replay/irecordingsessionmanager.h
Normal file
@ -0,0 +1,33 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IRECORDINGSESSIONMANAGER_H
|
||||
#define IRECORDINGSESSIONMANAGER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
#include "replay/replayhandle.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CBaseRecordingSession;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IRecordingSessionManager : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual CBaseRecordingSession *FindSession( ReplayHandle_t hSession ) = 0;
|
||||
virtual const CBaseRecordingSession *FindSession( ReplayHandle_t hSession ) const = 0;
|
||||
virtual void FlagSessionForFlush( CBaseRecordingSession *pSession, bool bForceImmediate ) = 0;
|
||||
virtual int GetServerStartTickForSession( ReplayHandle_t hSession ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IRECORDINGSESSIONMANAGER_H
|
25
common/replay/ireplaycamera.h
Normal file
25
common/replay/ireplaycamera.h
Normal file
@ -0,0 +1,25 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef IREPLAYCAMERA_H
|
||||
#define IREPLAYCAMERA_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
abstract_class IReplayCamera : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void ClearOverrideView() = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYCAMERA_H
|
47
common/replay/ireplaycontext.h
Normal file
47
common/replay/ireplaycontext.h
Normal file
@ -0,0 +1,47 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYCONTEXT_H
|
||||
#define IREPLAYCONTEXT_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
#include "replay/replayhandle.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IRecordingSessionManager;
|
||||
class IRecordingSessionBlockManager;
|
||||
class IRecordingSession;
|
||||
class IReplayErrorSystem;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayContext : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual bool Init( CreateInterfaceFn fnCreateFactory ) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
virtual void Think() = 0;
|
||||
|
||||
virtual bool IsInitialized() const = 0;
|
||||
|
||||
virtual const char *GetRelativeBaseDir() const = 0; // Returns path to wherever the index .dmx lives relative to the game path, e.g. "replay\client\"
|
||||
virtual const char *GetBaseDir() const = 0; // Returns full directory to wherever the index .dmx lives, e.g. c:\program files (x86)\steam\steamapps\<username>\team fortress 2\tf\replays\<client|server>\ -- NOTE: includes trailing slash
|
||||
virtual const char *GetReplaySubDir() const = 0; // Returns "client" or "server"
|
||||
|
||||
virtual IReplayErrorSystem *GetErrorSystem() = 0;
|
||||
virtual IRecordingSessionManager *GetRecordingSessionManager() = 0;
|
||||
virtual IRecordingSessionBlockManager *GetRecordingSessionBlockManager() = 0;
|
||||
virtual IRecordingSession *GetRecordingSession( ReplayHandle_t hSession ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYCONTEXT_H
|
42
common/replay/ireplaydemoplayer.h
Normal file
42
common/replay/ireplaydemoplayer.h
Normal file
@ -0,0 +1,42 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYDEMOPLAYER_H
|
||||
#define IREPLAYDEMOPLAYER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
#include "replay/replay.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define INTERFACEVERSION_REPLAYDEMOPLAYER "ReplayDemoPlayer001"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Interface for replay demo player
|
||||
//
|
||||
class IReplayDemoPlayer : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void PlayReplay( ReplayHandle_t hReplay, int iPerformance ) = 0;
|
||||
virtual void PlayNextReplay() = 0;
|
||||
virtual void ClearReplayList() = 0;
|
||||
virtual void AddReplayToList( ReplayHandle_t hReplay, int iPerformance ) = 0;
|
||||
virtual CReplay *GetCurrentReplay() = 0;
|
||||
virtual CReplayPerformance *GetCurrentPerformance() = 0; // The playing replay, or NULL if playing the original replay
|
||||
virtual void PauseReplay() = 0;
|
||||
virtual bool IsReplayPaused() = 0;
|
||||
virtual void ResumeReplay() = 0;
|
||||
virtual void OnSignonStateFull() = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYDEMOPLAYER_H
|
33
common/replay/ireplayerrorsystem.h
Normal file
33
common/replay/ireplayerrorsystem.h
Normal file
@ -0,0 +1,33 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYERRORSYSYTEM_H
|
||||
#define IREPLAYERRORSYSYTEM_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class KeyValues;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Replay error system
|
||||
//
|
||||
class IReplayErrorSystem : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void AddErrorFromTokenName( const char *pToken ) = 0;
|
||||
virtual void AddFormattedErrorFromTokenName( const char *pFormatToken, KeyValues *pFormatArgs ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYERRORSYSYTEM_H
|
31
common/replay/ireplayfactory.h
Normal file
31
common/replay/ireplayfactory.h
Normal file
@ -0,0 +1,31 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYFACTORY_H
|
||||
#define IREPLAYFACTORY_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplay;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
abstract_class IReplayFactory : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual CReplay *Create() = 0;
|
||||
};
|
||||
|
||||
#define INTERFACE_VERSION_REPLAY_FACTORY "IReplayFactory001"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYFACTORY_H
|
42
common/replay/ireplaymanager.h
Normal file
42
common/replay/ireplaymanager.h
Normal file
@ -0,0 +1,42 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYMANAGER_H
|
||||
#define IREPLAYMANAGER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
#include "replay/replayhandle.h"
|
||||
#include "utllinkedlist.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplay;
|
||||
class IQueryableReplayItem;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayManager : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual CReplay *GetReplay( ReplayHandle_t hReplay ) = 0;
|
||||
virtual CReplay *GetPlayingReplay() = 0;
|
||||
virtual CReplay *GetReplayForCurrentLife() = 0;
|
||||
virtual void FlagReplayForFlush( CReplay *pReplay, bool bForceImmediate ) = 0;
|
||||
virtual void DeleteReplay( ReplayHandle_t hReplay, bool bNotifyUI ) = 0;
|
||||
virtual int GetReplayCount() const = 0;
|
||||
virtual int GetUnrenderedReplayCount() = 0; // Get the number of unrendered replays
|
||||
virtual void GetReplays( CUtlLinkedList< CReplay *, int > &lstReplays ) = 0;
|
||||
virtual void GetReplaysAsQueryableItems( CUtlLinkedList< IQueryableReplayItem *, int > &lstReplays ) = 0;
|
||||
virtual float GetDownloadProgress( const CReplay *pReplay ) = 0;
|
||||
virtual const char *GetReplaysDir() const = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYMANAGER_H
|
42
common/replay/ireplaymovie.h
Normal file
42
common/replay/ireplaymovie.h
Normal file
@ -0,0 +1,42 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYMOVIE_H
|
||||
#define IREPLAYMOVIE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "iqueryablereplayitem.h"
|
||||
#include "replay/rendermovieparams.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
abstract_class IReplayMovie : public IQueryableReplayItem
|
||||
{
|
||||
public:
|
||||
virtual ReplayHandle_t GetMovieHandle() const = 0;
|
||||
virtual ReplayHandle_t GetReplayHandle() const = 0;
|
||||
virtual const ReplayRenderSettings_t &GetRenderSettings() = 0;
|
||||
virtual void GetFrameDimensions( int &nWidth, int &nHeight ) = 0;
|
||||
virtual void SetIsRendered( bool bIsRendered ) = 0;
|
||||
virtual void SetMovieFilename( const char *pFilename ) = 0;
|
||||
virtual const char *GetMovieFilename() const = 0;
|
||||
virtual void SetMovieTitle( const wchar_t *pTitle ) = 0;
|
||||
virtual void SetRenderTime( float flRenderTime ) = 0;
|
||||
virtual float GetRenderTime() const = 0;
|
||||
virtual void CaptureRecordTime() = 0;
|
||||
virtual void SetLength( float flLength ) = 0;
|
||||
|
||||
virtual bool IsUploaded() const = 0;
|
||||
virtual void SetUploaded( bool bUploaded ) = 0;
|
||||
virtual void SetUploadURL( const char *pURL ) = 0;
|
||||
virtual const char *GetUploadURL() const = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYMOVIE_H
|
56
common/replay/ireplaymoviemanager.h
Normal file
56
common/replay/ireplaymoviemanager.h
Normal file
@ -0,0 +1,56 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYMOVIEMANAGER_H
|
||||
#define IREPLAYMOVIEMANAGER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
#include "utlstring.h"
|
||||
#include "utllinkedlist.h"
|
||||
#include "replay/replayhandle.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayMovie;
|
||||
class CReplay;
|
||||
struct RenderMovieParams_t;
|
||||
class IQueryableReplayItem;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
abstract_class IReplayMovieManager : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual int GetMovieCount() = 0;
|
||||
virtual void GetMovieList( CUtlLinkedList< IReplayMovie * > &list ) = 0; // Fills the list with all movies
|
||||
virtual IReplayMovie *GetMovie( ReplayHandle_t hMovie ) = 0;
|
||||
virtual IReplayMovie *CreateAndAddMovie( ReplayHandle_t hReplay ) = 0; // Creates and adds a movie based on the given replay
|
||||
virtual void DeleteMovie( ReplayHandle_t hMovie ) = 0; // Delete a movie
|
||||
virtual int GetNumMoviesDependentOnReplay( const CReplay *pReplay ) = 0; // Get the number of movies that depend on the given replay
|
||||
virtual void GetCachedMovieTitleAndClear( wchar_t *pOut, int nOutBufLength ) = 0; // TODO: This is a hack - fix this
|
||||
virtual void SetPendingMovie( IReplayMovie *pMovie ) = 0;
|
||||
virtual IReplayMovie *GetPendingMovie() = 0;
|
||||
virtual void FlagMovieForFlush( IReplayMovie *pMovie, bool bImmediate ) = 0;
|
||||
virtual void GetMoviesAsQueryableItems( CUtlLinkedList< IQueryableReplayItem *, int > &lstMovies ) = 0;
|
||||
virtual const char *GetRenderDir() const = 0;
|
||||
virtual const char *GetRawExportDir() const = 0;
|
||||
|
||||
// TODO: Is this the best place for code that actually manages rendering?
|
||||
virtual bool IsRendering() const = 0;
|
||||
virtual bool RenderingCancelled() const = 0;
|
||||
virtual void RenderMovie( RenderMovieParams_t const& params ) = 0; // Renders the given replay - or if params.hReplay is -1, render all unrendered replays
|
||||
virtual void RenderNextMovie() = 0;
|
||||
virtual void CompleteRender( bool bSuccess, bool bShowBrowser ) = 0;
|
||||
virtual void CancelRender() = 0;
|
||||
virtual void ClearRenderCancelledFlag() = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYMOVIEMANAGER_H
|
33
common/replay/ireplaymovierenderer.h
Normal file
33
common/replay/ireplaymovierenderer.h
Normal file
@ -0,0 +1,33 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYMOVIERENDERER_H
|
||||
#define IREPLAYMOVIERENDERER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayMovie;
|
||||
struct RenderMovieParams_t;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
abstract_class IReplayMovieRenderer : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual bool SetupRenderer( RenderMovieParams_t ¶ms, IReplayMovie *pMovie ) = 0;
|
||||
virtual void ShutdownRenderer() = 0;
|
||||
virtual void RenderVideo() = 0;
|
||||
virtual void RenderAudio( unsigned char *pBuffer, int nSize, int nNumSamples ) = 0;
|
||||
|
||||
virtual void SetAudioSyncFrame( bool isSync = false ) = 0;
|
||||
virtual bool IsAudioSyncFrame() = 0;
|
||||
virtual float GetRecordingFrameDuration() = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYMOVIERENDERER_H
|
107
common/replay/ireplayperformancecontroller.h
Normal file
107
common/replay/ireplayperformancecontroller.h
Normal file
@ -0,0 +1,107 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYPERFORMANCECONTROLLER_H
|
||||
#define IREPLAYPERFORMANCECONTROLLER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
#include "tier1/strtools.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayPerformanceEditor;
|
||||
class CReplay;
|
||||
class Vector;
|
||||
class QAngle;
|
||||
class CReplayPerformance;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
// These values are what we use to represent
|
||||
|
||||
struct SetViewParams_t
|
||||
{
|
||||
SetViewParams_t() { V_memset( this, 0, sizeof( SetViewParams_t ) ); }
|
||||
SetViewParams_t( float flTime, Vector *pOrigin, QAngle *pAngles, float flFov, float flAccel,
|
||||
float flSpeed, float flRotFilter )
|
||||
: m_flTime( flTime ),
|
||||
m_pOrigin( pOrigin ),
|
||||
m_pAngles( pAngles ),
|
||||
m_flFov( flFov ),
|
||||
m_flAccel( flAccel ),
|
||||
m_flSpeed( flSpeed ),
|
||||
m_flRotationFilter( flRotFilter )
|
||||
{
|
||||
}
|
||||
|
||||
float m_flTime;
|
||||
Vector *m_pOrigin;
|
||||
QAngle *m_pAngles;
|
||||
float m_flFov;
|
||||
|
||||
// Right now only used for updating UI during playback:
|
||||
float m_flAccel;
|
||||
float m_flSpeed;
|
||||
float m_flRotationFilter;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayPerformanceController : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void SetEditor( IReplayPerformanceEditor *pEditor ) = 0;
|
||||
|
||||
virtual bool IsPlaybackDataLeft() = 0;
|
||||
|
||||
virtual void StartRecording( CReplay *pReplay, bool bSnip ) = 0;
|
||||
virtual void NotifyRewinding() = 0;
|
||||
|
||||
virtual void Stop() = 0;
|
||||
virtual bool SaveAsync() = 0;
|
||||
virtual bool SaveAsAsync( const wchar *pTitle ) = 0;
|
||||
|
||||
virtual bool IsSaving() const = 0;
|
||||
|
||||
virtual void SaveThink() = 0;
|
||||
|
||||
virtual bool GetLastSaveStatus() const = 0;
|
||||
|
||||
virtual bool IsRecording() const = 0;
|
||||
virtual bool IsPlaying() const = 0;
|
||||
|
||||
virtual bool IsDirty() const = 0;
|
||||
virtual void NotifyDirty() = 0;
|
||||
|
||||
virtual CReplayPerformance *GetPerformance() = 0;
|
||||
virtual CReplayPerformance *GetSavedPerformance() = 0;
|
||||
virtual bool HasSavedPerformance() = 0;
|
||||
|
||||
virtual void NotifyPauseState( bool bPaused ) = 0;
|
||||
|
||||
virtual void ClearRewinding() = 0;
|
||||
|
||||
virtual void OnSignonStateFull() = 0;
|
||||
|
||||
virtual float GetPlaybackTimeScale() const = 0;
|
||||
|
||||
//
|
||||
// Recorder-specific:
|
||||
//
|
||||
virtual void AddEvent_Camera_Change_FirstPerson( float flTime, int nEntityIndex ) = 0;
|
||||
virtual void AddEvent_Camera_Change_ThirdPerson( float flTime, int nEntityIndex ) = 0;
|
||||
virtual void AddEvent_Camera_Change_Free( float flTime ) = 0;
|
||||
virtual void AddEvent_Camera_ChangePlayer( float flTime, int nEntIndex ) = 0;
|
||||
virtual void AddEvent_Camera_SetView( const SetViewParams_t ¶ms ) = 0;
|
||||
virtual void AddEvent_TimeScale( float flTime, float flScale ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYPERFORMANCECONTROLLER_H
|
33
common/replay/ireplayperformanceeditor.h
Normal file
33
common/replay/ireplayperformanceeditor.h
Normal file
@ -0,0 +1,33 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYPERFORMANCEEDITOR_H
|
||||
#define IREPLAYPERFORMANCEEDITOR_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplay;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Interface to allow the replay DLL to talk to the actual UI.
|
||||
//
|
||||
class IReplayPerformanceEditor : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual CReplay *GetReplay() = 0;
|
||||
virtual void OnRewindComplete() = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYPERFORMANCEEDITOR_H
|
36
common/replay/ireplayperformancemanager.h
Normal file
36
common/replay/ireplayperformancemanager.h
Normal file
@ -0,0 +1,36 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYPERFORMANCEMANAGER_H
|
||||
#define IREPLAYPERFORMANCEMANAGER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplayPerformance;
|
||||
class CReplay;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayPerformanceManager : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual CReplayPerformance *CreatePerformance( CReplay *pReplay ) = 0;
|
||||
virtual void DeletePerformance( CReplayPerformance *pPerformance ) = 0;
|
||||
|
||||
virtual const char *GetRelativePath() const = 0;
|
||||
virtual const char *GetFullPath() const = 0;
|
||||
|
||||
virtual const char *GeneratePerformanceFilename( CReplay *pReplay ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYPERFORMANCEMANAGER_H
|
36
common/replay/ireplayperformanceplaybackhandler.h
Normal file
36
common/replay/ireplayperformanceplaybackhandler.h
Normal file
@ -0,0 +1,36 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYPERFORMANCEPLAYBACKHANDLER_H
|
||||
#define IREPLAYPERFORMANCEPLAYBACKHANDLER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
#include "replay/ireplayperformancecontroller.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class Vector;
|
||||
class QAngle;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayPerformancePlaybackHandler : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void OnEvent_Camera_Change_FirstPerson( float flTime, int nEntityIndex ) = 0;
|
||||
virtual void OnEvent_Camera_Change_ThirdPerson( float flTime, int nEntityIndex ) = 0;
|
||||
virtual void OnEvent_Camera_Change_Free( float flTime ) = 0;
|
||||
virtual void OnEvent_Camera_ChangePlayer( float flTime, int nEntIndex ) = 0;
|
||||
virtual void OnEvent_Camera_SetView( const SetViewParams_t ¶ms ) = 0;
|
||||
virtual void OnEvent_TimeScale( float flTime, float flScale ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYPERFORMANCEPLAYBACKHANDLER_H
|
33
common/replay/ireplayperformanceplayer.h
Normal file
33
common/replay/ireplayperformanceplayer.h
Normal file
@ -0,0 +1,33 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYPERFORMANCEPLAYER_H
|
||||
#define IREPLAYPERFORMANCEPLAYER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplay;
|
||||
class CReplayPerformance;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayPerformancePlayer : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void BeginPerformancePlay( CReplayPerformance *pPerformance ) = 0;
|
||||
virtual void EndPerformancePlay() = 0;
|
||||
|
||||
virtual bool IsPlaying() const = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYPERFORMANCEPLAYER_H
|
49
common/replay/ireplayperformancerecorder.h
Normal file
49
common/replay/ireplayperformancerecorder.h
Normal file
@ -0,0 +1,49 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYPERFORMANCERECORDER_H
|
||||
#define IREPLAYPERFORMANCERECORDER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplay;
|
||||
class Vector;
|
||||
class QAngle;
|
||||
class CReplayPerformance;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayPerformanceRecorder : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void BeginPerformanceRecord( CReplay *pReplay ) = 0;
|
||||
virtual void EndPerformanceRecord() = 0;
|
||||
|
||||
virtual void NotifyPauseState( bool bPaused ) = 0;
|
||||
|
||||
virtual CReplayPerformance *GetPerformance() = 0;
|
||||
virtual bool IsRecording() const = 0;
|
||||
|
||||
virtual void SnipAtTime( float flTime ) = 0;
|
||||
virtual void NotifySkipping() = 0;
|
||||
virtual void ClearSkipping() = 0;
|
||||
|
||||
virtual void AddEvent_Camera_Change_FirstPerson( float flTime, int nEntityIndex ) = 0;
|
||||
virtual void AddEvent_Camera_Change_ThirdPerson( float flTime, int nEntityIndex ) = 0;
|
||||
virtual void AddEvent_Camera_Change_Free( float flTime ) = 0;
|
||||
virtual void AddEvent_Camera_ChangePlayer( float flTime, int nEntIndex ) = 0;
|
||||
virtual void AddEvent_Camera_SetView( float flTime, const Vector& origin, const QAngle &angles, float fov ) = 0;
|
||||
virtual void AddEvent_Slowmo( float flTime, float flScale ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYPERFORMANCERECORDER_H
|
41
common/replay/ireplayplayercache.h
Normal file
41
common/replay/ireplayplayercache.h
Normal file
@ -0,0 +1,41 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef IREPLAYPLAYERCACHE_H
|
||||
#define IREPLAYPLAYERCACHE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define REPLAYPLAYERCACHE_INTERFACE_VERSION "VENGINE_REPLAY_PLAYER_CACHE_001"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
abstract_class IReplayPlayerCache : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual bool Init() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
virtual void SetupPlayer( int nEntIndex ) = 0;
|
||||
virtual void DeletePlayerEntry( int nEntIndex ) = 0;
|
||||
|
||||
virtual bool PlayerHasCacheEntry( int nEntIndex ) = 0;
|
||||
|
||||
virtual void SetPlayerClass( int nEntIndex, const char *pPlayerClass ) = 0;
|
||||
virtual void SetPlayerSpawnTick( int nEntIndex, int nTick ) = 0;
|
||||
virtual void SetPlayerDeathTick( int nEntIndex, int nTick ) = 0;
|
||||
|
||||
virtual const char *GetPlayerClass( int nEntIndex ) = 0;
|
||||
virtual int GetPlayerSpawnTick( int nEntIndex ) = 0;
|
||||
virtual int GetPlayerDeathTick( int nEntIndex ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYPLAYERCACHE_H
|
32
common/replay/ireplayrenderqueue.h
Normal file
32
common/replay/ireplayrenderqueue.h
Normal file
@ -0,0 +1,32 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYRENDERQUEUE_H
|
||||
#define IREPLAYRENDERQUEUE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
#include "replay/replayhandle.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
abstract_class IReplayRenderQueue : IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void Add( ReplayHandle_t hReplay, int iPerformance ) = 0;
|
||||
virtual void Remove( ReplayHandle_t hReplay, int iPerformance ) = 0;
|
||||
virtual void Clear() = 0;
|
||||
|
||||
virtual int GetCount() const = 0;
|
||||
virtual bool GetEntryData( int iIndex, ReplayHandle_t *pHandleOut, int *pPerformanceOut ) const = 0;
|
||||
virtual bool IsInQueue( ReplayHandle_t hReplay, int iPerformance ) const = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYRENDERQUEUE_H
|
32
common/replay/ireplayscreenshotmanager.h
Normal file
32
common/replay/ireplayscreenshotmanager.h
Normal file
@ -0,0 +1,32 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYSCREENSHOTMANAGER_H
|
||||
#define IREPLAYSCREENSHOTMANAGER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplay;
|
||||
struct CaptureScreenshotParams_t;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayScreenshotManager : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void CaptureScreenshot( CaptureScreenshotParams_t& params ) = 0;
|
||||
virtual void GetUnpaddedScreenshotSize( int &nOutWidth, int &nOutHeight ) = 0;
|
||||
virtual void DeleteScreenshotsForReplay( CReplay *pReplay ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYSCREENSHOTMANAGER_H
|
34
common/replay/ireplayscreenshotsystem.h
Normal file
34
common/replay/ireplayscreenshotsystem.h
Normal file
@ -0,0 +1,34 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYSCREENSHOTSYSTEM_H
|
||||
#define IREPLAYSCREENSHOTSYSTEM_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
struct WriteReplayScreenshotParams_t;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Implementation lives in the client - allows replay to tell the client to grab a
|
||||
// screenshot or update the cache.
|
||||
//
|
||||
class IReplayScreenshotSystem : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void WriteReplayScreenshot( WriteReplayScreenshotParams_t ¶ms ) = 0;
|
||||
virtual void UpdateReplayScreenshotCache() = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYSCREENSHOTSYSTEM_H
|
48
common/replay/ireplayserializeable.h
Normal file
48
common/replay/ireplayserializeable.h
Normal file
@ -0,0 +1,48 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYSERIALIIZEABLE_H
|
||||
#define IREPLAYSERIALIIZEABLE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
#include "replay/replayhandle.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class KeyValues;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplaySerializeable : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void SetHandle( ReplayHandle_t h ) = 0;
|
||||
virtual ReplayHandle_t GetHandle() const = 0;
|
||||
|
||||
virtual bool Read( KeyValues *pIn ) = 0;
|
||||
virtual void Write( KeyValues *pOut ) = 0;
|
||||
|
||||
virtual const char *GetSubKeyTitle() const = 0;
|
||||
virtual const char *GetFilename() const = 0;
|
||||
virtual const char *GetPath() const = 0;
|
||||
|
||||
virtual const char *GetFullFilename() const = 0;
|
||||
|
||||
virtual void SetLocked( bool bLocked ) = 0;
|
||||
virtual bool IsLocked() const = 0;
|
||||
|
||||
virtual void OnDelete() = 0;
|
||||
virtual void OnUnload() = 0;
|
||||
|
||||
virtual const char *GetDebugName() const = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYSERIALIIZEABLE_H
|
48
common/replay/ireplayserver.h
Normal file
48
common/replay/ireplayserver.h
Normal file
@ -0,0 +1,48 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef IREPLAYSERVER_H
|
||||
#define IREPLAYSERVER_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class IServer;
|
||||
class IReplayDirector;
|
||||
class IGameEvent;
|
||||
struct netadr_s;
|
||||
class CServerReplay;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Interface the Replay module exposes to the engine
|
||||
//-----------------------------------------------------------------------------
|
||||
#define INTERFACEVERSION_REPLAYSERVER "ReplayServer001"
|
||||
|
||||
class IReplayServer : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual ~IReplayServer() {}
|
||||
|
||||
virtual IServer *GetBaseServer() = 0; // get Replay base server interface
|
||||
virtual IReplayDirector *GetDirector() = 0; // get director interface
|
||||
virtual int GetReplaySlot() = 0; // return entity index-1 of Replay in game
|
||||
virtual float GetOnlineTime() = 0; // seconds since broadcast started
|
||||
virtual void BroadcastEvent(IGameEvent *event) = 0; // send a director command to all specs
|
||||
virtual bool IsRecording() = 0;
|
||||
virtual void StartRecording() = 0;
|
||||
virtual void StopRecording() = 0;
|
||||
};
|
||||
|
||||
#endif
|
27
common/replay/ireplaysessionrecorder.h
Normal file
27
common/replay/ireplaysessionrecorder.h
Normal file
@ -0,0 +1,27 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYSESSIONRECORDER_H
|
||||
#define IREPLAYSESSIONRECORDER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplaySessionRecorder : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void StartRecording() = 0;
|
||||
virtual void StopRecording( bool bAborting ) = 0;
|
||||
virtual void SetCurrentRecordingStartTick( int nStartTick ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYSESSIONRECORDER_H
|
60
common/replay/ireplaysystem.h
Normal file
60
common/replay/ireplaysystem.h
Normal file
@ -0,0 +1,60 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef IREPLAYSYSTEM_H
|
||||
#define IREPLAYSYSTEM_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "appframework/IAppSystem.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IClientReplayContext;
|
||||
class IServerReplayContext;
|
||||
class IGameEvent;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
abstract_class IReplaySystem : public IAppSystem
|
||||
{
|
||||
public:
|
||||
// IAppSystem:
|
||||
virtual bool Connect( CreateInterfaceFn fnFactory ) = 0;
|
||||
virtual void Disconnect() = 0;
|
||||
virtual InitReturnVal_t Init() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
// To be called client- & server-side
|
||||
virtual void Think() = 0;
|
||||
virtual bool IsReplayEnabled() = 0;
|
||||
virtual bool IsRecording() = 0;
|
||||
|
||||
// To be called client-side only - on dedicated servers, only subs defined
|
||||
virtual bool CL_Init( CreateInterfaceFn fnClientFactory ) = 0;
|
||||
virtual void CL_Shutdown() = 0;
|
||||
virtual void CL_Render() = 0;
|
||||
virtual IClientReplayContext *CL_GetContext() = 0;
|
||||
|
||||
// To be called server-side only
|
||||
virtual bool SV_Init( CreateInterfaceFn fnFactory ) = 0;
|
||||
virtual void SV_Shutdown() = 0;
|
||||
virtual void SV_EndRecordingSession( bool bForceSynchronousPublish = false ) = 0;
|
||||
virtual void SV_SendReplayEvent( const char *pEventName, int nClientSlot ) = 0;
|
||||
virtual void SV_SendReplayEvent( IGameEvent *pEvent, int nClientSlot ) = 0;
|
||||
virtual bool SV_ShouldBeginRecording( bool bIsInWaitingForPlayers ) = 0;
|
||||
virtual void SV_NotifyReplayRequested() = 0;
|
||||
virtual IServerReplayContext *SV_GetContext() = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define REPLAY_INTERFACE_VERSION "ReplaySystem001"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // IREPLAYSYSTEM_H
|
27
common/replay/iserverengine.h
Normal file
27
common/replay/iserverengine.h
Normal file
@ -0,0 +1,27 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef ISERVERENGINE_H
|
||||
#define ISERVERENGINE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayServerEngine : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void EndReplayRecordingSession() = 0;
|
||||
virtual bool IsReplayRecording() = 0;
|
||||
virtual bool IsReplay() = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // ISERVERENGINE_H
|
37
common/replay/iserverreplay.h
Normal file
37
common/replay/iserverreplay.h
Normal file
@ -0,0 +1,37 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef ISERVERREPLAY_H
|
||||
#define ISERVERREPLAY_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "interface.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define SERVER_REPLAY_INTERFACE_VERSION "ServerReplay001"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayFactory;
|
||||
class KeyValues;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Allows the replay DLL to talk to the server
|
||||
//
|
||||
class IServerReplay : public IBaseInterface
|
||||
{
|
||||
public:
|
||||
virtual void UploadOgsData( KeyValues *pData, bool bIncludeTimeField ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // ISERVERREPLAY_H
|
38
common/replay/iserverreplaycontext.h
Normal file
38
common/replay/iserverreplaycontext.h
Normal file
@ -0,0 +1,38 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef ISERVERREPLAYCONTEXT_H
|
||||
#define ISERVERREPLAYCONTEXT_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "replay/ireplaycontext.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IGameEvent;
|
||||
class IReplaySessionRecorder;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define REPLAYHISTORYMANAGER_INTERFACE_VERSION_SERVER "VENGINE_SERVER_REPLAY_HISTORY_MANAGER_001"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IServerReplayContext : public IReplayContext
|
||||
{
|
||||
public:
|
||||
virtual void FlagForConVarSanityCheck() = 0; // Checks replay_enable / replay_local_fileserver_path / replay_downloadurlport / replay_downloadurlpath
|
||||
virtual IGameEvent *CreateReplaySessionInfoEvent() = 0; // Create "replay_sessioninfo" event w/ appropriate fields filled in
|
||||
virtual IReplaySessionRecorder *GetSessionRecorder() = 0;
|
||||
virtual const char *GetLocalFileServerPath() const = 0; // Returns the local path where session blocks and such should be published for download
|
||||
virtual void CreateSessionOnClient( int nClientSlot ) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // ISERVERREPLAYCONTEXT_H
|
63
common/replay/performance.h
Normal file
63
common/replay/performance.h
Normal file
@ -0,0 +1,63 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef REPLAYPERFORMANCE_H
|
||||
#define REPLAYPERFORMANCE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "shared_defs.h"
|
||||
#include "qlimits.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplay;
|
||||
class KeyValues;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplayPerformance
|
||||
{
|
||||
public:
|
||||
CReplayPerformance( CReplay *pReplay );
|
||||
|
||||
inline bool HasInTick() const { return m_nTickIn >= 0; }
|
||||
inline bool HasOutTick() const { return m_nTickOut >= 0; }
|
||||
|
||||
inline int GetTickIn() const { return m_nTickIn; }
|
||||
inline int GetTickOut() const { return m_nTickOut; }
|
||||
|
||||
void Copy( const CReplayPerformance *pSrc );
|
||||
void CopyTicks( const CReplayPerformance *pSrc );
|
||||
|
||||
void SetFilename( const char *pFilename );
|
||||
const char *GetFullPerformanceFilename();
|
||||
|
||||
void AutoNameIfHasNoTitle( const char *pMapName );
|
||||
void SetTitle( const wchar_t *pTitle );
|
||||
|
||||
// NOTE: Doesn't copy exactly - gets a valid filename for the returned performance.
|
||||
CReplayPerformance *MakeCopy() const;
|
||||
|
||||
void Read( KeyValues *pIn );
|
||||
void Write( KeyValues *pOut );
|
||||
|
||||
// NOTE: Any changes made here should be reflected in the copy constructor
|
||||
// (which is called from MakeCopy()).
|
||||
wchar_t m_wszTitle[MAX_TAKE_TITLE_LENGTH];
|
||||
char m_szBaseFilename[ MAX_OSPATH ];
|
||||
CReplay *m_pReplay;
|
||||
int m_nTickIn;
|
||||
int m_nTickOut;
|
||||
|
||||
private:
|
||||
CReplayPerformance( const CReplayPerformance *pPerformance );
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // REPLAYPERFORMANCE_H
|
62
common/replay/rendermovieparams.h
Normal file
62
common/replay/rendermovieparams.h
Normal file
@ -0,0 +1,62 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef RENDERMOVIEPARAMS_H
|
||||
#define RENDERMOVIEPARAMS_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/strtools.h"
|
||||
#include "replay/replayhandle.h"
|
||||
#include "replay/shared_defs.h"
|
||||
#include "video/ivideoservices.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
typedef unsigned int MovieHandle_t;
|
||||
|
||||
struct RenderMovieParams_t
|
||||
{
|
||||
inline RenderMovieParams_t() : m_iPerformance( -1 ) { V_memset( this, 0, sizeof( RenderMovieParams_t ) ); m_Settings.m_FPS.SetFPS( 0, false ); }
|
||||
|
||||
ReplayHandle_t m_hReplay;
|
||||
int m_iPerformance; // -1 for default view, otherwise this is an index into the replay's m_vecPerformances vector.
|
||||
wchar_t m_wszTitle[MAX_REPLAY_TITLE_LENGTH];
|
||||
char m_szVideoPreset[64];
|
||||
char m_szExtension[16]; // File extension
|
||||
bool m_bQuitWhenFinished;
|
||||
bool m_bExportRaw; // Export movie as raw TGA frames and a .WAV
|
||||
float m_flEngineFps;
|
||||
|
||||
struct ReplayRenderSettings_t
|
||||
{
|
||||
uint16 m_nWidth;
|
||||
uint16 m_nHeight;
|
||||
int8 m_nMotionBlurQuality; // [0,MAX_MOTION_BLUR_QUALITY]
|
||||
VideoFrameRate_t m_FPS; // Actual framerate can be calculated with m_FPS.GetFps()
|
||||
VideoEncodeCodec_t m_Codec;
|
||||
bool m_bMotionBlurEnabled; // Motion blur enabled?
|
||||
bool m_bAAEnabled; // Antialiasing enabled?
|
||||
int8 m_nEncodingQuality; // [0,100]
|
||||
bool m_bRaw; // This movie was exported as raw TGA frames and a .WAV file?
|
||||
}
|
||||
m_Settings;
|
||||
};
|
||||
|
||||
typedef RenderMovieParams_t::ReplayRenderSettings_t ReplayRenderSettings_t;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define MAX_DOF_QUALITY 2
|
||||
#define MAX_MOTION_BLUR_QUALITY 3
|
||||
#define SUBPIXEL_JITTER_SAMPLES 16
|
||||
#define CHEAP_DOF_SAMPLES 4
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // RENDERMOVIEPARAMS_H
|
146
common/replay/replay.h
Normal file
146
common/replay/replay.h
Normal file
@ -0,0 +1,146 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef REPLAY_H
|
||||
#define REPLAY_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "replay/iqueryablereplayitem.h"
|
||||
#include "replay/replaytime.h"
|
||||
#include "replay/basereplayserializeable.h"
|
||||
#include "qlimits.h"
|
||||
#include "utlstring.h"
|
||||
#include "utlvector.h"
|
||||
#include "replay/shared_defs.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IReplayDownloadEventHandler;
|
||||
class CReplayScreenshot;
|
||||
class CReplayPerformance;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplay : public CBaseReplaySerializeable,
|
||||
public IQueryableReplayItem
|
||||
{
|
||||
typedef CBaseReplaySerializeable BaseClass;
|
||||
|
||||
public:
|
||||
enum ReplayStatus_t
|
||||
{
|
||||
REPLAYSTATUS_INVALID,
|
||||
REPLAYSTATUS_ERROR,
|
||||
REPLAYSTATUS_DOWNLOADPHASE, // Multiple sub-states during download state
|
||||
REPLAYSTATUS_READYTOCONVERT, // Download is complete, ready to convert
|
||||
REPLAYSTATUS_RENDERING, // Currently rendering the file
|
||||
REPLAYSTATUS_RENDERED,
|
||||
REPLAYSTATUS_MAX
|
||||
};
|
||||
|
||||
CReplay();
|
||||
virtual ~CReplay() {}
|
||||
|
||||
//
|
||||
// IReplaySerializeable
|
||||
//
|
||||
virtual const char *GetSubKeyTitle() const;
|
||||
virtual const char *GetPath() const;
|
||||
virtual void OnDelete();
|
||||
virtual bool Read( KeyValues *pIn );
|
||||
virtual void Write( KeyValues *pOut );
|
||||
|
||||
virtual void DumpGameSpecificData() const {}
|
||||
|
||||
virtual void Update() {}
|
||||
|
||||
// Hooks to allow replays to setup event listeners, etc.
|
||||
virtual void OnBeginRecording() {}
|
||||
virtual void OnEndRecording() {}
|
||||
|
||||
// Called when a replay is "completed"
|
||||
virtual void OnComplete();
|
||||
|
||||
// Should we allow this replay to be deleted?
|
||||
virtual bool ShouldAllowDelete() const { return true; }
|
||||
|
||||
void AutoNameTitleIfEmpty();
|
||||
|
||||
void AddScreenshot( int nWidth, int nHeight, const char *pBaseFilename );
|
||||
|
||||
bool HasReconstructedReplay() const;
|
||||
bool IsSignificantBlock( int iBlockReconstruction ) const; // Does this replay care about the given block?
|
||||
|
||||
CReplayPerformance *AddNewPerformance( bool bGenTitle = true, bool bGenFilename = true );
|
||||
void AddPerformance( KeyValues *pIn );
|
||||
void AddPerformance( CReplayPerformance *pPerformance );
|
||||
|
||||
// Accessors:
|
||||
inline int GetScreenshotCount() const { return m_vecScreenshots.Count(); }
|
||||
inline const CReplayScreenshot *GetScreenshot( int i ) const { return m_vecScreenshots[ i ]; }
|
||||
bool IsDownloaded() const;
|
||||
inline int GetPerformanceCount() const { return m_vecPerformances.Count(); }
|
||||
CReplayPerformance *GetPerformance( int i );
|
||||
const CReplayPerformance *GetPerformance( int i ) const;
|
||||
inline bool HasPerformance( CReplayPerformance *pPerformance ) { return m_vecPerformances.Find( pPerformance ) != m_vecPerformances.InvalidIndex(); }
|
||||
bool FindPerformance( CReplayPerformance *pPerformance, int &iResult );
|
||||
CReplayPerformance *GetPerformanceWithTitle( const wchar_t *pTitle );
|
||||
inline const char *GetMapName() const { return m_szMapName; }
|
||||
inline int GetSpawnTick() const { return m_nSpawnTick; }
|
||||
inline int GetDeathTick() const { return m_nDeathTick; }
|
||||
|
||||
// IQueryableReplayItem implementation:
|
||||
virtual const CReplayTime &GetItemDate() const;
|
||||
virtual bool IsItemRendered() const;
|
||||
virtual CReplay *GetItemReplay();
|
||||
virtual ReplayHandle_t GetItemReplayHandle() const;
|
||||
virtual QueryableReplayItemHandle_t GetItemHandle() const;
|
||||
virtual const wchar_t *GetItemTitle() const;
|
||||
virtual void SetItemTitle( const wchar_t *pTitle );
|
||||
virtual float GetItemLength() const;
|
||||
virtual void *GetUserData();
|
||||
virtual void SetUserData( void* pUserData );
|
||||
virtual bool IsItemAMovie() const;
|
||||
|
||||
// Non-persistent data
|
||||
mutable IReplayDownloadEventHandler *m_pDownloadEventHandler; // Implemented by replay browser - the reason we've got one per replay rather than
|
||||
// one per download group is because the browser needs to receive events per-thumbnail
|
||||
bool m_bSaved; // True as soon as the replay is saved to disk for the first time
|
||||
bool m_bRequestedByUser; // Did the user request to save this replay?
|
||||
bool m_bComplete; // Indicates whether the replay is done recording - this should be false
|
||||
// until the player dies, the round ends, or the level changes
|
||||
void *m_pUserData;
|
||||
float m_flNextUpdateTime;
|
||||
bool m_bDirty;
|
||||
|
||||
// Persistent data
|
||||
ReplayHandle_t m_hSession; // The recording session in which this replay was recorded
|
||||
char m_szMapName[MAX_OSPATH];
|
||||
ReplayStatus_t m_nStatus;
|
||||
const char* m_pFileURL; // In the form <protocol>://<server address>:<port number>/path/file - points to the string in the download group
|
||||
wchar_t m_wszTitle[MAX_REPLAY_TITLE_LENGTH];
|
||||
CUtlString m_strKilledBy; // Name of player who killed, if any
|
||||
int m_nDeathTime;
|
||||
int m_nSpawnTick;
|
||||
int m_nDeathTick;
|
||||
float m_flLength; // The length of the entire replay, including the post-death time, in seconds
|
||||
bool m_bRendered; // Has the replay been rendered yet?
|
||||
int m_nPlayerSlot; // Player slot (+1), used to determine which player recorded the demo during playback
|
||||
int m_nPostDeathRecordTime; // replay_postdeathrecordtime at the time of record
|
||||
CUtlVector< CReplayScreenshot * > m_vecScreenshots;
|
||||
CUtlVector< CReplayPerformance * > m_vecPerformances;
|
||||
int m_iMaxSessionBlockRequired; // The maximum session block required to reconstruct a viewable .dem file from spawn tick until length
|
||||
CReplayTime m_RecordTime; // Contains time/date when spawn tick was recorded
|
||||
float m_flStartTime; // Start time (uses engine's host_time)
|
||||
CUtlString m_strReconstructedFilename;
|
||||
bool m_bSavedDuringThisSession;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // REPLAY_H
|
25
common/replay/replayhandle.h
Normal file
25
common/replay/replayhandle.h
Normal file
@ -0,0 +1,25 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef REPLAYHANDLE_H
|
||||
#define REPLAYHANDLE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
typedef uint32 ReplayHandle_t;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define REPLAY_HANDLE_INVALID ( (ReplayHandle_t)-1 )
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // REPLAYHANDLE_H
|
21
common/replay/replaylib.h
Normal file
21
common/replay/replaylib.h
Normal file
@ -0,0 +1,21 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef REPLAYLIB_H
|
||||
#define REPLAYLIB_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class IClientReplayContext;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
bool ReplayLib_Init( const char *pGameDir, IClientReplayContext *pClientReplayContext );
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // REPLAYLIB_H
|
57
common/replay/replaytime.h
Normal file
57
common/replay/replaytime.h
Normal file
@ -0,0 +1,57 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef REPLAYTIME_H
|
||||
#define REPLAYTIME_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class KeyValues;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "vgui/ILocalize.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplayTime
|
||||
{
|
||||
public:
|
||||
CReplayTime();
|
||||
|
||||
void InitDateAndTimeToNow();
|
||||
|
||||
void Read( KeyValues *pIn );
|
||||
void Write( KeyValues *pOut );
|
||||
|
||||
// Modifiers:
|
||||
void SetDate( int nDay, int nMonth, int nYear );
|
||||
void SetTime( int nHour, int nMin, int nSec );
|
||||
inline void SetRawDate( int nRawDate ) { m_fDate = nRawDate; }
|
||||
inline void SetRawTime( int nRawTime ) { m_fTime = nRawTime; }
|
||||
|
||||
// Accessors:
|
||||
void GetTime( int &nHour, int &nMin, int &nSec ) const;
|
||||
void GetDate( int &nDay, int &nMonth, int &nYear ) const;
|
||||
|
||||
static const char *FormatTimeString( int nSecs );
|
||||
static const char *FormatPreciseTimeString( float flSecs );
|
||||
static const wchar_t *GetLocalizedMonth( vgui::ILocalize *pLocalize, int nMonth );
|
||||
static const wchar_t *GetLocalizedDay( vgui::ILocalize *pLocalize, int nDay );
|
||||
static const wchar_t *GetLocalizedYear( vgui::ILocalize *pLocalize, int nYear );
|
||||
static const wchar_t *GetLocalizedTime( vgui::ILocalize *pLocalize, int nHour, int nMin, int nSec );
|
||||
static const wchar_t *GetLocalizedDate( vgui::ILocalize *pLocalize, int nDay, int nMonth, int nYear,
|
||||
int *pHour = NULL, int *pMin = NULL, int *pSec = NULL, bool bForceFullFormat = false ); // bForceFullFormat true will keep from returning "today" or "yesterday"
|
||||
static const wchar_t *GetLocalizedDate( vgui::ILocalize *pLocalize, const CReplayTime &t, bool bForceFullFormat = false );
|
||||
|
||||
int m_fDate; // Representation of a date (bitfield)
|
||||
int m_fTime; // Representation of time (bitfield)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // REPLAYTIME_H
|
43
common/replay/replayutils.h
Normal file
43
common/replay/replayutils.h
Normal file
@ -0,0 +1,43 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef REPLAYUTILS_H
|
||||
#define REPLAYUTILS_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "utlstring.h"
|
||||
|
||||
void Replay_GetFirstAvailableFilename( char *pDst, int nDstLen, const char *pIdealFilename, const char *pExt,
|
||||
const char *pFilePath, int nStartIndex );
|
||||
|
||||
void Replay_ConstructReplayFilenameString( CUtlString &strOut, const char *pReplaySubDir, const char *pFilename, const char *pGameDir );
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Util function, copied from src/engine/common.cpp
|
||||
//----------------------------------------------------------------------------------------
|
||||
char *Replay_va( PRINTF_FORMAT_STRING const char *format, ... );
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Return the base dir, e.g. "c:\...\game\tf\replays\"
|
||||
//----------------------------------------------------------------------------------------
|
||||
const char *Replay_GetBaseDir();
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Set the game directory (only to be called from ReplayLib_Init())
|
||||
//----------------------------------------------------------------------------------------
|
||||
void Replay_SetGameDir( const char *pGameDir );
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Return the base dir, e.g. "c:\...\game\tf\replays\"
|
||||
//----------------------------------------------------------------------------------------
|
||||
const char *Replay_GetGameDir();
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Get a name of the format "<map>: <current date & time>" - used for replays and takes.
|
||||
//----------------------------------------------------------------------------------------
|
||||
void Replay_GetAutoName( OUT_Z_BYTECAP(nDestSizeInBytes) wchar_t *pDest, int nDestSizeInBytes, const char *pMapName );
|
||||
|
||||
#endif // REPLAY_H
|
72
common/replay/screenshot.h
Normal file
72
common/replay/screenshot.h
Normal file
@ -0,0 +1,72 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef SCREENSHOT_H
|
||||
#define SCREENSHOT_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "replay/basereplayserializeable.h"
|
||||
#include "mathlib/vector.h"
|
||||
#include "qlimits.h"
|
||||
#include "strtools.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define SUBDIR_SCREENSHOTS "screenshots"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class CReplayScreenshot : public CBaseReplaySerializeable
|
||||
{
|
||||
public:
|
||||
inline CReplayScreenshot( int nWidth = 0, int nHeight = 0, const char *pBaseFilename = NULL )
|
||||
: m_nWidth( nWidth ), m_nHeight( nHeight )
|
||||
{
|
||||
if ( pBaseFilename )
|
||||
{
|
||||
V_strncpy( m_szBaseFilename, pBaseFilename, sizeof( m_szBaseFilename ) );
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool Read( KeyValues *pIn );
|
||||
virtual void Write( KeyValues *pOut );
|
||||
virtual const char *GetSubKeyTitle() const;
|
||||
virtual const char *GetPath() const;
|
||||
|
||||
int m_nWidth; // Screenshot width (does not include power-of-2 padding)
|
||||
int m_nHeight; // Screenshot height (does not include power-of-2 padding)
|
||||
char m_szBaseFilename[ MAX_OSPATH ];
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
struct CaptureScreenshotParams_t // To be passed from the client into IReplayHistoryManager::CaptureScreenshot()
|
||||
{
|
||||
float m_flDelay; // Delay from now (in seconds) when we will take the screenshot
|
||||
int m_nEntity; // Should be 0 if no camera adjustment is needed, otherwise should be the index of the entity index from which m_posCamera will be based
|
||||
Vector m_posCamera; // Local position, relative to entity's index (if m_nEntity > 0) for camera position
|
||||
QAngle m_angCamera; // World angles of camera - used if m_bUseCameraAngles is true
|
||||
bool m_bUseCameraAngles; // Should we use m_angCamera - m_nEntity can't be 0
|
||||
bool m_bIgnoreMinTimeBetweenScreenshots; // Force screenshot, regardless of replay_mintimebetweenscreenshots?
|
||||
bool m_bPrimary; // Only set to true for the primary screenshot, which is taken when the user saves their replay
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
struct WriteReplayScreenshotParams_t // Passed from the engine into the client to take a screenshot
|
||||
{
|
||||
const char *m_pFilename;
|
||||
int m_nWidth;
|
||||
int m_nHeight;
|
||||
Vector *m_pOrigin; // Perspective origin from which to render. Can be NULL
|
||||
QAngle *m_pAngles; // Perspective angles from which to render. Can be NULL
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // SCREENSHOT_H
|
73
common/replay/shared_defs.h
Normal file
73
common/replay/shared_defs.h
Normal file
@ -0,0 +1,73 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
//=======================================================================================//
|
||||
|
||||
#ifndef SHARED_DEFS_H
|
||||
#define SHARED_DEFS_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define SUBDIR_REPLAY "replay"
|
||||
#define SUBDIR_REPLAYS "replays"
|
||||
#define SUBDIR_SESSIONS "sessions"
|
||||
#define SUBDIR_BLOCKS "blocks"
|
||||
#define SUBDIR_CLIENT "client"
|
||||
#define SUBDIR_MOVIES "movies"
|
||||
#define SUBDIR_PERFORMANCES "edits"
|
||||
#define SUBDIR_SERVER "server"
|
||||
#define SUBDIR_RENDERED "rendered"
|
||||
#define SUBDIR_TMP "tmp"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define BLOCK_FILE_EXTENSION "block"
|
||||
#define GENERIC_FILE_EXTENSION "dmx"
|
||||
#define DEMO_FILE_EXTENSION "dem"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define MOVIE_HANDLE_BASE 10000 // 10,000
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define BUILD_CURL ( defined( WIN32 ) && !defined( _X360 ) ) || defined( POSIX )
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define MIN_SERVER_DUMP_INTERVAL 10
|
||||
#define MAX_SERVER_DUMP_INTERVAL 30
|
||||
|
||||
#define DOWNLOAD_TIMEOUT_THRESHOLD 90 // Timeout for a replay download - if no blocks
|
||||
// are added or updated after this many seconds,
|
||||
// the replay will be put in the error state.
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define MAX_TIMES_TO_SHOW_REPLAY_WELCOME_DLG 1
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define MAX_SESSIONNAME_LENGTH 260
|
||||
#define MAX_REPLAY_TITLE_LENGTH 256
|
||||
#define MAX_TAKE_TITLE_LENGTH 256
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define DEFAULT_COMPRESSOR_TYPE COMPRESSORTYPE_BZ2
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#define JOB_FAILED ( (JobStatus_t) -1 )
|
||||
|
||||
#define DOWNLOAD_MAX_SIZE ( 8 * 1024 * 1024 ) // 8 MB
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#endif // SHARED_DEFS_H
|
3135
common/studiobyteswap.cpp
Normal file
3135
common/studiobyteswap.cpp
Normal file
File diff suppressed because it is too large
Load Diff
38
common/studiobyteswap.h
Normal file
38
common/studiobyteswap.h
Normal file
@ -0,0 +1,38 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: StudioMDL byteswapping functions.
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
#ifndef STUDIOBYTESWAP_H
|
||||
#define STUDIOBYTESWAP_H
|
||||
|
||||
#if defined(_WIN32)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "byteswap.h"
|
||||
struct studiohdr_t;
|
||||
class IPhysicsCollision;
|
||||
|
||||
namespace StudioByteSwap
|
||||
{
|
||||
typedef bool (*CompressFunc_t)( const void *pInput, int inputSize, void **pOutput, int *pOutputSize );
|
||||
|
||||
//void SetTargetBigEndian( bool bigEndian );
|
||||
void ActivateByteSwapping( bool bActivate );
|
||||
void SourceIsNative( bool bActivate );
|
||||
void SetVerbose( bool bVerbose );
|
||||
void SetCollisionInterface( IPhysicsCollision *pPhysicsCollision );
|
||||
|
||||
int ByteswapStudioFile( const char *pFilename, void *pOutBase, const void *pFileBase, int fileSize, studiohdr_t *pHdr, CompressFunc_t pCompressFunc = NULL );
|
||||
int ByteswapPHY( void *pOutBase, const void *pFileBase, int fileSize );
|
||||
int ByteswapANI( studiohdr_t* pHdr, void *pOutBase, const void *pFileBase, int filesize );
|
||||
int ByteswapVVD( void *pOutBase, const void *pFileBase, int fileSize );
|
||||
int ByteswapVTX( void *pOutBase, const void *pFileBase, int fileSize );
|
||||
int ByteswapMDL( void *pOutBase, const void *pFileBase, int fileSize );
|
||||
|
||||
#define BYTESWAP_ALIGNMENT_PADDING 4096
|
||||
}
|
||||
|
||||
#endif // STUDIOBYTESWAP_H
|
237
common/xbox/xboxstubs.h
Normal file
237
common/xbox/xboxstubs.h
Normal file
@ -0,0 +1,237 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Win32 replacements for XBox.
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#if !defined( XBOXSTUBS_H ) && !defined( _X360 )
|
||||
#define XBOXSTUBS_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "tier0/platform.h"
|
||||
|
||||
// Content creation/open flags
|
||||
#define XCONTENTFLAG_NONE 0x00
|
||||
#define XCONTENTFLAG_CREATENEW 0x00
|
||||
#define XCONTENTFLAG_CREATEALWAYS 0x00
|
||||
#define XCONTENTFLAG_OPENEXISTING 0x00
|
||||
#define XCONTENTFLAG_OPENALWAYS 0x00
|
||||
#define XCONTENTFLAG_TRUNCATEEXISTING 0x00
|
||||
|
||||
// Content attributes
|
||||
#define XCONTENTFLAG_NOPROFILE_TRANSFER 0x00
|
||||
#define XCONTENTFLAG_NODEVICE_TRANSFER 0x00
|
||||
#define XCONTENTFLAG_STRONG_SIGNED 0x00
|
||||
#define XCONTENTFLAG_ALLOWPROFILE_TRANSFER 0x00
|
||||
#define XCONTENTFLAG_MOVEONLY_TRANSFER 0x00
|
||||
|
||||
// Console device ports
|
||||
#define XDEVICE_PORT0 0
|
||||
#define XDEVICE_PORT1 1
|
||||
#define XDEVICE_PORT2 2
|
||||
#define XDEVICE_PORT3 3
|
||||
#define XUSER_MAX_COUNT 4
|
||||
#define XUSER_INDEX_NONE 0x000000FE
|
||||
|
||||
#define XBX_CLR_DEFAULT 0xFF000000
|
||||
#define XBX_CLR_WARNING 0x0000FFFF
|
||||
#define XBX_CLR_ERROR 0x000000FF
|
||||
|
||||
#define XBOX_MINBORDERSAFE 0
|
||||
#define XBOX_MAXBORDERSAFE 0
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XK_NULL,
|
||||
XK_BUTTON_UP,
|
||||
XK_BUTTON_DOWN,
|
||||
XK_BUTTON_LEFT,
|
||||
XK_BUTTON_RIGHT,
|
||||
XK_BUTTON_START,
|
||||
XK_BUTTON_BACK,
|
||||
XK_BUTTON_STICK1,
|
||||
XK_BUTTON_STICK2,
|
||||
XK_BUTTON_A,
|
||||
XK_BUTTON_B,
|
||||
XK_BUTTON_X,
|
||||
XK_BUTTON_Y,
|
||||
XK_BUTTON_LEFT_SHOULDER,
|
||||
XK_BUTTON_RIGHT_SHOULDER,
|
||||
XK_BUTTON_LTRIGGER,
|
||||
XK_BUTTON_RTRIGGER,
|
||||
XK_STICK1_UP,
|
||||
XK_STICK1_DOWN,
|
||||
XK_STICK1_LEFT,
|
||||
XK_STICK1_RIGHT,
|
||||
XK_STICK2_UP,
|
||||
XK_STICK2_DOWN,
|
||||
XK_STICK2_LEFT,
|
||||
XK_STICK2_RIGHT,
|
||||
XK_MAX_KEYS,
|
||||
} xKey_t;
|
||||
|
||||
//typedef enum
|
||||
//{
|
||||
// XVRB_NONE, // off
|
||||
// XVRB_ERROR, // fatal error
|
||||
// XVRB_ALWAYS, // no matter what
|
||||
// XVRB_WARNING, // non-fatal warnings
|
||||
// XVRB_STATUS, // status reports
|
||||
// XVRB_ALL,
|
||||
//} xverbose_e;
|
||||
|
||||
typedef unsigned short WORD;
|
||||
#ifndef POSIX
|
||||
typedef unsigned long DWORD;
|
||||
typedef void* HANDLE;
|
||||
typedef unsigned __int64 ULONGLONG;
|
||||
#endif
|
||||
|
||||
#ifdef POSIX
|
||||
typedef DWORD COLORREF;
|
||||
#endif
|
||||
|
||||
#ifndef INVALID_HANDLE_VALUE
|
||||
#define INVALID_HANDLE_VALUE ((HANDLE)-1)
|
||||
#endif
|
||||
|
||||
// typedef struct {
|
||||
// IN_ADDR ina; // IP address (zero if not static/DHCP)
|
||||
// IN_ADDR inaOnline; // Online IP address (zero if not online)
|
||||
// WORD wPortOnline; // Online port
|
||||
// BYTE abEnet[6]; // Ethernet MAC address
|
||||
// BYTE abOnline[20]; // Online identification
|
||||
// } XNADDR;
|
||||
|
||||
typedef int XNADDR;
|
||||
typedef uint64 XUID;
|
||||
|
||||
typedef struct {
|
||||
BYTE ab[8]; // xbox to xbox key identifier
|
||||
} XNKID;
|
||||
|
||||
typedef struct {
|
||||
BYTE ab[16]; // xbox to xbox key exchange key
|
||||
} XNKEY;
|
||||
|
||||
typedef struct _XSESSION_INFO
|
||||
{
|
||||
XNKID sessionID; // 8 bytes
|
||||
XNADDR hostAddress; // 36 bytes
|
||||
XNKEY keyExchangeKey; // 16 bytes
|
||||
} XSESSION_INFO, *PXSESSION_INFO;
|
||||
|
||||
typedef struct _XUSER_DATA
|
||||
{
|
||||
BYTE type;
|
||||
|
||||
union
|
||||
{
|
||||
int nData; // XUSER_DATA_TYPE_INT32
|
||||
int64 i64Data; // XUSER_DATA_TYPE_INT64
|
||||
double dblData; // XUSER_DATA_TYPE_DOUBLE
|
||||
struct // XUSER_DATA_TYPE_UNICODE
|
||||
{
|
||||
uint cbData; // Includes null-terminator
|
||||
char * pwszData;
|
||||
} string;
|
||||
float fData; // XUSER_DATA_TYPE_FLOAT
|
||||
struct // XUSER_DATA_TYPE_BINARY
|
||||
{
|
||||
uint cbData;
|
||||
char * pbData;
|
||||
} binary;
|
||||
};
|
||||
} XUSER_DATA, *PXUSER_DATA;
|
||||
|
||||
typedef struct _XUSER_PROPERTY
|
||||
{
|
||||
DWORD dwPropertyId;
|
||||
XUSER_DATA value;
|
||||
} XUSER_PROPERTY, *PXUSER_PROPERTY;
|
||||
|
||||
typedef struct _XUSER_CONTEXT
|
||||
{
|
||||
DWORD dwContextId;
|
||||
DWORD dwValue;
|
||||
} XUSER_CONTEXT, *PXUSER_CONTEXT;
|
||||
|
||||
typedef struct _XSESSION_SEARCHRESULT
|
||||
{
|
||||
XSESSION_INFO info;
|
||||
DWORD dwOpenPublicSlots;
|
||||
DWORD dwOpenPrivateSlots;
|
||||
DWORD dwFilledPublicSlots;
|
||||
DWORD dwFilledPrivateSlots;
|
||||
DWORD cProperties;
|
||||
DWORD cContexts;
|
||||
PXUSER_PROPERTY pProperties;
|
||||
PXUSER_CONTEXT pContexts;
|
||||
} XSESSION_SEARCHRESULT, *PXSESSION_SEARCHRESULT;
|
||||
|
||||
typedef struct _XSESSION_SEARCHRESULT_HEADER
|
||||
{
|
||||
DWORD dwSearchResults;
|
||||
XSESSION_SEARCHRESULT *pResults;
|
||||
} XSESSION_SEARCHRESULT_HEADER, *PXSESSION_SEARCHRESULT_HEADER;
|
||||
|
||||
typedef struct _XSESSION_REGISTRANT
|
||||
{
|
||||
uint64 qwMachineID;
|
||||
DWORD bTrustworthiness;
|
||||
DWORD bNumUsers;
|
||||
XUID *rgUsers;
|
||||
|
||||
} XSESSION_REGISTRANT;
|
||||
|
||||
typedef struct _XSESSION_REGISTRATION_RESULTS
|
||||
{
|
||||
DWORD wNumRegistrants;
|
||||
XSESSION_REGISTRANT *rgRegistrants;
|
||||
} XSESSION_REGISTRATION_RESULTS, *PXSESSION_REGISTRATION_RESULTS;
|
||||
|
||||
typedef struct {
|
||||
BYTE bFlags;
|
||||
BYTE bReserved;
|
||||
WORD cProbesXmit;
|
||||
WORD cProbesRecv;
|
||||
WORD cbData;
|
||||
BYTE * pbData;
|
||||
WORD wRttMinInMsecs;
|
||||
WORD wRttMedInMsecs;
|
||||
DWORD dwUpBitsPerSec;
|
||||
DWORD dwDnBitsPerSec;
|
||||
} XNQOSINFO;
|
||||
|
||||
typedef struct {
|
||||
uint cxnqos;
|
||||
uint cxnqosPending;
|
||||
XNQOSINFO axnqosinfo[1];
|
||||
} XNQOS;
|
||||
|
||||
#define XSESSION_CREATE_HOST 0
|
||||
#define XUSER_DATA_TYPE_INT32 0
|
||||
#define XSESSION_CREATE_USES_ARBITRATION 0
|
||||
#define XNET_QOS_LISTEN_ENABLE 0
|
||||
#define XNET_QOS_LISTEN_DISABLE 0
|
||||
#define XNET_QOS_LISTEN_SET_DATA 0
|
||||
|
||||
FORCEINLINE void XBX_ProcessEvents() {}
|
||||
FORCEINLINE unsigned int XBX_GetSystemTime() { return 0; }
|
||||
FORCEINLINE int XBX_GetPrimaryUserId() { return 0; }
|
||||
FORCEINLINE void XBX_SetPrimaryUserId( DWORD idx ) {}
|
||||
FORCEINLINE int XBX_GetStorageDeviceId() { return 0; }
|
||||
FORCEINLINE void XBX_SetStorageDeviceId( DWORD idx ) {}
|
||||
FORCEINLINE const char *XBX_GetLanguageString() { return ""; }
|
||||
FORCEINLINE bool XBX_IsLocalized() { return false; }
|
||||
|
||||
#define XCONTENT_MAX_DISPLAYNAME_LENGTH 128
|
||||
#define XCONTENT_MAX_FILENAME_LENGTH 42
|
||||
|
||||
#define XBX_INVALID_STORAGE_ID ((DWORD) -1)
|
||||
#define XBX_STORAGE_DECLINED ((DWORD) -2)
|
||||
|
||||
#endif // XBOXSTUBS_H
|
949
devtools/bin/fxc_prep.pl
Normal file
949
devtools/bin/fxc_prep.pl
Normal file
@ -0,0 +1,949 @@
|
||||
BEGIN {use File::Basename; push @INC, dirname($0); }
|
||||
require "valve_perl_helpers.pl";
|
||||
|
||||
sub ReadInputFile
|
||||
{
|
||||
local( $filename ) = shift;
|
||||
local( *INPUT );
|
||||
local( @output );
|
||||
open INPUT, "<$filename" || die;
|
||||
|
||||
local( $line );
|
||||
local( $linenum ) = 1;
|
||||
while( $line = <INPUT> )
|
||||
{
|
||||
# print "LINE: $line";
|
||||
# $line =~ s/\n//g;
|
||||
# local( $postfix ) = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
|
||||
# $postfix .= "; LINEINFO($filename)($linenum)\n";
|
||||
if( $line =~ m/\#include\s+\"(.*)\"/i )
|
||||
{
|
||||
push @output, &ReadInputFile( $1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
# push @output, $line . $postfix;
|
||||
push @output, $line;
|
||||
}
|
||||
$linenum++;
|
||||
}
|
||||
|
||||
close INPUT;
|
||||
# print "-----------------\n";
|
||||
# print @output;
|
||||
# print "-----------------\n";
|
||||
return @output;
|
||||
}
|
||||
|
||||
$dynamic_compile = defined $ENV{"dynamic_shaders"} && $ENV{"dynamic_shaders"} != 0;
|
||||
$generateListingFile = 0;
|
||||
$spewCombos = 0;
|
||||
|
||||
@startTimes = times;
|
||||
$startTime = time;
|
||||
|
||||
$g_produceCppClasses = 1;
|
||||
$g_produceCompiledVcs = 1;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
$fxc_filename = shift;
|
||||
if( $fxc_filename =~ m/-source/ )
|
||||
{
|
||||
shift;
|
||||
}
|
||||
elsif( $fxc_filename =~ m/-nv3x/i )
|
||||
{
|
||||
$nvidia = 1;
|
||||
}
|
||||
elsif( $fxc_filename =~ m/-ps20a/i )
|
||||
{
|
||||
$ps2a = 1;
|
||||
}
|
||||
elsif( $fxc_filename =~ m/-x360/i )
|
||||
{
|
||||
# enable x360
|
||||
$g_x360 = 1;
|
||||
}
|
||||
elsif( $fxc_filename =~ m/-novcs/i )
|
||||
{
|
||||
$g_produceCompiledVcs = 0;
|
||||
}
|
||||
elsif( $fxc_filename =~ m/-nocpp/i )
|
||||
{
|
||||
$g_produceCppClasses = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$argstring = $fxc_filename;
|
||||
$fxc_basename = $fxc_filename;
|
||||
$fxc_basename =~ s/^.*-----//;
|
||||
$fxc_filename =~ s/-----.*$//;
|
||||
|
||||
$debug = 0;
|
||||
$forcehalf = 0;
|
||||
|
||||
sub ToUpper
|
||||
{
|
||||
local( $in ) = shift;
|
||||
$in =~ tr/a-z/A-Z/;
|
||||
return $in;
|
||||
}
|
||||
|
||||
sub CreateCCodeToSpewDynamicCombo
|
||||
{
|
||||
local( $out ) = "";
|
||||
|
||||
$out .= "\t\tOutputDebugString( \"src:$fxc_filename vcs:$fxc_basename dynamic index\" );\n";
|
||||
$out .= "\t\tchar tmp[128];\n";
|
||||
$out .= "\t\tint shaderID = ";
|
||||
local( $scale ) = 1;
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
local( $name ) = @dynamicDefineNames[$i];
|
||||
local( $varname ) = "m_n" . $name;
|
||||
$out .= "( $scale * $varname ) + ";
|
||||
$scale *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
|
||||
}
|
||||
$out .= "0;\n";
|
||||
if( scalar( @dynamicDefineNames ) + scalar( @staticDefineNames ) > 0 )
|
||||
{
|
||||
$out .= "\t\tint nCombo = shaderID;\n";
|
||||
}
|
||||
|
||||
my $type = GetShaderType( $fxc_filename );
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
$out .= "\t\tint n$dynamicDefineNames[$i] = nCombo % ";
|
||||
$out .= ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) + $dynamicDefineMin[$i];
|
||||
$out .= ";\n";
|
||||
|
||||
$out .= "\t\tsprintf( tmp, \"\%d\", n$dynamicDefineNames[$i] );\n";
|
||||
$out .= "\t\tOutputDebugString( \" $dynamicDefineNames[$i]";
|
||||
$out .= "=\" );\n";
|
||||
$out .= "\t\tOutputDebugString( tmp );\n";
|
||||
|
||||
$out .= "\t\tnCombo = nCombo / " . ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) . ";\n";
|
||||
$out .= "\n";
|
||||
}
|
||||
$out .= "\t\tOutputDebugString( \"\\n\" );\n";
|
||||
return $out;
|
||||
}
|
||||
|
||||
sub CreateCCodeToSpewStaticCombo
|
||||
{
|
||||
local( $out ) = "";
|
||||
|
||||
$out .= "\t\tOutputDebugString( \"src:$fxc_filename vcs:$fxc_basename static index\" );\n";
|
||||
$out .= "\t\tchar tmp[128];\n";
|
||||
$out .= "\t\tint shaderID = ";
|
||||
|
||||
local( $scale ) = 1;
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
$scale *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
|
||||
}
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
|
||||
{
|
||||
local( $name ) = @staticDefineNames[$i];
|
||||
local( $varname ) = "m_n" . $name;
|
||||
$out .= "( $scale * $varname ) + ";
|
||||
$scale *= $staticDefineMax[$i] - $staticDefineMin[$i] + 1;
|
||||
}
|
||||
$out .= "0;\n";
|
||||
|
||||
# $out .= "\t\tsprintf( tmp, \"\%d\\n\", shaderID );\n";
|
||||
# $out .= "\t\tOutputDebugString( tmp );\n\n";
|
||||
if( scalar( @staticDefineNames ) + scalar( @staticDefineNames ) > 0 )
|
||||
{
|
||||
$out .= "\t\tint nCombo = shaderID;\n";
|
||||
}
|
||||
|
||||
my $type = GetShaderType( $fxc_filename );
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
$out .= "\t\tnCombo = nCombo / " . ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) . ";\n";
|
||||
}
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
|
||||
{
|
||||
$out .= "\t\tint n$staticDefineNames[$i] = nCombo % ";
|
||||
$out .= ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) + $staticDefineMin[$i];
|
||||
$out .= ";\n";
|
||||
|
||||
$out .= "\t\tsprintf( tmp, \"\%d\", n$staticDefineNames[$i] );\n";
|
||||
$out .= "\t\tOutputDebugString( \" $staticDefineNames[$i]";
|
||||
$out .= "=\" );\n";
|
||||
$out .= "\t\tOutputDebugString( tmp );\n";
|
||||
|
||||
$out .= "\t\tnCombo = nCombo / " . ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) . ";\n";
|
||||
$out .= "\n";
|
||||
}
|
||||
$out .= "\t\tOutputDebugString( \"\\n\" );\n";
|
||||
return $out;
|
||||
}
|
||||
|
||||
sub WriteHelperVar
|
||||
{
|
||||
local( $name ) = shift;
|
||||
local( $min ) = shift;
|
||||
local( $max ) = shift;
|
||||
local( $varname ) = "m_n" . $name;
|
||||
local( $boolname ) = "m_b" . $name;
|
||||
push @outputHeader, "private:\n";
|
||||
push @outputHeader, "\tint $varname;\n";
|
||||
push @outputHeader, "#ifdef _DEBUG\n";
|
||||
push @outputHeader, "\tbool $boolname;\n";
|
||||
push @outputHeader, "#endif\n";
|
||||
push @outputHeader, "public:\n";
|
||||
# int version of set function
|
||||
push @outputHeader, "\tvoid Set" . $name . "( int i )\n";
|
||||
push @outputHeader, "\t{\n";
|
||||
push @outputHeader, "\t\tAssert( i >= $min && i <= $max );\n";
|
||||
push @outputHeader, "\t\t$varname = i;\n";
|
||||
push @outputHeader, "#ifdef _DEBUG\n";
|
||||
push @outputHeader, "\t\t$boolname = true;\n";
|
||||
push @outputHeader, "#endif\n";
|
||||
push @outputHeader, "\t}\n";
|
||||
# bool version of set function
|
||||
push @outputHeader, "\tvoid Set" . $name . "( bool i )\n";
|
||||
push @outputHeader, "\t{\n";
|
||||
# push @outputHeader, "\t\tAssert( i >= $min && i <= $max );\n";
|
||||
push @outputHeader, "\t\t$varname = i ? 1 : 0;\n";
|
||||
push @outputHeader, "#ifdef _DEBUG\n";
|
||||
push @outputHeader, "\t\t$boolname = true;\n";
|
||||
push @outputHeader, "#endif\n";
|
||||
push @outputHeader, "\t}\n";
|
||||
}
|
||||
|
||||
sub WriteStaticBoolExpression
|
||||
{
|
||||
local( $prefix ) = shift;
|
||||
local( $operator ) = shift;
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
|
||||
{
|
||||
if( $i )
|
||||
{
|
||||
push @outputHeader, " $operator ";
|
||||
}
|
||||
local( $name ) = @staticDefineNames[$i];
|
||||
local( $boolname ) = "m_b" . $name;
|
||||
push @outputHeader, "$prefix$boolname";
|
||||
}
|
||||
push @outputHeader, ";\n";
|
||||
}
|
||||
|
||||
sub WriteDynamicBoolExpression
|
||||
{
|
||||
local( $prefix ) = shift;
|
||||
local( $operator ) = shift;
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
if( $i )
|
||||
{
|
||||
push @outputHeader, " $operator ";
|
||||
}
|
||||
local( $name ) = @dynamicDefineNames[$i];
|
||||
local( $boolname ) = "m_b" . $name;
|
||||
push @outputHeader, "$prefix$boolname";
|
||||
}
|
||||
push @outputHeader, ";\n";
|
||||
}
|
||||
|
||||
sub WriteDynamicHelperClasses
|
||||
{
|
||||
local( $basename ) = $fxc_basename;
|
||||
$basename =~ tr/A-Z/a-z/;
|
||||
local( $classname ) = $basename . "_Dynamic_Index";
|
||||
push @outputHeader, "class $classname\n";
|
||||
push @outputHeader, "{\n";
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
$name = $dynamicDefineNames[$i];
|
||||
$min = $dynamicDefineMin[$i];
|
||||
$max = $dynamicDefineMax[$i];
|
||||
&WriteHelperVar( $name, $min, $max );
|
||||
}
|
||||
push @outputHeader, "public:\n";
|
||||
# push @outputHeader, "void SetPixelShaderIndex( IShaderAPI *pShaderAPI ) { pShaderAPI->SetPixelShaderIndex( GetIndex() ); }\n";
|
||||
push @outputHeader, "\t$classname()\n";
|
||||
push @outputHeader, "\t{\n";
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
local( $name ) = @dynamicDefineNames[$i];
|
||||
local( $boolname ) = "m_b" . $name;
|
||||
local( $varname ) = "m_n" . $name;
|
||||
push @outputHeader, "#ifdef _DEBUG\n";
|
||||
push @outputHeader, "\t\t$boolname = false;\n";
|
||||
push @outputHeader, "#endif // _DEBUG\n";
|
||||
push @outputHeader, "\t\t$varname = 0;\n";
|
||||
}
|
||||
push @outputHeader, "\t}\n";
|
||||
push @outputHeader, "\tint GetIndex()\n";
|
||||
push @outputHeader, "\t{\n";
|
||||
push @outputHeader, "\t\t// Asserts to make sure that we aren't using any skipped combinations.\n";
|
||||
foreach $skip (@perlskipcodeindividual)
|
||||
{
|
||||
# can't do this static and dynamic can see each other.
|
||||
# $skip =~ s/\$/m_n/g;
|
||||
# $skip =~ s/defined//g;
|
||||
# push @outputHeader, "\t\tAssert( !( $skip ) );\n";
|
||||
# print "\t\tAssert( !( $skip ) );\n";
|
||||
}
|
||||
push @outputHeader, "\t\t// Asserts to make sure that we are setting all of the combination vars.\n";
|
||||
|
||||
push @outputHeader, "#ifdef _DEBUG\n";
|
||||
if( scalar( @dynamicDefineNames ) > 0 )
|
||||
{
|
||||
push @outputHeader, "\t\tbool bAllDynamicVarsDefined = ";
|
||||
WriteDynamicBoolExpression( "", "&&" );
|
||||
}
|
||||
if( scalar( @dynamicDefineNames ) > 0 )
|
||||
{
|
||||
push @outputHeader, "\t\tAssert( bAllDynamicVarsDefined );\n";
|
||||
}
|
||||
push @outputHeader, "#endif // _DEBUG\n";
|
||||
|
||||
if( $spewCombos && scalar( @dynamicDefineNames ) )
|
||||
{
|
||||
push @outputHeader, &CreateCCodeToSpewDynamicCombo();
|
||||
}
|
||||
push @outputHeader, "\t\treturn ";
|
||||
local( $scale ) = 1;
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
local( $name ) = @dynamicDefineNames[$i];
|
||||
local( $varname ) = "m_n" . $name;
|
||||
push @outputHeader, "( $scale * $varname ) + ";
|
||||
$scale *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
|
||||
}
|
||||
push @outputHeader, "0;\n";
|
||||
push @outputHeader, "\t}\n";
|
||||
push @outputHeader, "};\n";
|
||||
push @outputHeader, "\#define shaderDynamicTest_" . $basename . " ";
|
||||
my $prefix;
|
||||
my $shaderType = &GetShaderType( $fxc_filename );
|
||||
if( $shaderType =~ m/^vs/i )
|
||||
{
|
||||
$prefix = "vsh_";
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefix = "psh_";
|
||||
}
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
local( $name ) = @dynamicDefineNames[$i];
|
||||
push @outputHeader, $prefix . "forgot_to_set_dynamic_" . $name . " + ";
|
||||
}
|
||||
push @outputHeader, "0\n";
|
||||
}
|
||||
|
||||
sub WriteStaticHelperClasses
|
||||
{
|
||||
local( $basename ) = $fxc_basename;
|
||||
$basename =~ tr/A-Z/a-z/;
|
||||
local( $classname ) = $basename . "_Static_Index";
|
||||
push @outputHeader, "#include \"shaderlib/cshader.h\"\n";
|
||||
push @outputHeader, "class $classname\n";
|
||||
push @outputHeader, "{\n";
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
|
||||
{
|
||||
$name = $staticDefineNames[$i];
|
||||
$min = $staticDefineMin[$i];
|
||||
$max = $staticDefineMax[$i];
|
||||
&WriteHelperVar( $name, $min, $max );
|
||||
}
|
||||
push @outputHeader, "public:\n";
|
||||
# push @outputHeader, "void SetShaderIndex( IShaderShadow *pShaderShadow ) { pShaderShadow->SetPixelShaderIndex( GetIndex() ); }\n";
|
||||
push @outputHeader, "\t$classname( )\n";
|
||||
push @outputHeader, "\t{\n";
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
|
||||
{
|
||||
local( $name ) = @staticDefineNames[$i];
|
||||
local( $boolname ) = "m_b" . $name;
|
||||
local( $varname ) = "m_n" . $name;
|
||||
if ( length( $staticDefineInit{$name} ) )
|
||||
{
|
||||
push @outputHeader, "#ifdef _DEBUG\n";
|
||||
push @outputHeader, "\t\t$boolname = true;\n";
|
||||
push @outputHeader, "#endif // _DEBUG\n";
|
||||
push @outputHeader, "\t\t$varname = $staticDefineInit{$name};\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
push @outputHeader, "#ifdef _DEBUG\n";
|
||||
push @outputHeader, "\t\t$boolname = false;\n";
|
||||
push @outputHeader, "#endif // _DEBUG\n";
|
||||
push @outputHeader, "\t\t$varname = 0;\n";
|
||||
}
|
||||
}
|
||||
push @outputHeader, "\t}\n";
|
||||
push @outputHeader, "\tint GetIndex()\n";
|
||||
push @outputHeader, "\t{\n";
|
||||
push @outputHeader, "\t\t// Asserts to make sure that we aren't using any skipped combinations.\n";
|
||||
foreach $skip (@perlskipcodeindividual)
|
||||
{
|
||||
$skip =~ s/\$/m_n/g;
|
||||
# push @outputHeader, "\t\tAssert( !( $skip ) );\n";
|
||||
}
|
||||
push @outputHeader, "\t\t// Asserts to make sure that we are setting all of the combination vars.\n";
|
||||
|
||||
push @outputHeader, "#ifdef _DEBUG\n";
|
||||
if( scalar( @staticDefineNames ) > 0 )
|
||||
{
|
||||
push @outputHeader, "\t\tbool bAllStaticVarsDefined = ";
|
||||
WriteStaticBoolExpression( "", "&&" );
|
||||
|
||||
}
|
||||
if( scalar( @staticDefineNames ) > 0 )
|
||||
{
|
||||
push @outputHeader, "\t\tAssert( bAllStaticVarsDefined );\n";
|
||||
}
|
||||
push @outputHeader, "#endif // _DEBUG\n";
|
||||
|
||||
if( $spewCombos && scalar( @staticDefineNames ) )
|
||||
{
|
||||
push @outputHeader, &CreateCCodeToSpewStaticCombo();
|
||||
}
|
||||
push @outputHeader, "\t\treturn ";
|
||||
local( $scale ) = 1;
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
$scale *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
|
||||
}
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
|
||||
{
|
||||
local( $name ) = @staticDefineNames[$i];
|
||||
local( $varname ) = "m_n" . $name;
|
||||
push @outputHeader, "( $scale * $varname ) + ";
|
||||
$scale *= $staticDefineMax[$i] - $staticDefineMin[$i] + 1;
|
||||
}
|
||||
push @outputHeader, "0;\n";
|
||||
push @outputHeader, "\t}\n";
|
||||
push @outputHeader, "};\n";
|
||||
push @outputHeader, "\#define shaderStaticTest_" . $basename . " ";
|
||||
my $prefix;
|
||||
my $shaderType = &GetShaderType( $fxc_filename );
|
||||
if( $shaderType =~ m/^vs/i )
|
||||
{
|
||||
$prefix = "vsh_";
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefix = "psh_";
|
||||
}
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
|
||||
{
|
||||
local( $name ) = @staticDefineNames[$i];
|
||||
push @outputHeader, $prefix . "forgot_to_set_static_" . $name . " + " unless (length($staticDefineInit{$name} ));
|
||||
}
|
||||
push @outputHeader, "0\n";
|
||||
}
|
||||
|
||||
sub GetNewMainName
|
||||
{
|
||||
local( $shadername ) = shift;
|
||||
local( $combo ) = shift;
|
||||
local( $i );
|
||||
$shadername =~ s/\./_/g;
|
||||
local( $name ) = $shadername;
|
||||
for( $i = 0; $i < scalar( @defineNames ); $i++ )
|
||||
{
|
||||
local( $val ) = ( $combo % ( $defineMax[$i] - $defineMin[$i] + 1 ) ) + $defineMin[$i];
|
||||
$name .= "_" . $defineNames[$i] . "_" . $val;
|
||||
$combo = $combo / ( $defineMax[$i] - $defineMin[$i] + 1 );
|
||||
}
|
||||
# return $name;
|
||||
return "main";
|
||||
}
|
||||
|
||||
sub RenameMain
|
||||
{
|
||||
local( $shadername ) = shift;
|
||||
local( $combo ) = shift;
|
||||
local( $name ) = &GetNewMainName( $shadername, $combo );
|
||||
return "/Dmain=$name /E$name ";
|
||||
}
|
||||
|
||||
sub GetShaderType
|
||||
{
|
||||
local( $shadername ) = shift; # hack - use global variables
|
||||
$shadername = $fxc_basename;
|
||||
if( $shadername =~ m/ps30/i )
|
||||
{
|
||||
if( $debug )
|
||||
{
|
||||
return "ps_3_sw";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "ps_3_0";
|
||||
}
|
||||
}
|
||||
elsif( $shadername =~ m/ps20b/i )
|
||||
{
|
||||
return "ps_2_b";
|
||||
}
|
||||
elsif( $shadername =~ m/ps20/i )
|
||||
{
|
||||
if( $debug )
|
||||
{
|
||||
return "ps_2_sw";
|
||||
}
|
||||
else
|
||||
{
|
||||
if( $ps2a )
|
||||
{
|
||||
return "ps_2_a";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "ps_2_0";
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif( $shadername =~ m/ps14/i )
|
||||
{
|
||||
return "ps_1_4";
|
||||
}
|
||||
elsif( $shadername =~ m/ps11/i )
|
||||
{
|
||||
return "ps_1_1";
|
||||
}
|
||||
elsif( $shadername =~ m/vs30/i )
|
||||
{
|
||||
if( $debug )
|
||||
{
|
||||
return "vs_3_sw";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "vs_3_0";
|
||||
}
|
||||
}
|
||||
elsif( $shadername =~ m/vs20/i )
|
||||
{
|
||||
if( $debug )
|
||||
{
|
||||
return "vs_2_sw";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "vs_2_0";
|
||||
}
|
||||
}
|
||||
elsif( $shadername =~ m/vs14/i )
|
||||
{
|
||||
return "vs_1_1";
|
||||
}
|
||||
elsif( $shadername =~ m/vs11/i )
|
||||
{
|
||||
return "vs_1_1";
|
||||
}
|
||||
else
|
||||
{
|
||||
die "\n\nSHADERNAME = $shadername\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub CalcNumCombos
|
||||
{
|
||||
local( $i, $numCombos );
|
||||
$numCombos = 1;
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
$numCombos *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
|
||||
}
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
|
||||
{
|
||||
$numCombos *= $staticDefineMax[$i] - $staticDefineMin[$i] + 1;
|
||||
}
|
||||
return $numCombos;
|
||||
}
|
||||
|
||||
sub CalcNumDynamicCombos
|
||||
{
|
||||
local( $i, $numCombos );
|
||||
$numCombos = 1;
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
$numCombos *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
|
||||
}
|
||||
return $numCombos;
|
||||
}
|
||||
|
||||
sub CreateCFuncToCreateCompileCommandLine
|
||||
{
|
||||
local( $out ) = "";
|
||||
|
||||
$out .= "\t\tOutputDebugString( \"compiling src:$fxc_filename vcs:$fxc_basename \" );\n";
|
||||
$out .= "\t\tchar tmp[128];\n";
|
||||
$out .= "\t\tsprintf( tmp, \"\%d\\n\", shaderID );\n";
|
||||
$out .= "\t\tOutputDebugString( tmp );\n";
|
||||
$out .= "\t\tstatic PrecompiledShaderByteCode_t byteCode;\n";
|
||||
if( scalar( @dynamicDefineNames ) + scalar( @staticDefineNames ) > 0 )
|
||||
{
|
||||
$out .= "\t\tint nCombo = shaderID;\n";
|
||||
}
|
||||
|
||||
# $out .= "\tvoid BuildCompileCommandLine( int nCombo, char *pResult, int maxLength )\n";
|
||||
# $out .= "\t{\n";
|
||||
$out .= "\t\tD3DXMACRO ";
|
||||
$out .= "defineMacros";
|
||||
$out .= "[";
|
||||
$out .= scalar( @dynamicDefineNames ) + scalar( @staticDefineNames ) + 1; # add 1 for null termination
|
||||
$out .= "];\n";
|
||||
if( scalar( @dynamicDefineNames ) + scalar( @staticDefineNames ) > 0 )
|
||||
{
|
||||
$out .= "\t\tchar tmpStringBuf[1024];\n";
|
||||
$out .= "\t\tchar *pTmpString = tmpStringBuf;\n\n";
|
||||
}
|
||||
|
||||
local( $i );
|
||||
my $type = GetShaderType( $fxc_filename );
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
$out .= "\t\tsprintf( pTmpString, \"%d\", nCombo % ";
|
||||
$out .= ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) + $dynamicDefineMin[$i];
|
||||
$out .= " );\n";
|
||||
$out .= "\t\tdefineMacros";
|
||||
$out .= "[";
|
||||
$out .= $i;
|
||||
$out .= "]";
|
||||
$out .= "\.Name = ";
|
||||
$out .= "\"$dynamicDefineNames[$i]\";\n";
|
||||
|
||||
$out .= "\t\tint n$dynamicDefineNames[$i] = nCombo % ";
|
||||
$out .= ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) + $dynamicDefineMin[$i];
|
||||
$out .= ";\n";
|
||||
$out .= "\t\tUNUSED( n$dynamicDefineNames[$i] );\n";
|
||||
|
||||
$out .= "\t\tdefineMacros";
|
||||
$out .= "[";
|
||||
$out .= $i;
|
||||
$out .= "]";
|
||||
$out .= "\.Definition = ";
|
||||
$out .= "pTmpString;\n";
|
||||
$out .= "\t\tpTmpString += strlen( pTmpString ) + 1;\n";
|
||||
|
||||
$out .= "\t\tsprintf( tmp, \"\%d\", n$dynamicDefineNames[$i] );\n";
|
||||
$out .= "\t\tOutputDebugString( \" $dynamicDefineNames[$i]";
|
||||
$out .= "=\" );\n";
|
||||
$out .= "\t\tOutputDebugString( tmp );\n";
|
||||
|
||||
$out .= "\t\tnCombo = nCombo / " . ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) . ";\n";
|
||||
$out .= "\n";
|
||||
}
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
|
||||
{
|
||||
$out .= "\t\tsprintf( pTmpString, \"%d\", nCombo % ";
|
||||
$out .= ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) + $staticDefineMin[$i];
|
||||
$out .= " );\n";
|
||||
$out .= "\t\tdefineMacros";
|
||||
$out .= "[";
|
||||
$out .= $i + scalar( @dynamicDefineNames );
|
||||
$out .= "]";
|
||||
$out .= "\.Name = ";
|
||||
$out .= "\"$staticDefineNames[$i]\";\n";
|
||||
|
||||
$out .= "\t\tint n$staticDefineNames[$i] = nCombo % ";
|
||||
$out .= ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) + $staticDefineMin[$i];
|
||||
$out .= ";\n";
|
||||
$out .= "\t\tUNUSED( n$staticDefineNames[$i] );\n";
|
||||
|
||||
$out .= "\t\tdefineMacros";
|
||||
$out .= "[";
|
||||
$out .= $i + scalar( @dynamicDefineNames );
|
||||
$out .= "]";
|
||||
$out .= "\.Definition = ";
|
||||
$out .= "pTmpString;\n";
|
||||
$out .= "\t\tpTmpString += strlen( pTmpString ) + 1;\n";
|
||||
|
||||
$out .= "\t\tsprintf( tmp, \"\%d\", n$staticDefineNames[$i] );\n";
|
||||
$out .= "\t\tOutputDebugString( \" $staticDefineNames[$i]";
|
||||
$out .= "=\" );\n";
|
||||
$out .= "\t\tOutputDebugString( tmp );\n";
|
||||
|
||||
$out .= "\t\tnCombo = nCombo / " . ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) . ";\n";
|
||||
$out .= "\n";
|
||||
}
|
||||
|
||||
$out .= "\t\tOutputDebugString( \"\\n\" );\n";
|
||||
|
||||
$cskipcode = $perlskipcode;
|
||||
$cskipcode =~ s/\$/n/g;
|
||||
$out .= "\t\tif( $cskipcode )\n\t\t{\n";
|
||||
$out .= "\t\t\tstatic char blah[4] = { 0, 0, 0, 0 };\n";
|
||||
$out .= "\t\t\tbyteCode.m_pRawData = blah;\n";
|
||||
$out .= "\t\t\tbyteCode.m_nSizeInBytes = 4;\n";
|
||||
$out .= "\t\t\treturn byteCode;\n";
|
||||
$out .= "\t\t}\n";
|
||||
|
||||
|
||||
|
||||
$out .= "\t\t// Must null terminate macros.\n";
|
||||
$out .= "\t\tdefineMacros[";
|
||||
$out .= scalar( @dynamicDefineNames ) + scalar( @staticDefineNames );
|
||||
$out .= "]";
|
||||
$out .= ".Name = NULL;\n";
|
||||
$out .= "\t\tdefineMacros[";
|
||||
$out .= scalar( @dynamicDefineNames ) + scalar( @staticDefineNames );
|
||||
$out .= "]";
|
||||
$out .= ".Definition = NULL;\n\n";
|
||||
|
||||
|
||||
$out .= "\t\tLPD3DXBUFFER pShader; // NOTE: THESE LEAK!!!\n";
|
||||
$out .= "\t\tLPD3DXBUFFER pErrorMessages; // NOTE: THESE LEAK!!!\n";
|
||||
$out .= "\t\tHRESULT hr = D3DXCompileShaderFromFile( \"u:\\\\hl2_e3_2004\\\\src_e3_2004\\\\materialsystem\\\\stdshaders\\\\$fxc_filename\",\n\t\t\tdefineMacros,\n\t\t\tNULL, // LPD3DXINCLUDE \n\t\t\t\"main\",\n\t\t\t\"$type\",\n\t\t\t0, // DWORD Flags\n\t\t\t&pShader,\n\t\t\t&pErrorMessages,\n\t\t\tNULL // LPD3DXCONSTANTTABLE *ppConstantTable\n\t\t\t );\n";
|
||||
$out .= "\t\tif( hr != D3D_OK )\n";
|
||||
$out .= "\t\t{\n";
|
||||
$out .= "\t\t\tconst char *pErrorMessageString = ( const char * )pErrorMessages->GetBufferPointer();\n";
|
||||
$out .= "\t\t\tOutputDebugString( pErrorMessageString );\n";
|
||||
$out .= "\t\t\tOutputDebugString( \"\\n\" );\n";
|
||||
$out .= "\t\t\tAssert( 0 );\n";
|
||||
$out .= "\t\t\tstatic char blah[4] = { 0, 0, 0, 0 };\n";
|
||||
$out .= "\t\t\tbyteCode.m_pRawData = blah;\n";
|
||||
$out .= "\t\t\tbyteCode.m_nSizeInBytes = 4;\n";
|
||||
$out .= "\t\t}\n";
|
||||
$out .= "\t\telse\n";
|
||||
$out .= "\t\t{\n";
|
||||
$out .= "\t\t\tbyteCode.m_pRawData = pShader->GetBufferPointer();\n";
|
||||
$out .= "\t\t\tbyteCode.m_nSizeInBytes = pShader->GetBufferSize();\n";
|
||||
$out .= "\t\t}\n";
|
||||
$out .= "\t\treturn byteCode;\n";
|
||||
return $out;
|
||||
}
|
||||
|
||||
#print "--------\n";
|
||||
|
||||
if ( $g_x360 )
|
||||
{
|
||||
$fxctmp = "fxctmp9_360_tmp";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fxctmp = "fxctmp9_tmp";
|
||||
}
|
||||
|
||||
if( !stat $fxctmp )
|
||||
{
|
||||
mkdir $fxctmp, 0777 || die $!;
|
||||
}
|
||||
|
||||
# suck in an input file (using includes)
|
||||
#print "$fxc_filename...";
|
||||
@fxc = ReadInputFile( $fxc_filename );
|
||||
|
||||
# READ THE TOP OF THE FILE TO FIND SHADER COMBOS
|
||||
foreach $line ( @fxc )
|
||||
{
|
||||
$line="" if ($g_x360 && ($line=~/\[PC\]/)); # line marked as [PC] when building for x360
|
||||
$line="" if (($g_x360 == 0) && ($line=~/\[XBOX\]/)); # line marked as [XBOX] when building for pc
|
||||
|
||||
if ( $fxc_basename =~ m/_ps(\d+\w?)$/i )
|
||||
{
|
||||
my $psver = $1;
|
||||
$line="" if (($line =~/\[ps\d+\w?\]/i) && ($line!~/\[ps$psver\]/i)); # line marked for a version of compiler and not what we build
|
||||
}
|
||||
if ( $fxc_basename =~ m/_vs(\d+\w?)$/i )
|
||||
{
|
||||
my $vsver = $1;
|
||||
$line="" if (($line =~/\[vs\d+\w?\]/i) && ($line!~/\[vs$vsver\]/i)); # line marked for a version of compiler and not what we build
|
||||
}
|
||||
|
||||
my $init_expr;
|
||||
|
||||
$init_expr = $1 if ( $line=~/\[\=([^\]]+)\]/); # parse default init expression for combos
|
||||
|
||||
$line=~s/\[[^\[\]]*\]//; # cut out all occurrences of
|
||||
# square brackets and whatever is
|
||||
# inside all these modifications
|
||||
# to the line are seen later when
|
||||
# processing skips and centroids
|
||||
|
||||
next if( $line =~ m/^\s*$/ );
|
||||
|
||||
if( $line =~ m/^\s*\/\/\s*STATIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
|
||||
{
|
||||
local( $name, $min, $max );
|
||||
$name = $1;
|
||||
$min = $2;
|
||||
$max = $3;
|
||||
# print STDERR "STATIC: \"$name\" \"$min..$max\"\n";
|
||||
push @staticDefineNames, $name;
|
||||
push @staticDefineMin, $min;
|
||||
push @staticDefineMax, $max;
|
||||
$staticDefineInit{$name}=$init_expr;
|
||||
}
|
||||
elsif( $line =~ m/^\s*\/\/\s*DYNAMIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
|
||||
{
|
||||
local( $name, $min, $max );
|
||||
$name = $1;
|
||||
$min = $2;
|
||||
$max = $3;
|
||||
# print STDERR "DYNAMIC: \"$name\" \"$min..$max\"\n";
|
||||
push @dynamicDefineNames, $name;
|
||||
push @dynamicDefineMin, $min;
|
||||
push @dynamicDefineMax, $max;
|
||||
}
|
||||
}
|
||||
# READ THE WHOLE FILE AND FIND SKIP STATEMENTS
|
||||
foreach $line ( @fxc )
|
||||
{
|
||||
if( $line =~ m/^\s*\/\/\s*SKIP\s*\s*\:\s*(.*)$/ )
|
||||
{
|
||||
# print $1 . "\n";
|
||||
$perlskipcode .= "(" . $1 . ")||";
|
||||
push @perlskipcodeindividual, $1;
|
||||
}
|
||||
}
|
||||
|
||||
if( defined $perlskipcode )
|
||||
{
|
||||
$perlskipcode .= "0";
|
||||
$perlskipcode =~ s/\n//g;
|
||||
}
|
||||
else
|
||||
{
|
||||
$perlskipcode = "0";
|
||||
}
|
||||
|
||||
# READ THE WHOLE FILE AND FIND CENTROID STATEMENTS
|
||||
foreach $line ( @fxc )
|
||||
{
|
||||
if( $line =~ m/^\s*\/\/\s*CENTROID\s*\:\s*TEXCOORD(\d+)\s*$/ )
|
||||
{
|
||||
$centroidEnable{$1} = 1;
|
||||
# print "CENTROID: $1\n";
|
||||
}
|
||||
}
|
||||
|
||||
if( $spewCombos )
|
||||
{
|
||||
push @outputHeader, "#include \"windows.h\"\n";
|
||||
}
|
||||
|
||||
#push @outputHeader, "\#include \"shaderlib\\baseshader.h\"\n";
|
||||
#push @outputHeader, "IShaderDynamicAPI *CBaseShader::s_pShaderAPI;\n";
|
||||
|
||||
# Go ahead an compute the mask of samplers that need to be centroid sampled
|
||||
$centroidMask = 0;
|
||||
foreach $centroidRegNum ( keys( %centroidEnable ) )
|
||||
{
|
||||
# print "THING: $samplerName $centroidRegNum\n";
|
||||
$centroidMask += 1 << $centroidRegNum;
|
||||
}
|
||||
|
||||
#printf "0x%x\n", $centroidMask;
|
||||
|
||||
$numCombos = &CalcNumCombos();
|
||||
#print "$numCombos combos\n";
|
||||
|
||||
|
||||
if( $g_produceCompiledVcs && !$dynamic_compile )
|
||||
{
|
||||
open FOUT, ">>filelistgen.txt" || die "can't open filelistgen.txt";
|
||||
|
||||
print FOUT "**** generated by fxc_prep.pl ****\n";
|
||||
print FOUT "#BEGIN " . $fxc_basename . "\n";
|
||||
print FOUT "$fxc_filename" . "\n";
|
||||
print FOUT "#DEFINES-D:\n";
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); \$i++ )
|
||||
{
|
||||
print FOUT "$dynamicDefineNames[$i]=";
|
||||
print FOUT $dynamicDefineMin[$i];
|
||||
print FOUT "..";
|
||||
print FOUT $dynamicDefineMax[$i];
|
||||
print FOUT "\n";
|
||||
}
|
||||
print FOUT "#DEFINES-S:\n";
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); \$i++ )
|
||||
{
|
||||
print FOUT "$staticDefineNames[$i]=";
|
||||
print FOUT $staticDefineMin[$i];
|
||||
print FOUT "..";
|
||||
print FOUT $staticDefineMax[$i];
|
||||
print FOUT "\n";
|
||||
}
|
||||
print FOUT "#SKIP:\n";
|
||||
print FOUT "$perlskipcode\n";
|
||||
print FOUT "#COMMAND:\n";
|
||||
# first line
|
||||
print FOUT "fxc.exe ";
|
||||
print FOUT "/DTOTALSHADERCOMBOS=$numCombos ";
|
||||
print FOUT "/DCENTROIDMASK=$centroidMask ";
|
||||
print FOUT "/DNUMDYNAMICCOMBOS=" . &CalcNumDynamicCombos() . " ";
|
||||
print FOUT "/DFLAGS=0x0 "; # Nothing here for now.
|
||||
print FOUT "\n";
|
||||
#defines go here
|
||||
# second line
|
||||
print FOUT &RenameMain( $fxc_filename, $i );
|
||||
print FOUT "/T" . &GetShaderType( $fxc_filename ) . " ";
|
||||
print FOUT "/DSHADER_MODEL_" . &ToUpper( &GetShaderType( $fxc_filename ) ) . "=1 ";
|
||||
if( $nvidia )
|
||||
{
|
||||
print FOUT "/DNV3X=1 "; # enable NV3X codepath
|
||||
}
|
||||
if ( $g_x360 )
|
||||
{
|
||||
print FOUT "/D_X360=1 "; # shaders can identify X360 centric code
|
||||
# print FOUT "/Xbe:2- "; # use the less-broken old back end
|
||||
}
|
||||
if( $debug )
|
||||
{
|
||||
print FOUT "/Od "; # disable optimizations
|
||||
print FOUT "/Zi "; # enable debug info
|
||||
}
|
||||
# print FOUT "/Zi "; # enable debug info
|
||||
print FOUT "/nologo ";
|
||||
# print FOUT "/Fhtmpshader.h ";
|
||||
print FOUT "/Foshader.o ";
|
||||
print FOUT "$fxc_filename";
|
||||
print FOUT ">output.txt 2>&1";
|
||||
print FOUT "\n";
|
||||
#end of command line
|
||||
print FOUT "#END\n";
|
||||
print FOUT "**** end ****\n";
|
||||
|
||||
close FOUT;
|
||||
}
|
||||
|
||||
if ( $g_produceCppClasses )
|
||||
{
|
||||
# Write out the C++ helper class for picking shader combos
|
||||
&WriteStaticHelperClasses();
|
||||
&WriteDynamicHelperClasses();
|
||||
my $incfilename = "$fxctmp\\$fxc_basename" . ".inc";
|
||||
&WriteFile( $incfilename, join( "", @outputHeader ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( $generateListingFile )
|
||||
{
|
||||
my $listFileName = "$fxctmp/$fxc_basename" . ".lst";
|
||||
print "writing $listFileName\n";
|
||||
if( !open FILE, ">$listFileName" )
|
||||
{
|
||||
die;
|
||||
}
|
||||
print FILE @listingOutput;
|
||||
close FILE;
|
||||
}
|
||||
|
||||
|
||||
@endTimes = times;
|
||||
|
||||
$endTime = time;
|
||||
|
||||
#printf "Elapsed user time: %.2f seconds!\n", $endTimes[0] - $startTimes[0];
|
||||
#printf "Elapsed system time: %.2f seconds!\n", $endTimes[1] - $startTimes[1];
|
||||
#printf "Elapsed child user time: %.2f seconds!\n", $endTimes[2] - $startTimes[2];
|
||||
#printf "Elapsed child system time: %.2f seconds!\n", $endTimes[3] - $startTimes[3];
|
||||
|
||||
#printf "Elapsed total time: %.2f seconds!\n", $endTime - $startTime;
|
||||
|
BIN
devtools/bin/linux/ccache
Normal file
BIN
devtools/bin/linux/ccache
Normal file
Binary file not shown.
BIN
devtools/bin/osx32/ccache
Normal file
BIN
devtools/bin/osx32/ccache
Normal file
Binary file not shown.
BIN
devtools/bin/osx32/protoc
Normal file
BIN
devtools/bin/osx32/protoc
Normal file
Binary file not shown.
333
devtools/bin/psh_prep.pl
Normal file
333
devtools/bin/psh_prep.pl
Normal file
@ -0,0 +1,333 @@
|
||||
use String::CRC32;
|
||||
BEGIN {use File::Basename; push @INC, dirname($0); }
|
||||
require "valve_perl_helpers.pl";
|
||||
|
||||
sub BuildDefineOptions
|
||||
{
|
||||
local( $output );
|
||||
local( $combo ) = shift;
|
||||
local( $i );
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
local( $val ) = ( $combo % ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 ) ) + $dynamicDefineMin[$i];
|
||||
$output .= "/D$dynamicDefineNames[$i]=$val ";
|
||||
$combo = $combo / ( $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1 );
|
||||
}
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
|
||||
{
|
||||
local( $val ) = ( $combo % ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 ) ) + $staticDefineMin[$i];
|
||||
$output .= "/D$staticDefineNames[$i]=$val ";
|
||||
$combo = $combo / ( $staticDefineMax[$i] - $staticDefineMin[$i] + 1 );
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
sub CalcNumCombos
|
||||
{
|
||||
local( $i, $numCombos );
|
||||
$numCombos = 1;
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
$numCombos *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
|
||||
}
|
||||
for( $i = 0; $i < scalar( @staticDefineNames ); $i++ )
|
||||
{
|
||||
$numCombos *= $staticDefineMax[$i] - $staticDefineMin[$i] + 1;
|
||||
}
|
||||
return $numCombos;
|
||||
}
|
||||
|
||||
sub CalcNumDynamicCombos
|
||||
{
|
||||
local( $i, $numCombos );
|
||||
$numCombos = 1;
|
||||
for( $i = 0; $i < scalar( @dynamicDefineNames ); $i++ )
|
||||
{
|
||||
$numCombos *= $dynamicDefineMax[$i] - $dynamicDefineMin[$i] + 1;
|
||||
}
|
||||
return $numCombos;
|
||||
}
|
||||
|
||||
$g_dx9 = 1;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
$psh_filename = shift;
|
||||
|
||||
if( $psh_filename =~ m/-source/ )
|
||||
{
|
||||
$g_SourceDir = shift;
|
||||
}
|
||||
elsif( $psh_filename =~ m/-x360/ )
|
||||
{
|
||||
$g_x360 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
$psh_filename =~ s/-----.*$//;
|
||||
|
||||
|
||||
# Get the shader binary version number from a header file.
|
||||
open FILE, "<$g_SourceDir\\public\\materialsystem\\shader_vcs_version.h" || die;
|
||||
while( $line = <FILE> )
|
||||
{
|
||||
if( $line =~ m/^\#define\s+SHADER_VCS_VERSION_NUMBER\s+(\d+)\s*$/ )
|
||||
{
|
||||
$shaderVersion = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
if( !defined $shaderVersion )
|
||||
{
|
||||
die "couldn't get shader version from shader_vcs_version.h";
|
||||
}
|
||||
close FILE;
|
||||
|
||||
|
||||
|
||||
local( @staticDefineNames );
|
||||
local( @staticDefineMin );
|
||||
local( @staticDefineMax );
|
||||
local( @dynamicDefineNames );
|
||||
local( @dynamicDefineMin );
|
||||
local( @dynamicDefineMax );
|
||||
|
||||
# Parse the combos.
|
||||
open PSH, "<$psh_filename";
|
||||
while( <PSH> )
|
||||
{
|
||||
last if( !m,^;, );
|
||||
s,^;\s*,,;
|
||||
if( m/\s*STATIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
|
||||
{
|
||||
local( $name, $min, $max );
|
||||
$name = $1;
|
||||
$min = $2;
|
||||
$max = $3;
|
||||
# print "\"STATIC: $name\" \"$min..$max\"\n";
|
||||
if (/\[(.*)\]/)
|
||||
{
|
||||
$platforms=$1;
|
||||
next if ( ($g_x360) && (!($platforms=~/XBOX/i)) );
|
||||
next if ( (!$g_x360) && (!($platforms=~/PC/i)) );
|
||||
}
|
||||
push @staticDefineNames, $name;
|
||||
push @staticDefineMin, $min;
|
||||
push @staticDefineMax, $max;
|
||||
}
|
||||
elsif( m/\s*DYNAMIC\s*\:\s*\"(.*)\"\s+\"(\d+)\.\.(\d+)\"/ )
|
||||
{
|
||||
local( $name, $min, $max );
|
||||
$name = $1;
|
||||
$min = $2;
|
||||
$max = $3;
|
||||
# print "\"DYNAMIC: $name\" \"$min..$max\"\n";
|
||||
if (/\[(.*)\]/)
|
||||
{
|
||||
$platforms=$1;
|
||||
next if ( ($g_x360) && (!($platforms=~/XBOX/i)) );
|
||||
next if ( (!$g_x360) && (!($platforms=~/PC/i)) );
|
||||
}
|
||||
push @dynamicDefineNames, $name;
|
||||
push @dynamicDefineMin, $min;
|
||||
push @dynamicDefineMax, $max;
|
||||
}
|
||||
}
|
||||
close PSH;
|
||||
|
||||
$numCombos = &CalcNumCombos();
|
||||
$numDynamicCombos = &CalcNumDynamicCombos();
|
||||
print "$psh_filename\n";
|
||||
#print "$numCombos combos\n";
|
||||
#print "$numDynamicCombos dynamic combos\n";
|
||||
|
||||
if( $g_x360 )
|
||||
{
|
||||
$pshtmp = "pshtmp9_360";
|
||||
}
|
||||
elsif( $g_dx9 )
|
||||
{
|
||||
$pshtmp = "pshtmp9";
|
||||
}
|
||||
else
|
||||
{
|
||||
$pshtmp = "pshtmp8";
|
||||
}
|
||||
$basename = $psh_filename;
|
||||
$basename =~ s/\.psh$//i;
|
||||
|
||||
for( $shaderCombo = 0; $shaderCombo < $numCombos; $shaderCombo++ )
|
||||
{
|
||||
my $tempFilename = "shader$shaderCombo.o";
|
||||
unlink $tempFilename;
|
||||
|
||||
if( $g_x360 )
|
||||
{
|
||||
$cmd = "$g_SourceDir\\x360xdk\\bin\\win32\\psa /D_X360=1 /Foshader$shaderCombo.o /nologo " . &BuildDefineOptions( $shaderCombo ) . "$psh_filename > NIL";
|
||||
}
|
||||
else
|
||||
{
|
||||
$cmd = "$g_SourceDir\\dx9sdk\\utilities\\psa /Foshader$shaderCombo.o /nologo " . &BuildDefineOptions( $shaderCombo ) . "$psh_filename > NIL";
|
||||
}
|
||||
|
||||
if( !stat $pshtmp )
|
||||
{
|
||||
mkdir $pshtmp, 0777 || die $!;
|
||||
}
|
||||
|
||||
# print $cmd . "\n";
|
||||
system $cmd || die $!;
|
||||
|
||||
# Make sure a file got generated because sometimes the die above won't happen on compile errors.
|
||||
my $filesize = (stat $tempFilename)[7];
|
||||
if ( !$filesize )
|
||||
{
|
||||
die "Error compiling shader$shaderCombo.o";
|
||||
}
|
||||
|
||||
push @outputHeader, @hdr;
|
||||
}
|
||||
|
||||
$basename =~ s/\.fxc//gi;
|
||||
push @outputHeader, "static PrecompiledShaderByteCode_t " . $basename . "_pixel_shaders[" . $numCombos . "] = \n";
|
||||
push @outputHeader, "{\n";
|
||||
local( $j );
|
||||
for( $j = 0; $j < $numCombos; $j++ )
|
||||
{
|
||||
local( $thing ) = "pixelShader_" . $basename . "_" . $j;
|
||||
push @outputHeader, "\t{ " . "$thing, sizeof( $thing ) },\n";
|
||||
}
|
||||
push @outputHeader, "};\n";
|
||||
|
||||
push @outputHeader, "struct $basename" . "PixelShader_t : public PrecompiledShader_t\n";
|
||||
push @outputHeader, "{\n";
|
||||
push @outputHeader, "\t$basename" . "PixelShader_t()\n";
|
||||
push @outputHeader, "\t{\n";
|
||||
push @outputHeader, "\t\tm_nFlags = 0;\n";
|
||||
push @outputHeader, "\t\tm_pByteCode = " . $basename . "_pixel_shaders;\n";
|
||||
push @outputHeader, "\t\tm_nShaderCount = $numCombos;\n";
|
||||
#push @outputHeader, "\t\tm_nDynamicCombos = m_nShaderCount;\n";
|
||||
push @outputHeader, "\t\t// NOTE!!! psh_prep.pl shaders are always static combos!\n";
|
||||
push @outputHeader, "\t\tm_nDynamicCombos = 1;\n";
|
||||
push @outputHeader, "\t\tm_pName = \"$basename\";\n";
|
||||
if( $basename =~ /vs\d\d/ ) # hack
|
||||
{
|
||||
push @outputHeader, "\t\tGetShaderDLL()->InsertPrecompiledShader( PRECOMPILED_VERTEX_SHADER, this );\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
push @outputHeader, "\t\tGetShaderDLL()->InsertPrecompiledShader( PRECOMPILED_PIXEL_SHADER, this );\n";
|
||||
}
|
||||
push @outputHeader, "\t}\n";
|
||||
push @outputHeader, "\tvirtual const PrecompiledShaderByteCode_t &GetByteCode( int shaderID )\n";
|
||||
push @outputHeader, "\t{\n";
|
||||
push @outputHeader, "\t\treturn m_pByteCode[shaderID];\n";
|
||||
push @outputHeader, "\t}\n";
|
||||
push @outputHeader, "};\n";
|
||||
|
||||
push @outputHeader, "static $basename" . "PixelShader_t $basename" . "_PixelShaderInstance;\n";
|
||||
|
||||
|
||||
&MakeDirHier( "shaders/psh" );
|
||||
|
||||
my $vcsName = "";
|
||||
if( $g_x360 )
|
||||
{
|
||||
$vcsName = $basename . ".360.vcs";
|
||||
}
|
||||
else
|
||||
{
|
||||
$vcsName = $basename . ".vcs";
|
||||
}
|
||||
|
||||
open COMPILEDSHADER, ">shaders/psh/$vcsName" || die;
|
||||
binmode( COMPILEDSHADER );
|
||||
|
||||
#
|
||||
# Write out the part of the header that we know. . we'll write the rest after writing the object code.
|
||||
#
|
||||
|
||||
#print $numCombos . "\n";
|
||||
|
||||
# Pack arguments
|
||||
my $sInt = "i";
|
||||
my $uInt = "I";
|
||||
if ( $g_x360 )
|
||||
{
|
||||
# Change arguments to "big endian long"
|
||||
$sInt = "N";
|
||||
$uInt = "N";
|
||||
}
|
||||
|
||||
open PSH, "<$psh_filename";
|
||||
my $crc = crc32( *PSH );
|
||||
close PSH;
|
||||
#print STDERR "crc for $psh_filename: $crc\n";
|
||||
|
||||
# version
|
||||
print COMPILEDSHADER pack $sInt, 4;
|
||||
# totalCombos
|
||||
print COMPILEDSHADER pack $sInt, $numCombos;
|
||||
# dynamic combos
|
||||
print COMPILEDSHADER pack $sInt, $numDynamicCombos;
|
||||
# flags
|
||||
print COMPILEDSHADER pack $uInt, 0x0; # nothing here for now.
|
||||
# centroid mask
|
||||
print COMPILEDSHADER pack $uInt, 0;
|
||||
# reference size for diffs
|
||||
print COMPILEDSHADER pack $uInt, 0;
|
||||
# crc32 of the source code
|
||||
print COMPILEDSHADER pack $uInt, $crc;
|
||||
|
||||
my $beginningOfDir = tell COMPILEDSHADER;
|
||||
|
||||
# Write out a blank directionary. . we'll fill it in later.
|
||||
for( $i = 0; $i < $numCombos; $i++ )
|
||||
{
|
||||
# offset from beginning of file.
|
||||
print COMPILEDSHADER pack $sInt, 0;
|
||||
# size
|
||||
print COMPILEDSHADER pack $sInt, 0;
|
||||
}
|
||||
|
||||
my $startByteCode = tell COMPILEDSHADER;
|
||||
my @byteCodeStart;
|
||||
my @byteCodeSize;
|
||||
|
||||
# Write out the shader object code.
|
||||
for( $shaderCombo = 0; $shaderCombo < $numCombos; $shaderCombo++ )
|
||||
{
|
||||
my $filename = "shader$shaderCombo\.o";
|
||||
my $filesize = (stat $filename)[7];
|
||||
|
||||
$byteCodeStart[$shaderCombo] = tell COMPILEDSHADER;
|
||||
$byteCodeSize[$shaderCombo] = $filesize;
|
||||
open SHADERBYTECODE, "<$filename";
|
||||
binmode SHADERBYTECODE;
|
||||
|
||||
my $bin;
|
||||
my $numread = read SHADERBYTECODE, $bin, $filesize;
|
||||
# print "filename: $filename numread: $numread filesize: $filesize\n";
|
||||
close SHADERBYTECODE;
|
||||
unlink $filename;
|
||||
|
||||
print COMPILEDSHADER $bin;
|
||||
}
|
||||
|
||||
# Seek back to the directory and write it out.
|
||||
seek COMPILEDSHADER, $beginningOfDir, 0;
|
||||
for( $i = 0; $i < $numCombos; $i++ )
|
||||
{
|
||||
# offset from beginning of file.
|
||||
print COMPILEDSHADER pack $sInt, $byteCodeStart[$i];
|
||||
# size
|
||||
print COMPILEDSHADER pack $sInt, $byteCodeSize[$i];
|
||||
}
|
||||
|
||||
close COMPILEDSHADER;
|
||||
|
||||
|
305
devtools/bin/updateshaders.pl
Normal file
305
devtools/bin/updateshaders.pl
Normal file
@ -0,0 +1,305 @@
|
||||
use String::CRC32;
|
||||
BEGIN {use File::Basename; push @INC, dirname($0); }
|
||||
require "valve_perl_helpers.pl";
|
||||
|
||||
$dynamic_compile = defined $ENV{"dynamic_shaders"} && $ENV{"dynamic_shaders"} != 0;
|
||||
|
||||
$depnum = 0;
|
||||
$baseSourceDir = ".";
|
||||
|
||||
my %dep;
|
||||
|
||||
sub GetAsmShaderDependencies_R
|
||||
{
|
||||
local( $shadername ) = shift;
|
||||
local( *SHADER );
|
||||
|
||||
open SHADER, "<$shadername";
|
||||
while( <SHADER> )
|
||||
{
|
||||
if( m/^\s*\#\s*include\s+\"(.*)\"/ )
|
||||
{
|
||||
# make sure it isn't in there already.
|
||||
if( !defined( $dep{$1} ) )
|
||||
{
|
||||
$dep{$1} = 1;
|
||||
GetAsmShaderDependencies_R( $1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
close SHADER;
|
||||
}
|
||||
|
||||
sub GetAsmShaderDependencies
|
||||
{
|
||||
local( $shadername ) = shift;
|
||||
undef %dep;
|
||||
GetAsmShaderDependencies_R( $shadername );
|
||||
# local( $i );
|
||||
# foreach $i ( keys( %dep ) )
|
||||
# {
|
||||
# print "$shadername depends on $i\n";
|
||||
# }
|
||||
return keys( %dep );
|
||||
}
|
||||
|
||||
sub GetShaderType
|
||||
{
|
||||
my $shadername = shift;
|
||||
my $shadertype;
|
||||
if( $shadername =~ m/\.vsh/i )
|
||||
{
|
||||
$shadertype = "vsh";
|
||||
}
|
||||
elsif( $shadername =~ m/\.psh/i )
|
||||
{
|
||||
$shadertype = "psh";
|
||||
}
|
||||
elsif( $shadername =~ m/\.fxc/i )
|
||||
{
|
||||
$shadertype = "fxc";
|
||||
}
|
||||
else
|
||||
{
|
||||
die;
|
||||
}
|
||||
return $shadertype;
|
||||
}
|
||||
|
||||
sub GetShaderSrc
|
||||
{
|
||||
my $shadername = shift;
|
||||
if ( $shadername =~ m/^(.*)-----/i )
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $shadername;
|
||||
}
|
||||
}
|
||||
|
||||
sub GetShaderBase
|
||||
{
|
||||
my $shadername = shift;
|
||||
if ( $shadername =~ m/-----(.*)$/i )
|
||||
{
|
||||
return $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
my $shadertype = &GetShaderType( $shadername );
|
||||
$shadername =~ s/\.$shadertype//i;
|
||||
return $shadername;
|
||||
}
|
||||
}
|
||||
|
||||
sub DoAsmShader
|
||||
{
|
||||
my $argstring = shift;
|
||||
my $shadername = &GetShaderSrc( $argstring );
|
||||
my $shaderbase = &GetShaderBase( $argstring );
|
||||
my $shadertype = &GetShaderType( $argstring );
|
||||
my $incfile = "";
|
||||
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
|
||||
{
|
||||
$incfile = $shadertype . "tmp9" . $g_tmpfolder . "\\$shaderbase.inc ";
|
||||
}
|
||||
|
||||
my $vcsfile = $shaderbase . $g_vcsext;
|
||||
my $bWillCompileVcs = 1;
|
||||
if( ( $shadertype eq "fxc") && $dynamic_compile )
|
||||
{
|
||||
$bWillCompileVcs = 0;
|
||||
}
|
||||
if( $shadercrcpass{$argstring} )
|
||||
{
|
||||
$bWillCompileVcs = 0;
|
||||
}
|
||||
|
||||
if( $bWillCompileVcs )
|
||||
{
|
||||
&output_makefile_line( $incfile . "shaders\\$shadertype\\$vcsfile: $shadername @dep\n") ;
|
||||
}
|
||||
else
|
||||
{
|
||||
# psh files don't need a rule at this point since they don't have inc files and we aren't compiling a vcs.
|
||||
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
|
||||
{
|
||||
&output_makefile_line( $incfile . ": $shadername @dep\n") ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $x360switch = "";
|
||||
my $moreswitches = "";
|
||||
if( !$bWillCompileVcs && $shadertype eq "fxc" )
|
||||
{
|
||||
$moreswitches .= "-novcs ";
|
||||
}
|
||||
if( $g_x360 )
|
||||
{
|
||||
$x360switch = "-x360";
|
||||
|
||||
if( $bWillCompileVcs && ( $shaderbase =~ m/_ps20$/i ) )
|
||||
{
|
||||
$moreswitches .= "-novcs ";
|
||||
$bWillCompileVcs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
# if we are psh and we are compiling the vcs, we don't need this rule.
|
||||
if( !( $shadertype eq "psh" && !$bWillCompileVcs ) )
|
||||
{
|
||||
&output_makefile_line( "\tperl $g_SourceDir\\devtools\\bin\\" . $shadertype . "_prep.pl $moreswitches $x360switch -source \"$g_SourceDir\" $argstring\n") ;
|
||||
}
|
||||
|
||||
if( $bWillCompileVcs )
|
||||
{
|
||||
&output_makefile_line( "\techo $shadername>> filestocopy.txt\n") ;
|
||||
my $dep;
|
||||
foreach $dep( @dep )
|
||||
{
|
||||
&output_makefile_line( "\techo $dep>> filestocopy.txt\n") ;
|
||||
}
|
||||
}
|
||||
&output_makefile_line( "\n") ;
|
||||
}
|
||||
|
||||
if( scalar( @ARGV ) == 0 )
|
||||
{
|
||||
die "Usage updateshaders.pl shaderprojectbasename\n\tie: updateshaders.pl stdshaders_dx6\n";
|
||||
}
|
||||
|
||||
$g_x360 = 0;
|
||||
$g_tmpfolder = "_tmp";
|
||||
$g_vcsext = ".vcs";
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
$inputbase = shift;
|
||||
|
||||
if( $inputbase =~ m/-source/ )
|
||||
{
|
||||
$g_SourceDir = shift;
|
||||
}
|
||||
elsif( $inputbase =~ m/-x360/ )
|
||||
{
|
||||
$g_x360 = 1;
|
||||
$g_tmpfolder = "_360_tmp";
|
||||
$g_vcsext = ".360.vcs";
|
||||
}
|
||||
elsif( $inputbase =~ m/-execute/ )
|
||||
{
|
||||
$g_execute = 1;
|
||||
}
|
||||
elsif( $inputbase =~ m/-nv3x/ )
|
||||
{
|
||||
$nv3x = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
my @srcfiles = &LoadShaderListFile( $inputbase );
|
||||
|
||||
open MAKEFILE, ">makefile\.$inputbase";
|
||||
open COPYFILE, ">makefile\.$inputbase\.copy";
|
||||
open INCLIST, ">inclist.txt";
|
||||
open VCSLIST, ">vcslist.txt";
|
||||
|
||||
# make a default dependency that depends on all of the shaders.
|
||||
&output_makefile_line( "default: ") ;
|
||||
foreach $shader ( @srcfiles )
|
||||
{
|
||||
my $shadertype = &GetShaderType( $shader );
|
||||
my $shaderbase = &GetShaderBase( $shader );
|
||||
my $shadersrc = &GetShaderSrc( $shader );
|
||||
if( $shadertype eq "fxc" || $shadertype eq "vsh" )
|
||||
{
|
||||
# We only generate inc files for fxc and vsh files.
|
||||
my $incFileName = "$shadertype" . "tmp9" . $g_tmpfolder . "\\" . $shaderbase . "\.inc";
|
||||
&output_makefile_line( " $incFileName" );
|
||||
&output_inclist_line( "$incFileName\n" );
|
||||
}
|
||||
|
||||
my $vcsfile = $shaderbase . $g_vcsext;
|
||||
|
||||
my $compilevcs = 1;
|
||||
if( $shadertype eq "fxc" && $dynamic_compile )
|
||||
{
|
||||
$compilevcs = 0;
|
||||
}
|
||||
if( $g_x360 && ( $shaderbase =~ m/_ps20$/i ) )
|
||||
{
|
||||
$compilevcs = 0;
|
||||
}
|
||||
if( $compilevcs )
|
||||
{
|
||||
my $vcsFileName = "..\\..\\..\\game\\hl2\\shaders\\$shadertype\\$shaderbase" . $g_vcsext;
|
||||
# We want to check for perforce operations even if the crc matches in the event that a file has been manually reverted and needs to be checked out again.
|
||||
&output_vcslist_line( "$vcsFileName\n" );
|
||||
$shadercrcpass{$shader} = &CheckCRCAgainstTarget( $shadersrc, $vcsFileName, 0 );
|
||||
if( $shadercrcpass{$shader} )
|
||||
{
|
||||
$compilevcs = 0;
|
||||
}
|
||||
}
|
||||
if( $compilevcs )
|
||||
{
|
||||
&output_makefile_line( " shaders\\$shadertype\\$vcsfile" );
|
||||
# emit a list of vcs files to copy to the target since we want to build them.
|
||||
&output_copyfile_line( GetShaderSrc($shader) . "-----" . GetShaderBase($shader) . "\n" );
|
||||
}
|
||||
}
|
||||
&output_makefile_line( "\n\n") ;
|
||||
|
||||
# Insert all of our vertex shaders and depencencies
|
||||
$lastshader = "";
|
||||
foreach $shader ( @srcfiles )
|
||||
{
|
||||
my $currentshader = &GetShaderSrc( $shader );
|
||||
if ( $lastshader ne $currentshader )
|
||||
{
|
||||
$lastshader = $currentshader;
|
||||
@dep = &GetAsmShaderDependencies( $lastshader );
|
||||
}
|
||||
&DoAsmShader( $shader );
|
||||
}
|
||||
close VCSLIST;
|
||||
close INCLIST;
|
||||
close COPYFILE;
|
||||
close MAKEFILE;
|
||||
|
||||
# nuke the copyfile if it is zero length
|
||||
if( ( stat "makefile\.$inputbase\.copy" )[7] == 0 )
|
||||
{
|
||||
unlink "makefile\.$inputbase\.copy";
|
||||
}
|
||||
|
||||
sub output_makefile_line
|
||||
{
|
||||
local ($_)=@_;
|
||||
print MAKEFILE $_;
|
||||
}
|
||||
|
||||
sub output_copyfile_line
|
||||
{
|
||||
local ($_)=@_;
|
||||
print COPYFILE $_;
|
||||
}
|
||||
|
||||
sub output_vcslist_line
|
||||
{
|
||||
local ($_)=@_;
|
||||
print VCSLIST $_;
|
||||
}
|
||||
|
||||
sub output_inclist_line
|
||||
{
|
||||
local ($_)=@_;
|
||||
print INCLIST $_;
|
||||
}
|
||||
|
1106
devtools/bin/vsh_prep.pl
Normal file
1106
devtools/bin/vsh_prep.pl
Normal file
File diff suppressed because it is too large
Load Diff
44
devtools/gendbg.sh
Normal file
44
devtools/gendbg.sh
Normal file
@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
OBJCOPY=objcopy
|
||||
|
||||
function usage {
|
||||
echo "$0 /path/to/input/file [-o /path/to/output/file ]"
|
||||
echo ""
|
||||
}
|
||||
|
||||
if [ $# == 0 ]; then
|
||||
usage
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ $(basename $1) == $1 ]; then
|
||||
INFILEDIR=$PWD
|
||||
else
|
||||
INFILEDIR=$(cd ${1%/*} && echo $PWD)
|
||||
fi
|
||||
INFILE=$(basename $1)
|
||||
|
||||
OUTFILEDIR=$INFILEDIR
|
||||
OUTFILE=$INFILE.dbg
|
||||
|
||||
while getopts "o:" opt; do
|
||||
case $opt in
|
||||
o)
|
||||
OUTFILEDIR=$(cd ${OPTARG%/*} && echo $PWD)
|
||||
OUTFILE=$(basename $OPTARG)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$OUTFILEDIR" != "$INFILEDIR" ]; then
|
||||
INFILE=${INFILEDIR}/${INFILE}
|
||||
OUTFILE=${OUTFILEDIR}/${OUTFILE}
|
||||
fi
|
||||
|
||||
pushd "$INFILEDIR"
|
||||
$OBJCOPY "$INFILE" "$OUTFILE"
|
||||
$OBJCOPY --add-gnu-debuglink="$OUTFILE" "$INFILE"
|
||||
popd
|
||||
|
||||
|
494
devtools/makefile_base_posix.mak
Normal file
494
devtools/makefile_base_posix.mak
Normal file
@ -0,0 +1,494 @@
|
||||
#
|
||||
# Base makefile for Linux and OSX
|
||||
#
|
||||
# !!!!! Note to future editors !!!!!
|
||||
#
|
||||
# before you make changes, make sure you grok:
|
||||
# 1. the difference between =, :=, +=, and ?=
|
||||
# 2. how and when this base makefile gets included in the generated makefile(s)
|
||||
# ( see http://www.gnu.org/software/make/manual/make.html#Flavors )
|
||||
#
|
||||
# Command line prefixes:
|
||||
# - errors are ignored
|
||||
# @ command is not printed to stdout before being executed
|
||||
# + command is executed even if Make is invoked in "do not exec" mode
|
||||
|
||||
OS := $(shell uname)
|
||||
HOSTNAME := $(shell hostname)
|
||||
|
||||
-include $(SRCROOT)/devtools/steam_def.mak
|
||||
-include $(SRCROOT)/devtools/sourcesdk_def.mak
|
||||
|
||||
# To build with clang, set the following in your environment:
|
||||
# CC = clang
|
||||
# CXX = clang++
|
||||
|
||||
ifeq ($(CFG), release)
|
||||
# With gcc 4.6.3, engine.so went from 7,383,765 to 8,429,109 when building with -O3.
|
||||
# There also was no speed difference running at 1280x1024. May 2012, mikesart.
|
||||
# tonyp: The size increase was likely caused by -finline-functions and -fipa-cp-clone getting switched on with -O3.
|
||||
# -fno-omit-frame-pointer: need this for stack traces with perf.
|
||||
OptimizerLevel_CompilerSpecific = -O2 -fno-strict-aliasing -ffast-math -fno-omit-frame-pointer -ftree-vectorize -fpredictive-commoning -funswitch-loops
|
||||
else
|
||||
OptimizerLevel_CompilerSpecific = -O0
|
||||
#-O1 -finline-functions
|
||||
endif
|
||||
|
||||
# CPPFLAGS == "c/c++ *preprocessor* flags" - not "cee-plus-plus flags"
|
||||
ARCH_FLAGS =
|
||||
BUILDING_MULTI_ARCH = 0
|
||||
CPPFLAGS = $(DEFINES) $(addprefix -I, $(abspath $(INCLUDEDIRS) ))
|
||||
CFLAGS = $(ARCH_FLAGS) $(CPPFLAGS) $(WARN_FLAGS) -fvisibility=$(SymbolVisibility) $(OptimizerLevel) -pipe $(GCC_ExtraCompilerFlags) -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE
|
||||
LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel)
|
||||
GENDEP_CXXFLAGS = -MD -MP -MF $(@:.o=.P)
|
||||
MAP_FLAGS =
|
||||
|
||||
ifeq ($(STEAM_BRANCH),1)
|
||||
WARN_FLAGS = -Wall -Wextra -Wshadow -Wno-invalid-offsetof
|
||||
else
|
||||
WARN_FLAGS = -Wno-write-strings -Wno-multichar
|
||||
endif
|
||||
|
||||
WARN_FLAGS += -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-sign-compare -Wno-reorder -Wno-invalid-offsetof -Wno-float-equal -Werror=return-type -fdiagnostics-show-option -Wformat -Wformat-security
|
||||
|
||||
|
||||
ifeq ($(OS),Linux)
|
||||
# We should always specify -Wl,--build-id, as documented at:
|
||||
# http://linux.die.net/man/1/ld and http://fedoraproject.org/wiki/Releases/FeatureBuildId.http://fedoraproject.org/wiki/Releases/FeatureBuildId
|
||||
LDFLAGS += -Wl,--build-id
|
||||
# Set USE_VALVE_BINDIR to build with /Steam/tools/linux in the /valve/bin path.
|
||||
# Dedicated server uses this.
|
||||
ifeq ($(USE_VALVE_BINDIR),1)
|
||||
# dedicated server flags
|
||||
ifeq ($(TARGET_PLATFORM),linux64)
|
||||
VALVE_BINDIR = /valve/bin64/
|
||||
MARCH_TARGET = nocona
|
||||
else
|
||||
VALVE_BINDIR = /valve/bin/
|
||||
MARCH_TARGET = pentium4
|
||||
endif
|
||||
STRIP_FLAGS =
|
||||
else
|
||||
# linux desktop client flags
|
||||
VALVE_BINDIR =
|
||||
# If the steam-runtime is available, use it. We should just default to using it when
|
||||
# buildbot and everyone has a bit of time to get it installed.
|
||||
ifneq "$(wildcard /valve/steam-runtime/bin/)" ""
|
||||
VALVE_BINDIR = /valve/steam-runtime/bin/
|
||||
endif
|
||||
GCC_VER =
|
||||
MARCH_TARGET = pentium4
|
||||
# On dedicated servers, some plugins depend on global variable symbols in addition to functions.
|
||||
# So symbols like _Z16ClearMultiDamagev should show up when you do "nm server_srv.so" in TF2.
|
||||
STRIP_FLAGS = -x
|
||||
endif
|
||||
|
||||
ifeq ($(CXX),clang++)
|
||||
# Clang does not support -mfpmath=sse because it uses whatever
|
||||
# instruction set extensions are available by default.
|
||||
SSE_GEN_FLAGS = -msse2
|
||||
else
|
||||
SSE_GEN_FLAGS = -msse2 -mfpmath=sse
|
||||
endif
|
||||
|
||||
CCACHE := $(SRCROOT)/devtools/bin/linux/ccache
|
||||
|
||||
ifeq ($(origin GCC_VER), undefined)
|
||||
GCC_VER=-4.6
|
||||
endif
|
||||
ifeq ($(origin AR), default)
|
||||
AR = $(VALVE_BINDIR)ar crs
|
||||
endif
|
||||
ifeq ($(origin CC),default)
|
||||
CC = $(CCACHE) $(VALVE_BINDIR)gcc$(GCC_VER)
|
||||
endif
|
||||
ifeq ($(origin CXX), default)
|
||||
CXX = $(CCACHE) $(VALVE_BINDIR)g++$(GCC_VER)
|
||||
endif
|
||||
# Support ccache with clang. Add -Qunused-arguments to avoid excessive warnings due to
|
||||
# a ccache quirk. Could also upgrade ccache.
|
||||
# http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html
|
||||
ifeq ($(CC),clang)
|
||||
CC = $(CCACHE) $(VALVE_BINDIR)clang -Qunused-arguments
|
||||
endif
|
||||
ifeq ($(CXX),clang++)
|
||||
CXX = $(CCACHE) $(VALVE_BINDIR)clang++ -Qunused-arguments
|
||||
endif
|
||||
LINK ?= $(CC)
|
||||
|
||||
ifeq ($(TARGET_PLATFORM),linux64)
|
||||
# nocona = pentium4 + 64bit + MMX, SSE, SSE2, SSE3 - no SSSE3 (that's three s's - added in core2)
|
||||
ARCH_FLAGS += -march=$(MARCH_TARGET) -mtune=core2
|
||||
LD_SO = ld-linux-x86_64.so.2
|
||||
LIBSTDCXX := $(shell $(CXX) -print-file-name=libstdc++.a)
|
||||
LIBSTDCXXPIC := $(shell $(CXX) -print-file-name=libstdc++-pic.a)
|
||||
else
|
||||
# pentium4 = MMX, SSE, SSE2 - no SSE3 (added in prescott) # -msse3 -mfpmath=sse
|
||||
ARCH_FLAGS += -m32 -march=$(MARCH_TARGET) -mtune=core2 $(SSE_GEN_FLAGS)
|
||||
LD_SO = ld-linux.so.2
|
||||
LIBSTDCXX := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
|
||||
LIBSTDCXXPIC := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
|
||||
LDFLAGS += -m32
|
||||
endif
|
||||
|
||||
GEN_SYM ?= $(SRCROOT)/devtools/gendbg.sh
|
||||
ifeq ($(CFG),release)
|
||||
STRIP ?= strip $(STRIP_FLAGS) -S
|
||||
# CFLAGS += -ffunction-sections -fdata-sections
|
||||
# LDFLAGS += -Wl,--gc-sections -Wl,--print-gc-sections
|
||||
else
|
||||
STRIP ?= true
|
||||
endif
|
||||
VSIGN ?= true
|
||||
|
||||
LINK_MAP_FLAGS = -Wl,-Map,$(@:.so=).map
|
||||
|
||||
SHLIBLDFLAGS = -shared $(LDFLAGS) -Wl,--no-undefined
|
||||
|
||||
_WRAP := -Xlinker --wrap=
|
||||
PATHWRAP = $(_WRAP)fopen $(_WRAP)freopen $(_WRAP)open $(_WRAP)creat $(_WRAP)access $(_WRAP)__xstat \
|
||||
$(_WRAP)stat $(_WRAP)lstat $(_WRAP)fopen64 $(_WRAP)open64 $(_WRAP)opendir $(_WRAP)__lxstat \
|
||||
$(_WRAP)chmod $(_WRAP)chown $(_WRAP)lchown $(_WRAP)symlink $(_WRAP)link $(_WRAP)__lxstat64 \
|
||||
$(_WRAP)mknod $(_WRAP)utimes $(_WRAP)unlink $(_WRAP)rename $(_WRAP)utime $(_WRAP)__xstat64 \
|
||||
$(_WRAP)mount $(_WRAP)mkfifo $(_WRAP)mkdir $(_WRAP)rmdir $(_WRAP)scandir $(_WRAP)realpath
|
||||
|
||||
LIB_START_EXE = $(PATHWRAP) -static-libgcc -Wl,--start-group
|
||||
LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread
|
||||
|
||||
LIB_START_SHLIB = $(PATHWRAP) -static-libgcc -Wl,--start-group
|
||||
LIB_END_SHLIB = -Wl,--end-group -lm -ldl $(LIBSTDCXXPIC) -lpthread -l:$(LD_SO) -Wl,--version-script=$(SRCROOT)/devtools/version_script.linux.txt
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Darwin)
|
||||
OSXVER := $(shell sw_vers -productVersion)
|
||||
CCACHE := $(SRCROOT)/devtools/bin/osx32/ccache
|
||||
DEVELOPER_DIR := $(shell /usr/bin/xcode-select -print-path)
|
||||
|
||||
ifeq (,$(findstring 10.7, $(OSXVER)))
|
||||
BUILDING_ON_LION := 0
|
||||
COMPILER_BIN_DIR := $(DEVELOPER_DIR)/usr/bin
|
||||
SDK_DIR := $(DEVELOPER_DIR)/SDKs
|
||||
else
|
||||
BUILDING_ON_LION := 1
|
||||
# Need to figure out which version of XCode you have installed
|
||||
# See if you have the clang compiler in $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
|
||||
ifeq ($(wildcard $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang),)
|
||||
# no clang, you're running older Xcode
|
||||
COMPILER_BIN_DIR := $(DEVELOPER_DIR)/usr/bin
|
||||
SDK_DIR := $(DEVELOPER_DIR)/SDKs
|
||||
else
|
||||
# clang is in the new Toolchain, use it
|
||||
COMPILER_BIN_DIR := $(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/bin
|
||||
SDK_DIR := $(DEVELOPER_DIR)/Platforms/MacOSX.platform/Developer/SDKs
|
||||
endif
|
||||
endif
|
||||
|
||||
#test to see if you have a compiler in the right place, if you don't abort with an error
|
||||
|
||||
ifeq ($(wildcard $(COMPILER_BIN_DIR)/clang),)
|
||||
$(error Unable to find compiler, install and configure XCode)
|
||||
endif
|
||||
|
||||
ifeq ($(wildcard $(COMPILER_BIN_DIR)/clang++),)
|
||||
$(error Unable to find compiler, install and configure XCode)
|
||||
endif
|
||||
|
||||
|
||||
SDKROOT ?= $(SDK_DIR)/MacOSX10.6.sdk
|
||||
|
||||
ifeq ($(origin AR), default)
|
||||
AR = libtool -static -o
|
||||
endif
|
||||
ifeq ($(origin CC), default)
|
||||
CC = $(CCACHE) $(COMPILER_BIN_DIR)/clang -Qunused-arguments
|
||||
endif
|
||||
ifeq ($(origin CXX), default)
|
||||
CXX = $(CCACHE) $(COMPILER_BIN_DIR)/clang++ -Qunused-arguments
|
||||
endif
|
||||
LINK ?= $(CXX)
|
||||
|
||||
ifeq (($TARGET_PLATFORM),osx64)
|
||||
ARCH_FLAGS += -arch x86_64 -m64 -march=core2
|
||||
else ifeq (,$(findstring -arch x86_64,$(GCC_ExtraCompilerFlags)))
|
||||
ARCH_FLAGS += -arch i386 -m32 -march=prescott -momit-leaf-frame-pointer -mtune=core2
|
||||
else
|
||||
# dirty hack to build a universal binary - don't specify the architecture
|
||||
ARCH_FLAGS += -arch i386 -Xarch_i386 -march=prescott -Xarch_i386 -mtune=core2 -Xarch_i386 -momit-leaf-frame-pointer -Xarch_x86_64 -march=core2
|
||||
endif
|
||||
|
||||
#FIXME: NOTE:Full path specified because the xcode 4.0 preview has a terribly broken dsymutil, so ref the 3.2 one
|
||||
GEN_SYM ?= $(DEVELOPER_DIR)/usr/bin/dsymutil
|
||||
ifeq ($(CFG),release)
|
||||
STRIP ?= strip -S
|
||||
else
|
||||
STRIP ?= true
|
||||
endif
|
||||
ifeq ($(SOURCE_SDK), 1)
|
||||
VSIGN ?= true
|
||||
else
|
||||
VSIGN ?= $(SRCROOT)/devtools/bin/vsign
|
||||
endif
|
||||
|
||||
|
||||
CPPFLAGS += -I$(SDKROOT)/usr/include/malloc
|
||||
CFLAGS += -isysroot $(SDKROOT) -mmacosx-version-min=10.5 -fasm-blocks
|
||||
|
||||
LIB_START_EXE = -lm -ldl -lpthread
|
||||
LIB_END_EXE =
|
||||
|
||||
LIB_START_SHLIB =
|
||||
LIB_END_SHLIB =
|
||||
|
||||
SHLIBLDFLAGS = $(LDFLAGS) -bundle -flat_namespace -undefined suppress -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
|
||||
|
||||
ifeq (lib,$(findstring lib,$(GAMEOUTPUTFILE)))
|
||||
SHLIBLDFLAGS = $(LDFLAGS) -dynamiclib -current_version 1.0 -compatibility_version 1.0 -install_name @rpath/$(basename $(notdir $(GAMEOUTPUTFILE))).dylib $(SystemLibraries) -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
#
|
||||
# Profile-directed optimizations.
|
||||
# Note: Last time these were tested 3/5/08, it actually slowed down the server benchmark by 5%!
|
||||
#
|
||||
# First, uncomment these, build, and test. It will generate .gcda and .gcno files where the .o files are.
|
||||
# PROFILE_LINKER_FLAG=-fprofile-arcs
|
||||
# PROFILE_COMPILER_FLAG=-fprofile-arcs
|
||||
#
|
||||
# Then, comment the above flags out again and rebuild with this flag uncommented:
|
||||
# PROFILE_COMPILER_FLAG=-fprofile-use
|
||||
#
|
||||
|
||||
#############################################################################
|
||||
# The compiler command lne for each src code file to compile
|
||||
#############################################################################
|
||||
|
||||
OBJ_DIR = ./obj_$(NAME)_$(TARGET_PLATFORM)$(TARGET_PLATFORM_EXT)/$(CFG)
|
||||
CPP_TO_OBJ = $(CPPFILES:.cpp=.o)
|
||||
CXX_TO_OBJ = $(CPP_TO_OBJ:.cxx=.o)
|
||||
CC_TO_OBJ = $(CXX_TO_OBJ:.cc=.o)
|
||||
MM_TO_OBJ = $(CC_TO_OBJ:.mm=.o)
|
||||
C_TO_OBJ = $(MM_TO_OBJ:.c=.o)
|
||||
OBJS = $(addprefix $(OBJ_DIR)/, $(notdir $(C_TO_OBJ)))
|
||||
|
||||
ifeq ($(MAKE_VERBOSE),1)
|
||||
QUIET_PREFIX =
|
||||
QUIET_ECHO_POSTFIX =
|
||||
else
|
||||
QUIET_PREFIX = @
|
||||
QUIET_ECHO_POSTFIX = > /dev/null
|
||||
endif
|
||||
|
||||
ifeq ($(MAKE_CC_VERBOSE),1)
|
||||
CC += -v
|
||||
endif
|
||||
|
||||
ifeq ($(CONFTYPE),lib)
|
||||
LIB_File = $(OUTPUTFILE)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFTYPE),dll)
|
||||
SO_File = $(OUTPUTFILE)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFTYPE),exe)
|
||||
EXE_File = $(OUTPUTFILE)
|
||||
endif
|
||||
|
||||
# we generate dependencies as a side-effect of compilation now
|
||||
GEN_DEP_FILE=
|
||||
|
||||
PRE_COMPILE_FILE =
|
||||
|
||||
POST_COMPILE_FILE =
|
||||
|
||||
ifeq ($(BUILDING_MULTI_ARCH),1)
|
||||
SINGLE_ARCH_CXXFLAGS=$(subst -arch x86_64,,$(CXXFLAGS))
|
||||
COMPILE_FILE = \
|
||||
$(QUIET_PREFIX) \
|
||||
echo "---- $(lastword $(subst /, ,$<)) as MULTIARCH----";\
|
||||
mkdir -p $(OBJ_DIR) && \
|
||||
$(CXX) $(SINGLE_ARCH_CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $< && \
|
||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
else
|
||||
COMPILE_FILE = \
|
||||
$(QUIET_PREFIX) \
|
||||
echo "---- $(lastword $(subst /, ,$<)) ----";\
|
||||
mkdir -p $(OBJ_DIR) && \
|
||||
$(CXX) $(CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $<
|
||||
endif
|
||||
|
||||
ifneq "$(origin VALVE_NO_AUTO_P4)" "undefined"
|
||||
P4_EDIT_START = chmod -R +w
|
||||
P4_EDIT_END = || true
|
||||
P4_REVERT_START = true
|
||||
P4_REVERT_END =
|
||||
else
|
||||
ifndef P4_EDIT_CHANGELIST
|
||||
# You can use an environment variable to specify what changelist to check the Linux Binaries out into. Normally the default
|
||||
# setting is best, but here is an alternate example:
|
||||
# export P4_EDIT_CHANGELIST_CMD="echo 1424335"
|
||||
# ?= means that if P4_EDIT_CHANGELIST_CMD is already set it won't be changed.
|
||||
P4_EDIT_CHANGELIST_CMD ?= p4 changes -c `p4 client -o | grep ^Client | cut -f 2` -s pending | fgrep 'POSIX Auto Checkout' | cut -d' ' -f 2 | tail -n 1
|
||||
P4_EDIT_CHANGELIST := $(shell $(P4_EDIT_CHANGELIST_CMD))
|
||||
endif
|
||||
ifeq ($(P4_EDIT_CHANGELIST),)
|
||||
# If we haven't found a changelist to check out to then create one. The name must match the one from a few
|
||||
# lines above or else a new changelist will be created each time.
|
||||
# Warning: the behavior of 'echo' is not consistent. In bash you need the "-e" option in order for \n to be
|
||||
# interpreted as a line-feed, but in dash you do not, and if "-e" is passed along then it is printed, which
|
||||
# confuses p4. So, if you run this command from the bash shell don't forget to add "-e" to the echo command.
|
||||
P4_EDIT_CHANGELIST = $(shell echo "Change: new\nDescription: POSIX Auto Checkout" | p4 change -i | cut -f 2 -d ' ')
|
||||
endif
|
||||
|
||||
P4_EDIT_START := for f in
|
||||
P4_EDIT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - edit -c $(P4_EDIT_CHANGELIST); else p4 edit -c $(P4_EDIT_CHANGELIST) $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
|
||||
P4_REVERT_START := for f in
|
||||
P4_REVERT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - revert; else p4 revert $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFTYPE),dll)
|
||||
all: $(OTHER_DEPENDENCIES) $(OBJS) $(GAMEOUTPUTFILE)
|
||||
@echo $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX)
|
||||
else
|
||||
all: $(OTHER_DEPENDENCIES) $(OBJS) $(OUTPUTFILE)
|
||||
@echo $(OUTPUTFILE) $(QUIET_ECHO_POSTFIX)
|
||||
endif
|
||||
|
||||
.PHONY: clean cleantargets cleanandremove rebuild relink RemoveOutputFile SingleFile
|
||||
|
||||
|
||||
rebuild :
|
||||
$(MAKE) -f $(firstword $(MAKEFILE_LIST)) cleanandremove
|
||||
$(MAKE) -f $(firstword $(MAKEFILE_LIST))
|
||||
|
||||
|
||||
# Use the relink target to force to relink the project.
|
||||
relink: RemoveOutputFile all
|
||||
|
||||
RemoveOutputFile:
|
||||
rm -f $(OUTPUTFILE)
|
||||
|
||||
|
||||
# This rule is so you can say "make SingleFile SingleFilename=/home/myname/valve_main/src/engine/language.cpp" and have it only build that file.
|
||||
# It basically just translates the full filename to create a dependency on the appropriate .o file so it'll build that.
|
||||
SingleFile : RemoveSingleFile $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
|
||||
@echo ""
|
||||
|
||||
RemoveSingleFile:
|
||||
$(QUIET_PREFIX) rm -f $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
|
||||
|
||||
clean:
|
||||
ifneq "$(OBJ_DIR)" ""
|
||||
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
|
||||
$(QUIET_PREFIX) rm -rf $(OBJ_DIR)
|
||||
endif
|
||||
ifneq "$(OUTPUTFILE)" ""
|
||||
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
|
||||
echo "p4 revert $(OUTPUTFILE)"; \
|
||||
$(P4_REVERT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END); \
|
||||
fi;
|
||||
endif
|
||||
ifneq "$(OTHER_DEPENDENCIES)" ""
|
||||
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
|
||||
$(QUIET_PREFIX) rm -f $(OTHER_DEPENDENCIES)
|
||||
endif
|
||||
ifneq "$(GAMEOUTPUTFILE)" ""
|
||||
$(QUIET_PREFIX) echo "p4 revert $(GAMEOUTPUTFILE)"
|
||||
$(QUIET_PREFIX) $(P4_REVERT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END)
|
||||
endif
|
||||
|
||||
|
||||
# Do the above cleaning, except with p4 edit and rm. Reason being ar crs adds and replaces obj files to the
|
||||
# archive. However if you've renamed or deleted a source file, $(AR) won't remove it. This can leave
|
||||
# us with archive files that have extra unused symbols, and also potentially cause compilation errors
|
||||
# when you rename a file and have many duplicate symbols.
|
||||
cleanandremove:
|
||||
ifneq "$(OBJ_DIR)" ""
|
||||
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
|
||||
$(QUIET_PREFIX) -rm -rf $(OBJ_DIR)
|
||||
endif
|
||||
ifneq "$(OUTPUTFILE)" ""
|
||||
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
|
||||
echo "p4 edit and rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT)"; \
|
||||
$(P4_EDIT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END); \
|
||||
fi;
|
||||
$(QUIET_PREFIX) -rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT);
|
||||
endif
|
||||
ifneq "$(OTHER_DEPENDENCIES)" ""
|
||||
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
|
||||
$(QUIET_PREFIX) -rm -f $(OTHER_DEPENDENCIES)
|
||||
endif
|
||||
ifneq "$(GAMEOUTPUTFILE)" ""
|
||||
$(QUIET_PREFIX) echo "p4 edit and rm -f $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT)"
|
||||
$(QUIET_PREFIX) $(P4_EDIT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END)
|
||||
$(QUIET_PREFIX) -rm -f $(GAMEOUTPUTFILE)
|
||||
endif
|
||||
|
||||
|
||||
# This just deletes the final targets so it'll do a relink next time we build.
|
||||
cleantargets:
|
||||
$(QUIET_PREFIX) rm -f $(OUTPUTFILE) $(GAMEOUTPUTFILE)
|
||||
|
||||
|
||||
$(LIB_File): $(OTHER_DEPENDENCIES) $(OBJS)
|
||||
$(QUIET_PREFIX) -$(P4_EDIT_START) $(LIB_File) $(P4_EDIT_END);
|
||||
$(QUIET_PREFIX) $(AR) $(LIB_File) $(OBJS) $(LIBFILES);
|
||||
|
||||
SO_GameOutputFile = $(GAMEOUTPUTFILE)
|
||||
|
||||
# Remove the target before installing a file over it; this prevents existing
|
||||
# instances of the game from crashing due to the overwrite.
|
||||
$(SO_GameOutputFile): $(SO_File)
|
||||
$(QUIET_PREFIX) \
|
||||
$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END) && \
|
||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||
echo "---- COPYING TO $@ [$(CFG)] ----";\
|
||||
echo "----" $(QUIET_ECHO_POSTFIX);
|
||||
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END);
|
||||
$(QUIET_PREFIX) -mkdir -p `dirname $(GAMEOUTPUTFILE)` > /dev/null;
|
||||
$(QUIET_PREFIX) rm -f $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
|
||||
$(QUIET_PREFIX) cp -v $(OUTPUTFILE) $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
|
||||
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
|
||||
$(QUIET_PREFIX) $(GEN_SYM) $(GAMEOUTPUTFILE);
|
||||
$(QUIET_PREFIX) -$(STRIP) $(GAMEOUTPUTFILE);
|
||||
$(QUIET_PREFIX) $(VSIGN) -signvalve $(GAMEOUTPUTFILE);
|
||||
$(QUIET_PREFIX) if [ "$(IMPORTLIBRARY)" != "" ]; then\
|
||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||
echo "---- COPYING TO IMPORT LIBRARY $(IMPORTLIBRARY) ----";\
|
||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||
$(P4_EDIT_START) $(IMPORTLIBRARY) $(P4_EDIT_END) && \
|
||||
mkdir -p `dirname $(IMPORTLIBRARY)` > /dev/null && \
|
||||
cp -v $(OUTPUTFILE) $(IMPORTLIBRARY); \
|
||||
fi;
|
||||
|
||||
|
||||
$(SO_File): $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
|
||||
$(QUIET_PREFIX) \
|
||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||
echo "---- LINKING $@ [$(CFG)] ----";\
|
||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||
\
|
||||
$(LINK) $(LINK_MAP_FLAGS) $(SHLIBLDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_SHLIB) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_SHLIB);
|
||||
$(VSIGN) -signvalve $(OUTPUTFILE);
|
||||
|
||||
|
||||
$(EXE_File) : $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
|
||||
$(QUIET_PREFIX) \
|
||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||
echo "---- LINKING EXE $@ [$(CFG)] ----";\
|
||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||
\
|
||||
$(P4_EDIT_START) $(OUTPUTFILE) $(P4_EDIT_END);\
|
||||
$(LINK) $(LINK_MAP_FLAGS) $(LDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_EXE) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_EXE);
|
||||
$(QUIET_PREFIX) -$(P4_EDIT_START) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
|
||||
$(QUIET_PREFIX) $(GEN_SYM) $(OUTPUTFILE);
|
||||
$(QUIET_PREFIX) -$(STRIP) $(OUTPUTFILE);
|
||||
$(QUIET_PREFIX) $(VSIGN) -signvalve $(OUTPUTFILE);
|
||||
|
||||
|
||||
tags:
|
||||
etags -a -C -o $(SRCROOT)/TAGS *.cpp *.cxx *.h *.hxx
|
3
devtools/sourcesdk_def.mak
Normal file
3
devtools/sourcesdk_def.mak
Normal file
@ -0,0 +1,3 @@
|
||||
#defines these macros so that we skip VSIGN and P4 steps in the SDK
|
||||
SOURCE_SDK=1
|
||||
VALVE_NO_AUTO_P4=1
|
14
devtools/version_script.linux.txt
Normal file
14
devtools/version_script.linux.txt
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
global: *;
|
||||
local:
|
||||
extern "C++" {
|
||||
*std::*;
|
||||
__cxxabi*;
|
||||
__gcc*;
|
||||
__gxx*;
|
||||
__gnu_cxx*;
|
||||
__cxa*;
|
||||
operator*;
|
||||
__dynamic_cast
|
||||
};
|
||||
};
|
53
game/client/AnimateSpecificTextureProxy.cpp
Normal file
53
game/client/AnimateSpecificTextureProxy.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Acts exactly like "AnimatedTexture", but ONLY if the texture
|
||||
// it's working on matches the desired texture to work on.
|
||||
//
|
||||
// This assumes that some other proxy will be switching out the textures.
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "cbase.h"
|
||||
#include "materialsystem/imaterialproxy.h"
|
||||
#include "materialsystem/imaterialvar.h"
|
||||
#include "materialsystem/imaterial.h"
|
||||
#include "materialsystem/itexture.h"
|
||||
#include "baseanimatedtextureproxy.h"
|
||||
#include "utlstring.h"
|
||||
#include <KeyValues.h>
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
class CAnimateSpecificTexture : public CBaseAnimatedTextureProxy
|
||||
{
|
||||
private:
|
||||
CUtlString m_OnlyAnimateOnTexture;
|
||||
public:
|
||||
virtual float GetAnimationStartTime( void* pBaseEntity ) { return 0; }
|
||||
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
|
||||
virtual void OnBind( void *pC_BaseEntity );
|
||||
virtual void Release( void ) { delete this; }
|
||||
};
|
||||
|
||||
bool CAnimateSpecificTexture::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
|
||||
{
|
||||
char const* pszAnimateOnTexture = pKeyValues->GetString( "onlyAnimateOnTexture" );
|
||||
if( !pszAnimateOnTexture )
|
||||
return false;
|
||||
|
||||
m_OnlyAnimateOnTexture.Set( pszAnimateOnTexture );
|
||||
|
||||
return CBaseAnimatedTextureProxy::Init( pMaterial, pKeyValues );
|
||||
}
|
||||
|
||||
void CAnimateSpecificTexture::OnBind( void *pC_BaseEntity )
|
||||
{
|
||||
if( FStrEq( m_AnimatedTextureVar->GetTextureValue()->GetName(), m_OnlyAnimateOnTexture ) )
|
||||
{
|
||||
CBaseAnimatedTextureProxy::OnBind( pC_BaseEntity );
|
||||
}
|
||||
//else do nothing
|
||||
}
|
||||
|
||||
EXPOSE_INTERFACE( CAnimateSpecificTexture, IMaterialProxy, "AnimateSpecificTexture" IMATERIAL_PROXY_INTERFACE_VERSION );
|
65
game/client/C_Env_Projected_Texture.h
Normal file
65
game/client/C_Env_Projected_Texture.h
Normal file
@ -0,0 +1,65 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef C_ENVPROJECTEDTEXTURE_H
|
||||
#define C_ENVPROJECTEDTEXTURE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "c_baseentity.h"
|
||||
#include "basetypes.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
class C_EnvProjectedTexture : public C_BaseEntity
|
||||
{
|
||||
DECLARE_CLASS( C_EnvProjectedTexture, C_BaseEntity );
|
||||
public:
|
||||
DECLARE_CLIENTCLASS();
|
||||
|
||||
C_EnvProjectedTexture();
|
||||
~C_EnvProjectedTexture();
|
||||
|
||||
virtual void OnDataChanged( DataUpdateType_t updateType );
|
||||
void ShutDownLightHandle( void );
|
||||
|
||||
virtual void Simulate();
|
||||
|
||||
void UpdateLight( bool bForceUpdate );
|
||||
|
||||
bool ShadowsEnabled();
|
||||
|
||||
float GetFOV();
|
||||
|
||||
private:
|
||||
|
||||
ClientShadowHandle_t m_LightHandle;
|
||||
|
||||
EHANDLE m_hTargetEntity;
|
||||
|
||||
bool m_bState;
|
||||
float m_flLightFOV;
|
||||
bool m_bEnableShadows;
|
||||
bool m_bLightOnlyTarget;
|
||||
bool m_bLightWorld;
|
||||
bool m_bCameraSpace;
|
||||
color32 m_cLightColor;
|
||||
float m_flAmbient;
|
||||
char m_SpotlightTextureName[ MAX_PATH ];
|
||||
int m_nSpotlightTextureFrame;
|
||||
int m_nShadowQuality;
|
||||
bool m_bCurrentShadow;
|
||||
|
||||
public:
|
||||
C_EnvProjectedTexture *m_pNext;
|
||||
};
|
||||
|
||||
C_EnvProjectedTexture* GetEnvProjectedTextureList();
|
||||
|
||||
#endif // C_ENVPROJECTEDTEXTURE_H
|
798
game/client/C_MaterialModifyControl.cpp
Normal file
798
game/client/C_MaterialModifyControl.cpp
Normal file
@ -0,0 +1,798 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Material Modify control entity.
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include "cbase.h"
|
||||
#include "proxyentity.h"
|
||||
#include "materialsystem/imaterial.h"
|
||||
#include "materialsystem/imaterialvar.h"
|
||||
#include "materialsystem/itexture.h"
|
||||
#include "iviewrender.h"
|
||||
#include "texture_group_names.h"
|
||||
#include "baseanimatedtextureproxy.h"
|
||||
#include "toolframework_client.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
#define MATERIAL_MODIFY_STRING_SIZE 255
|
||||
#define MATERIAL_MODIFY_ANIMATION_UNSET -1
|
||||
|
||||
// Must match MaterialModifyControl.cpp
|
||||
enum MaterialModifyMode_t
|
||||
{
|
||||
MATERIAL_MODIFY_MODE_NONE = 0,
|
||||
MATERIAL_MODIFY_MODE_SETVAR = 1,
|
||||
MATERIAL_MODIFY_MODE_ANIM_SEQUENCE = 2,
|
||||
MATERIAL_MODIFY_MODE_FLOAT_LERP = 3,
|
||||
};
|
||||
|
||||
// forward declarations
|
||||
void ToolFramework_RecordMaterialParams( IMaterial *pMaterial );
|
||||
|
||||
ConVar debug_materialmodifycontrol_client( "debug_materialmodifycontrol_client", "0" );
|
||||
|
||||
struct materialanimcommands_t
|
||||
{
|
||||
int iFrameStart;
|
||||
int iFrameEnd;
|
||||
bool bWrap;
|
||||
float flFrameRate;
|
||||
};
|
||||
|
||||
struct materialfloatlerpcommands_t
|
||||
{
|
||||
int flStartValue;
|
||||
int flEndValue;
|
||||
float flTransitionTime;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FIXME: This really should inherit from something more lightweight
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class C_MaterialModifyControl : public C_BaseEntity
|
||||
{
|
||||
public:
|
||||
|
||||
DECLARE_CLASS( C_MaterialModifyControl, C_BaseEntity );
|
||||
|
||||
C_MaterialModifyControl();
|
||||
|
||||
void OnPreDataChanged( DataUpdateType_t updateType );
|
||||
void OnDataChanged( DataUpdateType_t updateType );
|
||||
bool ShouldDraw();
|
||||
|
||||
IMaterial *GetMaterial( void ) { return m_pMaterial; }
|
||||
const char *GetMaterialVariableName( void ) { return m_szMaterialVar; }
|
||||
const char *GetMaterialVariableValue( void ) { return m_szMaterialVarValue; }
|
||||
|
||||
DECLARE_CLIENTCLASS();
|
||||
|
||||
// Animated texture and Float Lerp usage
|
||||
bool HasNewAnimationCommands( void ) { return m_bHasNewAnimationCommands; }
|
||||
void ClearAnimationCommands( void ) { m_bHasNewAnimationCommands = false; }
|
||||
|
||||
// Animated texture usage
|
||||
void GetAnimationCommands( materialanimcommands_t *pCommands );
|
||||
|
||||
// FloatLerp usage
|
||||
void GetFloatLerpCommands( materialfloatlerpcommands_t *pCommands );
|
||||
|
||||
void SetAnimationStartTime( float flTime )
|
||||
{
|
||||
m_flAnimationStartTime = flTime;
|
||||
}
|
||||
float GetAnimationStartTime( void ) const
|
||||
{
|
||||
return m_flAnimationStartTime;
|
||||
}
|
||||
|
||||
MaterialModifyMode_t GetModifyMode( void ) const
|
||||
{
|
||||
return ( MaterialModifyMode_t)m_nModifyMode;
|
||||
}
|
||||
private:
|
||||
|
||||
char m_szMaterialName[MATERIAL_MODIFY_STRING_SIZE];
|
||||
char m_szMaterialVar[MATERIAL_MODIFY_STRING_SIZE];
|
||||
char m_szMaterialVarValue[MATERIAL_MODIFY_STRING_SIZE];
|
||||
IMaterial *m_pMaterial;
|
||||
|
||||
bool m_bHasNewAnimationCommands;
|
||||
|
||||
// Animation commands from the server
|
||||
int m_iFrameStart;
|
||||
int m_iFrameEnd;
|
||||
bool m_bWrap;
|
||||
float m_flFramerate;
|
||||
bool m_bNewAnimCommandsSemaphore;
|
||||
bool m_bOldAnimCommandsSemaphore;
|
||||
|
||||
// Float lerp commands from the server
|
||||
float m_flFloatLerpStartValue;
|
||||
float m_flFloatLerpEndValue;
|
||||
float m_flFloatLerpTransitionTime;
|
||||
bool m_bFloatLerpWrap;
|
||||
float m_flAnimationStartTime;
|
||||
|
||||
int m_nModifyMode;
|
||||
};
|
||||
|
||||
IMPLEMENT_CLIENTCLASS_DT(C_MaterialModifyControl, DT_MaterialModifyControl, CMaterialModifyControl)
|
||||
RecvPropString( RECVINFO( m_szMaterialName ) ),
|
||||
RecvPropString( RECVINFO( m_szMaterialVar ) ),
|
||||
RecvPropString( RECVINFO( m_szMaterialVarValue ) ),
|
||||
RecvPropInt( RECVINFO(m_iFrameStart) ),
|
||||
RecvPropInt( RECVINFO(m_iFrameEnd) ),
|
||||
RecvPropInt( RECVINFO(m_bWrap) ),
|
||||
RecvPropFloat( RECVINFO(m_flFramerate) ),
|
||||
RecvPropInt( RECVINFO(m_bNewAnimCommandsSemaphore) ),
|
||||
RecvPropFloat( RECVINFO(m_flFloatLerpStartValue) ),
|
||||
RecvPropFloat( RECVINFO(m_flFloatLerpEndValue) ),
|
||||
RecvPropFloat( RECVINFO(m_flFloatLerpTransitionTime) ),
|
||||
RecvPropInt( RECVINFO(m_bFloatLerpWrap) ),
|
||||
RecvPropInt( RECVINFO(m_nModifyMode) ),
|
||||
END_RECV_TABLE()
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//------------------------------------------------------------------------------
|
||||
C_MaterialModifyControl::C_MaterialModifyControl()
|
||||
{
|
||||
m_pMaterial = NULL;
|
||||
m_bOldAnimCommandsSemaphore = false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void C_MaterialModifyControl::OnPreDataChanged( DataUpdateType_t updateType )
|
||||
{
|
||||
BaseClass::OnPreDataChanged( updateType );
|
||||
|
||||
m_bOldAnimCommandsSemaphore = m_bNewAnimCommandsSemaphore;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//------------------------------------------------------------------------------
|
||||
void C_MaterialModifyControl::OnDataChanged( DataUpdateType_t updateType )
|
||||
{
|
||||
if( updateType == DATA_UPDATE_CREATED )
|
||||
{
|
||||
m_pMaterial = materials->FindMaterial( m_szMaterialName, TEXTURE_GROUP_OTHER );
|
||||
|
||||
// Clear out our variables
|
||||
m_bHasNewAnimationCommands = true;
|
||||
}
|
||||
|
||||
// Detect changes in the anim commands
|
||||
if ( m_bNewAnimCommandsSemaphore != m_bOldAnimCommandsSemaphore )
|
||||
{
|
||||
m_bHasNewAnimationCommands = true;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void C_MaterialModifyControl::GetAnimationCommands( materialanimcommands_t *pCommands )
|
||||
{
|
||||
pCommands->iFrameStart = m_iFrameStart;
|
||||
pCommands->iFrameEnd = m_iFrameEnd;
|
||||
pCommands->bWrap = m_bWrap;
|
||||
pCommands->flFrameRate = m_flFramerate;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void C_MaterialModifyControl::GetFloatLerpCommands( materialfloatlerpcommands_t *pCommands )
|
||||
{
|
||||
pCommands->flStartValue = m_flFloatLerpStartValue;
|
||||
pCommands->flEndValue = m_flFloatLerpEndValue;
|
||||
pCommands->flTransitionTime = m_flFloatLerpTransitionTime;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose: We don't draw.
|
||||
//------------------------------------------------------------------------------
|
||||
bool C_MaterialModifyControl::ShouldDraw()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// THE MATERIALMODIFYPROXY ITSELF
|
||||
//
|
||||
class CMaterialModifyProxy : public CBaseAnimatedTextureProxy
|
||||
{
|
||||
public:
|
||||
CMaterialModifyProxy();
|
||||
virtual ~CMaterialModifyProxy();
|
||||
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
|
||||
virtual void OnBind( void *pEntity );
|
||||
virtual IMaterial *GetMaterial();
|
||||
|
||||
private:
|
||||
void OnBindSetVar( C_MaterialModifyControl *pControl );
|
||||
void OnBindAnimatedTexture( C_MaterialModifyControl *pControl );
|
||||
void OnBindFloatLerp( C_MaterialModifyControl *pControl );
|
||||
float GetAnimationStartTime( void* pArg );
|
||||
void AnimationWrapped( void* pArg );
|
||||
|
||||
IMaterial *m_pMaterial;
|
||||
|
||||
// texture animation stuff
|
||||
int m_iFrameStart;
|
||||
int m_iFrameEnd;
|
||||
bool m_bReachedEnd;
|
||||
bool m_bCustomWrap;
|
||||
float m_flCustomFramerate;
|
||||
|
||||
// float lerp stuff
|
||||
IMaterialVar *m_pMaterialVar;
|
||||
int m_flStartValue;
|
||||
int m_flEndValue;
|
||||
float m_flStartTime;
|
||||
float m_flTransitionTime;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
CMaterialModifyProxy::CMaterialModifyProxy()
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
CMaterialModifyProxy::~CMaterialModifyProxy()
|
||||
{
|
||||
}
|
||||
|
||||
bool CMaterialModifyProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
|
||||
{
|
||||
// set var stuff
|
||||
m_pMaterial = pMaterial;
|
||||
|
||||
// float lerp stuff
|
||||
m_flStartValue = MATERIAL_MODIFY_ANIMATION_UNSET;
|
||||
m_flEndValue = MATERIAL_MODIFY_ANIMATION_UNSET;
|
||||
|
||||
// animated stuff
|
||||
// m_pMaterial = pMaterial;
|
||||
// m_iFrameStart = MATERIAL_MODIFY_ANIMATION_UNSET;
|
||||
// m_iFrameEnd = MATERIAL_MODIFY_ANIMATION_UNSET;
|
||||
// m_bReachedEnd = false;
|
||||
// return CBaseAnimatedTextureProxy::Init( pMaterial, pKeyValues );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CMaterialModifyProxy::OnBind( void *pEntity )
|
||||
{
|
||||
// Get the modified material vars from the entity input
|
||||
IClientRenderable *pRend = (IClientRenderable *)pEntity;
|
||||
if ( pRend )
|
||||
{
|
||||
C_BaseEntity *pBaseEntity = pRend->GetIClientUnknown()->GetBaseEntity();
|
||||
|
||||
if ( pBaseEntity )
|
||||
{
|
||||
if( debug_materialmodifycontrol_client.GetBool() )
|
||||
{
|
||||
// DevMsg( 1, "%s\n", pBaseEntity->GetDebugName() );
|
||||
}
|
||||
int numChildren = 0;
|
||||
bool gotOne = false;
|
||||
for ( C_BaseEntity *pChild = pBaseEntity->FirstMoveChild(); pChild; pChild = pChild->NextMovePeer() )
|
||||
{
|
||||
numChildren++;
|
||||
C_MaterialModifyControl *pControl = dynamic_cast<C_MaterialModifyControl*>( pChild );
|
||||
if ( !pControl )
|
||||
continue;
|
||||
|
||||
if( debug_materialmodifycontrol_client.GetBool() )
|
||||
{
|
||||
// DevMsg( 1, "pControl: 0x%p\n", pControl );
|
||||
}
|
||||
|
||||
switch( pControl->GetModifyMode() )
|
||||
{
|
||||
case MATERIAL_MODIFY_MODE_NONE:
|
||||
break;
|
||||
case MATERIAL_MODIFY_MODE_SETVAR:
|
||||
gotOne = true;
|
||||
OnBindSetVar( pControl );
|
||||
break;
|
||||
case MATERIAL_MODIFY_MODE_ANIM_SEQUENCE:
|
||||
OnBindAnimatedTexture( pControl );
|
||||
break;
|
||||
case MATERIAL_MODIFY_MODE_FLOAT_LERP:
|
||||
OnBindFloatLerp( pControl );
|
||||
break;
|
||||
default:
|
||||
Assert( 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( gotOne )
|
||||
{
|
||||
// DevMsg( 1, "numChildren: %d\n", numChildren );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ToolsEnabled() )
|
||||
{
|
||||
ToolFramework_RecordMaterialParams( GetMaterial() );
|
||||
}
|
||||
}
|
||||
|
||||
IMaterial *CMaterialModifyProxy::GetMaterial()
|
||||
{
|
||||
return m_pMaterial;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMaterialModifyProxy::OnBindSetVar( C_MaterialModifyControl *pControl )
|
||||
{
|
||||
IMaterial *pMaterial = pControl->GetMaterial();
|
||||
if( !pMaterial )
|
||||
{
|
||||
Assert( 0 );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( pMaterial != m_pMaterial )
|
||||
{
|
||||
// Warning( "\t%s!=%s\n", pMaterial->GetName(), m_pMaterial->GetName() );
|
||||
return;
|
||||
}
|
||||
|
||||
bool bFound;
|
||||
IMaterialVar *pMaterialVar = pMaterial->FindVar( pControl->GetMaterialVariableName(), &bFound, false );
|
||||
if ( !bFound )
|
||||
return;
|
||||
|
||||
if( Q_strcmp( pControl->GetMaterialVariableValue(), "" ) )
|
||||
{
|
||||
// const char *pMaterialName = m_pMaterial->GetName();
|
||||
// const char *pMaterialVarName = pMaterialVar->GetName();
|
||||
// const char *pMaterialVarValue = pControl->GetMaterialVariableValue();
|
||||
// if( debug_materialmodifycontrol_client.GetBool()
|
||||
// && Q_stristr( m_pMaterial->GetName(), "faceandhair" )
|
||||
// && Q_stristr( pMaterialVar->GetName(), "self" )
|
||||
// )
|
||||
// {
|
||||
// static int count = 0;
|
||||
// DevMsg( 1, "CMaterialModifyProxy::OnBindSetVar \"%s\" %s=%s %d pControl=0x%p\n",
|
||||
// m_pMaterial->GetName(), pMaterialVar->GetName(), pControl->GetMaterialVariableValue(), count++, pControl );
|
||||
// }
|
||||
pMaterialVar->SetValueAutodetectType( pControl->GetMaterialVariableValue() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Does the dirty deed
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMaterialModifyProxy::OnBindAnimatedTexture( C_MaterialModifyControl *pControl )
|
||||
{
|
||||
assert ( m_AnimatedTextureVar );
|
||||
if( m_AnimatedTextureVar->GetType() != MATERIAL_VAR_TYPE_TEXTURE )
|
||||
return;
|
||||
|
||||
ITexture *pTexture;
|
||||
pTexture = m_AnimatedTextureVar->GetTextureValue();
|
||||
|
||||
if ( !pControl )
|
||||
return;
|
||||
|
||||
if ( pControl->HasNewAnimationCommands() )
|
||||
{
|
||||
// Read the data from the modify entity
|
||||
materialanimcommands_t sCommands;
|
||||
pControl->GetAnimationCommands( &sCommands );
|
||||
|
||||
m_iFrameStart = sCommands.iFrameStart;
|
||||
m_iFrameEnd = sCommands.iFrameEnd;
|
||||
m_bCustomWrap = sCommands.bWrap;
|
||||
m_flCustomFramerate = sCommands.flFrameRate;
|
||||
m_bReachedEnd = false;
|
||||
|
||||
m_flStartTime = gpGlobals->curtime;
|
||||
|
||||
pControl->ClearAnimationCommands();
|
||||
}
|
||||
|
||||
// Init all the vars based on whether we're using the base material settings,
|
||||
// or the custom ones from the entity input.
|
||||
int numFrames;
|
||||
bool bWrapAnimation;
|
||||
float flFrameRate;
|
||||
int iLastFrame;
|
||||
|
||||
// Do we have a custom frame section from the server?
|
||||
if ( m_iFrameStart != MATERIAL_MODIFY_ANIMATION_UNSET )
|
||||
{
|
||||
if ( m_iFrameEnd == MATERIAL_MODIFY_ANIMATION_UNSET )
|
||||
{
|
||||
m_iFrameEnd = pTexture->GetNumAnimationFrames();
|
||||
}
|
||||
|
||||
numFrames = (m_iFrameEnd - m_iFrameStart) + 1;
|
||||
bWrapAnimation = m_bCustomWrap;
|
||||
flFrameRate = m_flCustomFramerate;
|
||||
iLastFrame = (m_iFrameEnd - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
numFrames = pTexture->GetNumAnimationFrames();
|
||||
bWrapAnimation = m_WrapAnimation;
|
||||
flFrameRate = m_FrameRate;
|
||||
iLastFrame = (numFrames - 1);
|
||||
}
|
||||
|
||||
// Have we already reached the end? If so, stay there.
|
||||
if ( m_bReachedEnd && !bWrapAnimation )
|
||||
{
|
||||
m_AnimatedTextureFrameNumVar->SetIntValue( iLastFrame );
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: Must not use relative time based methods here
|
||||
// because the bind proxy can be called many times per frame.
|
||||
// Prevent multiple Wrap callbacks to be sent for no wrap mode
|
||||
float startTime;
|
||||
if ( m_iFrameStart != MATERIAL_MODIFY_ANIMATION_UNSET )
|
||||
{
|
||||
startTime = m_flStartTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
startTime = GetAnimationStartTime(pControl);
|
||||
}
|
||||
float deltaTime = gpGlobals->curtime - startTime;
|
||||
float prevTime = deltaTime - gpGlobals->frametime;
|
||||
|
||||
// Clamp..
|
||||
if (deltaTime < 0.0f)
|
||||
deltaTime = 0.0f;
|
||||
if (prevTime < 0.0f)
|
||||
prevTime = 0.0f;
|
||||
|
||||
float frame = flFrameRate * deltaTime;
|
||||
float prevFrame = flFrameRate * prevTime;
|
||||
|
||||
int intFrame = ((int)frame) % numFrames;
|
||||
int intPrevFrame = ((int)prevFrame) % numFrames;
|
||||
|
||||
if ( m_iFrameStart != MATERIAL_MODIFY_ANIMATION_UNSET )
|
||||
{
|
||||
intFrame += m_iFrameStart;
|
||||
intPrevFrame += m_iFrameStart;
|
||||
}
|
||||
|
||||
// Report wrap situation...
|
||||
if (intPrevFrame > intFrame)
|
||||
{
|
||||
m_bReachedEnd = true;
|
||||
|
||||
if (bWrapAnimation)
|
||||
{
|
||||
AnimationWrapped( pControl );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only sent the wrapped message once.
|
||||
// when we're in non-wrapping mode
|
||||
if (prevFrame < numFrames)
|
||||
AnimationWrapped( pControl );
|
||||
intFrame = numFrames - 1;
|
||||
}
|
||||
}
|
||||
|
||||
m_AnimatedTextureFrameNumVar->SetIntValue( intFrame );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
float CMaterialModifyProxy::GetAnimationStartTime( void* pArg )
|
||||
{
|
||||
IClientRenderable *pRend = (IClientRenderable *)pArg;
|
||||
if (!pRend)
|
||||
return 0.0f;
|
||||
|
||||
C_BaseEntity* pEntity = pRend->GetIClientUnknown()->GetBaseEntity();
|
||||
if (pEntity)
|
||||
{
|
||||
return pEntity->GetTextureAnimationStartTime();
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMaterialModifyProxy::AnimationWrapped( void* pArg )
|
||||
{
|
||||
IClientRenderable *pRend = (IClientRenderable *)pArg;
|
||||
if (!pRend)
|
||||
return;
|
||||
|
||||
C_BaseEntity* pEntity = pRend->GetIClientUnknown()->GetBaseEntity();
|
||||
if (pEntity)
|
||||
{
|
||||
pEntity->TextureAnimationWrapped();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Does the dirty deed
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMaterialModifyProxy::OnBindFloatLerp( C_MaterialModifyControl *pControl )
|
||||
{
|
||||
if ( !pControl )
|
||||
return;
|
||||
|
||||
if ( pControl->HasNewAnimationCommands() )
|
||||
{
|
||||
pControl->SetAnimationStartTime( gpGlobals->curtime );
|
||||
pControl->ClearAnimationCommands();
|
||||
}
|
||||
|
||||
// Read the data from the modify entity
|
||||
materialfloatlerpcommands_t sCommands;
|
||||
pControl->GetFloatLerpCommands( &sCommands );
|
||||
|
||||
m_flStartValue = sCommands.flStartValue;
|
||||
m_flEndValue = sCommands.flEndValue;
|
||||
m_flTransitionTime = sCommands.flTransitionTime;
|
||||
m_flStartTime = pControl->GetAnimationStartTime();
|
||||
bool bFound;
|
||||
m_pMaterialVar = m_pMaterial->FindVar( pControl->GetMaterialVariableName(), &bFound, false );
|
||||
|
||||
if( bFound )
|
||||
{
|
||||
float currentValue;
|
||||
if( m_flTransitionTime > 0.0f )
|
||||
{
|
||||
currentValue = m_flStartValue + ( m_flEndValue - m_flStartValue ) * clamp( ( ( gpGlobals->curtime - m_flStartTime ) / m_flTransitionTime ), 0.0f, 1.0f );
|
||||
}
|
||||
else
|
||||
{
|
||||
currentValue = m_flEndValue;
|
||||
}
|
||||
|
||||
if( debug_materialmodifycontrol_client.GetBool() && Q_stristr( m_pMaterial->GetName(), "faceandhair" ) && Q_stristr( m_pMaterialVar->GetName(), "warp" ) )
|
||||
{
|
||||
static int count = 0;
|
||||
DevMsg( 1, "CMaterialFloatLerpProxy::OnBind \"%s\" %s=%f %d\n", m_pMaterial->GetName(), m_pMaterialVar->GetName(), currentValue, count++ );
|
||||
}
|
||||
m_pMaterialVar->SetFloatValue( currentValue );
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// MATERIALMODIFYANIMATED PROXY
|
||||
//
|
||||
class CMaterialModifyAnimatedProxy : public CBaseAnimatedTextureProxy
|
||||
{
|
||||
public:
|
||||
CMaterialModifyAnimatedProxy() {};
|
||||
virtual ~CMaterialModifyAnimatedProxy() {};
|
||||
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
|
||||
virtual void OnBind( void *pEntity );
|
||||
|
||||
virtual float GetAnimationStartTime( void* pBaseEntity );
|
||||
virtual void AnimationWrapped( void* pC_BaseEntity );
|
||||
|
||||
private:
|
||||
IMaterial *m_pMaterial;
|
||||
int m_iFrameStart;
|
||||
int m_iFrameEnd;
|
||||
bool m_bReachedEnd;
|
||||
float m_flStartTime;
|
||||
bool m_bCustomWrap;
|
||||
float m_flCustomFramerate;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CMaterialModifyAnimatedProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
|
||||
{
|
||||
m_pMaterial = pMaterial;
|
||||
m_iFrameStart = MATERIAL_MODIFY_ANIMATION_UNSET;
|
||||
m_iFrameEnd = MATERIAL_MODIFY_ANIMATION_UNSET;
|
||||
m_bReachedEnd = false;
|
||||
return CBaseAnimatedTextureProxy::Init( pMaterial, pKeyValues );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Does the dirty deed
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMaterialModifyAnimatedProxy::OnBind( void *pEntity )
|
||||
{
|
||||
assert ( m_AnimatedTextureVar );
|
||||
if( m_AnimatedTextureVar->GetType() != MATERIAL_VAR_TYPE_TEXTURE )
|
||||
return;
|
||||
|
||||
ITexture *pTexture;
|
||||
pTexture = m_AnimatedTextureVar->GetTextureValue();
|
||||
|
||||
// Get the modified material vars from the entity input
|
||||
IClientRenderable *pRend = (IClientRenderable *)pEntity;
|
||||
if ( pRend )
|
||||
{
|
||||
C_BaseEntity *pBaseEntity = pRend->GetIClientUnknown()->GetBaseEntity();
|
||||
if ( pBaseEntity )
|
||||
{
|
||||
for ( C_BaseEntity *pChild = pBaseEntity->FirstMoveChild(); pChild; pChild = pChild->NextMovePeer() )
|
||||
{
|
||||
C_MaterialModifyControl *pControl = dynamic_cast<C_MaterialModifyControl*>( pChild );
|
||||
if ( !pControl )
|
||||
continue;
|
||||
|
||||
if ( !pControl->HasNewAnimationCommands() )
|
||||
continue;
|
||||
|
||||
// Read the data from the modify entity
|
||||
materialanimcommands_t sCommands;
|
||||
pControl->GetAnimationCommands( &sCommands );
|
||||
|
||||
m_iFrameStart = sCommands.iFrameStart;
|
||||
m_iFrameEnd = sCommands.iFrameEnd;
|
||||
m_bCustomWrap = sCommands.bWrap;
|
||||
m_flCustomFramerate = sCommands.flFrameRate;
|
||||
m_bReachedEnd = false;
|
||||
|
||||
m_flStartTime = gpGlobals->curtime;
|
||||
|
||||
pControl->ClearAnimationCommands();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Init all the vars based on whether we're using the base material settings,
|
||||
// or the custom ones from the entity input.
|
||||
int numFrames;
|
||||
bool bWrapAnimation;
|
||||
float flFrameRate;
|
||||
int iLastFrame;
|
||||
|
||||
// Do we have a custom frame section from the server?
|
||||
if ( m_iFrameStart != MATERIAL_MODIFY_ANIMATION_UNSET )
|
||||
{
|
||||
if ( m_iFrameEnd == MATERIAL_MODIFY_ANIMATION_UNSET )
|
||||
{
|
||||
m_iFrameEnd = pTexture->GetNumAnimationFrames();
|
||||
}
|
||||
|
||||
numFrames = (m_iFrameEnd - m_iFrameStart) + 1;
|
||||
bWrapAnimation = m_bCustomWrap;
|
||||
flFrameRate = m_flCustomFramerate;
|
||||
iLastFrame = (m_iFrameEnd - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
numFrames = pTexture->GetNumAnimationFrames();
|
||||
bWrapAnimation = m_WrapAnimation;
|
||||
flFrameRate = m_FrameRate;
|
||||
iLastFrame = (numFrames - 1);
|
||||
}
|
||||
|
||||
// Have we already reached the end? If so, stay there.
|
||||
if ( m_bReachedEnd && !bWrapAnimation )
|
||||
{
|
||||
m_AnimatedTextureFrameNumVar->SetIntValue( iLastFrame );
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: Must not use relative time based methods here
|
||||
// because the bind proxy can be called many times per frame.
|
||||
// Prevent multiple Wrap callbacks to be sent for no wrap mode
|
||||
float startTime;
|
||||
if ( m_iFrameStart != MATERIAL_MODIFY_ANIMATION_UNSET )
|
||||
{
|
||||
startTime = m_flStartTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
startTime = GetAnimationStartTime(pEntity);
|
||||
}
|
||||
float deltaTime = gpGlobals->curtime - startTime;
|
||||
float prevTime = deltaTime - gpGlobals->frametime;
|
||||
|
||||
// Clamp..
|
||||
if (deltaTime < 0.0f)
|
||||
deltaTime = 0.0f;
|
||||
if (prevTime < 0.0f)
|
||||
prevTime = 0.0f;
|
||||
|
||||
float frame = flFrameRate * deltaTime;
|
||||
float prevFrame = flFrameRate * prevTime;
|
||||
|
||||
int intFrame = ((int)frame) % numFrames;
|
||||
int intPrevFrame = ((int)prevFrame) % numFrames;
|
||||
|
||||
if ( m_iFrameStart != MATERIAL_MODIFY_ANIMATION_UNSET )
|
||||
{
|
||||
intFrame += m_iFrameStart;
|
||||
intPrevFrame += m_iFrameStart;
|
||||
}
|
||||
|
||||
// Report wrap situation...
|
||||
if (intPrevFrame > intFrame)
|
||||
{
|
||||
m_bReachedEnd = true;
|
||||
|
||||
if (bWrapAnimation)
|
||||
{
|
||||
AnimationWrapped( pEntity );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only sent the wrapped message once.
|
||||
// when we're in non-wrapping mode
|
||||
if (prevFrame < numFrames)
|
||||
AnimationWrapped( pEntity );
|
||||
intFrame = numFrames - 1;
|
||||
}
|
||||
}
|
||||
|
||||
m_AnimatedTextureFrameNumVar->SetIntValue( intFrame );
|
||||
|
||||
if ( ToolsEnabled() )
|
||||
{
|
||||
ToolFramework_RecordMaterialParams( GetMaterial() );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
float CMaterialModifyAnimatedProxy::GetAnimationStartTime( void* pArg )
|
||||
{
|
||||
IClientRenderable *pRend = (IClientRenderable *)pArg;
|
||||
if (!pRend)
|
||||
return 0.0f;
|
||||
|
||||
C_BaseEntity* pEntity = pRend->GetIClientUnknown()->GetBaseEntity();
|
||||
if (pEntity)
|
||||
{
|
||||
return pEntity->GetTextureAnimationStartTime();
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CMaterialModifyAnimatedProxy::AnimationWrapped( void* pArg )
|
||||
{
|
||||
IClientRenderable *pRend = (IClientRenderable *)pArg;
|
||||
if (!pRend)
|
||||
return;
|
||||
|
||||
C_BaseEntity* pEntity = pRend->GetIClientUnknown()->GetBaseEntity();
|
||||
if (pEntity)
|
||||
{
|
||||
pEntity->TextureAnimationWrapped();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EXPOSE_INTERFACE( CMaterialModifyProxy, IMaterialProxy, "MaterialModify" IMATERIAL_PROXY_INTERFACE_VERSION );
|
||||
EXPOSE_INTERFACE( CMaterialModifyAnimatedProxy, IMaterialProxy, "MaterialModifyAnimated" IMATERIAL_PROXY_INTERFACE_VERSION );
|
60
game/client/C_WaterLODControl.cpp
Normal file
60
game/client/C_WaterLODControl.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Water LOD control entity.
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "cbase.h"
|
||||
#include "iviewrender.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// FIXME: This really should inherit from something more lightweight
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose : Water LOD control entity
|
||||
//------------------------------------------------------------------------------
|
||||
class C_WaterLODControl : public C_BaseEntity
|
||||
{
|
||||
public:
|
||||
DECLARE_CLASS( C_WaterLODControl, C_BaseEntity );
|
||||
|
||||
DECLARE_CLIENTCLASS();
|
||||
|
||||
void OnDataChanged(DataUpdateType_t updateType);
|
||||
bool ShouldDraw();
|
||||
|
||||
private:
|
||||
float m_flCheapWaterStartDistance;
|
||||
float m_flCheapWaterEndDistance;
|
||||
};
|
||||
|
||||
IMPLEMENT_CLIENTCLASS_DT(C_WaterLODControl, DT_WaterLODControl, CWaterLODControl)
|
||||
RecvPropFloat(RECVINFO(m_flCheapWaterStartDistance)),
|
||||
RecvPropFloat(RECVINFO(m_flCheapWaterEndDistance)),
|
||||
END_RECV_TABLE()
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose :
|
||||
// Input :
|
||||
// Output :
|
||||
//------------------------------------------------------------------------------
|
||||
void C_WaterLODControl::OnDataChanged(DataUpdateType_t updateType)
|
||||
{
|
||||
view->SetCheapWaterStartDistance( m_flCheapWaterStartDistance );
|
||||
view->SetCheapWaterEndDistance( m_flCheapWaterEndDistance );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// We don't draw...
|
||||
//------------------------------------------------------------------------------
|
||||
bool C_WaterLODControl::ShouldDraw()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
231
game/client/EffectsClient.cpp
Normal file
231
game/client/EffectsClient.cpp
Normal file
@ -0,0 +1,231 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Utility code.
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "cbase.h"
|
||||
#include "IEffects.h"
|
||||
#include "fx.h"
|
||||
#include "c_te_legacytempents.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Client-server neutral effects interface
|
||||
//-----------------------------------------------------------------------------
|
||||
class CEffectsClient : public IEffects
|
||||
{
|
||||
public:
|
||||
CEffectsClient();
|
||||
virtual ~CEffectsClient();
|
||||
|
||||
// Members of the IEffect interface
|
||||
virtual void Beam( const Vector &Start, const Vector &End, int nModelIndex,
|
||||
int nHaloIndex, unsigned char frameStart, unsigned char frameRate,
|
||||
float flLife, unsigned char width, unsigned char endWidth, unsigned char fadeLength,
|
||||
unsigned char noise, unsigned char red, unsigned char green,
|
||||
unsigned char blue, unsigned char brightness, unsigned char speed);
|
||||
virtual void Smoke( const Vector &origin, int modelIndex, float scale, float framerate );
|
||||
virtual void Sparks( const Vector &position, int nMagnitude = 1, int nTrailLength = 1, const Vector *pvecDir = NULL );
|
||||
virtual void Dust( const Vector &pos, const Vector &dir, float size, float speed );
|
||||
virtual void MuzzleFlash( const Vector &origin, const QAngle &angles, float fScale, int type );
|
||||
virtual void MetalSparks( const Vector &position, const Vector &direction );
|
||||
virtual void EnergySplash( const Vector &position, const Vector &direction, bool bExplosive = false );
|
||||
virtual void Ricochet( const Vector &position, const Vector &direction );
|
||||
|
||||
// FIXME: Should these methods remain in this interface? Or go in some
|
||||
// other client-server neutral interface?
|
||||
virtual float Time();
|
||||
virtual bool IsServer();
|
||||
virtual void SuppressEffectsSounds( bool bSuppress );
|
||||
|
||||
private:
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Returning true means don't even call TE func
|
||||
// Input : filter -
|
||||
// *suppress_host -
|
||||
// Output : static bool
|
||||
//-----------------------------------------------------------------------------
|
||||
bool SuppressTE( C_RecipientFilter& filter )
|
||||
{
|
||||
if ( !CanPredict() )
|
||||
return true;
|
||||
|
||||
if ( !filter.GetRecipientCount() )
|
||||
{
|
||||
// Suppress it
|
||||
return true;
|
||||
}
|
||||
|
||||
// There's at least one recipient
|
||||
return false;
|
||||
}
|
||||
|
||||
bool m_bSuppressSound;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Client-server neutral effects interface accessor
|
||||
//-----------------------------------------------------------------------------
|
||||
static CEffectsClient s_EffectClient;
|
||||
EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CEffectsClient, IEffects, IEFFECTS_INTERFACE_VERSION, s_EffectClient);
|
||||
IEffects *g_pEffects = &s_EffectClient;
|
||||
|
||||
ConVar r_decals( "r_decals", "2048" );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// constructor, destructor
|
||||
//-----------------------------------------------------------------------------
|
||||
CEffectsClient::CEffectsClient()
|
||||
{
|
||||
m_bSuppressSound = false;
|
||||
}
|
||||
|
||||
CEffectsClient::~CEffectsClient()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Suppress sound on effects
|
||||
//-----------------------------------------------------------------------------
|
||||
void CEffectsClient::SuppressEffectsSounds( bool bSuppress )
|
||||
{
|
||||
m_bSuppressSound = bSuppress;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Generates a beam
|
||||
//-----------------------------------------------------------------------------
|
||||
void CEffectsClient::Beam( const Vector &vecStartPoint, const Vector &vecEndPoint,
|
||||
int nModelIndex, int nHaloIndex, unsigned char frameStart, unsigned char nFrameRate,
|
||||
float flLife, unsigned char nWidth, unsigned char nEndWidth, unsigned char nFadeLength,
|
||||
unsigned char noise, unsigned char r, unsigned char g,
|
||||
unsigned char b, unsigned char brightness, unsigned char nSpeed)
|
||||
{
|
||||
Assert(0);
|
||||
// CBroadcastRecipientFilter filter;
|
||||
// if ( !SuppressTE( filter ) )
|
||||
// {
|
||||
// beams->CreateBeamPoints( vecStartPoint, vecEndPoint, nModelIndex, nHaloIndex,
|
||||
// m_fHaloScale,
|
||||
// flLife, 0.1 * nWidth, 0.1 * nEndWidth, nFadeLength, 0.01 * nAmplitude, a, 0.1 * nSpeed,
|
||||
// m_nStartFrame, 0.1 * nFrameRate, r, g, b );
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Generates various tempent effects
|
||||
//-----------------------------------------------------------------------------
|
||||
void CEffectsClient::Smoke( const Vector &vecOrigin, int modelIndex, float scale, float framerate )
|
||||
{
|
||||
CPVSFilter filter( vecOrigin );
|
||||
if ( !SuppressTE( filter ) )
|
||||
{
|
||||
int iColor = random->RandomInt(20,35);
|
||||
color32 color;
|
||||
color.r = iColor;
|
||||
color.g = iColor;
|
||||
color.b = iColor;
|
||||
color.a = iColor;
|
||||
QAngle angles;
|
||||
VectorAngles( Vector(0,0,1), angles );
|
||||
FX_Smoke( vecOrigin, angles, scale * 0.1f, 4, (unsigned char *)&color, 255 );
|
||||
}
|
||||
}
|
||||
|
||||
void CEffectsClient::Sparks( const Vector &position, int nMagnitude, int nTrailLength, const Vector *pVecDir )
|
||||
{
|
||||
CPVSFilter filter( position );
|
||||
if ( !SuppressTE( filter ) )
|
||||
{
|
||||
FX_ElectricSpark( position, nMagnitude, nTrailLength, pVecDir );
|
||||
}
|
||||
}
|
||||
|
||||
void CEffectsClient::Dust( const Vector &pos, const Vector &dir, float size, float speed )
|
||||
{
|
||||
CPVSFilter filter( pos );
|
||||
if ( !SuppressTE( filter ) )
|
||||
{
|
||||
FX_Dust( pos, dir, size, speed );
|
||||
}
|
||||
}
|
||||
|
||||
void CEffectsClient::MuzzleFlash( const Vector &vecOrigin, const QAngle &vecAngles, float flScale, int iType )
|
||||
{
|
||||
CPVSFilter filter( vecOrigin );
|
||||
if ( !SuppressTE( filter ) )
|
||||
{
|
||||
switch( iType )
|
||||
{
|
||||
case MUZZLEFLASH_TYPE_DEFAULT:
|
||||
FX_MuzzleEffect( vecOrigin, vecAngles, flScale, INVALID_EHANDLE_INDEX );
|
||||
break;
|
||||
|
||||
case MUZZLEFLASH_TYPE_GUNSHIP:
|
||||
FX_GunshipMuzzleEffect( vecOrigin, vecAngles, flScale, INVALID_EHANDLE_INDEX );
|
||||
break;
|
||||
|
||||
case MUZZLEFLASH_TYPE_STRIDER:
|
||||
FX_StriderMuzzleEffect( vecOrigin, vecAngles, flScale, INVALID_EHANDLE_INDEX );
|
||||
break;
|
||||
|
||||
default:
|
||||
Msg("No case for Muzzleflash type: %d\n", iType );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CEffectsClient::MetalSparks( const Vector &position, const Vector &direction )
|
||||
{
|
||||
CPVSFilter filter( position );
|
||||
if ( !SuppressTE( filter ) )
|
||||
{
|
||||
FX_MetalSpark( position, direction, direction );
|
||||
}
|
||||
}
|
||||
|
||||
void CEffectsClient::EnergySplash( const Vector &position, const Vector &direction, bool bExplosive )
|
||||
{
|
||||
CPVSFilter filter( position );
|
||||
if ( !SuppressTE( filter ) )
|
||||
{
|
||||
FX_EnergySplash( position, direction, bExplosive );
|
||||
}
|
||||
}
|
||||
|
||||
void CEffectsClient::Ricochet( const Vector &position, const Vector &direction )
|
||||
{
|
||||
CPVSFilter filter( position );
|
||||
if ( !SuppressTE( filter ) )
|
||||
{
|
||||
FX_MetalSpark( position, direction, direction );
|
||||
|
||||
if ( !m_bSuppressSound )
|
||||
{
|
||||
FX_RicochetSound( position );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Should these methods remain in this interface? Or go in some
|
||||
// other client-server neutral interface?
|
||||
float CEffectsClient::Time()
|
||||
{
|
||||
return gpGlobals->curtime;
|
||||
}
|
||||
|
||||
|
||||
bool CEffectsClient::IsServer()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
63
game/client/IsNPCProxy.cpp
Normal file
63
game/client/IsNPCProxy.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "cbase.h"
|
||||
#include "functionproxy.h"
|
||||
#include "toolframework_client.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
// forward declarations
|
||||
void ToolFramework_RecordMaterialParams( IMaterial *pMaterial );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Returns the player health (from 0 to 1)
|
||||
//-----------------------------------------------------------------------------
|
||||
class CProxyIsNPC : public CResultProxy
|
||||
{
|
||||
public:
|
||||
bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
|
||||
void OnBind( void *pC_BaseEntity );
|
||||
|
||||
private:
|
||||
CFloatInput m_Factor;
|
||||
};
|
||||
|
||||
bool CProxyIsNPC::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
|
||||
{
|
||||
if (!CResultProxy::Init( pMaterial, pKeyValues ))
|
||||
return false;
|
||||
|
||||
if (!m_Factor.Init( pMaterial, pKeyValues, "scale", 1 ))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CProxyIsNPC::OnBind( void *pC_BaseEntity )
|
||||
{
|
||||
if ( !pC_BaseEntity )
|
||||
return;
|
||||
|
||||
C_BaseEntity *pEntity = BindArgToEntity( pC_BaseEntity );
|
||||
if ( pEntity && pEntity->IsNPC() )
|
||||
{
|
||||
SetFloatResult( m_Factor.GetFloat() );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFloatResult( 0.0f );
|
||||
}
|
||||
if ( ToolsEnabled() )
|
||||
{
|
||||
ToolFramework_RecordMaterialParams( GetMaterial() );
|
||||
}
|
||||
}
|
||||
|
||||
EXPOSE_INTERFACE( CProxyIsNPC, IMaterialProxy, "IsNPC" IMATERIAL_PROXY_INTERFACE_VERSION );
|
||||
|
||||
|
60
game/client/MonitorMaterialProxy.cpp
Normal file
60
game/client/MonitorMaterialProxy.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "cbase.h"
|
||||
#include "materialsystem/imaterialproxy.h"
|
||||
#include "materialsystem/imaterial.h"
|
||||
#include "materialsystem/imaterialvar.h"
|
||||
|
||||
// $monitorTextureVar
|
||||
class CMonitorMaterialProxy : public IMaterialProxy
|
||||
{
|
||||
public:
|
||||
CMonitorMaterialProxy();
|
||||
virtual ~CMonitorMaterialProxy();
|
||||
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
|
||||
virtual void OnBind( void *pC_BaseEntity );
|
||||
virtual void Release( void ) { delete this; }
|
||||
private:
|
||||
IMaterialVar *m_pMonitorTextureVar;
|
||||
};
|
||||
|
||||
CMonitorMaterialProxy::CMonitorMaterialProxy()
|
||||
{
|
||||
m_pMonitorTextureVar = NULL;
|
||||
}
|
||||
|
||||
CMonitorMaterialProxy::~CMonitorMaterialProxy()
|
||||
{
|
||||
m_pMonitorTextureVar = NULL;
|
||||
}
|
||||
|
||||
|
||||
bool CMonitorMaterialProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
|
||||
{
|
||||
char const* pMonitorTextureVarName = pKeyValues->getString( "$monitorTextureVar" );
|
||||
if( !pMonitorTextureVarName )
|
||||
return false;
|
||||
|
||||
bool foundVar;
|
||||
m_pMonitorTextureVar = pMaterial->FindVar( pMonitorTextureVarName, &foundVar, false );
|
||||
if( !foundVar )
|
||||
{
|
||||
m_pMonitorTextureVar = NULL;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CMonitorMaterialProxy::OnBind( void *pC_BaseEntity )
|
||||
{
|
||||
if( !m_pMonitorTextureVar )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EXPOSE_INTERFACE( CMonitorMaterialProxy, IMaterialProxy, "Monitor" IMATERIAL_PROXY_INTERFACE_VERSION );
|
59
game/client/ProxyHealth.cpp
Normal file
59
game/client/ProxyHealth.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "cbase.h"
|
||||
#include "functionproxy.h"
|
||||
#include "toolframework_client.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
// forward declarations
|
||||
void ToolFramework_RecordMaterialParams( IMaterial *pMaterial );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Returns the player health (from 0 to 1)
|
||||
//-----------------------------------------------------------------------------
|
||||
class CProxyHealth : public CResultProxy
|
||||
{
|
||||
public:
|
||||
bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
|
||||
void OnBind( void *pC_BaseEntity );
|
||||
|
||||
private:
|
||||
CFloatInput m_Factor;
|
||||
};
|
||||
|
||||
bool CProxyHealth::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
|
||||
{
|
||||
if (!CResultProxy::Init( pMaterial, pKeyValues ))
|
||||
return false;
|
||||
|
||||
if (!m_Factor.Init( pMaterial, pKeyValues, "scale", 1 ))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CProxyHealth::OnBind( void *pC_BaseEntity )
|
||||
{
|
||||
if (!pC_BaseEntity)
|
||||
return;
|
||||
|
||||
C_BaseEntity *pEntity = BindArgToEntity( pC_BaseEntity );
|
||||
|
||||
Assert( m_pResult );
|
||||
SetFloatResult( pEntity->HealthFraction() * m_Factor.GetFloat() );
|
||||
|
||||
if ( ToolsEnabled() )
|
||||
{
|
||||
ToolFramework_RecordMaterialParams( GetMaterial() );
|
||||
}
|
||||
}
|
||||
|
||||
EXPOSE_INTERFACE( CProxyHealth, IMaterialProxy, "Health" IMATERIAL_PROXY_INTERFACE_VERSION );
|
||||
|
||||
|
317
game/client/ScreenSpaceEffects.cpp
Normal file
317
game/client/ScreenSpaceEffects.cpp
Normal file
@ -0,0 +1,317 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
#include "cbase.h"
|
||||
|
||||
#include "KeyValues.h"
|
||||
#include "cdll_client_int.h"
|
||||
#include "view_scene.h"
|
||||
#include "viewrender.h"
|
||||
#include "tier0/icommandline.h"
|
||||
#include "materialsystem/imesh.h"
|
||||
#include "materialsystem/imaterial.h"
|
||||
#include "materialsystem/imaterialsystemhardwareconfig.h"
|
||||
#include "materialsystem/imaterialvar.h"
|
||||
|
||||
#include "ScreenSpaceEffects.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CScreenSpaceEffectRegistration code
|
||||
// Used to register and effect with the IScreenSpaceEffectManager
|
||||
//------------------------------------------------------------------------------
|
||||
CScreenSpaceEffectRegistration *CScreenSpaceEffectRegistration::s_pHead = NULL;
|
||||
|
||||
CScreenSpaceEffectRegistration::CScreenSpaceEffectRegistration( const char *pName, IScreenSpaceEffect *pEffect )
|
||||
{
|
||||
m_pEffectName = pName;
|
||||
m_pEffect = pEffect;
|
||||
m_pNext = s_pHead;
|
||||
s_pHead = this;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CScreenSpaceEffectManager - Implementation of IScreenSpaceEffectManager
|
||||
//------------------------------------------------------------------------------
|
||||
class CScreenSpaceEffectManager : public IScreenSpaceEffectManager
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void InitScreenSpaceEffects( );
|
||||
virtual void ShutdownScreenSpaceEffects( );
|
||||
|
||||
virtual IScreenSpaceEffect *GetScreenSpaceEffect( const char *pEffectName );
|
||||
|
||||
virtual void SetScreenSpaceEffectParams( const char *pEffectName, KeyValues *params );
|
||||
virtual void SetScreenSpaceEffectParams( IScreenSpaceEffect *pEffect, KeyValues *params );
|
||||
|
||||
virtual void EnableScreenSpaceEffect( const char *pEffectName );
|
||||
virtual void EnableScreenSpaceEffect( IScreenSpaceEffect *pEffect );
|
||||
|
||||
virtual void DisableScreenSpaceEffect( const char *pEffectName );
|
||||
virtual void DisableScreenSpaceEffect( IScreenSpaceEffect *pEffect );
|
||||
|
||||
virtual void DisableAllScreenSpaceEffects( );
|
||||
|
||||
virtual void RenderEffects( int x, int y, int w, int h );
|
||||
};
|
||||
|
||||
CScreenSpaceEffectManager g_ScreenSpaceEffectManager;
|
||||
IScreenSpaceEffectManager *g_pScreenSpaceEffects = &g_ScreenSpaceEffectManager;
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// CScreenSpaceEffectManager::InitScreenSpaceEffects - Initialise all registered effects
|
||||
//---------------------------------------------------------------------------------------
|
||||
void CScreenSpaceEffectManager::InitScreenSpaceEffects( )
|
||||
{
|
||||
if ( CommandLine()->FindParm( "-filmgrain" ) )
|
||||
{
|
||||
GetScreenSpaceEffect( "filmgrain" )->Enable( true );
|
||||
}
|
||||
|
||||
for( CScreenSpaceEffectRegistration *pReg=CScreenSpaceEffectRegistration::s_pHead; pReg!=NULL; pReg=pReg->m_pNext )
|
||||
{
|
||||
IScreenSpaceEffect *pEffect = pReg->m_pEffect;
|
||||
if( pEffect )
|
||||
{
|
||||
bool bIsEnabled = pEffect->IsEnabled( );
|
||||
pEffect->Init( );
|
||||
pEffect->Enable( bIsEnabled );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
// CScreenSpaceEffectManager::ShutdownScreenSpaceEffects - Shutdown all registered effects
|
||||
//----------------------------------------------------------------------------------------
|
||||
void CScreenSpaceEffectManager::ShutdownScreenSpaceEffects( )
|
||||
{
|
||||
for( CScreenSpaceEffectRegistration *pReg=CScreenSpaceEffectRegistration::s_pHead; pReg!=NULL; pReg=pReg->m_pNext )
|
||||
{
|
||||
IScreenSpaceEffect *pEffect = pReg->m_pEffect;
|
||||
if( pEffect )
|
||||
{
|
||||
pEffect->Shutdown( );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// CScreenSpaceEffectManager::GetScreenSpaceEffect - Returns a point to the named effect
|
||||
//---------------------------------------------------------------------------------------
|
||||
IScreenSpaceEffect *CScreenSpaceEffectManager::GetScreenSpaceEffect( const char *pEffectName )
|
||||
{
|
||||
for( CScreenSpaceEffectRegistration *pReg=CScreenSpaceEffectRegistration::s_pHead; pReg!=NULL; pReg=pReg->m_pNext )
|
||||
{
|
||||
if( !Q_stricmp( pReg->m_pEffectName, pEffectName ) )
|
||||
{
|
||||
IScreenSpaceEffect *pEffect = pReg->m_pEffect;
|
||||
return pEffect;
|
||||
}
|
||||
}
|
||||
|
||||
Warning( "Could not find screen space effect %s\n", pEffectName );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// CScreenSpaceEffectManager::SetScreenSpaceEffectParams
|
||||
// - Assign parameters to the specified effect
|
||||
//---------------------------------------------------------------------------------------
|
||||
void CScreenSpaceEffectManager::SetScreenSpaceEffectParams( const char *pEffectName, KeyValues *params )
|
||||
{
|
||||
IScreenSpaceEffect *pEffect = GetScreenSpaceEffect( pEffectName );
|
||||
if( pEffect )
|
||||
SetScreenSpaceEffectParams( pEffect, params );
|
||||
}
|
||||
|
||||
void CScreenSpaceEffectManager::SetScreenSpaceEffectParams( IScreenSpaceEffect *pEffect, KeyValues *params )
|
||||
{
|
||||
if( pEffect )
|
||||
pEffect->SetParameters( params );
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// CScreenSpaceEffectManager::EnableScreenSpaceEffect
|
||||
// - Enables the specified effect
|
||||
//---------------------------------------------------------------------------------------
|
||||
void CScreenSpaceEffectManager::EnableScreenSpaceEffect( const char *pEffectName )
|
||||
{
|
||||
IScreenSpaceEffect *pEffect = GetScreenSpaceEffect( pEffectName );
|
||||
if( pEffect )
|
||||
EnableScreenSpaceEffect( pEffect );
|
||||
}
|
||||
|
||||
void CScreenSpaceEffectManager::EnableScreenSpaceEffect( IScreenSpaceEffect *pEffect )
|
||||
{
|
||||
if( pEffect )
|
||||
pEffect->Enable( true );
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// CScreenSpaceEffectManager::DisableScreenSpaceEffect
|
||||
// - Disables the specified effect
|
||||
//---------------------------------------------------------------------------------------
|
||||
void CScreenSpaceEffectManager::DisableScreenSpaceEffect( const char *pEffectName )
|
||||
{
|
||||
IScreenSpaceEffect *pEffect = GetScreenSpaceEffect( pEffectName );
|
||||
if( pEffect )
|
||||
DisableScreenSpaceEffect( pEffect );
|
||||
}
|
||||
|
||||
void CScreenSpaceEffectManager::DisableScreenSpaceEffect( IScreenSpaceEffect *pEffect )
|
||||
{
|
||||
if( pEffect )
|
||||
pEffect->Enable( false );
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// CScreenSpaceEffectManager::DisableAllScreenSpaceEffects
|
||||
// - Disables all registered screen space effects
|
||||
//---------------------------------------------------------------------------------------
|
||||
void CScreenSpaceEffectManager::DisableAllScreenSpaceEffects( )
|
||||
{
|
||||
for( CScreenSpaceEffectRegistration *pReg=CScreenSpaceEffectRegistration::s_pHead; pReg!=NULL; pReg=pReg->m_pNext )
|
||||
{
|
||||
IScreenSpaceEffect *pEffect = pReg->m_pEffect;
|
||||
if( pEffect )
|
||||
{
|
||||
pEffect->Enable( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// CScreenSpaceEffectManager::RenderEffects
|
||||
// - Renders all registered screen space effects
|
||||
//---------------------------------------------------------------------------------------
|
||||
void CScreenSpaceEffectManager::RenderEffects( int x, int y, int w, int h )
|
||||
{
|
||||
for( CScreenSpaceEffectRegistration *pReg=CScreenSpaceEffectRegistration::s_pHead; pReg!=NULL; pReg=pReg->m_pNext )
|
||||
{
|
||||
IScreenSpaceEffect *pEffect = pReg->m_pEffect;
|
||||
if( pEffect )
|
||||
{
|
||||
pEffect->Render( x, y, w, h );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Example post-processing effect
|
||||
//------------------------------------------------------------------------------
|
||||
class CExampleEffect : public IScreenSpaceEffect
|
||||
{
|
||||
public:
|
||||
CExampleEffect( );
|
||||
~CExampleEffect( );
|
||||
|
||||
void Init( );
|
||||
void Shutdown( );
|
||||
|
||||
void SetParameters( KeyValues *params );
|
||||
|
||||
void Render( int x, int y, int w, int h );
|
||||
|
||||
void Enable( bool bEnable );
|
||||
bool IsEnabled( );
|
||||
|
||||
private:
|
||||
|
||||
bool m_bEnable;
|
||||
|
||||
CMaterialReference m_Material;
|
||||
};
|
||||
|
||||
ADD_SCREENSPACE_EFFECT( CExampleEffect, exampleeffect );
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CExampleEffect constructor
|
||||
//------------------------------------------------------------------------------
|
||||
CExampleEffect::CExampleEffect( )
|
||||
{
|
||||
m_bEnable = false;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CExampleEffect destructor
|
||||
//------------------------------------------------------------------------------
|
||||
CExampleEffect::~CExampleEffect( )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CExampleEffect init
|
||||
//------------------------------------------------------------------------------
|
||||
void CExampleEffect::Init( )
|
||||
{
|
||||
// This is just example code, init your effect material here
|
||||
//m_Material.Init( "engine/exampleeffect", TEXTURE_GROUP_OTHER );
|
||||
|
||||
m_bEnable = false;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CExampleEffect shutdown
|
||||
//------------------------------------------------------------------------------
|
||||
void CExampleEffect::Shutdown( )
|
||||
{
|
||||
m_Material.Shutdown();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CExampleEffect enable
|
||||
//------------------------------------------------------------------------------
|
||||
void CExampleEffect::Enable( bool bEnable )
|
||||
{
|
||||
// This is just example code, don't enable it
|
||||
// m_bEnable = bEnable;
|
||||
}
|
||||
|
||||
bool CExampleEffect::IsEnabled( )
|
||||
{
|
||||
return m_bEnable;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CExampleEffect SetParameters
|
||||
//------------------------------------------------------------------------------
|
||||
void CExampleEffect::SetParameters( KeyValues *params )
|
||||
{
|
||||
if( params->GetDataType( "example_param" ) == KeyValues::TYPE_STRING )
|
||||
{
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// CExampleEffect render
|
||||
//------------------------------------------------------------------------------
|
||||
void CExampleEffect::Render( int x, int y, int w, int h )
|
||||
{
|
||||
if ( !IsEnabled() )
|
||||
return;
|
||||
|
||||
// Render Effect
|
||||
Rect_t actualRect;
|
||||
UpdateScreenEffectTexture( 0, x, y, w, h, false, &actualRect );
|
||||
ITexture *pTexture = GetFullFrameFrameBufferTexture( 0 );
|
||||
|
||||
CMatRenderContextPtr pRenderContext( materials );
|
||||
|
||||
pRenderContext->DrawScreenSpaceRectangle( m_Material, x, y, w, h,
|
||||
actualRect.x, actualRect.y, actualRect.x+actualRect.width-1, actualRect.y+actualRect.height-1,
|
||||
pTexture->GetActualWidth(), pTexture->GetActualHeight() );
|
||||
}
|
88
game/client/ScreenSpaceEffects.h
Normal file
88
game/client/ScreenSpaceEffects.h
Normal file
@ -0,0 +1,88 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//
|
||||
//=====================================================================================//
|
||||
|
||||
#ifndef SCREENSPACEEFFECTS_H
|
||||
#define SCREENSPACEEFFECTS_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
class KeyValues;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Simple base class for screen space post-processing effects
|
||||
//------------------------------------------------------------------------------
|
||||
abstract_class IScreenSpaceEffect
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Init( ) = 0;
|
||||
virtual void Shutdown( ) = 0;
|
||||
|
||||
virtual void SetParameters( KeyValues *params ) = 0;
|
||||
|
||||
virtual void Render( int x, int y, int w, int h ) = 0;
|
||||
|
||||
virtual void Enable( bool bEnable ) = 0;
|
||||
virtual bool IsEnabled( ) = 0;
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Interface class for managing screen space post-processing effects
|
||||
//------------------------------------------------------------------------------
|
||||
abstract_class IScreenSpaceEffectManager
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void InitScreenSpaceEffects( ) = 0;
|
||||
virtual void ShutdownScreenSpaceEffects( ) = 0;
|
||||
|
||||
virtual IScreenSpaceEffect *GetScreenSpaceEffect( const char *pEffectName ) = 0;
|
||||
|
||||
virtual void SetScreenSpaceEffectParams( const char *pEffectName, KeyValues *params ) = 0;
|
||||
virtual void SetScreenSpaceEffectParams( IScreenSpaceEffect *pEffect, KeyValues *params ) = 0;
|
||||
|
||||
virtual void EnableScreenSpaceEffect( const char *pEffectName ) = 0;
|
||||
virtual void EnableScreenSpaceEffect( IScreenSpaceEffect *pEffect ) = 0;
|
||||
|
||||
virtual void DisableScreenSpaceEffect( const char *pEffectName ) = 0;
|
||||
virtual void DisableScreenSpaceEffect( IScreenSpaceEffect *pEffect ) = 0;
|
||||
|
||||
virtual void DisableAllScreenSpaceEffects( ) = 0;
|
||||
|
||||
virtual void RenderEffects( int x, int y, int w, int h ) = 0;
|
||||
};
|
||||
|
||||
extern IScreenSpaceEffectManager *g_pScreenSpaceEffects;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Registration class for adding screen space effects to the IScreenSpaceEffectManager
|
||||
//-------------------------------------------------------------------------------------
|
||||
class CScreenSpaceEffectRegistration
|
||||
{
|
||||
public:
|
||||
CScreenSpaceEffectRegistration( const char *pName, IScreenSpaceEffect *pEffect );
|
||||
|
||||
const char *m_pEffectName;
|
||||
IScreenSpaceEffect *m_pEffect;
|
||||
|
||||
CScreenSpaceEffectRegistration *m_pNext;
|
||||
|
||||
static CScreenSpaceEffectRegistration *s_pHead;
|
||||
};
|
||||
|
||||
#define ADD_SCREENSPACE_EFFECT( CEffect, pEffectName ) CEffect pEffectName##_effect; \
|
||||
CScreenSpaceEffectRegistration pEffectName##_reg( #pEffectName, &pEffectName##_effect );
|
||||
|
||||
|
||||
|
||||
#endif
|
172
game/client/TeamBitmapImage.cpp
Normal file
172
game/client/TeamBitmapImage.cpp
Normal file
@ -0,0 +1,172 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: This is a panel which is rendered image on top of an entity
|
||||
//
|
||||
// $Revision: $
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "cbase.h"
|
||||
#include "TeamBitmapImage.h"
|
||||
#include <KeyValues.h>
|
||||
#include "vgui_bitmapimage.h"
|
||||
#include "panelmetaclassmgr.h"
|
||||
#include "VGuiMatSurface/IMatSystemSurface.h"
|
||||
#include <vgui_controls/Panel.h>
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A multiplexer bitmap that chooses a bitmap based on team
|
||||
//-----------------------------------------------------------------------------
|
||||
CTeamBitmapImage::CTeamBitmapImage() : m_Alpha(1.0f)
|
||||
{
|
||||
memset( m_ppImage, 0, BITMAP_COUNT * sizeof(BitmapImage*) );
|
||||
m_pEntity = NULL;
|
||||
m_bRelativeTeams = 0;
|
||||
}
|
||||
|
||||
CTeamBitmapImage::~CTeamBitmapImage()
|
||||
{
|
||||
int i;
|
||||
for ( i = 0; i < BITMAP_COUNT; ++i )
|
||||
{
|
||||
if (m_ppImage[i])
|
||||
delete m_ppImage[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// initialization
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CTeamBitmapImage::Init( vgui::Panel *pParent, KeyValues* pInitData, C_BaseEntity* pEntity )
|
||||
{
|
||||
static const char *pRelativeTeamNames[BITMAP_COUNT] =
|
||||
{
|
||||
"NoTeam",
|
||||
"MyTeam",
|
||||
"EnemyTeam",
|
||||
};
|
||||
|
||||
static const char *pAbsoluteTeamNames[BITMAP_COUNT] =
|
||||
{
|
||||
"Team0",
|
||||
"Team1",
|
||||
"Team2",
|
||||
};
|
||||
|
||||
m_pEntity = pEntity;
|
||||
m_bRelativeTeams = (pInitData->GetInt( "relativeteam" ) != 0);
|
||||
|
||||
const char **ppTeamNames = m_bRelativeTeams ? pRelativeTeamNames : pAbsoluteTeamNames;
|
||||
|
||||
int i;
|
||||
for ( i = 0 ; i < BITMAP_COUNT; ++i )
|
||||
{
|
||||
// Default to null
|
||||
m_ppImage[i] = NULL;
|
||||
|
||||
// Look for team section
|
||||
KeyValues *pTeamKV = pInitData->FindKey( ppTeamNames[i] );
|
||||
if ( !pTeamKV )
|
||||
continue;
|
||||
|
||||
char const* pClassImage = pTeamKV->GetString( "material" );
|
||||
if ( !pClassImage || !pClassImage[ 0 ] )
|
||||
return false;
|
||||
|
||||
// modulation color
|
||||
Color color;
|
||||
if (!ParseRGBA( pTeamKV, "color", color ))
|
||||
color.SetColor( 255, 255, 255, 255 );
|
||||
|
||||
// hook in the bitmap
|
||||
m_ppImage[i] = new BitmapImage( pParent->GetVPanel(), pClassImage );
|
||||
m_ppImage[i]->SetColor( color );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Alpha modulate...
|
||||
//-----------------------------------------------------------------------------
|
||||
void CTeamBitmapImage::SetAlpha( float alpha )
|
||||
{
|
||||
m_Alpha = clamp( alpha, 0.0f, 1.0f );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// draw
|
||||
//-----------------------------------------------------------------------------
|
||||
void CTeamBitmapImage::Paint( float yaw /*= 0.0f*/ )
|
||||
{
|
||||
if (m_Alpha == 0.0f)
|
||||
return;
|
||||
|
||||
int team = 0;
|
||||
if (m_bRelativeTeams)
|
||||
{
|
||||
if (GetEntity())
|
||||
{
|
||||
if (GetEntity()->GetTeamNumber() != 0)
|
||||
{
|
||||
team = GetEntity()->InLocalTeam() ? 1 : 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetEntity())
|
||||
team = GetEntity()->GetTeamNumber();
|
||||
}
|
||||
|
||||
// Paint the image for the current team
|
||||
if (m_ppImage[team])
|
||||
{
|
||||
// Modulate the color based on the alpha....
|
||||
Color color = m_ppImage[team]->GetColor();
|
||||
int alpha = color[3];
|
||||
color[3] = (alpha * m_Alpha);
|
||||
m_ppImage[team]->SetColor( color );
|
||||
|
||||
if ( yaw != 0.0f )
|
||||
{
|
||||
g_pMatSystemSurface->DisableClipping( true );
|
||||
|
||||
m_ppImage[team]->DoPaint( m_ppImage[team]->GetRenderSizePanel(), yaw );
|
||||
|
||||
g_pMatSystemSurface->DisableClipping( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Paint
|
||||
m_ppImage[team]->Paint();
|
||||
}
|
||||
|
||||
// restore previous color
|
||||
color[3] = alpha;
|
||||
m_ppImage[team]->SetColor( color );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helper method to initialize a team image from KeyValues data..
|
||||
//-----------------------------------------------------------------------------
|
||||
bool InitializeTeamImage( KeyValues *pInitData, const char* pSectionName, vgui::Panel *pParent, C_BaseEntity *pEntity, CTeamBitmapImage* pTeamImage )
|
||||
{
|
||||
KeyValues *pTeamImageSection = pInitData;
|
||||
if (pSectionName)
|
||||
{
|
||||
pTeamImageSection = pInitData->FindKey( pSectionName );
|
||||
if ( !pTeamImageSection )
|
||||
return false;
|
||||
}
|
||||
|
||||
return pTeamImage->Init( pParent, pTeamImageSection, pEntity );
|
||||
}
|
||||
|
80
game/client/TeamBitmapImage.h
Normal file
80
game/client/TeamBitmapImage.h
Normal file
@ -0,0 +1,80 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: This is a panel which is rendered image on top of an entity
|
||||
//
|
||||
// $Revision: $
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef TEAMBITMAPIMAGE_H
|
||||
#define TEAMBITMAPIMAGE_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
//#include "tf_shareddefs.h"
|
||||
|
||||
#include <vgui/VGUI.h>
|
||||
|
||||
namespace vgui
|
||||
{
|
||||
class Panel;
|
||||
}
|
||||
|
||||
class BitmapImage;
|
||||
class C_BaseEntity;
|
||||
class KeyValues;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A multiplexer bitmap that chooses a bitmap based on team
|
||||
//-----------------------------------------------------------------------------
|
||||
class CTeamBitmapImage
|
||||
{
|
||||
public:
|
||||
// construction, destruction
|
||||
CTeamBitmapImage();
|
||||
~CTeamBitmapImage();
|
||||
|
||||
// initialization
|
||||
bool Init( vgui::Panel *pParent, KeyValues* pInitData, C_BaseEntity* pEntity );
|
||||
|
||||
// Alpha override...
|
||||
void SetAlpha( float alpha );
|
||||
|
||||
// Paint the sucka. Paint it the size of the parent panel
|
||||
void Paint( float yaw = 0.0f );
|
||||
|
||||
protected:
|
||||
// Wrapper so we can implement this with EHANDLES some day
|
||||
C_BaseEntity *GetEntity() { return m_pEntity; }
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
// NOTE: Was MAX_TF_TEAMS not 4, but I don't like the dependency here.
|
||||
BITMAP_COUNT = 4 + 1
|
||||
};
|
||||
|
||||
BitmapImage *m_ppImage[ BITMAP_COUNT ];
|
||||
C_BaseEntity *m_pEntity;
|
||||
float m_Alpha;
|
||||
bool m_bRelativeTeams;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helper method to initialize a team image from KeyValues data..
|
||||
// KeyValues contains the bitmap data. pSectionName, if it exists,
|
||||
// indicates which subsection of pInitData should be looked at to get at the
|
||||
// image data. The final argument is the bitmap image to initialize.
|
||||
// The function returns true if it succeeded.
|
||||
//
|
||||
// NOTE: This function looks for the key values 'material' and 'color'
|
||||
// and uses them to set up the material + modulation color of the image
|
||||
//-----------------------------------------------------------------------------
|
||||
bool InitializeTeamImage( KeyValues *pInitData, const char* pSectionName,
|
||||
vgui::Panel *pParent, C_BaseEntity *pEntity, CTeamBitmapImage* pBitmapImage );
|
||||
|
||||
|
||||
#endif // TEAMBITMAPIMAGE_H
|
83
game/client/ViewConeImage.cpp
Normal file
83
game/client/ViewConeImage.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: This is a panel which is rendered image on top of an entity
|
||||
//
|
||||
// $Revision: $
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "cbase.h"
|
||||
#include "ViewConeImage.h"
|
||||
#include <KeyValues.h>
|
||||
#include <vgui_controls/Panel.h>
|
||||
#include "VGuiMatSurface/IMatSystemSurface.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// initialization
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CViewConeImage::Init( vgui::Panel *pParent, KeyValues* pInitData )
|
||||
{
|
||||
Assert( pParent );
|
||||
|
||||
// Load viewcone material
|
||||
if (!m_Image.Init( pParent->GetVPanel(), pInitData ))
|
||||
return false;
|
||||
|
||||
// Position the view cone...
|
||||
int viewconesize = pInitData->GetInt( "size", 32 );
|
||||
m_Image.SetRenderSize( viewconesize, viewconesize );
|
||||
|
||||
int cx, cy;
|
||||
pParent->GetSize( cx, cy );
|
||||
m_Image.SetPos( (cx - viewconesize) / 2, (cy - viewconesize) / 2 );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Paint the sucka
|
||||
//-----------------------------------------------------------------------------
|
||||
void CViewConeImage::Paint( float yaw )
|
||||
{
|
||||
g_pMatSystemSurface->DisableClipping( true );
|
||||
|
||||
m_Image.DoPaint( NULL, yaw );
|
||||
|
||||
g_pMatSystemSurface->DisableClipping( false );
|
||||
}
|
||||
|
||||
void CViewConeImage::SetColor( int r, int g, int b )
|
||||
{
|
||||
m_Image.SetColor( Color( r, g, b, 255 ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helper method to initialize a view cone image from KeyValues data..
|
||||
// KeyValues contains the bitmap data, pSectionName, if it exists,
|
||||
// indicates which subsection of pInitData should be looked at to get at the
|
||||
// image data. The final argument is the bitmap image to initialize.
|
||||
// The function returns true if it succeeded.
|
||||
//
|
||||
// NOTE: This function looks for the key values 'material' and 'color'
|
||||
// and uses them to set up the material + modulation color of the image
|
||||
//-----------------------------------------------------------------------------
|
||||
bool InitializeViewConeImage( KeyValues *pInitData, const char* pSectionName,
|
||||
vgui::Panel *pParent, CViewConeImage* pViewConeImage )
|
||||
{
|
||||
KeyValues *pViewConeImageSection;
|
||||
if (pSectionName)
|
||||
{
|
||||
pViewConeImageSection = pInitData->FindKey( pSectionName );
|
||||
if ( !pViewConeImageSection )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
pViewConeImageSection = pInitData;
|
||||
}
|
||||
|
||||
return pViewConeImage->Init( pParent, pViewConeImageSection );
|
||||
}
|
||||
|
56
game/client/ViewConeImage.h
Normal file
56
game/client/ViewConeImage.h
Normal file
@ -0,0 +1,56 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: This is a panel which draws a viewcone
|
||||
//
|
||||
// $Revision: $
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef VIEWCONEIMAGE_H
|
||||
#define VIEWCONEIMAGE_H
|
||||
|
||||
#include "shareddefs.h"
|
||||
#include "vgui_bitmapimage.h"
|
||||
|
||||
namespace vgui
|
||||
{
|
||||
class Panel;
|
||||
}
|
||||
|
||||
class C_BaseEntity;
|
||||
class KeyValues;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A bitmap that renders a view cone based on angles
|
||||
//-----------------------------------------------------------------------------
|
||||
class CViewConeImage
|
||||
{
|
||||
public:
|
||||
// initialization
|
||||
bool Init( vgui::Panel *pParent, KeyValues* pInitData );
|
||||
|
||||
// Paint the sucka
|
||||
void Paint( float yaw );
|
||||
|
||||
void SetColor( int r, int g, int b );
|
||||
|
||||
private:
|
||||
BitmapImage m_Image;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helper method to initialize a view cone image from KeyValues data..
|
||||
// KeyValues contains the bitmap data, pSectionName, if it exists,
|
||||
// indicates which subsection of pInitData should be looked at to get at the
|
||||
// image data. The final argument is the bitmap image to initialize.
|
||||
// The function returns true if it succeeded.
|
||||
//
|
||||
// NOTE: This function looks for the key values 'material' and 'color'
|
||||
// and uses them to set up the material + modulation color of the image
|
||||
//-----------------------------------------------------------------------------
|
||||
bool InitializeViewConeImage( KeyValues *pInitData, const char* pSectionName,
|
||||
vgui::Panel *pParent, CViewConeImage* pViewConeImage );
|
||||
|
||||
|
||||
#endif // VIEWCONEIMAGE_H
|
83
game/client/WaterLODMaterialProxy.cpp
Normal file
83
game/client/WaterLODMaterialProxy.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "cbase.h"
|
||||
#include "materialsystem/imaterialproxy.h"
|
||||
#include "materialsystem/imaterial.h"
|
||||
#include "materialsystem/imaterialvar.h"
|
||||
#include "iviewrender.h"
|
||||
#include "toolframework_client.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
// forward declarations
|
||||
void ToolFramework_RecordMaterialParams( IMaterial *pMaterial );
|
||||
|
||||
// no inputs, assumes that the results go into $CHEAPWATERSTARTDISTANCE and $CHEAPWATERENDDISTANCE
|
||||
class CWaterLODMaterialProxy : public IMaterialProxy
|
||||
{
|
||||
public:
|
||||
CWaterLODMaterialProxy();
|
||||
virtual ~CWaterLODMaterialProxy();
|
||||
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
|
||||
virtual void OnBind( void *pC_BaseEntity );
|
||||
virtual void Release( void ) { delete this; }
|
||||
virtual IMaterial *GetMaterial();
|
||||
|
||||
private:
|
||||
IMaterialVar *m_pCheapWaterStartDistanceVar;
|
||||
IMaterialVar *m_pCheapWaterEndDistanceVar;
|
||||
};
|
||||
|
||||
CWaterLODMaterialProxy::CWaterLODMaterialProxy()
|
||||
{
|
||||
m_pCheapWaterStartDistanceVar = NULL;
|
||||
m_pCheapWaterEndDistanceVar = NULL;
|
||||
}
|
||||
|
||||
CWaterLODMaterialProxy::~CWaterLODMaterialProxy()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool CWaterLODMaterialProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
|
||||
{
|
||||
bool foundVar;
|
||||
m_pCheapWaterStartDistanceVar = pMaterial->FindVar( "$CHEAPWATERSTARTDISTANCE", &foundVar, false );
|
||||
if( !foundVar )
|
||||
return false;
|
||||
|
||||
m_pCheapWaterEndDistanceVar = pMaterial->FindVar( "$CHEAPWATERENDDISTANCE", &foundVar, false );
|
||||
if( !foundVar )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CWaterLODMaterialProxy::OnBind( void *pC_BaseEntity )
|
||||
{
|
||||
if( !m_pCheapWaterStartDistanceVar || !m_pCheapWaterEndDistanceVar )
|
||||
{
|
||||
return;
|
||||
}
|
||||
float start, end;
|
||||
view->GetWaterLODParams( start, end );
|
||||
m_pCheapWaterStartDistanceVar->SetFloatValue( start );
|
||||
m_pCheapWaterEndDistanceVar->SetFloatValue( end );
|
||||
|
||||
if ( ToolsEnabled() )
|
||||
{
|
||||
ToolFramework_RecordMaterialParams( GetMaterial() );
|
||||
}
|
||||
}
|
||||
|
||||
IMaterial *CWaterLODMaterialProxy::GetMaterial()
|
||||
{
|
||||
return m_pCheapWaterStartDistanceVar->GetOwningMaterial();
|
||||
}
|
||||
|
||||
EXPOSE_INTERFACE( CWaterLODMaterialProxy, IMaterialProxy, "WaterLOD" IMATERIAL_PROXY_INTERFACE_VERSION );
|
78
game/client/WorldDimsProxy.cpp
Normal file
78
game/client/WorldDimsProxy.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include "cbase.h"
|
||||
#include "materialsystem/imaterialproxy.h"
|
||||
#include "materialsystem/imaterial.h"
|
||||
#include "materialsystem/imaterialvar.h"
|
||||
#include "c_world.h"
|
||||
#include "toolframework_client.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
// forward declarations
|
||||
void ToolFramework_RecordMaterialParams( IMaterial *pMaterial );
|
||||
|
||||
class CWorldDimsProxy : public IMaterialProxy
|
||||
{
|
||||
public:
|
||||
CWorldDimsProxy();
|
||||
virtual ~CWorldDimsProxy();
|
||||
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
|
||||
virtual void OnBind( void *pC_BaseEntity );
|
||||
virtual void Release( void ) { delete this; }
|
||||
virtual IMaterial *GetMaterial();
|
||||
|
||||
|
||||
public:
|
||||
IMaterialVar *m_pMinsVar;
|
||||
IMaterialVar *m_pMaxsVar;
|
||||
};
|
||||
|
||||
|
||||
CWorldDimsProxy::CWorldDimsProxy()
|
||||
{
|
||||
m_pMinsVar = m_pMaxsVar = NULL;
|
||||
}
|
||||
|
||||
CWorldDimsProxy::~CWorldDimsProxy()
|
||||
{
|
||||
}
|
||||
|
||||
bool CWorldDimsProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
|
||||
{
|
||||
m_pMinsVar = pMaterial->FindVar( "$world_mins", NULL, false );
|
||||
m_pMaxsVar = pMaterial->FindVar( "$world_maxs", NULL, false );
|
||||
return true;
|
||||
}
|
||||
|
||||
void CWorldDimsProxy::OnBind( void *pC_BaseEntity )
|
||||
{
|
||||
if ( m_pMinsVar && m_pMaxsVar )
|
||||
{
|
||||
C_World *pWorld = GetClientWorldEntity();
|
||||
if ( pWorld )
|
||||
{
|
||||
m_pMinsVar->SetVecValue( (const float*)&pWorld->m_WorldMins, 3 );
|
||||
m_pMaxsVar->SetVecValue( (const float*)&pWorld->m_WorldMaxs, 3 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ToolsEnabled() )
|
||||
{
|
||||
ToolFramework_RecordMaterialParams( GetMaterial() );
|
||||
}
|
||||
}
|
||||
|
||||
IMaterial *CWorldDimsProxy::GetMaterial()
|
||||
{
|
||||
return m_pMinsVar->GetOwningMaterial();
|
||||
}
|
||||
|
||||
EXPOSE_INTERFACE( CWorldDimsProxy, IMaterialProxy, "WorldDims" IMATERIAL_PROXY_INTERFACE_VERSION );
|
||||
|
||||
|
272
game/client/achievement_notification_panel.cpp
Normal file
272
game/client/achievement_notification_panel.cpp
Normal file
@ -0,0 +1,272 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#include "cbase.h"
|
||||
#include "hud.h"
|
||||
#include "hud_macros.h"
|
||||
#include "hudelement.h"
|
||||
#include "iclientmode.h"
|
||||
#include "ienginevgui.h"
|
||||
#include <vgui/ILocalize.h>
|
||||
#include <vgui/ISurface.h>
|
||||
#include <vgui/IVGui.h>
|
||||
#include <vgui_controls/EditablePanel.h>
|
||||
#include <vgui_controls/Label.h>
|
||||
#include <vgui_controls/ImagePanel.h>
|
||||
#include "achievement_notification_panel.h"
|
||||
#include "steam/steam_api.h"
|
||||
#include "iachievementmgr.h"
|
||||
#include "fmtstr.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
using namespace vgui;
|
||||
|
||||
#define ACHIEVEMENT_NOTIFICATION_DURATION 10.0f
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DECLARE_HUDELEMENT_DEPTH( CAchievementNotificationPanel, 100 );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
CAchievementNotificationPanel::CAchievementNotificationPanel( const char *pElementName ) : CHudElement( pElementName ), BaseClass( NULL, "AchievementNotificationPanel" )
|
||||
{
|
||||
Panel *pParent = g_pClientMode->GetViewport();
|
||||
SetParent( pParent );
|
||||
|
||||
m_flHideTime = 0;
|
||||
m_pPanelBackground = new EditablePanel( this, "Notification_Background" );
|
||||
m_pIcon = new ImagePanel( this, "Notification_Icon" );
|
||||
m_pLabelHeading = new Label( this, "HeadingLabel", "" );
|
||||
m_pLabelTitle = new Label( this, "TitleLabel", "" );
|
||||
|
||||
m_pIcon->SetShouldScaleImage( true );
|
||||
|
||||
vgui::ivgui()->AddTickSignal( GetVPanel() );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAchievementNotificationPanel::Init()
|
||||
{
|
||||
ListenForGameEvent( "achievement_event" );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAchievementNotificationPanel::ApplySchemeSettings( IScheme *pScheme )
|
||||
{
|
||||
// load control settings...
|
||||
LoadControlSettings( "resource/UI/AchievementNotification.res" );
|
||||
|
||||
BaseClass::ApplySchemeSettings( pScheme );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAchievementNotificationPanel::PerformLayout( void )
|
||||
{
|
||||
BaseClass::PerformLayout();
|
||||
|
||||
// Set background color of various elements. Need to do this in code, if we do it in res file it gets slammed by the
|
||||
// scheme. (Incl. label background: some products don't have label background colors set in their scheme and helpfully slam it to white.)
|
||||
SetBgColor( Color( 0, 0, 0, 0 ) );
|
||||
m_pLabelHeading->SetBgColor( Color( 0, 0, 0, 0 ) );
|
||||
m_pLabelTitle->SetBgColor( Color( 0, 0, 0, 0 ) );
|
||||
m_pPanelBackground->SetBgColor( Color( 62,70,55, 200 ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAchievementNotificationPanel::FireGameEvent( IGameEvent * event )
|
||||
{
|
||||
const char *name = event->GetName();
|
||||
if ( 0 == Q_strcmp( name, "achievement_event" ) )
|
||||
{
|
||||
const char *pchName = event->GetString( "achievement_name" );
|
||||
int iCur = event->GetInt( "cur_val" );
|
||||
int iMax = event->GetInt( "max_val" );
|
||||
wchar_t szLocalizedName[256]=L"";
|
||||
|
||||
if ( IsPC() )
|
||||
{
|
||||
// shouldn't ever get achievement progress if steam not running and user logged in, but check just in case
|
||||
if ( !steamapicontext->SteamUserStats() )
|
||||
{
|
||||
Msg( "Steam not running, achievement progress notification not displayed\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// use Steam to show achievement progress UI
|
||||
steamapicontext->SteamUserStats()->IndicateAchievementProgress( pchName, iCur, iMax );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// on X360 we need to show our own achievement progress UI
|
||||
|
||||
const wchar_t *pchLocalizedName = ACHIEVEMENT_LOCALIZED_NAME_FROM_STR( pchName );
|
||||
Assert( pchLocalizedName );
|
||||
if ( !pchLocalizedName || !pchLocalizedName[0] )
|
||||
return;
|
||||
Q_wcsncpy( szLocalizedName, pchLocalizedName, sizeof( szLocalizedName ) );
|
||||
|
||||
// this is achievement progress, compose the message of form: "<name> (<#>/<max>)"
|
||||
wchar_t szFmt[128]=L"";
|
||||
wchar_t szText[512]=L"";
|
||||
wchar_t szNumFound[16]=L"";
|
||||
wchar_t szNumTotal[16]=L"";
|
||||
_snwprintf( szNumFound, ARRAYSIZE( szNumFound ), L"%i", iCur );
|
||||
_snwprintf( szNumTotal, ARRAYSIZE( szNumTotal ), L"%i", iMax );
|
||||
|
||||
const wchar_t *pchFmt = g_pVGuiLocalize->Find( "#GameUI_Achievement_Progress_Fmt" );
|
||||
if ( !pchFmt || !pchFmt[0] )
|
||||
return;
|
||||
Q_wcsncpy( szFmt, pchFmt, sizeof( szFmt ) );
|
||||
|
||||
g_pVGuiLocalize->ConstructString( szText, sizeof( szText ), szFmt, 3, szLocalizedName, szNumFound, szNumTotal );
|
||||
AddNotification( pchName, g_pVGuiLocalize->Find( "#GameUI_Achievement_Progress" ), szText );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Called on each tick
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAchievementNotificationPanel::OnTick( void )
|
||||
{
|
||||
if ( ( m_flHideTime > 0 ) && ( m_flHideTime < gpGlobals->curtime ) )
|
||||
{
|
||||
m_flHideTime = 0;
|
||||
ShowNextNotification();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CAchievementNotificationPanel::ShouldDraw( void )
|
||||
{
|
||||
return ( ( m_flHideTime > 0 ) && ( m_flHideTime > gpGlobals->curtime ) && CHudElement::ShouldDraw() );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAchievementNotificationPanel::AddNotification( const char *szIconBaseName, const wchar_t *pHeading, const wchar_t *pTitle )
|
||||
{
|
||||
// put this notification in our queue
|
||||
int iQueueItem = m_queueNotification.AddToTail();
|
||||
Notification_t ¬ification = m_queueNotification[iQueueItem];
|
||||
Q_strncpy( notification.szIconBaseName, szIconBaseName, ARRAYSIZE( notification.szIconBaseName ) );
|
||||
Q_wcsncpy( notification.szHeading, pHeading, sizeof( notification.szHeading ) );
|
||||
Q_wcsncpy( notification.szTitle, pTitle, sizeof( notification.szTitle ) );
|
||||
|
||||
// if we are not currently displaying a notification, go ahead and show this one
|
||||
if ( 0 == m_flHideTime )
|
||||
{
|
||||
ShowNextNotification();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Shows next notification in queue if there is one
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAchievementNotificationPanel::ShowNextNotification()
|
||||
{
|
||||
// see if we have anything to do
|
||||
if ( 0 == m_queueNotification.Count() )
|
||||
{
|
||||
m_flHideTime = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
Notification_t ¬ification = m_queueNotification[ m_queueNotification.Head() ];
|
||||
|
||||
m_flHideTime = gpGlobals->curtime + ACHIEVEMENT_NOTIFICATION_DURATION;
|
||||
|
||||
// set the text and icon in the dialog
|
||||
SetDialogVariable( "heading", notification.szHeading );
|
||||
SetDialogVariable( "title", notification.szTitle );
|
||||
const char *pchIconBaseName = notification.szIconBaseName;
|
||||
if ( pchIconBaseName && pchIconBaseName[0] )
|
||||
{
|
||||
m_pIcon->SetImage( CFmtStr( "achievements/%s.vmt", pchIconBaseName ) );
|
||||
}
|
||||
|
||||
// resize the panel so it always looks good
|
||||
|
||||
// get fonts
|
||||
HFont hFontHeading = m_pLabelHeading->GetFont();
|
||||
HFont hFontTitle = m_pLabelTitle->GetFont();
|
||||
// determine how wide the text strings are
|
||||
int iHeadingWidth = UTIL_ComputeStringWidth( hFontHeading, notification.szHeading );
|
||||
int iTitleWidth = UTIL_ComputeStringWidth( hFontTitle, notification.szTitle );
|
||||
// use the widest string
|
||||
int iTextWidth = MAX( iHeadingWidth, iTitleWidth );
|
||||
// don't let it be insanely wide
|
||||
iTextWidth = MIN( iTextWidth, XRES( 300 ) );
|
||||
int iIconWidth = m_pIcon->GetWide();
|
||||
int iSpacing = XRES( 10 );
|
||||
int iPanelWidth = iSpacing + iIconWidth + iSpacing + iTextWidth + iSpacing;
|
||||
int iPanelX = GetWide() - iPanelWidth;
|
||||
int iIconX = iPanelX + iSpacing;
|
||||
int iTextX = iIconX + iIconWidth + iSpacing;
|
||||
// resize all the elements
|
||||
SetXAndWide( m_pPanelBackground, iPanelX, iPanelWidth );
|
||||
SetXAndWide( m_pIcon, iIconX, iIconWidth );
|
||||
SetXAndWide( m_pLabelHeading, iTextX, iTextWidth );
|
||||
SetXAndWide( m_pLabelTitle, iTextX, iTextWidth );
|
||||
|
||||
m_queueNotification.Remove( m_queueNotification.Head() );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAchievementNotificationPanel::SetXAndWide( Panel *pPanel, int x, int wide )
|
||||
{
|
||||
int xCur, yCur;
|
||||
pPanel->GetPos( xCur, yCur );
|
||||
pPanel->SetPos( x, yCur );
|
||||
pPanel->SetWide( wide );
|
||||
}
|
||||
|
||||
CON_COMMAND_F( achievement_notification_test, "Test the hud notification UI", FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY )
|
||||
{
|
||||
static int iCount=0;
|
||||
|
||||
CAchievementNotificationPanel *pPanel = GET_HUDELEMENT( CAchievementNotificationPanel );
|
||||
if ( pPanel )
|
||||
{
|
||||
pPanel->AddNotification( "HL2_KILL_ODESSAGUNSHIP", L"Achievement Progress", ( 0 == ( iCount % 2 ) ? L"Test Notification Message A (1/10)" :
|
||||
L"Test Message B" ) );
|
||||
}
|
||||
|
||||
#if 0
|
||||
IGameEvent *event = gameeventmanager->CreateEvent( "achievement_event" );
|
||||
if ( event )
|
||||
{
|
||||
const char *szTestStr[] = { "TF_GET_HEADSHOTS", "TF_PLAY_GAME_EVERYMAP", "TF_PLAY_GAME_EVERYCLASS", "TF_GET_HEALPOINTS" };
|
||||
event->SetString( "achievement_name", szTestStr[iCount%ARRAYSIZE(szTestStr)] );
|
||||
event->SetInt( "cur_val", ( iCount%9 ) + 1 );
|
||||
event->SetInt( "max_val", 10 );
|
||||
gameeventmanager->FireEvent( event );
|
||||
}
|
||||
#endif
|
||||
|
||||
iCount++;
|
||||
}
|
57
game/client/achievement_notification_panel.h
Normal file
57
game/client/achievement_notification_panel.h
Normal file
@ -0,0 +1,57 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef ACHIEVEMENT_NOTIFICATION_PANEL_H
|
||||
#define ACHIEVEMENT_NOTIFICATION_PANEL_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <vgui_controls/EditablePanel.h>
|
||||
#include "hudelement.h"
|
||||
|
||||
using namespace vgui;
|
||||
|
||||
class CAchievementNotificationPanel : public CHudElement, public EditablePanel
|
||||
{
|
||||
DECLARE_CLASS_SIMPLE( CAchievementNotificationPanel, EditablePanel );
|
||||
|
||||
public:
|
||||
CAchievementNotificationPanel( const char *pElementName );
|
||||
|
||||
virtual void Init();
|
||||
virtual void ApplySchemeSettings( IScheme *scheme );
|
||||
virtual bool ShouldDraw( void );
|
||||
virtual void PerformLayout( void );
|
||||
virtual void LevelInit( void ) { m_flHideTime = 0; }
|
||||
virtual void FireGameEvent( IGameEvent * event );
|
||||
virtual void OnTick( void );
|
||||
|
||||
void AddNotification( const char *szIconBaseName, const wchar_t *pHeading, const wchar_t *pTitle );
|
||||
|
||||
private:
|
||||
void ShowNextNotification();
|
||||
void SetXAndWide( Panel *pPanel, int x, int wide );
|
||||
|
||||
float m_flHideTime;
|
||||
|
||||
Label *m_pLabelHeading;
|
||||
Label *m_pLabelTitle;
|
||||
EditablePanel *m_pPanelBackground;
|
||||
ImagePanel *m_pIcon;
|
||||
|
||||
struct Notification_t
|
||||
{
|
||||
char szIconBaseName[255];
|
||||
wchar_t szHeading[255];
|
||||
wchar_t szTitle[255];
|
||||
};
|
||||
|
||||
CUtlLinkedList<Notification_t> m_queueNotification;
|
||||
};
|
||||
|
||||
#endif // ACHIEVEMENT_NOTIFICATION_PANEL_H
|
62
game/client/alphamaterialproxy.cpp
Normal file
62
game/client/alphamaterialproxy.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "cbase.h"
|
||||
#include "proxyentity.h"
|
||||
#include "materialsystem/imaterial.h"
|
||||
#include "materialsystem/imaterialvar.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
// $sineVar : name of variable that controls the alpha level (float)
|
||||
class CAlphaMaterialProxy : public CEntityMaterialProxy
|
||||
{
|
||||
public:
|
||||
CAlphaMaterialProxy();
|
||||
virtual ~CAlphaMaterialProxy();
|
||||
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
|
||||
virtual void OnBind( C_BaseEntity *pEntity );
|
||||
virtual IMaterial *GetMaterial();
|
||||
|
||||
private:
|
||||
IMaterialVar *m_AlphaVar;
|
||||
};
|
||||
|
||||
CAlphaMaterialProxy::CAlphaMaterialProxy()
|
||||
{
|
||||
m_AlphaVar = NULL;
|
||||
}
|
||||
|
||||
CAlphaMaterialProxy::~CAlphaMaterialProxy()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool CAlphaMaterialProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
|
||||
{
|
||||
bool foundVar;
|
||||
m_AlphaVar = pMaterial->FindVar( "$alpha", &foundVar, false );
|
||||
return foundVar;
|
||||
}
|
||||
|
||||
void CAlphaMaterialProxy::OnBind( C_BaseEntity *pEnt )
|
||||
{
|
||||
if (m_AlphaVar)
|
||||
{
|
||||
m_AlphaVar->SetFloatValue( pEnt->m_clrRender->a );
|
||||
}
|
||||
}
|
||||
|
||||
IMaterial *CAlphaMaterialProxy::GetMaterial()
|
||||
{
|
||||
if ( !m_AlphaVar )
|
||||
return NULL;
|
||||
|
||||
return m_AlphaVar->GetOwningMaterial();
|
||||
}
|
||||
|
||||
EXPOSE_INTERFACE( CAlphaMaterialProxy, IMaterialProxy, "Alpha" IMATERIAL_PROXY_INTERFACE_VERSION );
|
51
game/client/animatedentitytextureproxy.cpp
Normal file
51
game/client/animatedentitytextureproxy.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "cbase.h"
|
||||
#include "baseanimatedtextureproxy.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
class CAnimatedEntityTextureProxy : public CBaseAnimatedTextureProxy
|
||||
{
|
||||
public:
|
||||
CAnimatedEntityTextureProxy() {}
|
||||
virtual ~CAnimatedEntityTextureProxy() {}
|
||||
|
||||
virtual float GetAnimationStartTime( void* pBaseEntity );
|
||||
virtual void AnimationWrapped( void* pC_BaseEntity );
|
||||
|
||||
};
|
||||
|
||||
EXPOSE_INTERFACE( CAnimatedEntityTextureProxy, IMaterialProxy, "AnimatedEntityTexture" IMATERIAL_PROXY_INTERFACE_VERSION );
|
||||
|
||||
float CAnimatedEntityTextureProxy::GetAnimationStartTime( void* pArg )
|
||||
{
|
||||
IClientRenderable *pRend = (IClientRenderable *)pArg;
|
||||
if (!pRend)
|
||||
return 0.0f;
|
||||
|
||||
C_BaseEntity* pEntity = pRend->GetIClientUnknown()->GetBaseEntity();
|
||||
if (pEntity)
|
||||
{
|
||||
return pEntity->GetTextureAnimationStartTime();
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void CAnimatedEntityTextureProxy::AnimationWrapped( void* pArg )
|
||||
{
|
||||
IClientRenderable *pRend = (IClientRenderable *)pArg;
|
||||
if (!pRend)
|
||||
return;
|
||||
|
||||
C_BaseEntity* pEntity = pRend->GetIClientUnknown()->GetBaseEntity();
|
||||
if (pEntity)
|
||||
{
|
||||
pEntity->TextureAnimationWrapped();
|
||||
}
|
||||
}
|
56
game/client/animatedoffsettextureproxy.cpp
Normal file
56
game/client/animatedoffsettextureproxy.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#include "cbase.h"
|
||||
#include "baseanimatedtextureproxy.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
class CAnimatedOffsetTextureProxy : public CBaseAnimatedTextureProxy
|
||||
{
|
||||
public:
|
||||
CAnimatedOffsetTextureProxy() : m_flFrameOffset( 0.0f ) {}
|
||||
|
||||
virtual ~CAnimatedOffsetTextureProxy() {}
|
||||
|
||||
virtual float GetAnimationStartTime( void* pBaseEntity );
|
||||
virtual void OnBind( void *pBaseEntity );
|
||||
|
||||
protected:
|
||||
|
||||
float m_flFrameOffset;
|
||||
};
|
||||
|
||||
EXPOSE_INTERFACE( CAnimatedOffsetTextureProxy, IMaterialProxy, "AnimatedOffsetTexture" IMATERIAL_PROXY_INTERFACE_VERSION );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : pArg -
|
||||
// Output : float
|
||||
//-----------------------------------------------------------------------------
|
||||
float CAnimatedOffsetTextureProxy::GetAnimationStartTime( void* pArg )
|
||||
{
|
||||
return m_flFrameOffset;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *pBaseEntity -
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAnimatedOffsetTextureProxy::OnBind( void *pBaseEntity )
|
||||
{
|
||||
C_BaseEntity* pEntity = (C_BaseEntity*)pBaseEntity;
|
||||
|
||||
if ( pEntity )
|
||||
{
|
||||
m_flFrameOffset = pEntity->GetTextureAnimationStartTime();
|
||||
}
|
||||
|
||||
// Call into the base class
|
||||
CBaseAnimatedTextureProxy::OnBind( pBaseEntity );
|
||||
}
|
||||
|
29
game/client/animatedtextureproxy.cpp
Normal file
29
game/client/animatedtextureproxy.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "cbase.h"
|
||||
#include "baseanimatedtextureproxy.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
class CAnimatedTextureProxy : public CBaseAnimatedTextureProxy
|
||||
{
|
||||
public:
|
||||
CAnimatedTextureProxy() {}
|
||||
virtual ~CAnimatedTextureProxy() {}
|
||||
virtual float GetAnimationStartTime( void* pBaseEntity );
|
||||
};
|
||||
|
||||
EXPOSE_INTERFACE( CAnimatedTextureProxy, IMaterialProxy, "AnimatedTexture" IMATERIAL_PROXY_INTERFACE_VERSION );
|
||||
|
||||
#pragma warning (disable : 4100)
|
||||
|
||||
float CAnimatedTextureProxy::GetAnimationStartTime( void* pBaseEntity )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
213
game/client/animationlayer.h
Normal file
213
game/client/animationlayer.h
Normal file
@ -0,0 +1,213 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef ANIMATIONLAYER_H
|
||||
#define ANIMATIONLAYER_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
#include "rangecheckedvar.h"
|
||||
#include "lerp_functions.h"
|
||||
#include "networkvar.h"
|
||||
|
||||
class C_AnimationLayer
|
||||
{
|
||||
public:
|
||||
|
||||
// This allows the datatables to access private members.
|
||||
ALLOW_DATATABLES_PRIVATE_ACCESS();
|
||||
|
||||
C_AnimationLayer();
|
||||
void Reset();
|
||||
|
||||
void SetOrder( int order );
|
||||
|
||||
public:
|
||||
|
||||
bool IsActive( void );
|
||||
|
||||
CRangeCheckedVar<int, -1, 65535, 0> m_nSequence;
|
||||
CRangeCheckedVar<float, -2, 2, 0> m_flPrevCycle;
|
||||
CRangeCheckedVar<float, -5, 5, 0> m_flWeight;
|
||||
int m_nOrder;
|
||||
|
||||
// used for automatic crossfades between sequence changes
|
||||
CRangeCheckedVar<float, -50, 50, 1> m_flPlaybackRate;
|
||||
CRangeCheckedVar<float, -2, 2, 0> m_flCycle;
|
||||
|
||||
float GetFadeout( float flCurTime );
|
||||
|
||||
void BlendWeight();
|
||||
|
||||
float m_flLayerAnimtime;
|
||||
float m_flLayerFadeOuttime;
|
||||
|
||||
float m_flBlendIn;
|
||||
float m_flBlendOut;
|
||||
|
||||
bool m_bClientBlend;
|
||||
};
|
||||
#ifdef CLIENT_DLL
|
||||
#define CAnimationLayer C_AnimationLayer
|
||||
#endif
|
||||
|
||||
inline C_AnimationLayer::C_AnimationLayer()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
inline void C_AnimationLayer::Reset()
|
||||
{
|
||||
m_nSequence = 0;
|
||||
m_flPrevCycle = 0;
|
||||
m_flWeight = 0;
|
||||
m_flPlaybackRate = 0;
|
||||
m_flCycle = 0;
|
||||
m_flLayerAnimtime = 0;
|
||||
m_flLayerFadeOuttime = 0;
|
||||
m_flBlendIn = 0;
|
||||
m_flBlendOut = 0;
|
||||
m_bClientBlend = false;
|
||||
}
|
||||
|
||||
|
||||
inline void C_AnimationLayer::SetOrder( int order )
|
||||
{
|
||||
m_nOrder = order;
|
||||
}
|
||||
|
||||
inline float C_AnimationLayer::GetFadeout( float flCurTime )
|
||||
{
|
||||
float s;
|
||||
|
||||
if (m_flLayerFadeOuttime <= 0.0f)
|
||||
{
|
||||
s = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// blend in over 0.2 seconds
|
||||
s = 1.0 - (flCurTime - m_flLayerAnimtime) / m_flLayerFadeOuttime;
|
||||
if (s > 0 && s <= 1.0)
|
||||
{
|
||||
// do a nice spline curve
|
||||
s = 3 * s * s - 2 * s * s * s;
|
||||
}
|
||||
else if ( s > 1.0f )
|
||||
{
|
||||
// Shouldn't happen, but maybe curtime is behind animtime?
|
||||
s = 1.0f;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
inline C_AnimationLayer LoopingLerp( float flPercent, C_AnimationLayer& from, C_AnimationLayer& to )
|
||||
{
|
||||
C_AnimationLayer output;
|
||||
|
||||
output.m_nSequence = to.m_nSequence;
|
||||
output.m_flCycle = LoopingLerp( flPercent, (float)from.m_flCycle, (float)to.m_flCycle );
|
||||
output.m_flPrevCycle = to.m_flPrevCycle;
|
||||
output.m_flWeight = Lerp( flPercent, from.m_flWeight, to.m_flWeight );
|
||||
output.m_nOrder = to.m_nOrder;
|
||||
|
||||
output.m_flLayerAnimtime = to.m_flLayerAnimtime;
|
||||
output.m_flLayerFadeOuttime = to.m_flLayerFadeOuttime;
|
||||
return output;
|
||||
}
|
||||
|
||||
inline C_AnimationLayer Lerp( float flPercent, const C_AnimationLayer& from, const C_AnimationLayer& to )
|
||||
{
|
||||
C_AnimationLayer output;
|
||||
|
||||
output.m_nSequence = to.m_nSequence;
|
||||
output.m_flCycle = Lerp( flPercent, from.m_flCycle, to.m_flCycle );
|
||||
output.m_flPrevCycle = to.m_flPrevCycle;
|
||||
output.m_flWeight = Lerp( flPercent, from.m_flWeight, to.m_flWeight );
|
||||
output.m_nOrder = to.m_nOrder;
|
||||
|
||||
output.m_flLayerAnimtime = to.m_flLayerAnimtime;
|
||||
output.m_flLayerFadeOuttime = to.m_flLayerFadeOuttime;
|
||||
return output;
|
||||
}
|
||||
|
||||
inline C_AnimationLayer LoopingLerp_Hermite( float flPercent, C_AnimationLayer& prev, C_AnimationLayer& from, C_AnimationLayer& to )
|
||||
{
|
||||
C_AnimationLayer output;
|
||||
|
||||
output.m_nSequence = to.m_nSequence;
|
||||
output.m_flCycle = LoopingLerp_Hermite( flPercent, (float)prev.m_flCycle, (float)from.m_flCycle, (float)to.m_flCycle );
|
||||
output.m_flPrevCycle = to.m_flPrevCycle;
|
||||
output.m_flWeight = Lerp( flPercent, from.m_flWeight, to.m_flWeight );
|
||||
output.m_nOrder = to.m_nOrder;
|
||||
|
||||
output.m_flLayerAnimtime = to.m_flLayerAnimtime;
|
||||
output.m_flLayerFadeOuttime = to.m_flLayerFadeOuttime;
|
||||
return output;
|
||||
}
|
||||
|
||||
// YWB: Specialization for interpolating euler angles via quaternions...
|
||||
inline C_AnimationLayer Lerp_Hermite( float flPercent, const C_AnimationLayer& prev, const C_AnimationLayer& from, const C_AnimationLayer& to )
|
||||
{
|
||||
C_AnimationLayer output;
|
||||
|
||||
output.m_nSequence = to.m_nSequence;
|
||||
output.m_flCycle = Lerp_Hermite( flPercent, prev.m_flCycle, from.m_flCycle, to.m_flCycle );
|
||||
output.m_flPrevCycle = to.m_flPrevCycle;
|
||||
output.m_flWeight = Lerp( flPercent, from.m_flWeight, to.m_flWeight );
|
||||
output.m_nOrder = to.m_nOrder;
|
||||
|
||||
output.m_flLayerAnimtime = to.m_flLayerAnimtime;
|
||||
output.m_flLayerFadeOuttime = to.m_flLayerFadeOuttime;
|
||||
return output;
|
||||
}
|
||||
|
||||
inline void Lerp_Clamp( C_AnimationLayer &val )
|
||||
{
|
||||
Lerp_Clamp( val.m_nSequence );
|
||||
Lerp_Clamp( val.m_flCycle );
|
||||
Lerp_Clamp( val.m_flPrevCycle );
|
||||
Lerp_Clamp( val.m_flWeight );
|
||||
Lerp_Clamp( val.m_nOrder );
|
||||
Lerp_Clamp( val.m_flLayerAnimtime );
|
||||
Lerp_Clamp( val.m_flLayerFadeOuttime );
|
||||
}
|
||||
|
||||
inline void C_AnimationLayer::BlendWeight()
|
||||
{
|
||||
if ( !m_bClientBlend )
|
||||
return;
|
||||
|
||||
m_flWeight = 1;
|
||||
|
||||
// blend in?
|
||||
if ( m_flBlendIn != 0.0f )
|
||||
{
|
||||
if (m_flCycle < m_flBlendIn)
|
||||
{
|
||||
m_flWeight = m_flCycle / m_flBlendIn;
|
||||
}
|
||||
}
|
||||
|
||||
// blend out?
|
||||
if ( m_flBlendOut != 0.0f )
|
||||
{
|
||||
if (m_flCycle > 1.0 - m_flBlendOut)
|
||||
{
|
||||
m_flWeight = (1.0 - m_flCycle) / m_flBlendOut;
|
||||
}
|
||||
}
|
||||
|
||||
m_flWeight = 3.0 * m_flWeight * m_flWeight - 2.0 * m_flWeight * m_flWeight * m_flWeight;
|
||||
if (m_nSequence == 0)
|
||||
m_flWeight = 0;
|
||||
}
|
||||
|
||||
#endif // ANIMATIONLAYER_H
|
138
game/client/baseanimatedtextureproxy.cpp
Normal file
138
game/client/baseanimatedtextureproxy.cpp
Normal file
@ -0,0 +1,138 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#include "cbase.h"
|
||||
#include "baseanimatedtextureproxy.h"
|
||||
#include "materialsystem/imaterial.h"
|
||||
#include "materialsystem/imaterialvar.h"
|
||||
#include "materialsystem/itexture.h"
|
||||
#include "tier1/KeyValues.h"
|
||||
#include "toolframework_client.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
// forward declarations
|
||||
void ToolFramework_RecordMaterialParams( IMaterial *pMaterial );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Constructor, destructor:
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
CBaseAnimatedTextureProxy::CBaseAnimatedTextureProxy()
|
||||
{
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
CBaseAnimatedTextureProxy::~CBaseAnimatedTextureProxy()
|
||||
{
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Initialization, shutdown
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBaseAnimatedTextureProxy::Init( IMaterial *pMaterial, KeyValues *pKeyValues )
|
||||
{
|
||||
char const* pAnimatedTextureVarName = pKeyValues->GetString( "animatedTextureVar" );
|
||||
if( !pAnimatedTextureVarName )
|
||||
return false;
|
||||
|
||||
bool foundVar;
|
||||
m_AnimatedTextureVar = pMaterial->FindVar( pAnimatedTextureVarName, &foundVar, false );
|
||||
if( !foundVar )
|
||||
return false;
|
||||
|
||||
char const* pAnimatedTextureFrameNumVarName = pKeyValues->GetString( "animatedTextureFrameNumVar" );
|
||||
if( !pAnimatedTextureFrameNumVarName )
|
||||
return false;
|
||||
|
||||
m_AnimatedTextureFrameNumVar = pMaterial->FindVar( pAnimatedTextureFrameNumVarName, &foundVar, false );
|
||||
if( !foundVar )
|
||||
return false;
|
||||
|
||||
m_FrameRate = pKeyValues->GetFloat( "animatedTextureFrameRate", 15 );
|
||||
m_WrapAnimation = !pKeyValues->GetInt( "animationNoWrap", 0 );
|
||||
return true;
|
||||
}
|
||||
|
||||
void CBaseAnimatedTextureProxy::Cleanup()
|
||||
{
|
||||
m_AnimatedTextureVar = NULL;
|
||||
m_AnimatedTextureFrameNumVar = NULL;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Does the dirty deed
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBaseAnimatedTextureProxy::OnBind( void *pEntity )
|
||||
{
|
||||
Assert ( m_AnimatedTextureVar );
|
||||
|
||||
if( m_AnimatedTextureVar->GetType() != MATERIAL_VAR_TYPE_TEXTURE )
|
||||
{
|
||||
return;
|
||||
}
|
||||
ITexture *pTexture;
|
||||
pTexture = m_AnimatedTextureVar->GetTextureValue();
|
||||
int numFrames = pTexture->GetNumAnimationFrames();
|
||||
|
||||
if ( numFrames <= 0 )
|
||||
{
|
||||
Assert( !"0 frames in material calling animated texture proxy" );
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: Must not use relative time based methods here
|
||||
// because the bind proxy can be called many times per frame.
|
||||
// Prevent multiple Wrap callbacks to be sent for no wrap mode
|
||||
float startTime = GetAnimationStartTime(pEntity);
|
||||
float deltaTime = gpGlobals->curtime - startTime;
|
||||
float prevTime = deltaTime - gpGlobals->frametime;
|
||||
|
||||
// Clamp..
|
||||
if (deltaTime < 0.0f)
|
||||
deltaTime = 0.0f;
|
||||
if (prevTime < 0.0f)
|
||||
prevTime = 0.0f;
|
||||
|
||||
float frame = m_FrameRate * deltaTime;
|
||||
float prevFrame = m_FrameRate * prevTime;
|
||||
|
||||
int intFrame = ((int)frame) % numFrames;
|
||||
int intPrevFrame = ((int)prevFrame) % numFrames;
|
||||
|
||||
// Report wrap situation...
|
||||
if (intPrevFrame > intFrame)
|
||||
{
|
||||
if (m_WrapAnimation)
|
||||
{
|
||||
AnimationWrapped( pEntity );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only sent the wrapped message once.
|
||||
// when we're in non-wrapping mode
|
||||
if (prevFrame < numFrames)
|
||||
AnimationWrapped( pEntity );
|
||||
intFrame = numFrames - 1;
|
||||
}
|
||||
}
|
||||
|
||||
m_AnimatedTextureFrameNumVar->SetIntValue( intFrame );
|
||||
|
||||
if ( ToolsEnabled() )
|
||||
{
|
||||
ToolFramework_RecordMaterialParams( GetMaterial() );
|
||||
}
|
||||
}
|
||||
|
||||
IMaterial *CBaseAnimatedTextureProxy::GetMaterial()
|
||||
{
|
||||
return m_AnimatedTextureVar->GetOwningMaterial();
|
||||
}
|
47
game/client/baseanimatedtextureproxy.h
Normal file
47
game/client/baseanimatedtextureproxy.h
Normal file
@ -0,0 +1,47 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#ifndef BASEANIMATEDTEXTUREPROXY
|
||||
#define BASEANIMATEDTEXTUREPROXY
|
||||
|
||||
#include "materialsystem/imaterialproxy.h"
|
||||
|
||||
class IMaterial;
|
||||
class IMaterialVar;
|
||||
|
||||
#pragma warning (disable : 4100)
|
||||
|
||||
class CBaseAnimatedTextureProxy : public IMaterialProxy
|
||||
{
|
||||
public:
|
||||
CBaseAnimatedTextureProxy();
|
||||
virtual ~CBaseAnimatedTextureProxy();
|
||||
|
||||
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues );
|
||||
virtual void OnBind( void *pC_BaseEntity );
|
||||
virtual void Release( void ) { delete this; }
|
||||
virtual IMaterial *GetMaterial();
|
||||
|
||||
protected:
|
||||
// derived classes must implement this; it returns the time
|
||||
// that the animation began
|
||||
virtual float GetAnimationStartTime( void* pBaseEntity ) = 0;
|
||||
|
||||
// Derived classes may implement this if they choose;
|
||||
// this method is called whenever the animation wraps...
|
||||
virtual void AnimationWrapped( void* pBaseEntity ) {}
|
||||
|
||||
protected:
|
||||
void Cleanup();
|
||||
|
||||
IMaterialVar *m_AnimatedTextureVar;
|
||||
IMaterialVar *m_AnimatedTextureFrameNumVar;
|
||||
float m_FrameRate;
|
||||
bool m_WrapAnimation;
|
||||
};
|
||||
|
||||
#endif // BASEANIMATEDTEXTUREPROXY
|
78
game/client/baseclientrendertargets.cpp
Normal file
78
game/client/baseclientrendertargets.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Implementation for CBaseClientRenderTargets class.
|
||||
// Provides Init functions for common render textures used by the engine.
|
||||
// Mod makers can inherit from this class, and call the Create functions for
|
||||
// only the render textures the want for their mod.
|
||||
//=============================================================================//
|
||||
|
||||
#include "cbase.h"
|
||||
#include "baseclientrendertargets.h" // header
|
||||
#include "materialsystem/imaterialsystemhardwareconfig.h" // Hardware config checks
|
||||
#include "tier0/icommandline.h"
|
||||
|
||||
ITexture* CBaseClientRenderTargets::CreateWaterReflectionTexture( IMaterialSystem* pMaterialSystem, int iSize )
|
||||
{
|
||||
return pMaterialSystem->CreateNamedRenderTargetTextureEx2(
|
||||
"_rt_WaterReflection",
|
||||
iSize, iSize, RT_SIZE_PICMIP,
|
||||
pMaterialSystem->GetBackBufferFormat(),
|
||||
MATERIAL_RT_DEPTH_SHARED,
|
||||
TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT,
|
||||
CREATERENDERTARGETFLAGS_HDR );
|
||||
}
|
||||
|
||||
ITexture* CBaseClientRenderTargets::CreateWaterRefractionTexture( IMaterialSystem* pMaterialSystem, int iSize )
|
||||
{
|
||||
return pMaterialSystem->CreateNamedRenderTargetTextureEx2(
|
||||
"_rt_WaterRefraction",
|
||||
iSize, iSize, RT_SIZE_PICMIP,
|
||||
// This is different than reflection because it has to have alpha for fog factor.
|
||||
IMAGE_FORMAT_RGBA8888,
|
||||
MATERIAL_RT_DEPTH_SHARED,
|
||||
TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT,
|
||||
CREATERENDERTARGETFLAGS_HDR );
|
||||
}
|
||||
|
||||
ITexture* CBaseClientRenderTargets::CreateCameraTexture( IMaterialSystem* pMaterialSystem, int iSize )
|
||||
{
|
||||
return pMaterialSystem->CreateNamedRenderTargetTextureEx2(
|
||||
"_rt_Camera",
|
||||
iSize, iSize, RT_SIZE_DEFAULT,
|
||||
pMaterialSystem->GetBackBufferFormat(),
|
||||
MATERIAL_RT_DEPTH_SHARED,
|
||||
0,
|
||||
CREATERENDERTARGETFLAGS_HDR );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Called by the engine in material system init and shutdown.
|
||||
// Clients should override this in their inherited version, but the base
|
||||
// is to init all standard render targets for use.
|
||||
// Input : pMaterialSystem - the engine's material system (our singleton is not yet inited at the time this is called)
|
||||
// pHardwareConfig - the user hardware config, useful for conditional render target setup
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBaseClientRenderTargets::InitClientRenderTargets( IMaterialSystem* pMaterialSystem, IMaterialSystemHardwareConfig* pHardwareConfig, int iWaterTextureSize, int iCameraTextureSize )
|
||||
{
|
||||
// Water effects
|
||||
m_WaterReflectionTexture.Init( CreateWaterReflectionTexture( pMaterialSystem, iWaterTextureSize ) );
|
||||
m_WaterRefractionTexture.Init( CreateWaterRefractionTexture( pMaterialSystem, iWaterTextureSize ) );
|
||||
|
||||
// Monitors
|
||||
m_CameraTexture.Init( CreateCameraTexture( pMaterialSystem, iCameraTextureSize ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Shut down each CTextureReference we created in InitClientRenderTargets.
|
||||
// Called by the engine in material system shutdown.
|
||||
// Input : -
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBaseClientRenderTargets::ShutdownClientRenderTargets()
|
||||
{
|
||||
// Water effects
|
||||
m_WaterReflectionTexture.Shutdown();
|
||||
m_WaterRefractionTexture.Shutdown();
|
||||
|
||||
// Monitors
|
||||
m_CameraTexture.Shutdown();
|
||||
}
|
64
game/client/baseclientrendertargets.h
Normal file
64
game/client/baseclientrendertargets.h
Normal file
@ -0,0 +1,64 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Has init functions for all the standard render targets used by most games.
|
||||
// Mods who wish to make their own render targets can inherit from this class
|
||||
// and in the 'InitClientRenderTargets' interface called by the engine, set up
|
||||
// their own render targets as well as calling the init functions for various
|
||||
// common render targets provided by this class.
|
||||
//
|
||||
// Note: Unless the client defines a singleton interface by inheriting from
|
||||
// this class and exposing the singleton instance, these init and shutdown
|
||||
// functions WILL NOT be called by the engine.
|
||||
//
|
||||
//
|
||||
// $Workfile: $
|
||||
// $Date: $
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
#ifndef CLIENTRENDERTARTETS_H_
|
||||
#define CLIENTRENDERTARTETS_H_
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "game/client/iclientrendertargets.h" // base class with interfaces called by the engine
|
||||
#include "materialsystem/imaterialsystem.h" // for material system classes and interfaces
|
||||
|
||||
|
||||
// Externs
|
||||
class IMaterialSystem;
|
||||
class IMaterialSystemHardwareConfig;
|
||||
|
||||
class CBaseClientRenderTargets : public IClientRenderTargets
|
||||
{
|
||||
// no networked vars
|
||||
DECLARE_CLASS_GAMEROOT( CBaseClientRenderTargets, IClientRenderTargets );
|
||||
public:
|
||||
// Interface called by engine during material system startup.
|
||||
virtual void InitClientRenderTargets ( IMaterialSystem* pMaterialSystem, IMaterialSystemHardwareConfig* pHardwareConfig, int iWaterTextureSize = 1024, int iCameraTextureSize = 256 );
|
||||
// Shutdown all custom render targets here.
|
||||
virtual void ShutdownClientRenderTargets ( void );
|
||||
|
||||
protected:
|
||||
|
||||
// Standard render textures used by most mods-- Classes inheriting from
|
||||
// this can choose to init these or not depending on their needs.
|
||||
|
||||
// For reflective and refracting water
|
||||
CTextureReference m_WaterReflectionTexture;
|
||||
CTextureReference m_WaterRefractionTexture;
|
||||
|
||||
// Used for monitors
|
||||
CTextureReference m_CameraTexture;
|
||||
|
||||
// Used for the HUD in stereo and head tracking mode
|
||||
CTextureReference m_UITexture;
|
||||
|
||||
// Init functions for the common render targets
|
||||
ITexture* CreateWaterReflectionTexture( IMaterialSystem* pMaterialSystem, int iSize = 1024 );
|
||||
ITexture* CreateWaterRefractionTexture( IMaterialSystem* pMaterialSystem, int iSize = 1024 );
|
||||
ITexture* CreateCameraTexture( IMaterialSystem* pMaterialSystem, int iSize = 256 );
|
||||
|
||||
};
|
||||
|
||||
#endif // CLIENTRENDERTARTETS_H_
|
94
game/client/basepresence.cpp
Normal file
94
game/client/basepresence.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Base presence implementation for PC
|
||||
//
|
||||
//=====================================================================================//
|
||||
|
||||
#include "cbase.h"
|
||||
#include "basepresence.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
// Default global singleton. Mods should override this.
|
||||
static CBasePresence s_basePresence;
|
||||
IPresence *presence = NULL;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Steam version of Rich Presence is a WIP, so PC implementation is stubbed for now.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBasePresence::Init( void )
|
||||
{
|
||||
if ( !presence )
|
||||
{
|
||||
// Mod didn't override, default to base implementation
|
||||
presence = &s_basePresence;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void CBasePresence::Shutdown( void )
|
||||
{
|
||||
// TODO: Implement for PC
|
||||
}
|
||||
void CBasePresence::Update( float frametime )
|
||||
{
|
||||
// TODO: Implement for PC
|
||||
}
|
||||
void CBasePresence::UserSetContext( unsigned int nUserIndex, unsigned int nContextId, unsigned int nContextValue, bool bAsync )
|
||||
{
|
||||
// TODO: Implement for PC
|
||||
}
|
||||
void CBasePresence::UserSetProperty( unsigned int nUserIndex, unsigned int nPropertyId, unsigned int nBytes, const void *pvValue, bool bAsync )
|
||||
{
|
||||
// TODO: Implement for PC
|
||||
}
|
||||
void CBasePresence::SetupGameProperties( CUtlVector< XUSER_CONTEXT > &contexts, CUtlVector< XUSER_PROPERTY > &properties )
|
||||
{
|
||||
// TODO: Implement for PC
|
||||
}
|
||||
unsigned int CBasePresence::GetPresenceID( const char *pIDName )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
const char *CBasePresence::GetPropertyIdString( const uint id )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
void CBasePresence::GetPropertyDisplayString( uint id, uint value, char *pOutput, int nBytes )
|
||||
{
|
||||
}
|
||||
void CBasePresence::StartStatsReporting( HANDLE handle, bool bArbitrated )
|
||||
{
|
||||
}
|
||||
void CBasePresence::SetStat( uint iPropertyId, int iPropertyValue, int dataType )
|
||||
{
|
||||
}
|
||||
void CBasePresence::UploadStats()
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Debug support
|
||||
//---------------------------------------------------------
|
||||
void CBasePresence::DebugUserSetContext( const CCommand &args )
|
||||
{
|
||||
if ( args.ArgC() == 3 )
|
||||
{
|
||||
UserSetContext( 0, atoi( args.Arg( 1 ) ), atoi( args.Arg( 2 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning( "user_context <context id> <context value>\n" );
|
||||
}
|
||||
}
|
||||
void CBasePresence::DebugUserSetProperty( const CCommand &args )
|
||||
{
|
||||
if ( args.ArgC() == 3 )
|
||||
{
|
||||
UserSetProperty( 0, strtoul( args.Arg( 1 ), NULL, 0 ), sizeof(int), args.Arg( 2 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning( "user_property <property id> <property value>\n" );
|
||||
}
|
||||
}
|
55
game/client/basepresence.h
Normal file
55
game/client/basepresence.h
Normal file
@ -0,0 +1,55 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Base implementation of the IPresence interface
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef BASEPRESENCE_H
|
||||
#define BASEPRESENCE_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "ipresence.h"
|
||||
#include "igamesystem.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Common implementation for setting user contexts and properties.
|
||||
// Each client should inherit from this to implement mod-specific presence info.
|
||||
//-----------------------------------------------------------------------------
|
||||
class CBasePresence : public IPresence, public CAutoGameSystemPerFrame
|
||||
{
|
||||
public:
|
||||
// CBaseGameSystemPerFrame overrides
|
||||
virtual bool Init( void );
|
||||
virtual void Shutdown( void );
|
||||
virtual void Update( float frametime );
|
||||
virtual char const *Name( void ) { return "presence"; }
|
||||
|
||||
// IPresence Interface
|
||||
virtual void UserSetContext( unsigned int nUserIndex, unsigned int nContextId, unsigned int nContextValue, bool bAsync = false );
|
||||
virtual void UserSetProperty( unsigned int nUserIndex, unsigned int nPropertyId, unsigned int nBytes, const void *pvValue, bool bAsync = false );
|
||||
virtual void SetupGameProperties( CUtlVector< XUSER_CONTEXT > &contexts, CUtlVector< XUSER_PROPERTY > &properties );
|
||||
virtual uint GetPresenceID( const char *pIdName );
|
||||
virtual void GetPropertyDisplayString( uint id, uint value, char *pOutput, int nBytes );
|
||||
virtual const char *GetPropertyIdString( const uint id );
|
||||
|
||||
// Stats reporting
|
||||
virtual void StartStatsReporting( HANDLE handle, bool bArbitrated );
|
||||
virtual void SetStat( uint iPropertyId, int iPropertyValue, int dataType );
|
||||
virtual void UploadStats();
|
||||
|
||||
protected:
|
||||
bool m_bArbitrated;
|
||||
bool m_bReportingStats;
|
||||
HANDLE m_hSession;
|
||||
CUtlVector< XUSER_PROPERTY > m_PlayerStats;
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Debug support
|
||||
//---------------------------------------------------------
|
||||
CON_COMMAND_MEMBER_F( CBasePresence, "user_context", DebugUserSetContext, "Set a Rich Presence Context: user_context <context id> <context value>", 0 )
|
||||
CON_COMMAND_MEMBER_F( CBasePresence, "user_property", DebugUserSetProperty, "Set a Rich Presence Property: user_property <property id>", 0 )
|
||||
};
|
||||
|
||||
#endif // BASEPRESENCE_H
|
167
game/client/basepresence_xbox.cpp
Normal file
167
game/client/basepresence_xbox.cpp
Normal file
@ -0,0 +1,167 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose: Base rich presence implementation for Xbox360
|
||||
//
|
||||
//=====================================================================================//
|
||||
|
||||
#include "cbase.h"
|
||||
#include "basepresence.h"
|
||||
#include "cdll_client_int.h"
|
||||
#include "ixboxsystem.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
// Default global instance. Mods should override this.
|
||||
static CBasePresence s_basePresence;
|
||||
IPresence *presence = NULL;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Init
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBasePresence::Init( void )
|
||||
{
|
||||
if ( !presence )
|
||||
{
|
||||
// Mod didn't override, default to base implementation
|
||||
presence = &s_basePresence;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Shutdown
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBasePresence::Shutdown( void )
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Per-frame update
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBasePresence::Update( float frametime )
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Contexts are strings that describe the current state of the game.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBasePresence::UserSetContext( unsigned int nUserIndex, unsigned int nContextId, unsigned int nContextValue, bool bAsync )
|
||||
{
|
||||
if ( !xboxsystem->UserSetContext( nUserIndex, nContextId, nContextValue, bAsync ) )
|
||||
{
|
||||
Warning( "CBasePresence: UserSetContext failed.\n" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Properties are (usually) numeric values that can be insterted into context strings.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBasePresence::UserSetProperty( unsigned int nUserIndex, unsigned int nPropertyId, unsigned int nBytes, const void *pvValue, bool bAsync )
|
||||
{
|
||||
if ( !xboxsystem->UserSetProperty( nUserIndex, nPropertyId, nBytes, pvValue, bAsync ) )
|
||||
{
|
||||
Warning( "CBasePresence: UserSetProperty failed.\n" );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Get game session properties from matchmaking.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBasePresence::SetupGameProperties( CUtlVector< XUSER_CONTEXT > &contexts, CUtlVector< XUSER_PROPERTY > &properties )
|
||||
{
|
||||
Assert( 0 );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Convert a string to a presence ID.
|
||||
//-----------------------------------------------------------------------------
|
||||
uint CBasePresence::GetPresenceID( const char *pIdName )
|
||||
{
|
||||
Assert( 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Convert a presence ID to a string.
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *CBasePresence::GetPropertyIdString( const uint id )
|
||||
{
|
||||
Assert( 0 );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Get display string for a game property.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBasePresence::GetPropertyDisplayString( uint id, uint value, char *pOutput, int nBytes )
|
||||
{
|
||||
Assert( 0 );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Set up for reporting stats to Live.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBasePresence::StartStatsReporting( HANDLE handle, bool bArbitrated )
|
||||
{
|
||||
m_bArbitrated = bArbitrated;
|
||||
m_hSession = handle;
|
||||
m_bReportingStats = true;
|
||||
m_PlayerStats.RemoveAll();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Set a specific stat property.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBasePresence::SetStat( uint iPropertyId, int iPropertyValue, int dataType )
|
||||
{
|
||||
if ( m_bReportingStats )
|
||||
{
|
||||
XUSER_PROPERTY prop;
|
||||
prop.dwPropertyId = iPropertyId;
|
||||
prop.value.nData = iPropertyValue;
|
||||
prop.value.type = dataType;
|
||||
m_PlayerStats.AddToTail( prop );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Upload the stats to Live.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBasePresence::UploadStats()
|
||||
{
|
||||
Assert( 0 );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Debug support
|
||||
//---------------------------------------------------------
|
||||
void CBasePresence::DebugUserSetContext( const CCommand &args )
|
||||
{
|
||||
if ( args.ArgC() == 3 )
|
||||
{
|
||||
UserSetContext( XBX_GetPrimaryUserId(), atoi( args.Arg( 1 ) ), atoi( args.Arg( 2 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning( "user_context <context id> <context value>\n" );
|
||||
}
|
||||
}
|
||||
void CBasePresence::DebugUserSetProperty( const CCommand &args )
|
||||
{
|
||||
if ( args.ArgC() == 3 )
|
||||
{
|
||||
int value = atoi( args.Arg( 2 ) );
|
||||
UserSetProperty( XBX_GetPrimaryUserId(), strtoul( args.Arg( 1 ), NULL, 0 ), sizeof(int), &value );
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning( "user_property <property id> <property value>\n" );
|
||||
}
|
||||
}
|
1526
game/client/beamdraw.cpp
Normal file
1526
game/client/beamdraw.cpp
Normal file
File diff suppressed because it is too large
Load Diff
173
game/client/beamdraw.h
Normal file
173
game/client/beamdraw.h
Normal file
@ -0,0 +1,173 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//===========================================================================//
|
||||
#if !defined( BEAMDRAW_H )
|
||||
#define BEAMDRAW_H
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "materialsystem/imaterial.h"
|
||||
#include "materialsystem/imesh.h"
|
||||
#include "mathlib/vector.h"
|
||||
#include "tier2/beamsegdraw.h"
|
||||
#include "c_pixel_visibility.h"
|
||||
|
||||
#define NOISE_DIVISIONS 128
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
struct model_t;
|
||||
struct BeamTrail_t;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Beams fill out this data structure
|
||||
// This is also used for rendering
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class Beam_t : public CDefaultClientRenderable
|
||||
{
|
||||
public:
|
||||
Beam_t();
|
||||
|
||||
// Methods of IClientRenderable
|
||||
virtual const Vector& GetRenderOrigin( void );
|
||||
virtual const QAngle& GetRenderAngles( void );
|
||||
virtual const matrix3x4_t &RenderableToWorldTransform();
|
||||
virtual void GetRenderBounds( Vector& mins, Vector& maxs );
|
||||
virtual bool ShouldDraw( void );
|
||||
virtual bool IsTransparent( void );
|
||||
virtual int DrawModel( int flags );
|
||||
virtual void ComputeFxBlend( );
|
||||
virtual int GetFxBlend( );
|
||||
|
||||
// Resets the beam state
|
||||
void Reset();
|
||||
|
||||
// Method to computing the bounding box
|
||||
void ComputeBounds();
|
||||
|
||||
// Bounding box...
|
||||
Vector m_Mins;
|
||||
Vector m_Maxs;
|
||||
pixelvis_handle_t *m_queryHandleHalo;
|
||||
float m_haloProxySize;
|
||||
|
||||
// Data is below..
|
||||
|
||||
// Next beam in list
|
||||
Beam_t* next;
|
||||
|
||||
// Type of beam
|
||||
int type;
|
||||
int flags;
|
||||
|
||||
// Control points for the beam
|
||||
int numAttachments;
|
||||
Vector attachment[MAX_BEAM_ENTS];
|
||||
Vector delta;
|
||||
|
||||
// 0 .. 1 over lifetime of beam
|
||||
float t;
|
||||
float freq;
|
||||
|
||||
// Time when beam should die
|
||||
float die;
|
||||
float width;
|
||||
float endWidth;
|
||||
float fadeLength;
|
||||
float amplitude;
|
||||
float life;
|
||||
|
||||
// Color
|
||||
float r, g, b;
|
||||
float brightness;
|
||||
|
||||
// Speed
|
||||
float speed;
|
||||
|
||||
// Animation
|
||||
float frameRate;
|
||||
float frame;
|
||||
int segments;
|
||||
|
||||
// Attachment entities for the beam
|
||||
EHANDLE entity[MAX_BEAM_ENTS];
|
||||
int attachmentIndex[MAX_BEAM_ENTS];
|
||||
|
||||
// Model info
|
||||
int modelIndex;
|
||||
int haloIndex;
|
||||
|
||||
float haloScale;
|
||||
int frameCount;
|
||||
|
||||
float rgNoise[NOISE_DIVISIONS+1];
|
||||
|
||||
// Popcorn trail for beam follows to use
|
||||
BeamTrail_t* trail;
|
||||
|
||||
// for TE_BEAMRINGPOINT
|
||||
float start_radius;
|
||||
float end_radius;
|
||||
|
||||
// for FBEAM_ONLYNOISEONCE
|
||||
bool m_bCalculatedNoise;
|
||||
|
||||
float m_flHDRColorScale;
|
||||
|
||||
#ifdef PORTAL
|
||||
bool m_bDrawInMainRender;
|
||||
bool m_bDrawInPortalRender;
|
||||
#endif //#ifdef PORTAL
|
||||
};
|
||||
|
||||
|
||||
int ScreenTransform( const Vector& point, Vector& screen );
|
||||
|
||||
void DrawSegs( int noise_divisions, float *prgNoise, const model_t* spritemodel,
|
||||
float frame, int rendermode, const Vector& source, const Vector& delta,
|
||||
float startWidth, float endWidth, float scale, float freq, float speed, int segments,
|
||||
int flags, float* color, float fadeLength, float flHDRColorScale = 1.0f );
|
||||
void DrawTeslaSegs( int noise_divisions, float *prgNoise, const model_t* spritemodel,
|
||||
float frame, int rendermode, const Vector& source, const Vector& delta,
|
||||
float startWidth, float endWidth, float scale, float freq, float speed, int segments,
|
||||
int flags, float* color, float fadeLength, float flHDRColorScale = 1.0f );
|
||||
void DrawSplineSegs( int noise_divisions, float *prgNoise,
|
||||
const model_t* beammodel, const model_t* halomodel, float flHaloScale,
|
||||
float frame, int rendermode, int numAttachments, Vector* attachment,
|
||||
float startWidth, float endWidth, float scale, float freq, float speed, int segments,
|
||||
int flags, float* color, float fadeLength, float flHDRColorScale = 1.0f );
|
||||
void DrawHalo(IMaterial* pMaterial, const Vector& source, float scale, float const* color, float flHDRColorScale = 1.0f );
|
||||
void BeamDrawHalo( const model_t* spritemodel, float frame, int rendermode, const Vector& source,
|
||||
float scale, float* color, float flHDRColorScale = 1.0f );
|
||||
void DrawDisk( int noise_divisions, float *prgNoise, const model_t* spritemodel,
|
||||
float frame, int rendermode, const Vector& source, const Vector& delta,
|
||||
float width, float scale, float freq, float speed,
|
||||
int segments, float* color, float flHDRColorScale = 1.0f );
|
||||
void DrawCylinder( int noise_divisions, float *prgNoise, const model_t* spritemodel,
|
||||
float frame, int rendermode, const Vector& source,
|
||||
const Vector& delta, float width, float scale, float freq,
|
||||
float speed, int segments, float* color, float flHDRColorScale = 1.0f );
|
||||
void DrawRing( int noise_divisions, float *prgNoise, void (*pfnNoise)( float *noise, int divs, float scale ),
|
||||
const model_t* spritemodel, float frame, int rendermode,
|
||||
const Vector& source, const Vector& delta, float width, float amplitude,
|
||||
float freq, float speed, int segments, float* color, float flHDRColorScale = 1.0f );
|
||||
void DrawBeamFollow( const model_t* spritemodel, BeamTrail_t* pHead, int frame, int rendermode, Vector& delta,
|
||||
Vector& screen, Vector& screenLast, float die, const Vector& source,
|
||||
int flags, float width, float amplitude, float freq, float* color, float flHDRColorScale = 1.0f );
|
||||
|
||||
void DrawBeamQuadratic( const Vector &start, const Vector &control, const Vector &end, float width, const Vector &color, float scrollOffset, float flHDRColorScale = 1.0f );
|
||||
class CEngineSprite *Draw_SetSpriteTexture( const model_t *pSpriteModel, int frame, int rendermode );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Assumes the material has already been bound
|
||||
//-----------------------------------------------------------------------------
|
||||
void DrawSprite( const Vector &vecOrigin, float flWidth, float flHeight, color32 color );
|
||||
|
||||
#endif // BEAMDRAW_H
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user