]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/physics/player.qh
Make precedence explicit in expressions where || and && are mixed (patch by martin-t)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / physics / player.qh
index 0ebea585f80e61071cedd24e4c8e2d22abdec445..fc11cfab263185de02d7ccd67f3ce06069693fe3 100644 (file)
 .float swamp_slowdown;
 .float lastflags;
 .float lastground;
-.float wasFlying;
-#ifdef SVQC
-.float spectatorspeed = _STAT(SPECTATORSPEED);
-#elif defined(CSQC)
-.float spectatorspeed;
-#endif
+.bool wasFlying;
 
 .int buttons_old;
 .vector movement_old;
@@ -106,15 +101,6 @@ bool IsFlying(entity a);
 #define PHYS_INPUT_BUTTON_ZOOM(s)           PHYS_INPUT_BUTTON_BUTTON4(s)
 #define PHYS_INPUT_BUTTON_CROUCH(s)         PHYS_INPUT_BUTTON_BUTTON5(s)
 #define PHYS_INPUT_BUTTON_HOOK(s)           PHYS_INPUT_BUTTON_BUTTON6(s)
-
-#ifdef CSQC
-STATIC_INIT(PHYS_INPUT_BUTTON_HOOK)
-{
-       localcmd("alias +hook +button6\n");
-       localcmd("alias -hook -button6\n");
-}
-#endif
-
 #define PHYS_INPUT_BUTTON_INFO(s)           PHYS_INPUT_BUTTON_BUTTON7(s)
 #define PHYS_INPUT_BUTTON_DRAG(s)           PHYS_INPUT_BUTTON_BUTTON8(s)
 #define PHYS_INPUT_BUTTON_USE(s)            PHYS_INPUT_BUTTON_BUTTON_USE(s)
@@ -123,18 +109,19 @@ STATIC_INIT(PHYS_INPUT_BUTTON_HOOK)
 #define PHYS_INPUT_BUTTON_ZOOMSCRIPT(s)     PHYS_INPUT_BUTTON_BUTTON9(s)
 #define PHYS_INPUT_BUTTON_JETPACK(s)        PHYS_INPUT_BUTTON_BUTTON10(s)
 #define PHYS_INPUT_BUTTON_DODGE(s)                     PHYS_INPUT_BUTTON_BUTTON11(s)
+#define PHYS_INPUT_BUTTON_MINIGAME(s)          PHYS_INPUT_BUTTON_BUTTON12(s)
 
 #ifdef CSQC
-STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK)
+STATIC_INIT(PHYS_INPUT_BUTTON)
 {
+       localcmd("alias +hook +button6\n");
+       localcmd("alias -hook -button6\n");
+
        localcmd("alias +jetpack +button10\n");
-    localcmd("alias -jetpack -button10\n");
-}
+       localcmd("alias -jetpack -button10\n");
 
-STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
-{
-    localcmd("alias +dodge +button11\n");
-    localcmd("alias -dodge -button11\n");
+       localcmd("alias +dodge +button11\n");
+       localcmd("alias -dodge -button11\n");
 }
 #endif
 
@@ -148,17 +135,17 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
 // used for special commands and idle checking, not from the engine
 // TODO: cache
 #define PHYS_INPUT_BUTTON_MASK(s) ( \
-         (1 <<  0) * PHYS_INPUT_BUTTON_ATCK(s) \
-       | (1 <<  1) * PHYS_INPUT_BUTTON_JUMP(s) \
-       | (1 <<  2) * PHYS_INPUT_BUTTON_ATCK2(s) \
-       | (1 <<  3) * PHYS_INPUT_BUTTON_ZOOM(s) \
-       | (1 <<  4) * PHYS_INPUT_BUTTON_CROUCH(s) \
-       | (1 <<  5) * PHYS_INPUT_BUTTON_HOOK(s) \
-       | (1 <<  6) * PHYS_INPUT_BUTTON_USE(s) \
-       | (1 <<  7) * PHYS_INPUT_BUTTON_BACKWARD(s) \
-       | (1 <<  8) * PHYS_INPUT_BUTTON_FORWARD(s) \
-       | (1 <<  9) * PHYS_INPUT_BUTTON_LEFT(s) \
-       | (1 << 10) * PHYS_INPUT_BUTTON_RIGHT(s) \
+         ((1 <<  0) * PHYS_INPUT_BUTTON_ATCK(s)) \
+       | ((1 <<  1) * PHYS_INPUT_BUTTON_JUMP(s)) \
+       | ((1 <<  2) * PHYS_INPUT_BUTTON_ATCK2(s)) \
+       | ((1 <<  3) * PHYS_INPUT_BUTTON_ZOOM(s)) \
+       | ((1 <<  4) * PHYS_INPUT_BUTTON_CROUCH(s)) \
+       | ((1 <<  5) * PHYS_INPUT_BUTTON_HOOK(s)) \
+       | ((1 <<  6) * PHYS_INPUT_BUTTON_USE(s)) \
+       | ((1 <<  7) * PHYS_INPUT_BUTTON_BACKWARD(s)) \
+       | ((1 <<  8) * PHYS_INPUT_BUTTON_FORWARD(s)) \
+       | ((1 <<  9) * PHYS_INPUT_BUTTON_LEFT(s)) \
+       | ((1 << 10) * PHYS_INPUT_BUTTON_RIGHT(s)) \
        )
 
 #define IS_JUMP_HELD(s)                     (!((s).flags & FL_JUMPRELEASED))
@@ -171,10 +158,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
 #define ITEMS_STAT(s)                       ((s).items)
 
 .float teleport_time;
-#define PHYS_TELEPORT_TIME(s)               ((s).teleport_time)
-
-.float waterjump_time;
-#define PHYS_WATERJUMP_TIME(s)               ((s).waterjump_time)
 
 #ifdef CSQC
 
@@ -203,8 +186,8 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        .entity hook;
 
 // TODO
-       #define IS_CLIENT(s)                        ((s).isplayermodel || (s) == csqcplayer)
-       #define IS_PLAYER(s)                        ((s).isplayermodel)
+       #define IS_CLIENT(s)                        (((s).isplayermodel & ISPLAYER_CLIENT) || (s) == csqcplayer)
+       #define IS_PLAYER(s)                        ((s).isplayermodel & ISPLAYER_PLAYER)
        #define IS_NOT_A_CLIENT(s)                  (!(s).isplayermodel && (s) != csqcplayer)
        #define isPushable(s)                       ((s).isplayermodel || (s).pushable || ((s).flags & FL_PROJECTILE))
 
@@ -245,6 +228,8 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        #define SET_DUCKED(s)                       ((s).flags |= FL_DUCKED)
        #define UNSET_DUCKED(s)                     ((s).flags &= ~FL_DUCKED)
 
+       #define PHYS_INVEHICLE(s)                                       (boolean(hud != HUD_NORMAL))
+
        #define PHYS_JUMPSPEEDCAP_MIN               autocvar_cl_jumpspeedcap_min
        #define PHYS_JUMPSPEEDCAP_MAX               autocvar_cl_jumpspeedcap_max
 
@@ -260,9 +245,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
 
        void PM_UpdateButtons(entity this, entity store);
 
-       .float stat_sv_airspeedlimit_nonqw = _STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW);
-       .float stat_sv_maxspeed = _STAT(MOVEVARS_MAXSPEED);
-
        /** Not real stats */
        .string jumpspeedcap_min;
        .string jumpspeedcap_max;
@@ -300,6 +282,8 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        #define SET_DUCKED(s)                       ((s).crouch = true)
        #define UNSET_DUCKED(s)                     ((s).crouch = false)
 
+       #define PHYS_INVEHICLE(s)                                       (boolean((s).vehicle != NULL))
+
        #define PHYS_JUMPSPEEDCAP_MIN               autocvar_sv_jumpspeedcap_min
        #define PHYS_JUMPSPEEDCAP_MAX               autocvar_sv_jumpspeedcap_max