Makefile: use `-I.`
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / doublejump / doublejump.qc
1 #ifdef IMPLEMENTATION
2 #ifdef SVQC
3         #include <server/antilag.qh>
4 #endif
5 #include <common/physics/player.qh>
6
7 #ifdef SVQC
8 REGISTER_MUTATOR(doublejump, autocvar_sv_doublejump);
9 #elif defined(CSQC)
10 REGISTER_MUTATOR(doublejump, true);
11 #endif
12
13 #define PHYS_DOUBLEJUMP(s)                     STAT(DOUBLEJUMP, s)
14
15
16 MUTATOR_HOOKFUNCTION(doublejump, PlayerJump)
17 {
18         if (PHYS_DOUBLEJUMP(self))
19         {
20                 tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
21                 if (trace_fraction < 1 && trace_plane_normal_z > 0.7)
22                 {
23                         player_multijump = true;
24
25                         // we MUST clip velocity here!
26                         float f = self.velocity * trace_plane_normal;
27                         if (f < 0)
28                                 self.velocity -= f * trace_plane_normal;
29                 }
30         }
31         return false;
32 }
33
34 #endif