1 /*!
2 	Model Factory.
3 	create the additional scenenodes for ( bullets, health... )
4 
5 	Defines the Entities for Quake3
6 */
7 #ifndef __QUAKE3_FACTORY__H_INCLUDED__
8 #define __QUAKE3_FACTORY__H_INCLUDED__
9 
10 using namespace irr;
11 using namespace scene;
12 using namespace gui;
13 using namespace video;
14 using namespace core;
15 using namespace quake3;
16 using namespace io;
17 
18 
19 
20 //! Defines to which group the entities belong
21 enum eItemGroup
22 {
23 	WEAPON,
24 	AMMO,
25 	ARMOR,
26 	HEALTH,
27 	POWERUP
28 };
29 
30 //! define a supgroup for the item. for e.q the Weapons
31 enum eItemSubGroup
32 {
33 	SUB_NONE = 0,
34 	GAUNTLET,
35 	MACHINEGUN,
36 	SHOTGUN,
37 	GRENADE_LAUNCHER,
38 	ROCKET_LAUNCHER,
39 	LIGHTNING,
40 	RAILGUN,
41 	PLASMAGUN,
42 	BFG,
43 	GRAPPLING_HOOK,
44 	NAILGUN,
45 	PROX_LAUNCHER,
46 	CHAINGUN,
47 };
48 
49 //! aplly a special effect to the shader
50 enum eItemSpecialEffect
51 {
52 	SPECIAL_SFX_NONE		= 0,
53 	SPECIAL_SFX_ROTATE		= 1,
54 	SPECIAL_SFX_BOUNCE		= 2,
55 	SPECIAL_SFX_ROTATE_1	= 4,
56 };
57 
58 // a List for defining a model
59 struct SItemElement
60 {
61 	const c8 *key;
62 	const c8 *model[2];
63 	const c8 *sound;
64 	const c8 *icon;
65 	const c8 *pickup;
66 	s32 value;
67 	eItemGroup group;
68 	eItemSubGroup sub;
69 	u32 special;
70 };
71 
72 
73 //! Get's an entity based on it's key
74 const SItemElement * getItemElement ( const stringc& key );
75 
76 /*!
77 	Quake3 Model Factory.
78 	Takes the mesh buffers and creates scenenodes for their associated shaders
79 */
80 void Q3ShaderFactory (	Q3LevelLoadParameter &loadParam,
81 						IrrlichtDevice *device,
82 						IQ3LevelMesh* mesh,
83 						eQ3MeshIndex meshIndex,
84 						ISceneNode *parent,
85 						IMetaTriangleSelector *meta,
86 						bool showShaderName
87 					);
88 
89 
90 /*!
91 	Creates Model based on the entity list
92 */
93 void Q3ModelFactory (	Q3LevelLoadParameter &loadParam,
94 						IrrlichtDevice *device,
95 						IQ3LevelMesh* masterMesh,
96 						ISceneNode *parent,
97 						bool showShaderName
98 					);
99 
100 /*!
101 	so we need a good starting Position in the level.
102 	we can ask the Quake3 Loader for all entities with class_name "info_player_deathmatch"
103 */
104 s32 Q3StartPosition (	IQ3LevelMesh* mesh,
105 						ICameraSceneNode* camera,
106 						s32 startposIndex,
107 						const vector3df &translation
108 					);
109 /*!
110 	gets a accumulated force on a given surface
111 */
112 vector3df getGravity ( const c8 * surface );
113 
114 
115 /*
116 	Dynamically load the Irrlicht Library
117 */
118 funcptr_createDevice load_createDevice ( const c8 * filename);
119 funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename);
120 
121 
122 //! Macro for save Dropping an Element
123 #define dropElement(x)	if (x) { x->remove(); x = 0; }
124 
125 
126 /*
127 	get the current collision respone camera animator
128 */
129 ISceneNodeAnimatorCollisionResponse* camCollisionResponse( IrrlichtDevice * device );
130 
131 //! internal Animation
132 enum eTimeFireFlag
133 {
134 	FIRED = 1,
135 };
136 
137 struct TimeFire
138 {
139 	u32 flags;
140 	u32 next;
141 	u32 delta;
142 };
143 
144 void setTimeFire ( TimeFire *t, u32 delta, u32 flags = 0 );
145 void checkTimeFire ( TimeFire *t, u32 listSize, u32 now );
146 
147 #endif // __QUAKE3_FACTORY__H_INCLUDED__
148 
149 
150