]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/csqcmodellib/common.qh
Rename defs to qh
[xonotic/xonotic-data.pk3dir.git] / qcsrc / csqcmodellib / common.qh
1 /*
2  * Copyright (c) 2011 Rudolf Polzer
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to
6  * deal in the Software without restriction, including without limitation the
7  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8  * sell copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20  * IN THE SOFTWARE.
21  */
22 #ifndef CSQCMODELLIB_COMMON_H
23 #define CSQCMODELLIB_COMMON_H
24
25 #if defined(CSQC)
26         #include "../common/util-pre.qh"
27         #include "../client/sys-pre.qh"
28         #include "../dpdefs/csprogsdefs.qh"
29         #include "../client/sys-post.qh"
30         #include "../client/defs.qh"
31         #include "../dpdefs/keycodes.qh"
32         #include "../common/constants.qh"
33         #include "../common/stats.qh"
34         #include "../warpzonelib/anglestransform.qh"
35         #include "../warpzonelib/mathlib.qh"
36         #include "../warpzonelib/common.qh"
37         #include "../warpzonelib/client.qh"
38         #include "../common/playerstats.qh"
39         #include "../common/teams.qh"
40         #include "../common/util.qh"
41         #include "../common/nades.qh"
42         #include "../common/buffs.qh"
43         #include "../common/test.qh"
44         #include "../common/counting.qh"
45         #include "../common/weapons/weapons.qh"
46         #include "../common/mapinfo.qh"
47         #include "../common/command/markup.qh"
48         #include "../common/command/rpn.qh"
49         #include "../common/command/generic.qh"
50         #include "../common/command/shared_defs.qh"
51         #include "../common/urllib.qh"
52         #include "../common/animdecide.qh"
53         #include "../client/command/cl_cmd.qh"
54         #include "../common/monsters/monsters.qh"
55         #include "../client/autocvars.qh"
56         #include "../common/notifications.qh"
57         #include "../common/deathtypes.qh"
58         #include "../client/damage.qh"
59         #include "interpolate.qh"
60         #include "../client/teamradar.qh"
61         #include "../client/hud.qh"
62         #include "../client/scoreboard.qh"
63         #include "../client/waypointsprites.qh"
64         #include "../client/movetypes.qh"
65         #include "../client/prandom.qh"
66         #include "../client/bgmscript.qh"
67         #include "../client/noise.qh"
68         #include "../client/tturrets.qh"
69         #include "../server/tturrets/include/turrets_early.qh"
70         #include "../client/main.qh"
71         #include "../client/vehicles/vehicles.qh"
72         #include "../common/csqcmodel_settings.qh"
73 #elif defined(MENUQC)
74 #elif defined(SVQC)
75         #include "../common/util-pre.qh"
76     #include "../server/sys-pre.qh"
77     #include "../dpdefs/progsdefs.qh"
78     #include "../dpdefs/dpextensions.qh"
79     #include "../server/sys-post.qh"
80     #include "../warpzonelib/anglestransform.qh"
81     #include "../warpzonelib/mathlib.qh"
82     #include "../warpzonelib/common.qh"
83     #include "../warpzonelib/util_server.qh"
84     #include "../warpzonelib/server.qh"
85     #include "../common/constants.qh"
86     #include "../common/stats.qh"
87     #include "../common/teams.qh"
88     #include "../common/util.qh"
89     #include "../common/nades.qh"
90     #include "../common/buffs.qh"
91     #include "../common/test.qh"
92     #include "../common/counting.qh"
93     #include "../common/urllib.qh"
94     #include "../common/command/markup.qh"
95     #include "../common/command/rpn.qh"
96     #include "../common/command/generic.qh"
97     #include "../common/command/shared_defs.qh"
98     #include "../common/net_notice.qh"
99     #include "../common/animdecide.qh"
100     #include "../common/monsters/monsters.qh"
101     #include "../common/monsters/sv_monsters.qh"
102     #include "../common/monsters/spawn.qh"
103     #include "../common/weapons/config.qh"
104     #include "../common/weapons/weapons.qh"
105     #include "../server/weapons/accuracy.qh"
106     #include "../server/weapons/common.qh"
107     #include "../server/weapons/csqcprojectile.qh"
108     #include "../server/weapons/hitplot.qh"
109     #include "../server/weapons/selection.qh"
110     #include "../server/weapons/spawning.qh"
111     #include "../server/weapons/throwing.qh"
112     #include "../server/weapons/tracing.qh"
113     #include "../server/weapons/weaponstats.qh"
114     #include "../server/weapons/weaponsystem.qh"
115     #include "../server/t_items.qh"
116     #include "../server/autocvars.qh"
117     #include "../server/constants.qh"
118     #include "../server/defs.qh"
119     #include "../common/notifications.qh"
120     #include "../common/deathtypes.qh"
121     #include "../server/mutators/mutators_include.qh"
122     #include "../server/tturrets/include/turrets_early.qh"
123     #include "../server/vehicles/vehicles_def.qh"
124     #include "../server/campaign.qh"
125     #include "../common/campaign_common.qh"
126     #include "../common/mapinfo.qh"
127     #include "../server/command/common.qh"
128     #include "../server/command/banning.qh"
129     #include "../server/command/radarmap.qh"
130     #include "../server/command/vote.qh"
131     #include "../server/command/getreplies.qh"
132     #include "../server/command/cmd.qh"
133     #include "../server/command/sv_cmd.qh"
134     #include "../common/csqcmodel_settings.qh"
135 #endif
136
137 noref string csqcmodel_license = "\
138 Copyright (c) 2011 Rudolf Polzer\
139 \
140 Permission is hereby granted, free of charge, to any person obtaining a copy\
141 of this software and associated documentation files (the \"Software\"), to\
142 deal in the Software without restriction, including without limitation the\
143 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\
144 sell copies of the Software, and to permit persons to whom the Software is\
145 furnished to do so, subject to the following conditions:\
146 \
147 The above copyright notice and this permission notice shall be included in\
148 all copies or substantial portions of the Software.\
149 \
150 THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\
151 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\
152 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\
153 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\
154 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\
155 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\
156 IN THE SOFTWARE.\
157 ";
158
159 .vector glowmod;
160 .vector view_ofs;
161 .float frame;
162 .float frame1time;
163 .float frame2;
164 .float frame2time;
165 .float lerpfrac;
166
167 const int CSQCMODEL_PROPERTY_FRAME = 8388608;
168 const int CSQCMODEL_PROPERTY_TELEPORTED = 4194304; // the "teleport bit" cancelling interpolation
169 const int CSQCMODEL_PROPERTY_MODELINDEX = 2097152;
170 const int CSQCMODEL_PROPERTY_ORIGIN = 1048576;
171 const int CSQCMODEL_PROPERTY_YAW = 524288;
172 const int CSQCMODEL_PROPERTY_PITCHROLL = 262144;
173 const int CSQCMODEL_PROPERTY_FRAME2 = 131072;
174 const int CSQCMODEL_PROPERTY_LERPFRAC = 65536;
175 const int CSQCMODEL_PROPERTY_SIZE = 32768;
176
177 #define ALLPROPERTIES_COMMON \
178         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME, float, ReadByte, WriteByte, frame) \
179         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_MODELINDEX, float, ReadShort, WriteShort, modelindex) \
180         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, float, ReadCoord, WriteCoord, origin_x) \
181         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, float, ReadCoord, WriteCoord, origin_y) \
182         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, float, ReadCoord, WriteCoord, origin_z) \
183         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadShort, WriteShort, mins_x) \
184         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadShort, WriteShort, mins_y) \
185         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadShort, WriteShort, mins_z) \
186         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadShort, WriteShort, maxs_x) \
187         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadShort, WriteShort, maxs_y) \
188         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadShort, WriteShort, maxs_z) \
189         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_PITCHROLL, float, ReadAngle, WriteAngle, angles_x) \
190         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_YAW, float, ReadAngle, WriteAngle, angles_y) \
191         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_PITCHROLL, float, ReadAngle, WriteAngle, angles_z) \
192         CSQCMODEL_EXTRAPROPERTIES
193
194 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
195 .float frame3;
196 .float frame3time;
197 .float lerpfrac3;
198 .float frame4;
199 .float frame4time;
200 .float lerpfrac4;
201 #define ALLPROPERTIES ALLPROPERTIES_COMMON \
202         CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME2, float, ReadByte, WriteByte, frame2) \
203         CSQCMODEL_PROPERTY_SCALED(CSQCMODEL_PROPERTY_LERPFRAC, float, ReadByte, WriteByte, lerpfrac, 255, 0, 255)
204 #else
205 #define ALLPROPERTIES ALLPROPERTIES_COMMON
206 #endif
207 #endif