aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/doc/html/example021.html
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/doc/html/example021.html')
-rw-r--r--src/others/irrlicht-1.8.1/doc/html/example021.html2190
1 files changed, 2190 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/doc/html/example021.html b/src/others/irrlicht-1.8.1/doc/html/example021.html
new file mode 100644
index 0000000..8a0f3c4
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/doc/html/example021.html
@@ -0,0 +1,2190 @@
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5<title>Irrlicht 3D Engine: Tutorial 21: Quake3 Explorer</title>
6
7<link href="tabs.css" rel="stylesheet" type="text/css"/>
8<link href="doxygen.css" rel="stylesheet" type="text/css" />
9<link href="navtree.css" rel="stylesheet" type="text/css"/>
10<script type="text/javascript" src="jquery.js"></script>
11<script type="text/javascript" src="resize.js"></script>
12<script type="text/javascript" src="navtree.js"></script>
13<script type="text/javascript">
14 $(document).ready(initResizable);
15</script>
16<link href="search/search.css" rel="stylesheet" type="text/css"/>
17<script type="text/javascript" src="search/search.js"></script>
18<script type="text/javascript">
19 $(document).ready(function() { searchBox.OnSelectItem(0); });
20</script>
21
22</head>
23<body>
24<div id="top"><!-- do not remove this div! -->
25
26
27<div id="titlearea">
28<table cellspacing="0" cellpadding="0">
29 <tbody>
30 <tr style="height: 56px;">
31
32 <td id="projectlogo"><img alt="Logo" src="irrlichtlogo.png"/></td>
33
34
35 <td style="padding-left: 0.5em;">
36 <div id="projectname">Irrlicht 3D Engine
37
38 </div>
39
40 </td>
41
42
43
44
45 <td> <div id="MSearchBox" class="MSearchBoxInactive">
46 <span class="left">
47 <img id="MSearchSelect" src="search/mag_sel.png"
48 onmouseover="return searchBox.OnSearchSelectShow()"
49 onmouseout="return searchBox.OnSearchSelectHide()"
50 alt=""/>
51 <input type="text" id="MSearchField" value="Search" accesskey="S"
52 onfocus="searchBox.OnSearchFieldFocus(true)"
53 onblur="searchBox.OnSearchFieldFocus(false)"
54 onkeyup="searchBox.OnSearchFieldChange(event)"/>
55 </span><span class="right">
56 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
57 </span>
58 </div>
59</td>
60
61
62 </tr>
63 </tbody>
64</table>
65</div>
66
67<!-- Generated by Doxygen 1.7.5.1 -->
68<script type="text/javascript">
69var searchBox = new SearchBox("searchBox", "search",false,'Search');
70</script>
71<script type="text/javascript" src="dynsections.js"></script>
72</div>
73<div id="side-nav" class="ui-resizable side-nav-resizable">
74 <div id="nav-tree">
75 <div id="nav-tree-contents">
76 </div>
77 </div>
78 <div id="splitbar" style="-moz-user-select:none;"
79 class="ui-resizable-handle">
80 </div>
81</div>
82<script type="text/javascript">
83 initNavTree('example021.html','');
84</script>
85<div id="doc-content">
86<div class="header">
87 <div class="headertitle">
88<div class="title">Tutorial 21: Quake3 Explorer </div> </div>
89</div>
90<div class="contents">
91<div class="textblock"><div class="image">
92<img src="021shot.jpg" alt="021shot.jpg"/>
93</div>
94 <p>This Tutorial shows how to load different Quake 3 maps.</p>
95<p>Features:</p>
96<ul>
97<li>Load BSP Archives at Runtime from the menu</li>
98<li>Load a Map from the menu. Showing with Screenshot</li>
99<li>Set the VideoDriver at runtime from menu</li>
100<li>Adjust GammaLevel at runtime</li>
101<li>Create SceneNodes for the Shaders</li>
102<li>Load EntityList and create Entity SceneNodes</li>
103<li>Create Players with Weapons and with Collision Response</li>
104<li>Play music</li>
105</ul>
106<p>You can download the Quake III Arena demo ( copyright id software ) at the following location: <a href="ftp://ftp.idsoftware.com/idstuff/quake3/win32/q3ademo.exe">ftp://ftp.idsoftware.com/idstuff/quake3/win32/q3ademo.exe</a></p>
107<p>Copyright 2006-2011 Burningwater, Thomas Alten </p>
108<div class="fragment"><pre class="fragment"><span class="preprocessor">#include &quot;<a class="code" href="driver_choice_8h.html">driverChoice.h</a>&quot;</span>
109<span class="preprocessor">#include &lt;<a class="code" href="irrlicht_8h.html" title="Main header file of the irrlicht, the only file needed to include.">irrlicht.h</a>&gt;</span>
110<span class="preprocessor">#include &quot;q3factory.h&quot;</span>
111<span class="preprocessor">#include &quot;sound.h&quot;</span>
112</pre></div><p>Game Data is used to hold Data which is needed to drive the game </p>
113<div class="fragment"><pre class="fragment"><span class="keyword">struct </span>GameData
114{
115 GameData ( <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a> &amp;startupDir) :
116 retVal(0), StartupDir(startupDir), createExDevice(0), Device(0)
117 {
118 setDefault ();
119 }
120
121 <span class="keywordtype">void</span> setDefault ();
122 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> save ( <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a> &amp;filename );
123 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> load ( <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a> &amp;filename );
124
125 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> debugState;
126 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> gravityState;
127 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> flyTroughState;
128 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> wireFrame;
129 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> guiActive;
130 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> guiInputActive;
131 <a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a> GammaValue;
132 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> retVal;
133 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> sound;
134
135 <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a> StartupDir;
136 <a class="code" href="namespaceirr_1_1core.html#aef83fafbb1b36fcce44c07c9be23a7f2" title="Typedef for wide character strings.">stringw</a> CurrentMapName;
137 array&lt;path&gt; CurrentArchiveList;
138
139 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> PlayerPosition;
140 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> PlayerRotation;
141
142 <a class="code" href="namespaceirr_1_1scene_1_1quake3.html#a312f35a37540d810fcb14b75fd449c9e">tQ3EntityList</a> Variable;
143
144 Q3LevelLoadParameter loadParam;
145 SIrrlichtCreationParameters deviceParam;
146 <a class="code" href="namespaceirr.html#a5137701377b2241305607fc37a27e9f8" title="typedef for Function Pointer">funcptr_createDeviceEx</a> createExDevice;
147 IrrlichtDevice *Device;
148};
149</pre></div><p>set default settings </p>
150<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> GameData::setDefault ()
151{
152 debugState = <a class="code" href="namespaceirr_1_1scene.html#a52b664c4c988113735042b168fc32dbea25111b15f03bee9a99498737286916dc" title="No Debug Data ( Default )">EDS_OFF</a>;
153 gravityState = 1;
154 flyTroughState = 0;
155 wireFrame = 0;
156 guiActive = 1;
157 guiInputActive = 0;
158 GammaValue = 1.f;
159
160 <span class="comment">// default deviceParam;</span>
161<span class="preprocessor">#if defined ( _IRR_WINDOWS_ )</span>
162<span class="preprocessor"></span> deviceParam.DriverType = <a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0a4691ca314f9018f508dcf2c57dcaacec" title="Direct3D 9 device, only available on Win32 platforms.">EDT_DIRECT3D9</a>;
163<span class="preprocessor">#else</span>
164<span class="preprocessor"></span> deviceParam.DriverType = <a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0a2715182a79f1cb8e2826fd68a8150a53" title="OpenGL device, available on most platforms.">EDT_OPENGL</a>;
165<span class="preprocessor">#endif</span>
166<span class="preprocessor"></span> deviceParam.WindowSize.Width = 800;
167 deviceParam.WindowSize.Height = 600;
168 deviceParam.Fullscreen = <span class="keyword">false</span>;
169 deviceParam.Bits = 24;
170 deviceParam.ZBufferBits = 16;
171 deviceParam.Vsync = <span class="keyword">false</span>;
172 deviceParam.AntiAlias = <span class="keyword">false</span>;
173
174 <span class="comment">// default Quake3 loadParam</span>
175 loadParam.defaultLightMapMaterial = <a class="code" href="namespaceirr_1_1video.html#ac8e9b6c66f7cebabd1a6d30cbc5430f1a5dc90a3b4a8d82f10503ddf834a3143f" title="Material type with standard lightmap technique.">EMT_LIGHTMAP</a>;
176 loadParam.defaultModulate = <a class="code" href="namespaceirr_1_1video.html#a1402e9045137ae232fafbdf385800843a58cc346f344fb488d403a3783675e5d7">EMFN_MODULATE_1X</a>;
177 loadParam.defaultFilter = <a class="code" href="namespaceirr_1_1video.html#a8a3bc00ae8137535b9fbc5f40add70d3a941c0756b9dc3f987a183a401c6fd4ad" title="Is anisotropic filtering? Default: false.">EMF_ANISOTROPIC_FILTER</a>;
178 loadParam.verbose = 2;
179 loadParam.mergeShaderBuffer = 1; <span class="comment">// merge meshbuffers with same material</span>
180 loadParam.cleanUnResolvedMeshes = 1; <span class="comment">// should unresolved meshes be cleaned. otherwise blue texture</span>
181 loadParam.loadAllShaders = 1; <span class="comment">// load all scripts in the script directory</span>
182 loadParam.loadSkyShader = 0; <span class="comment">// load sky Shader</span>
183 loadParam.alpharef = 1;
184
185 sound = 0;
186
187 CurrentMapName = <span class="stringliteral">&quot;&quot;</span>;
188 CurrentArchiveList.clear ();
189
190 <span class="comment">// Explorer Media directory</span>
191 CurrentArchiveList.push_back ( StartupDir + <span class="stringliteral">&quot;../../media/&quot;</span> );
192
193 <span class="comment">// Add the original quake3 files before you load your custom map</span>
194 <span class="comment">// Most mods are using the original shaders, models&amp;items&amp;weapons</span>
195 CurrentArchiveList.push_back(<span class="stringliteral">&quot;/q/baseq3/&quot;</span>);
196
197 CurrentArchiveList.push_back(StartupDir + <span class="stringliteral">&quot;../../media/map-20kdm2.pk3&quot;</span>);
198}
199</pre></div><p>Load the current game State from a typical quake3 cfg file </p>
200<div class="fragment"><pre class="fragment"><a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> GameData::load ( <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a> &amp;filename )
201{
202 <span class="keywordflow">if</span> (!Device)
203 <span class="keywordflow">return</span> 0;
204
205 <span class="comment">// the quake3 mesh loader can also handle *.shader and *.cfg file</span>
206 IQ3LevelMesh* mesh = (IQ3LevelMesh*) Device-&gt;getSceneManager()-&gt;getMesh ( filename );
207 <span class="keywordflow">if</span> (!mesh)
208 <span class="keywordflow">return</span> 0;
209
210 <a class="code" href="namespaceirr_1_1scene_1_1quake3.html#a312f35a37540d810fcb14b75fd449c9e">tQ3EntityList</a> &amp;entityList = mesh-&gt;getEntityList ();
211
212 <a class="code" href="namespaceirr_1_1core.html#ade1071a878633f2f6d8a75c5d11fec19" title="Typedef for character strings.">stringc</a> s;
213 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> pos;
214
215 <span class="keywordflow">for</span> ( <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> e = 0; e != entityList.size (); ++e )
216 {
217 <span class="comment">//dumpShader ( s, &amp;entityList[e], false );</span>
218 <span class="comment">//printf ( s.c_str () );</span>
219
220 <span class="keywordflow">for</span> ( <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> g = 0; g != entityList[e].getGroupSize (); ++g )
221 {
222 <span class="keyword">const</span> SVarGroup *group = entityList[e].getGroup ( g );
223
224 <span class="keywordflow">for</span> ( <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> index = 0; index &lt; group-&gt;Variable.size (); ++index )
225 {
226 <span class="keyword">const</span> SVariable &amp;v = group-&gt;Variable[index];
227 pos = 0;
228 <span class="keywordflow">if</span> ( v.name == <span class="stringliteral">&quot;playerposition&quot;</span> )
229 {
230 PlayerPosition = <a class="code" href="namespaceirr_1_1scene_1_1quake3.html#a6163d5a7fba9950a2f390a42fe354c3f" title="get a quake3 vector translated to irrlicht position (x,-z,y )">getAsVector3df</a> ( v.content, pos );
231 }
232 <span class="keywordflow">else</span>
233 <span class="keywordflow">if</span> ( v.name == <span class="stringliteral">&quot;playerrotation&quot;</span> )
234 {
235 PlayerRotation = <a class="code" href="namespaceirr_1_1scene_1_1quake3.html#a6163d5a7fba9950a2f390a42fe354c3f" title="get a quake3 vector translated to irrlicht position (x,-z,y )">getAsVector3df</a> ( v.content, pos );
236 }
237 }
238 }
239 }
240
241 <span class="keywordflow">return</span> 1;
242}
243</pre></div><p>Store the current game State in a quake3 configuration file </p>
244<div class="fragment"><pre class="fragment"><a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> GameData::save ( <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a> &amp;filename )
245{
246 <span class="keywordflow">return</span> 0;
247 <span class="keywordflow">if</span> (!Device)
248 <span class="keywordflow">return</span> 0;
249
250 <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> buf[128];
251 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> i;
252
253 <span class="comment">// Store current Archive for restart</span>
254 CurrentArchiveList.clear();
255 IFileSystem *fs = Device-&gt;getFileSystem();
256 <span class="keywordflow">for</span> ( i = 0; i != fs-&gt;getFileArchiveCount(); ++i )
257 {
258 CurrentArchiveList.push_back ( fs-&gt;getFileArchive(i)-&gt;getFileList()-&gt;getPath() );
259 }
260
261 <span class="comment">// Store Player Position and Rotation</span>
262 ICameraSceneNode * camera = Device-&gt;getSceneManager()-&gt;getActiveCamera ();
263 <span class="keywordflow">if</span> ( camera )
264 {
265 PlayerPosition = camera-&gt;getPosition ();
266 PlayerRotation = camera-&gt;getRotation ();
267 }
268
269 IWriteFile *file = fs-&gt;createAndWriteFile ( filename );
270 <span class="keywordflow">if</span> (!file)
271 <span class="keywordflow">return</span> 0;
272
273 snprintf ( buf, 128, <span class="stringliteral">&quot;playerposition %.f %.f %.f\nplayerrotation %.f %.f %.f\n&quot;</span>,
274 PlayerPosition.X, PlayerPosition.Z, PlayerPosition.Y,
275 PlayerRotation.X, PlayerRotation.Z, PlayerRotation.Y);
276 file-&gt;write ( buf, (<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a>) strlen ( buf ) );
277 <span class="keywordflow">for</span> ( i = 0; i != fs-&gt;getFileArchiveCount(); ++i )
278 {
279 snprintf ( buf, 128, <span class="stringliteral">&quot;archive %s\n&quot;</span>,<a class="code" href="namespaceirr_1_1core.html#ade1071a878633f2f6d8a75c5d11fec19" title="Typedef for character strings.">stringc</a> ( fs-&gt;getFileArchive(i)-&gt;getFileList()-&gt;getPath() ).c_str () );
280 file-&gt;write ( buf, (<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a>) strlen ( buf ) );
281 }
282
283 file-&gt;drop ();
284 <span class="keywordflow">return</span> 1;
285}
286</pre></div><p>Representing a player </p>
287<div class="fragment"><pre class="fragment"><span class="keyword">struct </span>Q3Player : <span class="keyword">public</span> IAnimationEndCallBack
288{
289 Q3Player ()
290 : Device(0), MapParent(0), Mesh(0), WeaponNode(0), StartPositionCurrent(0)
291 {
292 animation[0] = 0;
293 memset(Anim, 0, <span class="keyword">sizeof</span>(TimeFire)*4);
294 }
295
296 <span class="keyword">virtual</span> <span class="keywordtype">void</span> OnAnimationEnd(IAnimatedMeshSceneNode* node);
297
298 <span class="keywordtype">void</span> create ( IrrlichtDevice *device,
299 IQ3LevelMesh* mesh,
300 ISceneNode *mapNode,
301 IMetaTriangleSelector *meta
302 );
303 <span class="keywordtype">void</span> shutdown ();
304 <span class="keywordtype">void</span> setAnim ( <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> *name );
305 <span class="keywordtype">void</span> respawn ();
306 <span class="keywordtype">void</span> setpos ( <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> &amp;pos, <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a>&amp; rotation );
307
308 ISceneNodeAnimatorCollisionResponse * cam() { <span class="keywordflow">return</span> camCollisionResponse ( Device ); }
309
310 IrrlichtDevice *Device;
311 ISceneNode* MapParent;
312 IQ3LevelMesh* Mesh;
313 IAnimatedMeshSceneNode* WeaponNode;
314 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> StartPositionCurrent;
315 TimeFire Anim[4];
316 <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> animation[64];
317 <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> buf[64];
318};
319</pre></div><p> End player </p>
320<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> Q3Player::shutdown ()
321{
322 setAnim ( 0 );
323
324 dropElement (WeaponNode);
325
326 <span class="keywordflow">if</span> ( Device )
327 {
328 ICameraSceneNode* camera = Device-&gt;getSceneManager()-&gt;getActiveCamera();
329 dropElement ( camera );
330 Device = 0;
331 }
332
333 MapParent = 0;
334 Mesh = 0;
335}
336</pre></div><p> create a new player </p>
337<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> Q3Player::create ( IrrlichtDevice *device, IQ3LevelMesh* mesh, ISceneNode *mapNode, IMetaTriangleSelector *meta )
338{
339 setTimeFire ( Anim + 0, 200, FIRED );
340 setTimeFire ( Anim + 1, 5000 );
341
342 <span class="keywordflow">if</span> (!device)
343 <span class="keywordflow">return</span>;
344 <span class="comment">// load FPS weapon to Camera</span>
345 Device = device;
346 Mesh = mesh;
347 MapParent = mapNode;
348
349 ISceneManager *smgr = device-&gt;getSceneManager ();
350 IVideoDriver * driver = device-&gt;getVideoDriver();
351
352 ICameraSceneNode* camera = 0;
353
354 SKeyMap keyMap[10];
355 keyMap[0].Action = <a class="code" href="namespaceirr.html#aa9946ac9f3142f9e790ce52d59fd6168af9ff845aa49060787ef81773eeaf1016">EKA_MOVE_FORWARD</a>;
356 keyMap[0].KeyCode = <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3ae3341f66dcdd3d0cbce80ff741262395">KEY_UP</a>;
357 keyMap[1].Action = <a class="code" href="namespaceirr.html#aa9946ac9f3142f9e790ce52d59fd6168af9ff845aa49060787ef81773eeaf1016">EKA_MOVE_FORWARD</a>;
358 keyMap[1].KeyCode = <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3ae559e3169016a3180c45c2828f391af2">KEY_KEY_W</a>;
359
360 keyMap[2].Action = <a class="code" href="namespaceirr.html#aa9946ac9f3142f9e790ce52d59fd6168af4c724e0a0923e497c7f8a48884e36d9">EKA_MOVE_BACKWARD</a>;
361 keyMap[2].KeyCode = <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3acbab6476bacfd1212c52aba7c1c82886">KEY_DOWN</a>;
362 keyMap[3].Action = <a class="code" href="namespaceirr.html#aa9946ac9f3142f9e790ce52d59fd6168af4c724e0a0923e497c7f8a48884e36d9">EKA_MOVE_BACKWARD</a>;
363 keyMap[3].KeyCode = <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3ae52bafc112fc6c52f6b49cea42fa246e">KEY_KEY_S</a>;
364
365 keyMap[4].Action = <a class="code" href="namespaceirr.html#aa9946ac9f3142f9e790ce52d59fd6168a91cad59a86b88c0e6ab5aa75b936d9c7">EKA_STRAFE_LEFT</a>;
366 keyMap[4].KeyCode = <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a71c43cf2c123fd75911fef5501a15241">KEY_LEFT</a>;
367 keyMap[5].Action = <a class="code" href="namespaceirr.html#aa9946ac9f3142f9e790ce52d59fd6168a91cad59a86b88c0e6ab5aa75b936d9c7">EKA_STRAFE_LEFT</a>;
368 keyMap[5].KeyCode = <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a2fe10b4309013968b9cd14811c3d3c85">KEY_KEY_A</a>;
369
370 keyMap[6].Action = <a class="code" href="namespaceirr.html#aa9946ac9f3142f9e790ce52d59fd6168a57c4bd21c235bca312e547c6d1061df2">EKA_STRAFE_RIGHT</a>;
371 keyMap[6].KeyCode = <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3ae89f39517a44c78a6602d1b12b478118">KEY_RIGHT</a>;
372 keyMap[7].Action = <a class="code" href="namespaceirr.html#aa9946ac9f3142f9e790ce52d59fd6168a57c4bd21c235bca312e547c6d1061df2">EKA_STRAFE_RIGHT</a>;
373 keyMap[7].KeyCode = <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3ad20e7e220103e611752b90edeb6cbc9d">KEY_KEY_D</a>;
374
375 keyMap[8].Action = <a class="code" href="namespaceirr.html#aa9946ac9f3142f9e790ce52d59fd6168a574c0935be6337a2e6bc97e8304a7400">EKA_JUMP_UP</a>;
376 keyMap[8].KeyCode = <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a3231acd1573be6e4d121cc6c4ab6ccc4">KEY_KEY_J</a>;
377
378 keyMap[9].Action = <a class="code" href="namespaceirr.html#aa9946ac9f3142f9e790ce52d59fd6168aace30d0d2eef7a48f5f863a99dabfb84">EKA_CROUCH</a>;
379 keyMap[9].KeyCode = <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a85a756fa6a3336312c5f32877a7185e5">KEY_KEY_C</a>;
380
381 camera = smgr-&gt;addCameraSceneNodeFPS(0, 100.0f, 0.6f, -1, keyMap, 10, <span class="keyword">false</span>, 0.6f);
382 camera-&gt;setName ( <span class="stringliteral">&quot;First Person Camera&quot;</span> );
383 <span class="comment">//camera-&gt;setFOV ( 100.f * core::DEGTORAD );</span>
384 camera-&gt;setFarValue( 20000.f );
385
386 IAnimatedMeshMD2* weaponMesh = (IAnimatedMeshMD2*) smgr-&gt;getMesh(<span class="stringliteral">&quot;gun.md2&quot;</span>);
387 <span class="keywordflow">if</span> ( 0 == weaponMesh )
388 <span class="keywordflow">return</span>;
389
390 <span class="keywordflow">if</span> ( weaponMesh-&gt;getMeshType() == <a class="code" href="namespaceirr_1_1scene.html#a2fc85a64604521ca063f1881b5dd1c61a3b87f459cd5f287626c4fd9aaf729284" title="Quake 2 MD2 model file.">EAMT_MD2</a> )
391 {
392 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> count = weaponMesh-&gt;getAnimationCount();
393 <span class="keywordflow">for</span> ( <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> i = 0; i != count; ++i )
394 {
395 snprintf ( buf, 64, <span class="stringliteral">&quot;Animation: %s&quot;</span>, weaponMesh-&gt;getAnimationName(i) );
396 device-&gt;getLogger()-&gt;log(buf, <a class="code" href="namespaceirr.html#aa2d1cac68606a25ed24cfffccfa30a92a9d74de15737e326a91aec6f38c23f9cf" title="Useful information to print. For example hardware infos or something started/stopped.">ELL_INFORMATION</a>);
397 }
398 }
399
400 WeaponNode = smgr-&gt;addAnimatedMeshSceneNode(
401 weaponMesh,
402 smgr-&gt;getActiveCamera(),
403 10,
404 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a>( 0, 0, 0),
405 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a>(-90,-90,90)
406 );
407 WeaponNode-&gt;setMaterialFlag(<a class="code" href="namespaceirr_1_1video.html#a8a3bc00ae8137535b9fbc5f40add70d3acea597a2692b8415486a464a7f954d34" title="Will this material be lighted? Default: true.">EMF_LIGHTING</a>, <span class="keyword">false</span>);
408 WeaponNode-&gt;setMaterialTexture(0, driver-&gt;getTexture( <span class="stringliteral">&quot;gun.jpg&quot;</span>));
409 WeaponNode-&gt;setLoopMode ( <span class="keyword">false</span> );
410 WeaponNode-&gt;setName ( <span class="stringliteral">&quot;tommi the gun man&quot;</span> );
411
412 <span class="comment">//create a collision auto response animator</span>
413 ISceneNodeAnimator* anim =
414 smgr-&gt;createCollisionResponseAnimator( meta, camera,
415 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a>(30,45,30),
416 getGravity ( <span class="stringliteral">&quot;earth&quot;</span> ),
417 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a>(0,40,0),
418 0.0005f
419 );
420
421 camera-&gt;addAnimator( anim );
422 anim-&gt;drop();
423
424 <span class="keywordflow">if</span> ( meta )
425 {
426 meta-&gt;drop ();
427 }
428
429 respawn ();
430 setAnim ( <span class="stringliteral">&quot;idle&quot;</span> );
431}
432</pre></div><p>so we need a good starting Position in the level. we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch" </p>
433<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> Q3Player::respawn ()
434{
435 <span class="keywordflow">if</span> (!Device)
436 <span class="keywordflow">return</span>;
437 ICameraSceneNode* camera = Device-&gt;getSceneManager()-&gt;getActiveCamera();
438
439 Device-&gt;getLogger()-&gt;log( <span class="stringliteral">&quot;respawn&quot;</span> );
440
441 <span class="keywordflow">if</span> ( StartPositionCurrent &gt;= Q3StartPosition (
442 Mesh, camera,StartPositionCurrent++,
443 cam ()-&gt;getEllipsoidTranslation() )
444 )
445 {
446 StartPositionCurrent = 0;
447 }
448}
449</pre></div><p>set Player position from saved coordinates </p>
450<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> Q3Player::setpos ( <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> &amp;pos, <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> &amp;rotation )
451{
452 <span class="keywordflow">if</span> (!Device)
453 <span class="keywordflow">return</span>;
454 Device-&gt;getLogger()-&gt;log( <span class="stringliteral">&quot;setpos&quot;</span> );
455
456 ICameraSceneNode* camera = Device-&gt;getSceneManager()-&gt;getActiveCamera();
457 <span class="keywordflow">if</span> ( camera )
458 {
459 camera-&gt;setPosition ( pos );
460 camera-&gt;setRotation ( rotation );
461 camera-&gt;OnAnimate ( 0 );
462 }
463}
464</pre></div><p> set the Animation of the player and weapon </p>
465<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> Q3Player::setAnim ( <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> *name )
466{
467 <span class="keywordflow">if</span> ( name )
468 {
469 snprintf ( animation, 64, <span class="stringliteral">&quot;%s&quot;</span>, name );
470 <span class="keywordflow">if</span> ( WeaponNode )
471 {
472 WeaponNode-&gt;setAnimationEndCallback ( <span class="keyword">this</span> );
473 WeaponNode-&gt;setMD2Animation ( animation );
474 }
475 }
476 <span class="keywordflow">else</span>
477 {
478 animation[0] = 0;
479 <span class="keywordflow">if</span> ( WeaponNode )
480 {
481 WeaponNode-&gt;setAnimationEndCallback ( 0 );
482 }
483 }
484}
485
486
487<span class="comment">// Callback</span>
488<span class="keywordtype">void</span> Q3Player::OnAnimationEnd(IAnimatedMeshSceneNode* node)
489{
490 setAnim ( 0 );
491}
492</pre></div><p> GUI Elements </p>
493<div class="fragment"><pre class="fragment"><span class="keyword">struct </span>GUI
494{
495 GUI ()
496 {
497 memset ( <span class="keyword">this</span>, 0, <span class="keyword">sizeof</span> ( *<span class="keyword">this</span> ) );
498 }
499
500 <span class="keywordtype">void</span> drop()
501 {
502 dropElement ( Window );
503 dropElement ( Logo );
504 }
505
506 IGUIComboBox* VideoDriver;
507 IGUIComboBox* VideoMode;
508 IGUICheckBox* FullScreen;
509 IGUICheckBox* Bit32;
510 IGUIScrollBar* MultiSample;
511 IGUIButton* SetVideoMode;
512
513 IGUIScrollBar* Tesselation;
514 IGUIScrollBar* Gamma;
515 IGUICheckBox* Collision;
516 IGUICheckBox* Visible_Map;
517 IGUICheckBox* Visible_Shader;
518 IGUICheckBox* Visible_Fog;
519 IGUICheckBox* Visible_Unresolved;
520 IGUICheckBox* Visible_Skydome;
521 IGUIButton* Respawn;
522
523 IGUITable* ArchiveList;
524 IGUIButton* ArchiveAdd;
525 IGUIButton* ArchiveRemove;
526 IGUIFileOpenDialog* ArchiveFileOpen;
527 IGUIButton* ArchiveUp;
528 IGUIButton* ArchiveDown;
529
530 IGUIListBox* MapList;
531 IGUITreeView* SceneTree;
532 IGUIStaticText* StatusLine;
533 IGUIImage* Logo;
534 IGUIWindow* Window;
535};
536</pre></div><p>CQuake3EventHandler controls the game </p>
537<div class="fragment"><pre class="fragment"><span class="keyword">class </span>CQuake3EventHandler : <span class="keyword">public</span> IEventReceiver
538{
539<span class="keyword">public</span>:
540
541 CQuake3EventHandler( GameData *gameData );
542 <span class="keyword">virtual</span> ~CQuake3EventHandler ();
543
544 <span class="keywordtype">void</span> Animate();
545 <span class="keywordtype">void</span> Render();
546
547 <span class="keywordtype">void</span> AddArchive ( <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a>&amp; archiveName );
548 <span class="keywordtype">void</span> LoadMap ( <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1core.html#aef83fafbb1b36fcce44c07c9be23a7f2" title="Typedef for wide character strings.">stringw</a>&amp; mapName, <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> collision );
549 <span class="keywordtype">void</span> CreatePlayers();
550 <span class="keywordtype">void</span> AddSky( <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> dome, <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> *texture );
551 Q3Player *GetPlayer ( <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> index ) { <span class="keywordflow">return</span> &amp;Player[index]; }
552
553 <span class="keywordtype">void</span> CreateGUI();
554 <span class="keywordtype">void</span> SetGUIActive( <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> command);
555
556 <span class="keywordtype">bool</span> OnEvent(<span class="keyword">const</span> SEvent&amp; eve);
557
558
559<span class="keyword">private</span>:
560
561 GameData *Game;
562
563 IQ3LevelMesh* Mesh;
564 ISceneNode* MapParent;
565 ISceneNode* ShaderParent;
566 ISceneNode* ItemParent;
567 ISceneNode* UnresolvedParent;
568 ISceneNode* BulletParent;
569 ISceneNode* FogParent;
570 ISceneNode * SkyNode;
571 IMetaTriangleSelector *Meta;
572
573 <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> buf[256];
574
575 Q3Player Player[2];
576
577 <span class="keyword">struct </span>SParticleImpact
578 {
579 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> when;
580 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> pos;
581 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> outVector;
582 };
583 array&lt;SParticleImpact&gt; Impacts;
584 <span class="keywordtype">void</span> useItem( Q3Player * player);
585 <span class="keywordtype">void</span> createParticleImpacts( <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> now );
586
587 <span class="keywordtype">void</span> createTextures ();
588 <span class="keywordtype">void</span> addSceneTreeItem( ISceneNode * parent, IGUITreeViewNode* nodeParent);
589
590 GUI gui;
591 <span class="keywordtype">void</span> dropMap ();
592};
593</pre></div><p> Constructor </p>
594<div class="fragment"><pre class="fragment">CQuake3EventHandler::CQuake3EventHandler( GameData *game )
595: Game(game), Mesh(0), MapParent(0), ShaderParent(0), ItemParent(0), UnresolvedParent(0),
596 BulletParent(0), FogParent(0), SkyNode(0), Meta(0)
597{
598 buf[0]=0;
599 <span class="comment">// Also use 16 Bit Textures for 16 Bit RenderDevice</span>
600 <span class="keywordflow">if</span> ( Game-&gt;deviceParam.Bits == 16 )
601 {
602 game-&gt;Device-&gt;getVideoDriver()-&gt;setTextureCreationFlag(<a class="code" href="namespaceirr_1_1video.html#acaf6f7414534f7d62bff18c5bf11876fa4fe1c1b0f4b44ef4b5da219ce66a0ae8">ETCF_ALWAYS_16_BIT</a>, <span class="keyword">true</span>);
603 }
604
605 <span class="comment">// Quake3 Shader controls Z-Writing</span>
606 game-&gt;Device-&gt;getSceneManager()-&gt;getParameters()-&gt;setAttribute(<a class="code" href="namespaceirr_1_1scene.html#ab585d23bc2a3d02cd368d8bfd0b1414a" title="Name of the parameter for changing how Irrlicht handles the ZWrite flag for transparent (blending) ma...">scene::ALLOW_ZWRITE_ON_TRANSPARENT</a>, <span class="keyword">true</span>);
607
608 <span class="comment">// create internal textures</span>
609 createTextures ();
610
611 sound_init ( game-&gt;Device );
612
613 Game-&gt;Device-&gt;setEventReceiver ( <span class="keyword">this</span> );
614}
615
616
617<span class="comment">// destructor</span>
618CQuake3EventHandler::~CQuake3EventHandler ()
619{
620 Player[0].shutdown ();
621 sound_shutdown ();
622
623 Game-&gt;save( <span class="stringliteral">&quot;explorer.cfg&quot;</span> );
624
625 Game-&gt;Device-&gt;drop();
626}
627
628
629<span class="comment">// create runtime textures smog, fog</span>
630<span class="keywordtype">void</span> CQuake3EventHandler::createTextures()
631{
632 IVideoDriver * driver = Game-&gt;Device-&gt;getVideoDriver();
633
634 <a class="code" href="namespaceirr_1_1core.html#ad2e562e3219072e2f7fc7c2bba0ef0cb" title="Typedef for an unsigned integer dimension.">dimension2du</a> dim(64, 64);
635
636 video::IImage* image;
637 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> i;
638 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> x;
639 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> y;
640 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> * data;
641 <span class="keywordflow">for</span> ( i = 0; i != 8; ++i )
642 {
643 image = driver-&gt;createImage ( <a class="code" href="namespaceirr_1_1video.html#a1d5e487888c32b1674a8f75116d829eda55c57d63efff39efe33ee733fe962df0" title="Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha...">video::ECF_A8R8G8B8</a>, dim);
644 data = (<a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a>*) image-&gt;lock ();
645 <span class="keywordflow">for</span> ( y = 0; y != dim.Height; ++y )
646 {
647 <span class="keywordflow">for</span> ( x = 0; x != dim.Width; ++x )
648 {
649 data [x] = 0xFFFFFFFF;
650 }
651 data = (<a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a>*) ( (<a class="code" href="namespaceirr.html#a646874f69af8ff87fc10201b0254a761" title="8 bit unsigned variable.">u8</a>*) data + image-&gt;getPitch() );
652 }
653 image-&gt;unlock();
654 snprintf ( buf, 64, <span class="stringliteral">&quot;smoke_%02d&quot;</span>, i );
655 driver-&gt;addTexture( buf, image );
656 image-&gt;drop ();
657 }
658
659 <span class="comment">// fog</span>
660 <span class="keywordflow">for</span> ( i = 0; i != 1; ++i )
661 {
662 image = driver-&gt;createImage ( <a class="code" href="namespaceirr_1_1video.html#a1d5e487888c32b1674a8f75116d829eda55c57d63efff39efe33ee733fe962df0" title="Default 32 bit color format. 8 bits are used for every component: red, green, blue and alpha...">video::ECF_A8R8G8B8</a>, dim);
663 data = (<a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a>*) image-&gt;lock ();
664 <span class="keywordflow">for</span> ( y = 0; y != dim.Height; ++y )
665 {
666 <span class="keywordflow">for</span> ( x = 0; x != dim.Width; ++x )
667 {
668 data [x] = 0xFFFFFFFF;
669 }
670 data = (<a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a>*) ( (<a class="code" href="namespaceirr.html#a646874f69af8ff87fc10201b0254a761" title="8 bit unsigned variable.">u8</a>*) data + image-&gt;getPitch() );
671 }
672 image-&gt;unlock();
673 snprintf ( buf, 64, <span class="stringliteral">&quot;fog_%02d&quot;</span>, i );
674 driver-&gt;addTexture( buf, image );
675 image-&gt;drop ();
676 }
677}
678</pre></div><p>create the GUI </p>
679<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> CQuake3EventHandler::CreateGUI()
680{
681
682 IGUIEnvironment *env = Game-&gt;Device-&gt;getGUIEnvironment();
683 IVideoDriver * driver = Game-&gt;Device-&gt;getVideoDriver();
684
685 gui.drop();
686
687 <span class="comment">// set skin font</span>
688 IGUIFont* font = env-&gt;getFont(<span class="stringliteral">&quot;fontlucida.png&quot;</span>);
689 <span class="keywordflow">if</span> (font)
690 env-&gt;getSkin()-&gt;setFont(font);
691 env-&gt;getSkin()-&gt;setColor ( <a class="code" href="namespaceirr_1_1gui.html#abd15860fde29833c48daff5f95d5467aa03e6e93fa9356e9d8d743e6928111185" title="Text on a button.">EGDC_BUTTON_TEXT</a>, video::SColor(240,0xAA,0xAA,0xAA) );
692 env-&gt;getSkin()-&gt;setColor ( <a class="code" href="namespaceirr_1_1gui.html#abd15860fde29833c48daff5f95d5467aa1227b2c3a809d139e1ead87aa29fa101" title="Highlight color for three-dimensional display elements (for edges facing the light source...">EGDC_3D_HIGH_LIGHT</a>, video::SColor(240,0x22,0x22,0x22) );
693 env-&gt;getSkin()-&gt;setColor ( <a class="code" href="namespaceirr_1_1gui.html#abd15860fde29833c48daff5f95d5467aabeac28ca22e9f22dc84222d5f62a80eb" title="Face color for three-dimensional display elements and for dialog box backgrounds.">EGDC_3D_FACE</a>, video::SColor(240,0x44,0x44,0x44) );
694 env-&gt;getSkin()-&gt;setColor ( <a class="code" href="namespaceirr_1_1gui.html#abd15860fde29833c48daff5f95d5467aa94ea28795bc78153e40739db9ece3b6b" title="Window background for editable field (editbox, checkbox-field)">EGDC_EDITABLE</a>, video::SColor(240,0x44,0x44,0x44) );
695 env-&gt;getSkin()-&gt;setColor ( <a class="code" href="namespaceirr_1_1gui.html#abd15860fde29833c48daff5f95d5467aa393dd9513e3c54fdfd5006bd9f853253" title="Show focus of window background for editable field (editbox or when checkbox-field is pressed)...">EGDC_FOCUSED_EDITABLE</a>, video::SColor(240,0x54,0x54,0x54) );
696 env-&gt;getSkin()-&gt;setColor ( <a class="code" href="namespaceirr_1_1gui.html#abd15860fde29833c48daff5f95d5467aab60eb00de0efde8c5a948ab15d9aa0a7" title="Window background.">EGDC_WINDOW</a>, video::SColor(240,0x66,0x66,0x66) );
697
698 <span class="comment">// minimal gui size 800x600</span>
699 dimension2d&lt;u32&gt; dim ( 800, 600 );
700 dimension2d&lt;u32&gt; vdim ( Game-&gt;Device-&gt;getVideoDriver()-&gt;getScreenSize() );
701
702 <span class="keywordflow">if</span> ( vdim.Height &gt;= dim.Height &amp;&amp; vdim.Width &gt;= dim.Width )
703 {
704 <span class="comment">//dim = vdim;</span>
705 }
706 <span class="keywordflow">else</span>
707 {
708 }
709
710 gui.Window = env-&gt;addWindow ( rect&lt;s32&gt; ( 0, 0, dim.Width, dim.Height ), <span class="keyword">false</span>, L<span class="stringliteral">&quot;Quake3 Explorer&quot;</span> );
711 gui.Window-&gt;setToolTipText ( L<span class="stringliteral">&quot;Quake3Explorer. Loads and show various BSP File Format and Shaders.&quot;</span> );
712 gui.Window-&gt;getCloseButton()-&gt;setToolTipText ( L<span class="stringliteral">&quot;Quit Quake3 Explorer&quot;</span> );
713
714 <span class="comment">// add a status line help text</span>
715 gui.StatusLine = env-&gt;addStaticText( 0, rect&lt;s32&gt;( 5,dim.Height - 30,dim.Width - 5,dim.Height - 10),
716 <span class="keyword">false</span>, <span class="keyword">false</span>, gui.Window, -1, <span class="keyword">true</span>
717 );
718
719
720 env-&gt;addStaticText ( L<span class="stringliteral">&quot;VideoDriver:&quot;</span>, rect&lt;s32&gt;( dim.Width - 400, 24, dim.Width - 310, 40 ),<span class="keyword">false</span>, <span class="keyword">false</span>, gui.Window, -1, <span class="keyword">false</span> );
721 gui.VideoDriver = env-&gt;addComboBox(rect&lt;s32&gt;( dim.Width - 300, 24, dim.Width - 10, 40 ),gui.Window);
722 gui.VideoDriver-&gt;addItem(L<span class="stringliteral">&quot;Direct3D 9.0c&quot;</span>, <a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0a4691ca314f9018f508dcf2c57dcaacec" title="Direct3D 9 device, only available on Win32 platforms.">EDT_DIRECT3D9</a> );
723 gui.VideoDriver-&gt;addItem(L<span class="stringliteral">&quot;Direct3D 8.1&quot;</span>, <a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0a8cc3807f6f28404f3424ad7e31b3142f" title="Direct3D8 device, only available on Win32 platforms.">EDT_DIRECT3D8</a> );
724 gui.VideoDriver-&gt;addItem(L<span class="stringliteral">&quot;OpenGL 1.5&quot;</span>, <a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0a2715182a79f1cb8e2826fd68a8150a53" title="OpenGL device, available on most platforms.">EDT_OPENGL</a>);
725 gui.VideoDriver-&gt;addItem(L<span class="stringliteral">&quot;Software Renderer&quot;</span>, <a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0a1598cd235a1a6bd052e2011b559e8995" title="The Irrlicht Engine Software renderer.">EDT_SOFTWARE</a>);
726 gui.VideoDriver-&gt;addItem(L<span class="stringliteral">&quot;Burning&#39;s Video (TM) Thomas Alten&quot;</span>, <a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0ae85481da26159b967191ccc6de1e4a05" title="The Burning&#39;s Software Renderer, an alternative software renderer.">EDT_BURNINGSVIDEO</a>);
727 gui.VideoDriver-&gt;setSelected ( gui.VideoDriver-&gt;getIndexForItemData ( Game-&gt;deviceParam.DriverType ) );
728 gui.VideoDriver-&gt;setToolTipText ( L<span class="stringliteral">&quot;Use a VideoDriver&quot;</span> );
729
730 env-&gt;addStaticText ( L<span class="stringliteral">&quot;VideoMode:&quot;</span>, rect&lt;s32&gt;( dim.Width - 400, 44, dim.Width - 310, 60 ),<span class="keyword">false</span>, <span class="keyword">false</span>, gui.Window, -1, <span class="keyword">false</span> );
731 gui.VideoMode = env-&gt;addComboBox(rect&lt;s32&gt;( dim.Width - 300, 44, dim.Width - 10, 60 ),gui.Window);
732 gui.VideoMode-&gt;setToolTipText ( L<span class="stringliteral">&quot;Supported Screenmodes&quot;</span> );
733 IVideoModeList *modeList = Game-&gt;Device-&gt;getVideoModeList();
734 <span class="keywordflow">if</span> ( modeList )
735 {
736 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> i;
737 <span class="keywordflow">for</span> ( i = 0; i != modeList-&gt;getVideoModeCount (); ++i )
738 {
739 <a class="code" href="namespaceirr.html#ae9f8ec82692ad3b83c21f555bfa70bcc" title="16 bit unsigned variable.">u16</a> d = modeList-&gt;getVideoModeDepth ( i );
740 <span class="keywordflow">if</span> ( d &lt; 16 )
741 <span class="keywordflow">continue</span>;
742
743 <a class="code" href="namespaceirr.html#ae9f8ec82692ad3b83c21f555bfa70bcc" title="16 bit unsigned variable.">u16</a> w = modeList-&gt;getVideoModeResolution ( i ).Width;
744 <a class="code" href="namespaceirr.html#ae9f8ec82692ad3b83c21f555bfa70bcc" title="16 bit unsigned variable.">u16</a> h = modeList-&gt;getVideoModeResolution ( i ).Height;
745 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> val = w &lt;&lt; 16 | h;
746
747 <span class="keywordflow">if</span> ( gui.VideoMode-&gt;getIndexForItemData ( val ) &gt;= 0 )
748 <span class="keywordflow">continue</span>;
749
750 <a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a> aspect = (<a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a>) w / (<a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a>) h;
751 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> *a = <span class="stringliteral">&quot;&quot;</span>;
752 <span class="keywordflow">if</span> ( <a class="code" href="namespaceirr_1_1core.html#abf9b9b140cc365908ea4c8c47451e4e3" title="returns if a equals b, taking possible rounding errors into account">core::equals</a> ( aspect, 1.3333333333f ) ) a = <span class="stringliteral">&quot;4:3&quot;</span>;
753 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="namespaceirr_1_1core.html#abf9b9b140cc365908ea4c8c47451e4e3" title="returns if a equals b, taking possible rounding errors into account">core::equals</a> ( aspect, 1.6666666f ) ) a = <span class="stringliteral">&quot;15:9 widescreen&quot;</span>;
754 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="namespaceirr_1_1core.html#abf9b9b140cc365908ea4c8c47451e4e3" title="returns if a equals b, taking possible rounding errors into account">core::equals</a> ( aspect, 1.7777777f ) ) a = <span class="stringliteral">&quot;16:9 widescreen&quot;</span>;
755 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="namespaceirr_1_1core.html#abf9b9b140cc365908ea4c8c47451e4e3" title="returns if a equals b, taking possible rounding errors into account">core::equals</a> ( aspect, 1.6f ) ) a = <span class="stringliteral">&quot;16:10 widescreen&quot;</span>;
756 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="namespaceirr_1_1core.html#abf9b9b140cc365908ea4c8c47451e4e3" title="returns if a equals b, taking possible rounding errors into account">core::equals</a> ( aspect, 2.133333f ) ) a = <span class="stringliteral">&quot;20:9 widescreen&quot;</span>;
757
758 snprintf ( buf, <span class="keyword">sizeof</span> ( buf ), <span class="stringliteral">&quot;%d x %d, %s&quot;</span>,w, h, a );
759 gui.VideoMode-&gt;addItem ( <a class="code" href="namespaceirr_1_1core.html#aef83fafbb1b36fcce44c07c9be23a7f2" title="Typedef for wide character strings.">stringw</a> ( buf ).c_str(), val );
760 }
761 }
762 gui.VideoMode-&gt;setSelected ( gui.VideoMode-&gt;getIndexForItemData (
763 Game-&gt;deviceParam.WindowSize.Width &lt;&lt; 16 |
764 Game-&gt;deviceParam.WindowSize.Height ) );
765
766 gui.FullScreen = env-&gt;addCheckBox ( Game-&gt;deviceParam.Fullscreen, rect&lt;s32&gt;( dim.Width - 400, 64, dim.Width - 300, 80 ), gui.Window,-1, L<span class="stringliteral">&quot;Fullscreen&quot;</span> );
767 gui.FullScreen-&gt;setToolTipText ( L<span class="stringliteral">&quot;Set Fullscreen or Window Mode&quot;</span> );
768
769 gui.Bit32 = env-&gt;addCheckBox ( Game-&gt;deviceParam.Bits == 32, rect&lt;s32&gt;( dim.Width - 300, 64, dim.Width - 240, 80 ), gui.Window,-1, L<span class="stringliteral">&quot;32Bit&quot;</span> );
770 gui.Bit32-&gt;setToolTipText ( L<span class="stringliteral">&quot;Use 16 or 32 Bit&quot;</span> );
771
772 env-&gt;addStaticText ( L<span class="stringliteral">&quot;MultiSample:&quot;</span>, rect&lt;s32&gt;( dim.Width - 235, 64, dim.Width - 150, 80 ),<span class="keyword">false</span>, <span class="keyword">false</span>, gui.Window, -1, <span class="keyword">false</span> );
773 gui.MultiSample = env-&gt;addScrollBar( <span class="keyword">true</span>, rect&lt;s32&gt;( dim.Width - 150, 64, dim.Width - 70, 80 ), gui.Window,-1 );
774 gui.MultiSample-&gt;setMin ( 0 );
775 gui.MultiSample-&gt;setMax ( 8 );
776 gui.MultiSample-&gt;setSmallStep ( 1 );
777 gui.MultiSample-&gt;setLargeStep ( 1 );
778 gui.MultiSample-&gt;setPos ( Game-&gt;deviceParam.AntiAlias );
779 gui.MultiSample-&gt;setToolTipText ( L<span class="stringliteral">&quot;Set the MultiSample (disable, 1x, 2x, 4x, 8x )&quot;</span> );
780
781 gui.SetVideoMode = env-&gt;addButton (rect&lt;s32&gt;( dim.Width - 60, 64, dim.Width - 10, 80 ), gui.Window, -1,L<span class="stringliteral">&quot;set&quot;</span> );
782 gui.SetVideoMode-&gt;setToolTipText ( L<span class="stringliteral">&quot;Set Video Mode with current values&quot;</span> );
783
784 env-&gt;addStaticText ( L<span class="stringliteral">&quot;Gamma:&quot;</span>, rect&lt;s32&gt;( dim.Width - 400, 104, dim.Width - 310, 120 ),<span class="keyword">false</span>, <span class="keyword">false</span>, gui.Window, -1, <span class="keyword">false</span> );
785 gui.Gamma = env-&gt;addScrollBar( <span class="keyword">true</span>, rect&lt;s32&gt;( dim.Width - 300, 104, dim.Width - 10, 120 ), gui.Window,-1 );
786 gui.Gamma-&gt;setMin ( 50 );
787 gui.Gamma-&gt;setMax ( 350 );
788 gui.Gamma-&gt;setSmallStep ( 1 );
789 gui.Gamma-&gt;setLargeStep ( 10 );
790 gui.Gamma-&gt;setPos ( <a class="code" href="namespaceirr_1_1core.html#ac230a392b15e3d27c6e2a07a6925a8c4">core::floor32</a> ( Game-&gt;GammaValue * 100.f ) );
791 gui.Gamma-&gt;setToolTipText ( L<span class="stringliteral">&quot;Adjust Gamma Ramp ( 0.5 - 3.5)&quot;</span> );
792 Game-&gt;Device-&gt;setGammaRamp ( Game-&gt;GammaValue, Game-&gt;GammaValue, Game-&gt;GammaValue, 0.f, 0.f );
793
794
795 env-&gt;addStaticText ( L<span class="stringliteral">&quot;Tesselation:&quot;</span>, rect&lt;s32&gt;( dim.Width - 400, 124, dim.Width - 310, 140 ),<span class="keyword">false</span>, <span class="keyword">false</span>, gui.Window, -1, <span class="keyword">false</span> );
796 gui.Tesselation = env-&gt;addScrollBar( <span class="keyword">true</span>, rect&lt;s32&gt;( dim.Width - 300, 124, dim.Width - 10, 140 ), gui.Window,-1 );
797 gui.Tesselation-&gt;setMin ( 2 );
798 gui.Tesselation-&gt;setMax ( 12 );
799 gui.Tesselation-&gt;setSmallStep ( 1 );
800 gui.Tesselation-&gt;setLargeStep ( 1 );
801 gui.Tesselation-&gt;setPos ( Game-&gt;loadParam.patchTesselation );
802 gui.Tesselation-&gt;setToolTipText ( L<span class="stringliteral">&quot;How smooth should curved surfaces be rendered&quot;</span> );
803
804 gui.Collision = env-&gt;addCheckBox ( <span class="keyword">true</span>, rect&lt;s32&gt;( dim.Width - 400, 150, dim.Width - 300, 166 ), gui.Window,-1, L<span class="stringliteral">&quot;Collision&quot;</span> );
805 gui.Collision-&gt;setToolTipText ( L<span class="stringliteral">&quot;Set collision on or off ( flythrough ). \nPress F7 on your Keyboard&quot;</span> );
806 gui.Visible_Map = env-&gt;addCheckBox ( <span class="keyword">true</span>, rect&lt;s32&gt;( dim.Width - 300, 150, dim.Width - 240, 166 ), gui.Window,-1, L<span class="stringliteral">&quot;Map&quot;</span> );
807 gui.Visible_Map-&gt;setToolTipText ( L<span class="stringliteral">&quot;Show or not show the static part the Level. \nPress F3 on your Keyboard&quot;</span> );
808 gui.Visible_Shader = env-&gt;addCheckBox ( <span class="keyword">true</span>, rect&lt;s32&gt;( dim.Width - 240, 150, dim.Width - 170, 166 ), gui.Window,-1, L<span class="stringliteral">&quot;Shader&quot;</span> );
809 gui.Visible_Shader-&gt;setToolTipText ( L<span class="stringliteral">&quot;Show or not show the Shader Nodes. \nPress F4 on your Keyboard&quot;</span> );
810 gui.Visible_Fog = env-&gt;addCheckBox ( <span class="keyword">true</span>, rect&lt;s32&gt;( dim.Width - 170, 150, dim.Width - 110, 166 ), gui.Window,-1, L<span class="stringliteral">&quot;Fog&quot;</span> );
811 gui.Visible_Fog-&gt;setToolTipText ( L<span class="stringliteral">&quot;Show or not show the Fog Nodes. \nPress F5 on your Keyboard&quot;</span> );
812 gui.Visible_Unresolved = env-&gt;addCheckBox ( <span class="keyword">true</span>, rect&lt;s32&gt;( dim.Width - 110, 150, dim.Width - 10, 166 ), gui.Window,-1, L<span class="stringliteral">&quot;Unresolved&quot;</span> );
813 gui.Visible_Unresolved-&gt;setToolTipText ( L<span class="stringliteral">&quot;Show the or not show the Nodes the Engine can&#39;t handle. \nPress F6 on your Keyboard&quot;</span> );
814 gui.Visible_Skydome = env-&gt;addCheckBox ( <span class="keyword">true</span>, rect&lt;s32&gt;( dim.Width - 110, 180, dim.Width - 10, 196 ), gui.Window,-1, L<span class="stringliteral">&quot;Skydome&quot;</span> );
815 gui.Visible_Skydome-&gt;setToolTipText ( L<span class="stringliteral">&quot;Show the or not show the Skydome.&quot;</span> );
816
817 <span class="comment">//Respawn = env-&gt;addButton ( rect&lt;s32&gt;( dim.Width - 260, 90, dim.Width - 10, 106 ), 0,-1, L&quot;Respawn&quot; );</span>
818
819 env-&gt;addStaticText ( L<span class="stringliteral">&quot;Archives:&quot;</span>, rect&lt;s32&gt;( 5, dim.Height - 530, dim.Width - 600,dim.Height - 514 ),<span class="keyword">false</span>, <span class="keyword">false</span>, gui.Window, -1, <span class="keyword">false</span> );
820
821 gui.ArchiveAdd = env-&gt;addButton ( rect&lt;s32&gt;( dim.Width - 725, dim.Height - 530, dim.Width - 665, dim.Height - 514 ), gui.Window,-1, L<span class="stringliteral">&quot;add&quot;</span> );
822 gui.ArchiveAdd-&gt;setToolTipText ( L<span class="stringliteral">&quot;Add an archive, usually packed zip-archives (*.pk3) to the Filesystem&quot;</span> );
823 gui.ArchiveRemove = env-&gt;addButton ( rect&lt;s32&gt;( dim.Width - 660, dim.Height - 530, dim.Width - 600, dim.Height - 514 ), gui.Window,-1, L<span class="stringliteral">&quot;del&quot;</span> );
824 gui.ArchiveRemove-&gt;setToolTipText ( L<span class="stringliteral">&quot;Remove the selected archive from the FileSystem.&quot;</span> );
825 gui.ArchiveUp = env-&gt;addButton ( rect&lt;s32&gt;( dim.Width - 575, dim.Height - 530, dim.Width - 515, dim.Height - 514 ), gui.Window,-1, L<span class="stringliteral">&quot;up&quot;</span> );
826 gui.ArchiveUp-&gt;setToolTipText ( L<span class="stringliteral">&quot;Arrange Archive Look-up Hirachy. Move the selected Archive up&quot;</span> );
827 gui.ArchiveDown = env-&gt;addButton ( rect&lt;s32&gt;( dim.Width - 510, dim.Height - 530, dim.Width - 440, dim.Height - 514 ), gui.Window,-1, L<span class="stringliteral">&quot;down&quot;</span> );
828 gui.ArchiveDown-&gt;setToolTipText ( L<span class="stringliteral">&quot;Arrange Archive Look-up Hirachy. Move the selected Archive down&quot;</span> );
829
830
831 gui.ArchiveList = env-&gt;addTable ( rect&lt;s32&gt;( 5,dim.Height - 510, dim.Width - 450,dim.Height - 410 ), gui.Window );
832 gui.ArchiveList-&gt;addColumn ( L<span class="stringliteral">&quot;Type&quot;</span>, 0 );
833 gui.ArchiveList-&gt;addColumn ( L<span class="stringliteral">&quot;Real File Path&quot;</span>, 1 );
834 gui.ArchiveList-&gt;setColumnWidth ( 0, 60 );
835 gui.ArchiveList-&gt;setColumnWidth ( 1, 284 );
836 gui.ArchiveList-&gt;setToolTipText ( L<span class="stringliteral">&quot;Show the attached Archives&quot;</span> );
837
838
839 env-&gt;addStaticText ( L<span class="stringliteral">&quot;Maps:&quot;</span>, rect&lt;s32&gt;( 5, dim.Height - 400, dim.Width - 450,dim.Height - 380 ),<span class="keyword">false</span>, <span class="keyword">false</span>, gui.Window, -1, <span class="keyword">false</span> );
840 gui.MapList = env-&gt;addListBox ( rect&lt;s32&gt;( 5,dim.Height - 380, dim.Width - 450,dim.Height - 40 ), gui.Window, -1, <span class="keyword">true</span> );
841 gui.MapList-&gt;setToolTipText ( L<span class="stringliteral">&quot;Show the current Maps in all Archives.\n Double-Click the Map to start the level&quot;</span> );
842
843
844 <span class="comment">// create a visible Scene Tree</span>
845 env-&gt;addStaticText ( L<span class="stringliteral">&quot;Scenegraph:&quot;</span>, rect&lt;s32&gt;( dim.Width - 400, dim.Height - 400, dim.Width - 5,dim.Height - 380 ),<span class="keyword">false</span>, <span class="keyword">false</span>, gui.Window, -1, <span class="keyword">false</span> );
846 gui.SceneTree = env-&gt;addTreeView( rect&lt;s32&gt;( dim.Width - 400, dim.Height - 380, dim.Width - 5, dim.Height - 40 ),
847 gui.Window, -1, <span class="keyword">true</span>, <span class="keyword">true</span>, <span class="keyword">false</span> );
848 gui.SceneTree-&gt;setToolTipText ( L<span class="stringliteral">&quot;Show the current Scenegraph&quot;</span> );
849 gui.SceneTree-&gt;getRoot()-&gt;clearChildren();
850 addSceneTreeItem ( Game-&gt;Device-&gt;getSceneManager()-&gt;getRootSceneNode(), gui.SceneTree-&gt;getRoot() );
851
852
853 IGUIImageList* imageList = env-&gt;createImageList( driver-&gt;getTexture ( <span class="stringliteral">&quot;iconlist.png&quot;</span> ),
854 <a class="code" href="namespaceirr_1_1core.html#ac79bc3704cf28bc1ab72d7cd1cae78d1" title="Typedef for an integer dimension.">dimension2di</a>( 32, 32 ), true );
855
856 <span class="keywordflow">if</span> ( imageList )
857 {
858 gui.SceneTree-&gt;setImageList( imageList );
859 imageList-&gt;drop ();
860 }
861
862
863 <span class="comment">// load the engine logo</span>
864 gui.Logo = env-&gt;addImage( driver-&gt;getTexture(<span class="stringliteral">&quot;irrlichtlogo3.png&quot;</span>), position2d&lt;s32&gt;(5, 16 ), <span class="keyword">true</span>, 0 );
865 gui.Logo-&gt;setToolTipText ( L<span class="stringliteral">&quot;The great Irrlicht Engine&quot;</span> );
866
867 AddArchive ( <span class="stringliteral">&quot;&quot;</span> );
868}
869</pre></div><p>Add an Archive to the FileSystems and updates the GUI </p>
870<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> CQuake3EventHandler::AddArchive ( <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a>&amp; archiveName )
871{
872 IFileSystem *fs = Game-&gt;Device-&gt;getFileSystem();
873 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> i;
874
875 <span class="keywordflow">if</span> ( archiveName.size () )
876 {
877 <span class="keywordtype">bool</span> exists = <span class="keyword">false</span>;
878 <span class="keywordflow">for</span> ( i = 0; i != fs-&gt;getFileArchiveCount(); ++i )
879 {
880 <span class="keywordflow">if</span> ( fs-&gt;getFileArchive(i)-&gt;getFileList()-&gt;getPath() == archiveName )
881 {
882 exists = <span class="keyword">true</span>;
883 <span class="keywordflow">break</span>;
884 }
885 }
886
887 <span class="keywordflow">if</span> (!exists)
888 {
889 fs-&gt;addFileArchive(archiveName, <span class="keyword">true</span>, <span class="keyword">false</span>);
890 }
891 }
892
893 <span class="comment">// store the current archives in game data</span>
894 <span class="comment">// show the attached Archive in proper order</span>
895 <span class="keywordflow">if</span> ( gui.ArchiveList )
896 {
897 gui.ArchiveList-&gt;clearRows();
898
899 <span class="keywordflow">for</span> ( i = 0; i != fs-&gt;getFileArchiveCount(); ++i )
900 {
901 IFileArchive * archive = fs-&gt;getFileArchive ( i );
902
903 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> index = gui.ArchiveList-&gt;addRow(i);
904
905 <a class="code" href="namespaceirr_1_1core.html#aef83fafbb1b36fcce44c07c9be23a7f2" title="Typedef for wide character strings.">core::stringw</a> typeName;
906 <span class="keywordflow">switch</span>(archive-&gt;getType())
907 {
908 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1io.html#adb3e3c445ec8e608ed1f0f93306da14fa63010a52f2efb42f3c85b91ecf077004" title="A PKZIP archive.">io::EFAT_ZIP</a>:
909 typeName = <span class="stringliteral">&quot;ZIP&quot;</span>;
910 <span class="keywordflow">break</span>;
911 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1io.html#adb3e3c445ec8e608ed1f0f93306da14fa9d37ff1b229bb63f52d29ef65a35b6ce" title="A gzip archive.">io::EFAT_GZIP</a>:
912 typeName = <span class="stringliteral">&quot;gzip&quot;</span>;
913 <span class="keywordflow">break</span>;
914 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1io.html#adb3e3c445ec8e608ed1f0f93306da14fa1d1f159095f087da5647835b47cd85d4" title="A virtual directory.">io::EFAT_FOLDER</a>:
915 typeName = <span class="stringliteral">&quot;Mount&quot;</span>;
916 <span class="keywordflow">break</span>;
917 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1io.html#adb3e3c445ec8e608ed1f0f93306da14faae9e1788acfc49c30a77f80f5ced7cf5" title="An ID Software PAK archive.">io::EFAT_PAK</a>:
918 typeName = <span class="stringliteral">&quot;PAK&quot;</span>;
919 <span class="keywordflow">break</span>;
920 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1io.html#adb3e3c445ec8e608ed1f0f93306da14fa0f36ce25d47b45f41a58e32b4c029cb6" title="A Tape ARchive.">io::EFAT_TAR</a>:
921 typeName = <span class="stringliteral">&quot;TAR&quot;</span>;
922 <span class="keywordflow">break</span>;
923 <span class="keywordflow">default</span>:
924 typeName = <span class="stringliteral">&quot;archive&quot;</span>;
925 }
926
927 gui.ArchiveList-&gt;setCellText ( index, 0, typeName );
928 gui.ArchiveList-&gt;setCellText ( index, 1, archive-&gt;getFileList()-&gt;getPath() );
929 }
930 }
931
932
933 <span class="comment">// browse the archives for maps</span>
934 <span class="keywordflow">if</span> ( gui.MapList )
935 {
936 gui.MapList-&gt;clear();
937
938 IGUISpriteBank *bank = Game-&gt;Device-&gt;getGUIEnvironment()-&gt;getSpriteBank(<span class="stringliteral">&quot;sprite_q3map&quot;</span>);
939 <span class="keywordflow">if</span> ( 0 == bank )
940 bank = Game-&gt;Device-&gt;getGUIEnvironment()-&gt;addEmptySpriteBank(<span class="stringliteral">&quot;sprite_q3map&quot;</span>);
941
942 SGUISprite sprite;
943 SGUISpriteFrame frame;
944 core::rect&lt;s32&gt; r;
945
946 bank-&gt;getSprites().clear();
947 bank-&gt;getPositions().clear ();
948 gui.MapList-&gt;setSpriteBank ( bank );
949
950 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> g = 0;
951 <a class="code" href="namespaceirr_1_1core.html#aef83fafbb1b36fcce44c07c9be23a7f2" title="Typedef for wide character strings.">core::stringw</a> s;
952
953 <span class="comment">// browse the attached file system</span>
954 fs-&gt;setFileListSystem ( <a class="code" href="namespaceirr_1_1io.html#a22364f1caf06442a70f6198025af3fe9a94a9818df56a8fe16b1c7c6f44e8f9f3">FILESYSTEM_VIRTUAL</a> );
955 fs-&gt;changeWorkingDirectoryTo ( <span class="stringliteral">&quot;/maps/&quot;</span> );
956 IFileList *fileList = fs-&gt;createFileList ();
957 fs-&gt;setFileListSystem ( <a class="code" href="namespaceirr_1_1io.html#a22364f1caf06442a70f6198025af3fe9acfbc9e5e8773ec885f08eafd6c8d3c6f">FILESYSTEM_NATIVE</a> );
958
959 <span class="keywordflow">for</span> ( i=0; i&lt; fileList-&gt;getFileCount(); ++i)
960 {
961 s = fileList-&gt;getFullFileName(i);
962 <span class="keywordflow">if</span> ( s.find ( <span class="stringliteral">&quot;.bsp&quot;</span> ) &gt;= 0 )
963 {
964 <span class="comment">// get level screenshot. reformat texture to 128x128</span>
965 <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a> c ( s );
966 <a class="code" href="namespaceirr_1_1core.html#a905c95bab4a7e8d5360a19b0726383a9" title="delete path from filename">deletePathFromFilename</a> ( c );
967 <a class="code" href="namespaceirr_1_1core.html#a188da2e914c6d4a6535bee08565d877b" title="cut the filename extension from a source file path and store it in a dest file path">cutFilenameExtension</a> ( c, c );
968 c = <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a> ( <span class="stringliteral">&quot;levelshots/&quot;</span> ) + c;
969
970 <a class="code" href="namespaceirr_1_1core.html#ad2e562e3219072e2f7fc7c2bba0ef0cb" title="Typedef for an unsigned integer dimension.">dimension2du</a> dim ( 128, 128 );
971 IVideoDriver * driver = Game-&gt;Device-&gt;getVideoDriver();
972 IImage* image = 0;
973 ITexture *tex = 0;
974 <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a> filename;
975
976 filename = c + <span class="stringliteral">&quot;.jpg&quot;</span>;
977 <span class="keywordflow">if</span> ( fs-&gt;existFile ( filename ) )
978 image = driver-&gt;createImageFromFile( filename );
979 <span class="keywordflow">if</span> ( 0 == image )
980 {
981 filename = c + <span class="stringliteral">&quot;.tga&quot;</span>;
982 <span class="keywordflow">if</span> ( fs-&gt;existFile ( filename ) )
983 image = driver-&gt;createImageFromFile( filename );
984 }
985
986 <span class="keywordflow">if</span> ( image )
987 {
988 IImage* filter = driver-&gt;createImage ( <a class="code" href="namespaceirr_1_1video.html#a1d5e487888c32b1674a8f75116d829eda3f0380aafb1e1fd59f5419a95d630a6d" title="24 bit color, no alpha channel, but 8 bit for red, green and blue.">video::ECF_R8G8B8</a>, dim );
989 image-&gt;copyToScalingBoxFilter ( filter, 0 );
990 image-&gt;drop ();
991 image = filter;
992 }
993
994 <span class="keywordflow">if</span> ( image )
995 {
996 tex = driver-&gt;addTexture ( filename, image );
997 image-&gt;drop ();
998 }
999
1000
1001 bank-&gt;setTexture ( g, tex );
1002
1003 r.LowerRightCorner.X = dim.Width;
1004 r.LowerRightCorner.Y = dim.Height;
1005 gui.MapList-&gt;setItemHeight ( r.LowerRightCorner.Y + 4 );
1006 frame.rectNumber = bank-&gt;getPositions().size();
1007 frame.textureNumber = g;
1008
1009 bank-&gt;getPositions().push_back(r);
1010
1011 sprite.Frames.set_used ( 0 );
1012 sprite.Frames.push_back(frame);
1013 sprite.frameTime = 0;
1014 bank-&gt;getSprites().push_back(sprite);
1015
1016 gui.MapList-&gt;addItem ( s.c_str (), g );
1017 g += 1;
1018 }
1019 }
1020 fileList-&gt;drop ();
1021
1022 gui.MapList-&gt;setSelected ( -1 );
1023 IGUIScrollBar * bar = (IGUIScrollBar*)gui.MapList-&gt;getElementFromId( 0 );
1024 <span class="keywordflow">if</span> ( bar )
1025 bar-&gt;setPos ( 0 );
1026
1027 }
1028
1029}
1030</pre></div><p>clears the Map in Memory </p>
1031<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> CQuake3EventHandler::dropMap ()
1032{
1033 IVideoDriver * driver = Game-&gt;Device-&gt;getVideoDriver();
1034
1035 driver-&gt;removeAllHardwareBuffers ();
1036 driver-&gt;removeAllTextures ();
1037
1038 Player[0].shutdown ();
1039
1040
1041 dropElement ( ItemParent );
1042 dropElement ( ShaderParent );
1043 dropElement ( UnresolvedParent );
1044 dropElement ( FogParent );
1045 dropElement ( BulletParent );
1046
1047
1048 Impacts.clear();
1049
1050 <span class="keywordflow">if</span> ( Meta )
1051 {
1052 Meta = 0;
1053 }
1054
1055 dropElement ( MapParent );
1056 dropElement ( SkyNode );
1057
1058 <span class="comment">// clean out meshes, because textures are invalid</span>
1059 <span class="comment">// TODO: better texture handling;-)</span>
1060 IMeshCache *cache = Game-&gt;Device-&gt;getSceneManager ()-&gt;getMeshCache();
1061 cache-&gt;clear ();
1062 Mesh = 0;
1063}
1064</pre></div><p> Load new map </p>
1065<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> CQuake3EventHandler::LoadMap ( <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1core.html#aef83fafbb1b36fcce44c07c9be23a7f2" title="Typedef for wide character strings.">stringw</a> &amp;mapName, <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> collision )
1066{
1067 <span class="keywordflow">if</span> ( 0 == mapName.size() )
1068 <span class="keywordflow">return</span>;
1069
1070 dropMap ();
1071
1072 IFileSystem *fs = Game-&gt;Device-&gt;getFileSystem();
1073 ISceneManager *smgr = Game-&gt;Device-&gt;getSceneManager ();
1074
1075 IReadFile* file = fs-&gt;createMemoryReadFile(&amp;Game-&gt;loadParam,
1076 <span class="keyword">sizeof</span>(Game-&gt;loadParam), L<span class="stringliteral">&quot;levelparameter.cfg&quot;</span>, <span class="keyword">false</span>);
1077
1078 <span class="comment">// load cfg file</span>
1079 smgr-&gt;getMesh( file );
1080 file-&gt;drop ();
1081
1082 <span class="comment">// load the actual map</span>
1083 Mesh = (IQ3LevelMesh*) smgr-&gt;getMesh(mapName);
1084 <span class="keywordflow">if</span> ( 0 == Mesh )
1085 <span class="keywordflow">return</span>;
1086</pre></div><p>add the geometry mesh to the Scene ( polygon &amp; patches ) The Geometry mesh is optimised for faster drawing </p>
1087<div class="fragment"><pre class="fragment"> IMesh *geometry = Mesh-&gt;getMesh(<a class="code" href="namespaceirr_1_1scene_1_1quake3.html#a44a1a489a965cc9a0ad2c235bbb7bf33a10a5968f2ec9c929bfbca721780a7ef6">E_Q3_MESH_GEOMETRY</a>);
1088 <span class="keywordflow">if</span> ( 0 == geometry || geometry-&gt;getMeshBufferCount() == 0)
1089 <span class="keywordflow">return</span>;
1090
1091 Game-&gt;CurrentMapName = mapName;
1092
1093 <span class="comment">//create a collision list</span>
1094 Meta = 0;
1095
1096 ITriangleSelector * selector = 0;
1097 <span class="keywordflow">if</span> (collision)
1098 Meta = smgr-&gt;createMetaTriangleSelector();
1099
1100 <span class="comment">//IMeshBuffer *b0 = geometry-&gt;getMeshBuffer(0);</span>
1101 <span class="comment">//s32 minimalNodes = b0 ? core::s32_max ( 2048, b0-&gt;getVertexCount() / 32 ) : 2048;</span>
1102 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> minimalNodes = 2048;
1103
1104 MapParent = smgr-&gt;addOctreeSceneNode(geometry, 0, -1, minimalNodes);
1105 MapParent-&gt;setName ( mapName );
1106 <span class="keywordflow">if</span> ( Meta )
1107 {
1108 selector = smgr-&gt;createOctreeTriangleSelector( geometry,MapParent, minimalNodes);
1109 <span class="comment">//selector = smgr-&gt;createTriangleSelector ( geometry, MapParent );</span>
1110 Meta-&gt;addTriangleSelector( selector);
1111 selector-&gt;drop ();
1112 }
1113
1114 <span class="comment">// logical parent for the items</span>
1115 ItemParent = smgr-&gt;addEmptySceneNode();
1116 <span class="keywordflow">if</span> ( ItemParent )
1117 ItemParent-&gt;setName ( <span class="stringliteral">&quot;Item Container&quot;</span> );
1118
1119 ShaderParent = smgr-&gt;addEmptySceneNode();
1120 <span class="keywordflow">if</span> ( ShaderParent )
1121 ShaderParent-&gt;setName ( <span class="stringliteral">&quot;Shader Container&quot;</span> );
1122
1123 UnresolvedParent = smgr-&gt;addEmptySceneNode();
1124 <span class="keywordflow">if</span> ( UnresolvedParent )
1125 UnresolvedParent-&gt;setName ( <span class="stringliteral">&quot;Unresolved Container&quot;</span> );
1126
1127 FogParent = smgr-&gt;addEmptySceneNode();
1128 <span class="keywordflow">if</span> ( FogParent )
1129 FogParent-&gt;setName ( <span class="stringliteral">&quot;Fog Container&quot;</span> );
1130
1131 <span class="comment">// logical parent for the bullets</span>
1132 BulletParent = smgr-&gt;addEmptySceneNode();
1133 <span class="keywordflow">if</span> ( BulletParent )
1134 BulletParent-&gt;setName ( <span class="stringliteral">&quot;Bullet Container&quot;</span> );
1135</pre></div><p>now construct SceneNodes for each Shader The Objects are stored in the quake mesh E_Q3_MESH_ITEMS and the Shader ID is stored in the MaterialParameters mostly dark looking skulls and moving lava.. or green flashing tubes? </p>
1136<div class="fragment"><pre class="fragment"> Q3ShaderFactory ( Game-&gt;loadParam, Game-&gt;Device, Mesh, <a class="code" href="namespaceirr_1_1scene_1_1quake3.html#a44a1a489a965cc9a0ad2c235bbb7bf33a15b1dd0b29d69900d070346d61f44319">E_Q3_MESH_ITEMS</a>,ShaderParent, Meta, <span class="keyword">false</span> );
1137 Q3ShaderFactory ( Game-&gt;loadParam, Game-&gt;Device, Mesh, <a class="code" href="namespaceirr_1_1scene_1_1quake3.html#a44a1a489a965cc9a0ad2c235bbb7bf33a8679450d9dcdd4d1b22f38bbd059740b">E_Q3_MESH_FOG</a>,FogParent, 0, <span class="keyword">false</span> );
1138 Q3ShaderFactory ( Game-&gt;loadParam, Game-&gt;Device, Mesh, <a class="code" href="namespaceirr_1_1scene_1_1quake3.html#a44a1a489a965cc9a0ad2c235bbb7bf33a9690978438eed9b5e39c7a87e9235b1d">E_Q3_MESH_UNRESOLVED</a>,UnresolvedParent, Meta, <span class="keyword">true</span> );
1139</pre></div><p>Now construct Models from Entity List </p>
1140<div class="fragment"><pre class="fragment"> Q3ModelFactory ( Game-&gt;loadParam, Game-&gt;Device, Mesh, ItemParent, <span class="keyword">false</span> );
1141}
1142</pre></div><p>Adds a SceneNode with an icon to the Scene Tree </p>
1143<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> CQuake3EventHandler::addSceneTreeItem( ISceneNode * parent, IGUITreeViewNode* nodeParent)
1144{
1145 IGUITreeViewNode* node;
1146 <span class="keywordtype">wchar_t</span> msg[128];
1147
1148 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> imageIndex;
1149 list&lt;ISceneNode*&gt;::ConstIterator it = parent-&gt;getChildren().begin();
1150 <span class="keywordflow">for</span> (; it != parent-&gt;getChildren().end(); ++it)
1151 {
1152 <span class="keywordflow">switch</span> ( (*it)-&gt;getType () )
1153 {
1154 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#acad3d7ef92a9807d391ba29120f3b7bda240e6f8e61816ea8f0cdf840b457734c" title="Quake3 Shader Scene Node.">ESNT_Q3SHADER_SCENE_NODE</a>: imageIndex = 0; <span class="keywordflow">break</span>;
1155 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#acad3d7ef92a9807d391ba29120f3b7bda117834c96690a72567a0a813708cf3b6" title="Camera Scene Node.">ESNT_CAMERA</a>: imageIndex = 1; <span class="keywordflow">break</span>;
1156 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#acad3d7ef92a9807d391ba29120f3b7bda977d9500eeb4d4f23e5676a312367f57" title="Empty Scene Node.">ESNT_EMPTY</a>: imageIndex = 2; <span class="keywordflow">break</span>;
1157 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#acad3d7ef92a9807d391ba29120f3b7bda25998267ed8640ca0c432df23f1b71fe" title="Mesh Scene Node.">ESNT_MESH</a>: imageIndex = 3; <span class="keywordflow">break</span>;
1158 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#acad3d7ef92a9807d391ba29120f3b7bda1cbab0e001b2df07ef2a253434532a52" title="Octree Scene Node.">ESNT_OCTREE</a>: imageIndex = 3; <span class="keywordflow">break</span>;
1159 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#acad3d7ef92a9807d391ba29120f3b7bda073d7fe9dfd49f24cb13bfae56d8d3b6" title="Animated Mesh Scene Node.">ESNT_ANIMATED_MESH</a>: imageIndex = 4; <span class="keywordflow">break</span>;
1160 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#acad3d7ef92a9807d391ba29120f3b7bdac47a4c2ad206e916f080ad28faed7f3b" title="Sky Box Scene Node.">ESNT_SKY_BOX</a>: imageIndex = 5; <span class="keywordflow">break</span>;
1161 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#acad3d7ef92a9807d391ba29120f3b7bda85e4b3fca8fceb3de9057e91926d2a5f" title="Billboard Scene Node.">ESNT_BILLBOARD</a>: imageIndex = 6; <span class="keywordflow">break</span>;
1162 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#acad3d7ef92a9807d391ba29120f3b7bdab027cde22a402f6f7f19eb714acf26a4" title="Particle System Scene Node.">ESNT_PARTICLE_SYSTEM</a>: imageIndex = 7; <span class="keywordflow">break</span>;
1163 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#acad3d7ef92a9807d391ba29120f3b7bda65e7b71bf270e10f94d88bcab8cbf184" title="Text Scene Node.">ESNT_TEXT</a>: imageIndex = 8; <span class="keywordflow">break</span>;
1164 <span class="keywordflow">default</span>:imageIndex = -1; <span class="keywordflow">break</span>;
1165 }
1166
1167 <span class="keywordflow">if</span> ( imageIndex &lt; 0 )
1168 {
1169 swprintf ( msg, 128, L<span class="stringliteral">&quot;%hs,%hs&quot;</span>,
1170 Game-&gt;Device-&gt;getSceneManager ()-&gt;getSceneNodeTypeName ( (*it)-&gt;getType () ),
1171 (*it)-&gt;getName()
1172 );
1173 }
1174 <span class="keywordflow">else</span>
1175 {
1176 swprintf ( msg, 128, L<span class="stringliteral">&quot;%hs&quot;</span>,(*it)-&gt;getName() );
1177 }
1178
1179 node = nodeParent-&gt;addChildBack( msg, 0, imageIndex );
1180
1181 <span class="comment">// Add all Animators</span>
1182 list&lt;ISceneNodeAnimator*&gt;::ConstIterator ait = (*it)-&gt;getAnimators().begin();
1183 <span class="keywordflow">for</span> (; ait != (*it)-&gt;getAnimators().end(); ++ait)
1184 {
1185 imageIndex = -1;
1186 swprintf ( msg, 128, L<span class="stringliteral">&quot;%hs&quot;</span>,
1187 Game-&gt;Device-&gt;getSceneManager ()-&gt;getAnimatorTypeName ( (*ait)-&gt;getType () )
1188 );
1189
1190 <span class="keywordflow">switch</span> ( (*ait)-&gt;getType () )
1191 {
1192 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#a327a1e43872705cf8f3f3342fb307d19add5f15ecd6c0209d4e3d81a287ae9a66" title="Fly circle scene node animator.">ESNAT_FLY_CIRCLE</a>:
1193 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#a327a1e43872705cf8f3f3342fb307d19af71dad2be8d964a88329d2727fb53b74" title="Fly straight scene node animator.">ESNAT_FLY_STRAIGHT</a>:
1194 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#a327a1e43872705cf8f3f3342fb307d19addc7e3bb5180f7087546ccab14dcc4ad" title="Follow spline scene node animator.">ESNAT_FOLLOW_SPLINE</a>:
1195 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#a327a1e43872705cf8f3f3342fb307d19a689aa5051e83b7f61a7abba85eb1be52" title="Rotation scene node animator.">ESNAT_ROTATION</a>:
1196 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#a327a1e43872705cf8f3f3342fb307d19a2f3e75035fbb3227189a0a3d8bcda993" title="Texture scene node animator.">ESNAT_TEXTURE</a>:
1197 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#a327a1e43872705cf8f3f3342fb307d19abbafee6e6a120e26a6e1ed6bd3cbdc86" title="Deletion scene node animator.">ESNAT_DELETION</a>:
1198 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#a327a1e43872705cf8f3f3342fb307d19af5889b6449faa50d3fabd005d4493490" title="Collision respose scene node animator.">ESNAT_COLLISION_RESPONSE</a>:
1199 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#a327a1e43872705cf8f3f3342fb307d19ae40c836272ace5bf243baaca72dba55c" title="FPS camera animator.">ESNAT_CAMERA_FPS</a>:
1200 <span class="keywordflow">case</span> <a class="code" href="namespaceirr_1_1scene.html#a327a1e43872705cf8f3f3342fb307d19a851338028c38a91643f70d2a2e5ff8c4" title="Maya camera animator.">ESNAT_CAMERA_MAYA</a>:
1201 <span class="keywordflow">default</span>:
1202 <span class="keywordflow">break</span>;
1203 }
1204 node-&gt;addChildBack( msg, 0, imageIndex );
1205 }
1206
1207 addSceneTreeItem ( *it, node );
1208 }
1209}
1210
1211
1212<span class="comment">// Adds life!</span>
1213<span class="keywordtype">void</span> CQuake3EventHandler::CreatePlayers()
1214{
1215 Player[0].create ( Game-&gt;Device, Mesh, MapParent, Meta );
1216}
1217
1218
1219<span class="comment">// Adds a skydome to the scene</span>
1220<span class="keywordtype">void</span> CQuake3EventHandler::AddSky( <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> dome, <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> *texture)
1221{
1222 ISceneManager *smgr = Game-&gt;Device-&gt;getSceneManager ();
1223 IVideoDriver * driver = Game-&gt;Device-&gt;getVideoDriver();
1224
1225 <span class="keywordtype">bool</span> oldMipMapState = driver-&gt;getTextureCreationFlag(<a class="code" href="namespaceirr_1_1video.html#acaf6f7414534f7d62bff18c5bf11876fa288b302e9d4faaba80c7796c7bc1682c">video::ETCF_CREATE_MIP_MAPS</a>);
1226 driver-&gt;setTextureCreationFlag(<a class="code" href="namespaceirr_1_1video.html#acaf6f7414534f7d62bff18c5bf11876fa288b302e9d4faaba80c7796c7bc1682c">video::ETCF_CREATE_MIP_MAPS</a>, <span class="keyword">false</span>);
1227
1228 <span class="keywordflow">if</span> ( 0 == dome )
1229 {
1230 <span class="comment">// irrlicht order</span>
1231 <span class="comment">//static const c8*p[] = { &quot;ft&quot;, &quot;lf&quot;, &quot;bk&quot;, &quot;rt&quot;, &quot;up&quot;, &quot;dn&quot; };</span>
1232 <span class="comment">// quake3 order</span>
1233 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a>*p[] = { <span class="stringliteral">&quot;ft&quot;</span>, <span class="stringliteral">&quot;rt&quot;</span>, <span class="stringliteral">&quot;bk&quot;</span>, <span class="stringliteral">&quot;lf&quot;</span>, <span class="stringliteral">&quot;up&quot;</span>, <span class="stringliteral">&quot;dn&quot;</span> };
1234
1235 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> i = 0;
1236 snprintf ( buf, 64, <span class="stringliteral">&quot;%s_%s.jpg&quot;</span>, texture, p[i] );
1237 SkyNode = smgr-&gt;addSkyBoxSceneNode( driver-&gt;getTexture ( buf ), 0, 0, 0, 0, 0 );
1238
1239 <span class="keywordflow">if</span> (SkyNode)
1240 {
1241 <span class="keywordflow">for</span> ( i = 0; i &lt; 6; ++i )
1242 {
1243 snprintf ( buf, 64, <span class="stringliteral">&quot;%s_%s.jpg&quot;</span>, texture, p[i] );
1244 SkyNode-&gt;getMaterial(i).setTexture ( 0, driver-&gt;getTexture ( buf ) );
1245 }
1246 }
1247 }
1248 <span class="keywordflow">else</span>
1249 <span class="keywordflow">if</span> ( 1 == dome )
1250 {
1251 snprintf ( buf, 64, <span class="stringliteral">&quot;%s.jpg&quot;</span>, texture );
1252 SkyNode = smgr-&gt;addSkyDomeSceneNode(
1253 driver-&gt;getTexture( buf ), 32,32,
1254 1.f, 1.f, 1000.f, 0, 11);
1255 }
1256 <span class="keywordflow">else</span>
1257 <span class="keywordflow">if</span> ( 2 == dome )
1258 {
1259 snprintf ( buf, 64, <span class="stringliteral">&quot;%s.jpg&quot;</span>, texture );
1260 SkyNode = smgr-&gt;addSkyDomeSceneNode(
1261 driver-&gt;getTexture( buf ), 16,8,
1262 0.95f, 2.f, 1000.f, 0, 11);
1263 }
1264
1265 <span class="keywordflow">if</span> (SkyNode)
1266 SkyNode-&gt;setName(<span class="stringliteral">&quot;Skydome&quot;</span>);
1267 <span class="comment">//SkyNode-&gt;getMaterial(0).ZBuffer = video::EMDF_DEPTH_LESS_EQUAL;</span>
1268
1269 driver-&gt;setTextureCreationFlag(<a class="code" href="namespaceirr_1_1video.html#acaf6f7414534f7d62bff18c5bf11876fa288b302e9d4faaba80c7796c7bc1682c">video::ETCF_CREATE_MIP_MAPS</a>, oldMipMapState);
1270}
1271
1272
1273<span class="comment">// enable GUI elements</span>
1274<span class="keywordtype">void</span> CQuake3EventHandler::SetGUIActive( <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> command)
1275{
1276 <span class="keywordtype">bool</span> inputState = <span class="keyword">false</span>;
1277
1278 ICameraSceneNode * camera = Game-&gt;Device-&gt;getSceneManager()-&gt;getActiveCamera ();
1279
1280 <span class="keywordflow">switch</span> ( command )
1281 {
1282 <span class="keywordflow">case</span> 0: Game-&gt;guiActive = 0; inputState = !Game-&gt;guiActive; <span class="keywordflow">break</span>;
1283 <span class="keywordflow">case</span> 1: Game-&gt;guiActive = 1; inputState = !Game-&gt;guiActive;;<span class="keywordflow">break</span>;
1284 <span class="keywordflow">case</span> 2: Game-&gt;guiActive ^= 1; inputState = !Game-&gt;guiActive;<span class="keywordflow">break</span>;
1285 <span class="keywordflow">case</span> 3:
1286 <span class="keywordflow">if</span> ( camera )
1287 inputState = !camera-&gt;isInputReceiverEnabled();
1288 <span class="keywordflow">break</span>;
1289 }
1290
1291 <span class="keywordflow">if</span> ( camera )
1292 {
1293 camera-&gt;setInputReceiverEnabled ( inputState );
1294 Game-&gt;Device-&gt;getCursorControl()-&gt;setVisible( !inputState );
1295 }
1296
1297 <span class="keywordflow">if</span> ( gui.Window )
1298 {
1299 gui.Window-&gt;setVisible ( Game-&gt;guiActive != 0 );
1300 }
1301
1302 <span class="keywordflow">if</span> ( Game-&gt;guiActive &amp;&amp;
1303 gui.SceneTree &amp;&amp; Game-&gt;Device-&gt;getGUIEnvironment()-&gt;getFocus() != gui.SceneTree
1304 )
1305 {
1306 gui.SceneTree-&gt;getRoot()-&gt;clearChildren();
1307 addSceneTreeItem ( Game-&gt;Device-&gt;getSceneManager()-&gt;getRootSceneNode(), gui.SceneTree-&gt;getRoot() );
1308 }
1309
1310 Game-&gt;Device-&gt;getGUIEnvironment()-&gt;setFocus ( Game-&gt;guiActive ? gui.Window: 0 );
1311}
1312</pre></div><p>Handle game input </p>
1313<div class="fragment"><pre class="fragment"><span class="keywordtype">bool</span> CQuake3EventHandler::OnEvent(<span class="keyword">const</span> SEvent&amp; eve)
1314{
1315 <span class="keywordflow">if</span> ( eve.EventType == <a class="code" href="namespaceirr.html#ac9eed96e06e85ce3c86fcbbbe9e48a0ca8553b889c8da285c96b90116ae019952" title="A log event.">EET_LOG_TEXT_EVENT</a> )
1316 {
1317 <span class="keywordflow">return</span> <span class="keyword">false</span>;
1318 }
1319
1320 <span class="keywordflow">if</span> ( Game-&gt;guiActive &amp;&amp; eve.EventType == <a class="code" href="namespaceirr.html#ac9eed96e06e85ce3c86fcbbbe9e48a0cae85bb44dd09a29c879d64a05047fc1d2" title="An event of the graphical user interface.">EET_GUI_EVENT</a> )
1321 {
1322 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.MapList &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a3f3c374a3c74405ee3eac6973e78345f" title="An item in the listbox was selected, which was already selected.">gui::EGET_LISTBOX_SELECTED_AGAIN</a> )
1323 {
1324 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> selected = gui.MapList-&gt;getSelected();
1325 <span class="keywordflow">if</span> ( selected &gt;= 0 )
1326 {
1327 <a class="code" href="namespaceirr_1_1core.html#aef83fafbb1b36fcce44c07c9be23a7f2" title="Typedef for wide character strings.">stringw</a> loadMap = gui.MapList-&gt;getListItem ( selected );
1328 <span class="keywordflow">if</span> ( 0 == MapParent || loadMap != Game-&gt;CurrentMapName )
1329 {
1330 printf ( <span class="stringliteral">&quot;Loading map %ls\n&quot;</span>, loadMap.c_str() );
1331 LoadMap ( loadMap , 1 );
1332 <span class="keywordflow">if</span> ( 0 == Game-&gt;loadParam.loadSkyShader )
1333 {
1334 AddSky ( 1, <span class="stringliteral">&quot;skydome2&quot;</span> );
1335 }
1336 CreatePlayers ();
1337 CreateGUI ();
1338 SetGUIActive ( 0 );
1339 <span class="keywordflow">return</span> <span class="keyword">true</span>;
1340 }
1341 }
1342 }
1343 <span class="keywordflow">else</span>
1344 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.ArchiveRemove &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a308ee345c92444931f83e48354072d98" title="A button was clicked.">gui::EGET_BUTTON_CLICKED</a> )
1345 {
1346 Game-&gt;Device-&gt;getFileSystem()-&gt;removeFileArchive( gui.ArchiveList-&gt;getSelected() );
1347 Game-&gt;CurrentMapName = <span class="stringliteral">&quot;&quot;</span>;
1348 AddArchive ( <span class="stringliteral">&quot;&quot;</span> );
1349 }
1350 <span class="keywordflow">else</span>
1351 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.ArchiveAdd &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a308ee345c92444931f83e48354072d98" title="A button was clicked.">gui::EGET_BUTTON_CLICKED</a> )
1352 {
1353 <span class="keywordflow">if</span> ( 0 == gui.ArchiveFileOpen )
1354 {
1355 Game-&gt;Device-&gt;getFileSystem()-&gt;setFileListSystem ( <a class="code" href="namespaceirr_1_1io.html#a22364f1caf06442a70f6198025af3fe9acfbc9e5e8773ec885f08eafd6c8d3c6f">FILESYSTEM_NATIVE</a> );
1356 gui.ArchiveFileOpen = Game-&gt;Device-&gt;getGUIEnvironment()-&gt;addFileOpenDialog ( L<span class="stringliteral">&quot;Add Game Archive&quot;</span> , <span class="keyword">false</span>,gui.Window );
1357 }
1358 }
1359 <span class="keywordflow">else</span>
1360 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.ArchiveFileOpen &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a5b6504cf6b541d5ad95407c384632873" title="A file has been selected in the file dialog.">gui::EGET_FILE_SELECTED</a> )
1361 {
1362 AddArchive ( gui.ArchiveFileOpen-&gt;getFileName() );
1363 gui.ArchiveFileOpen = 0;
1364 }
1365 <span class="keywordflow">else</span>
1366 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.ArchiveFileOpen &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a0c8a9e059bd8efe74e2f747e2e9187b3" title="A directory has been selected in the file dialog.">gui::EGET_DIRECTORY_SELECTED</a> )
1367 {
1368 AddArchive ( gui.ArchiveFileOpen-&gt;getDirectoryName() );
1369 }
1370 <span class="keywordflow">else</span>
1371 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.ArchiveFileOpen &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808ae524b2c68bc8c3117c6ae7a2d2df7865" title="A file open dialog has been closed without choosing a file.">gui::EGET_FILE_CHOOSE_DIALOG_CANCELLED</a> )
1372 {
1373 gui.ArchiveFileOpen = 0;
1374 }
1375 <span class="keywordflow">else</span>
1376 <span class="keywordflow">if</span> ( ( eve.GUIEvent.Caller == gui.ArchiveUp || eve.GUIEvent.Caller == gui.ArchiveDown ) &amp;&amp;
1377 eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a308ee345c92444931f83e48354072d98" title="A button was clicked.">gui::EGET_BUTTON_CLICKED</a> )
1378 {
1379 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> rel = eve.GUIEvent.Caller == gui.ArchiveUp ? -1 : 1;
1380 <span class="keywordflow">if</span> ( Game-&gt;Device-&gt;getFileSystem()-&gt;moveFileArchive ( gui.ArchiveList-&gt;getSelected (), rel ) )
1381 {
1382 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> newIndex = <a class="code" href="namespaceirr_1_1core.html#aa7828c932a36c62a67fd0f2b972d8b21">core::s32_clamp</a> ( gui.ArchiveList-&gt;getSelected() + rel, 0, gui.ArchiveList-&gt;getRowCount() - 1 );
1383 AddArchive ( <span class="stringliteral">&quot;&quot;</span> );
1384 gui.ArchiveList-&gt;setSelected ( newIndex );
1385 Game-&gt;CurrentMapName = <span class="stringliteral">&quot;&quot;</span>;
1386 }
1387 }
1388 <span class="keywordflow">else</span>
1389 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.VideoDriver &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808aef7f9081622a71160e161c80eb07d436" title="The selection in a combo box has been changed.">gui::EGET_COMBO_BOX_CHANGED</a> )
1390 {
1391 Game-&gt;deviceParam.DriverType = (<a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0" title="An enum for all types of drivers the Irrlicht Engine supports.">E_DRIVER_TYPE</a>) gui.VideoDriver-&gt;getItemData ( gui.VideoDriver-&gt;getSelected() );
1392 }
1393 <span class="keywordflow">else</span>
1394 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.VideoMode &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808aef7f9081622a71160e161c80eb07d436" title="The selection in a combo box has been changed.">gui::EGET_COMBO_BOX_CHANGED</a> )
1395 {
1396 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> val = gui.VideoMode-&gt;getItemData ( gui.VideoMode-&gt;getSelected() );
1397 Game-&gt;deviceParam.WindowSize.Width = val &gt;&gt; 16;
1398 Game-&gt;deviceParam.WindowSize.Height = val &amp; 0xFFFF;
1399 }
1400 <span class="keywordflow">else</span>
1401 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.FullScreen &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a16a1f6de4aeb2d7f34f7b7dbff0a7a0a" title="A checkbox has changed its check state.">gui::EGET_CHECKBOX_CHANGED</a> )
1402 {
1403 Game-&gt;deviceParam.Fullscreen = gui.FullScreen-&gt;isChecked();
1404 }
1405 <span class="keywordflow">else</span>
1406 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.Bit32 &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a16a1f6de4aeb2d7f34f7b7dbff0a7a0a" title="A checkbox has changed its check state.">gui::EGET_CHECKBOX_CHANGED</a> )
1407 {
1408 Game-&gt;deviceParam.Bits = gui.Bit32-&gt;isChecked() ? 32 : 16;
1409 }
1410 <span class="keywordflow">else</span>
1411 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.MultiSample &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a2eea536494edcde2bb2608bda9d352b2" title="A scrollbar has changed its position.">gui::EGET_SCROLL_BAR_CHANGED</a> )
1412 {
1413 Game-&gt;deviceParam.AntiAlias = gui.MultiSample-&gt;getPos();
1414 }
1415 <span class="keywordflow">else</span>
1416 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.Tesselation &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a2eea536494edcde2bb2608bda9d352b2" title="A scrollbar has changed its position.">gui::EGET_SCROLL_BAR_CHANGED</a> )
1417 {
1418 Game-&gt;loadParam.patchTesselation = gui.Tesselation-&gt;getPos ();
1419 }
1420 <span class="keywordflow">else</span>
1421 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.Gamma &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a2eea536494edcde2bb2608bda9d352b2" title="A scrollbar has changed its position.">gui::EGET_SCROLL_BAR_CHANGED</a> )
1422 {
1423 Game-&gt;GammaValue = gui.Gamma-&gt;getPos () * 0.01f;
1424 Game-&gt;Device-&gt;setGammaRamp ( Game-&gt;GammaValue, Game-&gt;GammaValue, Game-&gt;GammaValue, 0.f, 0.f );
1425 }
1426 <span class="keywordflow">else</span>
1427 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.SetVideoMode &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a308ee345c92444931f83e48354072d98" title="A button was clicked.">gui::EGET_BUTTON_CLICKED</a> )
1428 {
1429 Game-&gt;retVal = 2;
1430 Game-&gt;Device-&gt;closeDevice();
1431 }
1432 <span class="keywordflow">else</span>
1433 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.Window &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a9879e90ebeaf90f3ec7477acc1a46749" title="An element would like to close.">gui::EGET_ELEMENT_CLOSED</a> )
1434 {
1435 Game-&gt;Device-&gt;closeDevice();
1436 }
1437 <span class="keywordflow">else</span>
1438 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.Collision &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a16a1f6de4aeb2d7f34f7b7dbff0a7a0a" title="A checkbox has changed its check state.">gui::EGET_CHECKBOX_CHANGED</a> )
1439 {
1440 <span class="comment">// set fly through active</span>
1441 Game-&gt;flyTroughState ^= 1;
1442 Player[0].cam()-&gt;setAnimateTarget ( Game-&gt;flyTroughState == 0 );
1443
1444 printf ( <span class="stringliteral">&quot;collision %d\n&quot;</span>, Game-&gt;flyTroughState == 0 );
1445 }
1446 <span class="keywordflow">else</span>
1447 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.Visible_Map &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a16a1f6de4aeb2d7f34f7b7dbff0a7a0a" title="A checkbox has changed its check state.">gui::EGET_CHECKBOX_CHANGED</a> )
1448 {
1449 <span class="keywordtype">bool</span> v = gui.Visible_Map-&gt;isChecked();
1450
1451 <span class="keywordflow">if</span> ( MapParent )
1452 {
1453 printf ( <span class="stringliteral">&quot;static node set visible %d\n&quot;</span>,v );
1454 MapParent-&gt;setVisible ( v );
1455 }
1456 }
1457 <span class="keywordflow">else</span>
1458 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.Visible_Shader &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a16a1f6de4aeb2d7f34f7b7dbff0a7a0a" title="A checkbox has changed its check state.">gui::EGET_CHECKBOX_CHANGED</a> )
1459 {
1460 <span class="keywordtype">bool</span> v = gui.Visible_Shader-&gt;isChecked();
1461
1462 <span class="keywordflow">if</span> ( ShaderParent )
1463 {
1464 printf ( <span class="stringliteral">&quot;shader node set visible %d\n&quot;</span>,v );
1465 ShaderParent-&gt;setVisible ( v );
1466 }
1467 }
1468 <span class="keywordflow">else</span>
1469 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.Visible_Skydome &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a16a1f6de4aeb2d7f34f7b7dbff0a7a0a" title="A checkbox has changed its check state.">gui::EGET_CHECKBOX_CHANGED</a> )
1470 {
1471 <span class="keywordflow">if</span> ( SkyNode )
1472 {
1473 <span class="keywordtype">bool</span> v = !SkyNode-&gt;isVisible();
1474 printf ( <span class="stringliteral">&quot;skynode set visible %d\n&quot;</span>,v );
1475 SkyNode-&gt;setVisible ( v );
1476 }
1477 }
1478 <span class="keywordflow">else</span>
1479 <span class="keywordflow">if</span> ( eve.GUIEvent.Caller == gui.Respawn &amp;&amp; eve.GUIEvent.EventType == <a class="code" href="namespaceirr_1_1gui.html#aeac71ad17341a4b6e9026ae11d576808a308ee345c92444931f83e48354072d98" title="A button was clicked.">gui::EGET_BUTTON_CLICKED</a> )
1480 {
1481 Player[0].respawn ();
1482 }
1483
1484 <span class="keywordflow">return</span> <span class="keyword">false</span>;
1485 }
1486
1487 <span class="comment">// fire</span>
1488 <span class="keywordflow">if</span> ((eve.EventType == <a class="code" href="namespaceirr.html#ac9eed96e06e85ce3c86fcbbbe9e48a0ca6f90390f3147a1693e5e2e3422d6ca09" title="A key input event.">EET_KEY_INPUT_EVENT</a> &amp;&amp; eve.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a52c3b1744ca8ae7b6da19fc00fbb8ee8">KEY_SPACE</a> &amp;&amp;
1489 eve.KeyInput.PressedDown == <span class="keyword">false</span>) ||
1490 (eve.EventType == <a class="code" href="namespaceirr.html#ac9eed96e06e85ce3c86fcbbbe9e48a0caa230b748674e074aa67f661819ad5891" title="A mouse input event.">EET_MOUSE_INPUT_EVENT</a> &amp;&amp; eve.MouseInput.Event == <a class="code" href="namespaceirr.html#a2dbf2a247aa17a9eeefbbf36ebd5739fa26d91b99a8912ff622133f02c60f306a" title="Left mouse button was left up.">EMIE_LMOUSE_LEFT_UP</a>)
1491 )
1492 {
1493 ICameraSceneNode * camera = Game-&gt;Device-&gt;getSceneManager()-&gt;getActiveCamera ();
1494 <span class="keywordflow">if</span> ( camera &amp;&amp; camera-&gt;isInputReceiverEnabled () )
1495 {
1496 useItem( Player + 0 );
1497 }
1498 }
1499
1500 <span class="comment">// gui active</span>
1501 <span class="keywordflow">if</span> ((eve.EventType == <a class="code" href="namespaceirr.html#ac9eed96e06e85ce3c86fcbbbe9e48a0ca6f90390f3147a1693e5e2e3422d6ca09" title="A key input event.">EET_KEY_INPUT_EVENT</a> &amp;&amp; eve.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a5427274e34fd5587155fe8b3b12d96a8">KEY_F1</a> &amp;&amp;
1502 eve.KeyInput.PressedDown == <span class="keyword">false</span>) ||
1503 (eve.EventType == <a class="code" href="namespaceirr.html#ac9eed96e06e85ce3c86fcbbbe9e48a0caa230b748674e074aa67f661819ad5891" title="A mouse input event.">EET_MOUSE_INPUT_EVENT</a> &amp;&amp; eve.MouseInput.Event == <a class="code" href="namespaceirr.html#a2dbf2a247aa17a9eeefbbf36ebd5739fadb92d5c1011534b2b18065573182d9f4" title="Right mouse button was left up.">EMIE_RMOUSE_LEFT_UP</a>)
1504 )
1505 {
1506 SetGUIActive ( 2 );
1507 }
1508
1509 <span class="comment">// check if user presses the key</span>
1510 <span class="keywordflow">if</span> ( eve.EventType == <a class="code" href="namespaceirr.html#ac9eed96e06e85ce3c86fcbbbe9e48a0ca6f90390f3147a1693e5e2e3422d6ca09" title="A key input event.">EET_KEY_INPUT_EVENT</a> &amp;&amp; eve.KeyInput.PressedDown == <span class="keyword">false</span>)
1511 {
1512 <span class="comment">// Escape toggles camera Input</span>
1513 <span class="keywordflow">if</span> ( eve.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3aab32bfc194f119e5d5b9b39527bbcd61">irr::KEY_ESCAPE</a> )
1514 {
1515 SetGUIActive ( 3 );
1516 }
1517 <span class="keywordflow">else</span>
1518 <span class="keywordflow">if</span> (eve.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3af847cf3df62b0e23942f0bd2d226a9eb">KEY_F11</a>)
1519 {
1520 <span class="comment">// screenshot are taken without gamma!</span>
1521 IImage* image = Game-&gt;Device-&gt;getVideoDriver()-&gt;createScreenShot();
1522 <span class="keywordflow">if</span> (image)
1523 {
1524 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">core::vector3df</a> pos;
1525 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">core::vector3df</a> rot;
1526 ICameraSceneNode * cam = Game-&gt;Device-&gt;getSceneManager()-&gt;getActiveCamera ();
1527 <span class="keywordflow">if</span> ( cam )
1528 {
1529 pos = cam-&gt;getPosition ();
1530 rot = cam-&gt;getRotation ();
1531 }
1532
1533 <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> *dName[] = { <span class="stringliteral">&quot;null&quot;</span>, <span class="stringliteral">&quot;software&quot;</span>, <span class="stringliteral">&quot;burning&quot;</span>,
1534 <span class="stringliteral">&quot;d3d8&quot;</span>, <span class="stringliteral">&quot;d3d9&quot;</span>, <span class="stringliteral">&quot;opengl&quot;</span> };
1535
1536 snprintf(buf, 256, <span class="stringliteral">&quot;%s_%ls_%.0f_%.0f_%.0f_%.0f_%.0f_%.0f.jpg&quot;</span>,
1537 dName[Game-&gt;Device-&gt;getVideoDriver()-&gt;getDriverType()],
1538 Game-&gt;CurrentMapName.c_str(),
1539 pos.X, pos.Y, pos.Z,
1540 rot.X, rot.Y, rot.Z
1541 );
1542 <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a> filename ( buf );
1543 filename.replace ( <span class="charliteral">&#39;/&#39;</span>, <span class="charliteral">&#39;_&#39;</span> );
1544 printf ( <span class="stringliteral">&quot;screenshot : %s\n&quot;</span>, filename.c_str() );
1545 Game-&gt;Device-&gt;getVideoDriver()-&gt;writeImageToFile(image, filename, 100 );
1546 image-&gt;drop();
1547 }
1548 }
1549 <span class="keywordflow">else</span>
1550 <span class="keywordflow">if</span> (eve.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a5dfbe4e0c7c8d9d810717fc1331fd3c9">KEY_F9</a>)
1551 {
1552 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> value = <a class="code" href="namespaceirr_1_1scene.html#a52b664c4c988113735042b168fc32dbea25111b15f03bee9a99498737286916dc" title="No Debug Data ( Default )">EDS_OFF</a>;
1553
1554 Game-&gt;debugState = ( Game-&gt;debugState + 1 ) &amp; 3;
1555
1556 <span class="keywordflow">switch</span> ( Game-&gt;debugState )
1557 {
1558 <span class="keywordflow">case</span> 1: value = <a class="code" href="namespaceirr_1_1scene.html#a52b664c4c988113735042b168fc32dbea2713e470ee18ec9bfe40fdfb502f8b05" title="Show Vertex Normals.">EDS_NORMALS</a> | <a class="code" href="namespaceirr_1_1scene.html#a52b664c4c988113735042b168fc32dbea349b086537ac770f09935af4e31d3f3e" title="Overlays Mesh Wireframe.">EDS_MESH_WIRE_OVERLAY</a> | <a class="code" href="namespaceirr_1_1scene.html#a52b664c4c988113735042b168fc32dbea80f38e42f1b8cf169e83f44092367bfe" title="EDS_BBOX | EDS_BBOX_BUFFERS.">EDS_BBOX_ALL</a>; <span class="keywordflow">break</span>;
1559 <span class="keywordflow">case</span> 2: value = <a class="code" href="namespaceirr_1_1scene.html#a52b664c4c988113735042b168fc32dbea2713e470ee18ec9bfe40fdfb502f8b05" title="Show Vertex Normals.">EDS_NORMALS</a> | <a class="code" href="namespaceirr_1_1scene.html#a52b664c4c988113735042b168fc32dbea349b086537ac770f09935af4e31d3f3e" title="Overlays Mesh Wireframe.">EDS_MESH_WIRE_OVERLAY</a> | <a class="code" href="namespaceirr_1_1scene.html#a52b664c4c988113735042b168fc32dbeaa7664e189b8641ac54cf27f70f6d8144" title="Shows Skeleton/Tags.">EDS_SKELETON</a>; <span class="keywordflow">break</span>;
1560 }
1561</pre></div><p>set debug map data on/off debugState = debugState == EDS_OFF ? EDS_NORMALS | EDS_MESH_WIRE_OVERLAY | EDS_BBOX_ALL: EDS_OFF; </p>
1562<div class="fragment"><pre class="fragment"> <span class="keywordflow">if</span> ( ItemParent )
1563 {
1564 list&lt;ISceneNode*&gt;::ConstIterator it = ItemParent-&gt;getChildren().begin();
1565 <span class="keywordflow">for</span> (; it != ItemParent-&gt;getChildren().end(); ++it)
1566 {
1567 (*it)-&gt;setDebugDataVisible ( value );
1568 }
1569 }
1570
1571 <span class="keywordflow">if</span> ( ShaderParent )
1572 {
1573 list&lt;ISceneNode*&gt;::ConstIterator it = ShaderParent-&gt;getChildren().begin();
1574 <span class="keywordflow">for</span> (; it != ShaderParent-&gt;getChildren().end(); ++it)
1575 {
1576 (*it)-&gt;setDebugDataVisible ( value );
1577 }
1578 }
1579
1580 <span class="keywordflow">if</span> ( UnresolvedParent )
1581 {
1582 list&lt;ISceneNode*&gt;::ConstIterator it = UnresolvedParent-&gt;getChildren().begin();
1583 <span class="keywordflow">for</span> (; it != UnresolvedParent-&gt;getChildren().end(); ++it)
1584 {
1585 (*it)-&gt;setDebugDataVisible ( value );
1586 }
1587 }
1588
1589 <span class="keywordflow">if</span> ( FogParent )
1590 {
1591 list&lt;ISceneNode*&gt;::ConstIterator it = FogParent-&gt;getChildren().begin();
1592 <span class="keywordflow">for</span> (; it != FogParent-&gt;getChildren().end(); ++it)
1593 {
1594 (*it)-&gt;setDebugDataVisible ( value );
1595 }
1596 }
1597
1598 <span class="keywordflow">if</span> ( SkyNode )
1599 {
1600 SkyNode-&gt;setDebugDataVisible ( value );
1601 }
1602
1603 }
1604 <span class="keywordflow">else</span>
1605 <span class="keywordflow">if</span> (eve.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a5111be01fea6429912b3e497b2a85d73">KEY_F8</a>)
1606 {
1607 <span class="comment">// set gravity on/off</span>
1608 Game-&gt;gravityState ^= 1;
1609 Player[0].cam()-&gt;setGravity ( getGravity ( Game-&gt;gravityState ? <span class="stringliteral">&quot;earth&quot;</span> : <span class="stringliteral">&quot;none&quot;</span> ) );
1610 printf ( <span class="stringliteral">&quot;gravity %s\n&quot;</span>, Game-&gt;gravityState ? <span class="stringliteral">&quot;earth&quot;</span> : <span class="stringliteral">&quot;none&quot;</span> );
1611 }
1612 <span class="keywordflow">else</span>
1613 <span class="keywordflow">if</span> (eve.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a7f58cecbda71cea3043c026d3ba00456">KEY_F7</a>)
1614 {
1615 <span class="comment">// set fly through active</span>
1616 Game-&gt;flyTroughState ^= 1;
1617 Player[0].cam()-&gt;setAnimateTarget ( Game-&gt;flyTroughState == 0 );
1618 <span class="keywordflow">if</span> ( gui.Collision )
1619 gui.Collision-&gt;setChecked ( Game-&gt;flyTroughState == 0 );
1620
1621 printf ( <span class="stringliteral">&quot;collision %d\n&quot;</span>, Game-&gt;flyTroughState == 0 );
1622 }
1623 <span class="keywordflow">else</span>
1624 <span class="keywordflow">if</span> (eve.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a992b194a5b4b4809587db8a43c3e75dd">KEY_F2</a>)
1625 {
1626 Player[0].respawn ();
1627 }
1628 <span class="keywordflow">else</span>
1629 <span class="keywordflow">if</span> (eve.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a2f017f7a3b6291e5d549ed4a09c03d4e">KEY_F3</a>)
1630 {
1631 <span class="keywordflow">if</span> ( MapParent )
1632 {
1633 <span class="keywordtype">bool</span> v = !MapParent-&gt;isVisible ();
1634 printf ( <span class="stringliteral">&quot;static node set visible %d\n&quot;</span>,v );
1635 MapParent-&gt;setVisible ( v );
1636 <span class="keywordflow">if</span> ( gui.Visible_Map )
1637 gui.Visible_Map-&gt;setChecked ( v );
1638 }
1639 }
1640 <span class="keywordflow">else</span>
1641 <span class="keywordflow">if</span> (eve.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a8f49f2e6664716985551334f0b2c1b47">KEY_F4</a>)
1642 {
1643 <span class="keywordflow">if</span> ( ShaderParent )
1644 {
1645 <span class="keywordtype">bool</span> v = !ShaderParent-&gt;isVisible ();
1646 printf ( <span class="stringliteral">&quot;shader node set visible %d\n&quot;</span>,v );
1647 ShaderParent-&gt;setVisible ( v );
1648 <span class="keywordflow">if</span> ( gui.Visible_Shader )
1649 gui.Visible_Shader-&gt;setChecked ( v );
1650 }
1651 }
1652 <span class="keywordflow">else</span>
1653 <span class="keywordflow">if</span> (eve.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a6aecea6261588331b87093b4ab544b1a">KEY_F5</a>)
1654 {
1655 <span class="keywordflow">if</span> ( FogParent )
1656 {
1657 <span class="keywordtype">bool</span> v = !FogParent-&gt;isVisible ();
1658 printf ( <span class="stringliteral">&quot;fog node set visible %d\n&quot;</span>,v );
1659 FogParent-&gt;setVisible ( v );
1660 <span class="keywordflow">if</span> ( gui.Visible_Fog )
1661 gui.Visible_Fog-&gt;setChecked ( v );
1662 }
1663
1664 }
1665 <span class="keywordflow">else</span>
1666 <span class="keywordflow">if</span> (eve.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a6c0530c3448c3274b137f97df44e2a44">KEY_F6</a>)
1667 {
1668 <span class="keywordflow">if</span> ( UnresolvedParent )
1669 {
1670 <span class="keywordtype">bool</span> v = !UnresolvedParent-&gt;isVisible ();
1671 printf ( <span class="stringliteral">&quot;unresolved node set visible %d\n&quot;</span>,v );
1672 UnresolvedParent-&gt;setVisible ( v );
1673 <span class="keywordflow">if</span> ( gui.Visible_Unresolved )
1674 gui.Visible_Unresolved-&gt;setChecked ( v );
1675 }
1676 }
1677 }
1678
1679 <span class="comment">// check if user presses the key C ( for crouch)</span>
1680 <span class="keywordflow">if</span> ( eve.EventType == <a class="code" href="namespaceirr.html#ac9eed96e06e85ce3c86fcbbbe9e48a0ca6f90390f3147a1693e5e2e3422d6ca09" title="A key input event.">EET_KEY_INPUT_EVENT</a> &amp;&amp; eve.KeyInput.Key == <a class="code" href="namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3a85a756fa6a3336312c5f32877a7185e5">KEY_KEY_C</a> )
1681 {
1682 <span class="comment">// crouch</span>
1683 ISceneNodeAnimatorCollisionResponse *anim = Player[0].cam ();
1684 <span class="keywordflow">if</span> ( anim &amp;&amp; 0 == Game-&gt;flyTroughState )
1685 {
1686 <span class="keywordflow">if</span> ( <span class="keyword">false</span> == eve.KeyInput.PressedDown )
1687 {
1688 <span class="comment">// stand up</span>
1689 anim-&gt;setEllipsoidRadius ( <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a>(30,45,30) );
1690 anim-&gt;setEllipsoidTranslation ( <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a>(0,40,0));
1691
1692 }
1693 <span class="keywordflow">else</span>
1694 {
1695 <span class="comment">// on your knees</span>
1696 anim-&gt;setEllipsoidRadius ( <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a>(30,20,30) );
1697 anim-&gt;setEllipsoidTranslation ( <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a>(0,20,0));
1698 }
1699 <span class="keywordflow">return</span> <span class="keyword">true</span>;
1700 }
1701 }
1702 <span class="keywordflow">return</span> <span class="keyword">false</span>;
1703}
1704</pre></div><p>useItem </p>
1705<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> CQuake3EventHandler::useItem( Q3Player * player)
1706{
1707 ISceneManager* smgr = Game-&gt;Device-&gt;getSceneManager();
1708 ICameraSceneNode* camera = smgr-&gt;getActiveCamera();
1709
1710 <span class="keywordflow">if</span> (!camera)
1711 <span class="keywordflow">return</span>;
1712
1713 SParticleImpact imp;
1714 imp.when = 0;
1715
1716 <span class="comment">// get line of camera</span>
1717
1718 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> start = camera-&gt;getPosition();
1719
1720 <span class="keywordflow">if</span> ( player-&gt;WeaponNode )
1721 {
1722 start.X += 0.f;
1723 start.Y += 0.f;
1724 start.Z += 0.f;
1725 }
1726
1727 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> end = (camera-&gt;getTarget() - start);
1728 end.normalize();
1729 start += end*20.0f;
1730
1731 end = start + (end * camera-&gt;getFarValue());
1732
1733 <a class="code" href="namespaceirr_1_1core.html#a1112835405bbec5dadf031dc7934e7d0" title="Typedef for a f32 3d triangle.">triangle3df</a> triangle;
1734 line3d&lt;f32&gt; line(start, end);
1735
1736 <span class="comment">// get intersection point with map</span>
1737 scene::ISceneNode* hitNode;
1738 <span class="keywordflow">if</span> (smgr-&gt;getSceneCollisionManager()-&gt;getCollisionPoint(
1739 line, Meta, end, triangle,hitNode))
1740 {
1741 <span class="comment">// collides with wall</span>
1742 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> out = triangle.getNormal();
1743 out.setLength(0.03f);
1744
1745 imp.when = 1;
1746 imp.outVector = out;
1747 imp.pos = end;
1748
1749 player-&gt;setAnim ( <span class="stringliteral">&quot;pow&quot;</span> );
1750 player-&gt;Anim[1].next += player-&gt;Anim[1].delta;
1751 }
1752 <span class="keywordflow">else</span>
1753 {
1754 <span class="comment">// doesnt collide with wall</span>
1755 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> start = camera-&gt;getPosition();
1756 <span class="keywordflow">if</span> ( player-&gt;WeaponNode )
1757 {
1758 <span class="comment">//start.X += 10.f;</span>
1759 <span class="comment">//start.Y += -5.f;</span>
1760 <span class="comment">//start.Z += 1.f;</span>
1761 }
1762
1763 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> end = (camera-&gt;getTarget() - start);
1764 end.normalize();
1765 start += end*20.0f;
1766 end = start + (end * camera-&gt;getFarValue());
1767 }
1768
1769 <span class="comment">// create fire ball</span>
1770 ISceneNode* node = 0;
1771 node = smgr-&gt;addBillboardSceneNode( BulletParent,dimension2d&lt;f32&gt;(10,10), start);
1772
1773 node-&gt;setMaterialFlag(<a class="code" href="namespaceirr_1_1video.html#a8a3bc00ae8137535b9fbc5f40add70d3acea597a2692b8415486a464a7f954d34" title="Will this material be lighted? Default: true.">EMF_LIGHTING</a>, <span class="keyword">false</span>);
1774 node-&gt;setMaterialTexture(0, Game-&gt;Device-&gt;getVideoDriver()-&gt;getTexture(<span class="stringliteral">&quot;fireball.bmp&quot;</span>));
1775 node-&gt;setMaterialFlag(<a class="code" href="namespaceirr_1_1video.html#a8a3bc00ae8137535b9fbc5f40add70d3a4bc03b7b9dd19e577bf909313ea62510" title="May be written to the zbuffer or is it readonly. Default: true.">video::EMF_ZWRITE_ENABLE</a>, <span class="keyword">false</span>);
1776 node-&gt;setMaterialType(<a class="code" href="namespaceirr_1_1video.html#ac8e9b6c66f7cebabd1a6d30cbc5430f1a1b5a814c4466aca2943ff056003a50d1" title="A transparent material.">EMT_TRANSPARENT_ADD_COLOR</a>);
1777
1778 <a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a> length = (<a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a>)(end - start).getLength();
1779 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a> speed = 5.8f;
1780 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> time = (<a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a>)(length / speed);
1781
1782 ISceneNodeAnimator* anim = 0;
1783
1784 <span class="comment">// set flight line</span>
1785
1786 anim = smgr-&gt;createFlyStraightAnimator(start, end, time);
1787 node-&gt;addAnimator(anim);
1788 anim-&gt;drop();
1789
1790 snprintf ( buf, 64, <span class="stringliteral">&quot;bullet: %s on %.1f,%1.f,%1.f&quot;</span>,
1791 imp.when ? <span class="stringliteral">&quot;hit&quot;</span> : <span class="stringliteral">&quot;nohit&quot;</span>, end.X, end.Y, end.Z );
1792 node-&gt;setName ( buf );
1793
1794
1795 anim = smgr-&gt;createDeleteAnimator(time);
1796 node-&gt;addAnimator(anim);
1797 anim-&gt;drop();
1798
1799 <span class="keywordflow">if</span> (imp.when)
1800 {
1801 <span class="comment">// create impact note</span>
1802 imp.when = Game-&gt;Device-&gt;getTimer()-&gt;getTime() +
1803 (time + (<a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a>) ( ( 1.f + Noiser::get() ) * 250.f ));
1804 Impacts.push_back(imp);
1805 }
1806
1807 <span class="comment">// play sound</span>
1808}
1809
1810<span class="comment">// rendered when bullets hit something</span>
1811<span class="keywordtype">void</span> CQuake3EventHandler::createParticleImpacts( <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> now )
1812{
1813 ISceneManager* sm = Game-&gt;Device-&gt;getSceneManager();
1814
1815 <span class="keyword">struct </span>smokeLayer
1816 {
1817 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> * texture;
1818 <a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a> scale;
1819 <a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a> minparticleSize;
1820 <a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a> maxparticleSize;
1821 <a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a> boxSize;
1822 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> minParticle;
1823 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> maxParticle;
1824 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> fadeout;
1825 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> lifetime;
1826 };
1827
1828 smokeLayer smoke[] =
1829 {
1830 { <span class="stringliteral">&quot;smoke2.jpg&quot;</span>, 0.4f, 1.5f, 18.f, 20.f, 20, 50, 2000, 10000 },
1831 { <span class="stringliteral">&quot;smoke3.jpg&quot;</span>, 0.2f, 1.2f, 15.f, 20.f, 10, 30, 1000, 12000 }
1832 };
1833
1834
1835 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> i;
1836 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> g;
1837 <a class="code" href="namespaceirr.html#ac66849b7a6ed16e30ebede579f9b47c6" title="32 bit signed variable.">s32</a> factor = 1;
1838 <span class="keywordflow">for</span> ( 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 <span class="keywordflow">for</span> ( i=0; i &lt; Impacts.size(); ++i)
1847 {
1848 <span class="keywordflow">if</span> (now &lt; Impacts[i].when)
1849 <span class="keywordflow">continue</span>;
1850
1851 <span class="comment">// create smoke particle system</span>
1852 IParticleSystemSceneNode* pas = 0;
1853
1854 <span class="keywordflow">for</span> ( g = 0; g != 2; ++g )
1855 {
1856 pas = sm-&gt;addParticleSystemSceneNode(<span class="keyword">false</span>, BulletParent, -1, Impacts[i].pos);
1857
1858 snprintf ( buf, 64, <span class="stringliteral">&quot;bullet impact smoke at %.1f,%.1f,%1.f&quot;</span>,
1859 Impacts[i].pos.X,Impacts[i].pos.Y,Impacts[i].pos.Z);
1860 pas-&gt;setName ( buf );
1861
1862 <span class="comment">// create a flat smoke</span>
1863 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> direction = Impacts[i].outVector;
1864 direction *= smoke[g].scale;
1865 IParticleEmitter* em = pas-&gt;createBoxEmitter(
1866 aabbox3d&lt;f32&gt;(-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-&gt;setMinStartSize (dimension2d&lt;f32&gt;( smoke[g].minparticleSize, smoke[g].minparticleSize));
1872 em-&gt;setMaxStartSize (dimension2d&lt;f32&gt;( smoke[g].maxparticleSize, smoke[g].maxparticleSize));
1873
1874 pas-&gt;setEmitter(em);
1875 em-&gt;drop();
1876
1877 <span class="comment">// particles get invisible</span>
1878 IParticleAffector* paf = pas-&gt;createFadeOutParticleAffector(
1879 video::SColor ( 0, 0, 0, 0 ), smoke[g].fadeout);
1880 pas-&gt;addAffector(paf);
1881 paf-&gt;drop();
1882
1883 <span class="comment">// particle system life time</span>
1884 ISceneNodeAnimator* anim = sm-&gt;createDeleteAnimator( smoke[g].lifetime);
1885 pas-&gt;addAnimator(anim);
1886 anim-&gt;drop();
1887
1888 pas-&gt;setMaterialFlag(<a class="code" href="namespaceirr_1_1video.html#a8a3bc00ae8137535b9fbc5f40add70d3acea597a2692b8415486a464a7f954d34" title="Will this material be lighted? Default: true.">video::EMF_LIGHTING</a>, <span class="keyword">false</span>);
1889 pas-&gt;setMaterialFlag(<a class="code" href="namespaceirr_1_1video.html#a8a3bc00ae8137535b9fbc5f40add70d3a4bc03b7b9dd19e577bf909313ea62510" title="May be written to the zbuffer or is it readonly. Default: true.">video::EMF_ZWRITE_ENABLE</a>, <span class="keyword">false</span>);
1890 pas-&gt;setMaterialType(<a class="code" href="namespaceirr_1_1video.html#ac8e9b6c66f7cebabd1a6d30cbc5430f1a1b5a814c4466aca2943ff056003a50d1" title="A transparent material.">video::EMT_TRANSPARENT_ADD_COLOR</a> );
1891 pas-&gt;setMaterialTexture(0, Game-&gt;Device-&gt;getVideoDriver()-&gt;getTexture( smoke[g].texture ));
1892 }
1893
1894
1895 <span class="comment">// play impact sound</span>
1896<span class="preprocessor"> #ifdef USE_IRRKLANG</span>
1897</pre></div><p>if (irrKlang) { audio::ISound* sound = irrKlang-&gt;play3D(impactSound, Impacts[i].pos, false, false, true);</p>
1898<p>if (sound) { adjust max value a bit to make to sound of an impact louder sound-&gt;setMinDistance(400); sound-&gt;drop(); } } </p>
1899<div class="fragment"><pre class="fragment"><span class="preprocessor"> #endif</span>
1900<span class="preprocessor"></span>
1901
1902 <span class="comment">// delete entry</span>
1903 Impacts.erase(i);
1904 i--;
1905 }
1906}
1907</pre></div><p>render </p>
1908<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> CQuake3EventHandler::Render()
1909{
1910 IVideoDriver * driver = Game-&gt;Device-&gt;getVideoDriver();
1911 <span class="keywordflow">if</span> ( 0 == driver )
1912 <span class="keywordflow">return</span>;
1913
1914 <span class="comment">// TODO: This does not work, yet.</span>
1915 <span class="keyword">const</span> <span class="keywordtype">bool</span> anaglyph=<span class="keyword">false</span>;
1916 <span class="keywordflow">if</span> (anaglyph)
1917 {
1918 scene::ICameraSceneNode* cameraOld = Game-&gt;Device-&gt;getSceneManager()-&gt;getActiveCamera();
1919 driver-&gt;beginScene(<span class="keyword">true</span>, <span class="keyword">true</span>, SColor(0,0,0,0));
1920 driver-&gt;getOverrideMaterial().Material.ColorMask = <a class="code" href="namespaceirr_1_1video.html#aa9f25191ae536c1a4b08ec5334866a21aa5afe366b19c967f884d0bd4ca083df9" title="No color enabled.">ECP_NONE</a>;
1921 driver-&gt;getOverrideMaterial().EnableFlags = <a class="code" href="namespaceirr_1_1video.html#a8a3bc00ae8137535b9fbc5f40add70d3a72ede4598946d81f12aa407fb680fc40" title="ColorMask bits, for enabling the color planes.">EMF_COLOR_MASK</a>;
1922 driver-&gt;getOverrideMaterial().EnablePasses = <a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fac41f4cb4900e84b9e55462089d0e3cb8" title="This is used for sky boxes.">ESNRP_SKY_BOX</a> +
1923 <a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fad058b020ab42ad745cc03fe379148e1f" title="Solid scene nodes or special scene nodes without materials.">ESNRP_SOLID</a> +
1924 <a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fad3a1300505d0ab06133e25256b893b2b" title="Transparent scene nodes, drawn after solid nodes. They are sorted from back to front and drawn in tha...">ESNRP_TRANSPARENT</a> +
1925 <a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fa3d134d3f703e328ab5798e5ff4a5c186" title="Transparent effect scene nodes, drawn after Transparent nodes. They are sorted from back to front and...">ESNRP_TRANSPARENT_EFFECT</a> +
1926 <a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fadbc7353e3092974abaa4d063faa22421" title="Drawn after the solid nodes, before the transparent nodes, the time for drawing shadow volumes...">ESNRP_SHADOW</a>;
1927 Game-&gt;Device-&gt;getSceneManager()-&gt;drawAll();
1928 driver-&gt;clearZBuffer();
1929
1930 <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> oldPosition = cameraOld-&gt;getPosition();
1931 <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> oldTarget = cameraOld-&gt;getTarget();
1932 <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1core.html#a73fa92e638c5ca97efd72da307cc9b65" title="Typedef for f32 matrix.">matrix4</a> startMatrix = cameraOld-&gt;getAbsoluteTransformation();
1933 <span class="keyword">const</span> <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> focusPoint = (oldTarget -
1934 cameraOld-&gt;getAbsolutePosition()).setLength(10000) +
1935 cameraOld-&gt;getAbsolutePosition() ;
1936
1937 scene::ICameraSceneNode* camera = cameraOld;<span class="comment">//Game-&gt;Device-&gt;getSceneManager()-&gt;addCameraSceneNode();</span>
1938
1939 <span class="comment">//Left eye...</span>
1940 <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a> pos;
1941 <a class="code" href="namespaceirr_1_1core.html#a73fa92e638c5ca97efd72da307cc9b65" title="Typedef for f32 matrix.">matrix4</a> move;
1942
1943 move.setTranslation( <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a>(-1.5f,0.0f,0.0f) );
1944 pos=(startMatrix*move).getTranslation();
1945
1946 driver-&gt;getOverrideMaterial().Material.ColorMask = <a class="code" href="namespaceirr_1_1video.html#aa9f25191ae536c1a4b08ec5334866a21a36263a436337ff10be86fc9b5ae2f6d0" title="Red enabled.">ECP_RED</a>;
1947 driver-&gt;getOverrideMaterial().EnableFlags = <a class="code" href="namespaceirr_1_1video.html#a8a3bc00ae8137535b9fbc5f40add70d3a72ede4598946d81f12aa407fb680fc40" title="ColorMask bits, for enabling the color planes.">EMF_COLOR_MASK</a>;
1948 driver-&gt;getOverrideMaterial().EnablePasses =
1949 <a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fac41f4cb4900e84b9e55462089d0e3cb8" title="This is used for sky boxes.">ESNRP_SKY_BOX</a>|<a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fad058b020ab42ad745cc03fe379148e1f" title="Solid scene nodes or special scene nodes without materials.">ESNRP_SOLID</a>|<a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fad3a1300505d0ab06133e25256b893b2b" title="Transparent scene nodes, drawn after solid nodes. They are sorted from back to front and drawn in tha...">ESNRP_TRANSPARENT</a>|
1950 <a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fa3d134d3f703e328ab5798e5ff4a5c186" title="Transparent effect scene nodes, drawn after Transparent nodes. They are sorted from back to front and...">ESNRP_TRANSPARENT_EFFECT</a>|<a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fadbc7353e3092974abaa4d063faa22421" title="Drawn after the solid nodes, before the transparent nodes, the time for drawing shadow volumes...">ESNRP_SHADOW</a>;
1951
1952 camera-&gt;setPosition(pos);
1953 camera-&gt;setTarget(focusPoint);
1954
1955 Game-&gt;Device-&gt;getSceneManager()-&gt;drawAll();
1956 driver-&gt;clearZBuffer();
1957
1958 <span class="comment">//Right eye...</span>
1959 move.setTranslation( <a class="code" href="namespaceirr_1_1core.html#a06f169d08b5c429f5575acb7edbad811" title="Typedef for a f32 3d vector.">vector3df</a>(1.5f,0.0f,0.0f) );
1960 pos=(startMatrix*move).getTranslation();
1961
1962 driver-&gt;getOverrideMaterial().Material.ColorMask = <a class="code" href="namespaceirr_1_1video.html#aa9f25191ae536c1a4b08ec5334866a21a1e712fd8781a461da6f0a293a3e7180f" title="Green enabled.">ECP_GREEN</a> + <a class="code" href="namespaceirr_1_1video.html#aa9f25191ae536c1a4b08ec5334866a21a31e270dab7c29a6e642ac491b172d16d" title="Blue enabled.">ECP_BLUE</a>;
1963 driver-&gt;getOverrideMaterial().EnableFlags = <a class="code" href="namespaceirr_1_1video.html#a8a3bc00ae8137535b9fbc5f40add70d3a72ede4598946d81f12aa407fb680fc40" title="ColorMask bits, for enabling the color planes.">EMF_COLOR_MASK</a>;
1964 driver-&gt;getOverrideMaterial().EnablePasses =
1965 <a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fac41f4cb4900e84b9e55462089d0e3cb8" title="This is used for sky boxes.">ESNRP_SKY_BOX</a>|<a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fad058b020ab42ad745cc03fe379148e1f" title="Solid scene nodes or special scene nodes without materials.">ESNRP_SOLID</a>|<a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fad3a1300505d0ab06133e25256b893b2b" title="Transparent scene nodes, drawn after solid nodes. They are sorted from back to front and drawn in tha...">ESNRP_TRANSPARENT</a>|
1966 <a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fa3d134d3f703e328ab5798e5ff4a5c186" title="Transparent effect scene nodes, drawn after Transparent nodes. They are sorted from back to front and...">ESNRP_TRANSPARENT_EFFECT</a>|<a class="code" href="namespaceirr_1_1scene.html#a7862269bd1abc123929d4dbb8200d67fadbc7353e3092974abaa4d063faa22421" title="Drawn after the solid nodes, before the transparent nodes, the time for drawing shadow volumes...">ESNRP_SHADOW</a>;
1967
1968 camera-&gt;setPosition(pos);
1969 camera-&gt;setTarget(focusPoint);
1970
1971 Game-&gt;Device-&gt;getSceneManager()-&gt;drawAll();
1972
1973 driver-&gt;getOverrideMaterial().Material.ColorMask=<a class="code" href="namespaceirr_1_1video.html#aa9f25191ae536c1a4b08ec5334866a21a674ec773096b1b504b38ed78213e1e38" title="All planes enabled.">ECP_ALL</a>;
1974 driver-&gt;getOverrideMaterial().EnableFlags=0;
1975 driver-&gt;getOverrideMaterial().EnablePasses=0;
1976
1977 <span class="keywordflow">if</span> (camera != cameraOld)
1978 {
1979 Game-&gt;Device-&gt;getSceneManager()-&gt;setActiveCamera(cameraOld);
1980 camera-&gt;remove();
1981 }
1982 <span class="keywordflow">else</span>
1983 {
1984 camera-&gt;setPosition(oldPosition);
1985 camera-&gt;setTarget(oldTarget);
1986 }
1987 }
1988 <span class="keywordflow">else</span>
1989 {
1990 driver-&gt;beginScene(<span class="keyword">true</span>, <span class="keyword">true</span>, SColor(0,0,0,0));
1991 Game-&gt;Device-&gt;getSceneManager()-&gt;drawAll();
1992 }
1993 Game-&gt;Device-&gt;getGUIEnvironment()-&gt;drawAll();
1994 driver-&gt;endScene();
1995}
1996</pre></div><p>update the generic scene node </p>
1997<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> CQuake3EventHandler::Animate()
1998{
1999 <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> now = Game-&gt;Device-&gt;getTimer()-&gt;getTime();
2000
2001 Q3Player * player = Player + 0;
2002
2003 checkTimeFire ( player-&gt;Anim, 4, now );
2004
2005 <span class="comment">// Query Scene Manager attributes</span>
2006 <span class="keywordflow">if</span> ( player-&gt;Anim[0].flags &amp; FIRED )
2007 {
2008 ISceneManager *smgr = Game-&gt;Device-&gt;getSceneManager ();
2009 <span class="keywordtype">wchar_t</span> msg[128];
2010 IVideoDriver * driver = Game-&gt;Device-&gt;getVideoDriver();
2011
2012 IAttributes * attr = smgr-&gt;getParameters();
2013<span class="preprocessor">#ifdef _IRR_SCENEMANAGER_DEBUG </span>
2014<span class="preprocessor"></span> swprintf ( msg, 128,
2015 L<span class="stringliteral">&quot;Q3 %s [%ls], FPS:%03d Tri:%.03fm Cull %d/%d nodes (%d,%d,%d)&quot;</span>,
2016 Game-&gt;CurrentMapName.c_str(),
2017 driver-&gt;getName(),
2018 driver-&gt;getFPS (),
2019 (<a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a>) driver-&gt;getPrimitiveCountDrawn( 0 ) * ( 1.f / 1000000.f ),
2020 attr-&gt;getAttributeAsInt ( <span class="stringliteral">&quot;culled&quot;</span> ),
2021 attr-&gt;getAttributeAsInt ( <span class="stringliteral">&quot;calls&quot;</span> ),
2022 attr-&gt;getAttributeAsInt ( <span class="stringliteral">&quot;drawn_solid&quot;</span> ),
2023 attr-&gt;getAttributeAsInt ( <span class="stringliteral">&quot;drawn_transparent&quot;</span> ),
2024 attr-&gt;getAttributeAsInt ( <span class="stringliteral">&quot;drawn_transparent_effect&quot;</span> )
2025 );
2026<span class="preprocessor">#else</span>
2027<span class="preprocessor"></span>swprintf ( msg, 128,
2028 L<span class="stringliteral">&quot;Q3 %s [%ls], FPS:%03d Tri:%.03fm&quot;</span>,
2029 Game-&gt;CurrentMapName.c_str(),
2030 driver-&gt;getName(),
2031 driver-&gt;getFPS (),
2032 (<a class="code" href="namespaceirr.html#a0277be98d67dc26ff93b1a6a1d086b07" title="32 bit floating point variable.">f32</a>) driver-&gt;getPrimitiveCountDrawn( 0 ) * ( 1.f / 1000000.f )
2033 );
2034<span class="preprocessor">#endif </span>
2035<span class="preprocessor"></span> Game-&gt;Device-&gt;setWindowCaption( msg );
2036
2037 swprintf ( msg, 128,
2038 L<span class="stringliteral">&quot;%03d fps, F1 GUI on/off, F2 respawn, F3-F6 toggle Nodes, F7 Collision on/off&quot;</span>
2039 L<span class="stringliteral">&quot;, F8 Gravity on/off, Right Mouse Toggle GUI&quot;</span>,
2040 Game-&gt;Device-&gt;getVideoDriver()-&gt;getFPS ()
2041 );
2042 <span class="keywordflow">if</span> ( gui.StatusLine )
2043 gui.StatusLine-&gt;setText ( msg );
2044 player-&gt;Anim[0].flags &amp;= ~FIRED;
2045 }
2046
2047 <span class="comment">// idle..</span>
2048 <span class="keywordflow">if</span> ( player-&gt;Anim[1].flags &amp; FIRED )
2049 {
2050 <span class="keywordflow">if</span> ( strcmp ( player-&gt;animation, <span class="stringliteral">&quot;idle&quot;</span> ) )
2051 player-&gt;setAnim ( <span class="stringliteral">&quot;idle&quot;</span> );
2052
2053 player-&gt;Anim[1].flags &amp;= ~FIRED;
2054 }
2055
2056 createParticleImpacts ( now );
2057
2058}
2059</pre></div><p> The main game states </p>
2060<div class="fragment"><pre class="fragment"><span class="keywordtype">void</span> runGame ( GameData *game )
2061{
2062 <span class="keywordflow">if</span> ( game-&gt;retVal &gt;= 3 )
2063 <span class="keywordflow">return</span>;
2064
2065 game-&gt;Device = (*game-&gt;createExDevice) ( game-&gt;deviceParam );
2066 <span class="keywordflow">if</span> ( 0 == game-&gt;Device)
2067 {
2068 <span class="comment">// could not create selected driver.</span>
2069 game-&gt;retVal = 0;
2070 <span class="keywordflow">return</span>;
2071 }
2072
2073 <span class="comment">// create an event receiver based on current game data</span>
2074 CQuake3EventHandler *eventHandler = <span class="keyword">new</span> CQuake3EventHandler( game );
2075
2076 <span class="comment">// load stored config</span>
2077 game-&gt;load ( <span class="stringliteral">&quot;explorer.cfg&quot;</span> );
2078
2079 <span class="comment">// add our media directory and archive to the file system</span>
2080 <span class="keywordflow">for</span> ( <a class="code" href="namespaceirr.html#a0416a53257075833e7002efd0a18e804" title="32 bit unsigned variable.">u32</a> i = 0; i &lt; game-&gt;CurrentArchiveList.size(); ++i )
2081 {
2082 eventHandler-&gt;AddArchive ( game-&gt;CurrentArchiveList[i] );
2083 }
2084
2085 <span class="comment">// Load a Map or startup to the GUI</span>
2086 <span class="keywordflow">if</span> ( game-&gt;CurrentMapName.size () )
2087 {
2088 eventHandler-&gt;LoadMap ( game-&gt;CurrentMapName, 1 );
2089 <span class="keywordflow">if</span> ( 0 == game-&gt;loadParam.loadSkyShader )
2090 eventHandler-&gt;AddSky ( 1, <span class="stringliteral">&quot;skydome2&quot;</span> );
2091 eventHandler-&gt;CreatePlayers ();
2092 eventHandler-&gt;CreateGUI ();
2093 eventHandler-&gt;SetGUIActive ( 0 );
2094
2095 <span class="comment">// set player to last position on restart</span>
2096 <span class="keywordflow">if</span> ( game-&gt;retVal == 2 )
2097 {
2098 eventHandler-&gt;GetPlayer( 0 )-&gt;setpos ( game-&gt;PlayerPosition, game-&gt;PlayerRotation );
2099 }
2100 }
2101 <span class="keywordflow">else</span>
2102 {
2103 <span class="comment">// start up empty</span>
2104 eventHandler-&gt;AddSky ( 1, <span class="stringliteral">&quot;skydome2&quot;</span> );
2105 eventHandler-&gt;CreatePlayers ();
2106 eventHandler-&gt;CreateGUI ();
2107 eventHandler-&gt;SetGUIActive ( 1 );
2108 background_music ( <span class="stringliteral">&quot;IrrlichtTheme.ogg&quot;</span> );
2109 }
2110
2111
2112 game-&gt;retVal = 3;
2113 <span class="keywordflow">while</span>( game-&gt;Device-&gt;run() )
2114 {
2115 eventHandler-&gt;Animate ();
2116 eventHandler-&gt;Render ();
2117 <span class="comment">//if ( !game-&gt;Device-&gt;isWindowActive() )</span>
2118 game-&gt;Device-&gt;yield();
2119 }
2120
2121 game-&gt;Device-&gt;setGammaRamp ( 1.f, 1.f, 1.f, 0.f, 0.f );
2122 <span class="keyword">delete</span> eventHandler;
2123}
2124
2125<span class="preprocessor">#if defined (_IRR_WINDOWS_) &amp;&amp; 0</span>
2126<span class="preprocessor"></span><span class="preprocessor"> #pragma comment(linker, &quot;/subsystem:windows /ENTRY:mainCRTStartup&quot;)</span>
2127<span class="preprocessor">#endif</span>
2128</pre></div><p> The main routine, doing all setup </p>
2129<div class="fragment"><pre class="fragment"><span class="keywordtype">int</span> <a class="code" href="_irr_compile_config_8h.html#a3f9bf2240c47d3f99b86f83f9123aa9d">IRRCALLCONV</a> main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span>* argv[])
2130{
2131 <a class="code" href="namespaceirr_1_1io.html#ab1bdc45edb3f94d8319c02bc0f840ee1" title="Type used for all file system related strings.">path</a> prgname(argv[0]);
2132 GameData game ( <a class="code" href="namespaceirr_1_1core.html#a9215d20e34c12cb6c1522366389bfcce" title="trim paths">deletePathFromPath</a> ( prgname, 1 ) );
2133
2134 <span class="comment">// dynamically load irrlicht</span>
2135 <span class="keyword">const</span> <a class="code" href="namespaceirr.html#a9395eaea339bcb546b319e9c96bf7410" title="8 bit character variable.">c8</a> * dllName = argc &gt; 1 ? argv[1] : <span class="stringliteral">&quot;irrlicht.dll&quot;</span>;
2136 game.createExDevice = load_createDeviceEx ( dllName );
2137 <span class="keywordflow">if</span> ( 0 == game.createExDevice )
2138 {
2139 game.retVal = 3;
2140 printf ( <span class="stringliteral">&quot;Could not load %s.\n&quot;</span>, dllName );
2141 <span class="keywordflow">return</span> game.retVal; <span class="comment">// could not load dll</span>
2142 }
2143
2144 <span class="comment">// start without asking for driver</span>
2145 game.retVal = 1;
2146 <span class="keywordflow">do</span>
2147 {
2148 <span class="comment">// if driver could not created, ask for another driver</span>
2149 <span class="keywordflow">if</span> ( game.retVal == 0 )
2150 {
2151 game.setDefault ();
2152 <span class="comment">// ask user for driver</span>
2153 game.deviceParam.DriverType=driverChoiceConsole();
2154 <span class="keywordflow">if</span> (game.deviceParam.DriverType==<a class="code" href="namespaceirr_1_1video.html#ae35a6de6d436c76107ad157fe42356d0ae685cada50f8c100403134d932d0414c" title="No driver, just for counting the elements.">video::EDT_COUNT</a>)
2155 game.retVal = 3;
2156 }
2157 runGame ( &amp;game );
2158 } <span class="keywordflow">while</span> ( game.retVal &lt; 3 );
2159
2160 <span class="keywordflow">return</span> game.retVal;
2161}
2162</pre></div> </div></div>
2163</div>
2164 <div id="nav-path" class="navpath">
2165 <ul>
2166<!-- window showing the filter options -->
2167<div id="MSearchSelectWindow"
2168 onmouseover="return searchBox.OnSearchSelectShow()"
2169 onmouseout="return searchBox.OnSearchSelectHide()"
2170 onkeydown="return searchBox.OnSearchSelectKey(event)">
2171<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>
2172
2173<!-- iframe showing the search results (closed by default) -->
2174<div id="MSearchResultsWindow">
2175<iframe src="javascript:void(0)" frameborder="0"
2176 name="MSearchResults" id="MSearchResults">
2177</iframe>
2178</div>
2179
2180
2181 <li class="footer">
2182<a href="http://irrlicht.sourceforge.net" target="_blank">Irrlicht
2183Engine</a> Documentation &copy; 2003-2012 by Nikolaus Gebhardt. Generated on Sun Nov 17 2013 20:18:41 for Irrlicht 3D Engine by
2184<a href="http://www.doxygen.org/index.html" target="_blank">Doxygen</a> 1.7.5.1 </li>
2185 </ul>
2186 </div>
2187
2188
2189</body>
2190</html>