Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
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
17
18# define TAG_VIEWLOC_NAME tag_networkviewloc
19# define TAG_VIEWLOC_TYPE int
21
22# define ALPHA m_alpha
23.float m_alpha;
24
25# define GROUNDENTITY_NAME ground_networkentity
26# define GROUNDENTITY_TYPE float
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_IF(!isplayer) \
48 CSQCMODEL_PROPERTY(BIT(0), int, ReadByte, WriteByte, sv_entnum) \
49 CSQCMODEL_ENDIF \
50 CSQCMODEL_PROPERTY(BIT(1), int, ReadInt24_t, WriteInt24_t, effects) \
51 CSQCMODEL_PROPERTY(BIT(2), int, ReadByte, WriteByte, modelflags) \
52 CSQCMODEL_PROPERTY(BIT(2), int, ReadByte, WriteByte, skin) \
53 CSQCMODEL_PROPERTY(BIT(2), int, ReadByte, WriteByte, traileffect) \
54 CSQCMODEL_PROPERTY(BIT(3), int, ReadByte, WriteByte, move_movetype) \
55 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! */ \
56 CSQCMODEL_PROPERTY(BIT(3), float, ReadByte, WriteByte, solid) \
57 CSQCMODEL_PROPERTY(BIT(4), int, ReadByte, WriteByte, multijump_count) \
58 CSQCMODEL_PROPERTY(BIT(4), int, ReadByte, WriteByte, clipgroup) \
59 CSQCMODEL_PROPERTY(BIT(5), float, ReadApproxPastTime, WriteApproxPastTime, death_time) \
60 CSQCMODEL_IF(isplayer) \
61 CSQCMODEL_PROPERTY(BIT(6), GROUNDENTITY_TYPE, ReadShort, WriteEntity, GROUNDENTITY_NAME) \
62 CSQCMODEL_ENDIF \
63 CSQCMODEL_IF(!isplayer) \
64 CSQCMODEL_PROPERTY(BIT(7), TAG_ENTITY_TYPE, ReadShort, WriteEntity, TAG_ENTITY_NAME) \
65 CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, glowmod_x, 254, -1, 254) \
66 CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, glowmod_y, 254, -1, 254) \
67 CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, glowmod_z, 254, -1, 254) \
68 CSQCMODEL_ENDIF \
69 CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, colormod_x, 16, 0, 255) \
70 CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, colormod_y, 16, 0, 255) \
71 CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, colormod_z, 16, 0, 255) \
72 CSQCMODEL_IF(isplayer) \
73 CSQCMODEL_PROPERTY(BIT(7), int, ReadByte, WriteByte, anim_state) \
74 CSQCMODEL_PROPERTY(BIT(7), float, ReadApproxPastTime, WriteApproxPastTime, anim_time) \
75 CSQCMODEL_IF(!islocalplayer) \
76 CSQCMODEL_PROPERTY(BIT(8), float, ReadChar, WriteChar, anim_lower_action) \
77 CSQCMODEL_PROPERTY(BIT(8), float, ReadApproxPastTime, WriteApproxPastTime, anim_lower_time) \
78 CSQCMODEL_ENDIF \
79 CSQCMODEL_PROPERTY(BIT(9), float, ReadChar, WriteChar, anim_upper_action) \
80 CSQCMODEL_PROPERTY(BIT(9), float, ReadApproxPastTime, WriteApproxPastTime, anim_upper_time) \
81 CSQCMODEL_ENDIF \
82 CSQCMODEL_PROPERTY(BIT(10), float, ReadAngle, WriteAngle, v_angle_x) \
83 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! */ \
84 CSQCMODEL_PROPERTY(BIT(12), float, ReadCoord, WriteCoord, scale) \
85 CSQCMODEL_PROPERTY(BIT(13), int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \
86 /**/
87// NOTE: bits above 14 are defined in lib/csqcmodel/common.qh, avoid reusing them if possible
88// in particular bit 15 should NOT be reused, it is large enough sending the model's hitbox vectors!
89// TODO get rid of colormod/glowmod here; also get rid of some useless properties on non-players that only exist for CopyBody
90
91// add hook function calls here
92#define CSQCPLAYER_HOOK_POSTCAMERASETUP() \
93 viewloc_SetViewLocation()
94
95// force updates of player entities this frequently (per second) even if unchanged
96#ifndef CSQCPLAYER_FORCE_UPDATES
97#define CSQCPLAYER_FORCE_UPDATES 4
98#endif
99
100// mod must define:
101//vector PL_MIN = ...;
102//vector PL_MAX = ...;
103//vector PL_VIEW_OFS = ...;
104//vector PL_CROUCH_MIN = ...;
105//vector PL_CROUCH_MAX = ...;
106//vector PL_CROUCH_VIEW_OFS = ...;
107
108#ifdef SVQC
109# define CSQCMODEL_AUTOINIT(e) CSQCModel_LinkEntity(e)
110# define CSQCMODEL_AUTOUPDATE(e) CSQCModel_CheckUpdate(e)
111#endif
112
113#define CSQCMODEL_EF_RESPAWNGHOST EF_SELECTABLE
float ground_networkentity
float tag_networkviewloc
float m_alpha
float tag_networkentity