~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to examples/21.Quake3Explorer/q3factory.h

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

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