DOOM-3-BFG

DOOM 3 BFG Edition
Log | Files | Refs

Fx.h (3876B)


      1 /*
      2 ===========================================================================
      3 
      4 Doom 3 BFG Edition GPL Source Code
      5 Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. 
      6 
      7 This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").  
      8 
      9 Doom 3 BFG Edition 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 BFG Edition 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 BFG Edition Source Code.  If not, see <http://www.gnu.org/licenses/>.
     21 
     22 In addition, the Doom 3 BFG Edition 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 BFG Edition 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();
     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();
     71 	const int				Duration();
     72 	const char *			EffectName();
     73 	const char *			Joint();
     74 	const bool				Done();
     75 
     76 	virtual void			WriteToSnapshot( idBitMsg &msg ) const;
     77 	virtual void			ReadFromSnapshot( const idBitMsg &msg );
     78 	virtual void			ClientThink( const int curTime, const float fraction, const bool predict );
     79 	virtual void			ClientPredictionThink();
     80 
     81 	static idEntityFx *		StartFx( const char *fx, const idVec3 *useOrigin, const idMat3 *useAxis, idEntity *ent, bool bind );
     82 
     83 protected:
     84 	void					Event_Trigger( idEntity *activator );
     85 	void					Event_ClearFx();
     86 
     87 	void					CleanUp();
     88 	void					CleanUpSingleAction( const idFXSingleAction& fxaction, idFXLocalAction& laction );
     89 	void					ApplyFade( const idFXSingleAction& fxaction, idFXLocalAction& laction, const int time, const int actualStart );
     90 
     91 	int						started;
     92 	int						nextTriggerTime;
     93 	const idDeclFX *		fxEffect;				// GetFX() should be called before using fxEffect as a pointer
     94 	idList<idFXLocalAction, TAG_FX>	actions;
     95 	idStr					systemName;
     96 };
     97 
     98 class idTeleporter : public idEntityFx {
     99 public:
    100 	CLASS_PROTOTYPE( idTeleporter );
    101 
    102 private:
    103 	// teleporters to this location
    104 	void					Event_DoAction( idEntity *activator );
    105 };
    106 
    107 #endif /* !__GAME_FX_H__ */