]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/physics.qh
Merge branch 'master' into TimePath/stats
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / physics.qh
index 682e58712fe718a15c5639fcbbe6d893391fd35c..fb396d1596291b1ed51947a2a38093762e0e95bf 100644 (file)
@@ -143,19 +143,19 @@ bool IsFlying(entity a);
 
        #define PHYS_INPUT_MOVEVALUES(s)                        input_movevalues
 
-       #define PHYS_INPUT_BUTTON_MASK(s)               (input_buttons | 128 * (input_movevalues_x < 0) | 256 * (input_movevalues_x > 0) | 512 * (input_movevalues_y < 0) | 1024 * (input_movevalues_y > 0))
-       #define PHYS_INPUT_BUTTON_ATCK(s)                       !!(input_buttons & 1)
-       #define PHYS_INPUT_BUTTON_JUMP(s)                       !!(input_buttons & 2)
-       #define PHYS_INPUT_BUTTON_ATCK2(s)                      !!(input_buttons & 4)
-       #define PHYS_INPUT_BUTTON_ZOOM(s)                       !!(input_buttons & 8)
-       #define PHYS_INPUT_BUTTON_CROUCH(s)                     !!(input_buttons & 16)
-       #define PHYS_INPUT_BUTTON_HOOK(s)                       !!(input_buttons & 32)
-       #define PHYS_INPUT_BUTTON_USE(s)                        !!(input_buttons & 64)
-       #define PHYS_INPUT_BUTTON_BACKWARD(s)           !!(input_buttons & 128)
-       #define PHYS_INPUT_BUTTON_FORWARD(s)            !!(input_buttons & 256)
-       #define PHYS_INPUT_BUTTON_LEFT(s)                       !!(input_buttons & 512)
-       #define PHYS_INPUT_BUTTON_RIGHT(s)                      !!(input_buttons & 1024)
-       #define PHYS_INPUT_BUTTON_JETPACK(s)            !!(input_buttons & 4096)
+       #define PHYS_INPUT_BUTTON_MASK(s)               (input_buttons | BIT(7) * (input_movevalues.x < 0) | BIT(8) * (input_movevalues.x > 0) | BIT(9) * (input_movevalues.y < 0) | BIT(10) * (input_movevalues.y > 0))
+       #define PHYS_INPUT_BUTTON_ATCK(s)                       boolean(input_buttons & BIT(0))
+       #define PHYS_INPUT_BUTTON_JUMP(s)                       boolean(input_buttons & BIT(1))
+       #define PHYS_INPUT_BUTTON_ATCK2(s)                      boolean(input_buttons & BIT(2))
+       #define PHYS_INPUT_BUTTON_ZOOM(s)                       boolean(input_buttons & BIT(3))
+       #define PHYS_INPUT_BUTTON_CROUCH(s)                     boolean(input_buttons & BIT(4))
+       #define PHYS_INPUT_BUTTON_HOOK(s)                       boolean(input_buttons & BIT(5))
+       #define PHYS_INPUT_BUTTON_USE(s)                        boolean(input_buttons & BIT(6))
+       #define PHYS_INPUT_BUTTON_BACKWARD(s)           boolean(input_buttons & BIT(7))
+       #define PHYS_INPUT_BUTTON_FORWARD(s)            boolean(input_buttons & BIT(8))
+       #define PHYS_INPUT_BUTTON_LEFT(s)                       boolean(input_buttons & BIT(9))
+       #define PHYS_INPUT_BUTTON_RIGHT(s)                      boolean(input_buttons & BIT(10))
+       #define PHYS_INPUT_BUTTON_JETPACK(s)            boolean(input_buttons & BIT(12))
 
        #define PHYS_DEAD(s)                                            s.csqcmodel_isdead
 
@@ -163,7 +163,7 @@ bool IsFlying(entity a);
        #define GAMEPLAYFIX_NOGRAVITYONGROUND                   (boolean(moveflags & MOVEFLAG_NOGRAVITYONGROUND))
        #define GAMEPLAYFIX_Q2AIRACCELERATE                             (boolean(moveflags & MOVEFLAG_Q2AIRACCELERATE))
 
-       #define IS_DUCKED(s)                                            !!(s.flags & FL_DUCKED)
+       #define IS_DUCKED(s)                                            boolean(s.flags & FL_DUCKED)
        #define SET_DUCKED(s)                                           s.flags |= FL_DUCKED
        #define UNSET_DUCKED(s)                                         s.flags &= ~FL_DUCKED
 
@@ -171,11 +171,11 @@ bool IsFlying(entity a);
        #define SET_JUMP_HELD(s)                                        s.flags &= ~FL_JUMPRELEASED
        #define UNSET_JUMP_HELD(s)                                      s.flags |= FL_JUMPRELEASED
 
-       #define IS_ONGROUND(s)                                          !!(s.flags & FL_ONGROUND)
+       #define IS_ONGROUND(s)                                          boolean(s.flags & FL_ONGROUND)
        #define SET_ONGROUND(s)                                         s.flags |= FL_ONGROUND
        #define UNSET_ONGROUND(s)                                       s.flags &= ~FL_ONGROUND
 
-       #define WAS_ONGROUND(s)                                         !!(s.lastflags & FL_ONGROUND)
+       #define WAS_ONGROUND(s)                                         boolean(s.lastflags & FL_ONGROUND)
 
        #define ITEMS_STAT(s)                                           (s).items
 
@@ -234,11 +234,11 @@ bool IsFlying(entity a);
        #define SET_JUMP_HELD(s)                                        s.flags &= ~FL_JUMPRELEASED
        #define UNSET_JUMP_HELD(s)                                      s.flags |= FL_JUMPRELEASED
 
-       #define IS_ONGROUND(s)                                          !!(s.flags & FL_ONGROUND)
+       #define IS_ONGROUND(s)                                          boolean(s.flags & FL_ONGROUND)
        #define SET_ONGROUND(s)                                         s.flags |= FL_ONGROUND
        #define UNSET_ONGROUND(s)                                       s.flags &= ~FL_ONGROUND
 
-       #define WAS_ONGROUND(s)                                         !!((s).lastflags & FL_ONGROUND)
+       #define WAS_ONGROUND(s)                                         boolean((s).lastflags & FL_ONGROUND)
 
        #define ITEMS_STAT(s)                                           s.items