Merge branches 'TimePath/weaponsys' and 'Mario/modpack'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / csqcmodel_settings.qh
1 #ifndef CSQCMODEL_SETTINGS_H
2 #define CSQCMODEL_SETTINGS_H
3
4 // define this if svqc code wants to use .frame2 and .lerpfrac
5 //#define CSQCMODEL_HAVE_TWO_FRAMES
6
7 // don't define this ever
8 //#define CSQCMODEL_SUPPORT_GETTAGINFO_BEFORE_DRAW
9
10 // server decides crouching, this lags, but so be it
11 //#define CSQCMODEL_SERVERSIDE_CROUCH
12
13 // a hack for Xonotic
14 #ifdef CSQC
15 # define TAG_ENTITY_NAME tag_networkentity
16 # define TAG_ENTITY_TYPE float
17 .float tag_networkentity;
18
19 # define TAG_VIEWLOC_NAME tag_networkviewloc
20 # define TAG_VIEWLOC_TYPE int
21 .float tag_networkviewloc;
22 #else
23 # define TAG_ENTITY_NAME tag_entity
24 # define TAG_ENTITY_TYPE entity
25
26 # define TAG_VIEWLOC_NAME viewloc
27 # define TAG_VIEWLOC_TYPE entity
28 #endif
29
30 // new fields
31 .vector v_angle;
32
33 // add properties you want networked to CSQC here
34 #define CSQCMODEL_EXTRAPROPERTIES \
35         CSQCMODEL_PROPERTY(1, int, ReadShort, WriteShort, colormap) \
36         CSQCMODEL_PROPERTY(2, int, ReadInt24_t, WriteInt24_t, effects) \
37         CSQCMODEL_PROPERTY(4, int, ReadByte, WriteByte, modelflags) \
38         CSQCMODEL_PROPERTY_SCALED(8, float, ReadByte, WriteByte, alpha, 254, -1, 254) \
39         CSQCMODEL_PROPERTY(16, int, ReadByte, WriteByte, skin) \
40         CSQCMODEL_PROPERTY(32, float, ReadApproxPastTime, WriteApproxPastTime, death_time) \
41         CSQCMODEL_PROPERTY(64, float, ReadByte, WriteByte, solid) \
42         CSQCMODEL_IF(!isplayer) \
43                 CSQCMODEL_PROPERTY(128, TAG_ENTITY_TYPE, ReadShort, WriteEntity, TAG_ENTITY_NAME) \
44                 CSQCMODEL_PROPERTY_SCALED(256, float, ReadByte, WriteByte, glowmod_x, 255, 0, 255) \
45                 CSQCMODEL_PROPERTY_SCALED(256, float, ReadByte, WriteByte, glowmod_y, 255, 0, 255) \
46                 CSQCMODEL_PROPERTY_SCALED(256, float, ReadByte, WriteByte, glowmod_z, 255, 0, 255) \
47                 CSQCMODEL_PROPERTY_SCALED(256, float, ReadByte, WriteByte, colormod_x, 255, 0, 255) \
48                 CSQCMODEL_PROPERTY_SCALED(256, float, ReadByte, WriteByte, colormod_y, 255, 0, 255) \
49                 CSQCMODEL_PROPERTY_SCALED(256, float, ReadByte, WriteByte, colormod_z, 255, 0, 255) \
50         CSQCMODEL_ENDIF \
51         CSQCMODEL_IF(isplayer) \
52                 CSQCMODEL_PROPERTY(128, int, ReadByte, WriteByte, anim_state) \
53                 CSQCMODEL_PROPERTY(128, float, ReadApproxPastTime, WriteApproxPastTime, anim_time) \
54                 CSQCMODEL_IF(!islocalplayer) \
55                         CSQCMODEL_PROPERTY(256, float, ReadChar, WriteChar, anim_lower_action) \
56                         CSQCMODEL_PROPERTY(256, float, ReadApproxPastTime, WriteApproxPastTime, anim_lower_time) \
57                 CSQCMODEL_ENDIF \
58                 CSQCMODEL_PROPERTY(512, float, ReadChar, WriteChar, anim_upper_action) \
59                 CSQCMODEL_PROPERTY(512, float, ReadApproxPastTime, WriteApproxPastTime, anim_upper_time) \
60         CSQCMODEL_ENDIF \
61         CSQCMODEL_PROPERTY(1024, float, ReadAngle, WriteAngle, v_angle_x) \
62         CSQCMODEL_PROPERTY_SCALED(4096, float, ReadByte, WriteByte, scale, 16, 0, 255) \
63         CSQCMODEL_PROPERTY(8192, int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \
64         CSQCMODEL_PROPERTY(16384, TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME) 
65 // TODO get rid of colormod/glowmod here, find good solution for vortex charge glowmod hack; also get rid of some useless properties on non-players that only exist for CopyBody
66
67 // add hook function calls here
68 #define CSQCMODEL_HOOK_PREUPDATE \
69         CSQCModel_Hook_PreUpdate(isnew, isplayer, islocalplayer);
70 #define CSQCMODEL_HOOK_POSTUPDATE \
71         CSQCModel_Hook_PostUpdate(isnew, isplayer, islocalplayer);
72 #define CSQCMODEL_HOOK_PREDRAW \
73         CSQCModel_Hook_PreDraw(isplayer);
74 #define CSQCPLAYER_HOOK_POSTCAMERASETUP \
75         CSQCPlayer_SetViewLocation();
76
77 // force updates of player entities that often even if unchanged
78 #define CSQCPLAYER_FORCE_UPDATES 0.25
79
80 // mod must define:
81 //vector PL_MIN  = ...;
82 //vector PL_MAX  = ...;
83 //vector PL_VIEW_OFS  = ...;
84 //vector PL_CROUCH_MIN  = ...;
85 //vector PL_CROUCH_MAX  = ...;
86 //vector PL_CROUCH_VIEW_OFS  = ...;
87
88 #ifdef SVQC
89 # define CSQCMODEL_AUTOINIT() CSQCModel_LinkEntity()
90 # define CSQCMODEL_AUTOUPDATE() CSQCModel_CheckUpdate()
91 #endif
92
93 #define CSQCMODEL_EF_RESPAWNGHOST EF_SELECTABLE
94 #endif