]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/effects.qh
Improve compatibility with cpp
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / effects.qh
1 #ifndef P_EFFECTS_H
2 #define P_EFFECTS_H
3
4 #ifdef CSQC
5 void Read_Effect(bool is_new);
6 #elif defined(SVQC)
7 void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt);
8 void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt);
9 #endif
10
11 #define particleeffectnum(e) _particleeffectnum(e.eent_eff_name)
12
13 void RegisterEffects();
14 const int MAX_EFFECTS = 512;
15 entity effects_ent[MAX_EFFECTS], effects_ent_first, effects_ent_last;
16 int EFFECT_COUNT;
17
18 #define EFFECT(istrail, name, realname) \
19     REGISTER(RegisterEffects, EFFECT, effects_ent, EFFECT_COUNT, name, m_id, Create_Effect_Entity(realname, istrail));
20 REGISTER_REGISTRY(RegisterEffects)
21
22 .int m_id;
23 .string eent_eff_name;
24 .int eent_eff_trail;
25
26 .vector eent_net_location;
27 .vector eent_net_velocity;
28 .int eent_net_count;
29
30 entity Create_Effect_Entity(string eff_name, bool eff_trail)
31 {
32         entity this = new(effect_entity);
33         this.eent_eff_name = eff_name;
34         this.eent_eff_trail = eff_trail;
35         return this;
36 }
37
38 void RegisterEffects_First()
39 {
40     #ifdef SVQC
41     #define dedi (server_is_dedicated ? "a dedicated " : "")
42     #else
43     #define dedi ""
44     #endif
45
46     LOG_TRACEF("Beginning effect initialization on %s%s program...\n", dedi, PROGNAME);
47     #undef dedi
48 }
49
50 void RegisterEffects_Done()
51 {
52     LOG_TRACE("Effects initialization successful!\n");
53 }
54
55 // NOW we actually activate the declarations
56 ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_First)
57 EFFECT(0, Null, string_null)
58 #include "effects.inc"
59 ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_Done)
60
61 #endif