// Client/server mappings
+#ifdef SVQC
+// TODO: get rid of this random dumb include!
+ #include <common/state.qh>
+#endif
+
.entity conveyor;
.float race_penalty;
.float lastflags;
.float lastground;
.float wasFlying;
-#ifdef SVQC
-.float spectatorspeed = _STAT(SPECTATORSPEED);
-#elif defined(CSQC)
-.float spectatorspeed;
-#endif
+.int buttons_old;
.vector movement_old;
-.float buttons_old;
.vector v_angle_old;
.string lastclassname;
#define PHYS_JETPACK_MAXSPEED_UP(s) STAT(JETPACK_MAXSPEED_UP, s)
#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_JUMPSPEEDCAP_DISABLE_ONRAMPS(s) STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS)
#define PHYS_JUMPVELOCITY(s) STAT(MOVEVARS_JUMPVELOCITY, s)
+#define PHYS_JUMPVELOCITY_CROUCH(s) STAT(MOVEVARS_JUMPVELOCITY_CROUCH, s)
#define PHYS_MAXAIRSPEED(s) STAT(MOVEVARS_MAXAIRSPEED, s)
#define PHYS_MAXAIRSTRAFESPEED(s) STAT(MOVEVARS_MAXAIRSTRAFESPEED, s)
#define PHYS_WARSOWBUNNY_TOPSPEED(s) STAT(MOVEVARS_WARSOWBUNNY_TOPSPEED, s)
#define PHYS_WARSOWBUNNY_TURNACCEL(s) STAT(MOVEVARS_WARSOWBUNNY_TURNACCEL, s)
-#define PHYS_SLICK_APPLYGRAVITY(s) STAT(SLICK_APPLYGRAVITY, NULL)
+#define PHYS_SLICK_APPLYGRAVITY(s) STAT(SLICK_APPLYGRAVITY)
#define PHYS_INPUT_BUTTON_ATCK(s) PHYS_INPUT_BUTTON_BUTTON1(s)
#define PHYS_INPUT_BUTTON_JUMP(s) PHYS_INPUT_BUTTON_BUTTON2(s)
#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)
#define PHYS_INPUT_BUTTON_DODGE(s) PHYS_INPUT_BUTTON_BUTTON11(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
.int items;
.vector movement;
+
+ // angles of the player's view (as opposed to their model which uses `.vector angles;`) in degrees
+ // x is pitch: positive means down (unlike .angles)
+ // y is yaw: between -180 and 180, increases when turning left
+ // z is roll: positive means tilted clockwise, usually is 0
+ // when .fixangle is set, the player's view will change to the direction where the model is facing
+ // more info: https://gitlab.com/xonotic/xonotic-data.pk3dir/merge_requests/447#note_32816794
.vector v_angle;
.entity hook;
#define PHYS_INPUT_FRAMETIME serverdeltatime
#define PHYS_INPUT_MOVEVALUES(s) input_movevalues
+ #define PHYS_CS(s) (s)
#define PHYS_INPUT_BUTTON_BUTTON1(s) boolean(input_buttons & BIT(0))
#define PHYS_INPUT_BUTTON_BUTTON2(s) boolean(input_buttons & BIT(1))
#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
bool Physics_Valid(string thecvar);
- void Physics_UpdateStats(entity this, float maxspd_mod);
+ void Physics_UpdateStats(entity this);
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;
#define PHYS_INPUT_TIMELENGTH frametime
#define PHYS_INPUT_FRAMETIME sys_frametime
- #define PHYS_INPUT_MOVEVALUES(s) ((s).movement)
+ #define PHYS_INPUT_MOVEVALUES(s) CS(s).movement
+ #define PHYS_CS(s) CS(s)
#define PHYS_INPUT_BUTTON_BUTTON1(s) (CS(s).button0)
- #define PHYS_INPUT_BUTTON_BUTTON2(s) ((s).button2)
+ #define PHYS_INPUT_BUTTON_BUTTON2(s) (CS(s).button2)
#define PHYS_INPUT_BUTTON_BUTTON3(s) (CS(s).button3)
- #define PHYS_INPUT_BUTTON_BUTTON4(s) ((s).button4)
- #define PHYS_INPUT_BUTTON_BUTTON5(s) ((s).button5)
- #define PHYS_INPUT_BUTTON_BUTTON6(s) ((s).button6)
- #define PHYS_INPUT_BUTTON_BUTTON7(s) ((s).button7)
- #define PHYS_INPUT_BUTTON_BUTTON8(s) ((s).button8)
- #define PHYS_INPUT_BUTTON_BUTTON_USE(s) ((s).buttonuse)
- #define PHYS_INPUT_BUTTON_BUTTON_CHAT(s) ((s).buttonchat)
- #define PHYS_INPUT_BUTTON_BUTTON_PRYDON(s) ((s).cursor_active)
- #define PHYS_INPUT_BUTTON_BUTTON9(s) ((s).button9)
- #define PHYS_INPUT_BUTTON_BUTTON10(s) ((s).button10)
- #define PHYS_INPUT_BUTTON_BUTTON11(s) ((s).button11)
- #define PHYS_INPUT_BUTTON_BUTTON12(s) ((s).button12)
- #define PHYS_INPUT_BUTTON_BUTTON13(s) ((s).button13)
- #define PHYS_INPUT_BUTTON_BUTTON14(s) ((s).button14)
- #define PHYS_INPUT_BUTTON_BUTTON15(s) ((s).button15)
- #define PHYS_INPUT_BUTTON_BUTTON16(s) ((s).button16)
+ #define PHYS_INPUT_BUTTON_BUTTON4(s) (CS(s).button4)
+ #define PHYS_INPUT_BUTTON_BUTTON5(s) (CS(s).button5)
+ #define PHYS_INPUT_BUTTON_BUTTON6(s) (CS(s).button6)
+ #define PHYS_INPUT_BUTTON_BUTTON7(s) (CS(s).button7)
+ #define PHYS_INPUT_BUTTON_BUTTON8(s) (CS(s).button8)
+ #define PHYS_INPUT_BUTTON_BUTTON_USE(s) (CS(s).buttonuse)
+ #define PHYS_INPUT_BUTTON_BUTTON_CHAT(s) (CS(s).buttonchat)
+ #define PHYS_INPUT_BUTTON_BUTTON_PRYDON(s) (CS(s).cursor_active)
+ #define PHYS_INPUT_BUTTON_BUTTON9(s) (CS(s).button9)
+ #define PHYS_INPUT_BUTTON_BUTTON10(s) (CS(s).button10)
+ #define PHYS_INPUT_BUTTON_BUTTON11(s) (CS(s).button11)
+ #define PHYS_INPUT_BUTTON_BUTTON12(s) (CS(s).button12)
+ #define PHYS_INPUT_BUTTON_BUTTON13(s) (CS(s).button13)
+ #define PHYS_INPUT_BUTTON_BUTTON14(s) (CS(s).button14)
+ #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) ((s).cvar_cl_movement_track_canjump)
+ #define PHYS_CL_TRACK_CANJUMP(s) (CS(s).cvar_cl_movement_track_canjump)
#endif