]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move physics specific stats into the movetype code and out of player movement code
authorMario <mario@smbclan.net>
Thu, 13 Jul 2017 00:24:13 +0000 (10:24 +1000)
committerMario <mario@smbclan.net>
Thu, 13 Jul 2017 00:24:13 +0000 (10:24 +1000)
qcsrc/common/physics/movetypes/movetypes.qh
qcsrc/common/physics/player.qh

index 712817386037581064666a4e9cd7ce5faca8590f..4cd184e9ec6de1557665415ecef80d36b5ad5706 100644 (file)
@@ -7,16 +7,44 @@
 #define SET_ONSLICK(s)                                         ((s).flags |= FL_ONSLICK)
 #define UNSET_ONSLICK(s)                                       ((s).flags &= ~FL_ONSLICK)
 
-#define GAMEPLAYFIX_DOWNTRACEONGROUND(s)    STAT(GAMEPLAYFIX_DOWNTRACEONGROUND, s)
-#define GAMEPLAYFIX_EASIERWATERJUMP(s)      STAT(GAMEPLAYFIX_EASIERWATERJUMP, s)
-#define GAMEPLAYFIX_STEPDOWN(s)             STAT(GAMEPLAYFIX_STEPDOWN, s)
-#define GAMEPLAYFIX_STEPMULTIPLETIMES(s)    STAT(GAMEPLAYFIX_STEPMULTIPLETIMES, s)
-#define GAMEPLAYFIX_UNSTICKPLAYERS(s)       STAT(GAMEPLAYFIX_UNSTICKPLAYERS, s)
-#define GAMEPLAYFIX_WATERTRANSITION(s)                 STAT(GAMEPLAYFIX_WATERTRANSITION, s)
+#define GAMEPLAYFIX_DOWNTRACEONGROUND(s)    STAT(GAMEPLAYFIX_DOWNTRACEONGROUND, NULL)
+#define GAMEPLAYFIX_EASIERWATERJUMP(s)      STAT(GAMEPLAYFIX_EASIERWATERJUMP, NULL)
+#define GAMEPLAYFIX_STEPDOWN(s)             STAT(GAMEPLAYFIX_STEPDOWN, NULL)
+#define GAMEPLAYFIX_STEPMULTIPLETIMES(s)    STAT(GAMEPLAYFIX_STEPMULTIPLETIMES, NULL)
+#define GAMEPLAYFIX_UNSTICKPLAYERS(s)       STAT(GAMEPLAYFIX_UNSTICKPLAYERS, NULL)
+#define GAMEPLAYFIX_WATERTRANSITION(s)                 STAT(GAMEPLAYFIX_WATERTRANSITION, NULL)
+#define UPWARD_VELOCITY_CLEARS_ONGROUND(s)  STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, NULL)
+
+#define PHYS_STEPHEIGHT(s)                  STAT(MOVEVARS_STEPHEIGHT, NULL)
+#define PHYS_NOSTEP(s)                      STAT(NOSTEP, NULL)
+#define PHYS_JUMPSTEP(s)                    STAT(MOVEVARS_JUMPSTEP, NULL)
+#define PHYS_WALLFRICTION(s)                STAT(MOVEVARS_WALLFRICTION, NULL)
 
 #ifdef CSQC
 .float bouncestop;
 .float bouncefactor;
+
+       #define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE  (boolean(moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE))
+       #define GAMEPLAYFIX_NOGRAVITYONGROUND           (boolean(moveflags & MOVEFLAG_NOGRAVITYONGROUND))
+       #define GAMEPLAYFIX_Q2AIRACCELERATE             (boolean(moveflags & MOVEFLAG_Q2AIRACCELERATE))
+
+       #define PHYS_GRAVITY(s)                     STAT(MOVEVARS_GRAVITY, s)
+       // FIXME: 0 doesn't mean zero gravity
+       #define PHYS_ENTGRAVITY(s)                  STAT(MOVEVARS_ENTGRAVITY, s)
+
+       #define TICRATE                             ticrate
+
+#elif defined(SVQC)
+
+       #define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE  autocvar_sv_gameplayfix_gravityunaffectedbyticrate
+       #define GAMEPLAYFIX_NOGRAVITYONGROUND           autocvar_sv_gameplayfix_nogravityonground
+       #define GAMEPLAYFIX_Q2AIRACCELERATE             autocvar_sv_gameplayfix_q2airaccelerate
+
+       #define PHYS_GRAVITY(s)                     autocvar_sv_gravity
+       #define PHYS_ENTGRAVITY(s)                  ((s).gravity)
+
+       #define TICRATE sys_frametime
+
 #endif
 
 void set_movetype(entity this, int mt);
index 59201f99366a132b739f8e74fb82171700476277..07c3d1cb9baaae1c481d65847c9f422406a96dcf 100644 (file)
@@ -78,30 +78,22 @@ bool IsFlying(entity a);
 #define PHYS_JETPACK_REVERSE_THRUST(s)         STAT(JETPACK_REVERSE_THRUST, s)
 
 #define PHYS_JUMPSPEEDCAP_DISABLE_ONRAMPS(s) STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, NULL)
-#define PHYS_JUMPSTEP(s)                    STAT(MOVEVARS_JUMPSTEP, NULL)
 #define PHYS_JUMPVELOCITY(s)                STAT(MOVEVARS_JUMPVELOCITY, s)
 
 #define PHYS_MAXAIRSPEED(s)                 STAT(MOVEVARS_MAXAIRSPEED, s)
 #define PHYS_MAXAIRSTRAFESPEED(s)           STAT(MOVEVARS_MAXAIRSTRAFESPEED, s)
 #define PHYS_MAXSPEED(s)                    STAT(MOVEVARS_MAXSPEED, s)
 
-#define PHYS_NOSTEP(s)                      STAT(NOSTEP, NULL)
-#define PHYS_STEPHEIGHT(s)                  STAT(MOVEVARS_STEPHEIGHT, NULL)
-
 #define PHYS_STOPSPEED(s)                   STAT(MOVEVARS_STOPSPEED, s)
 
 #define PHYS_TRACK_CANJUMP(s)               STAT(MOVEVARS_TRACK_CANJUMP, s)
 
-#define PHYS_WALLFRICTION(s)                STAT(MOVEVARS_WALLFRICTION, NULL)
-
 #define PHYS_WARSOWBUNNY_ACCEL(s)           STAT(MOVEVARS_WARSOWBUNNY_ACCEL, s)
 #define PHYS_WARSOWBUNNY_AIRFORWARDACCEL(s) STAT(MOVEVARS_WARSOWBUNNY_AIRFORWARDACCEL, s)
 #define PHYS_WARSOWBUNNY_BACKTOSIDERATIO(s) STAT(MOVEVARS_WARSOWBUNNY_BACKTOSIDERATIO, s)
 #define PHYS_WARSOWBUNNY_TOPSPEED(s)        STAT(MOVEVARS_WARSOWBUNNY_TOPSPEED, s)
 #define PHYS_WARSOWBUNNY_TURNACCEL(s)       STAT(MOVEVARS_WARSOWBUNNY_TURNACCEL, s)
 
-#define UPWARD_VELOCITY_CLEARS_ONGROUND(s)  STAT(GAMEPLAYFIX_UPVELOCITYCLEARSONGROUND, NULL)
-
 #define PHYS_SLICK_APPLYGRAVITY(s)             STAT(SLICK_APPLYGRAVITY, NULL)
 
 #define PHYS_INPUT_BUTTON_ATCK(s)           PHYS_INPUT_BUTTON_BUTTON1(s)
@@ -208,10 +200,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        //float player_multijump;
        //float player_jumpheight;
 
-       #define PHYS_GRAVITY(s)                     STAT(MOVEVARS_GRAVITY, s)
-
-       #define TICRATE                             ticrate
-
        #define PHYS_INPUT_ANGLES(s)                input_angles
 // TODO
        #define PHYS_WORLD_ANGLES(s)                input_angles
@@ -241,10 +229,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        #define PHYS_INPUT_BUTTON_BUTTON15(s)       boolean(input_buttons & BIT(17))
        #define PHYS_INPUT_BUTTON_BUTTON16(s)       boolean(input_buttons & BIT(18))
 
-       #define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE  (boolean(moveflags & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE))
-       #define GAMEPLAYFIX_NOGRAVITYONGROUND           (boolean(moveflags & MOVEFLAG_NOGRAVITYONGROUND))
-       #define GAMEPLAYFIX_Q2AIRACCELERATE             (boolean(moveflags & MOVEFLAG_Q2AIRACCELERATE))
-
        #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)
@@ -253,8 +237,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        #define PHYS_JUMPSPEEDCAP_MAX               autocvar_cl_jumpspeedcap_max
 
        #define PHYS_CL_TRACK_CANJUMP(s)            STAT(MOVEVARS_CL_TRACK_CANJUMP, s)
-       // FIXME: 0 doesn't mean zero gravity
-       #define PHYS_ENTGRAVITY(s)                  STAT(MOVEVARS_ENTGRAVITY, s)
 
 #elif defined(SVQC)
 
@@ -271,10 +253,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        .string jumpspeedcap_min;
        .string jumpspeedcap_max;
 
-       #define PHYS_GRAVITY(s)                     autocvar_sv_gravity
-
-       #define TICRATE sys_frametime
-
        #define PHYS_INPUT_ANGLES(s)                ((s).v_angle)
        #define PHYS_WORLD_ANGLES(s)                ((s).angles)
 
@@ -303,10 +281,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        #define PHYS_INPUT_BUTTON_BUTTON15(s)       ((s).button15)
        #define PHYS_INPUT_BUTTON_BUTTON16(s)       ((s).button16)
 
-       #define GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE  autocvar_sv_gameplayfix_gravityunaffectedbyticrate
-       #define GAMEPLAYFIX_NOGRAVITYONGROUND           autocvar_sv_gameplayfix_nogravityonground
-       #define GAMEPLAYFIX_Q2AIRACCELERATE             autocvar_sv_gameplayfix_q2airaccelerate
-
        #define IS_DUCKED(s)                        ((s).crouch)
        #define SET_DUCKED(s)                       ((s).crouch = true)
        #define UNSET_DUCKED(s)                     ((s).crouch = false)
@@ -315,7 +289,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
        #define PHYS_JUMPSPEEDCAP_MAX               autocvar_sv_jumpspeedcap_max
 
        #define PHYS_CL_TRACK_CANJUMP(s)            ((s).cvar_cl_movement_track_canjump)
-       #define PHYS_ENTGRAVITY(s)                  ((s).gravity)
 
 #endif