1 /*
2 ===========================================================================
3 Copyright (C) 2000 - 2013, Raven Software, Inc.
4 Copyright (C) 2001 - 2013, Activision, Inc.
5 Copyright (C) 2013 - 2015, OpenJK contributors
6
7 This file is part of the OpenJK source code.
8
9 OpenJK is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License version 2 as
11 published by the Free Software Foundation.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 ===========================================================================
21 */
22
23 #include "client.h"
24 #include "FxScheduler.h"
25
26 //#define __FXCHECKER
27
28 #ifdef __FXCHECKER
29 #include <float.h>
30 #endif // __FXCHECKER
31
FX_RegisterEffect(const char * file)32 int FX_RegisterEffect(const char *file)
33 {
34 return theFxScheduler.RegisterEffect(file, true);
35 }
36
FX_PlayEffect(const char * file,vec3_t org,vec3_t fwd,int vol,int rad)37 void FX_PlayEffect( const char *file, vec3_t org, vec3_t fwd, int vol, int rad )
38 {
39 #ifdef __FXCHECKER
40 if (_isnan(org[0]) || _isnan(org[1]) || _isnan(org[2]))
41 {
42 assert(0);
43 }
44 if (_isnan(fwd[0]) || _isnan(fwd[1]) || _isnan(fwd[2]))
45 {
46 assert(0);
47 }
48 if (fabs(fwd[0]) < 0.1 && fabs(fwd[1]) < 0.1 && fabs(fwd[2]) < 0.1)
49 {
50 assert(0);
51 }
52 #endif // __FXCHECKER
53
54 theFxScheduler.PlayEffect(file, org, fwd, vol, rad);
55 }
56
FX_PlayEffectID(int id,vec3_t org,vec3_t fwd,int vol,int rad,qboolean isPortal)57 void FX_PlayEffectID( int id, vec3_t org, vec3_t fwd, int vol, int rad, qboolean isPortal )
58 {
59 #ifdef __FXCHECKER
60 if (_isnan(org[0]) || _isnan(org[1]) || _isnan(org[2]))
61 {
62 assert(0);
63 }
64 if (_isnan(fwd[0]) || _isnan(fwd[1]) || _isnan(fwd[2]))
65 {
66 assert(0);
67 }
68 if (fabs(fwd[0]) < 0.1 && fabs(fwd[1]) < 0.1 && fabs(fwd[2]) < 0.1)
69 {
70 assert(0);
71 }
72 #endif // __FXCHECKER
73
74 theFxScheduler.PlayEffect(id, org, fwd, vol, rad, !!isPortal );
75 }
76
FX_PlayBoltedEffectID(int id,vec3_t org,const int boltInfo,CGhoul2Info_v * ghoul2,int iLooptime,qboolean isRelative)77 void FX_PlayBoltedEffectID( int id, vec3_t org,
78 const int boltInfo, CGhoul2Info_v *ghoul2, int iLooptime, qboolean isRelative )
79 {
80 theFxScheduler.PlayEffect(id, org, 0, boltInfo, ghoul2, -1, -1, -1, qfalse, iLooptime, !!isRelative );
81 }
82
FX_PlayEntityEffectID(int id,vec3_t org,matrix3_t axis,const int boltInfo,const int entNum,int vol,int rad)83 void FX_PlayEntityEffectID( int id, vec3_t org,
84 matrix3_t axis, const int boltInfo, const int entNum, int vol, int rad )
85 {
86 #ifdef __FXCHECKER
87 if (_isnan(org[0]) || _isnan(org[1]) || _isnan(org[2]))
88 {
89 assert(0);
90 }
91 #endif // __FXCHECKER
92
93 theFxScheduler.PlayEffect(id, org, axis, boltInfo, 0, -1, vol, rad );
94 }
95
FX_AddScheduledEffects(qboolean portal)96 void FX_AddScheduledEffects( qboolean portal )
97 {
98 theFxScheduler.AddScheduledEffects(!!portal);
99 }
100
FX_Draw2DEffects(float screenXScale,float screenYScale)101 void FX_Draw2DEffects( float screenXScale, float screenYScale )
102 {
103 theFxScheduler.Draw2DEffects( screenXScale, screenYScale );
104 }
105
FX_InitSystem(refdef_t * refdef)106 int FX_InitSystem( refdef_t* refdef )
107 {
108 return FX_Init( refdef );
109 }
110
FX_SetRefDefFromCGame(refdef_t * refdef)111 void FX_SetRefDefFromCGame( refdef_t* refdef )
112 {
113 FX_SetRefDef( refdef );
114 }
115
FX_FreeSystem(void)116 qboolean FX_FreeSystem( void )
117 {
118 return (qboolean)FX_Free( true );
119 }
120
FX_AdjustTime(int time)121 void FX_AdjustTime( int time )
122 {
123 theFxHelper.AdjustTime(time);
124 }
125