aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/examples/21.Quake3Explorer/q3factory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/irrlicht-1.8/examples/21.Quake3Explorer/q3factory.cpp')
-rw-r--r--libraries/irrlicht-1.8/examples/21.Quake3Explorer/q3factory.cpp1648
1 files changed, 824 insertions, 824 deletions
diff --git a/libraries/irrlicht-1.8/examples/21.Quake3Explorer/q3factory.cpp b/libraries/irrlicht-1.8/examples/21.Quake3Explorer/q3factory.cpp
index d0f09b2..fc95a1d 100644
--- a/libraries/irrlicht-1.8/examples/21.Quake3Explorer/q3factory.cpp
+++ b/libraries/irrlicht-1.8/examples/21.Quake3Explorer/q3factory.cpp
@@ -1,824 +1,824 @@
1/*! 1/*!
2 Model Factory. 2 Model Factory.
3 create the additional scenenodes for ( bullets, health... ) 3 create the additional scenenodes for ( bullets, health... )
4 4
5 Defines the Entities for Quake3 5 Defines the Entities for Quake3
6*/ 6*/
7 7
8#include <irrlicht.h> 8#include <irrlicht.h>
9#include "q3factory.h" 9#include "q3factory.h"
10#include "sound.h" 10#include "sound.h"
11 11
12using namespace irr; 12using namespace irr;
13using namespace scene; 13using namespace scene;
14using namespace gui; 14using namespace gui;
15using namespace video; 15using namespace video;
16using namespace core; 16using namespace core;
17using namespace quake3; 17using namespace quake3;
18 18
19//! This list is based on the original quake3. 19//! This list is based on the original quake3.
20static const SItemElement Quake3ItemElement [] = { 20static const SItemElement Quake3ItemElement [] = {
21{ "item_health", 21{ "item_health",
22 {"models/powerups/health/medium_cross.md3", 22 {"models/powerups/health/medium_cross.md3",
23 "models/powerups/health/medium_sphere.md3"}, 23 "models/powerups/health/medium_sphere.md3"},
24 "sound/items/n_health.wav", 24 "sound/items/n_health.wav",
25 "icons/iconh_yellow", 25 "icons/iconh_yellow",
26 "25 Health", 26 "25 Health",
27 25, 27 25,
28 HEALTH, 28 HEALTH,
29 SUB_NONE, 29 SUB_NONE,
30 SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1 30 SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1
31}, 31},
32{ "item_health_large", 32{ "item_health_large",
33 "models/powerups/health/large_cross.md3", 33 "models/powerups/health/large_cross.md3",
34 "models/powerups/health/large_sphere.md3", 34 "models/powerups/health/large_sphere.md3",
35 "sound/items/l_health.wav", 35 "sound/items/l_health.wav",
36 "icons/iconh_red", 36 "icons/iconh_red",
37 "50 Health", 37 "50 Health",
38 50, 38 50,
39 HEALTH, 39 HEALTH,
40 SUB_NONE, 40 SUB_NONE,
41 SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1 41 SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1
42}, 42},
43{ 43{
44 "item_health_mega", 44 "item_health_mega",
45 "models/powerups/health/mega_cross.md3", 45 "models/powerups/health/mega_cross.md3",
46 "models/powerups/health/mega_sphere.md3", 46 "models/powerups/health/mega_sphere.md3",
47 "sound/items/m_health.wav", 47 "sound/items/m_health.wav",
48 "icons/iconh_mega", 48 "icons/iconh_mega",
49 "Mega Health", 49 "Mega Health",
50 100, 50 100,
51 HEALTH, 51 HEALTH,
52 SUB_NONE, 52 SUB_NONE,
53 SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1 53 SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1
54}, 54},
55{ 55{
56 "item_health_small", 56 "item_health_small",
57 "models/powerups/health/small_cross.md3", 57 "models/powerups/health/small_cross.md3",
58 "models/powerups/health/small_sphere.md3", 58 "models/powerups/health/small_sphere.md3",
59 "sound/items/s_health.wav", 59 "sound/items/s_health.wav",
60 "icons/iconh_green", 60 "icons/iconh_green",
61 "5 Health", 61 "5 Health",
62 5, 62 5,
63 HEALTH, 63 HEALTH,
64 SUB_NONE, 64 SUB_NONE,
65 SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1 65 SPECIAL_SFX_BOUNCE | SPECIAL_SFX_ROTATE_1
66}, 66},
67{ "ammo_bullets", 67{ "ammo_bullets",
68 "models/powerups/ammo/machinegunam.md3", 68 "models/powerups/ammo/machinegunam.md3",
69 "", 69 "",
70 "sound/misc/am_pkup.wav", 70 "sound/misc/am_pkup.wav",
71 "icons/icona_machinegun", 71 "icons/icona_machinegun",
72 "Bullets", 72 "Bullets",
73 50, 73 50,
74 AMMO, 74 AMMO,
75 MACHINEGUN, 75 MACHINEGUN,
76 SPECIAL_SFX_BOUNCE, 76 SPECIAL_SFX_BOUNCE,
77}, 77},
78{ 78{
79 "ammo_cells", 79 "ammo_cells",
80 "models/powerups/ammo/plasmaam.md3", 80 "models/powerups/ammo/plasmaam.md3",
81 "", 81 "",
82 "sound/misc/am_pkup.wav", 82 "sound/misc/am_pkup.wav",
83 "icons/icona_plasma", 83 "icons/icona_plasma",
84 "Cells", 84 "Cells",
85 30, 85 30,
86 AMMO, 86 AMMO,
87 PLASMAGUN, 87 PLASMAGUN,
88 SPECIAL_SFX_BOUNCE 88 SPECIAL_SFX_BOUNCE
89}, 89},
90{ "ammo_rockets", 90{ "ammo_rockets",
91 "models/powerups/ammo/rocketam.md3", 91 "models/powerups/ammo/rocketam.md3",
92 "", 92 "",
93 "", 93 "",
94 "icons/icona_rocket", 94 "icons/icona_rocket",
95 "Rockets", 95 "Rockets",
96 5, 96 5,
97 AMMO, 97 AMMO,
98 ROCKET_LAUNCHER, 98 ROCKET_LAUNCHER,
99 SPECIAL_SFX_ROTATE 99 SPECIAL_SFX_ROTATE
100}, 100},
101{ 101{
102 "ammo_shells", 102 "ammo_shells",
103 "models/powerups/ammo/shotgunam.md3", 103 "models/powerups/ammo/shotgunam.md3",
104 "", 104 "",
105 "sound/misc/am_pkup.wav", 105 "sound/misc/am_pkup.wav",
106 "icons/icona_shotgun", 106 "icons/icona_shotgun",
107 "Shells", 107 "Shells",
108 10, 108 10,
109 AMMO, 109 AMMO,
110 SHOTGUN, 110 SHOTGUN,
111 SPECIAL_SFX_ROTATE 111 SPECIAL_SFX_ROTATE
112}, 112},
113{ 113{
114 "ammo_slugs", 114 "ammo_slugs",
115 "models/powerups/ammo/railgunam.md3", 115 "models/powerups/ammo/railgunam.md3",
116 "", 116 "",
117 "sound/misc/am_pkup.wav", 117 "sound/misc/am_pkup.wav",
118 "icons/icona_railgun", 118 "icons/icona_railgun",
119 "Slugs", 119 "Slugs",
120 10, 120 10,
121 AMMO, 121 AMMO,
122 RAILGUN, 122 RAILGUN,
123 SPECIAL_SFX_ROTATE 123 SPECIAL_SFX_ROTATE
124}, 124},
125{ 125{
126 "item_armor_body", 126 "item_armor_body",
127 "models/powerups/armor/armor_red.md3", 127 "models/powerups/armor/armor_red.md3",
128 "", 128 "",
129 "sound/misc/ar2_pkup.wav", 129 "sound/misc/ar2_pkup.wav",
130 "icons/iconr_red", 130 "icons/iconr_red",
131 "Heavy Armor", 131 "Heavy Armor",
132 100, 132 100,
133 ARMOR, 133 ARMOR,
134 SUB_NONE, 134 SUB_NONE,
135 SPECIAL_SFX_ROTATE 135 SPECIAL_SFX_ROTATE
136}, 136},
137{ 137{
138 "item_armor_combat", 138 "item_armor_combat",
139 "models/powerups/armor/armor_yel.md3", 139 "models/powerups/armor/armor_yel.md3",
140 "", 140 "",
141 "sound/misc/ar2_pkup.wav", 141 "sound/misc/ar2_pkup.wav",
142 "icons/iconr_yellow", 142 "icons/iconr_yellow",
143 "Armor", 143 "Armor",
144 50, 144 50,
145 ARMOR, 145 ARMOR,
146 SUB_NONE, 146 SUB_NONE,
147 SPECIAL_SFX_ROTATE 147 SPECIAL_SFX_ROTATE
148}, 148},
149{ 149{
150 "item_armor_shard", 150 "item_armor_shard",
151 "models/powerups/armor/shard.md3", 151 "models/powerups/armor/shard.md3",
152 "", 152 "",
153 "sound/misc/ar1_pkup.wav", 153 "sound/misc/ar1_pkup.wav",
154 "icons/iconr_shard", 154 "icons/iconr_shard",
155 "Armor Shared", 155 "Armor Shared",
156 5, 156 5,
157 ARMOR, 157 ARMOR,
158 SUB_NONE, 158 SUB_NONE,
159 SPECIAL_SFX_ROTATE 159 SPECIAL_SFX_ROTATE
160}, 160},
161{ 161{
162 "weapon_gauntlet", 162 "weapon_gauntlet",
163 "models/weapons2/gauntlet/gauntlet.md3", 163 "models/weapons2/gauntlet/gauntlet.md3",
164 "", 164 "",
165 "sound/misc/w_pkup.wav", 165 "sound/misc/w_pkup.wav",
166 "icons/iconw_gauntlet", 166 "icons/iconw_gauntlet",
167 "Gauntlet", 167 "Gauntlet",
168 0, 168 0,
169 WEAPON, 169 WEAPON,
170 GAUNTLET, 170 GAUNTLET,
171 SPECIAL_SFX_ROTATE 171 SPECIAL_SFX_ROTATE
172}, 172},
173{ 173{
174 "weapon_shotgun", 174 "weapon_shotgun",
175 "models/weapons2/shotgun/shotgun.md3", 175 "models/weapons2/shotgun/shotgun.md3",
176 "", 176 "",
177 "sound/misc/w_pkup.wav", 177 "sound/misc/w_pkup.wav",
178 "icons/iconw_shotgun", 178 "icons/iconw_shotgun",
179 "Shotgun", 179 "Shotgun",
180 10, 180 10,
181 WEAPON, 181 WEAPON,
182 SHOTGUN, 182 SHOTGUN,
183 SPECIAL_SFX_ROTATE 183 SPECIAL_SFX_ROTATE
184}, 184},
185{ 185{
186 "weapon_machinegun", 186 "weapon_machinegun",
187 "models/weapons2/machinegun/machinegun.md3", 187 "models/weapons2/machinegun/machinegun.md3",
188 "", 188 "",
189 "sound/misc/w_pkup.wav", 189 "sound/misc/w_pkup.wav",
190 "icons/iconw_machinegun", 190 "icons/iconw_machinegun",
191 "Machinegun", 191 "Machinegun",
192 40, 192 40,
193 WEAPON, 193 WEAPON,
194 MACHINEGUN, 194 MACHINEGUN,
195 SPECIAL_SFX_ROTATE 195 SPECIAL_SFX_ROTATE
196}, 196},
197{ 197{
198 "weapon_grenadelauncher", 198 "weapon_grenadelauncher",
199 "models/weapons2/grenadel/grenadel.md3", 199 "models/weapons2/grenadel/grenadel.md3",
200 "", 200 "",
201 "sound/misc/w_pkup.wav", 201 "sound/misc/w_pkup.wav",
202 "icons/iconw_grenade", 202 "icons/iconw_grenade",
203 "Grenade Launcher", 203 "Grenade Launcher",
204 10, 204 10,
205 WEAPON, 205 WEAPON,
206 GRENADE_LAUNCHER, 206 GRENADE_LAUNCHER,
207 SPECIAL_SFX_ROTATE 207 SPECIAL_SFX_ROTATE
208}, 208},
209{ 209{
210 "weapon_rocketlauncher", 210 "weapon_rocketlauncher",
211 "models/weapons2/rocketl/rocketl.md3", 211 "models/weapons2/rocketl/rocketl.md3",
212 "", 212 "",
213 "sound/misc/w_pkup.wav", 213 "sound/misc/w_pkup.wav",
214 "icons/iconw_rocket", 214 "icons/iconw_rocket",
215 "Rocket Launcher", 215 "Rocket Launcher",
216 10, 216 10,
217 WEAPON, 217 WEAPON,
218 ROCKET_LAUNCHER, 218 ROCKET_LAUNCHER,
219 SPECIAL_SFX_ROTATE 219 SPECIAL_SFX_ROTATE
220}, 220},
221{ 221{
222 "weapon_lightning", 222 "weapon_lightning",
223 "models/weapons2/lightning/lightning.md3", 223 "models/weapons2/lightning/lightning.md3",
224 "", 224 "",
225 "sound/misc/w_pkup.wav", 225 "sound/misc/w_pkup.wav",
226 "icons/iconw_lightning", 226 "icons/iconw_lightning",
227 "Lightning Gun", 227 "Lightning Gun",
228 100, 228 100,
229 WEAPON, 229 WEAPON,
230 LIGHTNING, 230 LIGHTNING,
231 SPECIAL_SFX_ROTATE 231 SPECIAL_SFX_ROTATE
232}, 232},
233{ 233{
234 "weapon_railgun", 234 "weapon_railgun",
235 "models/weapons2/railgun/railgun.md3", 235 "models/weapons2/railgun/railgun.md3",
236 "", 236 "",
237 "sound/misc/w_pkup.wav", 237 "sound/misc/w_pkup.wav",
238 "icons/iconw_railgun", 238 "icons/iconw_railgun",
239 "Railgun", 239 "Railgun",
240 10, 240 10,
241 WEAPON, 241 WEAPON,
242 RAILGUN, 242 RAILGUN,
243 SPECIAL_SFX_ROTATE 243 SPECIAL_SFX_ROTATE
244}, 244},
245{ 245{
246 "weapon_plasmagun", 246 "weapon_plasmagun",
247 "models/weapons2/plasma/plasma.md3", 247 "models/weapons2/plasma/plasma.md3",
248 "", 248 "",
249 "sound/misc/w_pkup.wav", 249 "sound/misc/w_pkup.wav",
250 "icons/iconw_plasma", 250 "icons/iconw_plasma",
251 "Plasma Gun", 251 "Plasma Gun",
252 50, 252 50,
253 WEAPON, 253 WEAPON,
254 PLASMAGUN, 254 PLASMAGUN,
255 SPECIAL_SFX_ROTATE 255 SPECIAL_SFX_ROTATE
256}, 256},
257{ 257{
258 "weapon_bfg", 258 "weapon_bfg",
259 "models/weapons2/bfg/bfg.md3", 259 "models/weapons2/bfg/bfg.md3",
260 "", 260 "",
261 "sound/misc/w_pkup.wav", 261 "sound/misc/w_pkup.wav",
262 "icons/iconw_bfg", 262 "icons/iconw_bfg",
263 "BFG10K", 263 "BFG10K",
264 20, 264 20,
265 WEAPON, 265 WEAPON,
266 BFG, 266 BFG,
267 SPECIAL_SFX_ROTATE 267 SPECIAL_SFX_ROTATE
268}, 268},
269{ 269{
270 "weapon_grapplinghook", 270 "weapon_grapplinghook",
271 "models/weapons2/grapple/grapple.md3", 271 "models/weapons2/grapple/grapple.md3",
272 "", 272 "",
273 "sound/misc/w_pkup.wav", 273 "sound/misc/w_pkup.wav",
274 "icons/iconw_grapple", 274 "icons/iconw_grapple",
275 "Grappling Hook", 275 "Grappling Hook",
276 0, 276 0,
277 WEAPON, 277 WEAPON,
278 GRAPPLING_HOOK, 278 GRAPPLING_HOOK,
279 SPECIAL_SFX_ROTATE 279 SPECIAL_SFX_ROTATE
280}, 280},
281{ 281{
282 0 282 0
283} 283}
284 284
285}; 285};
286 286
287 287
288/*! 288/*!
289*/ 289*/
290const SItemElement * getItemElement ( const stringc& key ) 290const SItemElement * getItemElement ( const stringc& key )
291{ 291{
292 const SItemElement *item = Quake3ItemElement; 292 const SItemElement *item = Quake3ItemElement;
293 293
294 while ( item->key ) 294 while ( item->key )
295 { 295 {
296 if ( 0 == strcmp ( key.c_str(), item->key ) ) 296 if ( 0 == strcmp ( key.c_str(), item->key ) )
297 return item; 297 return item;
298 item += 1; 298 item += 1;
299 } 299 }
300 return 0; 300 return 0;
301} 301}
302 302
303/*! 303/*!
304 Quake3 Model Factory. 304 Quake3 Model Factory.
305 Takes the mesh buffers and creates scenenodes for their associated shaders 305 Takes the mesh buffers and creates scenenodes for their associated shaders
306*/ 306*/
307void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam, 307void Q3ShaderFactory ( Q3LevelLoadParameter &loadParam,
308 IrrlichtDevice *device, 308 IrrlichtDevice *device,
309 IQ3LevelMesh* mesh, 309 IQ3LevelMesh* mesh,
310 eQ3MeshIndex meshIndex, 310 eQ3MeshIndex meshIndex,
311 ISceneNode *parent, 311 ISceneNode *parent,
312 IMetaTriangleSelector *meta, 312 IMetaTriangleSelector *meta,
313 bool showShaderName ) 313 bool showShaderName )
314{ 314{
315 if ( 0 == mesh || 0 == device ) 315 if ( 0 == mesh || 0 == device )
316 return; 316 return;
317 317
318 IMeshSceneNode* node = 0; 318 IMeshSceneNode* node = 0;
319 ISceneManager* smgr = device->getSceneManager(); 319 ISceneManager* smgr = device->getSceneManager();
320 ITriangleSelector * selector = 0; 320 ITriangleSelector * selector = 0;
321 321
322 // the additional mesh can be quite huge and is unoptimized 322 // the additional mesh can be quite huge and is unoptimized
323 // Save to cast to SMesh 323 // Save to cast to SMesh
324 SMesh * additional_mesh = (SMesh*) mesh->getMesh ( meshIndex ); 324 SMesh * additional_mesh = (SMesh*) mesh->getMesh ( meshIndex );
325 if ( 0 == additional_mesh || additional_mesh->getMeshBufferCount() == 0) 325 if ( 0 == additional_mesh || additional_mesh->getMeshBufferCount() == 0)
326 return; 326 return;
327 327
328 char buf[128]; 328 char buf[128];
329 if ( loadParam.verbose > 0 ) 329 if ( loadParam.verbose > 0 )
330 { 330 {
331 loadParam.startTime = device->getTimer()->getRealTime(); 331 loadParam.startTime = device->getTimer()->getRealTime();
332 if ( loadParam.verbose > 1 ) 332 if ( loadParam.verbose > 1 )
333 { 333 {
334 snprintf(buf, 128, "q3shaderfactory start" ); 334 snprintf(buf, 128, "q3shaderfactory start" );
335 device->getLogger()->log( buf, ELL_INFORMATION); 335 device->getLogger()->log( buf, ELL_INFORMATION);
336 } 336 }
337 } 337 }
338 338
339 IGUIFont *font = 0; 339 IGUIFont *font = 0;
340 if ( showShaderName ) 340 if ( showShaderName )
341 font = device->getGUIEnvironment()->getFont("fontlucida.png"); 341 font = device->getGUIEnvironment()->getFont("fontlucida.png");
342 342
343 IVideoDriver *driver = device->getVideoDriver(); 343 IVideoDriver *driver = device->getVideoDriver();
344 344
345 // create helper textures 345 // create helper textures
346 if ( 1 ) 346 if ( 1 )
347 { 347 {
348 tTexArray tex; 348 tTexArray tex;
349 u32 pos = 0; 349 u32 pos = 0;
350 getTextures ( tex, "$redimage $blueimage $whiteimage $checkerimage", pos, 350 getTextures ( tex, "$redimage $blueimage $whiteimage $checkerimage", pos,
351 device->getFileSystem(), driver ); 351 device->getFileSystem(), driver );
352 } 352 }
353 353
354 s32 sceneNodeID = 0; 354 s32 sceneNodeID = 0;
355 for ( u32 i = 0; i!= additional_mesh->getMeshBufferCount (); ++i ) 355 for ( u32 i = 0; i!= additional_mesh->getMeshBufferCount (); ++i )
356 { 356 {
357 IMeshBuffer *meshBuffer = additional_mesh->getMeshBuffer ( i ); 357 IMeshBuffer *meshBuffer = additional_mesh->getMeshBuffer ( i );
358 const SMaterial &material = meshBuffer->getMaterial(); 358 const SMaterial &material = meshBuffer->getMaterial();
359 359
360 //! The ShaderIndex is stored in the second material parameter 360 //! The ShaderIndex is stored in the second material parameter
361 s32 shaderIndex = (s32) material.MaterialTypeParam2; 361 s32 shaderIndex = (s32) material.MaterialTypeParam2;
362 362
363 // the meshbuffer can be rendered without additional support, or it has no shader 363 // the meshbuffer can be rendered without additional support, or it has no shader
364 IShader *shader = (IShader *) mesh->getShader ( shaderIndex ); 364 IShader *shader = (IShader *) mesh->getShader ( shaderIndex );
365 365
366 // no shader, or mapped to existing material 366 // no shader, or mapped to existing material
367 if ( 0 == shader ) 367 if ( 0 == shader )
368 { 368 {
369 369
370#if 1 370#if 1
371 // clone mesh 371 // clone mesh
372 SMesh * m = new SMesh (); 372 SMesh * m = new SMesh ();
373 m->addMeshBuffer ( meshBuffer ); 373 m->addMeshBuffer ( meshBuffer );
374 SMaterial &mat = m->getMeshBuffer( 0 )->getMaterial(); 374 SMaterial &mat = m->getMeshBuffer( 0 )->getMaterial();
375 if ( mat.getTexture( 0 ) == 0 ) 375 if ( mat.getTexture( 0 ) == 0 )
376 mat.setTexture ( 0, driver->getTexture ( "$blueimage" ) ); 376 mat.setTexture ( 0, driver->getTexture ( "$blueimage" ) );
377 if ( mat.getTexture( 1 ) == 0 ) 377 if ( mat.getTexture( 1 ) == 0 )
378 mat.setTexture ( 1, driver->getTexture ( "$redimage" ) ); 378 mat.setTexture ( 1, driver->getTexture ( "$redimage" ) );
379 379
380 IMesh * store = smgr->getMeshManipulator ()->createMeshWith2TCoords ( m ); 380 IMesh * store = smgr->getMeshManipulator ()->createMeshWith2TCoords ( m );
381 m->drop(); 381 m->drop();
382 382
383 node = smgr->addMeshSceneNode ( store, parent, sceneNodeID ); 383 node = smgr->addMeshSceneNode ( store, parent, sceneNodeID );
384 node->setAutomaticCulling ( scene::EAC_OFF ); 384 node->setAutomaticCulling ( scene::EAC_OFF );
385 store->drop (); 385 store->drop ();
386 sceneNodeID += 1; 386 sceneNodeID += 1;
387#endif 387#endif
388 } 388 }
389 else if ( 1 ) 389 else if ( 1 )
390 { 390 {
391/* 391/*
392 stringc s; 392 stringc s;
393 dumpShader ( s, shader ); 393 dumpShader ( s, shader );
394 printf ( s.c_str () ); 394 printf ( s.c_str () );
395*/ 395*/
396 // create sceneNode 396 // create sceneNode
397 node = smgr->addQuake3SceneNode ( meshBuffer, shader, parent, sceneNodeID ); 397 node = smgr->addQuake3SceneNode ( meshBuffer, shader, parent, sceneNodeID );
398 node->setAutomaticCulling ( scene::EAC_FRUSTUM_BOX ); 398 node->setAutomaticCulling ( scene::EAC_FRUSTUM_BOX );
399 sceneNodeID += 1; 399 sceneNodeID += 1;
400 } 400 }
401 401
402 // show Debug Shader Name 402 // show Debug Shader Name
403 if ( showShaderName && node ) 403 if ( showShaderName && node )
404 { 404 {
405 swprintf ( (wchar_t*) buf, 64, L"%hs:%d", node->getName(),node->getID() ); 405 swprintf ( (wchar_t*) buf, 64, L"%hs:%d", node->getName(),node->getID() );
406 smgr->addBillboardTextSceneNode( 406 smgr->addBillboardTextSceneNode(
407 font, 407 font,
408 (wchar_t*) buf, 408 (wchar_t*) buf,
409 node, 409 node,
410 dimension2d<f32>(80.0f, 8.0f), 410 dimension2d<f32>(80.0f, 8.0f),
411 vector3df(0, 10, 0), 411 vector3df(0, 10, 0),
412 sceneNodeID); 412 sceneNodeID);
413 sceneNodeID += 1; 413 sceneNodeID += 1;
414 } 414 }
415 415
416 // create Portal Rendertargets 416 // create Portal Rendertargets
417 if ( shader ) 417 if ( shader )
418 { 418 {
419 const SVarGroup *group = shader->getGroup(1); 419 const SVarGroup *group = shader->getGroup(1);
420 if ( group->isDefined( "surfaceparm", "portal" ) ) 420 if ( group->isDefined( "surfaceparm", "portal" ) )
421 { 421 {
422 } 422 }
423 423
424 } 424 }
425 425
426 426
427 // add collision 427 // add collision
428 // find out if shader is marked as nonsolid 428 // find out if shader is marked as nonsolid
429 u8 doCreate = meta !=0 ; 429 u8 doCreate = meta !=0 ;
430 430
431 if ( shader ) 431 if ( shader )
432 { 432 {
433 const SVarGroup *group = shader->getGroup(1); 433 const SVarGroup *group = shader->getGroup(1);
434 if ( group->isDefined( "surfaceparm", "trans" ) 434 if ( group->isDefined( "surfaceparm", "trans" )
435 // || group->isDefined( "surfaceparm", "sky" ) 435 // || group->isDefined( "surfaceparm", "sky" )
436 // || group->isDefined( "surfaceparm", "nonsolid" ) 436 // || group->isDefined( "surfaceparm", "nonsolid" )
437 ) 437 )
438 { 438 {
439 if ( !group->isDefined( "surfaceparm", "metalsteps" ) ) 439 if ( !group->isDefined( "surfaceparm", "metalsteps" ) )
440 { 440 {
441 doCreate = 0; 441 doCreate = 0;
442 } 442 }
443 } 443 }
444 } 444 }
445 445
446 if ( doCreate ) 446 if ( doCreate )
447 { 447 {
448 IMesh *m = 0; 448 IMesh *m = 0;
449 449
450 //! controls if triangles are modified by the scenenode during runtime 450 //! controls if triangles are modified by the scenenode during runtime
451 bool takeOriginal = true; 451 bool takeOriginal = true;
452 452
453 if ( takeOriginal ) 453 if ( takeOriginal )
454 { 454 {
455 m = new SMesh (); 455 m = new SMesh ();
456 ((SMesh*) m )->addMeshBuffer (meshBuffer); 456 ((SMesh*) m )->addMeshBuffer (meshBuffer);
457 } 457 }
458 else 458 else
459 { 459 {
460 m = node->getMesh(); 460 m = node->getMesh();
461 } 461 }
462 462
463 //selector = smgr->createOctreeTriangleSelector ( m, 0, 128 ); 463 //selector = smgr->createOctreeTriangleSelector ( m, 0, 128 );
464 selector = smgr->createTriangleSelector ( m, 0 ); 464 selector = smgr->createTriangleSelector ( m, 0 );
465 meta->addTriangleSelector ( selector ); 465 meta->addTriangleSelector ( selector );
466 selector->drop (); 466 selector->drop ();
467 467
468 if ( takeOriginal ) 468 if ( takeOriginal )
469 { 469 {
470 delete m; 470 delete m;
471 } 471 }
472 } 472 }
473 473
474 } 474 }
475 475
476#if 0 476#if 0
477 if ( meta ) 477 if ( meta )
478 { 478 {
479 selector = smgr->createOctreeTriangleSelector ( additional_mesh, 0 ); 479 selector = smgr->createOctreeTriangleSelector ( additional_mesh, 0 );
480 meta->addTriangleSelector ( selector ); 480 meta->addTriangleSelector ( selector );
481 selector->drop (); 481 selector->drop ();
482 } 482 }
483#endif 483#endif
484 484
485 if ( loadParam.verbose > 0 ) 485 if ( loadParam.verbose > 0 )
486 { 486 {
487 loadParam.endTime = device->getTimer()->getRealTime (); 487 loadParam.endTime = device->getTimer()->getRealTime ();
488 snprintf(buf, 128, "q3shaderfactory needed %04d ms to create %d shader nodes", 488 snprintf(buf, 128, "q3shaderfactory needed %04d ms to create %d shader nodes",
489 loadParam.endTime - loadParam.startTime, 489 loadParam.endTime - loadParam.startTime,
490 sceneNodeID 490 sceneNodeID
491 ); 491 );
492 device->getLogger()->log(buf, ELL_INFORMATION); 492 device->getLogger()->log(buf, ELL_INFORMATION);
493 } 493 }
494 494
495} 495}
496 496
497 497
498/*! 498/*!
499 create Items from Entity 499 create Items from Entity
500*/ 500*/
501void Q3ModelFactory ( Q3LevelLoadParameter &loadParam, 501void Q3ModelFactory ( Q3LevelLoadParameter &loadParam,
502 IrrlichtDevice *device, 502 IrrlichtDevice *device,
503 IQ3LevelMesh* masterMesh, 503 IQ3LevelMesh* masterMesh,
504 ISceneNode *parent, 504 ISceneNode *parent,
505 bool showShaderName 505 bool showShaderName
506 ) 506 )
507{ 507{
508 if ( 0 == masterMesh ) 508 if ( 0 == masterMesh )
509 return; 509 return;
510 510
511 tQ3EntityList &entity = masterMesh->getEntityList (); 511 tQ3EntityList &entity = masterMesh->getEntityList ();
512 ISceneManager* smgr = device->getSceneManager(); 512 ISceneManager* smgr = device->getSceneManager();
513 513
514 514
515 char buf[128]; 515 char buf[128];
516 const SVarGroup *group; 516 const SVarGroup *group;
517 IEntity search; 517 IEntity search;
518 s32 index; 518 s32 index;
519 s32 lastIndex; 519 s32 lastIndex;
520 520
521/* 521/*
522 stringc s; 522 stringc s;
523 FILE *f = 0; 523 FILE *f = 0;
524 f = fopen ( "entity.txt", "wb" ); 524 f = fopen ( "entity.txt", "wb" );
525 for ( index = 0; (u32) index < entityList.size (); ++index ) 525 for ( index = 0; (u32) index < entityList.size (); ++index )
526 { 526 {
527 const IEntity *entity = &entityList[ index ]; 527 const IEntity *entity = &entityList[ index ];
528 s = entity->name; 528 s = entity->name;
529 dumpShader ( s, entity ); 529 dumpShader ( s, entity );
530 fwrite ( s.c_str(), 1, s.size(), f ); 530 fwrite ( s.c_str(), 1, s.size(), f );
531 } 531 }
532 fclose ( f ); 532 fclose ( f );
533*/ 533*/
534 IAnimatedMeshMD3* model; 534 IAnimatedMeshMD3* model;
535 SMD3Mesh * mesh; 535 SMD3Mesh * mesh;
536 const SMD3MeshBuffer *meshBuffer; 536 const SMD3MeshBuffer *meshBuffer;
537 IMeshSceneNode* node; 537 IMeshSceneNode* node;
538 ISceneNodeAnimator* anim; 538 ISceneNodeAnimator* anim;
539 const IShader *shader; 539 const IShader *shader;
540 u32 pos; 540 u32 pos;
541 vector3df p; 541 vector3df p;
542 u32 nodeCount = 0; 542 u32 nodeCount = 0;
543 tTexArray textureArray; 543 tTexArray textureArray;
544 544
545 IGUIFont *font = 0; 545 IGUIFont *font = 0;
546 if ( showShaderName ) 546 if ( showShaderName )
547 font = device->getGUIEnvironment()->getFont("fontlucida.png"); 547 font = device->getGUIEnvironment()->getFont("fontlucida.png");
548 548
549 const SItemElement *itemElement; 549 const SItemElement *itemElement;
550 550
551 // walk list 551 // walk list
552 for ( index = 0; (u32) index < entity.size(); ++index ) 552 for ( index = 0; (u32) index < entity.size(); ++index )
553 { 553 {
554 itemElement = getItemElement ( entity[index].name ); 554 itemElement = getItemElement ( entity[index].name );
555 if ( 0 == itemElement ) 555 if ( 0 == itemElement )
556 continue; 556 continue;
557 557
558 pos = 0; 558 pos = 0;
559 p = getAsVector3df ( entity[index].getGroup(1)->get ( "origin" ), pos ); 559 p = getAsVector3df ( entity[index].getGroup(1)->get ( "origin" ), pos );
560 560
561 nodeCount += 1; 561 nodeCount += 1;
562 for ( u32 g = 0; g < 2; ++g ) 562 for ( u32 g = 0; g < 2; ++g )
563 { 563 {
564 if ( 0 == itemElement->model[g] || itemElement->model[g][0] == 0 ) 564 if ( 0 == itemElement->model[g] || itemElement->model[g][0] == 0 )
565 continue; 565 continue;
566 model = (IAnimatedMeshMD3*) smgr->getMesh( itemElement->model[g] ); 566 model = (IAnimatedMeshMD3*) smgr->getMesh( itemElement->model[g] );
567 if ( 0 == model ) 567 if ( 0 == model )
568 continue; 568 continue;
569 569
570 mesh = model->getOriginalMesh(); 570 mesh = model->getOriginalMesh();
571 for ( u32 j = 0; j != mesh->Buffer.size (); ++j ) 571 for ( u32 j = 0; j != mesh->Buffer.size (); ++j )
572 { 572 {
573 meshBuffer = mesh->Buffer[j]; 573 meshBuffer = mesh->Buffer[j];
574 if ( 0 == meshBuffer ) 574 if ( 0 == meshBuffer )
575 continue; 575 continue;
576 576
577 shader = masterMesh->getShader ( meshBuffer->Shader.c_str(), false ); 577 shader = masterMesh->getShader ( meshBuffer->Shader.c_str(), false );
578 IMeshBuffer *final = model->getMesh(0)->getMeshBuffer(j); 578 IMeshBuffer *final = model->getMesh(0)->getMeshBuffer(j);
579 if ( shader ) 579 if ( shader )
580 { 580 {
581 //!TODO: Hack don't modify the vertexbuffer. make it better;-) 581 //!TODO: Hack don't modify the vertexbuffer. make it better;-)
582 final->getMaterial().ColorMask = 0; 582 final->getMaterial().ColorMask = 0;
583 node = smgr->addQuake3SceneNode ( final, shader, parent ); 583 node = smgr->addQuake3SceneNode ( final, shader, parent );
584 final->getMaterial().ColorMask = 15; 584 final->getMaterial().ColorMask = 15;
585 } 585 }
586 else 586 else
587 { 587 {
588 // clone mesh 588 // clone mesh
589 SMesh * m = new SMesh (); 589 SMesh * m = new SMesh ();
590 m->addMeshBuffer ( final ); 590 m->addMeshBuffer ( final );
591 node = smgr->addMeshSceneNode ( m, parent ); 591 node = smgr->addMeshSceneNode ( m, parent );
592 m->drop(); 592 m->drop();
593 } 593 }
594 594
595 if ( 0 == node ) 595 if ( 0 == node )
596 { 596 {
597 snprintf ( buf, 128, "q3ModelFactory shader %s failed", meshBuffer->Shader.c_str() ); 597 snprintf ( buf, 128, "q3ModelFactory shader %s failed", meshBuffer->Shader.c_str() );
598 device->getLogger()->log ( buf ); 598 device->getLogger()->log ( buf );
599 continue; 599 continue;
600 } 600 }
601 601
602 // node was maybe centered by shaderscenenode 602 // node was maybe centered by shaderscenenode
603 node->setPosition ( p ); 603 node->setPosition ( p );
604 node->setName ( meshBuffer->Shader ); 604 node->setName ( meshBuffer->Shader );
605 node->setAutomaticCulling ( scene::EAC_BOX ); 605 node->setAutomaticCulling ( scene::EAC_BOX );
606 606
607 // add special effects to node 607 // add special effects to node
608 if ( itemElement->special & SPECIAL_SFX_ROTATE || 608 if ( itemElement->special & SPECIAL_SFX_ROTATE ||
609 (g == 0 && itemElement->special & SPECIAL_SFX_ROTATE_1) 609 (g == 0 && itemElement->special & SPECIAL_SFX_ROTATE_1)
610 ) 610 )
611 { 611 {
612 anim = smgr->createRotationAnimator ( vector3df ( 0.f, 612 anim = smgr->createRotationAnimator ( vector3df ( 0.f,
613 2.f, 0.f ) ); 613 2.f, 0.f ) );
614 node->addAnimator ( anim ); 614 node->addAnimator ( anim );
615 anim->drop (); 615 anim->drop ();
616 } 616 }
617 617
618 if ( itemElement->special & SPECIAL_SFX_BOUNCE ) 618 if ( itemElement->special & SPECIAL_SFX_BOUNCE )
619 { 619 {
620 //anim = smgr->createFlyStraightAnimator ( 620 //anim = smgr->createFlyStraightAnimator (
621 // p, p + vector3df ( 0.f, 60.f, 0.f ), 1000, true, true ); 621 // p, p + vector3df ( 0.f, 60.f, 0.f ), 1000, true, true );
622 anim = smgr->createFlyCircleAnimator ( 622 anim = smgr->createFlyCircleAnimator (
623 p + vector3df( 0.f, 20.f, 0.f ), 623 p + vector3df( 0.f, 20.f, 0.f ),
624 20.f, 624 20.f,
625 0.005f, 625 0.005f,
626 vector3df ( 1.f, 0.f, 0.f ), 626 vector3df ( 1.f, 0.f, 0.f ),
627 core::fract ( nodeCount * 0.05f ), 627 core::fract ( nodeCount * 0.05f ),
628 1.f 628 1.f
629 ); 629 );
630 node->addAnimator ( anim ); 630 node->addAnimator ( anim );
631 anim->drop (); 631 anim->drop ();
632 } 632 }
633 } 633 }
634 } 634 }
635 // show name 635 // show name
636 if ( showShaderName ) 636 if ( showShaderName )
637 { 637 {
638 swprintf ( (wchar_t*) buf, sizeof(buf) / 2, L"%hs", itemElement->key ); 638 swprintf ( (wchar_t*) buf, sizeof(buf) / 2, L"%hs", itemElement->key );
639 smgr->addBillboardTextSceneNode( 639 smgr->addBillboardTextSceneNode(
640 font, 640 font,
641 (wchar_t*) buf, 641 (wchar_t*) buf,
642 parent, 642 parent,
643 dimension2d<f32>(80.0f, 8.0f), 643 dimension2d<f32>(80.0f, 8.0f),
644 p + vector3df(0, 30, 0), 644 p + vector3df(0, 30, 0),
645 0); 645 0);
646 } 646 }
647 } 647 }
648 648
649 // music 649 // music
650 search.name = "worldspawn"; 650 search.name = "worldspawn";
651 index = entity.binary_search_multi ( search, lastIndex ); 651 index = entity.binary_search_multi ( search, lastIndex );
652 652
653 if ( index >= 0 ) 653 if ( index >= 0 )
654 { 654 {
655 group = entity[ index ].getGroup(1); 655 group = entity[ index ].getGroup(1);
656 background_music ( group->get ( "music" ).c_str () ); 656 background_music ( group->get ( "music" ).c_str () );
657 } 657 }
658 658
659 // music 659 // music
660 search.name = "worldspawn"; 660 search.name = "worldspawn";
661 index = entity.binary_search_multi ( search, lastIndex ); 661 index = entity.binary_search_multi ( search, lastIndex );
662 662
663 if ( index >= 0 ) 663 if ( index >= 0 )
664 { 664 {
665 group = entity[ index ].getGroup(1); 665 group = entity[ index ].getGroup(1);
666 background_music ( group->get ( "music" ).c_str () ); 666 background_music ( group->get ( "music" ).c_str () );
667 } 667 }
668 668
669 //IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2"); 669 //IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
670 //IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh ); 670 //IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
671 671
672} 672}
673 673
674/*! 674/*!
675 so we need a good starting Position in the level. 675 so we need a good starting Position in the level.
676 we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch" 676 we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch"
677*/ 677*/
678s32 Q3StartPosition ( IQ3LevelMesh* mesh, 678s32 Q3StartPosition ( IQ3LevelMesh* mesh,
679 ICameraSceneNode* camera, 679 ICameraSceneNode* camera,
680 s32 startposIndex, 680 s32 startposIndex,
681 const vector3df &translation 681 const vector3df &translation
682 ) 682 )
683{ 683{
684 if ( 0 == mesh ) 684 if ( 0 == mesh )
685 return 0; 685 return 0;
686 686
687 tQ3EntityList &entityList = mesh->getEntityList (); 687 tQ3EntityList &entityList = mesh->getEntityList ();
688 688
689 IEntity search; 689 IEntity search;
690 search.name = "info_player_start"; // "info_player_deathmatch"; 690 search.name = "info_player_start"; // "info_player_deathmatch";
691 691
692 // find all entities in the multi-list 692 // find all entities in the multi-list
693 s32 lastIndex; 693 s32 lastIndex;
694 s32 index = entityList.binary_search_multi ( search, lastIndex ); 694 s32 index = entityList.binary_search_multi ( search, lastIndex );
695 695
696 if ( index < 0 ) 696 if ( index < 0 )
697 { 697 {
698 search.name = "info_player_deathmatch"; 698 search.name = "info_player_deathmatch";
699 index = entityList.binary_search_multi ( search, lastIndex ); 699 index = entityList.binary_search_multi ( search, lastIndex );
700 } 700 }
701 701
702 if ( index < 0 ) 702 if ( index < 0 )
703 return 0; 703 return 0;
704 704
705 index += core::clamp ( startposIndex, 0, lastIndex - index ); 705 index += core::clamp ( startposIndex, 0, lastIndex - index );
706 706
707 u32 parsepos; 707 u32 parsepos;
708 708
709 const SVarGroup *group; 709 const SVarGroup *group;
710 group = entityList[ index ].getGroup(1); 710 group = entityList[ index ].getGroup(1);
711 711
712 parsepos = 0; 712 parsepos = 0;
713 vector3df pos = getAsVector3df ( group->get ( "origin" ), parsepos ); 713 vector3df pos = getAsVector3df ( group->get ( "origin" ), parsepos );
714 pos += translation; 714 pos += translation;
715 715
716 parsepos = 0; 716 parsepos = 0;
717 f32 angle = getAsFloat ( group->get ( "angle"), parsepos ); 717 f32 angle = getAsFloat ( group->get ( "angle"), parsepos );
718 718
719 vector3df target ( 0.f, 0.f, 1.f ); 719 vector3df target ( 0.f, 0.f, 1.f );
720 target.rotateXZBy ( angle - 90.f, vector3df () ); 720 target.rotateXZBy ( angle - 90.f, vector3df () );
721 721
722 if ( camera ) 722 if ( camera )
723 { 723 {
724 camera->setPosition ( pos ); 724 camera->setPosition ( pos );
725 camera->setTarget ( pos + target ); 725 camera->setTarget ( pos + target );
726 //! New. FPSCamera and animators catches reset on animate 0 726 //! New. FPSCamera and animators catches reset on animate 0
727 camera->OnAnimate ( 0 ); 727 camera->OnAnimate ( 0 );
728 } 728 }
729 return lastIndex - index + 1; 729 return lastIndex - index + 1;
730} 730}
731 731
732 732
733/*! 733/*!
734 gets a accumulated force on a given surface 734 gets a accumulated force on a given surface
735*/ 735*/
736vector3df getGravity ( const c8 * surface ) 736vector3df getGravity ( const c8 * surface )
737{ 737{
738 if ( 0 == strcmp ( surface, "earth" ) ) return vector3df ( 0.f, -90.f, 0.f ); 738 if ( 0 == strcmp ( surface, "earth" ) ) return vector3df ( 0.f, -90.f, 0.f );
739 if ( 0 == strcmp ( surface, "moon" ) ) return vector3df ( 0.f, -6.f / 100.f, 0.f ); 739 if ( 0 == strcmp ( surface, "moon" ) ) return vector3df ( 0.f, -6.f / 100.f, 0.f );
740 if ( 0 == strcmp ( surface, "water" ) ) return vector3df ( 0.1f / 100.f, -2.f / 100.f, 0.f ); 740 if ( 0 == strcmp ( surface, "water" ) ) return vector3df ( 0.1f / 100.f, -2.f / 100.f, 0.f );
741 if ( 0 == strcmp ( surface, "ice" ) ) return vector3df ( 0.2f / 100.f, -9.f / 100.f, 0.3f / 100.f ); 741 if ( 0 == strcmp ( surface, "ice" ) ) return vector3df ( 0.2f / 100.f, -9.f / 100.f, 0.3f / 100.f );
742 742
743 return vector3df ( 0.f, 0.f, 0.f ); 743 return vector3df ( 0.f, 0.f, 0.f );
744} 744}
745 745
746 746
747 747
748/* 748/*
749 Dynamically load the Irrlicht Library 749 Dynamically load the Irrlicht Library
750*/ 750*/
751 751
752#if defined(_IRR_WINDOWS_API_) 752#if defined(_IRR_WINDOWS_API_)
753#ifdef _MSC_VER 753#ifdef _MSC_VER
754#pragma comment(lib, "Irrlicht.lib") 754#pragma comment(lib, "Irrlicht.lib")
755#endif 755#endif
756 756
757#include <windows.h> 757#include <windows.h>
758 758
759funcptr_createDevice load_createDevice ( const c8 * filename) 759funcptr_createDevice load_createDevice ( const c8 * filename)
760{ 760{
761 return (funcptr_createDevice) GetProcAddress ( LoadLibrary ( filename ), "createDevice" ); 761 return (funcptr_createDevice) GetProcAddress ( LoadLibrary ( filename ), "createDevice" );
762} 762}
763 763
764funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename) 764funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename)
765{ 765{
766 return (funcptr_createDeviceEx) GetProcAddress ( LoadLibrary ( filename ), "createDeviceEx" ); 766 return (funcptr_createDeviceEx) GetProcAddress ( LoadLibrary ( filename ), "createDeviceEx" );
767} 767}
768 768
769#else 769#else
770 770
771// TODO: Dynamic Loading for other os 771// TODO: Dynamic Loading for other os
772funcptr_createDevice load_createDevice ( const c8 * filename) 772funcptr_createDevice load_createDevice ( const c8 * filename)
773{ 773{
774 return createDevice; 774 return createDevice;
775} 775}
776 776
777funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename) 777funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename)
778{ 778{
779 return createDeviceEx; 779 return createDeviceEx;
780} 780}
781 781
782#endif 782#endif
783 783
784/* 784/*
785 get the current collision response camera animator 785 get the current collision response camera animator
786*/ 786*/
787ISceneNodeAnimatorCollisionResponse* camCollisionResponse( IrrlichtDevice * device ) 787ISceneNodeAnimatorCollisionResponse* camCollisionResponse( IrrlichtDevice * device )
788{ 788{
789 ICameraSceneNode *camera = device->getSceneManager()->getActiveCamera(); 789 ICameraSceneNode *camera = device->getSceneManager()->getActiveCamera();
790 ISceneNodeAnimatorCollisionResponse *a = 0; 790 ISceneNodeAnimatorCollisionResponse *a = 0;
791 791
792 list<ISceneNodeAnimator*>::ConstIterator it = camera->getAnimators().begin(); 792 list<ISceneNodeAnimator*>::ConstIterator it = camera->getAnimators().begin();
793 for (; it != camera->getAnimators().end(); ++it) 793 for (; it != camera->getAnimators().end(); ++it)
794 { 794 {
795 a = (ISceneNodeAnimatorCollisionResponse*) (*it); 795 a = (ISceneNodeAnimatorCollisionResponse*) (*it);
796 if ( a->getType() == ESNAT_COLLISION_RESPONSE ) 796 if ( a->getType() == ESNAT_COLLISION_RESPONSE )
797 return a; 797 return a;
798 } 798 }
799 799
800 return 0; 800 return 0;
801} 801}
802 802
803 803
804//! internal Animation 804//! internal Animation
805void setTimeFire ( TimeFire *t, u32 delta, u32 flags ) 805void setTimeFire ( TimeFire *t, u32 delta, u32 flags )
806{ 806{
807 t->flags = flags; 807 t->flags = flags;
808 t->next = 0; 808 t->next = 0;
809 t->delta = delta; 809 t->delta = delta;
810} 810}
811 811
812 812
813void checkTimeFire ( TimeFire *t, u32 listSize, u32 now ) 813void checkTimeFire ( TimeFire *t, u32 listSize, u32 now )
814{ 814{
815 u32 i; 815 u32 i;
816 for ( i = 0; i < listSize; ++i ) 816 for ( i = 0; i < listSize; ++i )
817 { 817 {
818 if ( now < t[i].next ) 818 if ( now < t[i].next )
819 continue; 819 continue;
820 820
821 t[i].next = core::max_ ( now + t[i].delta, t[i].next + t[i].delta ); 821 t[i].next = core::max_ ( now + t[i].delta, t[i].next + t[i].delta );
822 t[i].flags |= FIRED; 822 t[i].flags |= FIRED;
823 } 823 }
824} 824}