]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/physics/player.qh
Merge branch 'master' into develop
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / physics / player.qh
index 9ecf7eab71ed436c9d5e51be8246b4818474440f..0a5b049f57c3852970861c96cc0732bea9025b33 100644 (file)
@@ -5,6 +5,50 @@
 #ifdef SVQC
 // TODO: get rid of this random dumb include!
        #include <common/state.qh>
+
+float autocvar_sv_airaccel_qw;
+float autocvar_sv_airstrafeaccel_qw;
+float autocvar_sv_airspeedlimit_nonqw;
+float autocvar_sv_airaccel_qw_stretchfactor;
+float autocvar_sv_maxairstrafespeed;
+float autocvar_sv_airstrafeaccelerate;
+float autocvar_sv_warsowbunny_turnaccel;
+float autocvar_sv_airaccel_sideways_friction;
+float autocvar_sv_aircontrol;
+float autocvar_sv_aircontrol_power;
+float autocvar_sv_aircontrol_backwards;
+float autocvar_sv_aircontrol_sidewards;
+float autocvar_sv_aircontrol_penalty;
+float autocvar_sv_warsowbunny_airforwardaccel;
+float autocvar_sv_warsowbunny_topspeed;
+float autocvar_sv_warsowbunny_accel;
+float autocvar_sv_warsowbunny_backtosideratio;
+float autocvar_sv_friction;
+float autocvar_sv_accelerate;
+float autocvar_sv_stopspeed;
+float autocvar_sv_airaccelerate;
+float autocvar_sv_airstopaccelerate;
+float autocvar_sv_track_canjump;
+string autocvar_g_physics_clientselect_options;
+string autocvar_g_physics_clientselect_default;
+bool autocvar_g_jump_grunt;
+bool autocvar_g_physics_clientselect;
+float autocvar_g_maxspeed;
+float autocvar_g_movement_highspeed = 1;
+bool autocvar_g_movement_highspeed_q3_compat = 0;
+//float autocvar_g_nick_flood_penalty;
+int autocvar_g_nick_flood_penalty_red;
+int autocvar_g_nick_flood_penalty_yellow;
+//float autocvar_g_nick_flood_timeout;
+bool autocvar_speedmeter;
+string autocvar_sv_jumpspeedcap_max;
+float autocvar_sv_jumpspeedcap_max_disable_on_ramps;
+string autocvar_sv_jumpspeedcap_min;
+float autocvar_sv_jumpvelocity;
+float autocvar_sv_jumpvelocity_crouch;
+float autocvar_sv_maxairspeed;
+float autocvar_sv_maxspeed;
+bool autocvar_g_footsteps;
 #endif
 
 .entity conveyor;
@@ -27,6 +71,12 @@ float AdjustAirAccelQW(float accelqw, float factor);
 
 bool IsFlying(entity a);
 
+#ifdef GAMEQC
+REPLICATE_INIT(string, cvar_cl_physics);
+REPLICATE_INIT(bool, cvar_cl_jetpack_jump);
+REPLICATE_INIT(bool, cvar_cl_movement_track_canjump);
+#endif
+
 #define PHYS_PL_MAX(s)                                         STAT(PL_MAX, s)
 #define PHYS_PL_MIN(s)                                         STAT(PL_MIN, s)
 #define PHYS_PL_CROUCH_MAX(s)                          STAT(PL_CROUCH_MAX, s)
@@ -38,8 +88,6 @@ bool IsFlying(entity a);
 #define PHYS_VIEWHEIGHT(s)                                     STAT(VIEWHEIGHT, s)
 #define PHYS_HEALTH(s)                                         STAT(HEALTH, s)
 
-#define BUFFS_STAT(s)                       STAT(BUFFS, s)
-
 #define PHYS_ACCELERATE(s)                  STAT(MOVEVARS_ACCELERATE, s)
 #define PHYS_AIRACCELERATE(s)               STAT(MOVEVARS_AIRACCELERATE, s)
 #define PHYS_AIRACCEL_QW(s)                 STAT(MOVEVARS_AIRACCEL_QW, s)
@@ -109,7 +157,7 @@ bool IsFlying(entity a);
 #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_BUTTON14(s)
+#define PHYS_INPUT_BUTTON_MINIGAME(s)          PHYS_INPUT_BUTTON_BUTTON12(s)
 
 #ifdef CSQC
 STATIC_INIT(PHYS_INPUT_BUTTON)
@@ -135,17 +183,17 @@ STATIC_INIT(PHYS_INPUT_BUTTON)
 // 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) \
+         (BIT(0) * PHYS_INPUT_BUTTON_ATCK(s)) \
+       | (BIT(1) * PHYS_INPUT_BUTTON_JUMP(s)) \
+       | (BIT(2) * PHYS_INPUT_BUTTON_ATCK2(s)) \
+       | (BIT(3) * PHYS_INPUT_BUTTON_ZOOM(s)) \
+       | (BIT(4) * PHYS_INPUT_BUTTON_CROUCH(s)) \
+       | (BIT(5) * PHYS_INPUT_BUTTON_HOOK(s)) \
+       | (BIT(6) * PHYS_INPUT_BUTTON_USE(s)) \
+       | (BIT(7) * PHYS_INPUT_BUTTON_BACKWARD(s)) \
+       | (BIT(8) * PHYS_INPUT_BUTTON_FORWARD(s)) \
+       | (BIT(9) * PHYS_INPUT_BUTTON_LEFT(s)) \
+       | (BIT(10) * PHYS_INPUT_BUTTON_RIGHT(s)) \
        )
 
 #define IS_JUMP_HELD(s)                     (!((s).flags & FL_JUMPRELEASED))
@@ -155,13 +203,13 @@ STATIC_INIT(PHYS_INPUT_BUTTON)
 #define WAS_ONGROUND(s)                     boolean((s).lastflags & FL_ONGROUND)
 #define WAS_ONSLICK(s)                      boolean((s).lastflags & FL_ONSLICK)
 
+#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)
+
 #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
 
@@ -170,9 +218,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON)
        string autocvar_cl_jumpspeedcap_min;
        string autocvar_cl_jumpspeedcap_max;
 
-       const int FL_WATERJUMP = 2048;  // player jumping out of water
-       const int FL_JUMPRELEASED = 4096;  // for jump debouncing
-
        .float watertype;
        .float waterlevel;
        .int items;
@@ -193,7 +238,7 @@ STATIC_INIT(PHYS_INPUT_BUTTON)
        #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))
+       #define IS_DEAD(s)                          (((s).classname == "ENT_CLIENT_MODEL") ? (s).csqcmodel_isdead : (GetResource((s), RES_HEALTH) <= 0))
 
        //float player_multijump;
        //float player_jumpheight;
@@ -228,10 +273,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON)
        #define PHYS_INPUT_BUTTON_BUTTON15(s)       boolean(input_buttons & BIT(17))
        #define PHYS_INPUT_BUTTON_BUTTON16(s)       boolean(input_buttons & BIT(18))
 
-       #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)
-
        #define PHYS_INVEHICLE(s)                                       (boolean(hud != HUD_NORMAL))
 
        #define PHYS_JUMPSPEEDCAP_MIN               autocvar_cl_jumpspeedcap_min
@@ -253,6 +294,9 @@ STATIC_INIT(PHYS_INPUT_BUTTON)
        .string jumpspeedcap_min;
        .string jumpspeedcap_max;
 
+       // footstep interval
+       .float nextstep;
+
        #define PHYS_INPUT_ANGLES(s)                ((s).v_angle)
        #define PHYS_WORLD_ANGLES(s)                ((s).angles)
 
@@ -282,16 +326,12 @@ STATIC_INIT(PHYS_INPUT_BUTTON)
        #define PHYS_INPUT_BUTTON_BUTTON15(s)       (CS(s).button15)
        #define PHYS_INPUT_BUTTON_BUTTON16(s)       (CS(s).button16)
 
-       #define IS_DUCKED(s)                        ((s).crouch)
-       #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
 
-       #define PHYS_CL_TRACK_CANJUMP(s)            (CS(s).cvar_cl_movement_track_canjump)
+       #define PHYS_CL_TRACK_CANJUMP(s)            (CS_CVAR(s).cvar_cl_movement_track_canjump)
 
 #endif