Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
doublejump.qc
Go to the documentation of this file.
1
#include "
doublejump.qh
"
2
3
#ifdef GAMEQC
4
#ifdef SVQC
5
#include <
server/antilag.qh
>
6
#endif
7
#include <
common/physics/player.qh
>
8
9
#ifdef SVQC
10
REGISTER_MUTATOR
(doublejump,
autocvar_sv_doublejump
);
11
#elif defined(CSQC)
12
REGISTER_MUTATOR
(doublejump,
true
);
13
#endif
14
15
#define PHYS_DOUBLEJUMP(s) STAT(DOUBLEJUMP, s)
16
17
18
MUTATOR_HOOKFUNCTION
(doublejump,
PlayerJump
)
19
{
20
entity
player =
M_ARGV
(0,
entity
);
21
22
if
(
PHYS_DOUBLEJUMP
(player))
23
{
24
tracebox(player.origin +
'0 0 0.01'
, player.mins, player.maxs, player.origin -
'0 0 0.01'
,
MOVE_NORMAL
, player);
25
if
(
trace_fraction < 1 && trace_plane_normal_z >
0.7)
26
{
27
M_ARGV
(2,
bool
) =
true
;
28
29
// we MUST clip velocity here!
30
float
f = player.velocity *
trace_plane_normal
;
31
if
(f < 0)
32
player.velocity -= f *
trace_plane_normal
;
33
}
34
}
35
}
36
#endif
antilag.qh
REGISTER_MUTATOR
#define REGISTER_MUTATOR(...)
Definition
base.qh:295
MUTATOR_HOOKFUNCTION
#define MUTATOR_HOOKFUNCTION(...)
Definition
base.qh:335
entity
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
M_ARGV
#define M_ARGV(x, type)
Definition
events.qh:17
PlayerJump
bool PlayerJump(entity this)
Definition
player.qc:378
player.qh
MOVE_NORMAL
const float MOVE_NORMAL
Definition
csprogsdefs.qc:256
trace_fraction
float trace_fraction
Definition
csprogsdefs.qc:36
trace_plane_normal
vector trace_plane_normal
Definition
csprogsdefs.qc:38
PHYS_DOUBLEJUMP
#define PHYS_DOUBLEJUMP(s)
Definition
doublejump.qc:15
doublejump.qh
autocvar_sv_doublejump
bool autocvar_sv_doublejump
Definition
doublejump.qh:4
common
mutators
mutator
doublejump
doublejump.qc
Generated on
for Xonotic QuakeC by
1.14.0