Xonotic
common.qh
Go to the documentation of this file.
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 #pragma once
23 
25 
26 noref string csqcmodel_license = "\
27 Copyright (c) 2011 Rudolf Polzer\
28 \
29 Permission is hereby granted, free of charge, to any person obtaining a copy\
30 of this software and associated documentation files (the \"Software\"), to\
31 deal in the Software without restriction, including without limitation the\
32 rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\
33 sell copies of the Software, and to permit persons to whom the Software is\
34 furnished to do so, subject to the following conditions:\
35 \
36 The above copyright notice and this permission notice shall be included in\
37 all copies or substantial portions of the Software.\
38 \
39 THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\
40 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\
41 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\
42 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\
43 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\
44 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\
45 IN THE SOFTWARE.\
46 "; // "
47 
48 .vector glowmod;
49 .vector view_ofs;
50 .int frame;
51 .float frame1time;
52 .int frame2;
53 .float frame2time;
54 .float lerpfrac;
55 
56 const int ISPLAYER_MODEL = BIT(0); // using a player model
57 const int ISPLAYER_CLIENT = BIT(1); // is a client
58 const int ISPLAYER_LOCAL = BIT(2); // is the local player
59 const int ISPLAYER_PLAYER = BIT(3); // is a player in the match
60 
61 const int CSQCMODEL_PROPERTY_FRAME = BIT(23);
62 const int CSQCMODEL_PROPERTY_TELEPORTED = BIT(22); // the "teleport bit" cancelling interpolation
65 const int CSQCMODEL_PROPERTY_YAW = BIT(19);
69 const int CSQCMODEL_PROPERTY_SIZE = BIT(15);
70 
71 #define ALLPROPERTIES_COMMON \
72  CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME, int, ReadByte, WriteByte, frame) \
73  CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_MODELINDEX, int, ReadShort, WriteShort, modelindex) \
74  CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, vector, ReadVector, WriteVector, origin) \
75  CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, vector, ReadVector, WriteVector, mins) \
76  CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, vector, ReadVector, WriteVector, maxs) \
77  CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_PITCHROLL, float, ReadAngle, WriteAngle, angles_x) \
78  CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_YAW, float, ReadAngle, WriteAngle, angles_y) \
79  CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_PITCHROLL, float, ReadAngle, WriteAngle, angles_z) \
80  CSQCMODEL_EXTRAPROPERTIES
81 
82 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
83 .float frame3;
84 .float frame3time;
85 .float lerpfrac3;
86 .float frame4;
87 .float frame4time;
88 .float lerpfrac4;
89 #define ALLPROPERTIES ALLPROPERTIES_COMMON \
90  CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME2, int, ReadByte, WriteByte, frame2) \
91  CSQCMODEL_PROPERTY_SCALED(CSQCMODEL_PROPERTY_LERPFRAC, float, ReadByte, WriteByte, lerpfrac, 255, 0, 255)
92 #else
93 #define ALLPROPERTIES ALLPROPERTIES_COMMON
94 #endif
const int CSQCMODEL_PROPERTY_MODELINDEX
Definition: common.qh:63
const int ISPLAYER_PLAYER
Definition: common.qh:59
const int CSQCMODEL_PROPERTY_YAW
Definition: common.qh:65
float frame1time
Definition: common.qh:51
float lerpfrac
Definition: common.qh:54
float frame4
quaternary framegroup animation (strength = lerpfrac4)
Definition: anim.qh:12
const int CSQCMODEL_PROPERTY_SIZE
Definition: common.qh:69
vector glowmod
Definition: common.qh:48
float frame3
tertiary framegroup animation (strength = lerpfrac3)
Definition: anim.qh:10
const int CSQCMODEL_PROPERTY_ORIGIN
Definition: common.qh:64
const int CSQCMODEL_PROPERTY_FRAME2
Definition: common.qh:67
float frame2time
Definition: common.qh:53
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition: bits.qh:8
float frame3time
start time of framegroup animation
Definition: anim.qh:26
const int ISPLAYER_LOCAL
Definition: common.qh:58
vector view_ofs
Definition: common.qh:49
float lerpfrac4
strength of framegroup blend
Definition: anim.qh:19
const int CSQCMODEL_PROPERTY_PITCHROLL
Definition: common.qh:66
const int CSQCMODEL_PROPERTY_LERPFRAC
Definition: common.qh:68
float frame4time
start time of framegroup animation
Definition: anim.qh:28
int frame2
Definition: common.qh:52
const int CSQCMODEL_PROPERTY_FRAME
Definition: common.qh:61
noref string csqcmodel_license
Definition: common.qh:26
const int ISPLAYER_CLIENT
Definition: common.qh:57
const int CSQCMODEL_PROPERTY_TELEPORTED
Definition: common.qh:62
const int ISPLAYER_MODEL
Definition: common.qh:56
int frame
Definition: common.qh:50
float lerpfrac3
strength of framegroup blend
Definition: anim.qh:17