diff options
Diffstat (limited to 'src/others/irrlicht-1.8.1/examples/21.Quake3Explorer')
13 files changed, 4415 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Makefile b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Makefile new file mode 100644 index 0000000..b2c6927 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Makefile | |||
@@ -0,0 +1,38 @@ | |||
1 | # Makefile for Irrlicht Examples | ||
2 | # It's usually sufficient to change just the target name and source file list | ||
3 | # and be sure that CXX is set to a valid compiler | ||
4 | Target = 21.Quake3Explorer | ||
5 | Sources = main.cpp sound.cpp q3factory.cpp | ||
6 | |||
7 | # general compiler settings | ||
8 | CPPFLAGS = -I../../include -I/usr/X11R6/include | ||
9 | #CXXFLAGS = -O3 -ffast-math | ||
10 | CXXFLAGS = -g -Wall | ||
11 | |||
12 | #default target is Linux | ||
13 | all: all_linux | ||
14 | |||
15 | ifeq ($(HOSTTYPE), x86_64) | ||
16 | LIBSELECT=64 | ||
17 | endif | ||
18 | |||
19 | # target specific settings | ||
20 | all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11 -lXcursor | ||
21 | all_linux clean_linux: SYSTEM=Linux | ||
22 | all_win32: LDFLAGS = -L../../lib/Win32-gcc -lIrrlicht -lopengl32 -lm | ||
23 | all_win32 clean_win32: SYSTEM=Win32-gcc | ||
24 | all_win32 clean_win32: SUF=.exe | ||
25 | # name of the binary - only valid for targets which set SYSTEM | ||
26 | DESTPATH = ../../bin/$(SYSTEM)/$(Target)$(SUF) | ||
27 | |||
28 | all_linux all_win32: | ||
29 | $(warning Building...) | ||
30 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS) | ||
31 | |||
32 | clean: clean_linux clean_win32 | ||
33 | $(warning Cleaning...) | ||
34 | |||
35 | clean_linux clean_win32: | ||
36 | @$(RM) $(DESTPATH) | ||
37 | |||
38 | .PHONY: all all_win32 clean clean_linux clean_win32 | ||
diff --git a/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer.cbp b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer.cbp new file mode 100644 index 0000000..af962e2 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer.cbp | |||
@@ -0,0 +1,59 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
2 | <CodeBlocks_project_file> | ||
3 | <FileVersion major="1" minor="6" /> | ||
4 | <Project> | ||
5 | <Option title="Irrlicht Example 21 Quake 3 Explorer" /> | ||
6 | <Option pch_mode="0" /> | ||
7 | <Option compiler="gcc" /> | ||
8 | <Build> | ||
9 | <Target title="Linux"> | ||
10 | <Option platforms="Unix;" /> | ||
11 | <Option output="..\..\bin\Linux\Quake3Explorer" prefix_auto="0" extension_auto="0" /> | ||
12 | <Option type="1" /> | ||
13 | <Option compiler="gcc" /> | ||
14 | <Compiler> | ||
15 | <Add option="-g" /> | ||
16 | <Add option="-D_IRR_STATIC_LIB_" /> | ||
17 | </Compiler> | ||
18 | <Linker> | ||
19 | <Add library="Xxf86vm" /> | ||
20 | <Add library="Xcursor" /> | ||
21 | <Add library="GL" /> | ||
22 | <Add directory="..\..\lib\Linux" /> | ||
23 | </Linker> | ||
24 | </Target> | ||
25 | <Target title="Windows"> | ||
26 | <Option platforms="Windows;" /> | ||
27 | <Option output="..\..\bin\Win32-gcc\Quake3Explorer" prefix_auto="0" extension_auto="1" /> | ||
28 | <Option type="1" /> | ||
29 | <Option compiler="gcc" /> | ||
30 | <Compiler> | ||
31 | <Add option="-g" /> | ||
32 | </Compiler> | ||
33 | <Linker> | ||
34 | <Add directory="..\..\lib\Win32-gcc" /> | ||
35 | </Linker> | ||
36 | </Target> | ||
37 | </Build> | ||
38 | <VirtualTargets> | ||
39 | <Add alias="All" targets="Windows;Linux;" /> | ||
40 | </VirtualTargets> | ||
41 | <Compiler> | ||
42 | <Add option="-g" /> | ||
43 | <Add directory="..\..\include" /> | ||
44 | </Compiler> | ||
45 | <Linker> | ||
46 | <Add library="Irrlicht" /> | ||
47 | </Linker> | ||
48 | <Unit filename="main.cpp" /> | ||
49 | <Unit filename="q3factory.cpp" /> | ||
50 | <Unit filename="q3factory.h" /> | ||
51 | <Unit filename="sound.cpp" /> | ||
52 | <Unit filename="sound.h" /> | ||
53 | <Extensions> | ||
54 | <code_completion /> | ||
55 | <debugger /> | ||
56 | <envvars /> | ||
57 | </Extensions> | ||
58 | </Project> | ||
59 | </CodeBlocks_project_file> | ||
diff --git a/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer.dev b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer.dev new file mode 100644 index 0000000..193c6bd --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer.dev | |||
@@ -0,0 +1,99 @@ | |||
1 | [Project] | ||
2 | FileName=Quake3Explorer.dev | ||
3 | Name=Irrlicht Example 21 Quake3 Explorer | ||
4 | UnitCount=5 | ||
5 | Type=1 | ||
6 | Ver=1 | ||
7 | ObjFiles= | ||
8 | Includes=..\..\include | ||
9 | Libs= | ||
10 | PrivateResource= | ||
11 | ResourceIncludes= | ||
12 | MakeIncludes= | ||
13 | Compiler= | ||
14 | CppCompiler= | ||
15 | Linker=../../lib/Win32-gcc/libIrrlicht.a_@@_ | ||
16 | IsCpp=1 | ||
17 | Icon= | ||
18 | ExeOutput=../../bin/Win32-gcc | ||
19 | ObjectOutput=obj | ||
20 | OverrideOutput=1 | ||
21 | OverrideOutputName=21.Quake3Explorer.exe | ||
22 | HostApplication= | ||
23 | Folders= | ||
24 | CommandLine= | ||
25 | IncludeVersionInfo=0 | ||
26 | SupportXPThemes=0 | ||
27 | CompilerSet=0 | ||
28 | CompilerSettings=0000000000000000000000 | ||
29 | UseCustomMakefile=0 | ||
30 | CustomMakefile= | ||
31 | |||
32 | [Unit1] | ||
33 | FileName=main.cpp | ||
34 | CompileCpp=1 | ||
35 | Folder=Projekt1 | ||
36 | Compile=1 | ||
37 | Link=1 | ||
38 | Priority=1000 | ||
39 | OverrideBuildCmd=0 | ||
40 | BuildCmd= | ||
41 | |||
42 | [VersionInfo] | ||
43 | Major=0 | ||
44 | Minor=1 | ||
45 | Release=1 | ||
46 | Build=1 | ||
47 | LanguageID=1033 | ||
48 | CharsetID=1252 | ||
49 | CompanyName= | ||
50 | FileVersion= | ||
51 | FileDescription=Irrlicht Engine example compiled using DevCpp and gcc | ||
52 | InternalName= | ||
53 | LegalCopyright= | ||
54 | LegalTrademarks= | ||
55 | OriginalFilename= | ||
56 | ProductName= | ||
57 | ProductVersion= | ||
58 | AutoIncBuildNr=0 | ||
59 | |||
60 | [Unit2] | ||
61 | FileName=q3factory.cpp | ||
62 | CompileCpp=1 | ||
63 | Folder=Irrlicht Example 21 Quake3 Explorer | ||
64 | Compile=1 | ||
65 | Link=1 | ||
66 | Priority=1000 | ||
67 | OverrideBuildCmd=0 | ||
68 | BuildCmd= | ||
69 | |||
70 | [Unit3] | ||
71 | FileName=q3factory.h | ||
72 | CompileCpp=1 | ||
73 | Folder=Irrlicht Example 21 Quake3 Explorer | ||
74 | Compile=1 | ||
75 | Link=1 | ||
76 | Priority=1000 | ||
77 | OverrideBuildCmd=0 | ||
78 | BuildCmd= | ||
79 | |||
80 | [Unit4] | ||
81 | FileName=sound.cpp | ||
82 | CompileCpp=1 | ||
83 | Folder=Irrlicht Example 21 Quake3 Explorer | ||
84 | Compile=1 | ||
85 | Link=1 | ||
86 | Priority=1000 | ||
87 | OverrideBuildCmd=0 | ||
88 | BuildCmd= | ||
89 | |||
90 | [Unit5] | ||
91 | FileName=sound.h | ||
92 | CompileCpp=1 | ||
93 | Folder=Irrlicht Example 21 Quake3 Explorer | ||
94 | Compile=1 | ||
95 | Link=1 | ||
96 | Priority=1000 | ||
97 | OverrideBuildCmd=0 | ||
98 | BuildCmd= | ||
99 | |||
diff --git a/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer.vcproj b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer.vcproj new file mode 100644 index 0000000..b869cc4 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer.vcproj | |||
@@ -0,0 +1,132 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="7.10" | ||
5 | Name="21.Quake3Explorer" | ||
6 | ProjectGUID="{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}" | ||
7 | Keyword="Win32Proj"> | ||
8 | <Platforms> | ||
9 | <Platform | ||
10 | Name="Win32"/> | ||
11 | </Platforms> | ||
12 | <Configurations> | ||
13 | <Configuration | ||
14 | Name="Debug|Win32" | ||
15 | OutputDirectory="Debug" | ||
16 | IntermediateDirectory="Debug" | ||
17 | ConfigurationType="1" | ||
18 | CharacterSet="2"> | ||
19 | <Tool | ||
20 | Name="VCCLCompilerTool" | ||
21 | Optimization="0" | ||
22 | AdditionalIncludeDirectories="..\..\include" | ||
23 | PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" | ||
24 | MinimalRebuild="TRUE" | ||
25 | BasicRuntimeChecks="3" | ||
26 | RuntimeLibrary="5" | ||
27 | UsePrecompiledHeader="0" | ||
28 | WarningLevel="3" | ||
29 | Detect64BitPortabilityProblems="TRUE" | ||
30 | DebugInformationFormat="4"/> | ||
31 | <Tool | ||
32 | Name="VCCustomBuildTool"/> | ||
33 | <Tool | ||
34 | Name="VCLinkerTool" | ||
35 | OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe" | ||
36 | LinkIncremental="1" | ||
37 | AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio" | ||
38 | GenerateDebugInformation="TRUE" | ||
39 | ProgramDatabaseFile="$(OutDir)/Quake3MapShader.pdb" | ||
40 | SubSystem="1" | ||
41 | TargetMachine="1"/> | ||
42 | <Tool | ||
43 | Name="VCMIDLTool"/> | ||
44 | <Tool | ||
45 | Name="VCPostBuildEventTool"/> | ||
46 | <Tool | ||
47 | Name="VCPreBuildEventTool"/> | ||
48 | <Tool | ||
49 | Name="VCPreLinkEventTool"/> | ||
50 | <Tool | ||
51 | Name="VCResourceCompilerTool"/> | ||
52 | <Tool | ||
53 | Name="VCWebServiceProxyGeneratorTool"/> | ||
54 | <Tool | ||
55 | Name="VCXMLDataGeneratorTool"/> | ||
56 | <Tool | ||
57 | Name="VCWebDeploymentTool"/> | ||
58 | <Tool | ||
59 | Name="VCManagedWrapperGeneratorTool"/> | ||
60 | <Tool | ||
61 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
62 | </Configuration> | ||
63 | <Configuration | ||
64 | Name="Release|Win32" | ||
65 | OutputDirectory="Release" | ||
66 | IntermediateDirectory="Release" | ||
67 | ConfigurationType="1" | ||
68 | CharacterSet="2" | ||
69 | WholeProgramOptimization="TRUE"> | ||
70 | <Tool | ||
71 | Name="VCCLCompilerTool" | ||
72 | AdditionalOptions="/QIfist /Oa" | ||
73 | Optimization="3" | ||
74 | GlobalOptimizations="TRUE" | ||
75 | InlineFunctionExpansion="2" | ||
76 | EnableIntrinsicFunctions="TRUE" | ||
77 | FavorSizeOrSpeed="1" | ||
78 | OmitFramePointers="TRUE" | ||
79 | AdditionalIncludeDirectories="..\..\include" | ||
80 | PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" | ||
81 | RuntimeLibrary="4" | ||
82 | BufferSecurityCheck="FALSE" | ||
83 | UsePrecompiledHeader="0" | ||
84 | WarningLevel="3" | ||
85 | Detect64BitPortabilityProblems="TRUE" | ||
86 | DebugInformationFormat="0" | ||
87 | CallingConvention="1"/> | ||
88 | <Tool | ||
89 | Name="VCCustomBuildTool"/> | ||
90 | <Tool | ||
91 | Name="VCLinkerTool" | ||
92 | OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe" | ||
93 | LinkIncremental="1" | ||
94 | SuppressStartupBanner="TRUE" | ||
95 | AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio" | ||
96 | GenerateDebugInformation="FALSE" | ||
97 | SubSystem="1" | ||
98 | OptimizeReferences="2" | ||
99 | EnableCOMDATFolding="2" | ||
100 | TargetMachine="1"/> | ||
101 | <Tool | ||
102 | Name="VCMIDLTool"/> | ||
103 | <Tool | ||
104 | Name="VCPostBuildEventTool"/> | ||
105 | <Tool | ||
106 | Name="VCPreBuildEventTool"/> | ||
107 | <Tool | ||
108 | Name="VCPreLinkEventTool"/> | ||
109 | <Tool | ||
110 | Name="VCResourceCompilerTool"/> | ||
111 | <Tool | ||
112 | Name="VCWebServiceProxyGeneratorTool"/> | ||
113 | <Tool | ||
114 | Name="VCXMLDataGeneratorTool"/> | ||
115 | <Tool | ||
116 | Name="VCWebDeploymentTool"/> | ||
117 | <Tool | ||
118 | Name="VCManagedWrapperGeneratorTool"/> | ||
119 | <Tool | ||
120 | Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | ||
121 | </Configuration> | ||
122 | </Configurations> | ||
123 | <References> | ||
124 | </References> | ||
125 | <Files> | ||
126 | <File | ||
127 | RelativePath=".\main.cpp"> | ||
128 | </File> | ||
129 | </Files> | ||
130 | <Globals> | ||
131 | </Globals> | ||
132 | </VisualStudioProject> | ||
diff --git a/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer_vc10.vcxproj b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer_vc10.vcxproj new file mode 100644 index 0000000..8ba3e72 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer_vc10.vcxproj | |||
@@ -0,0 +1,196 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
3 | <ItemGroup Label="ProjectConfigurations"> | ||
4 | <ProjectConfiguration Include="Debug|Win32"> | ||
5 | <Configuration>Debug</Configuration> | ||
6 | <Platform>Win32</Platform> | ||
7 | </ProjectConfiguration> | ||
8 | <ProjectConfiguration Include="Debug|x64"> | ||
9 | <Configuration>Debug</Configuration> | ||
10 | <Platform>x64</Platform> | ||
11 | </ProjectConfiguration> | ||
12 | <ProjectConfiguration Include="Release|Win32"> | ||
13 | <Configuration>Release</Configuration> | ||
14 | <Platform>Win32</Platform> | ||
15 | </ProjectConfiguration> | ||
16 | <ProjectConfiguration Include="Release|x64"> | ||
17 | <Configuration>Release</Configuration> | ||
18 | <Platform>x64</Platform> | ||
19 | </ProjectConfiguration> | ||
20 | </ItemGroup> | ||
21 | <PropertyGroup Label="Globals"> | ||
22 | <ProjectName>21.Quake3Explorer</ProjectName> | ||
23 | <ProjectGuid>{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}</ProjectGuid> | ||
24 | <RootNamespace>21.Quake3Explorer</RootNamespace> | ||
25 | <Keyword>Win32Proj</Keyword> | ||
26 | </PropertyGroup> | ||
27 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
28 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
29 | <ConfigurationType>Application</ConfigurationType> | ||
30 | <CharacterSet>MultiByte</CharacterSet> | ||
31 | </PropertyGroup> | ||
32 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
33 | <ConfigurationType>Application</ConfigurationType> | ||
34 | <CharacterSet>MultiByte</CharacterSet> | ||
35 | </PropertyGroup> | ||
36 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||
37 | <ConfigurationType>Application</ConfigurationType> | ||
38 | <CharacterSet>MultiByte</CharacterSet> | ||
39 | </PropertyGroup> | ||
40 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
41 | <ConfigurationType>Application</ConfigurationType> | ||
42 | <CharacterSet>MultiByte</CharacterSet> | ||
43 | </PropertyGroup> | ||
44 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
45 | <ImportGroup Label="ExtensionSettings"> | ||
46 | </ImportGroup> | ||
47 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> | ||
48 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
49 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | ||
50 | </ImportGroup> | ||
51 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> | ||
52 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
53 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | ||
54 | </ImportGroup> | ||
55 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> | ||
56 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
57 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | ||
58 | </ImportGroup> | ||
59 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> | ||
60 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
61 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | ||
62 | </ImportGroup> | ||
63 | <PropertyGroup Label="UserMacros" /> | ||
64 | <PropertyGroup> | ||
65 | <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> | ||
66 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\bin\Win32-VisualStudio\</OutDir> | ||
67 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\bin\Win64-VisualStudio\</OutDir> | ||
68 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> | ||
69 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> | ||
70 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\bin\Win32-VisualStudio\</OutDir> | ||
71 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\bin\Win64-VisualStudio\</OutDir> | ||
72 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> | ||
73 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> | ||
74 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> | ||
75 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> | ||
76 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> | ||
77 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> | ||
78 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> | ||
79 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> | ||
80 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> | ||
81 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> | ||
82 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | ||
83 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> | ||
84 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | ||
85 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> | ||
86 | </PropertyGroup> | ||
87 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
88 | <ClCompile> | ||
89 | <Optimization>Disabled</Optimization> | ||
90 | <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
91 | <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
92 | <MinimalRebuild>true</MinimalRebuild> | ||
93 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | ||
94 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||
95 | <PrecompiledHeader> | ||
96 | </PrecompiledHeader> | ||
97 | <WarningLevel>Level3</WarningLevel> | ||
98 | <DebugInformationFormat>EditAndContinue</DebugInformationFormat> | ||
99 | </ClCompile> | ||
100 | <Link> | ||
101 | <OutputFile>..\..\bin\Win32-VisualStudio\21.Quake3Explorer.exe</OutputFile> | ||
102 | <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
103 | <GenerateDebugInformation>true</GenerateDebugInformation> | ||
104 | <ProgramDatabaseFile>$(OutDir)Quake3MapShader.pdb</ProgramDatabaseFile> | ||
105 | <SubSystem>Console</SubSystem> | ||
106 | <DataExecutionPrevention> | ||
107 | </DataExecutionPrevention> | ||
108 | </Link> | ||
109 | </ItemDefinitionGroup> | ||
110 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
111 | <ClCompile> | ||
112 | <Optimization>Disabled</Optimization> | ||
113 | <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
114 | <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
115 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | ||
116 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||
117 | <PrecompiledHeader> | ||
118 | </PrecompiledHeader> | ||
119 | <WarningLevel>Level3</WarningLevel> | ||
120 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||
121 | </ClCompile> | ||
122 | <Link> | ||
123 | <OutputFile>..\..\bin\Win64-VisualStudio\21.Quake3Explorer.exe</OutputFile> | ||
124 | <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
125 | <GenerateDebugInformation>true</GenerateDebugInformation> | ||
126 | <ProgramDatabaseFile>$(OutDir)Quake3MapShader.pdb</ProgramDatabaseFile> | ||
127 | <SubSystem>Console</SubSystem> | ||
128 | <DataExecutionPrevention> | ||
129 | </DataExecutionPrevention> | ||
130 | </Link> | ||
131 | </ItemDefinitionGroup> | ||
132 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
133 | <ClCompile> | ||
134 | <IntrinsicFunctions>true</IntrinsicFunctions> | ||
135 | <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> | ||
136 | <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
137 | <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
138 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
139 | <BufferSecurityCheck>false</BufferSecurityCheck> | ||
140 | <PrecompiledHeader> | ||
141 | </PrecompiledHeader> | ||
142 | <WarningLevel>Level3</WarningLevel> | ||
143 | <DebugInformationFormat> | ||
144 | </DebugInformationFormat> | ||
145 | <CallingConvention>FastCall</CallingConvention> | ||
146 | </ClCompile> | ||
147 | <Link> | ||
148 | <OutputFile>..\..\bin\Win32-VisualStudio\21.Quake3Explorer.exe</OutputFile> | ||
149 | <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
150 | <GenerateDebugInformation>false</GenerateDebugInformation> | ||
151 | <SubSystem>Console</SubSystem> | ||
152 | <OptimizeReferences>true</OptimizeReferences> | ||
153 | <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
154 | <DataExecutionPrevention> | ||
155 | </DataExecutionPrevention> | ||
156 | </Link> | ||
157 | </ItemDefinitionGroup> | ||
158 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
159 | <ClCompile> | ||
160 | <IntrinsicFunctions>true</IntrinsicFunctions> | ||
161 | <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> | ||
162 | <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
163 | <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
164 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
165 | <BufferSecurityCheck>false</BufferSecurityCheck> | ||
166 | <PrecompiledHeader> | ||
167 | </PrecompiledHeader> | ||
168 | <WarningLevel>Level3</WarningLevel> | ||
169 | <DebugInformationFormat> | ||
170 | </DebugInformationFormat> | ||
171 | <CallingConvention>FastCall</CallingConvention> | ||
172 | </ClCompile> | ||
173 | <Link> | ||
174 | <OutputFile>..\..\bin\Win64-VisualStudio\21.Quake3Explorer.exe</OutputFile> | ||
175 | <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
176 | <GenerateDebugInformation>false</GenerateDebugInformation> | ||
177 | <SubSystem>Console</SubSystem> | ||
178 | <OptimizeReferences>true</OptimizeReferences> | ||
179 | <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
180 | <DataExecutionPrevention> | ||
181 | </DataExecutionPrevention> | ||
182 | </Link> | ||
183 | </ItemDefinitionGroup> | ||
184 | <ItemGroup> | ||
185 | <ClCompile Include="main.cpp" /> | ||
186 | <ClCompile Include="q3factory.cpp" /> | ||
187 | <ClCompile Include="sound.cpp" /> | ||
188 | </ItemGroup> | ||
189 | <ItemGroup> | ||
190 | <ClInclude Include="q3factory.h" /> | ||
191 | <ClInclude Include="sound.h" /> | ||
192 | </ItemGroup> | ||
193 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
194 | <ImportGroup Label="ExtensionTargets"> | ||
195 | </ImportGroup> | ||
196 | </Project> \ No newline at end of file | ||
diff --git a/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer_vc11.vcxproj b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer_vc11.vcxproj new file mode 100644 index 0000000..d0c29b2 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer_vc11.vcxproj | |||
@@ -0,0 +1,200 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
3 | <ItemGroup Label="ProjectConfigurations"> | ||
4 | <ProjectConfiguration Include="Debug|Win32"> | ||
5 | <Configuration>Debug</Configuration> | ||
6 | <Platform>Win32</Platform> | ||
7 | </ProjectConfiguration> | ||
8 | <ProjectConfiguration Include="Debug|x64"> | ||
9 | <Configuration>Debug</Configuration> | ||
10 | <Platform>x64</Platform> | ||
11 | </ProjectConfiguration> | ||
12 | <ProjectConfiguration Include="Release|Win32"> | ||
13 | <Configuration>Release</Configuration> | ||
14 | <Platform>Win32</Platform> | ||
15 | </ProjectConfiguration> | ||
16 | <ProjectConfiguration Include="Release|x64"> | ||
17 | <Configuration>Release</Configuration> | ||
18 | <Platform>x64</Platform> | ||
19 | </ProjectConfiguration> | ||
20 | </ItemGroup> | ||
21 | <PropertyGroup Label="Globals"> | ||
22 | <ProjectName>21.Quake3Explorer</ProjectName> | ||
23 | <ProjectGuid>{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}</ProjectGuid> | ||
24 | <RootNamespace>21.Quake3Explorer</RootNamespace> | ||
25 | <Keyword>Win32Proj</Keyword> | ||
26 | </PropertyGroup> | ||
27 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
28 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
29 | <ConfigurationType>Application</ConfigurationType> | ||
30 | <CharacterSet>MultiByte</CharacterSet> | ||
31 | <PlatformToolset>v110</PlatformToolset> | ||
32 | </PropertyGroup> | ||
33 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
34 | <ConfigurationType>Application</ConfigurationType> | ||
35 | <CharacterSet>MultiByte</CharacterSet> | ||
36 | <PlatformToolset>v110</PlatformToolset> | ||
37 | </PropertyGroup> | ||
38 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||
39 | <ConfigurationType>Application</ConfigurationType> | ||
40 | <CharacterSet>MultiByte</CharacterSet> | ||
41 | <PlatformToolset>v110</PlatformToolset> | ||
42 | </PropertyGroup> | ||
43 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
44 | <ConfigurationType>Application</ConfigurationType> | ||
45 | <CharacterSet>MultiByte</CharacterSet> | ||
46 | <PlatformToolset>v110</PlatformToolset> | ||
47 | </PropertyGroup> | ||
48 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
49 | <ImportGroup Label="ExtensionSettings"> | ||
50 | </ImportGroup> | ||
51 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> | ||
52 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
53 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | ||
54 | </ImportGroup> | ||
55 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> | ||
56 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
57 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | ||
58 | </ImportGroup> | ||
59 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> | ||
60 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
61 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | ||
62 | </ImportGroup> | ||
63 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> | ||
64 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
65 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | ||
66 | </ImportGroup> | ||
67 | <PropertyGroup Label="UserMacros" /> | ||
68 | <PropertyGroup> | ||
69 | <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> | ||
70 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\bin\Win32-VisualStudio\</OutDir> | ||
71 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\bin\Win64-VisualStudio\</OutDir> | ||
72 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> | ||
73 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> | ||
74 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\bin\Win32-VisualStudio\</OutDir> | ||
75 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\bin\Win64-VisualStudio\</OutDir> | ||
76 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> | ||
77 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> | ||
78 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> | ||
79 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> | ||
80 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> | ||
81 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> | ||
82 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> | ||
83 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> | ||
84 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> | ||
85 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> | ||
86 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | ||
87 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> | ||
88 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | ||
89 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> | ||
90 | </PropertyGroup> | ||
91 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
92 | <ClCompile> | ||
93 | <Optimization>Disabled</Optimization> | ||
94 | <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
95 | <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
96 | <MinimalRebuild>true</MinimalRebuild> | ||
97 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | ||
98 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||
99 | <PrecompiledHeader> | ||
100 | </PrecompiledHeader> | ||
101 | <WarningLevel>Level3</WarningLevel> | ||
102 | <DebugInformationFormat>EditAndContinue</DebugInformationFormat> | ||
103 | </ClCompile> | ||
104 | <Link> | ||
105 | <OutputFile>..\..\bin\Win32-VisualStudio\21.Quake3Explorer.exe</OutputFile> | ||
106 | <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
107 | <GenerateDebugInformation>true</GenerateDebugInformation> | ||
108 | <ProgramDatabaseFile>$(OutDir)Quake3MapShader.pdb</ProgramDatabaseFile> | ||
109 | <SubSystem>Console</SubSystem> | ||
110 | <DataExecutionPrevention> | ||
111 | </DataExecutionPrevention> | ||
112 | </Link> | ||
113 | </ItemDefinitionGroup> | ||
114 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
115 | <ClCompile> | ||
116 | <Optimization>Disabled</Optimization> | ||
117 | <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
118 | <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
119 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | ||
120 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||
121 | <PrecompiledHeader> | ||
122 | </PrecompiledHeader> | ||
123 | <WarningLevel>Level3</WarningLevel> | ||
124 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||
125 | </ClCompile> | ||
126 | <Link> | ||
127 | <OutputFile>..\..\bin\Win64-VisualStudio\21.Quake3Explorer.exe</OutputFile> | ||
128 | <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
129 | <GenerateDebugInformation>true</GenerateDebugInformation> | ||
130 | <ProgramDatabaseFile>$(OutDir)Quake3MapShader.pdb</ProgramDatabaseFile> | ||
131 | <SubSystem>Console</SubSystem> | ||
132 | <DataExecutionPrevention> | ||
133 | </DataExecutionPrevention> | ||
134 | </Link> | ||
135 | </ItemDefinitionGroup> | ||
136 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
137 | <ClCompile> | ||
138 | <IntrinsicFunctions>true</IntrinsicFunctions> | ||
139 | <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> | ||
140 | <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
141 | <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
142 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
143 | <BufferSecurityCheck>false</BufferSecurityCheck> | ||
144 | <PrecompiledHeader> | ||
145 | </PrecompiledHeader> | ||
146 | <WarningLevel>Level3</WarningLevel> | ||
147 | <DebugInformationFormat> | ||
148 | </DebugInformationFormat> | ||
149 | <CallingConvention>FastCall</CallingConvention> | ||
150 | </ClCompile> | ||
151 | <Link> | ||
152 | <OutputFile>..\..\bin\Win32-VisualStudio\21.Quake3Explorer.exe</OutputFile> | ||
153 | <AdditionalLibraryDirectories>..\..\lib\Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
154 | <GenerateDebugInformation>false</GenerateDebugInformation> | ||
155 | <SubSystem>Console</SubSystem> | ||
156 | <OptimizeReferences>true</OptimizeReferences> | ||
157 | <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
158 | <DataExecutionPrevention> | ||
159 | </DataExecutionPrevention> | ||
160 | </Link> | ||
161 | </ItemDefinitionGroup> | ||
162 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
163 | <ClCompile> | ||
164 | <IntrinsicFunctions>true</IntrinsicFunctions> | ||
165 | <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> | ||
166 | <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
167 | <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
168 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
169 | <BufferSecurityCheck>false</BufferSecurityCheck> | ||
170 | <PrecompiledHeader> | ||
171 | </PrecompiledHeader> | ||
172 | <WarningLevel>Level3</WarningLevel> | ||
173 | <DebugInformationFormat> | ||
174 | </DebugInformationFormat> | ||
175 | <CallingConvention>FastCall</CallingConvention> | ||
176 | </ClCompile> | ||
177 | <Link> | ||
178 | <OutputFile>..\..\bin\Win64-VisualStudio\21.Quake3Explorer.exe</OutputFile> | ||
179 | <AdditionalLibraryDirectories>..\..\lib\Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
180 | <GenerateDebugInformation>false</GenerateDebugInformation> | ||
181 | <SubSystem>Console</SubSystem> | ||
182 | <OptimizeReferences>true</OptimizeReferences> | ||
183 | <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
184 | <DataExecutionPrevention> | ||
185 | </DataExecutionPrevention> | ||
186 | </Link> | ||
187 | </ItemDefinitionGroup> | ||
188 | <ItemGroup> | ||
189 | <ClCompile Include="main.cpp" /> | ||
190 | <ClCompile Include="q3factory.cpp" /> | ||
191 | <ClCompile Include="sound.cpp" /> | ||
192 | </ItemGroup> | ||
193 | <ItemGroup> | ||
194 | <ClInclude Include="q3factory.h" /> | ||
195 | <ClInclude Include="sound.h" /> | ||
196 | </ItemGroup> | ||
197 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
198 | <ImportGroup Label="ExtensionTargets"> | ||
199 | </ImportGroup> | ||
200 | </Project> \ No newline at end of file | ||
diff --git a/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer_vc8.vcproj b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer_vc8.vcproj new file mode 100644 index 0000000..9045027 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer_vc8.vcproj | |||
@@ -0,0 +1,210 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="8,00" | ||
5 | Name="21.Quake3Explorer_vc8" | ||
6 | ProjectGUID="{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}" | ||
7 | RootNamespace="21.Quake3Explorer_vc8" | ||
8 | Keyword="Win32Proj" | ||
9 | > | ||
10 | <Platforms> | ||
11 | <Platform | ||
12 | Name="Win32" | ||
13 | /> | ||
14 | </Platforms> | ||
15 | <ToolFiles> | ||
16 | </ToolFiles> | ||
17 | <Configurations> | ||
18 | <Configuration | ||
19 | Name="Debug|Win32" | ||
20 | OutputDirectory="Debug" | ||
21 | IntermediateDirectory="Debug" | ||
22 | ConfigurationType="1" | ||
23 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
24 | CharacterSet="2" | ||
25 | > | ||
26 | <Tool | ||
27 | Name="VCPreBuildEventTool" | ||
28 | /> | ||
29 | <Tool | ||
30 | Name="VCCustomBuildTool" | ||
31 | /> | ||
32 | <Tool | ||
33 | Name="VCXMLDataGeneratorTool" | ||
34 | /> | ||
35 | <Tool | ||
36 | Name="VCWebServiceProxyGeneratorTool" | ||
37 | /> | ||
38 | <Tool | ||
39 | Name="VCMIDLTool" | ||
40 | /> | ||
41 | <Tool | ||
42 | Name="VCCLCompilerTool" | ||
43 | Optimization="0" | ||
44 | AdditionalIncludeDirectories="..\..\include" | ||
45 | PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" | ||
46 | MinimalRebuild="true" | ||
47 | BasicRuntimeChecks="3" | ||
48 | RuntimeLibrary="1" | ||
49 | UsePrecompiledHeader="0" | ||
50 | WarningLevel="3" | ||
51 | Detect64BitPortabilityProblems="true" | ||
52 | DebugInformationFormat="4" | ||
53 | DisableSpecificWarnings="4996" | ||
54 | /> | ||
55 | <Tool | ||
56 | Name="VCManagedResourceCompilerTool" | ||
57 | /> | ||
58 | <Tool | ||
59 | Name="VCResourceCompilerTool" | ||
60 | /> | ||
61 | <Tool | ||
62 | Name="VCPreLinkEventTool" | ||
63 | /> | ||
64 | <Tool | ||
65 | Name="VCLinkerTool" | ||
66 | OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe" | ||
67 | LinkIncremental="2" | ||
68 | AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio" | ||
69 | GenerateDebugInformation="true" | ||
70 | ProgramDatabaseFile="$(OutDir)/Quake3MapShader.pdb" | ||
71 | SubSystem="1" | ||
72 | TargetMachine="1" | ||
73 | /> | ||
74 | <Tool | ||
75 | Name="VCALinkTool" | ||
76 | /> | ||
77 | <Tool | ||
78 | Name="VCManifestTool" | ||
79 | /> | ||
80 | <Tool | ||
81 | Name="VCXDCMakeTool" | ||
82 | /> | ||
83 | <Tool | ||
84 | Name="VCBscMakeTool" | ||
85 | /> | ||
86 | <Tool | ||
87 | Name="VCFxCopTool" | ||
88 | /> | ||
89 | <Tool | ||
90 | Name="VCAppVerifierTool" | ||
91 | /> | ||
92 | <Tool | ||
93 | Name="VCWebDeploymentTool" | ||
94 | /> | ||
95 | <Tool | ||
96 | Name="VCPostBuildEventTool" | ||
97 | /> | ||
98 | </Configuration> | ||
99 | <Configuration | ||
100 | Name="Release|Win32" | ||
101 | OutputDirectory="Release" | ||
102 | IntermediateDirectory="Release" | ||
103 | ConfigurationType="1" | ||
104 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
105 | CharacterSet="2" | ||
106 | > | ||
107 | <Tool | ||
108 | Name="VCPreBuildEventTool" | ||
109 | /> | ||
110 | <Tool | ||
111 | Name="VCCustomBuildTool" | ||
112 | /> | ||
113 | <Tool | ||
114 | Name="VCXMLDataGeneratorTool" | ||
115 | /> | ||
116 | <Tool | ||
117 | Name="VCWebServiceProxyGeneratorTool" | ||
118 | /> | ||
119 | <Tool | ||
120 | Name="VCMIDLTool" | ||
121 | /> | ||
122 | <Tool | ||
123 | Name="VCCLCompilerTool" | ||
124 | Optimization="2" | ||
125 | EnableIntrinsicFunctions="true" | ||
126 | FavorSizeOrSpeed="1" | ||
127 | AdditionalIncludeDirectories="..\..\include" | ||
128 | PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" | ||
129 | RuntimeLibrary="0" | ||
130 | BufferSecurityCheck="false" | ||
131 | UsePrecompiledHeader="0" | ||
132 | WarningLevel="3" | ||
133 | Detect64BitPortabilityProblems="true" | ||
134 | DebugInformationFormat="0" | ||
135 | CallingConvention="1" | ||
136 | DisableSpecificWarnings="4996" | ||
137 | /> | ||
138 | <Tool | ||
139 | Name="VCManagedResourceCompilerTool" | ||
140 | /> | ||
141 | <Tool | ||
142 | Name="VCResourceCompilerTool" | ||
143 | /> | ||
144 | <Tool | ||
145 | Name="VCPreLinkEventTool" | ||
146 | /> | ||
147 | <Tool | ||
148 | Name="VCLinkerTool" | ||
149 | OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe" | ||
150 | LinkIncremental="1" | ||
151 | AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio" | ||
152 | GenerateDebugInformation="false" | ||
153 | SubSystem="1" | ||
154 | OptimizeReferences="2" | ||
155 | EnableCOMDATFolding="2" | ||
156 | TargetMachine="1" | ||
157 | /> | ||
158 | <Tool | ||
159 | Name="VCALinkTool" | ||
160 | /> | ||
161 | <Tool | ||
162 | Name="VCManifestTool" | ||
163 | /> | ||
164 | <Tool | ||
165 | Name="VCXDCMakeTool" | ||
166 | /> | ||
167 | <Tool | ||
168 | Name="VCBscMakeTool" | ||
169 | /> | ||
170 | <Tool | ||
171 | Name="VCFxCopTool" | ||
172 | /> | ||
173 | <Tool | ||
174 | Name="VCAppVerifierTool" | ||
175 | /> | ||
176 | <Tool | ||
177 | Name="VCWebDeploymentTool" | ||
178 | /> | ||
179 | <Tool | ||
180 | Name="VCPostBuildEventTool" | ||
181 | /> | ||
182 | </Configuration> | ||
183 | </Configurations> | ||
184 | <References> | ||
185 | </References> | ||
186 | <Files> | ||
187 | <File | ||
188 | RelativePath=".\main.cpp" | ||
189 | > | ||
190 | </File> | ||
191 | <File | ||
192 | RelativePath=".\q3factory.cpp" | ||
193 | > | ||
194 | </File> | ||
195 | <File | ||
196 | RelativePath=".\q3factory.h" | ||
197 | > | ||
198 | </File> | ||
199 | <File | ||
200 | RelativePath=".\sound.cpp" | ||
201 | > | ||
202 | </File> | ||
203 | <File | ||
204 | RelativePath=".\sound.h" | ||
205 | > | ||
206 | </File> | ||
207 | </Files> | ||
208 | <Globals> | ||
209 | </Globals> | ||
210 | </VisualStudioProject> | ||
diff --git a/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer_vc9.vcproj b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer_vc9.vcproj new file mode 100644 index 0000000..36aee41 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/Quake3Explorer_vc9.vcproj | |||
@@ -0,0 +1,204 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="9,00" | ||
5 | Name="21.Quake3Explorer_vc9" | ||
6 | ProjectGUID="{CDC4AAA9-72E1-4FFA-A04D-7EF59D8B97CD}" | ||
7 | RootNamespace="21.Quake3Explorer_vc9" | ||
8 | Keyword="Win32Proj" | ||
9 | TargetFrameworkVersion="131072" | ||
10 | > | ||
11 | <Platforms> | ||
12 | <Platform | ||
13 | Name="Win32" | ||
14 | /> | ||
15 | </Platforms> | ||
16 | <ToolFiles> | ||
17 | </ToolFiles> | ||
18 | <Configurations> | ||
19 | <Configuration | ||
20 | Name="Debug|Win32" | ||
21 | OutputDirectory="Debug" | ||
22 | IntermediateDirectory="Debug" | ||
23 | ConfigurationType="1" | ||
24 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
25 | CharacterSet="2" | ||
26 | > | ||
27 | <Tool | ||
28 | Name="VCPreBuildEventTool" | ||
29 | /> | ||
30 | <Tool | ||
31 | Name="VCCustomBuildTool" | ||
32 | /> | ||
33 | <Tool | ||
34 | Name="VCXMLDataGeneratorTool" | ||
35 | /> | ||
36 | <Tool | ||
37 | Name="VCWebServiceProxyGeneratorTool" | ||
38 | /> | ||
39 | <Tool | ||
40 | Name="VCMIDLTool" | ||
41 | /> | ||
42 | <Tool | ||
43 | Name="VCCLCompilerTool" | ||
44 | Optimization="0" | ||
45 | AdditionalIncludeDirectories="..\..\include" | ||
46 | PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" | ||
47 | MinimalRebuild="true" | ||
48 | BasicRuntimeChecks="3" | ||
49 | RuntimeLibrary="1" | ||
50 | UsePrecompiledHeader="0" | ||
51 | WarningLevel="3" | ||
52 | DebugInformationFormat="4" | ||
53 | /> | ||
54 | <Tool | ||
55 | Name="VCManagedResourceCompilerTool" | ||
56 | /> | ||
57 | <Tool | ||
58 | Name="VCResourceCompilerTool" | ||
59 | /> | ||
60 | <Tool | ||
61 | Name="VCPreLinkEventTool" | ||
62 | /> | ||
63 | <Tool | ||
64 | Name="VCLinkerTool" | ||
65 | OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe" | ||
66 | LinkIncremental="2" | ||
67 | AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio" | ||
68 | GenerateDebugInformation="true" | ||
69 | ProgramDatabaseFile="$(OutDir)/Quake3MapShader.pdb" | ||
70 | SubSystem="1" | ||
71 | RandomizedBaseAddress="1" | ||
72 | DataExecutionPrevention="0" | ||
73 | TargetMachine="1" | ||
74 | /> | ||
75 | <Tool | ||
76 | Name="VCALinkTool" | ||
77 | /> | ||
78 | <Tool | ||
79 | Name="VCManifestTool" | ||
80 | /> | ||
81 | <Tool | ||
82 | Name="VCXDCMakeTool" | ||
83 | /> | ||
84 | <Tool | ||
85 | Name="VCBscMakeTool" | ||
86 | /> | ||
87 | <Tool | ||
88 | Name="VCFxCopTool" | ||
89 | /> | ||
90 | <Tool | ||
91 | Name="VCAppVerifierTool" | ||
92 | /> | ||
93 | <Tool | ||
94 | Name="VCPostBuildEventTool" | ||
95 | /> | ||
96 | </Configuration> | ||
97 | <Configuration | ||
98 | Name="Release|Win32" | ||
99 | OutputDirectory="Release" | ||
100 | IntermediateDirectory="Release" | ||
101 | ConfigurationType="1" | ||
102 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | ||
103 | CharacterSet="2" | ||
104 | > | ||
105 | <Tool | ||
106 | Name="VCPreBuildEventTool" | ||
107 | /> | ||
108 | <Tool | ||
109 | Name="VCCustomBuildTool" | ||
110 | /> | ||
111 | <Tool | ||
112 | Name="VCXMLDataGeneratorTool" | ||
113 | /> | ||
114 | <Tool | ||
115 | Name="VCWebServiceProxyGeneratorTool" | ||
116 | /> | ||
117 | <Tool | ||
118 | Name="VCMIDLTool" | ||
119 | /> | ||
120 | <Tool | ||
121 | Name="VCCLCompilerTool" | ||
122 | EnableIntrinsicFunctions="true" | ||
123 | FavorSizeOrSpeed="1" | ||
124 | AdditionalIncludeDirectories="..\..\include" | ||
125 | PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" | ||
126 | RuntimeLibrary="0" | ||
127 | BufferSecurityCheck="false" | ||
128 | UsePrecompiledHeader="0" | ||
129 | WarningLevel="3" | ||
130 | DebugInformationFormat="0" | ||
131 | CallingConvention="1" | ||
132 | /> | ||
133 | <Tool | ||
134 | Name="VCManagedResourceCompilerTool" | ||
135 | /> | ||
136 | <Tool | ||
137 | Name="VCResourceCompilerTool" | ||
138 | /> | ||
139 | <Tool | ||
140 | Name="VCPreLinkEventTool" | ||
141 | /> | ||
142 | <Tool | ||
143 | Name="VCLinkerTool" | ||
144 | OutputFile="..\..\bin\Win32-VisualStudio\21.Quake3MapExplorer.exe" | ||
145 | LinkIncremental="1" | ||
146 | AdditionalLibraryDirectories="..\..\lib\Win32-visualstudio" | ||
147 | GenerateDebugInformation="false" | ||
148 | SubSystem="1" | ||
149 | OptimizeReferences="2" | ||
150 | EnableCOMDATFolding="2" | ||
151 | RandomizedBaseAddress="1" | ||
152 | DataExecutionPrevention="0" | ||
153 | TargetMachine="1" | ||
154 | /> | ||
155 | <Tool | ||
156 | Name="VCALinkTool" | ||
157 | /> | ||
158 | <Tool | ||
159 | Name="VCManifestTool" | ||
160 | /> | ||
161 | <Tool | ||
162 | Name="VCXDCMakeTool" | ||
163 | /> | ||
164 | <Tool | ||
165 | Name="VCBscMakeTool" | ||
166 | /> | ||
167 | <Tool | ||
168 | Name="VCFxCopTool" | ||
169 | /> | ||
170 | <Tool | ||
171 | Name="VCAppVerifierTool" | ||
172 | /> | ||
173 | <Tool | ||
174 | Name="VCPostBuildEventTool" | ||
175 | /> | ||
176 | </Configuration> | ||
177 | </Configurations> | ||
178 | <References> | ||
179 | </References> | ||
180 | <Files> | ||
181 | <File | ||
182 | RelativePath=".\main.cpp" | ||
183 | > | ||
184 | </File> | ||
185 | <File | ||
186 | RelativePath=".\q3factory.cpp" | ||
187 | > | ||
188 | </File> | ||
189 | <File | ||
190 | RelativePath=".\q3factory.h" | ||
191 | > | ||
192 | </File> | ||
193 | <File | ||
194 | RelativePath=".\sound.cpp" | ||
195 | > | ||
196 | </File> | ||
197 | <File | ||
198 | RelativePath=".\sound.h" | ||
199 | > | ||
200 | </File> | ||
201 | </Files> | ||
202 | <Globals> | ||
203 | </Globals> | ||
204 | </VisualStudioProject> | ||
diff --git a/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/main.cpp b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/main.cpp new file mode 100644 index 0000000..b2277e6 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/main.cpp | |||
@@ -0,0 +1,2188 @@ | |||
1 | /** Example 021 Quake3 Explorer | ||
2 | |||
3 | This Tutorial shows how to load different Quake 3 maps. | ||
4 | |||
5 | Features: | ||
6 | - Load BSP Archives at Runtime from the menu | ||
7 | - Load a Map from the menu. Showing with Screenshot | ||
8 | - Set the VideoDriver at runtime from menu | ||
9 | - Adjust GammaLevel at runtime | ||
10 | - Create SceneNodes for the Shaders | ||
11 | - Load EntityList and create Entity SceneNodes | ||
12 | - Create Players with Weapons and with Collision Response | ||
13 | - Play music | ||
14 | |||
15 | You can download the Quake III Arena demo ( copyright id software ) | ||
16 | at the following location: | ||
17 | ftp://ftp.idsoftware.com/idstuff/quake3/win32/q3ademo.exe | ||
18 | |||
19 | Copyright 2006-2011 Burningwater, Thomas Alten | ||
20 | */ | ||
21 | |||
22 | #include "driverChoice.h" | ||
23 | #include <irrlicht.h> | ||
24 | #include "q3factory.h" | ||
25 | #include "sound.h" | ||
26 | |||
27 | /* | ||
28 | Game Data is used to hold Data which is needed to drive the game | ||
29 | */ | ||
30 | struct GameData | ||
31 | { | ||
32 | GameData ( const path &startupDir) : | ||
33 | retVal(0), StartupDir(startupDir), createExDevice(0), Device(0) | ||
34 | { | ||
35 | setDefault (); | ||
36 | } | ||
37 | |||
38 | void setDefault (); | ||
39 | s32 save ( const path &filename ); | ||
40 | s32 load ( const path &filename ); | ||
41 | |||
42 | s32 debugState; | ||
43 | s32 gravityState; | ||
44 | s32 flyTroughState; | ||
45 | s32 wireFrame; | ||
46 | s32 guiActive; | ||
47 | s32 guiInputActive; | ||
48 | f32 GammaValue; | ||
49 | s32 retVal; | ||
50 | s32 sound; | ||
51 | |||
52 | path StartupDir; | ||
53 | stringw CurrentMapName; | ||
54 | array<path> CurrentArchiveList; | ||
55 | |||
56 | vector3df PlayerPosition; | ||
57 | vector3df PlayerRotation; | ||
58 | |||
59 | tQ3EntityList Variable; | ||
60 | |||
61 | Q3LevelLoadParameter loadParam; | ||
62 | SIrrlichtCreationParameters deviceParam; | ||
63 | funcptr_createDeviceEx createExDevice; | ||
64 | IrrlichtDevice *Device; | ||
65 | }; | ||
66 | |||
67 | /* | ||
68 | set default settings | ||
69 | */ | ||
70 | void GameData::setDefault () | ||
71 | { | ||
72 | debugState = EDS_OFF; | ||
73 | gravityState = 1; | ||
74 | flyTroughState = 0; | ||
75 | wireFrame = 0; | ||
76 | guiActive = 1; | ||
77 | guiInputActive = 0; | ||
78 | GammaValue = 1.f; | ||
79 | |||
80 | // default deviceParam; | ||
81 | #if defined ( _IRR_WINDOWS_ ) | ||
82 | deviceParam.DriverType = EDT_DIRECT3D9; | ||
83 | #else | ||
84 | deviceParam.DriverType = EDT_OPENGL; | ||
85 | #endif | ||
86 | deviceParam.WindowSize.Width = 800; | ||
87 | deviceParam.WindowSize.Height = 600; | ||
88 | deviceParam.Fullscreen = false; | ||
89 | deviceParam.Bits = 24; | ||
90 | deviceParam.ZBufferBits = 16; | ||
91 | deviceParam.Vsync = false; | ||
92 | deviceParam.AntiAlias = false; | ||
93 | |||
94 | // default Quake3 loadParam | ||
95 | loadParam.defaultLightMapMaterial = EMT_LIGHTMAP; | ||
96 | loadParam.defaultModulate = EMFN_MODULATE_1X; | ||
97 | loadParam.defaultFilter = EMF_ANISOTROPIC_FILTER; | ||
98 | loadParam.verbose = 2; | ||
99 | loadParam.mergeShaderBuffer = 1; // merge meshbuffers with same material | ||
100 | loadParam.cleanUnResolvedMeshes = 1; // should unresolved meshes be cleaned. otherwise blue texture | ||
101 | loadParam.loadAllShaders = 1; // load all scripts in the script directory | ||
102 | loadParam.loadSkyShader = 0; // load sky Shader | ||
103 | loadParam.alpharef = 1; | ||
104 | |||
105 | sound = 0; | ||
106 | |||
107 | CurrentMapName = ""; | ||
108 | CurrentArchiveList.clear (); | ||
109 | |||
110 | // Explorer Media directory | ||
111 | CurrentArchiveList.push_back ( StartupDir + "../../media/" ); | ||
112 | |||
113 | // Add the original quake3 files before you load your custom map | ||
114 | // Most mods are using the original shaders, models&items&weapons | ||
115 | CurrentArchiveList.push_back("/q/baseq3/"); | ||
116 | |||
117 | CurrentArchiveList.push_back(StartupDir + "../../media/map-20kdm2.pk3"); | ||
118 | } | ||
119 | |||
120 | /* | ||
121 | Load the current game State from a typical quake3 cfg file | ||
122 | */ | ||
123 | s32 GameData::load ( const path &filename ) | ||
124 | { | ||
125 | if (!Device) | ||
126 | return 0; | ||
127 | |||
128 | // the quake3 mesh loader can also handle *.shader and *.cfg file | ||
129 | IQ3LevelMesh* mesh = (IQ3LevelMesh*) Device->getSceneManager()->getMesh ( filename ); | ||
130 | if (!mesh) | ||
131 | return 0; | ||
132 | |||
133 | tQ3EntityList &entityList = mesh->getEntityList (); | ||
134 | |||
135 | stringc s; | ||
136 | u32 pos; | ||
137 | |||
138 | for ( u32 e = 0; e != entityList.size (); ++e ) | ||
139 | { | ||
140 | //dumpShader ( s, &entityList[e], false ); | ||
141 | //printf ( s.c_str () ); | ||
142 | |||
143 | for ( u32 g = 0; g != entityList[e].getGroupSize (); ++g ) | ||
144 | { | ||
145 | const SVarGroup *group = entityList[e].getGroup ( g ); | ||
146 | |||
147 | for ( u32 index = 0; index < group->Variable.size (); ++index ) | ||
148 | { | ||
149 | const SVariable &v = group->Variable[index]; | ||
150 | pos = 0; | ||
151 | if ( v.name == "playerposition" ) | ||
152 | { | ||
153 | PlayerPosition = getAsVector3df ( v.content, pos ); | ||
154 | } | ||
155 | else | ||
156 | if ( v.name == "playerrotation" ) | ||
157 | { | ||
158 | PlayerRotation = getAsVector3df ( v.content, pos ); | ||
159 | } | ||
160 | } | ||
161 | } | ||
162 | } | ||
163 | |||
164 | return 1; | ||
165 | } | ||
166 | |||
167 | /* | ||
168 | Store the current game State in a quake3 configuration file | ||
169 | */ | ||
170 | s32 GameData::save ( const path &filename ) | ||
171 | { | ||
172 | return 0; | ||
173 | if (!Device) | ||
174 | return 0; | ||
175 | |||
176 | c8 buf[128]; | ||
177 | u32 i; | ||
178 | |||
179 | // Store current Archive for restart | ||
180 | CurrentArchiveList.clear(); | ||
181 | IFileSystem *fs = Device->getFileSystem(); | ||
182 | for ( i = 0; i != fs->getFileArchiveCount(); ++i ) | ||
183 | { | ||
184 | CurrentArchiveList.push_back ( fs->getFileArchive(i)->getFileList()->getPath() ); | ||
185 | } | ||
186 | |||
187 | // Store Player Position and Rotation | ||
188 | ICameraSceneNode * camera = Device->getSceneManager()->getActiveCamera (); | ||
189 | if ( camera ) | ||
190 | { | ||
191 | PlayerPosition = camera->getPosition (); | ||
192 | PlayerRotation = camera->getRotation (); | ||
193 | } | ||
194 | |||
195 | IWriteFile *file = fs->createAndWriteFile ( filename ); | ||
196 | if (!file) | ||
197 | return 0; | ||
198 | |||
199 | snprintf ( buf, 128, "playerposition %.f %.f %.f\nplayerrotation %.f %.f %.f\n", | ||
200 | PlayerPosition.X, PlayerPosition.Z, PlayerPosition.Y, | ||
201 | PlayerRotation.X, PlayerRotation.Z, PlayerRotation.Y); | ||
202 | file->write ( buf, (s32) strlen ( buf ) ); | ||
203 | for ( i = 0; i != fs->getFileArchiveCount(); ++i ) | ||
204 | { | ||
205 | snprintf ( buf, 128, "archive %s\n",stringc ( fs->getFileArchive(i)->getFileList()->getPath() ).c_str () ); | ||
206 | file->write ( buf, (s32) strlen ( buf ) ); | ||
207 | } | ||
208 | |||
209 | file->drop (); | ||
210 | return 1; | ||
211 | } | ||
212 | |||
213 | /* | ||
214 | Representing a player | ||
215 | */ | ||
216 | struct Q3Player : public IAnimationEndCallBack | ||
217 | { | ||
218 | Q3Player () | ||
219 | : Device(0), MapParent(0), Mesh(0), WeaponNode(0), StartPositionCurrent(0) | ||
220 | { | ||
221 | animation[0] = 0; | ||
222 | memset(Anim, 0, sizeof(TimeFire)*4); | ||
223 | } | ||
224 | |||
225 | virtual void OnAnimationEnd(IAnimatedMeshSceneNode* node); | ||
226 | |||
227 | void create ( IrrlichtDevice *device, | ||
228 | IQ3LevelMesh* mesh, | ||
229 | ISceneNode *mapNode, | ||
230 | IMetaTriangleSelector *meta | ||
231 | ); | ||
232 | void shutdown (); | ||
233 | void setAnim ( const c8 *name ); | ||
234 | void respawn (); | ||
235 | void setpos ( const vector3df &pos, const vector3df& rotation ); | ||
236 | |||
237 | ISceneNodeAnimatorCollisionResponse * cam() { return camCollisionResponse ( Device ); } | ||
238 | |||
239 | IrrlichtDevice *Device; | ||
240 | ISceneNode* MapParent; | ||
241 | IQ3LevelMesh* Mesh; | ||
242 | IAnimatedMeshSceneNode* WeaponNode; | ||
243 | s32 StartPositionCurrent; | ||
244 | TimeFire Anim[4]; | ||
245 | c8 animation[64]; | ||
246 | c8 buf[64]; | ||
247 | }; | ||
248 | |||
249 | |||
250 | /* End player | ||
251 | */ | ||
252 | void Q3Player::shutdown () | ||
253 | { | ||
254 | setAnim ( 0 ); | ||
255 | |||
256 | dropElement (WeaponNode); | ||
257 | |||
258 | if ( Device ) | ||
259 | { | ||
260 | ICameraSceneNode* camera = Device->getSceneManager()->getActiveCamera(); | ||
261 | dropElement ( camera ); | ||
262 | Device = 0; | ||
263 | } | ||
264 | |||
265 | MapParent = 0; | ||
266 | Mesh = 0; | ||
267 | } | ||
268 | |||
269 | |||
270 | /* create a new player | ||
271 | */ | ||
272 | void Q3Player::create ( IrrlichtDevice *device, IQ3LevelMesh* mesh, ISceneNode *mapNode, IMetaTriangleSelector *meta ) | ||
273 | { | ||
274 | setTimeFire ( Anim + 0, 200, FIRED ); | ||
275 | setTimeFire ( Anim + 1, 5000 ); | ||
276 | |||
277 | if (!device) | ||
278 | return; | ||
279 | // load FPS weapon to Camera | ||
280 | Device = device; | ||
281 | Mesh = mesh; | ||
282 | MapParent = mapNode; | ||
283 | |||
284 | ISceneManager *smgr = device->getSceneManager (); | ||
285 | IVideoDriver * driver = device->getVideoDriver(); | ||
286 | |||
287 | ICameraSceneNode* camera = 0; | ||
288 | |||
289 | SKeyMap keyMap[10]; | ||
290 | keyMap[0].Action = EKA_MOVE_FORWARD; | ||
291 | keyMap[0].KeyCode = KEY_UP; | ||
292 | keyMap[1].Action = EKA_MOVE_FORWARD; | ||
293 | keyMap[1].KeyCode = KEY_KEY_W; | ||
294 | |||
295 | keyMap[2].Action = EKA_MOVE_BACKWARD; | ||
296 | keyMap[2].KeyCode = KEY_DOWN; | ||
297 | keyMap[3].Action = EKA_MOVE_BACKWARD; | ||
298 | keyMap[3].KeyCode = KEY_KEY_S; | ||
299 | |||
300 | keyMap[4].Action = EKA_STRAFE_LEFT; | ||
301 | keyMap[4].KeyCode = KEY_LEFT; | ||
302 | keyMap[5].Action = EKA_STRAFE_LEFT; | ||
303 | keyMap[5].KeyCode = KEY_KEY_A; | ||
304 | |||
305 | keyMap[6].Action = EKA_STRAFE_RIGHT; | ||
306 | keyMap[6].KeyCode = KEY_RIGHT; | ||
307 | keyMap[7].Action = EKA_STRAFE_RIGHT; | ||
308 | keyMap[7].KeyCode = KEY_KEY_D; | ||
309 | |||
310 | keyMap[8].Action = EKA_JUMP_UP; | ||
311 | keyMap[8].KeyCode = KEY_KEY_J; | ||
312 | |||
313 | keyMap[9].Action = EKA_CROUCH; | ||
314 | keyMap[9].KeyCode = KEY_KEY_C; | ||
315 | |||
316 | camera = smgr->addCameraSceneNodeFPS(0, 100.0f, 0.6f, -1, keyMap, 10, false, 0.6f); | ||
317 | camera->setName ( "First Person Camera" ); | ||
318 | //camera->setFOV ( 100.f * core::DEGTORAD ); | ||
319 | camera->setFarValue( 20000.f ); | ||
320 | |||
321 | IAnimatedMeshMD2* weaponMesh = (IAnimatedMeshMD2*) smgr->getMesh("gun.md2"); | ||
322 | if ( 0 == weaponMesh ) | ||
323 | return; | ||
324 | |||
325 | if ( weaponMesh->getMeshType() == EAMT_MD2 ) | ||
326 | { | ||
327 | s32 count = weaponMesh->getAnimationCount(); | ||
328 | for ( s32 i = 0; i != count; ++i ) | ||
329 | { | ||
330 | snprintf ( buf, 64, "Animation: %s", weaponMesh->getAnimationName(i) ); | ||
331 | device->getLogger()->log(buf, ELL_INFORMATION); | ||
332 | } | ||
333 | } | ||
334 | |||
335 | WeaponNode = smgr->addAnimatedMeshSceneNode( | ||
336 | weaponMesh, | ||
337 | smgr->getActiveCamera(), | ||
338 | 10, | ||
339 | vector3df( 0, 0, 0), | ||
340 | vector3df(-90,-90,90) | ||
341 | ); | ||
342 | WeaponNode->setMaterialFlag(EMF_LIGHTING, false); | ||
343 | WeaponNode->setMaterialTexture(0, driver->getTexture( "gun.jpg")); | ||
344 | WeaponNode->setLoopMode ( false ); | ||
345 | WeaponNode->setName ( "tommi the gun man" ); | ||
346 | |||
347 | //create a collision auto response animator | ||
348 | ISceneNodeAnimator* anim = | ||
349 | smgr->createCollisionResponseAnimator( meta, camera, | ||
350 | vector3df(30,45,30), | ||
351 | getGravity ( "earth" ), | ||
352 | vector3df(0,40,0), | ||
353 | 0.0005f | ||
354 | ); | ||
355 | |||
356 | camera->addAnimator( anim ); | ||
357 | anim->drop(); | ||
358 | |||
359 | if ( meta ) | ||
360 | { | ||
361 | meta->drop (); | ||
362 | } | ||
363 | |||
364 | respawn (); | ||
365 | setAnim ( "idle" ); | ||
366 | } | ||
367 | |||
368 | |||
369 | /* | ||
370 | so we need a good starting Position in the level. | ||
371 | we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch" | ||
372 | */ | ||
373 | void Q3Player::respawn () | ||
374 | { | ||
375 | if (!Device) | ||
376 | return; | ||
377 | ICameraSceneNode* camera = Device->getSceneManager()->getActiveCamera(); | ||
378 | |||
379 | Device->getLogger()->log( "respawn" ); | ||
380 | |||
381 | if ( StartPositionCurrent >= Q3StartPosition ( | ||
382 | Mesh, camera,StartPositionCurrent++, | ||
383 | cam ()->getEllipsoidTranslation() ) | ||
384 | ) | ||
385 | { | ||
386 | StartPositionCurrent = 0; | ||
387 | } | ||
388 | } | ||
389 | |||
390 | /* | ||
391 | set Player position from saved coordinates | ||
392 | */ | ||
393 | void Q3Player::setpos ( const vector3df &pos, const vector3df &rotation ) | ||
394 | { | ||
395 | if (!Device) | ||
396 | return; | ||
397 | Device->getLogger()->log( "setpos" ); | ||
398 | |||
399 | ICameraSceneNode* camera = Device->getSceneManager()->getActiveCamera(); | ||
400 | if ( camera ) | ||
401 | { | ||
402 | camera->setPosition ( pos ); | ||
403 | camera->setRotation ( rotation ); | ||
404 | //! New. FPSCamera and animators catches reset on animate 0 | ||
405 | camera->OnAnimate ( 0 ); | ||
406 | } | ||
407 | } | ||
408 | |||
409 | /* set the Animation of the player and weapon | ||
410 | */ | ||
411 | void Q3Player::setAnim ( const c8 *name ) | ||
412 | { | ||
413 | if ( name ) | ||
414 | { | ||
415 | snprintf ( animation, 64, "%s", name ); | ||
416 | if ( WeaponNode ) | ||
417 | { | ||
418 | WeaponNode->setAnimationEndCallback ( this ); | ||
419 | WeaponNode->setMD2Animation ( animation ); | ||
420 | } | ||
421 | } | ||
422 | else | ||
423 | { | ||
424 | animation[0] = 0; | ||
425 | if ( WeaponNode ) | ||
426 | { | ||
427 | WeaponNode->setAnimationEndCallback ( 0 ); | ||
428 | } | ||
429 | } | ||
430 | } | ||
431 | |||
432 | |||
433 | // Callback | ||
434 | void Q3Player::OnAnimationEnd(IAnimatedMeshSceneNode* node) | ||
435 | { | ||
436 | setAnim ( 0 ); | ||
437 | } | ||
438 | |||
439 | |||
440 | |||
441 | /* GUI Elements | ||
442 | */ | ||
443 | struct GUI | ||
444 | { | ||
445 | GUI () | ||
446 | { | ||
447 | memset ( this, 0, sizeof ( *this ) ); | ||
448 | } | ||
449 | |||
450 | void drop() | ||
451 | { | ||
452 | dropElement ( Window ); | ||
453 | dropElement ( Logo ); | ||
454 | } | ||
455 | |||
456 | IGUIComboBox* VideoDriver; | ||
457 | IGUIComboBox* VideoMode; | ||
458 | IGUICheckBox* FullScreen; | ||
459 | IGUICheckBox* Bit32; | ||
460 | IGUIScrollBar* MultiSample; | ||
461 | IGUIButton* SetVideoMode; | ||
462 | |||
463 | IGUIScrollBar* Tesselation; | ||
464 | IGUIScrollBar* Gamma; | ||
465 | IGUICheckBox* Collision; | ||
466 | IGUICheckBox* Visible_Map; | ||
467 | IGUICheckBox* Visible_Shader; | ||
468 | IGUICheckBox* Visible_Fog; | ||
469 | IGUICheckBox* Visible_Unresolved; | ||
470 | IGUICheckBox* Visible_Skydome; | ||
471 | IGUIButton* Respawn; | ||
472 | |||
473 | IGUITable* ArchiveList; | ||
474 | IGUIButton* ArchiveAdd; | ||
475 | IGUIButton* ArchiveRemove; | ||
476 | IGUIFileOpenDialog* ArchiveFileOpen; | ||
477 | IGUIButton* ArchiveUp; | ||
478 | IGUIButton* ArchiveDown; | ||
479 | |||
480 | IGUIListBox* MapList; | ||
481 | IGUITreeView* SceneTree; | ||
482 | IGUIStaticText* StatusLine; | ||
483 | IGUIImage* Logo; | ||
484 | IGUIWindow* Window; | ||
485 | }; | ||
486 | |||
487 | |||
488 | /* | ||
489 | CQuake3EventHandler controls the game | ||
490 | */ | ||
491 | class CQuake3EventHandler : public IEventReceiver | ||
492 | { | ||
493 | public: | ||
494 | |||
495 | CQuake3EventHandler( GameData *gameData ); | ||
496 | virtual ~CQuake3EventHandler (); | ||
497 | |||
498 | void Animate(); | ||
499 | void Render(); | ||
500 | |||
501 | void AddArchive ( const path& archiveName ); | ||
502 | void LoadMap ( const stringw& mapName, s32 collision ); | ||
503 | void CreatePlayers(); | ||
504 | void AddSky( u32 dome, const c8 *texture ); | ||
505 | Q3Player *GetPlayer ( u32 index ) { return &Player[index]; } | ||
506 | |||
507 | void CreateGUI(); | ||
508 | void SetGUIActive( s32 command); | ||
509 | |||
510 | bool OnEvent(const SEvent& eve); | ||
511 | |||
512 | |||
513 | private: | ||
514 | |||
515 | GameData *Game; | ||
516 | |||
517 | IQ3LevelMesh* Mesh; | ||
518 | ISceneNode* MapParent; | ||
519 | ISceneNode* ShaderParent; | ||
520 | ISceneNode* ItemParent; | ||
521 | ISceneNode* UnresolvedParent; | ||
522 | ISceneNode* BulletParent; | ||
523 | ISceneNode* FogParent; | ||
524 | ISceneNode * SkyNode; | ||
525 | IMetaTriangleSelector *Meta; | ||
526 | |||
527 | c8 buf[256]; | ||
528 | |||
529 | Q3Player Player[2]; | ||
530 | |||
531 | struct SParticleImpact | ||
532 | { | ||
533 | u32 when; | ||
534 | vector3df pos; | ||
535 | vector3df outVector; | ||
536 | }; | ||
537 | array<SParticleImpact> Impacts; | ||
538 | void useItem( Q3Player * player); | ||
539 | void createParticleImpacts( u32 now ); | ||
540 | |||
541 | void createTextures (); | ||
542 | void addSceneTreeItem( ISceneNode * parent, IGUITreeViewNode* nodeParent); | ||
543 | |||
544 | GUI gui; | ||
545 | void dropMap (); | ||
546 | }; | ||
547 | |||
548 | /* Constructor | ||
549 | */ | ||
550 | CQuake3EventHandler::CQuake3EventHandler( GameData *game ) | ||
551 | : Game(game), Mesh(0), MapParent(0), ShaderParent(0), ItemParent(0), UnresolvedParent(0), | ||
552 | BulletParent(0), FogParent(0), SkyNode(0), Meta(0) | ||
553 | { | ||
554 | buf[0]=0; | ||
555 | // Also use 16 Bit Textures for 16 Bit RenderDevice | ||
556 | if ( Game->deviceParam.Bits == 16 ) | ||
557 | { | ||
558 | game->Device->getVideoDriver()->setTextureCreationFlag(ETCF_ALWAYS_16_BIT, true); | ||
559 | } | ||
560 | |||
561 | // Quake3 Shader controls Z-Writing | ||
562 | game->Device->getSceneManager()->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true); | ||
563 | |||
564 | // create internal textures | ||
565 | createTextures (); | ||
566 | |||
567 | sound_init ( game->Device ); | ||
568 | |||
569 | Game->Device->setEventReceiver ( this ); | ||
570 | } | ||
571 | |||
572 | |||
573 | // destructor | ||
574 | CQuake3EventHandler::~CQuake3EventHandler () | ||
575 | { | ||
576 | Player[0].shutdown (); | ||
577 | sound_shutdown (); | ||
578 | |||
579 | Game->save( "explorer.cfg" ); | ||
580 | |||
581 | Game->Device->drop(); | ||
582 | } | ||
583 | |||
584 | |||
585 | // create runtime textures smog, fog | ||
586 | void CQuake3EventHandler::createTextures() | ||
587 | { | ||
588 | IVideoDriver * driver = Game->Device->getVideoDriver(); | ||
589 | |||
590 | dimension2du dim(64, 64); | ||
591 | |||
592 | video::IImage* image; | ||
593 | u32 i; | ||
594 | u32 x; | ||
595 | u32 y; | ||
596 | u32 * data; | ||
597 | for ( i = 0; i != 8; ++i ) | ||
598 | { | ||
599 | image = driver->createImage ( video::ECF_A8R8G8B8, dim); | ||
600 | data = (u32*) image->lock (); | ||
601 | for ( y = 0; y != dim.Height; ++y ) | ||
602 | { | ||
603 | for ( x = 0; x != dim.Width; ++x ) | ||
604 | { | ||
605 | data [x] = 0xFFFFFFFF; | ||
606 | } | ||
607 | data = (u32*) ( (u8*) data + image->getPitch() ); | ||
608 | } | ||
609 | image->unlock(); | ||
610 | snprintf ( buf, 64, "smoke_%02d", i ); | ||
611 | driver->addTexture( buf, image ); | ||
612 | image->drop (); | ||
613 | } | ||
614 | |||
615 | // fog | ||
616 | for ( i = 0; i != 1; ++i ) | ||
617 | { | ||
618 | image = driver->createImage ( video::ECF_A8R8G8B8, dim); | ||
619 | data = (u32*) image->lock (); | ||
620 | for ( y = 0; y != dim.Height; ++y ) | ||
621 | { | ||
622 | for ( x = 0; x != dim.Width; ++x ) | ||
623 | { | ||
624 | data [x] = 0xFFFFFFFF; | ||
625 | } | ||
626 | data = (u32*) ( (u8*) data + image->getPitch() ); | ||
627 | } | ||
628 | image->unlock(); | ||
629 | snprintf ( buf, 64, "fog_%02d", i ); | ||
630 | driver->addTexture( buf, image ); | ||
631 | image->drop (); | ||
632 | } | ||
633 | } | ||
634 | |||
635 | |||
636 | /* | ||
637 | create the GUI | ||
638 | */ | ||
639 | void CQuake3EventHandler::CreateGUI() | ||
640 | { | ||
641 | |||
642 | IGUIEnvironment *env = Game->Device->getGUIEnvironment(); | ||
643 | IVideoDriver * driver = Game->Device->getVideoDriver(); | ||
644 | |||
645 | gui.drop(); | ||
646 | |||
647 | // set skin font | ||
648 | IGUIFont* font = env->getFont("fontlucida.png"); | ||
649 | if (font) | ||
650 | env->getSkin()->setFont(font); | ||
651 | env->getSkin()->setColor ( EGDC_BUTTON_TEXT, video::SColor(240,0xAA,0xAA,0xAA) ); | ||
652 | env->getSkin()->setColor ( EGDC_3D_HIGH_LIGHT, video::SColor(240,0x22,0x22,0x22) ); | ||
653 | env->getSkin()->setColor ( EGDC_3D_FACE, video::SColor(240,0x44,0x44,0x44) ); | ||
654 | env->getSkin()->setColor ( EGDC_EDITABLE, video::SColor(240,0x44,0x44,0x44) ); | ||
655 | env->getSkin()->setColor ( EGDC_FOCUSED_EDITABLE, video::SColor(240,0x54,0x54,0x54) ); | ||
656 | env->getSkin()->setColor ( EGDC_WINDOW, video::SColor(240,0x66,0x66,0x66) ); | ||
657 | |||
658 | // minimal gui size 800x600 | ||
659 | dimension2d<u32> dim ( 800, 600 ); | ||
660 | dimension2d<u32> vdim ( Game->Device->getVideoDriver()->getScreenSize() ); | ||
661 | |||
662 | if ( vdim.Height >= dim.Height && vdim.Width >= dim.Width ) | ||
663 | { | ||
664 | //dim = vdim; | ||
665 | } | ||
666 | else | ||
667 | { | ||
668 | } | ||
669 | |||
670 | gui.Window = env->addWindow ( rect<s32> ( 0, 0, dim.Width, dim.Height ), false, L"Quake3 Explorer" ); | ||
671 | gui.Window->setToolTipText ( L"Quake3Explorer. Loads and show various BSP File Format and Shaders." ); | ||
672 | gui.Window->getCloseButton()->setToolTipText ( L"Quit Quake3 Explorer" ); | ||
673 | |||
674 | // add a status line help text | ||
675 | gui.StatusLine = env->addStaticText( 0, rect<s32>( 5,dim.Height - 30,dim.Width - 5,dim.Height - 10), | ||
676 | false, false, gui.Window, -1, true | ||
677 | ); | ||
678 | |||
679 | |||
680 | env->addStaticText ( L"VideoDriver:", rect<s32>( dim.Width - 400, 24, dim.Width - 310, 40 ),false, false, gui.Window, -1, false ); | ||
681 | gui.VideoDriver = env->addComboBox(rect<s32>( dim.Width - 300, 24, dim.Width - 10, 40 ),gui.Window); | ||
682 | gui.VideoDriver->addItem(L"Direct3D 9.0c", EDT_DIRECT3D9 ); | ||
683 | gui.VideoDriver->addItem(L"Direct3D 8.1", EDT_DIRECT3D8 ); | ||
684 | gui.VideoDriver->addItem(L"OpenGL 1.5", EDT_OPENGL); | ||
685 | gui.VideoDriver->addItem(L"Software Renderer", EDT_SOFTWARE); | ||
686 | gui.VideoDriver->addItem(L"Burning's Video (TM) Thomas Alten", EDT_BURNINGSVIDEO); | ||
687 | gui.VideoDriver->setSelected ( gui.VideoDriver->getIndexForItemData ( Game->deviceParam.DriverType ) ); | ||
688 | gui.VideoDriver->setToolTipText ( L"Use a VideoDriver" ); | ||
689 | |||
690 | env->addStaticText ( L"VideoMode:", rect<s32>( dim.Width - 400, 44, dim.Width - 310, 60 ),false, false, gui.Window, -1, false ); | ||
691 | gui.VideoMode = env->addComboBox(rect<s32>( dim.Width - 300, 44, dim.Width - 10, 60 ),gui.Window); | ||
692 | gui.VideoMode->setToolTipText ( L"Supported Screenmodes" ); | ||
693 | IVideoModeList *modeList = Game->Device->getVideoModeList(); | ||
694 | if ( modeList ) | ||
695 | { | ||
696 | s32 i; | ||
697 | for ( i = 0; i != modeList->getVideoModeCount (); ++i ) | ||
698 | { | ||
699 | u16 d = modeList->getVideoModeDepth ( i ); | ||
700 | if ( d < 16 ) | ||
701 | continue; | ||
702 | |||
703 | u16 w = modeList->getVideoModeResolution ( i ).Width; | ||
704 | u16 h = modeList->getVideoModeResolution ( i ).Height; | ||
705 | u32 val = w << 16 | h; | ||
706 | |||
707 | if ( gui.VideoMode->getIndexForItemData ( val ) >= 0 ) | ||
708 | continue; | ||
709 | |||
710 | f32 aspect = (f32) w / (f32) h; | ||
711 | const c8 *a = ""; | ||
712 | if ( core::equals ( aspect, 1.3333333333f ) ) a = "4:3"; | ||
713 | else if ( core::equals ( aspect, 1.6666666f ) ) a = "15:9 widescreen"; | ||
714 | else if ( core::equals ( aspect, 1.7777777f ) ) a = "16:9 widescreen"; | ||
715 | else if ( core::equals ( aspect, 1.6f ) ) a = "16:10 widescreen"; | ||
716 | else if ( core::equals ( aspect, 2.133333f ) ) a = "20:9 widescreen"; | ||
717 | |||
718 | snprintf ( buf, sizeof ( buf ), "%d x %d, %s",w, h, a ); | ||
719 | gui.VideoMode->addItem ( stringw ( buf ).c_str(), val ); | ||
720 | } | ||
721 | } | ||
722 | gui.VideoMode->setSelected ( gui.VideoMode->getIndexForItemData ( | ||
723 | Game->deviceParam.WindowSize.Width << 16 | | ||
724 | Game->deviceParam.WindowSize.Height ) ); | ||
725 | |||
726 | gui.FullScreen = env->addCheckBox ( Game->deviceParam.Fullscreen, rect<s32>( dim.Width - 400, 64, dim.Width - 300, 80 ), gui.Window,-1, L"Fullscreen" ); | ||
727 | gui.FullScreen->setToolTipText ( L"Set Fullscreen or Window Mode" ); | ||
728 | |||
729 | gui.Bit32 = env->addCheckBox ( Game->deviceParam.Bits == 32, rect<s32>( dim.Width - 300, 64, dim.Width - 240, 80 ), gui.Window,-1, L"32Bit" ); | ||
730 | gui.Bit32->setToolTipText ( L"Use 16 or 32 Bit" ); | ||
731 | |||
732 | env->addStaticText ( L"MultiSample:", rect<s32>( dim.Width - 235, 64, dim.Width - 150, 80 ),false, false, gui.Window, -1, false ); | ||
733 | gui.MultiSample = env->addScrollBar( true, rect<s32>( dim.Width - 150, 64, dim.Width - 70, 80 ), gui.Window,-1 ); | ||
734 | gui.MultiSample->setMin ( 0 ); | ||
735 | gui.MultiSample->setMax ( 8 ); | ||
736 | gui.MultiSample->setSmallStep ( 1 ); | ||
737 | gui.MultiSample->setLargeStep ( 1 ); | ||
738 | gui.MultiSample->setPos ( Game->deviceParam.AntiAlias ); | ||
739 | gui.MultiSample->setToolTipText ( L"Set the MultiSample (disable, 1x, 2x, 4x, 8x )" ); | ||
740 | |||
741 | gui.SetVideoMode = env->addButton (rect<s32>( dim.Width - 60, 64, dim.Width - 10, 80 ), gui.Window, -1,L"set" ); | ||
742 | gui.SetVideoMode->setToolTipText ( L"Set Video Mode with current values" ); | ||
743 | |||
744 | env->addStaticText ( L"Gamma:", rect<s32>( dim.Width - 400, 104, dim.Width - 310, 120 ),false, false, gui.Window, -1, false ); | ||
745 | gui.Gamma = env->addScrollBar( true, rect<s32>( dim.Width - 300, 104, dim.Width - 10, 120 ), gui.Window,-1 ); | ||
746 | gui.Gamma->setMin ( 50 ); | ||
747 | gui.Gamma->setMax ( 350 ); | ||
748 | gui.Gamma->setSmallStep ( 1 ); | ||
749 | gui.Gamma->setLargeStep ( 10 ); | ||
750 | gui.Gamma->setPos ( core::floor32 ( Game->GammaValue * 100.f ) ); | ||
751 | gui.Gamma->setToolTipText ( L"Adjust Gamma Ramp ( 0.5 - 3.5)" ); | ||
752 | Game->Device->setGammaRamp ( Game->GammaValue, Game->GammaValue, Game->GammaValue, 0.f, 0.f ); | ||
753 | |||
754 | |||
755 | env->addStaticText ( L"Tesselation:", rect<s32>( dim.Width - 400, 124, dim.Width - 310, 140 ),false, false, gui.Window, -1, false ); | ||
756 | gui.Tesselation = env->addScrollBar( true, rect<s32>( dim.Width - 300, 124, dim.Width - 10, 140 ), gui.Window,-1 ); | ||
757 | gui.Tesselation->setMin ( 2 ); | ||
758 | gui.Tesselation->setMax ( 12 ); | ||
759 | gui.Tesselation->setSmallStep ( 1 ); | ||
760 | gui.Tesselation->setLargeStep ( 1 ); | ||
761 | gui.Tesselation->setPos ( Game->loadParam.patchTesselation ); | ||
762 | gui.Tesselation->setToolTipText ( L"How smooth should curved surfaces be rendered" ); | ||
763 | |||
764 | gui.Collision = env->addCheckBox ( true, rect<s32>( dim.Width - 400, 150, dim.Width - 300, 166 ), gui.Window,-1, L"Collision" ); | ||
765 | gui.Collision->setToolTipText ( L"Set collision on or off ( flythrough ). \nPress F7 on your Keyboard" ); | ||
766 | gui.Visible_Map = env->addCheckBox ( true, rect<s32>( dim.Width - 300, 150, dim.Width - 240, 166 ), gui.Window,-1, L"Map" ); | ||
767 | gui.Visible_Map->setToolTipText ( L"Show or not show the static part the Level. \nPress F3 on your Keyboard" ); | ||
768 | gui.Visible_Shader = env->addCheckBox ( true, rect<s32>( dim.Width - 240, 150, dim.Width - 170, 166 ), gui.Window,-1, L"Shader" ); | ||
769 | gui.Visible_Shader->setToolTipText ( L"Show or not show the Shader Nodes. \nPress F4 on your Keyboard" ); | ||
770 | gui.Visible_Fog = env->addCheckBox ( true, rect<s32>( dim.Width - 170, 150, dim.Width - 110, 166 ), gui.Window,-1, L"Fog" ); | ||
771 | gui.Visible_Fog->setToolTipText ( L"Show or not show the Fog Nodes. \nPress F5 on your Keyboard" ); | ||
772 | gui.Visible_Unresolved = env->addCheckBox ( true, rect<s32>( dim.Width - 110, 150, dim.Width - 10, 166 ), gui.Window,-1, L"Unresolved" ); | ||
773 | gui.Visible_Unresolved->setToolTipText ( L"Show the or not show the Nodes the Engine can't handle. \nPress F6 on your Keyboard" ); | ||
774 | gui.Visible_Skydome = env->addCheckBox ( true, rect<s32>( dim.Width - 110, 180, dim.Width - 10, 196 ), gui.Window,-1, L"Skydome" ); | ||
775 | gui.Visible_Skydome->setToolTipText ( L"Show the or not show the Skydome." ); | ||
776 | |||
777 | //Respawn = env->addButton ( rect<s32>( dim.Width - 260, 90, dim.Width - 10, 106 ), 0,-1, L"Respawn" ); | ||
778 | |||
779 | env->addStaticText ( L"Archives:", rect<s32>( 5, dim.Height - 530, dim.Width - 600,dim.Height - 514 ),false, false, gui.Window, -1, false ); | ||
780 | |||
781 | gui.ArchiveAdd = env->addButton ( rect<s32>( dim.Width - 725, dim.Height - 530, dim.Width - 665, dim.Height - 514 ), gui.Window,-1, L"add" ); | ||
782 | gui.ArchiveAdd->setToolTipText ( L"Add an archive, usually packed zip-archives (*.pk3) to the Filesystem" ); | ||
783 | gui.ArchiveRemove = env->addButton ( rect<s32>( dim.Width - 660, dim.Height - 530, dim.Width - 600, dim.Height - 514 ), gui.Window,-1, L"del" ); | ||
784 | gui.ArchiveRemove->setToolTipText ( L"Remove the selected archive from the FileSystem." ); | ||
785 | gui.ArchiveUp = env->addButton ( rect<s32>( dim.Width - 575, dim.Height - 530, dim.Width - 515, dim.Height - 514 ), gui.Window,-1, L"up" ); | ||
786 | gui.ArchiveUp->setToolTipText ( L"Arrange Archive Look-up Hirachy. Move the selected Archive up" ); | ||
787 | gui.ArchiveDown = env->addButton ( rect<s32>( dim.Width - 510, dim.Height - 530, dim.Width - 440, dim.Height - 514 ), gui.Window,-1, L"down" ); | ||
788 | gui.ArchiveDown->setToolTipText ( L"Arrange Archive Look-up Hirachy. Move the selected Archive down" ); | ||
789 | |||
790 | |||
791 | gui.ArchiveList = env->addTable ( rect<s32>( 5,dim.Height - 510, dim.Width - 450,dim.Height - 410 ), gui.Window ); | ||
792 | gui.ArchiveList->addColumn ( L"Type", 0 ); | ||
793 | gui.ArchiveList->addColumn ( L"Real File Path", 1 ); | ||
794 | gui.ArchiveList->setColumnWidth ( 0, 60 ); | ||
795 | gui.ArchiveList->setColumnWidth ( 1, 284 ); | ||
796 | gui.ArchiveList->setToolTipText ( L"Show the attached Archives" ); | ||
797 | |||
798 | |||
799 | env->addStaticText ( L"Maps:", rect<s32>( 5, dim.Height - 400, dim.Width - 450,dim.Height - 380 ),false, false, gui.Window, -1, false ); | ||
800 | gui.MapList = env->addListBox ( rect<s32>( 5,dim.Height - 380, dim.Width - 450,dim.Height - 40 ), gui.Window, -1, true ); | ||
801 | gui.MapList->setToolTipText ( L"Show the current Maps in all Archives.\n Double-Click the Map to start the level" ); | ||
802 | |||
803 | |||
804 | // create a visible Scene Tree | ||
805 | env->addStaticText ( L"Scenegraph:", rect<s32>( dim.Width - 400, dim.Height - 400, dim.Width - 5,dim.Height - 380 ),false, false, gui.Window, -1, false ); | ||
806 | gui.SceneTree = env->addTreeView( rect<s32>( dim.Width - 400, dim.Height - 380, dim.Width - 5, dim.Height - 40 ), | ||
807 | gui.Window, -1, true, true, false ); | ||
808 | gui.SceneTree->setToolTipText ( L"Show the current Scenegraph" ); | ||
809 | gui.SceneTree->getRoot()->clearChildren(); | ||
810 | addSceneTreeItem ( Game->Device->getSceneManager()->getRootSceneNode(), gui.SceneTree->getRoot() ); | ||
811 | |||
812 | |||
813 | IGUIImageList* imageList = env->createImageList( driver->getTexture ( "iconlist.png" ), | ||
814 | dimension2di( 32, 32 ), true ); | ||
815 | |||
816 | if ( imageList ) | ||
817 | { | ||
818 | gui.SceneTree->setImageList( imageList ); | ||
819 | imageList->drop (); | ||
820 | } | ||
821 | |||
822 | |||
823 | // load the engine logo | ||
824 | gui.Logo = env->addImage( driver->getTexture("irrlichtlogo3.png"), position2d<s32>(5, 16 ), true, 0 ); | ||
825 | gui.Logo->setToolTipText ( L"The great Irrlicht Engine" ); | ||
826 | |||
827 | AddArchive ( "" ); | ||
828 | } | ||
829 | |||
830 | |||
831 | /* | ||
832 | Add an Archive to the FileSystems and updates the GUI | ||
833 | */ | ||
834 | void CQuake3EventHandler::AddArchive ( const path& archiveName ) | ||
835 | { | ||
836 | IFileSystem *fs = Game->Device->getFileSystem(); | ||
837 | u32 i; | ||
838 | |||
839 | if ( archiveName.size () ) | ||
840 | { | ||
841 | bool exists = false; | ||
842 | for ( i = 0; i != fs->getFileArchiveCount(); ++i ) | ||
843 | { | ||
844 | if ( fs->getFileArchive(i)->getFileList()->getPath() == archiveName ) | ||
845 | { | ||
846 | exists = true; | ||
847 | break; | ||
848 | } | ||
849 | } | ||
850 | |||
851 | if (!exists) | ||
852 | { | ||
853 | fs->addFileArchive(archiveName, true, false); | ||
854 | } | ||
855 | } | ||
856 | |||
857 | // store the current archives in game data | ||
858 | // show the attached Archive in proper order | ||
859 | if ( gui.ArchiveList ) | ||
860 | { | ||
861 | gui.ArchiveList->clearRows(); | ||
862 | |||
863 | for ( i = 0; i != fs->getFileArchiveCount(); ++i ) | ||
864 | { | ||
865 | IFileArchive * archive = fs->getFileArchive ( i ); | ||
866 | |||
867 | u32 index = gui.ArchiveList->addRow(i); | ||
868 | |||
869 | core::stringw typeName; | ||
870 | switch(archive->getType()) | ||
871 | { | ||
872 | case io::EFAT_ZIP: | ||
873 | typeName = "ZIP"; | ||
874 | break; | ||
875 | case io::EFAT_GZIP: | ||
876 | typeName = "gzip"; | ||
877 | break; | ||
878 | case io::EFAT_FOLDER: | ||
879 | typeName = "Mount"; | ||
880 | break; | ||
881 | case io::EFAT_PAK: | ||
882 | typeName = "PAK"; | ||
883 | break; | ||
884 | case io::EFAT_TAR: | ||
885 | typeName = "TAR"; | ||
886 | break; | ||
887 | default: | ||
888 | typeName = "archive"; | ||
889 | } | ||
890 | |||
891 | gui.ArchiveList->setCellText ( index, 0, typeName ); | ||
892 | gui.ArchiveList->setCellText ( index, 1, archive->getFileList()->getPath() ); | ||
893 | } | ||
894 | } | ||
895 | |||
896 | |||
897 | // browse the archives for maps | ||
898 | if ( gui.MapList ) | ||
899 | { | ||
900 | gui.MapList->clear(); | ||
901 | |||
902 | IGUISpriteBank *bank = Game->Device->getGUIEnvironment()->getSpriteBank("sprite_q3map"); | ||
903 | if ( 0 == bank ) | ||
904 | bank = Game->Device->getGUIEnvironment()->addEmptySpriteBank("sprite_q3map"); | ||
905 | |||
906 | SGUISprite sprite; | ||
907 | SGUISpriteFrame frame; | ||
908 | core::rect<s32> r; | ||
909 | |||
910 | bank->getSprites().clear(); | ||
911 | bank->getPositions().clear (); | ||
912 | gui.MapList->setSpriteBank ( bank ); | ||
913 | |||
914 | u32 g = 0; | ||
915 | core::stringw s; | ||
916 | |||
917 | // browse the attached file system | ||
918 | fs->setFileListSystem ( FILESYSTEM_VIRTUAL ); | ||
919 | fs->changeWorkingDirectoryTo ( "/maps/" ); | ||
920 | IFileList *fileList = fs->createFileList (); | ||
921 | fs->setFileListSystem ( FILESYSTEM_NATIVE ); | ||
922 | |||
923 | for ( i=0; i< fileList->getFileCount(); ++i) | ||
924 | { | ||
925 | s = fileList->getFullFileName(i); | ||
926 | if ( s.find ( ".bsp" ) >= 0 ) | ||
927 | { | ||
928 | // get level screenshot. reformat texture to 128x128 | ||
929 | path c ( s ); | ||
930 | deletePathFromFilename ( c ); | ||
931 | cutFilenameExtension ( c, c ); | ||
932 | c = path ( "levelshots/" ) + c; | ||
933 | |||
934 | dimension2du dim ( 128, 128 ); | ||
935 | IVideoDriver * driver = Game->Device->getVideoDriver(); | ||
936 | IImage* image = 0; | ||
937 | ITexture *tex = 0; | ||
938 | path filename; | ||
939 | |||
940 | filename = c + ".jpg"; | ||
941 | if ( fs->existFile ( filename ) ) | ||
942 | image = driver->createImageFromFile( filename ); | ||
943 | if ( 0 == image ) | ||
944 | { | ||
945 | filename = c + ".tga"; | ||
946 | if ( fs->existFile ( filename ) ) | ||
947 | image = driver->createImageFromFile( filename ); | ||
948 | } | ||
949 | |||
950 | if ( image ) | ||
951 | { | ||
952 | IImage* filter = driver->createImage ( video::ECF_R8G8B8, dim ); | ||
953 | image->copyToScalingBoxFilter ( filter, 0 ); | ||
954 | image->drop (); | ||
955 | image = filter; | ||
956 | } | ||
957 | |||
958 | if ( image ) | ||
959 | { | ||
960 | tex = driver->addTexture ( filename, image ); | ||
961 | image->drop (); | ||
962 | } | ||
963 | |||
964 | |||
965 | bank->setTexture ( g, tex ); | ||
966 | |||
967 | r.LowerRightCorner.X = dim.Width; | ||
968 | r.LowerRightCorner.Y = dim.Height; | ||
969 | gui.MapList->setItemHeight ( r.LowerRightCorner.Y + 4 ); | ||
970 | frame.rectNumber = bank->getPositions().size(); | ||
971 | frame.textureNumber = g; | ||
972 | |||
973 | bank->getPositions().push_back(r); | ||
974 | |||
975 | sprite.Frames.set_used ( 0 ); | ||
976 | sprite.Frames.push_back(frame); | ||
977 | sprite.frameTime = 0; | ||
978 | bank->getSprites().push_back(sprite); | ||
979 | |||
980 | gui.MapList->addItem ( s.c_str (), g ); | ||
981 | g += 1; | ||
982 | } | ||
983 | } | ||
984 | fileList->drop (); | ||
985 | |||
986 | gui.MapList->setSelected ( -1 ); | ||
987 | IGUIScrollBar * bar = (IGUIScrollBar*)gui.MapList->getElementFromId( 0 ); | ||
988 | if ( bar ) | ||
989 | bar->setPos ( 0 ); | ||
990 | |||
991 | } | ||
992 | |||
993 | } | ||
994 | |||
995 | /* | ||
996 | clears the Map in Memory | ||
997 | */ | ||
998 | void CQuake3EventHandler::dropMap () | ||
999 | { | ||
1000 | IVideoDriver * driver = Game->Device->getVideoDriver(); | ||
1001 | |||
1002 | driver->removeAllHardwareBuffers (); | ||
1003 | driver->removeAllTextures (); | ||
1004 | |||
1005 | Player[0].shutdown (); | ||
1006 | |||
1007 | |||
1008 | dropElement ( ItemParent ); | ||
1009 | dropElement ( ShaderParent ); | ||
1010 | dropElement ( UnresolvedParent ); | ||
1011 | dropElement ( FogParent ); | ||
1012 | dropElement ( BulletParent ); | ||
1013 | |||
1014 | |||
1015 | Impacts.clear(); | ||
1016 | |||
1017 | if ( Meta ) | ||
1018 | { | ||
1019 | Meta = 0; | ||
1020 | } | ||
1021 | |||
1022 | dropElement ( MapParent ); | ||
1023 | dropElement ( SkyNode ); | ||
1024 | |||
1025 | // clean out meshes, because textures are invalid | ||
1026 | // TODO: better texture handling;-) | ||
1027 | IMeshCache *cache = Game->Device->getSceneManager ()->getMeshCache(); | ||
1028 | cache->clear (); | ||
1029 | Mesh = 0; | ||
1030 | } | ||
1031 | |||
1032 | /* Load new map | ||
1033 | */ | ||
1034 | void CQuake3EventHandler::LoadMap ( const stringw &mapName, s32 collision ) | ||
1035 | { | ||
1036 | if ( 0 == mapName.size() ) | ||
1037 | return; | ||
1038 | |||
1039 | dropMap (); | ||
1040 | |||
1041 | IFileSystem *fs = Game->Device->getFileSystem(); | ||
1042 | ISceneManager *smgr = Game->Device->getSceneManager (); | ||
1043 | |||
1044 | IReadFile* file = fs->createMemoryReadFile(&Game->loadParam, | ||
1045 | sizeof(Game->loadParam), L"levelparameter.cfg", false); | ||
1046 | |||
1047 | // load cfg file | ||
1048 | smgr->getMesh( file ); | ||
1049 | file->drop (); | ||
1050 | |||
1051 | // load the actual map | ||
1052 | Mesh = (IQ3LevelMesh*) smgr->getMesh(mapName); | ||
1053 | if ( 0 == Mesh ) | ||
1054 | return; | ||
1055 | |||
1056 | /* | ||
1057 | add the geometry mesh to the Scene ( polygon & patches ) | ||
1058 | The Geometry mesh is optimised for faster drawing | ||
1059 | */ | ||
1060 | |||
1061 | IMesh *geometry = Mesh->getMesh(E_Q3_MESH_GEOMETRY); | ||
1062 | if ( 0 == geometry || geometry->getMeshBufferCount() == 0) | ||
1063 | return; | ||
1064 | |||
1065 | Game->CurrentMapName = mapName; | ||
1066 | |||
1067 | //create a collision list | ||
1068 | Meta = 0; | ||
1069 | |||
1070 | ITriangleSelector * selector = 0; | ||
1071 | if (collision) | ||
1072 | Meta = smgr->createMetaTriangleSelector(); | ||
1073 | |||
1074 | //IMeshBuffer *b0 = geometry->getMeshBuffer(0); | ||
1075 | //s32 minimalNodes = b0 ? core::s32_max ( 2048, b0->getVertexCount() / 32 ) : 2048; | ||
1076 | s32 minimalNodes = 2048; | ||
1077 | |||
1078 | MapParent = smgr->addOctreeSceneNode(geometry, 0, -1, minimalNodes); | ||
1079 | MapParent->setName ( mapName ); | ||
1080 | if ( Meta ) | ||
1081 | { | ||
1082 | selector = smgr->createOctreeTriangleSelector( geometry,MapParent, minimalNodes); | ||
1083 | //selector = smgr->createTriangleSelector ( geometry, MapParent ); | ||
1084 | Meta->addTriangleSelector( selector); | ||
1085 | selector->drop (); | ||
1086 | } | ||
1087 | |||
1088 | // logical parent for the items | ||
1089 | ItemParent = smgr->addEmptySceneNode(); | ||
1090 | if ( ItemParent ) | ||
1091 | ItemParent->setName ( "Item Container" ); | ||
1092 | |||
1093 | ShaderParent = smgr->addEmptySceneNode(); | ||
1094 | if ( ShaderParent ) | ||
1095 | ShaderParent->setName ( "Shader Container" ); | ||
1096 | |||
1097 | UnresolvedParent = smgr->addEmptySceneNode(); | ||
1098 | if ( UnresolvedParent ) | ||
1099 | UnresolvedParent->setName ( "Unresolved Container" ); | ||
1100 | |||
1101 | FogParent = smgr->addEmptySceneNode(); | ||
1102 | if ( FogParent ) | ||
1103 | FogParent->setName ( "Fog Container" ); | ||
1104 | |||
1105 | // logical parent for the bullets | ||
1106 | BulletParent = smgr->addEmptySceneNode(); | ||
1107 | if ( BulletParent ) | ||
1108 | BulletParent->setName ( "Bullet Container" ); | ||
1109 | |||
1110 | /* | ||
1111 | now construct SceneNodes for each Shader | ||
1112 | The Objects are stored in the quake mesh E_Q3_MESH_ITEMS | ||
1113 | and the Shader ID is stored in the MaterialParameters | ||
1114 | mostly dark looking skulls and moving lava.. or green flashing tubes? | ||
1115 | */ | ||
1116 | Q3ShaderFactory ( Game->loadParam, Game->Device, Mesh, E_Q3_MESH_ITEMS,ShaderParent, Meta, false ); | ||
1117 | Q3ShaderFactory ( Game->loadParam, Game->Device, Mesh, E_Q3_MESH_FOG,FogParent, 0, false ); | ||
1118 | Q3ShaderFactory ( Game->loadParam, Game->Device, Mesh, E_Q3_MESH_UNRESOLVED,UnresolvedParent, Meta, true ); | ||
1119 | |||
1120 | /* | ||
1121 | Now construct Models from Entity List | ||
1122 | */ | ||
1123 | Q3ModelFactory ( Game->loadParam, Game->Device, Mesh, ItemParent, false ); | ||
1124 | } | ||
1125 | |||
1126 | /* | ||
1127 | Adds a SceneNode with an icon to the Scene Tree | ||
1128 | */ | ||
1129 | void CQuake3EventHandler::addSceneTreeItem( ISceneNode * parent, IGUITreeViewNode* nodeParent) | ||
1130 | { | ||
1131 | IGUITreeViewNode* node; | ||
1132 | wchar_t msg[128]; | ||
1133 | |||
1134 | s32 imageIndex; | ||
1135 | list<ISceneNode*>::ConstIterator it = parent->getChildren().begin(); | ||
1136 | for (; it != parent->getChildren().end(); ++it) | ||
1137 | { | ||
1138 | switch ( (*it)->getType () ) | ||
1139 | { | ||
1140 | case ESNT_Q3SHADER_SCENE_NODE: imageIndex = 0; break; | ||
1141 | case ESNT_CAMERA: imageIndex = 1; break; | ||
1142 | case ESNT_EMPTY: imageIndex = 2; break; | ||
1143 | case ESNT_MESH: imageIndex = 3; break; | ||
1144 | case ESNT_OCTREE: imageIndex = 3; break; | ||
1145 | case ESNT_ANIMATED_MESH: imageIndex = 4; break; | ||
1146 | case ESNT_SKY_BOX: imageIndex = 5; break; | ||
1147 | case ESNT_BILLBOARD: imageIndex = 6; break; | ||
1148 | case ESNT_PARTICLE_SYSTEM: imageIndex = 7; break; | ||
1149 | case ESNT_TEXT: imageIndex = 8; break; | ||
1150 | default:imageIndex = -1; break; | ||
1151 | } | ||
1152 | |||
1153 | if ( imageIndex < 0 ) | ||
1154 | { | ||
1155 | swprintf ( msg, 128, L"%hs,%hs", | ||
1156 | Game->Device->getSceneManager ()->getSceneNodeTypeName ( (*it)->getType () ), | ||
1157 | (*it)->getName() | ||
1158 | ); | ||
1159 | } | ||
1160 | else | ||
1161 | { | ||
1162 | swprintf ( msg, 128, L"%hs",(*it)->getName() ); | ||
1163 | } | ||
1164 | |||
1165 | node = nodeParent->addChildBack( msg, 0, imageIndex ); | ||
1166 | |||
1167 | // Add all Animators | ||
1168 | list<ISceneNodeAnimator*>::ConstIterator ait = (*it)->getAnimators().begin(); | ||
1169 | for (; ait != (*it)->getAnimators().end(); ++ait) | ||
1170 | { | ||
1171 | imageIndex = -1; | ||
1172 | swprintf ( msg, 128, L"%hs", | ||
1173 | Game->Device->getSceneManager ()->getAnimatorTypeName ( (*ait)->getType () ) | ||
1174 | ); | ||
1175 | |||
1176 | switch ( (*ait)->getType () ) | ||
1177 | { | ||
1178 | case ESNAT_FLY_CIRCLE: | ||
1179 | case ESNAT_FLY_STRAIGHT: | ||
1180 | case ESNAT_FOLLOW_SPLINE: | ||
1181 | case ESNAT_ROTATION: | ||
1182 | case ESNAT_TEXTURE: | ||
1183 | case ESNAT_DELETION: | ||
1184 | case ESNAT_COLLISION_RESPONSE: | ||
1185 | case ESNAT_CAMERA_FPS: | ||
1186 | case ESNAT_CAMERA_MAYA: | ||
1187 | default: | ||
1188 | break; | ||
1189 | } | ||
1190 | node->addChildBack( msg, 0, imageIndex ); | ||
1191 | } | ||
1192 | |||
1193 | addSceneTreeItem ( *it, node ); | ||
1194 | } | ||
1195 | } | ||
1196 | |||
1197 | |||
1198 | // Adds life! | ||
1199 | void CQuake3EventHandler::CreatePlayers() | ||
1200 | { | ||
1201 | Player[0].create ( Game->Device, Mesh, MapParent, Meta ); | ||
1202 | } | ||
1203 | |||
1204 | |||
1205 | // Adds a skydome to the scene | ||
1206 | void CQuake3EventHandler::AddSky( u32 dome, const c8 *texture) | ||
1207 | { | ||
1208 | ISceneManager *smgr = Game->Device->getSceneManager (); | ||
1209 | IVideoDriver * driver = Game->Device->getVideoDriver(); | ||
1210 | |||
1211 | bool oldMipMapState = driver->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS); | ||
1212 | driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false); | ||
1213 | |||
1214 | if ( 0 == dome ) | ||
1215 | { | ||
1216 | // irrlicht order | ||
1217 | //static const c8*p[] = { "ft", "lf", "bk", "rt", "up", "dn" }; | ||
1218 | // quake3 order | ||
1219 | static const c8*p[] = { "ft", "rt", "bk", "lf", "up", "dn" }; | ||
1220 | |||
1221 | u32 i = 0; | ||
1222 | snprintf ( buf, 64, "%s_%s.jpg", texture, p[i] ); | ||
1223 | SkyNode = smgr->addSkyBoxSceneNode( driver->getTexture ( buf ), 0, 0, 0, 0, 0 ); | ||
1224 | |||
1225 | if (SkyNode) | ||
1226 | { | ||
1227 | for ( i = 0; i < 6; ++i ) | ||
1228 | { | ||
1229 | snprintf ( buf, 64, "%s_%s.jpg", texture, p[i] ); | ||
1230 | SkyNode->getMaterial(i).setTexture ( 0, driver->getTexture ( buf ) ); | ||
1231 | } | ||
1232 | } | ||
1233 | } | ||
1234 | else | ||
1235 | if ( 1 == dome ) | ||
1236 | { | ||
1237 | snprintf ( buf, 64, "%s.jpg", texture ); | ||
1238 | SkyNode = smgr->addSkyDomeSceneNode( | ||
1239 | driver->getTexture( buf ), 32,32, | ||
1240 | 1.f, 1.f, 1000.f, 0, 11); | ||
1241 | } | ||
1242 | else | ||
1243 | if ( 2 == dome ) | ||
1244 | { | ||
1245 | snprintf ( buf, 64, "%s.jpg", texture ); | ||
1246 | SkyNode = smgr->addSkyDomeSceneNode( | ||
1247 | driver->getTexture( buf ), 16,8, | ||
1248 | 0.95f, 2.f, 1000.f, 0, 11); | ||
1249 | } | ||
1250 | |||
1251 | if (SkyNode) | ||
1252 | SkyNode->setName("Skydome"); | ||
1253 | //SkyNode->getMaterial(0).ZBuffer = video::EMDF_DEPTH_LESS_EQUAL; | ||
1254 | |||
1255 | driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, oldMipMapState); | ||
1256 | } | ||
1257 | |||
1258 | |||
1259 | // enable GUI elements | ||
1260 | void CQuake3EventHandler::SetGUIActive( s32 command) | ||
1261 | { | ||
1262 | bool inputState = false; | ||
1263 | |||
1264 | ICameraSceneNode * camera = Game->Device->getSceneManager()->getActiveCamera (); | ||
1265 | |||
1266 | switch ( command ) | ||
1267 | { | ||
1268 | case 0: Game->guiActive = 0; inputState = !Game->guiActive; break; | ||
1269 | case 1: Game->guiActive = 1; inputState = !Game->guiActive;;break; | ||
1270 | case 2: Game->guiActive ^= 1; inputState = !Game->guiActive;break; | ||
1271 | case 3: | ||
1272 | if ( camera ) | ||
1273 | inputState = !camera->isInputReceiverEnabled(); | ||
1274 | break; | ||
1275 | } | ||
1276 | |||
1277 | if ( camera ) | ||
1278 | { | ||
1279 | camera->setInputReceiverEnabled ( inputState ); | ||
1280 | Game->Device->getCursorControl()->setVisible( !inputState ); | ||
1281 | } | ||
1282 | |||
1283 | if ( gui.Window ) | ||
1284 | { | ||
1285 | gui.Window->setVisible ( Game->guiActive != 0 ); | ||
1286 | } | ||
1287 | |||
1288 | if ( Game->guiActive && | ||
1289 | gui.SceneTree && Game->Device->getGUIEnvironment()->getFocus() != gui.SceneTree | ||
1290 | ) | ||
1291 | { | ||
1292 | gui.SceneTree->getRoot()->clearChildren(); | ||
1293 | addSceneTreeItem ( Game->Device->getSceneManager()->getRootSceneNode(), gui.SceneTree->getRoot() ); | ||
1294 | } | ||
1295 | |||
1296 | Game->Device->getGUIEnvironment()->setFocus ( Game->guiActive ? gui.Window: 0 ); | ||
1297 | } | ||
1298 | |||
1299 | |||
1300 | /* | ||
1301 | Handle game input | ||
1302 | */ | ||
1303 | bool CQuake3EventHandler::OnEvent(const SEvent& eve) | ||
1304 | { | ||
1305 | if ( eve.EventType == EET_LOG_TEXT_EVENT ) | ||
1306 | { | ||
1307 | return false; | ||
1308 | } | ||
1309 | |||
1310 | if ( Game->guiActive && eve.EventType == EET_GUI_EVENT ) | ||
1311 | { | ||
1312 | if ( eve.GUIEvent.Caller == gui.MapList && eve.GUIEvent.EventType == gui::EGET_LISTBOX_SELECTED_AGAIN ) | ||
1313 | { | ||
1314 | s32 selected = gui.MapList->getSelected(); | ||
1315 | if ( selected >= 0 ) | ||
1316 | { | ||
1317 | stringw loadMap = gui.MapList->getListItem ( selected ); | ||
1318 | if ( 0 == MapParent || loadMap != Game->CurrentMapName ) | ||
1319 | { | ||
1320 | printf ( "Loading map %ls\n", loadMap.c_str() ); | ||
1321 | LoadMap ( loadMap , 1 ); | ||
1322 | if ( 0 == Game->loadParam.loadSkyShader ) | ||
1323 | { | ||
1324 | AddSky ( 1, "skydome2" ); | ||
1325 | } | ||
1326 | CreatePlayers (); | ||
1327 | CreateGUI (); | ||
1328 | SetGUIActive ( 0 ); | ||
1329 | return true; | ||
1330 | } | ||
1331 | } | ||
1332 | } | ||
1333 | else | ||
1334 | if ( eve.GUIEvent.Caller == gui.ArchiveRemove && eve.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED ) | ||
1335 | { | ||
1336 | Game->Device->getFileSystem()->removeFileArchive( gui.ArchiveList->getSelected() ); | ||
1337 | Game->CurrentMapName = ""; | ||
1338 | AddArchive ( "" ); | ||
1339 | } | ||
1340 | else | ||
1341 | if ( eve.GUIEvent.Caller == gui.ArchiveAdd && eve.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED ) | ||
1342 | { | ||
1343 | if ( 0 == gui.ArchiveFileOpen ) | ||
1344 | { | ||
1345 | Game->Device->getFileSystem()->setFileListSystem ( FILESYSTEM_NATIVE ); | ||
1346 | gui.ArchiveFileOpen = Game->Device->getGUIEnvironment()->addFileOpenDialog ( L"Add Game Archive" , false,gui.Window ); | ||
1347 | } | ||
1348 | } | ||
1349 | else | ||
1350 | if ( eve.GUIEvent.Caller == gui.ArchiveFileOpen && eve.GUIEvent.EventType == gui::EGET_FILE_SELECTED ) | ||
1351 | { | ||
1352 | AddArchive ( gui.ArchiveFileOpen->getFileName() ); | ||
1353 | gui.ArchiveFileOpen = 0; | ||
1354 | } | ||
1355 | else | ||
1356 | if ( eve.GUIEvent.Caller == gui.ArchiveFileOpen && eve.GUIEvent.EventType == gui::EGET_DIRECTORY_SELECTED ) | ||
1357 | { | ||
1358 | AddArchive ( gui.ArchiveFileOpen->getDirectoryName() ); | ||
1359 | } | ||
1360 | else | ||
1361 | if ( eve.GUIEvent.Caller == gui.ArchiveFileOpen && eve.GUIEvent.EventType == gui::EGET_FILE_CHOOSE_DIALOG_CANCELLED ) | ||
1362 | { | ||
1363 | gui.ArchiveFileOpen = 0; | ||
1364 | } | ||
1365 | else | ||
1366 | if ( ( eve.GUIEvent.Caller == gui.ArchiveUp || eve.GUIEvent.Caller == gui.ArchiveDown ) && | ||
1367 | eve.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED ) | ||
1368 | { | ||
1369 | s32 rel = eve.GUIEvent.Caller == gui.ArchiveUp ? -1 : 1; | ||
1370 | if ( Game->Device->getFileSystem()->moveFileArchive ( gui.ArchiveList->getSelected (), rel ) ) | ||
1371 | { | ||
1372 | s32 newIndex = core::s32_clamp ( gui.ArchiveList->getSelected() + rel, 0, gui.ArchiveList->getRowCount() - 1 ); | ||
1373 | AddArchive ( "" ); | ||
1374 | gui.ArchiveList->setSelected ( newIndex ); | ||
1375 | Game->CurrentMapName = ""; | ||
1376 | } | ||
1377 | } | ||
1378 | else | ||
1379 | if ( eve.GUIEvent.Caller == gui.VideoDriver && eve.GUIEvent.EventType == gui::EGET_COMBO_BOX_CHANGED ) | ||
1380 | { | ||
1381 | Game->deviceParam.DriverType = (E_DRIVER_TYPE) gui.VideoDriver->getItemData ( gui.VideoDriver->getSelected() ); | ||
1382 | } | ||
1383 | else | ||
1384 | if ( eve.GUIEvent.Caller == gui.VideoMode && eve.GUIEvent.EventType == gui::EGET_COMBO_BOX_CHANGED ) | ||
1385 | { | ||
1386 | u32 val = gui.VideoMode->getItemData ( gui.VideoMode->getSelected() ); | ||
1387 | Game->deviceParam.WindowSize.Width = val >> 16; | ||
1388 | Game->deviceParam.WindowSize.Height = val & 0xFFFF; | ||
1389 | } | ||
1390 | else | ||
1391 | if ( eve.GUIEvent.Caller == gui.FullScreen && eve.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED ) | ||
1392 | { | ||
1393 | Game->deviceParam.Fullscreen = gui.FullScreen->isChecked(); | ||
1394 | } | ||
1395 | else | ||
1396 | if ( eve.GUIEvent.Caller == gui.Bit32 && eve.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED ) | ||
1397 | { | ||
1398 | Game->deviceParam.Bits = gui.Bit32->isChecked() ? 32 : 16; | ||
1399 | } | ||
1400 | else | ||
1401 | if ( eve.GUIEvent.Caller == gui.MultiSample && eve.GUIEvent.EventType == gui::EGET_SCROLL_BAR_CHANGED ) | ||
1402 | { | ||
1403 | Game->deviceParam.AntiAlias = gui.MultiSample->getPos(); | ||
1404 | } | ||
1405 | else | ||
1406 | if ( eve.GUIEvent.Caller == gui.Tesselation && eve.GUIEvent.EventType == gui::EGET_SCROLL_BAR_CHANGED ) | ||
1407 | { | ||
1408 | Game->loadParam.patchTesselation = gui.Tesselation->getPos (); | ||
1409 | } | ||
1410 | else | ||
1411 | if ( eve.GUIEvent.Caller == gui.Gamma && eve.GUIEvent.EventType == gui::EGET_SCROLL_BAR_CHANGED ) | ||
1412 | { | ||
1413 | Game->GammaValue = gui.Gamma->getPos () * 0.01f; | ||
1414 | Game->Device->setGammaRamp ( Game->GammaValue, Game->GammaValue, Game->GammaValue, 0.f, 0.f ); | ||
1415 | } | ||
1416 | else | ||
1417 | if ( eve.GUIEvent.Caller == gui.SetVideoMode && eve.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED ) | ||
1418 | { | ||
1419 | Game->retVal = 2; | ||
1420 | Game->Device->closeDevice(); | ||
1421 | } | ||
1422 | else | ||
1423 | if ( eve.GUIEvent.Caller == gui.Window && eve.GUIEvent.EventType == gui::EGET_ELEMENT_CLOSED ) | ||
1424 | { | ||
1425 | Game->Device->closeDevice(); | ||
1426 | } | ||
1427 | else | ||
1428 | if ( eve.GUIEvent.Caller == gui.Collision && eve.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED ) | ||
1429 | { | ||
1430 | // set fly through active | ||
1431 | Game->flyTroughState ^= 1; | ||
1432 | Player[0].cam()->setAnimateTarget ( Game->flyTroughState == 0 ); | ||
1433 | |||
1434 | printf ( "collision %d\n", Game->flyTroughState == 0 ); | ||
1435 | } | ||
1436 | else | ||
1437 | if ( eve.GUIEvent.Caller == gui.Visible_Map && eve.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED ) | ||
1438 | { | ||
1439 | bool v = gui.Visible_Map->isChecked(); | ||
1440 | |||
1441 | if ( MapParent ) | ||
1442 | { | ||
1443 | printf ( "static node set visible %d\n",v ); | ||
1444 | MapParent->setVisible ( v ); | ||
1445 | } | ||
1446 | } | ||
1447 | else | ||
1448 | if ( eve.GUIEvent.Caller == gui.Visible_Shader && eve.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED ) | ||
1449 | { | ||
1450 | bool v = gui.Visible_Shader->isChecked(); | ||
1451 | |||
1452 | if ( ShaderParent ) | ||
1453 | { | ||
1454 | printf ( "shader node set visible %d\n",v ); | ||
1455 | ShaderParent->setVisible ( v ); | ||
1456 | } | ||
1457 | } | ||
1458 | else | ||
1459 | if ( eve.GUIEvent.Caller == gui.Visible_Skydome && eve.GUIEvent.EventType == gui::EGET_CHECKBOX_CHANGED ) | ||
1460 | { | ||
1461 | if ( SkyNode ) | ||
1462 | { | ||
1463 | bool v = !SkyNode->isVisible(); | ||
1464 | printf ( "skynode set visible %d\n",v ); | ||
1465 | SkyNode->setVisible ( v ); | ||
1466 | } | ||
1467 | } | ||
1468 | else | ||
1469 | if ( eve.GUIEvent.Caller == gui.Respawn && eve.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED ) | ||
1470 | { | ||
1471 | Player[0].respawn (); | ||
1472 | } | ||
1473 | |||
1474 | return false; | ||
1475 | } | ||
1476 | |||
1477 | // fire | ||
1478 | if ((eve.EventType == EET_KEY_INPUT_EVENT && eve.KeyInput.Key == KEY_SPACE && | ||
1479 | eve.KeyInput.PressedDown == false) || | ||
1480 | (eve.EventType == EET_MOUSE_INPUT_EVENT && eve.MouseInput.Event == EMIE_LMOUSE_LEFT_UP) | ||
1481 | ) | ||
1482 | { | ||
1483 | ICameraSceneNode * camera = Game->Device->getSceneManager()->getActiveCamera (); | ||
1484 | if ( camera && camera->isInputReceiverEnabled () ) | ||
1485 | { | ||
1486 | useItem( Player + 0 ); | ||
1487 | } | ||
1488 | } | ||
1489 | |||
1490 | // gui active | ||
1491 | if ((eve.EventType == EET_KEY_INPUT_EVENT && eve.KeyInput.Key == KEY_F1 && | ||
1492 | eve.KeyInput.PressedDown == false) || | ||
1493 | (eve.EventType == EET_MOUSE_INPUT_EVENT && eve.MouseInput.Event == EMIE_RMOUSE_LEFT_UP) | ||
1494 | ) | ||
1495 | { | ||
1496 | SetGUIActive ( 2 ); | ||
1497 | } | ||
1498 | |||
1499 | // check if user presses the key | ||
1500 | if ( eve.EventType == EET_KEY_INPUT_EVENT && eve.KeyInput.PressedDown == false) | ||
1501 | { | ||
1502 | // Escape toggles camera Input | ||
1503 | if ( eve.KeyInput.Key == irr::KEY_ESCAPE ) | ||
1504 | { | ||
1505 | SetGUIActive ( 3 ); | ||
1506 | } | ||
1507 | else | ||
1508 | if (eve.KeyInput.Key == KEY_F11) | ||
1509 | { | ||
1510 | // screenshot are taken without gamma! | ||
1511 | IImage* image = Game->Device->getVideoDriver()->createScreenShot(); | ||
1512 | if (image) | ||
1513 | { | ||
1514 | core::vector3df pos; | ||
1515 | core::vector3df rot; | ||
1516 | ICameraSceneNode * cam = Game->Device->getSceneManager()->getActiveCamera (); | ||
1517 | if ( cam ) | ||
1518 | { | ||
1519 | pos = cam->getPosition (); | ||
1520 | rot = cam->getRotation (); | ||
1521 | } | ||
1522 | |||
1523 | static const c8 *dName[] = { "null", "software", "burning", | ||
1524 | "d3d8", "d3d9", "opengl" }; | ||
1525 | |||
1526 | snprintf(buf, 256, "%s_%ls_%.0f_%.0f_%.0f_%.0f_%.0f_%.0f.jpg", | ||
1527 | dName[Game->Device->getVideoDriver()->getDriverType()], | ||
1528 | Game->CurrentMapName.c_str(), | ||
1529 | pos.X, pos.Y, pos.Z, | ||
1530 | rot.X, rot.Y, rot.Z | ||
1531 | ); | ||
1532 | path filename ( buf ); | ||
1533 | filename.replace ( '/', '_' ); | ||
1534 | printf ( "screenshot : %s\n", filename.c_str() ); | ||
1535 | Game->Device->getVideoDriver()->writeImageToFile(image, filename, 100 ); | ||
1536 | image->drop(); | ||
1537 | } | ||
1538 | } | ||
1539 | else | ||
1540 | if (eve.KeyInput.Key == KEY_F9) | ||
1541 | { | ||
1542 | s32 value = EDS_OFF; | ||
1543 | |||
1544 | Game->debugState = ( Game->debugState + 1 ) & 3; | ||
1545 | |||
1546 | switch ( Game->debugState ) | ||
1547 | { | ||
1548 | case 1: value = EDS_NORMALS | EDS_MESH_WIRE_OVERLAY | EDS_BBOX_ALL; break; | ||
1549 | case 2: value = EDS_NORMALS | EDS_MESH_WIRE_OVERLAY | EDS_SKELETON; break; | ||
1550 | } | ||
1551 | /* | ||
1552 | // set debug map data on/off | ||
1553 | debugState = debugState == EDS_OFF ? | ||
1554 | EDS_NORMALS | EDS_MESH_WIRE_OVERLAY | EDS_BBOX_ALL: | ||
1555 | EDS_OFF; | ||
1556 | */ | ||
1557 | if ( ItemParent ) | ||
1558 | { | ||
1559 | list<ISceneNode*>::ConstIterator it = ItemParent->getChildren().begin(); | ||
1560 | for (; it != ItemParent->getChildren().end(); ++it) | ||
1561 | { | ||
1562 | (*it)->setDebugDataVisible ( value ); | ||
1563 | } | ||
1564 | } | ||
1565 | |||
1566 | if ( ShaderParent ) | ||
1567 | { | ||
1568 | list<ISceneNode*>::ConstIterator it = ShaderParent->getChildren().begin(); | ||
1569 | for (; it != ShaderParent->getChildren().end(); ++it) | ||
1570 | { | ||
1571 | (*it)->setDebugDataVisible ( value ); | ||
1572 | } | ||
1573 | } | ||
1574 | |||
1575 | if ( UnresolvedParent ) | ||
1576 | { | ||
1577 | list<ISceneNode*>::ConstIterator it = UnresolvedParent->getChildren().begin(); | ||
1578 | for (; it != UnresolvedParent->getChildren().end(); ++it) | ||
1579 | { | ||
1580 | (*it)->setDebugDataVisible ( value ); | ||
1581 | } | ||
1582 | } | ||
1583 | |||
1584 | if ( FogParent ) | ||
1585 | { | ||
1586 | list<ISceneNode*>::ConstIterator it = FogParent->getChildren().begin(); | ||
1587 | for (; it != FogParent->getChildren().end(); ++it) | ||
1588 | { | ||
1589 | (*it)->setDebugDataVisible ( value ); | ||
1590 | } | ||
1591 | } | ||
1592 | |||
1593 | if ( SkyNode ) | ||
1594 | { | ||
1595 | SkyNode->setDebugDataVisible ( value ); | ||
1596 | } | ||
1597 | |||
1598 | } | ||
1599 | else | ||
1600 | if (eve.KeyInput.Key == KEY_F8) | ||
1601 | { | ||
1602 | // set gravity on/off | ||
1603 | Game->gravityState ^= 1; | ||
1604 | Player[0].cam()->setGravity ( getGravity ( Game->gravityState ? "earth" : "none" ) ); | ||
1605 | printf ( "gravity %s\n", Game->gravityState ? "earth" : "none" ); | ||
1606 | } | ||
1607 | else | ||
1608 | if (eve.KeyInput.Key == KEY_F7) | ||
1609 | { | ||
1610 | // set fly through active | ||
1611 | Game->flyTroughState ^= 1; | ||
1612 | Player[0].cam()->setAnimateTarget ( Game->flyTroughState == 0 ); | ||
1613 | if ( gui.Collision ) | ||
1614 | gui.Collision->setChecked ( Game->flyTroughState == 0 ); | ||
1615 | |||
1616 | printf ( "collision %d\n", Game->flyTroughState == 0 ); | ||
1617 | } | ||
1618 | else | ||
1619 | if (eve.KeyInput.Key == KEY_F2) | ||
1620 | { | ||
1621 | Player[0].respawn (); | ||
1622 | } | ||
1623 | else | ||
1624 | if (eve.KeyInput.Key == KEY_F3) | ||
1625 | { | ||
1626 | if ( MapParent ) | ||
1627 | { | ||
1628 | bool v = !MapParent->isVisible (); | ||
1629 | printf ( "static node set visible %d\n",v ); | ||
1630 | MapParent->setVisible ( v ); | ||
1631 | if ( gui.Visible_Map ) | ||
1632 | gui.Visible_Map->setChecked ( v ); | ||
1633 | } | ||
1634 | } | ||
1635 | else | ||
1636 | if (eve.KeyInput.Key == KEY_F4) | ||
1637 | { | ||
1638 | if ( ShaderParent ) | ||
1639 | { | ||
1640 | bool v = !ShaderParent->isVisible (); | ||
1641 | printf ( "shader node set visible %d\n",v ); | ||
1642 | ShaderParent->setVisible ( v ); | ||
1643 | if ( gui.Visible_Shader ) | ||
1644 | gui.Visible_Shader->setChecked ( v ); | ||
1645 | } | ||
1646 | } | ||
1647 | else | ||
1648 | if (eve.KeyInput.Key == KEY_F5) | ||
1649 | { | ||
1650 | if ( FogParent ) | ||
1651 | { | ||
1652 | bool v = !FogParent->isVisible (); | ||
1653 | printf ( "fog node set visible %d\n",v ); | ||
1654 | FogParent->setVisible ( v ); | ||
1655 | if ( gui.Visible_Fog ) | ||
1656 | gui.Visible_Fog->setChecked ( v ); | ||
1657 | } | ||
1658 | |||
1659 | } | ||
1660 | else | ||
1661 | if (eve.KeyInput.Key == KEY_F6) | ||
1662 | { | ||
1663 | if ( UnresolvedParent ) | ||
1664 | { | ||
1665 | bool v = !UnresolvedParent->isVisible (); | ||
1666 | printf ( "unresolved node set visible %d\n",v ); | ||
1667 | UnresolvedParent->setVisible ( v ); | ||
1668 | if ( gui.Visible_Unresolved ) | ||
1669 | gui.Visible_Unresolved->setChecked ( v ); | ||
1670 | } | ||
1671 | } | ||
1672 | } | ||
1673 | |||
1674 | // check if user presses the key C ( for crouch) | ||
1675 | if ( eve.EventType == EET_KEY_INPUT_EVENT && eve.KeyInput.Key == KEY_KEY_C ) | ||
1676 | { | ||
1677 | // crouch | ||
1678 | ISceneNodeAnimatorCollisionResponse *anim = Player[0].cam (); | ||
1679 | if ( anim && 0 == Game->flyTroughState ) | ||
1680 | { | ||
1681 | if ( false == eve.KeyInput.PressedDown ) | ||
1682 | { | ||
1683 | // stand up | ||
1684 | anim->setEllipsoidRadius ( vector3df(30,45,30) ); | ||
1685 | anim->setEllipsoidTranslation ( vector3df(0,40,0)); | ||
1686 | |||
1687 | } | ||
1688 | else | ||
1689 | { | ||
1690 | // on your knees | ||
1691 | anim->setEllipsoidRadius ( vector3df(30,20,30) ); | ||
1692 | anim->setEllipsoidTranslation ( vector3df(0,20,0)); | ||
1693 | } | ||
1694 | return true; | ||
1695 | } | ||
1696 | } | ||
1697 | return false; | ||
1698 | } | ||
1699 | |||
1700 | |||
1701 | |||
1702 | /* | ||
1703 | useItem | ||
1704 | */ | ||
1705 | void CQuake3EventHandler::useItem( Q3Player * player) | ||
1706 | { | ||
1707 | ISceneManager* smgr = Game->Device->getSceneManager(); | ||
1708 | ICameraSceneNode* camera = smgr->getActiveCamera(); | ||
1709 | |||
1710 | if (!camera) | ||
1711 | return; | ||
1712 | |||
1713 | SParticleImpact imp; | ||
1714 | imp.when = 0; | ||
1715 | |||
1716 | // get line of camera | ||
1717 | |||
1718 | vector3df start = camera->getPosition(); | ||
1719 | |||
1720 | if ( player->WeaponNode ) | ||
1721 | { | ||
1722 | start.X += 0.f; | ||
1723 | start.Y += 0.f; | ||
1724 | start.Z += 0.f; | ||
1725 | } | ||
1726 | |||
1727 | vector3df end = (camera->getTarget() - start); | ||
1728 | end.normalize(); | ||
1729 | start += end*20.0f; | ||
1730 | |||
1731 | end = start + (end * camera->getFarValue()); | ||
1732 | |||
1733 | triangle3df triangle; | ||
1734 | line3d<f32> line(start, end); | ||
1735 | |||
1736 | // get intersection point with map | ||
1737 | scene::ISceneNode* hitNode; | ||
1738 | if (smgr->getSceneCollisionManager()->getCollisionPoint( | ||
1739 | line, Meta, end, triangle,hitNode)) | ||
1740 | { | ||
1741 | // collides with wall | ||
1742 | vector3df out = triangle.getNormal(); | ||
1743 | out.setLength(0.03f); | ||
1744 | |||
1745 | imp.when = 1; | ||
1746 | imp.outVector = out; | ||
1747 | imp.pos = end; | ||
1748 | |||
1749 | player->setAnim ( "pow" ); | ||
1750 | player->Anim[1].next += player->Anim[1].delta; | ||
1751 | } | ||
1752 | else | ||
1753 | { | ||
1754 | // doesnt collide with wall | ||
1755 | vector3df start = camera->getPosition(); | ||
1756 | if ( player->WeaponNode ) | ||
1757 | { | ||
1758 | //start.X += 10.f; | ||
1759 | //start.Y += -5.f; | ||
1760 | //start.Z += 1.f; | ||
1761 | } | ||
1762 | |||
1763 | vector3df end = (camera->getTarget() - start); | ||
1764 | end.normalize(); | ||
1765 | start += end*20.0f; | ||
1766 | end = start + (end * camera->getFarValue()); | ||
1767 | } | ||
1768 | |||
1769 | // create fire ball | ||
1770 | ISceneNode* node = 0; | ||
1771 | node = smgr->addBillboardSceneNode( BulletParent,dimension2d<f32>(10,10), start); | ||
1772 | |||
1773 | node->setMaterialFlag(EMF_LIGHTING, false); | ||
1774 | node->setMaterialTexture(0, Game->Device->getVideoDriver()->getTexture("fireball.bmp")); | ||
1775 | node->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false); | ||
1776 | node->setMaterialType(EMT_TRANSPARENT_ADD_COLOR); | ||
1777 | |||
1778 | f32 length = (f32)(end - start).getLength(); | ||
1779 | const f32 speed = 5.8f; | ||
1780 | u32 time = (u32)(length / speed); | ||
1781 | |||
1782 | ISceneNodeAnimator* anim = 0; | ||
1783 | |||
1784 | // set flight line | ||
1785 | |||
1786 | anim = smgr->createFlyStraightAnimator(start, end, time); | ||
1787 | node->addAnimator(anim); | ||
1788 | anim->drop(); | ||
1789 | |||
1790 | snprintf ( buf, 64, "bullet: %s on %.1f,%1.f,%1.f", | ||
1791 | imp.when ? "hit" : "nohit", end.X, end.Y, end.Z ); | ||
1792 | node->setName ( buf ); | ||
1793 | |||
1794 | |||
1795 | anim = smgr->createDeleteAnimator(time); | ||
1796 | node->addAnimator(anim); | ||
1797 | anim->drop(); | ||
1798 | |||
1799 | if (imp.when) | ||
1800 | { | ||
1801 | // create impact note | ||
1802 | imp.when = Game->Device->getTimer()->getTime() + | ||
1803 | (time + (s32) ( ( 1.f + Noiser::get() ) * 250.f )); | ||
1804 | Impacts.push_back(imp); | ||
1805 | } | ||
1806 | |||
1807 | // play sound | ||
1808 | } | ||
1809 | |||
1810 | // rendered when bullets hit something | ||
1811 | void CQuake3EventHandler::createParticleImpacts( u32 now ) | ||
1812 | { | ||
1813 | ISceneManager* sm = Game->Device->getSceneManager(); | ||
1814 | |||
1815 | struct smokeLayer | ||
1816 | { | ||
1817 | const c8 * texture; | ||
1818 | f32 scale; | ||
1819 | f32 minparticleSize; | ||
1820 | f32 maxparticleSize; | ||
1821 | f32 boxSize; | ||
1822 | u32 minParticle; | ||
1823 | u32 maxParticle; | ||
1824 | u32 fadeout; | ||
1825 | u32 lifetime; | ||
1826 | }; | ||
1827 | |||
1828 | smokeLayer smoke[] = | ||
1829 | { | ||
1830 | { "smoke2.jpg", 0.4f, 1.5f, 18.f, 20.f, 20, 50, 2000, 10000 }, | ||
1831 | { "smoke3.jpg", 0.2f, 1.2f, 15.f, 20.f, 10, 30, 1000, 12000 } | ||
1832 | }; | ||
1833 | |||
1834 | |||
1835 | u32 i; | ||
1836 | u32 g; | ||
1837 | s32 factor = 1; | ||
1838 | for ( g = 0; g != 2; ++g ) | ||
1839 | { | ||
1840 | smoke[g].minParticle *= factor; | ||
1841 | smoke[g].maxParticle *= factor; | ||
1842 | smoke[g].lifetime *= factor; | ||
1843 | smoke[g].boxSize *= Noiser::get() * 0.5f; | ||
1844 | } | ||
1845 | |||
1846 | for ( i=0; i < Impacts.size(); ++i) | ||
1847 | { | ||
1848 | if (now < Impacts[i].when) | ||
1849 | continue; | ||
1850 | |||
1851 | // create smoke particle system | ||
1852 | IParticleSystemSceneNode* pas = 0; | ||
1853 | |||
1854 | for ( g = 0; g != 2; ++g ) | ||
1855 | { | ||
1856 | pas = sm->addParticleSystemSceneNode(false, BulletParent, -1, Impacts[i].pos); | ||
1857 | |||
1858 | snprintf ( buf, 64, "bullet impact smoke at %.1f,%.1f,%1.f", | ||
1859 | Impacts[i].pos.X,Impacts[i].pos.Y,Impacts[i].pos.Z); | ||
1860 | pas->setName ( buf ); | ||
1861 | |||
1862 | // create a flat smoke | ||
1863 | vector3df direction = Impacts[i].outVector; | ||
1864 | direction *= smoke[g].scale; | ||
1865 | IParticleEmitter* em = pas->createBoxEmitter( | ||
1866 | aabbox3d<f32>(-4.f,0.f,-4.f,20.f,smoke[g].minparticleSize,20.f), | ||
1867 | direction,smoke[g].minParticle, smoke[g].maxParticle, | ||
1868 | video::SColor(0,0,0,0),video::SColor(0,128,128,128), | ||
1869 | 250,4000, 60); | ||
1870 | |||
1871 | em->setMinStartSize (dimension2d<f32>( smoke[g].minparticleSize, smoke[g].minparticleSize)); | ||
1872 | em->setMaxStartSize (dimension2d<f32>( smoke[g].maxparticleSize, smoke[g].maxparticleSize)); | ||
1873 | |||
1874 | pas->setEmitter(em); | ||
1875 | em->drop(); | ||
1876 | |||
1877 | // particles get invisible | ||
1878 | IParticleAffector* paf = pas->createFadeOutParticleAffector( | ||
1879 | video::SColor ( 0, 0, 0, 0 ), smoke[g].fadeout); | ||
1880 | pas->addAffector(paf); | ||
1881 | paf->drop(); | ||
1882 | |||
1883 | // particle system life time | ||
1884 | ISceneNodeAnimator* anim = sm->createDeleteAnimator( smoke[g].lifetime); | ||
1885 | pas->addAnimator(anim); | ||
1886 | anim->drop(); | ||
1887 | |||
1888 | pas->setMaterialFlag(video::EMF_LIGHTING, false); | ||
1889 | pas->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false); | ||
1890 | pas->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR ); | ||
1891 | pas->setMaterialTexture(0, Game->Device->getVideoDriver()->getTexture( smoke[g].texture )); | ||
1892 | } | ||
1893 | |||
1894 | |||
1895 | // play impact sound | ||
1896 | #ifdef USE_IRRKLANG | ||
1897 | /* | ||
1898 | if (irrKlang) | ||
1899 | { | ||
1900 | audio::ISound* sound = | ||
1901 | irrKlang->play3D(impactSound, Impacts[i].pos, false, false, true); | ||
1902 | |||
1903 | if (sound) | ||
1904 | { | ||
1905 | // adjust max value a bit to make to sound of an impact louder | ||
1906 | sound->setMinDistance(400); | ||
1907 | sound->drop(); | ||
1908 | } | ||
1909 | } | ||
1910 | */ | ||
1911 | #endif | ||
1912 | |||
1913 | |||
1914 | // delete entry | ||
1915 | Impacts.erase(i); | ||
1916 | i--; | ||
1917 | } | ||
1918 | } | ||
1919 | |||
1920 | /* | ||
1921 | render | ||
1922 | */ | ||
1923 | void CQuake3EventHandler::Render() | ||
1924 | { | ||
1925 | IVideoDriver * driver = Game->Device->getVideoDriver(); | ||
1926 | if ( 0 == driver ) | ||
1927 | return; | ||
1928 | |||
1929 | // TODO: This does not work, yet. | ||
1930 | const bool anaglyph=false; | ||
1931 | if (anaglyph) | ||
1932 | { | ||
1933 | scene::ICameraSceneNode* cameraOld = Game->Device->getSceneManager()->getActiveCamera(); | ||
1934 | driver->beginScene(true, true, SColor(0,0,0,0)); | ||
1935 | driver->getOverrideMaterial().Material.ColorMask = ECP_NONE; | ||
1936 | driver->getOverrideMaterial().EnableFlags = EMF_COLOR_MASK; | ||
1937 | driver->getOverrideMaterial().EnablePasses = ESNRP_SKY_BOX + | ||
1938 | ESNRP_SOLID + | ||
1939 | ESNRP_TRANSPARENT + | ||
1940 | ESNRP_TRANSPARENT_EFFECT + | ||
1941 | ESNRP_SHADOW; | ||
1942 | Game->Device->getSceneManager()->drawAll(); | ||
1943 | driver->clearZBuffer(); | ||
1944 | |||
1945 | const vector3df oldPosition = cameraOld->getPosition(); | ||
1946 | const vector3df oldTarget = cameraOld->getTarget(); | ||
1947 | const matrix4 startMatrix = cameraOld->getAbsoluteTransformation(); | ||
1948 | const vector3df focusPoint = (oldTarget - | ||
1949 | cameraOld->getAbsolutePosition()).setLength(10000) + | ||
1950 | cameraOld->getAbsolutePosition() ; | ||
1951 | |||
1952 | scene::ICameraSceneNode* camera = cameraOld;//Game->Device->getSceneManager()->addCameraSceneNode(); | ||
1953 | |||
1954 | //Left eye... | ||
1955 | vector3df pos; | ||
1956 | matrix4 move; | ||
1957 | |||
1958 | move.setTranslation( vector3df(-1.5f,0.0f,0.0f) ); | ||
1959 | pos=(startMatrix*move).getTranslation(); | ||
1960 | |||
1961 | driver->getOverrideMaterial().Material.ColorMask = ECP_RED; | ||
1962 | driver->getOverrideMaterial().EnableFlags = EMF_COLOR_MASK; | ||
1963 | driver->getOverrideMaterial().EnablePasses = | ||
1964 | ESNRP_SKY_BOX|ESNRP_SOLID|ESNRP_TRANSPARENT| | ||
1965 | ESNRP_TRANSPARENT_EFFECT|ESNRP_SHADOW; | ||
1966 | |||
1967 | camera->setPosition(pos); | ||
1968 | camera->setTarget(focusPoint); | ||
1969 | |||
1970 | Game->Device->getSceneManager()->drawAll(); | ||
1971 | driver->clearZBuffer(); | ||
1972 | |||
1973 | //Right eye... | ||
1974 | move.setTranslation( vector3df(1.5f,0.0f,0.0f) ); | ||
1975 | pos=(startMatrix*move).getTranslation(); | ||
1976 | |||
1977 | driver->getOverrideMaterial().Material.ColorMask = ECP_GREEN + ECP_BLUE; | ||
1978 | driver->getOverrideMaterial().EnableFlags = EMF_COLOR_MASK; | ||
1979 | driver->getOverrideMaterial().EnablePasses = | ||
1980 | ESNRP_SKY_BOX|ESNRP_SOLID|ESNRP_TRANSPARENT| | ||
1981 | ESNRP_TRANSPARENT_EFFECT|ESNRP_SHADOW; | ||
1982 | |||
1983 | camera->setPosition(pos); | ||
1984 | camera->setTarget(focusPoint); | ||
1985 | |||
1986 | Game->Device->getSceneManager()->drawAll(); | ||
1987 | |||
1988 | driver->getOverrideMaterial().Material.ColorMask=ECP_ALL; | ||
1989 | driver->getOverrideMaterial().EnableFlags=0; | ||
1990 | driver->getOverrideMaterial().EnablePasses=0; | ||
1991 | |||
1992 | if (camera != cameraOld) | ||
1993 | { | ||
1994 | Game->Device->getSceneManager()->setActiveCamera(cameraOld); | ||
1995 | camera->remove(); | ||
1996 | } | ||
1997 | else | ||
1998 | { | ||
1999 | camera->setPosition(oldPosition); | ||
2000 | camera->setTarget(oldTarget); | ||
2001 | } | ||
2002 | } | ||
2003 | else | ||
2004 | { | ||
2005 | driver->beginScene(true, true, SColor(0,0,0,0)); | ||
2006 | Game->Device->getSceneManager()->drawAll(); | ||
2007 | } | ||
2008 | Game->Device->getGUIEnvironment()->drawAll(); | ||
2009 | driver->endScene(); | ||
2010 | } | ||
2011 | |||
2012 | /* | ||
2013 | update the generic scene node | ||
2014 | */ | ||
2015 | void CQuake3EventHandler::Animate() | ||
2016 | { | ||
2017 | u32 now = Game->Device->getTimer()->getTime(); | ||
2018 | |||
2019 | Q3Player * player = Player + 0; | ||
2020 | |||
2021 | checkTimeFire ( player->Anim, 4, now ); | ||
2022 | |||
2023 | // Query Scene Manager attributes | ||
2024 | if ( player->Anim[0].flags & FIRED ) | ||
2025 | { | ||
2026 | ISceneManager *smgr = Game->Device->getSceneManager (); | ||
2027 | wchar_t msg[128]; | ||
2028 | IVideoDriver * driver = Game->Device->getVideoDriver(); | ||
2029 | |||
2030 | IAttributes * attr = smgr->getParameters(); | ||
2031 | #ifdef _IRR_SCENEMANAGER_DEBUG | ||
2032 | swprintf ( msg, 128, | ||
2033 | L"Q3 %s [%ls], FPS:%03d Tri:%.03fm Cull %d/%d nodes (%d,%d,%d)", | ||
2034 | Game->CurrentMapName.c_str(), | ||
2035 | driver->getName(), | ||
2036 | driver->getFPS (), | ||
2037 | (f32) driver->getPrimitiveCountDrawn( 0 ) * ( 1.f / 1000000.f ), | ||
2038 | attr->getAttributeAsInt ( "culled" ), | ||
2039 | attr->getAttributeAsInt ( "calls" ), | ||
2040 | attr->getAttributeAsInt ( "drawn_solid" ), | ||
2041 | attr->getAttributeAsInt ( "drawn_transparent" ), | ||
2042 | attr->getAttributeAsInt ( "drawn_transparent_effect" ) | ||
2043 | ); | ||
2044 | #else | ||
2045 | swprintf ( msg, 128, | ||
2046 | L"Q3 %s [%ls], FPS:%03d Tri:%.03fm", | ||
2047 | Game->CurrentMapName.c_str(), | ||
2048 | driver->getName(), | ||
2049 | driver->getFPS (), | ||
2050 | (f32) driver->getPrimitiveCountDrawn( 0 ) * ( 1.f / 1000000.f ) | ||
2051 | ); | ||
2052 | #endif | ||
2053 | Game->Device->setWindowCaption( msg ); | ||
2054 | |||
2055 | swprintf ( msg, 128, | ||
2056 | L"%03d fps, F1 GUI on/off, F2 respawn, F3-F6 toggle Nodes, F7 Collision on/off" | ||
2057 | L", F8 Gravity on/off, Right Mouse Toggle GUI", | ||
2058 | Game->Device->getVideoDriver()->getFPS () | ||
2059 | ); | ||
2060 | if ( gui.StatusLine ) | ||
2061 | gui.StatusLine->setText ( msg ); | ||
2062 | player->Anim[0].flags &= ~FIRED; | ||
2063 | } | ||
2064 | |||
2065 | // idle.. | ||
2066 | if ( player->Anim[1].flags & FIRED ) | ||
2067 | { | ||
2068 | if ( strcmp ( player->animation, "idle" ) ) | ||
2069 | player->setAnim ( "idle" ); | ||
2070 | |||
2071 | player->Anim[1].flags &= ~FIRED; | ||
2072 | } | ||
2073 | |||
2074 | createParticleImpacts ( now ); | ||
2075 | |||
2076 | } | ||
2077 | |||
2078 | |||
2079 | /* The main game states | ||
2080 | */ | ||
2081 | void runGame ( GameData *game ) | ||
2082 | { | ||
2083 | if ( game->retVal >= 3 ) | ||
2084 | return; | ||
2085 | |||
2086 | game->Device = (*game->createExDevice) ( game->deviceParam ); | ||
2087 | if ( 0 == game->Device) | ||
2088 | { | ||
2089 | // could not create selected driver. | ||
2090 | game->retVal = 0; | ||
2091 | return; | ||
2092 | } | ||
2093 | |||
2094 | // create an event receiver based on current game data | ||
2095 | CQuake3EventHandler *eventHandler = new CQuake3EventHandler( game ); | ||
2096 | |||
2097 | // load stored config | ||
2098 | game->load ( "explorer.cfg" ); | ||
2099 | |||
2100 | // add our media directory and archive to the file system | ||
2101 | for ( u32 i = 0; i < game->CurrentArchiveList.size(); ++i ) | ||
2102 | { | ||
2103 | eventHandler->AddArchive ( game->CurrentArchiveList[i] ); | ||
2104 | } | ||
2105 | |||
2106 | // Load a Map or startup to the GUI | ||
2107 | if ( game->CurrentMapName.size () ) | ||
2108 | { | ||
2109 | eventHandler->LoadMap ( game->CurrentMapName, 1 ); | ||
2110 | if ( 0 == game->loadParam.loadSkyShader ) | ||
2111 | eventHandler->AddSky ( 1, "skydome2" ); | ||
2112 | eventHandler->CreatePlayers (); | ||
2113 | eventHandler->CreateGUI (); | ||
2114 | eventHandler->SetGUIActive ( 0 ); | ||
2115 | |||
2116 | // set player to last position on restart | ||
2117 | if ( game->retVal == 2 ) | ||
2118 | { | ||
2119 | eventHandler->GetPlayer( 0 )->setpos ( game->PlayerPosition, game->PlayerRotation ); | ||
2120 | } | ||
2121 | } | ||
2122 | else | ||
2123 | { | ||
2124 | // start up empty | ||
2125 | eventHandler->AddSky ( 1, "skydome2" ); | ||
2126 | eventHandler->CreatePlayers (); | ||
2127 | eventHandler->CreateGUI (); | ||
2128 | eventHandler->SetGUIActive ( 1 ); | ||
2129 | background_music ( "IrrlichtTheme.ogg" ); | ||
2130 | } | ||
2131 | |||
2132 | |||
2133 | game->retVal = 3; | ||
2134 | while( game->Device->run() ) | ||
2135 | { | ||
2136 | eventHandler->Animate (); | ||
2137 | eventHandler->Render (); | ||
2138 | //if ( !game->Device->isWindowActive() ) | ||
2139 | game->Device->yield(); | ||
2140 | } | ||
2141 | |||
2142 | game->Device->setGammaRamp ( 1.f, 1.f, 1.f, 0.f, 0.f ); | ||
2143 | delete eventHandler; | ||
2144 | } | ||
2145 | |||
2146 | #if defined (_IRR_WINDOWS_) && 0 | ||
2147 | #pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup") | ||
2148 | #endif | ||
2149 | |||
2150 | |||
2151 | /* The main routine, doing all setup | ||
2152 | */ | ||
2153 | int IRRCALLCONV main(int argc, char* argv[]) | ||
2154 | { | ||
2155 | path prgname(argv[0]); | ||
2156 | GameData game ( deletePathFromPath ( prgname, 1 ) ); | ||
2157 | |||
2158 | // dynamically load irrlicht | ||
2159 | const c8 * dllName = argc > 1 ? argv[1] : "irrlicht.dll"; | ||
2160 | game.createExDevice = load_createDeviceEx ( dllName ); | ||
2161 | if ( 0 == game.createExDevice ) | ||
2162 | { | ||
2163 | game.retVal = 3; | ||
2164 | printf ( "Could not load %s.\n", dllName ); | ||
2165 | return game.retVal; // could not load dll | ||
2166 | } | ||
2167 | |||
2168 | // start without asking for driver | ||
2169 | game.retVal = 1; | ||
2170 | do | ||
2171 | { | ||
2172 | // if driver could not created, ask for another driver | ||
2173 | if ( game.retVal == 0 ) | ||
2174 | { | ||
2175 | game.setDefault (); | ||
2176 | // ask user for driver | ||
2177 | game.deviceParam.DriverType=driverChoiceConsole(); | ||
2178 | if (game.deviceParam.DriverType==video::EDT_COUNT) | ||
2179 | game.retVal = 3; | ||
2180 | } | ||
2181 | runGame ( &game ); | ||
2182 | } while ( game.retVal < 3 ); | ||
2183 | |||
2184 | return game.retVal; | ||
2185 | } | ||
2186 | |||
2187 | /* | ||
2188 | **/ | ||
diff --git a/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/q3factory.cpp b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/q3factory.cpp new file mode 100644 index 0000000..d0f09b2 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/q3factory.cpp | |||
@@ -0,0 +1,824 @@ | |||
1 | /*! | ||
2 | Model Factory. | ||
3 | create the additional scenenodes for ( bullets, health... ) | ||
4 | |||
5 | Defines the Entities for Quake3 | ||
6 | */ | ||
7 | |||
8 | #include <irrlicht.h> | ||
9 | #include "q3factory.h" | ||
10 | #include "sound.h" | ||
11 | |||
12 | using namespace irr; | ||
13 | using namespace scene; | ||
14 | using namespace gui; | ||
15 | using namespace video; | ||
16 | using namespace core; | ||
17 | using namespace quake3; | ||
18 | |||
19 | //! This list is based on the original quake3. | ||
20 | static const SItemElement Quake3ItemElement [] = { | ||
21 | { "item_health", | ||
22 | {"models/powerups/health/medium_cross.md3", | ||
23 | "models/powerups/health/medium_sphere.md3"}, | ||
24 | "sound/items/n_health.wav", | ||
25 | "icons/iconh_yellow", | ||
26 | "25 Health", | ||
27 | 25, | ||
28 | HEALTH, | ||
29 | SUB_NONE, | ||
30 | SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1 | ||
31 | }, | ||
32 | { "item_health_large", | ||
33 | "models/powerups/health/large_cross.md3", | ||
34 | "models/powerups/health/large_sphere.md3", | ||
35 | "sound/items/l_health.wav", | ||
36 | "icons/iconh_red", | ||
37 | "50 Health", | ||
38 | 50, | ||
39 | HEALTH, | ||
40 | SUB_NONE, | ||
41 | SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1 | ||
42 | }, | ||
43 | { | ||
44 | "item_health_mega", | ||
45 | "models/powerups/health/mega_cross.md3", | ||
46 | "models/powerups/health/mega_sphere.md3", | ||
47 | "sound/items/m_health.wav", | ||
48 | "icons/iconh_mega", | ||
49 | "Mega Health", | ||
50 | 100, | ||
51 | HEALTH, | ||
52 | SUB_NONE, | ||
53 | SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1 | ||
54 | }, | ||
55 | { | ||
56 | "item_health_small", | ||
57 | "models/powerups/health/small_cross.md3", | ||
58 | "models/powerups/health/small_sphere.md3", | ||
59 | "sound/items/s_health.wav", | ||
60 | "icons/iconh_green", | ||
61 | "5 Health", | ||
62 | 5, | ||
63 | HEALTH, | ||
64 | SUB_NONE, | ||
65 | SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1 | ||
66 | }, | ||
67 | { "ammo_bullets", | ||
68 | "models/powerups/ammo/machinegunam.md3", | ||
69 | "", | ||
70 | "sound/misc/am_pkup.wav", | ||
71 | "icons/icona_machinegun", | ||
72 | "Bullets", | ||
73 | 50, | ||
74 | AMMO, | ||
75 | MACHINEGUN, | ||
76 | SPECIAL_SFX_BOUNCE, | ||
77 | }, | ||
78 | { | ||
79 | "ammo_cells", | ||
80 | "models/powerups/ammo/plasmaam.md3", | ||
81 | "", | ||
82 | "sound/misc/am_pkup.wav", | ||
83 | "icons/icona_plasma", | ||
84 | "Cells", | ||
85 | 30, | ||
86 | AMMO, | ||
87 | PLASMAGUN, | ||
88 | SPECIAL_SFX_BOUNCE | ||
89 | }, | ||
90 | { "ammo_rockets", | ||
91 | "models/powerups/ammo/rocketam.md3", | ||
92 | "", | ||
93 | "", | ||
94 | "icons/icona_rocket", | ||
95 | "Rockets", | ||
96 | 5, | ||
97 | AMMO, | ||
98 | ROCKET_LAUNCHER, | ||
99 | SPECIAL_SFX_ROTATE | ||
100 | }, | ||
101 | { | ||
102 | "ammo_shells", | ||
103 | "models/powerups/ammo/shotgunam.md3", | ||
104 | "", | ||
105 | "sound/misc/am_pkup.wav", | ||
106 | "icons/icona_shotgun", | ||
107 | "Shells", | ||
108 | 10, | ||
109 | AMMO, | ||
110 | SHOTGUN, | ||
111 | SPECIAL_SFX_ROTATE | ||
112 | }, | ||
113 | { | ||
114 | "ammo_slugs", | ||
115 | "models/powerups/ammo/railgunam.md3", | ||
116 | "", | ||
117 | "sound/misc/am_pkup.wav", | ||
118 | "icons/icona_railgun", | ||
119 | "Slugs", | ||
120 | 10, | ||
121 | AMMO, | ||
122 | RAILGUN, | ||
123 | SPECIAL_SFX_ROTATE | ||
124 | }, | ||
125 | { | ||
126 | "item_armor_body", | ||
127 | "models/powerups/armor/armor_red.md3", | ||
128 | "", | ||
129 | "sound/misc/ar2_pkup.wav", | ||
130 | "icons/iconr_red", | ||
131 | "Heavy Armor", | ||
132 | 100, | ||
133 | ARMOR, | ||
134 | SUB_NONE, | ||
135 | SPECIAL_SFX_ROTATE | ||
136 | }, | ||
137 | { | ||
138 | "item_armor_combat", | ||
139 | "models/powerups/armor/armor_yel.md3", | ||
140 | "", | ||
141 | "sound/misc/ar2_pkup.wav", | ||
142 | "icons/iconr_yellow", | ||
143 | "Armor", | ||
144 | 50, | ||
145 | ARMOR, | ||
146 | SUB_NONE, | ||
147 | SPECIAL_SFX_ROTATE | ||
148 | }, | ||
149 | { | ||
150 | "item_armor_shard", | ||
151 | "models/powerups/armor/shard.md3", | ||
152 | "", | ||
153 | "sound/misc/ar1_pkup.wav", | ||
154 | "icons/iconr_shard", | ||
155 | "Armor Shared", | ||
156 | 5, | ||
157 | ARMOR, | ||
158 | SUB_NONE, | ||
159 | SPECIAL_SFX_ROTATE | ||
160 | }, | ||
161 | { | ||
162 | "weapon_gauntlet", | ||
163 | "models/weapons2/gauntlet/gauntlet.md3", | ||
164 | "", | ||
165 | "sound/misc/w_pkup.wav", | ||
166 | "icons/iconw_gauntlet", | ||
167 | "Gauntlet", | ||
168 | 0, | ||
169 | WEAPON, | ||
170 | GAUNTLET, | ||
171 | SPECIAL_SFX_ROTATE | ||
172 | }, | ||
173 | { | ||
174 | "weapon_shotgun", | ||
175 | "models/weapons2/shotgun/shotgun.md3", | ||
176 | "", | ||
177 | "sound/misc/w_pkup.wav", | ||
178 | "icons/iconw_shotgun", | ||
179 | "Shotgun", | ||
180 | 10, | ||
181 | WEAPON, | ||
182 | SHOTGUN, | ||
183 | SPECIAL_SFX_ROTATE | ||
184 | }, | ||
185 | { | ||
186 | "weapon_machinegun", | ||
187 | "models/weapons2/machinegun/machinegun.md3", | ||
188 | "", | ||
189 | "sound/misc/w_pkup.wav", | ||
190 | "icons/iconw_machinegun", | ||
191 | "Machinegun", | ||
192 | 40, | ||
193 | WEAPON, | ||
194 | MACHINEGUN, | ||
195 | SPECIAL_SFX_ROTATE | ||
196 | }, | ||
197 | { | ||
198 | "weapon_grenadelauncher", | ||
199 | "models/weapons2/grenadel/grenadel.md3", | ||
200 | "", | ||
201 | "sound/misc/w_pkup.wav", | ||
202 | "icons/iconw_grenade", | ||
203 | "Grenade Launcher", | ||
204 | 10, | ||
205 | WEAPON, | ||
206 | GRENADE_LAUNCHER, | ||
207 | SPECIAL_SFX_ROTATE | ||
208 | }, | ||
209 | { | ||
210 | "weapon_rocketlauncher", | ||
211 | "models/weapons2/rocketl/rocketl.md3", | ||
212 | "", | ||
213 | "sound/misc/w_pkup.wav", | ||
214 | "icons/iconw_rocket", | ||
215 | "Rocket Launcher", | ||
216 | 10, | ||
217 | WEAPON, | ||
218 | ROCKET_LAUNCHER, | ||
219 | SPECIAL_SFX_ROTATE | ||
220 | }, | ||
221 | { | ||
222 | "weapon_lightning", | ||
223 | "models/weapons2/lightning/lightning.md3", | ||
224 | "", | ||
225 | "sound/misc/w_pkup.wav", | ||
226 | "icons/iconw_lightning", | ||
227 | "Lightning Gun", | ||
228 | 100, | ||
229 | WEAPON, | ||
230 | LIGHTNING, | ||
231 | SPECIAL_SFX_ROTATE | ||
232 | }, | ||
233 | { | ||
234 | "weapon_railgun", | ||
235 | "models/weapons2/railgun/railgun.md3", | ||
236 | "", | ||
237 | "sound/misc/w_pkup.wav", | ||
238 | "icons/iconw_railgun", | ||
239 | "Railgun", | ||
240 | 10, | ||
241 | WEAPON, | ||
242 | RAILGUN, | ||
243 | SPECIAL_SFX_ROTATE | ||
244 | }, | ||
245 | { | ||
246 | "weapon_plasmagun", | ||
247 | "models/weapons2/plasma/plasma.md3", | ||
248 | "", | ||
249 | "sound/misc/w_pkup.wav", | ||
250 | "icons/iconw_plasma", | ||
251 | "Plasma Gun", | ||
252 | 50, | ||
253 | WEAPON, | ||
254 | PLASMAGUN, | ||
255 | SPECIAL_SFX_ROTATE | ||
256 | }, | ||
257 | { | ||
258 | "weapon_bfg", | ||
259 | "models/weapons2/bfg/bfg.md3", | ||
260 | "", | ||
261 | "sound/misc/w_pkup.wav", | ||
262 | "icons/iconw_bfg", | ||
263 | "BFG10K", | ||
264 | 20, | ||
265 | WEAPON, | ||
266 | BFG, | ||
267 | SPECIAL_SFX_ROTATE | ||
268 | }, | ||
269 | { | ||
270 | "weapon_grapplinghook", | ||
271 | "models/weapons2/grapple/grapple.md3", | ||
272 | "", | ||
273 | "sound/misc/w_pkup.wav", | ||
274 | "icons/iconw_grapple", | ||
275 | "Grappling Hook", | ||
276 | 0, | ||
277 | WEAPON, | ||
278 | GRAPPLING_HOOK, | ||
279 | SPECIAL_SFX_ROTATE | ||
280 | }, | ||
281 | { | ||
282 | 0 | ||
283 | } | ||
284 | |||
285 | }; | ||
286 | |||
287 | |||
288 | /*! | ||
289 | */ | ||
290 | const SItemElement * getItemElement ( const stringc& key ) | ||
291 | { | ||
292 | const SItemElement *item = Quake3ItemElement; | ||
293 | |||
294 | while ( item->key ) | ||
295 | { | ||
296 | if ( 0 == strcmp ( key.c_str(), item->key ) ) | ||
297 | return item; | ||
298 | item += 1; | ||
299 | } | ||
300 | return 0; | ||
301 | } | ||
302 | |||
303 | /*! | ||
304 | Quake3 Model Factory. | ||
305 | Takes the mesh buffers and creates scenenodes for their associated shaders | ||
306 | */ | ||
307 | void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam, | ||
308 | IrrlichtDevice *device, | ||
309 | IQ3LevelMesh* mesh, | ||
310 | eQ3MeshIndex meshIndex, | ||
311 | ISceneNode *parent, | ||
312 | IMetaTriangleSelector *meta, | ||
313 | bool showShaderName ) | ||
314 | { | ||
315 | if ( 0 == mesh || 0 == device ) | ||
316 | return; | ||
317 | |||
318 | IMeshSceneNode* node = 0; | ||
319 | ISceneManager* smgr = device->getSceneManager(); | ||
320 | ITriangleSelector * selector = 0; | ||
321 | |||
322 | // the additional mesh can be quite huge and is unoptimized | ||
323 | // Save to cast to SMesh | ||
324 | SMesh * additional_mesh = (SMesh*) mesh->getMesh ( meshIndex ); | ||
325 | if ( 0 == additional_mesh || additional_mesh->getMeshBufferCount() == 0) | ||
326 | return; | ||
327 | |||
328 | char buf[128]; | ||
329 | if ( loadParam.verbose > 0 ) | ||
330 | { | ||
331 | loadParam.startTime = device->getTimer()->getRealTime(); | ||
332 | if ( loadParam.verbose > 1 ) | ||
333 | { | ||
334 | snprintf(buf, 128, "q3shaderfactory start" ); | ||
335 | device->getLogger()->log( buf, ELL_INFORMATION); | ||
336 | } | ||
337 | } | ||
338 | |||
339 | IGUIFont *font = 0; | ||
340 | if ( showShaderName ) | ||
341 | font = device->getGUIEnvironment()->getFont("fontlucida.png"); | ||
342 | |||
343 | IVideoDriver *driver = device->getVideoDriver(); | ||
344 | |||
345 | // create helper textures | ||
346 | if ( 1 ) | ||
347 | { | ||
348 | tTexArray tex; | ||
349 | u32 pos = 0; | ||
350 | getTextures ( tex, "$redimage $blueimage $whiteimage $checkerimage", pos, | ||
351 | device->getFileSystem(), driver ); | ||
352 | } | ||
353 | |||
354 | s32 sceneNodeID = 0; | ||
355 | for ( u32 i = 0; i!= additional_mesh->getMeshBufferCount (); ++i ) | ||
356 | { | ||
357 | IMeshBuffer *meshBuffer = additional_mesh->getMeshBuffer ( i ); | ||
358 | const SMaterial &material = meshBuffer->getMaterial(); | ||
359 | |||
360 | //! The ShaderIndex is stored in the second material parameter | ||
361 | s32 shaderIndex = (s32) material.MaterialTypeParam2; | ||
362 | |||
363 | // the meshbuffer can be rendered without additional support, or it has no shader | ||
364 | IShader *shader = (IShader *) mesh->getShader ( shaderIndex ); | ||
365 | |||
366 | // no shader, or mapped to existing material | ||
367 | if ( 0 == shader ) | ||
368 | { | ||
369 | |||
370 | #if 1 | ||
371 | // clone mesh | ||
372 | SMesh * m = new SMesh (); | ||
373 | m->addMeshBuffer ( meshBuffer ); | ||
374 | SMaterial &mat = m->getMeshBuffer( 0 )->getMaterial(); | ||
375 | if ( mat.getTexture( 0 ) == 0 ) | ||
376 | mat.setTexture ( 0, driver->getTexture ( "$blueimage" ) ); | ||
377 | if ( mat.getTexture( 1 ) == 0 ) | ||
378 | mat.setTexture ( 1, driver->getTexture ( "$redimage" ) ); | ||
379 | |||
380 | IMesh * store = smgr->getMeshManipulator ()->createMeshWith2TCoords ( m ); | ||
381 | m->drop(); | ||
382 | |||
383 | node = smgr->addMeshSceneNode ( store, parent, sceneNodeID ); | ||
384 | node->setAutomaticCulling ( scene::EAC_OFF ); | ||
385 | store->drop (); | ||
386 | sceneNodeID += 1; | ||
387 | #endif | ||
388 | } | ||
389 | else if ( 1 ) | ||
390 | { | ||
391 | /* | ||
392 | stringc s; | ||
393 | dumpShader ( s, shader ); | ||
394 | printf ( s.c_str () ); | ||
395 | */ | ||
396 | // create sceneNode | ||
397 | node = smgr->addQuake3SceneNode ( meshBuffer, shader, parent, sceneNodeID ); | ||
398 | node->setAutomaticCulling ( scene::EAC_FRUSTUM_BOX ); | ||
399 | sceneNodeID += 1; | ||
400 | } | ||
401 | |||
402 | // show Debug Shader Name | ||
403 | if ( showShaderName && node ) | ||
404 | { | ||
405 | swprintf ( (wchar_t*) buf, 64, L"%hs:%d", node->getName(),node->getID() ); | ||
406 | smgr->addBillboardTextSceneNode( | ||
407 | font, | ||
408 | (wchar_t*) buf, | ||
409 | node, | ||
410 | dimension2d<f32>(80.0f, 8.0f), | ||
411 | vector3df(0, 10, 0), | ||
412 | sceneNodeID); | ||
413 | sceneNodeID += 1; | ||
414 | } | ||
415 | |||
416 | // create Portal Rendertargets | ||
417 | if ( shader ) | ||
418 | { | ||
419 | const SVarGroup *group = shader->getGroup(1); | ||
420 | if ( group->isDefined( "surfaceparm", "portal" ) ) | ||
421 | { | ||
422 | } | ||
423 | |||
424 | } | ||
425 | |||
426 | |||
427 | // add collision | ||
428 | // find out if shader is marked as nonsolid | ||
429 | u8 doCreate = meta !=0 ; | ||
430 | |||
431 | if ( shader ) | ||
432 | { | ||
433 | const SVarGroup *group = shader->getGroup(1); | ||
434 | if ( group->isDefined( "surfaceparm", "trans" ) | ||
435 | // || group->isDefined( "surfaceparm", "sky" ) | ||
436 | // || group->isDefined( "surfaceparm", "nonsolid" ) | ||
437 | ) | ||
438 | { | ||
439 | if ( !group->isDefined( "surfaceparm", "metalsteps" ) ) | ||
440 | { | ||
441 | doCreate = 0; | ||
442 | } | ||
443 | } | ||
444 | } | ||
445 | |||
446 | if ( doCreate ) | ||
447 | { | ||
448 | IMesh *m = 0; | ||
449 | |||
450 | //! controls if triangles are modified by the scenenode during runtime | ||
451 | bool takeOriginal = true; | ||
452 | |||
453 | if ( takeOriginal ) | ||
454 | { | ||
455 | m = new SMesh (); | ||
456 | ((SMesh*) m )->addMeshBuffer (meshBuffer); | ||
457 | } | ||
458 | else | ||
459 | { | ||
460 | m = node->getMesh(); | ||
461 | } | ||
462 | |||
463 | //selector = smgr->createOctreeTriangleSelector ( m, 0, 128 ); | ||
464 | selector = smgr->createTriangleSelector ( m, 0 ); | ||
465 | meta->addTriangleSelector ( selector ); | ||
466 | selector->drop (); | ||
467 | |||
468 | if ( takeOriginal ) | ||
469 | { | ||
470 | delete m; | ||
471 | } | ||
472 | } | ||
473 | |||
474 | } | ||
475 | |||
476 | #if 0 | ||
477 | if ( meta ) | ||
478 | { | ||
479 | selector = smgr->createOctreeTriangleSelector ( additional_mesh, 0 ); | ||
480 | meta->addTriangleSelector ( selector ); | ||
481 | selector->drop (); | ||
482 | } | ||
483 | #endif | ||
484 | |||
485 | if ( loadParam.verbose > 0 ) | ||
486 | { | ||
487 | loadParam.endTime = device->getTimer()->getRealTime (); | ||
488 | snprintf(buf, 128, "q3shaderfactory needed %04d ms to create %d shader nodes", | ||
489 | loadParam.endTime - loadParam.startTime, | ||
490 | sceneNodeID | ||
491 | ); | ||
492 | device->getLogger()->log(buf, ELL_INFORMATION); | ||
493 | } | ||
494 | |||
495 | } | ||
496 | |||
497 | |||
498 | /*! | ||
499 | create Items from Entity | ||
500 | */ | ||
501 | void Q3ModelFactory ( Q3LevelLoadParameter &loadParam, | ||
502 | IrrlichtDevice *device, | ||
503 | IQ3LevelMesh* masterMesh, | ||
504 | ISceneNode *parent, | ||
505 | bool showShaderName | ||
506 | ) | ||
507 | { | ||
508 | if ( 0 == masterMesh ) | ||
509 | return; | ||
510 | |||
511 | tQ3EntityList &entity = masterMesh->getEntityList (); | ||
512 | ISceneManager* smgr = device->getSceneManager(); | ||
513 | |||
514 | |||
515 | char buf[128]; | ||
516 | const SVarGroup *group; | ||
517 | IEntity search; | ||
518 | s32 index; | ||
519 | s32 lastIndex; | ||
520 | |||
521 | /* | ||
522 | stringc s; | ||
523 | FILE *f = 0; | ||
524 | f = fopen ( "entity.txt", "wb" ); | ||
525 | for ( index = 0; (u32) index < entityList.size (); ++index ) | ||
526 | { | ||
527 | const IEntity *entity = &entityList[ index ]; | ||
528 | s = entity->name; | ||
529 | dumpShader ( s, entity ); | ||
530 | fwrite ( s.c_str(), 1, s.size(), f ); | ||
531 | } | ||
532 | fclose ( f ); | ||
533 | */ | ||
534 | IAnimatedMeshMD3* model; | ||
535 | SMD3Mesh * mesh; | ||
536 | const SMD3MeshBuffer *meshBuffer; | ||
537 | IMeshSceneNode* node; | ||
538 | ISceneNodeAnimator* anim; | ||
539 | const IShader *shader; | ||
540 | u32 pos; | ||
541 | vector3df p; | ||
542 | u32 nodeCount = 0; | ||
543 | tTexArray textureArray; | ||
544 | |||
545 | IGUIFont *font = 0; | ||
546 | if ( showShaderName ) | ||
547 | font = device->getGUIEnvironment()->getFont("fontlucida.png"); | ||
548 | |||
549 | const SItemElement *itemElement; | ||
550 | |||
551 | // walk list | ||
552 | for ( index = 0; (u32) index < entity.size(); ++index ) | ||
553 | { | ||
554 | itemElement = getItemElement ( entity[index].name ); | ||
555 | if ( 0 == itemElement ) | ||
556 | continue; | ||
557 | |||
558 | pos = 0; | ||
559 | p = getAsVector3df ( entity[index].getGroup(1)->get ( "origin" ), pos ); | ||
560 | |||
561 | nodeCount += 1; | ||
562 | for ( u32 g = 0; g < 2; ++g ) | ||
563 | { | ||
564 | if ( 0 == itemElement->model[g] || itemElement->model[g][0] == 0 ) | ||
565 | continue; | ||
566 | model = (IAnimatedMeshMD3*) smgr->getMesh( itemElement->model[g] ); | ||
567 | if ( 0 == model ) | ||
568 | continue; | ||
569 | |||
570 | mesh = model->getOriginalMesh(); | ||
571 | for ( u32 j = 0; j != mesh->Buffer.size (); ++j ) | ||
572 | { | ||
573 | meshBuffer = mesh->Buffer[j]; | ||
574 | if ( 0 == meshBuffer ) | ||
575 | continue; | ||
576 | |||
577 | shader = masterMesh->getShader ( meshBuffer->Shader.c_str(), false ); | ||
578 | IMeshBuffer *final = model->getMesh(0)->getMeshBuffer(j); | ||
579 | if ( shader ) | ||
580 | { | ||
581 | //!TODO: Hack don't modify the vertexbuffer. make it better;-) | ||
582 | final->getMaterial().ColorMask = 0; | ||
583 | node = smgr->addQuake3SceneNode ( final, shader, parent ); | ||
584 | final->getMaterial().ColorMask = 15; | ||
585 | } | ||
586 | else | ||
587 | { | ||
588 | // clone mesh | ||
589 | SMesh * m = new SMesh (); | ||
590 | m->addMeshBuffer ( final ); | ||
591 | node = smgr->addMeshSceneNode ( m, parent ); | ||
592 | m->drop(); | ||
593 | } | ||
594 | |||
595 | if ( 0 == node ) | ||
596 | { | ||
597 | snprintf ( buf, 128, "q3ModelFactory shader %s failed", meshBuffer->Shader.c_str() ); | ||
598 | device->getLogger()->log ( buf ); | ||
599 | continue; | ||
600 | } | ||
601 | |||
602 | // node was maybe centered by shaderscenenode | ||
603 | node->setPosition ( p ); | ||
604 | node->setName ( meshBuffer->Shader ); | ||
605 | node->setAutomaticCulling ( scene::EAC_BOX ); | ||
606 | |||
607 | // add special effects to node | ||
608 | if ( itemElement->special & SPECIAL_SFX_ROTATE || | ||
609 | (g == 0 && itemElement->special & SPECIAL_SFX_ROTATE_1) | ||
610 | ) | ||
611 | { | ||
612 | anim = smgr->createRotationAnimator ( vector3df ( 0.f, | ||
613 | 2.f, 0.f ) ); | ||
614 | node->addAnimator ( anim ); | ||
615 | anim->drop (); | ||
616 | } | ||
617 | |||
618 | if ( itemElement->special & SPECIAL_SFX_BOUNCE ) | ||
619 | { | ||
620 | //anim = smgr->createFlyStraightAnimator ( | ||
621 | // p, p + vector3df ( 0.f, 60.f, 0.f ), 1000, true, true ); | ||
622 | anim = smgr->createFlyCircleAnimator ( | ||
623 | p + vector3df( 0.f, 20.f, 0.f ), | ||
624 | 20.f, | ||
625 | 0.005f, | ||
626 | vector3df ( 1.f, 0.f, 0.f ), | ||
627 | core::fract ( nodeCount * 0.05f ), | ||
628 | 1.f | ||
629 | ); | ||
630 | node->addAnimator ( anim ); | ||
631 | anim->drop (); | ||
632 | } | ||
633 | } | ||
634 | } | ||
635 | // show name | ||
636 | if ( showShaderName ) | ||
637 | { | ||
638 | swprintf ( (wchar_t*) buf, sizeof(buf) / 2, L"%hs", itemElement->key ); | ||
639 | smgr->addBillboardTextSceneNode( | ||
640 | font, | ||
641 | (wchar_t*) buf, | ||
642 | parent, | ||
643 | dimension2d<f32>(80.0f, 8.0f), | ||
644 | p + vector3df(0, 30, 0), | ||
645 | 0); | ||
646 | } | ||
647 | } | ||
648 | |||
649 | // music | ||
650 | search.name = "worldspawn"; | ||
651 | index = entity.binary_search_multi ( search, lastIndex ); | ||
652 | |||
653 | if ( index >= 0 ) | ||
654 | { | ||
655 | group = entity[ index ].getGroup(1); | ||
656 | background_music ( group->get ( "music" ).c_str () ); | ||
657 | } | ||
658 | |||
659 | // music | ||
660 | search.name = "worldspawn"; | ||
661 | index = entity.binary_search_multi ( search, lastIndex ); | ||
662 | |||
663 | if ( index >= 0 ) | ||
664 | { | ||
665 | group = entity[ index ].getGroup(1); | ||
666 | background_music ( group->get ( "music" ).c_str () ); | ||
667 | } | ||
668 | |||
669 | //IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2"); | ||
670 | //IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh ); | ||
671 | |||
672 | } | ||
673 | |||
674 | /*! | ||
675 | so we need a good starting Position in the level. | ||
676 | we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch" | ||
677 | */ | ||
678 | s32 Q3StartPosition ( IQ3LevelMesh* mesh, | ||
679 | ICameraSceneNode* camera, | ||
680 | s32 startposIndex, | ||
681 | const vector3df &translation | ||
682 | ) | ||
683 | { | ||
684 | if ( 0 == mesh ) | ||
685 | return 0; | ||
686 | |||
687 | tQ3EntityList &entityList = mesh->getEntityList (); | ||
688 | |||
689 | IEntity search; | ||
690 | search.name = "info_player_start"; // "info_player_deathmatch"; | ||
691 | |||
692 | // find all entities in the multi-list | ||
693 | s32 lastIndex; | ||
694 | s32 index = entityList.binary_search_multi ( search, lastIndex ); | ||
695 | |||
696 | if ( index < 0 ) | ||
697 | { | ||
698 | search.name = "info_player_deathmatch"; | ||
699 | index = entityList.binary_search_multi ( search, lastIndex ); | ||
700 | } | ||
701 | |||
702 | if ( index < 0 ) | ||
703 | return 0; | ||
704 | |||
705 | index += core::clamp ( startposIndex, 0, lastIndex - index ); | ||
706 | |||
707 | u32 parsepos; | ||
708 | |||
709 | const SVarGroup *group; | ||
710 | group = entityList[ index ].getGroup(1); | ||
711 | |||
712 | parsepos = 0; | ||
713 | vector3df pos = getAsVector3df ( group->get ( "origin" ), parsepos ); | ||
714 | pos += translation; | ||
715 | |||
716 | parsepos = 0; | ||
717 | f32 angle = getAsFloat ( group->get ( "angle"), parsepos ); | ||
718 | |||
719 | vector3df target ( 0.f, 0.f, 1.f ); | ||
720 | target.rotateXZBy ( angle - 90.f, vector3df () ); | ||
721 | |||
722 | if ( camera ) | ||
723 | { | ||
724 | camera->setPosition ( pos ); | ||
725 | camera->setTarget ( pos + target ); | ||
726 | //! New. FPSCamera and animators catches reset on animate 0 | ||
727 | camera->OnAnimate ( 0 ); | ||
728 | } | ||
729 | return lastIndex - index + 1; | ||
730 | } | ||
731 | |||
732 | |||
733 | /*! | ||
734 | gets a accumulated force on a given surface | ||
735 | */ | ||
736 | vector3df getGravity ( const c8 * surface ) | ||
737 | { | ||
738 | if ( 0 == strcmp ( surface, "earth" ) ) return vector3df ( 0.f, -90.f, 0.f ); | ||
739 | if ( 0 == strcmp ( surface, "moon" ) ) return vector3df ( 0.f, -6.f / 100.f, 0.f ); | ||
740 | if ( 0 == strcmp ( surface, "water" ) ) return vector3df ( 0.1f / 100.f, -2.f / 100.f, 0.f ); | ||
741 | if ( 0 == strcmp ( surface, "ice" ) ) return vector3df ( 0.2f / 100.f, -9.f / 100.f, 0.3f / 100.f ); | ||
742 | |||
743 | return vector3df ( 0.f, 0.f, 0.f ); | ||
744 | } | ||
745 | |||
746 | |||
747 | |||
748 | /* | ||
749 | Dynamically load the Irrlicht Library | ||
750 | */ | ||
751 | |||
752 | #if defined(_IRR_WINDOWS_API_) | ||
753 | #ifdef _MSC_VER | ||
754 | #pragma comment(lib, "Irrlicht.lib") | ||
755 | #endif | ||
756 | |||
757 | #include <windows.h> | ||
758 | |||
759 | funcptr_createDevice load_createDevice ( const c8 * filename) | ||
760 | { | ||
761 | return (funcptr_createDevice) GetProcAddress ( LoadLibrary ( filename ), "createDevice" ); | ||
762 | } | ||
763 | |||
764 | funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename) | ||
765 | { | ||
766 | return (funcptr_createDeviceEx) GetProcAddress ( LoadLibrary ( filename ), "createDeviceEx" ); | ||
767 | } | ||
768 | |||
769 | #else | ||
770 | |||
771 | // TODO: Dynamic Loading for other os | ||
772 | funcptr_createDevice load_createDevice ( const c8 * filename) | ||
773 | { | ||
774 | return createDevice; | ||
775 | } | ||
776 | |||
777 | funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename) | ||
778 | { | ||
779 | return createDeviceEx; | ||
780 | } | ||
781 | |||
782 | #endif | ||
783 | |||
784 | /* | ||
785 | get the current collision response camera animator | ||
786 | */ | ||
787 | ISceneNodeAnimatorCollisionResponse* camCollisionResponse( IrrlichtDevice * device ) | ||
788 | { | ||
789 | ICameraSceneNode *camera = device->getSceneManager()->getActiveCamera(); | ||
790 | ISceneNodeAnimatorCollisionResponse *a = 0; | ||
791 | |||
792 | list<ISceneNodeAnimator*>::ConstIterator it = camera->getAnimators().begin(); | ||
793 | for (; it != camera->getAnimators().end(); ++it) | ||
794 | { | ||
795 | a = (ISceneNodeAnimatorCollisionResponse*) (*it); | ||
796 | if ( a->getType() == ESNAT_COLLISION_RESPONSE ) | ||
797 | return a; | ||
798 | } | ||
799 | |||
800 | return 0; | ||
801 | } | ||
802 | |||
803 | |||
804 | //! internal Animation | ||
805 | void setTimeFire ( TimeFire *t, u32 delta, u32 flags ) | ||
806 | { | ||
807 | t->flags = flags; | ||
808 | t->next = 0; | ||
809 | t->delta = delta; | ||
810 | } | ||
811 | |||
812 | |||
813 | void checkTimeFire ( TimeFire *t, u32 listSize, u32 now ) | ||
814 | { | ||
815 | u32 i; | ||
816 | for ( i = 0; i < listSize; ++i ) | ||
817 | { | ||
818 | if ( now < t[i].next ) | ||
819 | continue; | ||
820 | |||
821 | t[i].next = core::max_ ( now + t[i].delta, t[i].next + t[i].delta ); | ||
822 | t[i].flags |= FIRED; | ||
823 | } | ||
824 | } | ||
diff --git a/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/q3factory.h b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/q3factory.h new file mode 100644 index 0000000..d9606ed --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/q3factory.h | |||
@@ -0,0 +1,149 @@ | |||
1 | /*! | ||
2 | Model Factory. | ||
3 | create the additional scenenodes for ( bullets, health... ) | ||
4 | |||
5 | Defines the Entities for Quake3 | ||
6 | */ | ||
7 | #ifndef __QUAKE3_FACTORY__H_INCLUDED__ | ||
8 | #define __QUAKE3_FACTORY__H_INCLUDED__ | ||
9 | |||
10 | using namespace irr; | ||
11 | using namespace scene; | ||
12 | using namespace gui; | ||
13 | using namespace video; | ||
14 | using namespace core; | ||
15 | using namespace quake3; | ||
16 | using namespace io; | ||
17 | |||
18 | |||
19 | |||
20 | //! Defines to which group the entities belong | ||
21 | enum eItemGroup | ||
22 | { | ||
23 | WEAPON, | ||
24 | AMMO, | ||
25 | ARMOR, | ||
26 | HEALTH, | ||
27 | POWERUP | ||
28 | }; | ||
29 | |||
30 | //! define a supgroup for the item. for e.q the Weapons | ||
31 | enum eItemSubGroup | ||
32 | { | ||
33 | SUB_NONE = 0, | ||
34 | GAUNTLET, | ||
35 | MACHINEGUN, | ||
36 | SHOTGUN, | ||
37 | GRENADE_LAUNCHER, | ||
38 | ROCKET_LAUNCHER, | ||
39 | LIGHTNING, | ||
40 | RAILGUN, | ||
41 | PLASMAGUN, | ||
42 | BFG, | ||
43 | GRAPPLING_HOOK, | ||
44 | NAILGUN, | ||
45 | PROX_LAUNCHER, | ||
46 | CHAINGUN, | ||
47 | }; | ||
48 | |||
49 | //! aplly a special effect to the shader | ||
50 | enum eItemSpecialEffect | ||
51 | { | ||
52 | SPECIAL_SFX_NONE = 0, | ||
53 | SPECIAL_SFX_ROTATE = 1, | ||
54 | SPECIAL_SFX_BOUNCE = 2, | ||
55 | SPECIAL_SFX_ROTATE_1 = 4, | ||
56 | }; | ||
57 | |||
58 | // a List for defining a model | ||
59 | struct SItemElement | ||
60 | { | ||
61 | const c8 *key; | ||
62 | const c8 *model[2]; | ||
63 | const c8 *sound; | ||
64 | const c8 *icon; | ||
65 | const c8 *pickup; | ||
66 | s32 value; | ||
67 | eItemGroup group; | ||
68 | eItemSubGroup sub; | ||
69 | u32 special; | ||
70 | }; | ||
71 | |||
72 | |||
73 | //! Get's an entity based on it's key | ||
74 | const SItemElement * getItemElement ( const stringc& key ); | ||
75 | |||
76 | /*! | ||
77 | Quake3 Model Factory. | ||
78 | Takes the mesh buffers and creates scenenodes for their associated shaders | ||
79 | */ | ||
80 | void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam, | ||
81 | IrrlichtDevice *device, | ||
82 | IQ3LevelMesh* mesh, | ||
83 | eQ3MeshIndex meshIndex, | ||
84 | ISceneNode *parent, | ||
85 | IMetaTriangleSelector *meta, | ||
86 | bool showShaderName | ||
87 | ); | ||
88 | |||
89 | |||
90 | /*! | ||
91 | Creates Model based on the entity list | ||
92 | */ | ||
93 | void Q3ModelFactory ( Q3LevelLoadParameter &loadParam, | ||
94 | IrrlichtDevice *device, | ||
95 | IQ3LevelMesh* masterMesh, | ||
96 | ISceneNode *parent, | ||
97 | bool showShaderName | ||
98 | ); | ||
99 | |||
100 | /*! | ||
101 | so we need a good starting Position in the level. | ||
102 | we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch" | ||
103 | */ | ||
104 | s32 Q3StartPosition ( IQ3LevelMesh* mesh, | ||
105 | ICameraSceneNode* camera, | ||
106 | s32 startposIndex, | ||
107 | const vector3df &translation | ||
108 | ); | ||
109 | /*! | ||
110 | gets a accumulated force on a given surface | ||
111 | */ | ||
112 | vector3df getGravity ( const c8 * surface ); | ||
113 | |||
114 | |||
115 | /* | ||
116 | Dynamically load the Irrlicht Library | ||
117 | */ | ||
118 | funcptr_createDevice load_createDevice ( const c8 * filename); | ||
119 | funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename); | ||
120 | |||
121 | |||
122 | //! Macro for save Dropping an Element | ||
123 | #define dropElement(x) if (x) { x->remove(); x = 0; } | ||
124 | |||
125 | |||
126 | /* | ||
127 | get the current collision respone camera animator | ||
128 | */ | ||
129 | ISceneNodeAnimatorCollisionResponse* camCollisionResponse( IrrlichtDevice * device ); | ||
130 | |||
131 | //! internal Animation | ||
132 | enum eTimeFireFlag | ||
133 | { | ||
134 | FIRED = 1, | ||
135 | }; | ||
136 | |||
137 | struct TimeFire | ||
138 | { | ||
139 | u32 flags; | ||
140 | u32 next; | ||
141 | u32 delta; | ||
142 | }; | ||
143 | |||
144 | void setTimeFire ( TimeFire *t, u32 delta, u32 flags = 0 ); | ||
145 | void checkTimeFire ( TimeFire *t, u32 listSize, u32 now ); | ||
146 | |||
147 | #endif // __QUAKE3_FACTORY__H_INCLUDED__ | ||
148 | |||
149 | |||
diff --git a/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/sound.cpp b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/sound.cpp new file mode 100644 index 0000000..75615c1 --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/sound.cpp | |||
@@ -0,0 +1,98 @@ | |||
1 | /*! | ||
2 | Sound Factory. | ||
3 | provides a sound interface | ||
4 | |||
5 | */ | ||
6 | |||
7 | #include "sound.h" | ||
8 | |||
9 | |||
10 | //#define USE_IRRKLANG | ||
11 | |||
12 | #ifdef USE_IRRKLANG | ||
13 | |||
14 | #include <irrKlang.h> | ||
15 | #ifdef _IRR_WINDOWS_ | ||
16 | #pragma comment (lib, "irrKlang.lib") | ||
17 | #endif | ||
18 | |||
19 | using namespace irrklang; | ||
20 | |||
21 | struct soundfile: public IFileReader | ||
22 | { | ||
23 | soundfile ( io::IReadFile* f ): file (f ) {} | ||
24 | virtual ~soundfile () { file->drop (); } | ||
25 | |||
26 | virtual ik_s32 read(void* buffer, ik_u32 sizeToRead) { return file->read ( buffer, sizeToRead ); } | ||
27 | virtual bool seek(ik_s32 finalPos, bool relativeMovement = false) { return file->seek ( finalPos, relativeMovement ); } | ||
28 | virtual ik_s32 getSize(){ return file->getSize (); } | ||
29 | virtual ik_s32 getPos() {return file->getPos (); } | ||
30 | virtual const ik_c8* getFileName() { return file->getFileName (); } | ||
31 | io::IReadFile* file; | ||
32 | }; | ||
33 | |||
34 | struct klangFactory : public irrklang::IFileFactory | ||
35 | { | ||
36 | klangFactory ( IrrlichtDevice *device ) { Device = device; } | ||
37 | |||
38 | virtual irrklang::IFileReader* createFileReader(const ik_c8* filename) | ||
39 | { | ||
40 | io::IReadFile* file = Device->getFileSystem()->createAndOpenFile(filename); | ||
41 | if ( 0 == file ) | ||
42 | return 0; | ||
43 | |||
44 | return new soundfile ( file ); | ||
45 | } | ||
46 | |||
47 | IrrlichtDevice *Device; | ||
48 | }; | ||
49 | |||
50 | ISoundEngine *engine = 0; | ||
51 | ISound *backMusic = 0; | ||
52 | |||
53 | void sound_init ( IrrlichtDevice *device ) | ||
54 | { | ||
55 | engine = createIrrKlangDevice (); | ||
56 | if ( 0 == engine ) | ||
57 | return; | ||
58 | |||
59 | klangFactory *f = new klangFactory ( device ); | ||
60 | engine->addFileFactory ( f ); | ||
61 | } | ||
62 | |||
63 | void sound_shutdown () | ||
64 | { | ||
65 | if ( backMusic ) | ||
66 | backMusic->drop (); | ||
67 | |||
68 | if ( engine ) | ||
69 | engine->drop (); | ||
70 | } | ||
71 | |||
72 | void background_music ( const c8 * file ) | ||
73 | { | ||
74 | if ( 0 == engine ) | ||
75 | return; | ||
76 | |||
77 | if ( backMusic ) | ||
78 | { | ||
79 | backMusic->stop (); | ||
80 | backMusic->drop (); | ||
81 | } | ||
82 | |||
83 | backMusic = engine->play2D ( file, true, false, true ); | ||
84 | |||
85 | if ( backMusic ) | ||
86 | { | ||
87 | backMusic->setVolume ( 0.5f ); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | #else | ||
92 | |||
93 | void sound_init ( IrrlichtDevice *device ) {} | ||
94 | void sound_shutdown () {} | ||
95 | void background_music ( const c8 * file ) {} | ||
96 | |||
97 | #endif | ||
98 | |||
diff --git a/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/sound.h b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/sound.h new file mode 100644 index 0000000..033e9bb --- /dev/null +++ b/src/others/irrlicht-1.8.1/examples/21.Quake3Explorer/sound.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /*! | ||
2 | Sound Factory. | ||
3 | provides a sound interface | ||
4 | |||
5 | */ | ||
6 | #ifndef __QUAKE3_SOUND__H_INCLUDED__ | ||
7 | #define __QUAKE3_SOUND__H_INCLUDED__ | ||
8 | |||
9 | #include <irrlicht.h> | ||
10 | |||
11 | using namespace irr; | ||
12 | |||
13 | void sound_init ( IrrlichtDevice *device ); | ||
14 | void sound_shutdown (); | ||
15 | void background_music ( const c8 * file ); | ||
16 | |||
17 | |||
18 | #endif // __QUAKE3_SOUND__H_INCLUDED__ | ||