]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/physics/movetypes/movetypes.qh
Merge branch 'terencehill/scoreboard_stuff' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / physics / movetypes / movetypes.qh
1 #pragma once
2
3 // water levels
4 const int WATERLEVEL_NONE = 0;
5 const int WATERLEVEL_WETFEET = 1;
6 const int WATERLEVEL_SWIMMING = 2;
7 const int WATERLEVEL_SUBMERGED = 3;
8
9 #define IS_ONGROUND(s)                      boolean((s).flags & FL_ONGROUND)
10 #define SET_ONGROUND(s)                     ((s).flags |= FL_ONGROUND)
11 #define UNSET_ONGROUND(s)                   ((s).flags &= ~FL_ONGROUND)
12 #define IS_ONSLICK(s)                                           boolean((s).flags & FL_ONSLICK)
13 #define SET_ONSLICK(s)                                          ((s).flags |= FL_ONSLICK)
14 #define UNSET_ONSLICK(s)                                        ((s).flags &= ~FL_ONSLICK)
15
16 #define GAMEPLAYFIX_DOWNTRACEONGROUND(s)    STAT(GAMEPLAYFIX_DOWNTRACEONGROUND)
17 #define GAMEPLAYFIX_EASIERWATERJUMP(s)      STAT(GAMEPLAYFIX_EASIERWATERJUMP)
18 #define GAMEPLAYFIX_STEPDOWN(s)             STAT(GAMEPLAYFIX_STEPDOWN)
19 #define GAMEPLAYFIX_STEPMULTIPLETIMES(s)    STAT(GAMEPLAYFIX_STEPMULTIPLETIMES)
20 #define GAMEPLAYFIX_UNSTICKPLAYERS(s)       STAT(GAMEPLAYFIX_UNSTICKPLAYERS)
21 #define GAMEPLAYFIX_WATERTRANSITION(s)          STAT(GAMEPLAYFIX_WATERTRANSITION)
22 #define UPWARD_VELOCITY_CLEARS_ONGROUND(s)  STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND)
23
24 #define PHYS_STEPHEIGHT(s)                  STAT(MOVEVARS_STEPHEIGHT)
25 #define PHYS_NOSTEP(s)                      STAT(NOSTEP)
26 #define PHYS_JUMPSTEP(s)                    STAT(MOVEVARS_JUMPSTEP)
27 #define PHYS_WALLFRICTION(s)                STAT(MOVEVARS_WALLFRICTION)
28
29 #define PHYS_WALLCLIP(s)                                        STAT(MOVEVARS_WALLCLIP)
30
31 #ifdef CSQC
32 .float bouncestop;
33 .float bouncefactor;
34
35         #define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE  (boolean(moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE))
36         #define GAMEPLAYFIX_NOGRAVITYONGROUND           (boolean(moveflags & MOVEFLAG_NOGRAVITYONGROUND))
37         #define GAMEPLAYFIX_Q2AIRACCELERATE             (boolean(moveflags & MOVEFLAG_Q2AIRACCELERATE))
38
39         #define PHYS_GRAVITY(s)                     STAT(MOVEVARS_GRAVITY, s)
40         // FIXME: 0 doesn't mean zero gravity
41         #define PHYS_ENTGRAVITY(s)                  STAT(MOVEVARS_ENTGRAVITY, s)
42
43         #define TICRATE                             ticrate
44
45 #elif defined(SVQC)
46
47         #define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE  autocvar_sv_gameplayfix_gravityunaffectedbyticrate
48         #define GAMEPLAYFIX_NOGRAVITYONGROUND           autocvar_sv_gameplayfix_nogravityonground
49         #define GAMEPLAYFIX_Q2AIRACCELERATE             autocvar_sv_gameplayfix_q2airaccelerate
50
51         #define PHYS_GRAVITY(s)                     autocvar_sv_gravity
52         #define PHYS_ENTGRAVITY(s)                  ((s).gravity)
53
54         #define TICRATE sys_frametime
55
56 #endif
57
58 void set_movetype(entity this, int mt);
59
60 .float pm_time;
61
62 .float move_movetype;
63 .float move_time;
64 //.vector move_origin;
65 //.vector move_angles;
66 //.vector move_velocity;
67 //.vector move_avelocity;
68 //.int move_flags;
69 //.int move_watertype;
70 //.int move_waterlevel;
71 .void(float, float)contentstransition;
72 //.float move_bounce_factor;
73 //.float move_bounce_stopspeed;
74 .float move_nomonsters;  // -1 for MOVE_NORMAL, otherwise a MOVE_ constant
75
76 .entity aiment;
77 .vector punchangle;
78
79 .entity groundentity;  // FIXME add move_groundnetworkentity?
80 .float move_suspendedinair;
81 .float move_didgravity;
82
83 void _Movetype_WallFriction(entity this, vector stepnormal);
84 int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnormal, float stepheight);
85 void _Movetype_CheckVelocity(entity this);
86 void _Movetype_CheckWaterTransition(entity ent);
87 float _Movetype_CheckWater(entity ent);
88 void _Movetype_LinkEdict_TouchAreaGrid(entity this);
89 void _Movetype_LinkEdict(entity this, float touch_triggers);
90 vector _Movetype_ClipVelocity(vector vel, vector norm, float f);
91 void _Movetype_PushEntityTrace(entity this, vector push);
92 float _Movetype_PushEntity(entity this, vector push, float failonstartsolid);
93
94 void Movetype_Physics_NoMatchTicrate(entity this, float movedt, bool isclient);
95 void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy);
96 void Movetype_Physics_MatchServer(entity this, bool sloppy);
97 void Movetype_Physics_NoMatchServer(entity this);
98 void _Movetype_LinkEdict(entity this, float touch_triggers);
99 void _Movetype_LinkEdict_TouchAreaGrid(entity this);
100
101 float _Movetype_UnstickEntity(entity this);
102
103 const int MAX_CLIP_PLANES = 5;
104
105 #ifdef CSQC
106 const int MOVETYPE_NONE             = 0;
107 const int MOVETYPE_ANGLENOCLIP      = 1;
108 const int MOVETYPE_ANGLECLIP        = 2;
109 const int MOVETYPE_WALK             = 3;
110 const int MOVETYPE_STEP             = 4;
111 const int MOVETYPE_FLY              = 5;
112 const int MOVETYPE_TOSS             = 6;
113 const int MOVETYPE_PUSH             = 7;
114 const int MOVETYPE_NOCLIP           = 8;
115 const int MOVETYPE_FLYMISSILE       = 9;
116 const int MOVETYPE_BOUNCE           = 10;
117 const int MOVETYPE_BOUNCEMISSILE    = 11;  // Like bounce but doesn't lose speed on bouncing
118 const int MOVETYPE_FOLLOW           = 12;
119 const int MOVETYPE_PHYSICS          = 32;
120 const int MOVETYPE_FLY_WORLDONLY    = 33;
121
122 const int FL_ITEM                   = 256;
123 const int FL_ONGROUND                           = 512;
124 #elif defined(SVQC)
125 const int MOVETYPE_ANGLENOCLIP      = 1;
126 const int MOVETYPE_ANGLECLIP        = 2;
127 #endif
128
129 const int FL_ONSLICK = BIT(20);
130
131 const int MOVETYPE_FAKEPUSH         = 13;
132
133 const int MOVEFLAG_VALID = BIT(23);
134 const int MOVEFLAG_Q2AIRACCELERATE = BIT(0);
135 const int MOVEFLAG_NOGRAVITYONGROUND = BIT(1);
136 const int MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE = BIT(2);
137
138 #ifdef CSQC
139 #define moveflags STAT(MOVEFLAGS)
140 #endif