]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/csqcmodel_settings.qh
Merge branch 'master' into terencehill/menu_hudskin_selector
[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
23 # define MOVETYPE_NAME move_movetype
24 #else
25 # define TAG_ENTITY_NAME tag_entity
26 # define TAG_ENTITY_TYPE entity
27
28 # define TAG_VIEWLOC_NAME viewloc
29 # define TAG_VIEWLOC_TYPE entity
30
31 # define MOVETYPE_NAME movetype
32 #endif
33
34 // new fields
35 .vector v_angle;
36
37 // add properties you want networked to CSQC here
38 #define CSQCMODEL_EXTRAPROPERTIES \
39         CSQCMODEL_PROPERTY(BIT(0), int, ReadShort, WriteShort, colormap) \
40         CSQCMODEL_PROPERTY(BIT(1), int, ReadInt24_t, WriteInt24_t, effects) \
41         CSQCMODEL_PROPERTY(BIT(2), int, ReadByte, WriteByte, modelflags) \
42         CSQCMODEL_PROPERTY_SCALED(BIT(3), float, ReadByte, WriteByte, alpha, 254, -1, 254) \
43         CSQCMODEL_PROPERTY(BIT(4), int, ReadByte, WriteByte, skin) \
44         CSQCMODEL_PROPERTY(BIT(5), float, ReadApproxPastTime, WriteApproxPastTime, death_time) \
45         CSQCMODEL_PROPERTY(BIT(6), float, ReadByte, WriteByte, solid) \
46         CSQCMODEL_IF(!isplayer) \
47                 CSQCMODEL_PROPERTY(BIT(7), TAG_ENTITY_TYPE, ReadShort, WriteEntity, TAG_ENTITY_NAME) \
48                 CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, glowmod_x, 254, -1, 254) \
49                 CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, glowmod_y, 254, -1, 254) \
50                 CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, glowmod_z, 254, -1, 254) \
51                 CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, colormod_x, 254, -1, 254) \
52                 CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, colormod_y, 254, -1, 254) \
53                 CSQCMODEL_PROPERTY_SCALED(BIT(8), float, ReadByte, WriteByte, colormod_z, 254, -1, 254) \
54         CSQCMODEL_ENDIF \
55         CSQCMODEL_IF(isplayer) \
56                 CSQCMODEL_PROPERTY(BIT(7), int, ReadByte, WriteByte, anim_state) \
57                 CSQCMODEL_PROPERTY(BIT(7), float, ReadApproxPastTime, WriteApproxPastTime, anim_time) \
58                 CSQCMODEL_IF(!islocalplayer) \
59                         CSQCMODEL_PROPERTY(BIT(8), float, ReadChar, WriteChar, anim_lower_action) \
60                         CSQCMODEL_PROPERTY(BIT(8), float, ReadApproxPastTime, WriteApproxPastTime, anim_lower_time) \
61                 CSQCMODEL_ENDIF \
62                 CSQCMODEL_PROPERTY(BIT(9), float, ReadChar, WriteChar, anim_upper_action) \
63                 CSQCMODEL_PROPERTY(BIT(9), float, ReadApproxPastTime, WriteApproxPastTime, anim_upper_time) \
64         CSQCMODEL_ENDIF \
65         CSQCMODEL_PROPERTY(BIT(10), float, ReadAngle, WriteAngle, v_angle_x) \
66         CSQCMODEL_PROPERTY(BIT(11), int, ReadByte, WriteByte, traileffect) \
67         CSQCMODEL_PROPERTY_SCALED(BIT(12), float, ReadByte, WriteByte, scale, 16, 0, 255) \
68         CSQCMODEL_PROPERTY(BIT(13), int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \
69         CSQCMODEL_PROPERTY(BIT(14), TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME) \
70         CSQCMODEL_PROPERTY(BIT(15), int, ReadByte, WriteByte, multijump_count) \
71         CSQCMODEL_PROPERTY(BIT(16), int, ReadByte, WriteByte, MOVETYPE_NAME)
72 // 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
73
74 // add hook function calls here
75 #define CSQCMODEL_HOOK_PREUPDATE \
76         CSQCModel_Hook_PreUpdate(isnew, isplayer, islocalplayer);
77 #define CSQCMODEL_HOOK_POSTUPDATE \
78         CSQCModel_Hook_PostUpdate(isnew, isplayer, islocalplayer);
79 #define CSQCMODEL_HOOK_PREDRAW \
80         CSQCModel_Hook_PreDraw(isplayer);
81 #define CSQCPLAYER_HOOK_POSTCAMERASETUP() \
82         CSQCPlayer_SetViewLocation()
83
84 // force updates of player entities that often even if unchanged
85 #ifndef CSQCPLAYER_FORCE_UPDATES
86 #define CSQCPLAYER_FORCE_UPDATES 0.25
87 #endif
88
89 // mod must define:
90 //vector PL_MIN  = ...;
91 //vector PL_MAX  = ...;
92 //vector PL_VIEW_OFS  = ...;
93 //vector PL_CROUCH_MIN  = ...;
94 //vector PL_CROUCH_MAX  = ...;
95 //vector PL_CROUCH_VIEW_OFS  = ...;
96
97 #ifdef SVQC
98 # define CSQCMODEL_AUTOINIT(e) CSQCModel_LinkEntity(e)
99 # define CSQCMODEL_AUTOUPDATE(e) CSQCModel_CheckUpdate(e)
100 #endif
101
102 #define CSQCMODEL_EF_RESPAWNGHOST EF_SELECTABLE
103 #endif