From: TimePath Date: Thu, 23 Jun 2016 11:59:43 +0000 (+1000) Subject: Move PM_Main to ecs X-Git-Tag: xonotic-v0.8.2~767 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0e9f5745e13dd23ac8378717d95663f87253791b;p=xonotic%2Fxonotic-data.pk3dir.git Move PM_Main to ecs --- diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index b8c2b375d..5925ada7b 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -198,8 +198,8 @@ void PM_ClientMovement_UpdateStatus(entity this, bool ground) } } - if (IS_ONGROUND(this) || this.velocity.z <= 0 || pmove_waterjumptime <= 0) - pmove_waterjumptime = 0; + if (IS_ONGROUND(this) || this.velocity.z <= 0 || PHYS_WATERJUMP_TIME(this) <= 0) + PHYS_WATERJUMP_TIME(this) = 0; #endif } @@ -570,7 +570,7 @@ void CheckWaterJump(entity this) #ifdef SVQC PHYS_TELEPORT_TIME(this) = time + 2; // safety net #elif defined(CSQC) - pmove_waterjumptime = 2; + PHYS_WATERJUMP_TIME(this) = 2; #endif } } @@ -862,7 +862,7 @@ void PM_swim(entity this, float maxspd_mod) this.velocity = forward * 50; this.velocity_z = 310; #ifdef CSQC - pmove_waterjumptime = 2; + PHYS_WATERJUMP_TIME(this) = 2; #endif UNSET_ONGROUND(this); SET_JUMP_HELD(this); @@ -886,7 +886,7 @@ void PM_swim(entity this, float maxspd_mod) if (IS_DUCKED(this)) wishspeed *= 0.5; -// if (pmove_waterjumptime <= 0) // TODO: use +// if (PHYS_WATERJUMP_TIME(this) <= 0) // TODO: use { // water friction float f = 1 - PHYS_INPUT_TIMELENGTH * PHYS_FRICTION(this); @@ -1215,7 +1215,7 @@ void PM_air(entity this, float buttons_prev, float maxspd_mod) #ifdef SVQC if(time >= PHYS_TELEPORT_TIME(this)) #elif defined(CSQC) - if(pmove_waterjumptime <= 0) + if(PHYS_WATERJUMP_TIME(this) <= 0) #endif { float maxairspd = PHYS_MAXAIRSPEED(this) * min(maxspd_mod, 1); @@ -1297,256 +1297,6 @@ bool IsFlying(entity this) return true; } -void PM_Main(entity this) -{ - int buttons = PHYS_INPUT_BUTTON_MASK(this); -#ifdef CSQC - this.items = STAT(ITEMS); - - this.movement = PHYS_INPUT_MOVEVALUES(this); - - this.spectatorspeed = STAT(SPECTATORSPEED); - - this.team = myteam + 1; // is this correct? - if (!(PHYS_INPUT_BUTTON_JUMP(this))) // !jump - UNSET_JUMP_HELD(this); // canjump = true - pmove_waterjumptime -= PHYS_INPUT_TIMELENGTH; - - PM_ClientMovement_UpdateStatus(this, true); -#endif - - this.oldmovement = this.movement; - - -#ifdef SVQC - WarpZone_PlayerPhysics_FixVAngle(this); -#endif - float maxspeed_mod = 1; - maxspeed_mod *= PHYS_HIGHSPEED(this); - -#ifdef SVQC - Physics_UpdateStats(this, maxspeed_mod); - - if (this.PlayerPhysplug) - if (this.PlayerPhysplug(this)) - return; -#elif defined(CSQC) - if(hud != HUD_NORMAL) - return; // no vehicle prediction (yet) -#endif - -#ifdef SVQC - anticheat_physics(this); -#endif - - if (PM_check_specialcommand(this, buttons)) - return; -#ifdef SVQC - if (sv_maxidle > 0) - { - if (buttons != this.buttons_old || this.movement != this.movement_old || this.v_angle != this.v_angle_old) - this.parm_idlesince = time; - } -#endif - int buttons_prev = this.buttons_old; - this.buttons_old = buttons; - this.movement_old = this.movement; - this.v_angle_old = this.v_angle; - - PM_check_nickspam(this); - - PM_check_punch(this); -#ifdef SVQC - if (IS_BOT_CLIENT(this)) - { - if (playerdemo_read(this)) - return; - bot_think(this); - } -#endif - -#ifdef SVQC - if (IS_PLAYER(this)) - { - const bool allowed_to_move = (time >= game_starttime); - if (!allowed_to_move) - { - this.velocity = '0 0 0'; - this.movetype = MOVETYPE_NONE; - this.disableclientprediction = 2; - } - else if (this.disableclientprediction == 2) - { - if (this.movetype == MOVETYPE_NONE) - this.movetype = MOVETYPE_WALK; - this.disableclientprediction = 0; - } - } -#endif - -#ifdef SVQC - if (this.movetype == MOVETYPE_NONE) - return; - - // when we get here, disableclientprediction cannot be 2 - this.disableclientprediction = 0; -#endif - - viewloc_PlayerPhysics(this); - - PM_check_frozen(this); - - PM_check_blocked(this); - - maxspeed_mod = 1; - - if (this.in_swamp) - maxspeed_mod *= this.swamp_slowdown; //cvar("g_balance_swamp_moverate"); - - // conveyors: first fix velocity - if (this.conveyor.state) - this.velocity -= this.conveyor.movedir; - - MUTATOR_CALLHOOK(PlayerPhysics, this); - - if (!IS_PLAYER(this)) - { -#ifdef SVQC - maxspeed_mod = autocvar_sv_spectator_speed_multiplier; - if (!this.spectatorspeed) - this.spectatorspeed = maxspeed_mod; - if (this.impulse && this.impulse <= 19 || (this.impulse >= 200 && this.impulse <= 209) || (this.impulse >= 220 && this.impulse <= 229)) - { - if (this.lastclassname != STR_PLAYER) - { - if (this.impulse == 10 || this.impulse == 15 || this.impulse == 18 || (this.impulse >= 200 && this.impulse <= 209)) - this.spectatorspeed = bound(1, this.spectatorspeed + 0.5, 5); - else if (this.impulse == 11) - this.spectatorspeed = maxspeed_mod; - else if (this.impulse == 12 || this.impulse == 16 || this.impulse == 19 || (this.impulse >= 220 && this.impulse <= 229)) - this.spectatorspeed = bound(1, this.spectatorspeed - 0.5, 5); - else if (this.impulse >= 1 && this.impulse <= 9) - this.spectatorspeed = 1 + 0.5 * (this.impulse - 1); - } // otherwise just clear - this.impulse = 0; - } -#endif - maxspeed_mod = this.spectatorspeed; - } -#ifdef SVQC - - float spd = max(PHYS_MAXSPEED(this), PHYS_MAXAIRSPEED(this)) * maxspeed_mod; - if(this.speed != spd) - { - this.speed = spd; - string temps = ftos(spd); - stuffcmd(this, strcat("cl_forwardspeed ", temps, "\n")); - stuffcmd(this, strcat("cl_backspeed ", temps, "\n")); - stuffcmd(this, strcat("cl_sidespeed ", temps, "\n")); - stuffcmd(this, strcat("cl_upspeed ", temps, "\n")); - } - - if(this.jumpspeedcap_min != autocvar_sv_jumpspeedcap_min) - { - this.jumpspeedcap_min = autocvar_sv_jumpspeedcap_min; - stuffcmd(this, sprintf("\ncl_jumpspeedcap_min \"%s\"\n", autocvar_sv_jumpspeedcap_min)); - } - if(this.jumpspeedcap_max != autocvar_sv_jumpspeedcap_max) - { - this.jumpspeedcap_max = autocvar_sv_jumpspeedcap_max; - stuffcmd(this, sprintf("\ncl_jumpspeedcap_max \"%s\"\n", autocvar_sv_jumpspeedcap_max)); - } -#endif - - if(IS_DEAD(this)) - { - // handle water here - vector midpoint = ((this.absmin + this.absmax) * 0.5); - if(pointcontents(midpoint) == CONTENT_WATER) - { - this.velocity = this.velocity * 0.5; - - // do we want this? - //if(pointcontents(midpoint + '0 0 2') == CONTENT_WATER) - //{ this.velocity_z = 70; } - } - goto end; - } - -#ifdef SVQC - if (!this.fixangle) - this.angles = '0 1 0' * this.v_angle.y; -#endif - - if (IS_PLAYER(this) && IS_ONGROUND(this)) - { - PM_check_hitground(this); - PM_Footsteps(this); - } - -#ifdef SVQC - if(IsFlying(this)) - this.wasFlying = 1; -#endif - - if (IS_PLAYER(this)) - CheckPlayerJump(this); - - if (this.flags & FL_WATERJUMP) - { - this.velocity_x = this.movedir.x; - this.velocity_y = this.movedir.y; - if (time > PHYS_TELEPORT_TIME(this) || this.waterlevel == WATERLEVEL_NONE - #ifdef CSQC - || pmove_waterjumptime <= 0 - #endif - ) - { - this.flags &= ~FL_WATERJUMP; - PHYS_TELEPORT_TIME(this) = 0; - #ifdef CSQC - pmove_waterjumptime = 0; - #endif - } - } - - else if (MUTATOR_CALLHOOK(PM_Physics, this, maxspeed_mod)) - { } - -#ifdef SVQC - else if (this.movetype == MOVETYPE_NOCLIP || this.movetype == MOVETYPE_FLY || this.movetype == MOVETYPE_FLY_WORLDONLY || MUTATOR_CALLHOOK(IsFlying, this)) -#elif defined(CSQC) - else if (this.move_movetype == MOVETYPE_NOCLIP || this.move_movetype == MOVETYPE_FLY || this.move_movetype == MOVETYPE_FLY_WORLDONLY || MUTATOR_CALLHOOK(IsFlying, this)) -#endif - PM_fly(this, maxspeed_mod); - - else if (this.waterlevel >= WATERLEVEL_SWIMMING) - PM_swim(this, maxspeed_mod); - - else if (time < this.ladder_time) - PM_ladder(this, maxspeed_mod); - - else if (ITEMS_STAT(this) & IT_USING_JETPACK) - PM_jetpack(this, maxspeed_mod); - - else if (IS_ONGROUND(this)) - PM_walk(this, maxspeed_mod); - - else - PM_air(this, buttons_prev, maxspeed_mod); - -LABEL(end) - if (IS_ONGROUND(this)) - this.lastground = time; - - // conveyors: then break velocity again - if(this.conveyor.state) - this.velocity += this.conveyor.movedir; - - this.lastflags = this.flags; - - this.lastclassname = this.classname; -} void sys_phys_update(entity this, float dt); #if defined(SVQC) diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index fd1b610de..5ce35dedc 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -156,14 +156,19 @@ STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK) #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 + #define PHYS_FIXANGLE(s) ('0 0 0') + #define PHYS_MOVETYPE(s) ((s).move_movetype) + string autocvar_cl_jumpspeedcap_min; string autocvar_cl_jumpspeedcap_max; - noref float pmove_waterjumptime; - const int FL_WATERJUMP = 2048; // player jumping out of water const int FL_JUMPRELEASED = 4096; // for jump debouncing @@ -187,8 +192,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK) #define PHYS_GRAVITY(s) STAT(MOVEVARS_GRAVITY, s) - #define PHYS_TELEPORT_TIME(s) ((s).teleport_time) - #define TICRATE ticrate #define PHYS_INPUT_ANGLES(s) input_angles @@ -237,6 +240,9 @@ STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK) #elif defined(SVQC) + #define PHYS_FIXANGLE(s) ((s).fixangle) + #define PHYS_MOVETYPE(s) ((s).movetype) + bool Physics_Valid(string thecvar); .float stat_sv_airspeedlimit_nonqw = _STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW); @@ -246,8 +252,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK) .string jumpspeedcap_min; .string jumpspeedcap_max; - #define PHYS_TELEPORT_TIME(s) ((s).teleport_time) - #define PHYS_GRAVITY(s) autocvar_sv_gravity #define TICRATE sys_frametime diff --git a/qcsrc/ecs/components/input.qh b/qcsrc/ecs/components/input.qh index 37944ca5c..bc1c66ace 100644 --- a/qcsrc/ecs/components/input.qh +++ b/qcsrc/ecs/components/input.qh @@ -1,6 +1,7 @@ #pragma once COMPONENT(in); -.vector com_in_move; +.vector com_in_move, com_in_move_prev; .vector com_in_angles; .bool com_in_jump; +.bool com_in_crouch; diff --git a/qcsrc/ecs/systems/_mod.inc b/qcsrc/ecs/systems/_mod.inc index f79d7f065..a5ada6cfb 100644 --- a/qcsrc/ecs/systems/_mod.inc +++ b/qcsrc/ecs/systems/_mod.inc @@ -1,2 +1,9 @@ // generated file; do not modify +#include #include +#ifdef CSQC + #include +#endif +#ifdef SVQC + #include +#endif diff --git a/qcsrc/ecs/systems/_mod.qh b/qcsrc/ecs/systems/_mod.qh index e71e0591c..869aefd55 100644 --- a/qcsrc/ecs/systems/_mod.qh +++ b/qcsrc/ecs/systems/_mod.qh @@ -1,2 +1,3 @@ // generated file; do not modify +#include #include diff --git a/qcsrc/ecs/systems/cl_physics.qc b/qcsrc/ecs/systems/cl_physics.qc new file mode 100644 index 000000000..52e8ed0ca --- /dev/null +++ b/qcsrc/ecs/systems/cl_physics.qc @@ -0,0 +1,30 @@ +#include "physics.qh" + +void sys_phys_fix(entity this, float dt) +{ + this.team = myteam + 1; // is this correct? + PHYS_WATERJUMP_TIME(this) -= dt; + this.oldmovement = this.movement; + this.movement = PHYS_INPUT_MOVEVALUES(this); + this.items = STAT(ITEMS, this); + this.spectatorspeed = STAT(SPECTATORSPEED, this); + if (!(PHYS_INPUT_BUTTON_JUMP(this))) // !jump + UNSET_JUMP_HELD(this); // canjump = true + PM_ClientMovement_UpdateStatus(this, true); +} + +bool sys_phys_override(entity this) +{ + // no vehicle prediction + return hud != HUD_NORMAL; +} + +void sys_phys_monitor(entity this) {} + +void sys_phys_ai(entity this) {} + +void sys_phys_pregame_hold(entity this) {} + +void sys_phys_spectator_control(entity this) {} + +void sys_phys_fixspeed(entity this, float maxspeed_mod) {} diff --git a/qcsrc/ecs/systems/input.qc b/qcsrc/ecs/systems/input.qc new file mode 100644 index 000000000..eac36250b --- /dev/null +++ b/qcsrc/ecs/systems/input.qc @@ -0,0 +1,7 @@ +#include "input.qh" + +void sys_in_update(entity this, float dt) +{ + this.com_in_jump = PHYS_INPUT_BUTTON_JUMP(this); + this.com_in_crouch = PHYS_INPUT_BUTTON_CROUCH(this); +} diff --git a/qcsrc/ecs/systems/input.qh b/qcsrc/ecs/systems/input.qh new file mode 100644 index 000000000..fc3f11ada --- /dev/null +++ b/qcsrc/ecs/systems/input.qh @@ -0,0 +1,3 @@ +#pragma once + +SYSTEM(in, 30, 10); diff --git a/qcsrc/ecs/systems/physics.qc b/qcsrc/ecs/systems/physics.qc index 8348b8785..3457198c5 100644 --- a/qcsrc/ecs/systems/physics.qc +++ b/qcsrc/ecs/systems/physics.qc @@ -1,6 +1,113 @@ #include "physics.qh" +#include "input.qh" + +.int disableclientprediction; void sys_phys_update(entity this, float dt) { - PM_Main(this); + sys_in_update(this, dt); + + sys_phys_fix(this, dt); + if (sys_phys_override(this)) return; + sys_phys_monitor(this); + + int buttons_prev = this.buttons_old; + this.buttons_old = PHYS_INPUT_BUTTON_MASK(this); + this.movement_old = this.movement; + this.v_angle_old = this.v_angle; + + sys_phys_ai(this); + + sys_phys_pregame_hold(this); + + if (IS_SVQC) { + if (PHYS_MOVETYPE(this) == MOVETYPE_NONE) return; + + // when we get here, disableclientprediction cannot be 2 + this.disableclientprediction = 0; + } + + viewloc_PlayerPhysics(this); + + PM_check_frozen(this); + + PM_check_blocked(this); + + float maxspeed_mod = (!this.in_swamp) ? 1 : this.swamp_slowdown; // cvar("g_balance_swamp_moverate"); + +// conveyors: first fix velocity + if (this.conveyor.state) this.velocity -= this.conveyor.movedir; + + MUTATOR_CALLHOOK(PlayerPhysics, this); + + if (!IS_PLAYER(this)) { + sys_phys_spectator_control(this); + maxspeed_mod = this.spectatorspeed; + } + sys_phys_fixspeed(this, maxspeed_mod); + + if (IS_DEAD(this)) { + // handle water here + vector midpoint = ((this.absmin + this.absmax) * 0.5); + if (pointcontents(midpoint) == CONTENT_WATER) { + this.velocity = this.velocity * 0.5; + + // do we want this? + // if(pointcontents(midpoint + '0 0 2') == CONTENT_WATER) + // { this.velocity_z = 70; } + } + goto end; + } + + if (IS_SVQC && !PHYS_FIXANGLE(this)) this.angles = '0 1 0' * this.v_angle.y; + + if (IS_PLAYER(this)) { + if (IS_ONGROUND(this)) { + PM_check_hitground(this); + PM_Footsteps(this); + } else if (IsFlying(this)) { + this.wasFlying = true; + } + CheckPlayerJump(this); + } + + if (this.flags & FL_WATERJUMP) { + this.velocity_x = this.movedir.x; + this.velocity_y = this.movedir.y; + if (time > PHYS_TELEPORT_TIME(this) + || this.waterlevel == WATERLEVEL_NONE + || PHYS_WATERJUMP_TIME(this) <= 0 + ) { + this.flags &= ~FL_WATERJUMP; + PHYS_TELEPORT_TIME(this) = 0; + PHYS_WATERJUMP_TIME(this) = 0; + } + } else if (MUTATOR_CALLHOOK(PM_Physics, this, maxspeed_mod)) { + // handled + } else if (PHYS_MOVETYPE(this) == MOVETYPE_NOCLIP + || PHYS_MOVETYPE(this) == MOVETYPE_FLY + || PHYS_MOVETYPE(this) == MOVETYPE_FLY_WORLDONLY + || MUTATOR_CALLHOOK(IsFlying, this)) { + PM_fly(this, maxspeed_mod); + } else if (this.waterlevel >= WATERLEVEL_SWIMMING) { + PM_swim(this, maxspeed_mod); + } else if (time < this.ladder_time) { + PM_ladder(this, maxspeed_mod); + } else if (ITEMS_STAT(this) & IT_USING_JETPACK) { + PM_jetpack(this, maxspeed_mod); + } else if (IS_ONGROUND(this)) { + PM_walk(this, maxspeed_mod); + } else { + PM_air(this, buttons_prev, maxspeed_mod); + } + + LABEL(end) + if (IS_ONGROUND(this)) this.lastground = time; + +// conveyors: then break velocity again + if (this.conveyor.state) this.velocity += this.conveyor.movedir; + + this.lastflags = this.flags; + + this.lastclassname = this.classname; } diff --git a/qcsrc/ecs/systems/physics.qh b/qcsrc/ecs/systems/physics.qh index 38d4e55e5..16c996ade 100644 --- a/qcsrc/ecs/systems/physics.qh +++ b/qcsrc/ecs/systems/physics.qh @@ -1,3 +1,11 @@ #pragma once SYSTEM(phys, 30, 10); + +void sys_phys_fix(entity this, float dt); +bool sys_phys_override(entity this); +void sys_phys_monitor(entity this); +void sys_phys_pregame_hold(entity this); +void sys_phys_ai(entity this); +void sys_phys_spectator_control(entity this); +void sys_phys_fixspeed(entity this, float maxspeed_mod); diff --git a/qcsrc/ecs/systems/sv_physics.qc b/qcsrc/ecs/systems/sv_physics.qc new file mode 100644 index 000000000..5c480fe78 --- /dev/null +++ b/qcsrc/ecs/systems/sv_physics.qc @@ -0,0 +1,97 @@ +#include "physics.qh" + +void sys_phys_fix(entity this, float dt) +{ + WarpZone_PlayerPhysics_FixVAngle(this); + Physics_UpdateStats(this, PHYS_HIGHSPEED(this)); +} + +bool sys_phys_override(entity this) +{ + int buttons = PHYS_INPUT_BUTTON_MASK(this); + if (PM_check_specialcommand(this, buttons)) return true; + if (this.PlayerPhysplug && this.PlayerPhysplug(this)) return true; + return false; +} + +void sys_phys_monitor(entity this) +{ + int buttons = PHYS_INPUT_BUTTON_MASK(this); + anticheat_physics(this); + if (sv_maxidle > 0) { + if (buttons != this.buttons_old + || this.movement != this.movement_old + || this.v_angle != this.v_angle_old) this.parm_idlesince = time; + } + PM_check_nickspam(this); + PM_check_punch(this); +} + +void sys_phys_ai(entity this) +{ + if (!IS_BOT_CLIENT(this)) return; + if (playerdemo_read(this)) return; + bot_think(this); +} + +void sys_phys_pregame_hold(entity this) +{ + if (!IS_PLAYER(this)) return; + const bool allowed_to_move = (time >= game_starttime); + if (!allowed_to_move) { + this.velocity = '0 0 0'; + this.movetype = MOVETYPE_NONE; + this.disableclientprediction = 2; + } else if (this.disableclientprediction == 2) { + if (this.movetype == MOVETYPE_NONE) this.movetype = MOVETYPE_WALK; + this.disableclientprediction = 0; + } +} + +void sys_phys_spectator_control(entity this) +{ + float maxspeed_mod = autocvar_sv_spectator_speed_multiplier; + if (!this.spectatorspeed) this.spectatorspeed = maxspeed_mod; + if ((this.impulse >= 1 && this.impulse <= 19) + || (this.impulse >= 200 && this.impulse <= 209) + || (this.impulse >= 220 && this.impulse <= 229) + ) { + if (this.lastclassname != STR_PLAYER) { + if (this.impulse == 10 + || this.impulse == 15 + || this.impulse == 18 + || (this.impulse >= 200 && this.impulse <= 209) + ) this.spectatorspeed = bound(1, this.spectatorspeed + 0.5, 5); + else if (this.impulse == 11) this.spectatorspeed = maxspeed_mod; + else if (this.impulse == 12 + || this.impulse == 16 + || this.impulse == 19 + || (this.impulse >= 220 && this.impulse <= 229) + ) this.spectatorspeed = bound(1, this.spectatorspeed - 0.5, 5); + else if (this.impulse >= 1 && this.impulse <= 9) this.spectatorspeed = 1 + 0.5 * (this.impulse - 1); + } // otherwise just clear + this.impulse = 0; + } +} + +void sys_phys_fixspeed(entity this, float maxspeed_mod) +{ + float spd = max(PHYS_MAXSPEED(this), PHYS_MAXAIRSPEED(this)) * maxspeed_mod; + if (this.speed != spd) { + this.speed = spd; + string temps = ftos(spd); + stuffcmd(this, strcat("cl_forwardspeed ", temps, "\n")); + stuffcmd(this, strcat("cl_backspeed ", temps, "\n")); + stuffcmd(this, strcat("cl_sidespeed ", temps, "\n")); + stuffcmd(this, strcat("cl_upspeed ", temps, "\n")); + } + + if (this.jumpspeedcap_min != autocvar_sv_jumpspeedcap_min) { + this.jumpspeedcap_min = autocvar_sv_jumpspeedcap_min; + stuffcmd(this, sprintf("\ncl_jumpspeedcap_min \"%s\"\n", autocvar_sv_jumpspeedcap_min)); + } + if (this.jumpspeedcap_max != autocvar_sv_jumpspeedcap_max) { + this.jumpspeedcap_max = autocvar_sv_jumpspeedcap_max; + stuffcmd(this, sprintf("\ncl_jumpspeedcap_max \"%s\"\n", autocvar_sv_jumpspeedcap_max)); + } +} diff --git a/qcsrc/lib/_all.inc b/qcsrc/lib/_all.inc index 61755fe94..d121f1e66 100644 --- a/qcsrc/lib/_all.inc +++ b/qcsrc/lib/_all.inc @@ -2,6 +2,18 @@ #define COMPAT_NO_MOD_IS_XONOTIC #endif +#ifdef CSQC +#define IS_CSQC 1 +#else +#define IS_CSQC 0 +#endif + +#ifdef SVQC +#define IS_SVQC 1 +#else +#define IS_SVQC 0 +#endif + #include "compiler.qh" #ifndef QCC_SUPPORT_INT diff --git a/qcsrc/uncrustify.cfg b/qcsrc/uncrustify.cfg index 98cdab9dd..692cb06ee 100644 --- a/qcsrc/uncrustify.cfg +++ b/qcsrc/uncrustify.cfg @@ -418,7 +418,7 @@ sp_angle_shift = ignore # ignore/add/remove/force sp_permit_cpp11_shift = false # false/true # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' -sp_before_sparen = add # ignore/add/remove/force #force +sp_before_sparen = force # ignore/add/remove/force #force # Add or remove space inside if-condition '(' and ')' # NOTE: is 68 worse than ignore @@ -431,10 +431,10 @@ sp_inside_sparen_close = ignore # ignore/add/remove/force #f sp_inside_sparen_open = ignore # ignore/add/remove/force #force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' -sp_after_sparen = add # ignore/add/remove/force +sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' -sp_sparen_brace = add # ignore/add/remove/force +sp_sparen_brace = force # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force #ignore @@ -630,11 +630,11 @@ sp_macro = remove # ignore/add/remove/force #f sp_macro_func = remove # ignore/add/remove/force #force # Add or remove space between 'else' and '{' if on the same line -sp_else_brace = add # ignore/add/remove/force +sp_else_brace = force # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line # WARNING: Code doesn't seem to use this feature - delete from the config? -sp_brace_else = ignore # ignore/add/remove/force +sp_brace_else = force # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = add # ignore/add/remove/force @@ -1116,17 +1116,17 @@ nl_union_brace = ignore # ignore/add/remove/force # Add or remove newline between 'if' and '{' # NOTE: is 136 worse than ignore -nl_if_brace = add # ignore/add/remove/force +nl_if_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'else' -nl_brace_else = add # ignore/add/remove/force +nl_brace_else = remove # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead -nl_elseif_brace = add # ignore/add/remove/force +nl_elseif_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and '{' -nl_else_brace = add # ignore/add/remove/force +nl_else_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = remove # ignore/add/remove/force @@ -1137,7 +1137,7 @@ nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' # WARNING: Code doesn't seem to use this feature - delete from the config? -nl_finally_brace = ignore # ignore/add/remove/force +nl_finally_brace = remove # ignore/add/remove/force # Add or remove newline between 'try' and '{' # WARNING: Code doesn't seem to use this feature - delete from the config? @@ -1149,7 +1149,7 @@ nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' # NOTE: is 109 worse than ignore -nl_for_brace = add # ignore/add/remove/force +nl_for_brace = remove # ignore/add/remove/force # Add or remove newline between 'catch' and '{' # WARNING: Code doesn't seem to use this feature - delete from the config? @@ -1161,7 +1161,7 @@ nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' # NOTE: is 22 worse than ignore -nl_while_brace = add # ignore/add/remove/force +nl_while_brace = remove # ignore/add/remove/force # Add or remove newline between 'scope (x)' and '{' (D) # WARNING: Code doesn't seem to use this feature - delete from the config? @@ -1608,7 +1608,7 @@ mod_pawn_semicolon = false # false/true mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons -mod_remove_extra_semicolon = false # false/true +mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added.