]> icculus.org git repositories - icculus/iodoom3.git/blob - neo/game/Fx.h
hello world
[icculus/iodoom3.git] / neo / game / Fx.h
1 /*
2 ===========================================================================
3
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 
6
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).  
8
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code.  If not, see <http://www.gnu.org/licenses/>.
21
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code.  If not, please request a copy in writing from id Software at the address below.
23
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25
26 ===========================================================================
27 */
28
29 #ifndef __GAME_FX_H__
30 #define __GAME_FX_H__
31
32 /*
33 ===============================================================================
34
35   Special effects.
36
37 ===============================================================================
38 */
39
40 typedef struct {
41         renderLight_t                   renderLight;                    // light presented to the renderer
42         qhandle_t                               lightDefHandle;                 // handle to renderer light def
43         renderEntity_t                  renderEntity;                   // used to present a model to the renderer
44         int                                             modelDefHandle;                 // handle to static renderer model
45         float                                   delay;
46         int                                             particleSystem;
47         int                                             start;
48         bool                                    soundStarted;
49         bool                                    shakeStarted;
50         bool                                    decalDropped;
51         bool                                    launched;
52 } idFXLocalAction;
53
54 class idEntityFx : public idEntity {
55 public:
56         CLASS_PROTOTYPE( idEntityFx );
57
58                                                         idEntityFx();
59         virtual                                 ~idEntityFx();
60
61         void                                    Spawn( void );
62
63         void                                    Save( idSaveGame *savefile ) const;
64         void                                    Restore( idRestoreGame *savefile );
65
66         virtual void                    Think();
67         void                                    Setup( const char *fx );
68         void                                    Run( int time );
69         void                                    Start( int time );
70         void                                    Stop( void );
71         const int                               Duration( void );
72         const char *                    EffectName( void );
73         const char *                    Joint( void );
74         const bool                              Done();
75
76         virtual void                    WriteToSnapshot( idBitMsgDelta &msg ) const;
77         virtual void                    ReadFromSnapshot( const idBitMsgDelta &msg );
78         virtual void                    ClientPredictionThink( void );
79
80         static idEntityFx *             StartFx( const char *fx, const idVec3 *useOrigin, const idMat3 *useAxis, idEntity *ent, bool bind );
81
82 protected:
83         void                                    Event_Trigger( idEntity *activator );
84         void                                    Event_ClearFx( void );
85
86         void                                    CleanUp( void );
87         void                                    CleanUpSingleAction( const idFXSingleAction& fxaction, idFXLocalAction& laction );
88         void                                    ApplyFade( const idFXSingleAction& fxaction, idFXLocalAction& laction, const int time, const int actualStart );
89
90         int                                             started;
91         int                                             nextTriggerTime;
92         const idDeclFX *                fxEffect;                               // GetFX() should be called before using fxEffect as a pointer
93         idList<idFXLocalAction> actions;
94         idStr                                   systemName;
95 };
96
97 class idTeleporter : public idEntityFx {
98 public:
99         CLASS_PROTOTYPE( idTeleporter );
100
101 private:
102         // teleporters to this location
103         void                                    Event_DoAction( idEntity *activator );
104 };
105
106 #endif /* !__GAME_FX_H__ */