]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/csqcmodel_settings.qh
Merge branch 'master' into terencehill/arena_and_ca_fixes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / csqcmodel_settings.qh
1 // define this if svqc code wants to use .frame2 and .lerpfrac
2 #define CSQCMODEL_HAVE_TWO_FRAMES
3
4 // don't define this ever
5 //#define CSQCMODEL_SUPPORT_GETTAGINFO_BEFORE_DRAW
6
7 // a hack for Xonotic
8 #ifdef CSQC
9 # define TAG_ENTITY_NAME tag_networkentity
10 # define TAG_ENTITY_TYPE float
11 .float tag_networkentity;
12 #else
13 # define TAG_ENTITY_NAME tag_entity
14 # define TAG_ENTITY_TYPE entity
15 #endif
16
17 // add properties you want networked to CSQC here
18 #define CSQCMODEL_EXTRAPROPERTIES \
19         CSQCMODEL_PROPERTY(1, float, ReadShort, WriteShort, colormap) \
20         CSQCMODEL_PROPERTY(2, float, ReadInt24_t, WriteInt24_t, effects) \
21         CSQCMODEL_PROPERTY(4, float, ReadByte, WriteByte, modelflags) \
22         CSQCMODEL_PROPERTY_SCALED(8, float, ReadByte, WriteByte, alpha, 254, -1, 254) \
23         CSQCMODEL_PROPERTY(16, float, ReadByte, WriteByte, skin) \
24         CSQCMODEL_PROPERTY(32, float, ReadApproxPastTime, WriteApproxPastTime, death_time) \
25         CSQCMODEL_IF(!isplayer) \
26                 CSQCMODEL_PROPERTY(64, TAG_ENTITY_TYPE, ReadShort, WriteEntity, TAG_ENTITY_NAME) \
27                 CSQCMODEL_PROPERTY_SCALED(128, float, ReadByte, WriteByte, glowmod_x, 255, 0, 255) \
28                 CSQCMODEL_PROPERTY_SCALED(128, float, ReadByte, WriteByte, glowmod_y, 255, 0, 255) \
29                 CSQCMODEL_PROPERTY_SCALED(128, float, ReadByte, WriteByte, glowmod_z, 255, 0, 255) \
30         CSQCMODEL_ENDIF
31 // TODO get rid of colormod/glowmod here, find good solution for nex charge glowmod hack; also get rid of some useless properties on non-players that only exist for CopyBody
32
33 // add hook function calls here
34 #define CSQCMODEL_HOOK_PREUPDATE \
35         CSQCModel_Hook_PreUpdate(isnew, isplayer, islocalplayer);
36 #define CSQCMODEL_HOOK_POSTUPDATE \
37         CSQCModel_Hook_PostUpdate(isnew, isplayer, islocalplayer);
38 #define CSQCMODEL_HOOK_PREDRAW \
39         CSQCModel_Hook_PreDraw();
40 #define CSQCPLAYER_HOOK_POSTCAMERASETUP
41
42 // force updates of player entities that often even if unchanged
43 #define CSQCPLAYER_FORCE_UPDATES 0.25
44
45 // mod must define:
46 //vector PL_MIN  = ...;
47 //vector PL_MAX  = ...;
48 //vector PL_VIEW_OFS  = ...;
49 //vector PL_CROUCH_MIN  = ...;
50 //vector PL_CROUCH_MAX  = ...;
51 //vector PL_CROUCH_VIEW_OFS  = ...;
52
53 #ifdef SVQC
54 # ifdef NO_LEGACY_NETWORKING
55 #  define CSQCMODEL_AUTOINIT() CSQCModel_LinkEntity()
56 #  define CSQCMODEL_AUTOUPDATE() CSQCModel_CheckUpdate()
57 # else
58 .float iscsqcmodel;
59 float autocvar_sv_use_csqc_players;
60 #  define CSQCMODEL_AUTOINIT() \
61         if(autocvar_sv_use_csqc_players) \
62         { \
63                 CSQCModel_LinkEntity(); \
64                 self.iscsqcmodel = 1; \
65         } \
66         else \
67                 self.iscsqcmodel = 0
68 #  define CSQCMODEL_AUTOUPDATE() \
69         if(autocvar_sv_use_csqc_players && !self.iscsqcmodel) \
70         { \
71                 CSQCModel_LinkEntity(); \
72                 self.iscsqcmodel = 1; \
73         } \
74         if(!autocvar_sv_use_csqc_players && self.iscsqcmodel) \
75         { \
76                 CSQCModel_UnlinkEntity(); \
77                 self.iscsqcmodel = 0; \
78         } \
79         if(self.iscsqcmodel) \
80                 CSQCModel_CheckUpdate()
81 # endif
82 #endif
83
84 #define CSQCMODEL_EF_RESPAWNGHOST EF_SELECTABLE