Xonotic
csqcmodel_settings.qh
Go to the documentation of this file.
1 #pragma once
2 
3 // define this if svqc code wants to use .frame2 and .lerpfrac
4 //#define CSQCMODEL_HAVE_TWO_FRAMES
5 
6 // don't define this ever
7 //#define CSQCMODEL_SUPPORT_GETTAGINFO_BEFORE_DRAW
8 
9 // server decides crouching, this lags, but so be it
10 //#define CSQCMODEL_SERVERSIDE_CROUCH
11 
12 // a hack for Xonotic
13 #ifdef CSQC
14 # define TAG_ENTITY_NAME tag_networkentity
15 # define TAG_ENTITY_TYPE float
16 .float tag_networkentity;
17 
18 # define TAG_VIEWLOC_NAME tag_networkviewloc
19 # define TAG_VIEWLOC_TYPE int
20 .float tag_networkviewloc;
21 
22 # define ALPHA m_alpha
23 .float m_alpha;
24 
25 # define GROUNDENTITY_NAME ground_networkentity
26 # define GROUNDENTITY_TYPE float
27 .float ground_networkentity;
28 #else
29 # define TAG_ENTITY_NAME tag_entity
30 # define TAG_ENTITY_TYPE entity
31 
32 # define TAG_VIEWLOC_NAME viewloc
33 # define TAG_VIEWLOC_TYPE entity
34 
35 # define ALPHA alpha
36 
37 # define GROUNDENTITY_NAME groundentity
38 # define GROUNDENTITY_TYPE entity
39 #endif
40 
41 // add properties you want networked to CSQC here
42 // NOTE: some properties share the same flag due to the limited number of bits (24) we can use
43 // generally the grouped ones are cheap (1 byte and less frequently networked)
44 // bits above 14 are defined in lib/csqcmodel/common.qh
45 #define CSQCMODEL_EXTRAPROPERTIES \
46  CSQCMODEL_PROPERTY(BIT(0), int, ReadShort, WriteShort, colormap) \
47  CSQCMODEL_PROPERTY(BIT(1), int, ReadInt24_t, WriteInt24_t, effects) \
48  CSQCMODEL_PROPERTY(BIT(2), int, ReadByte, WriteByte, modelflags) \
49  CSQCMODEL_PROPERTY(BIT(2), int, ReadByte, WriteByte, skin) \
50  CSQCMODEL_PROPERTY(BIT(2), int, ReadByte, WriteByte, traileffect) \
51  CSQCMODEL_PROPERTY(BIT(3), int, ReadByte, WriteByte, move_movetype) \
52  CSQCMODEL_PROPERTY_SCALED(BIT(3), float, ReadByte, WriteByte, ALPHA, 254, -1, 254) /* NOTE: update the use of this in cl_model.qc if you change the bitflag number! */ \
53  CSQCMODEL_PROPERTY(BIT(3), float, ReadByte, WriteByte, solid) \
54  CSQCMODEL_PROPERTY(BIT(4), int, ReadByte, WriteByte, multijump_count) \
55  CSQCMODEL_PROPERTY(BIT(4), int, ReadByte, WriteByte, clipgroup) \
56  CSQCMODEL_PROPERTY(BIT(5), float, ReadApproxPastTime, WriteApproxPastTime, death_time) \
57  CSQCMODEL_IF(isplayer) \
58  CSQCMODEL_PROPERTY(BIT(6), GROUNDENTITY_TYPE, ReadShort, WriteEntity, GROUNDENTITY_NAME) \
59  CSQCMODEL_ENDIF \
60  CSQCMODEL_IF(!isplayer) \
61  CSQCMODEL_PROPERTY(BIT(7), TAG_ENTITY_TYPE, ReadShort, WriteEntity, TAG_ENTITY_NAME) \
62  CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, glowmod_x, 254, -1, 254) \
63  CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, glowmod_y, 254, -1, 254) \
64  CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, glowmod_z, 254, -1, 254) \
65  CSQCMODEL_ENDIF \
66  CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, colormod_x, 16, 0, 255) \
67  CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, colormod_y, 16, 0, 255) \
68  CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, colormod_z, 16, 0, 255) \
69  CSQCMODEL_IF(isplayer) \
70  CSQCMODEL_PROPERTY(BIT(7), int, ReadByte, WriteByte, anim_state) \
71  CSQCMODEL_PROPERTY(BIT(7), float, ReadApproxPastTime, WriteApproxPastTime, anim_time) \
72  CSQCMODEL_IF(!islocalplayer) \
73  CSQCMODEL_PROPERTY(BIT(8), float, ReadChar, WriteChar, anim_lower_action) \
74  CSQCMODEL_PROPERTY(BIT(8), float, ReadApproxPastTime, WriteApproxPastTime, anim_lower_time) \
75  CSQCMODEL_ENDIF \
76  CSQCMODEL_PROPERTY(BIT(9), float, ReadChar, WriteChar, anim_upper_action) \
77  CSQCMODEL_PROPERTY(BIT(9), float, ReadApproxPastTime, WriteApproxPastTime, anim_upper_time) \
78  CSQCMODEL_ENDIF \
79  CSQCMODEL_PROPERTY(BIT(10), float, ReadAngle, WriteAngle, v_angle_x) \
80  CSQCMODEL_PROPERTY(BIT(11), TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME) /* NOTE: update the use of this in cl_model.qc if you change the bitflag number! */ \
81  CSQCMODEL_PROPERTY(BIT(12), float, ReadCoord, WriteCoord, scale) \
82  CSQCMODEL_PROPERTY(BIT(13), int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \
83 
84 // NOTE: bits above 14 are defined in lib/csqcmodel/common.qh, avoid reusing them if possible
85 // in particular bit 15 should NOT be reused, it is large enough sending the model's hitbox vectors!
86 // TODO get rid of colormod/glowmod here; also get rid of some useless properties on non-players that only exist for CopyBody
87 
88 // add hook function calls here
89 #define CSQCPLAYER_HOOK_POSTCAMERASETUP() \
90  viewloc_SetViewLocation()
91 
92 // force updates of player entities this frequently (per second) even if unchanged
93 #ifndef CSQCPLAYER_FORCE_UPDATES
94 #define CSQCPLAYER_FORCE_UPDATES 4
95 #endif
96 
97 // mod must define:
98 //vector PL_MIN = ...;
99 //vector PL_MAX = ...;
100 //vector PL_VIEW_OFS = ...;
101 //vector PL_CROUCH_MIN = ...;
102 //vector PL_CROUCH_MAX = ...;
103 //vector PL_CROUCH_VIEW_OFS = ...;
104 
105 #ifdef SVQC
106 # define CSQCMODEL_AUTOINIT(e) CSQCModel_LinkEntity(e)
107 # define CSQCMODEL_AUTOUPDATE(e) CSQCModel_CheckUpdate(e)
108 #endif
109 
110 #define CSQCMODEL_EF_RESPAWNGHOST EF_SELECTABLE
float m_alpha
Definition: weaponsystem.qc:74