aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8.1/examples/21.Quake3Explorer/q3factory.h
blob: d9606ed0926a03ad36b78a6247a74cb17358be61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*!
	Model Factory.
	create the additional scenenodes for ( bullets, health... ) 

	Defines the Entities for Quake3
*/
#ifndef __QUAKE3_FACTORY__H_INCLUDED__
#define __QUAKE3_FACTORY__H_INCLUDED__

using namespace irr;
using namespace scene;
using namespace gui;
using namespace video;
using namespace core;
using namespace quake3;
using namespace io;



//! Defines to which group the entities belong
enum eItemGroup
{
	WEAPON,
	AMMO,
	ARMOR,
	HEALTH,
	POWERUP
};

//! define a supgroup for the item. for e.q the Weapons
enum eItemSubGroup
{
	SUB_NONE = 0,
	GAUNTLET,
	MACHINEGUN,
	SHOTGUN,
	GRENADE_LAUNCHER,
	ROCKET_LAUNCHER,
	LIGHTNING,
	RAILGUN,
	PLASMAGUN,
	BFG,
	GRAPPLING_HOOK,
	NAILGUN,
	PROX_LAUNCHER,
	CHAINGUN,
};

//! aplly a special effect to the shader
enum eItemSpecialEffect
{
	SPECIAL_SFX_NONE		= 0,
	SPECIAL_SFX_ROTATE		= 1,
	SPECIAL_SFX_BOUNCE		= 2,
	SPECIAL_SFX_ROTATE_1	= 4,
};

// a List for defining a model
struct SItemElement
{
	const c8 *key;
	const c8 *model[2];
	const c8 *sound;
	const c8 *icon;
	const c8 *pickup;
	s32 value;
	eItemGroup group;
	eItemSubGroup sub;
	u32 special;
};


//! Get's an entity based on it's key
const SItemElement * getItemElement ( const stringc& key );

/*!
	Quake3 Model Factory.
	Takes the mesh buffers and creates scenenodes for their associated shaders
*/
void Q3ShaderFactory (	Q3LevelLoadParameter &loadParam,
						IrrlichtDevice *device, 
						IQ3LevelMesh* mesh, 
						eQ3MeshIndex meshIndex,
						ISceneNode *parent,
						IMetaTriangleSelector *meta,
						bool showShaderName 
					);


/*!
	Creates Model based on the entity list
*/
void Q3ModelFactory (	Q3LevelLoadParameter &loadParam,
						IrrlichtDevice *device, 
						IQ3LevelMesh* masterMesh, 
						ISceneNode *parent,
						bool showShaderName
					);

/*!
	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"
*/
s32 Q3StartPosition (	IQ3LevelMesh* mesh,
						ICameraSceneNode* camera,
						s32 startposIndex,
						const vector3df &translation
					);
/*!
	gets a accumulated force on a given surface
*/
vector3df getGravity ( const c8 * surface );


/*
	Dynamically load the Irrlicht Library
*/
funcptr_createDevice load_createDevice ( const c8 * filename);
funcptr_createDeviceEx load_createDeviceEx ( const c8 * filename);


//! Macro for save Dropping an Element
#define dropElement(x)	if (x) { x->remove(); x = 0; }


/*
	get the current collision respone camera animator
*/
ISceneNodeAnimatorCollisionResponse* camCollisionResponse( IrrlichtDevice * device );

//! internal Animation
enum eTimeFireFlag
{
	FIRED = 1,
};

struct TimeFire
{
	u32 flags;
	u32 next;
	u32 delta;
};

void setTimeFire ( TimeFire *t, u32 delta, u32 flags = 0 );
void checkTimeFire ( TimeFire *t, u32 listSize, u32 now );

#endif // __QUAKE3_FACTORY__H_INCLUDED__