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