From 8e1a3bdfd113ad6db5c8f297c3ef02dd1e65fecc Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 23 Jul 2016 03:01:46 +1000 Subject: [PATCH] Fix warpzones --- qcsrc/client/weapons/projectile.qc | 8 ++++---- qcsrc/common/effects/qc/casings.qc | 4 ++-- qcsrc/common/effects/qc/damageeffects.qc | 2 +- qcsrc/common/physics/movetypes/movetypes.qc | 12 ++++++------ qcsrc/common/physics/movetypes/step.qc | 4 ++-- qcsrc/common/physics/movetypes/toss.qc | 18 +++++++++--------- qcsrc/common/physics/movetypes/walk.qc | 6 +++--- qcsrc/common/t_items.qc | 4 ++-- qcsrc/common/triggers/subs.qc | 2 +- qcsrc/common/triggers/subs.qh | 1 - qcsrc/common/triggers/teleporters.qc | 2 +- qcsrc/common/vehicles/vehicle/bumblebee.qc | 2 +- qcsrc/lib/warpzone/server.qc | 2 ++ 13 files changed, 34 insertions(+), 33 deletions(-) diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 973005e12..56a172b10 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -62,7 +62,7 @@ void Projectile_Draw(entity this) if (this.count & 0x80) { - // this.flags &= ~FL_ONGROUND; + // UNSET_ONGROUND(this); if (this.move_movetype == MOVETYPE_NONE || this.move_movetype == MOVETYPE_FLY) Movetype_Physics_NoMatchServer(this); // the trivial movetypes do not have to match the @@ -72,7 +72,7 @@ void Projectile_Draw(entity this) // moving, we might still be ticrate dependent. else Movetype_Physics_MatchServer(this, autocvar_cl_projectiles_sloppy); - if (!(this.flags & FL_ONGROUND)) + if (!IS_ONGROUND(this)) if (this.velocity != '0 0 0') this.angles = vectoangles(this.velocity); } @@ -209,9 +209,9 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) // projectiles no longer being able to lie on a bmodel this.move_nomonsters = MOVE_WORLDONLY; if (f & 0x40) - this.flags |= FL_ONGROUND; + SET_ONGROUND(this); else - this.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(this); if (!this.move_time) { diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index 9eae42051..4ef7b51bc 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -49,7 +49,7 @@ void Casing_Delete(entity this) void Casing_Draw(entity this) { - if (this.flags & FL_ONGROUND) + if (IS_ONGROUND(this)) { this.angles_x = 0; this.angles_z = 0; @@ -122,7 +122,7 @@ void Casing_Damage(entity this, float thisdmg, int hittype, vector org, vector t if (thisforce.z < 0) thisforce.z = 0; this.velocity = this.velocity + thisforce + '0 0 100'; - this.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(this); } NET_HANDLE(casings, bool isNew) diff --git a/qcsrc/common/effects/qc/damageeffects.qc b/qcsrc/common/effects/qc/damageeffects.qc index 09ec8868f..b53b60505 100644 --- a/qcsrc/common/effects/qc/damageeffects.qc +++ b/qcsrc/common/effects/qc/damageeffects.qc @@ -256,7 +256,7 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew) if(vdist(thisforce, !=, 0)) { it.velocity = it.velocity + damage_explosion_calcpush(it.damageforcescale * thisforce, it.velocity, autocvar_g_balance_damagepush_speedfactor); - it.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(it); } if(w_issilent) diff --git a/qcsrc/common/physics/movetypes/movetypes.qc b/qcsrc/common/physics/movetypes/movetypes.qc index f00128da4..03a25ab0b 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qc +++ b/qcsrc/common/physics/movetypes/movetypes.qc @@ -46,7 +46,7 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnorma this.move_didgravity = 1; grav = dt * (PHYS_ENTGRAVITY(this) ? PHYS_ENTGRAVITY(this) : 1) * PHYS_GRAVITY(this); - if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !(this.flags & FL_ONGROUND)) + if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !IS_ONGROUND(this)) { if(GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) this.velocity_z -= grav * 0.5; @@ -99,7 +99,7 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnorma trace_ent = NULL; } - this.flags |= FL_ONGROUND; + SET_ONGROUND(this); this.move_groundentity = trace_ent; } } @@ -230,7 +230,7 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnorma if(applygravity) { - if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !(this.flags & FL_ONGROUND)) + if(!GAMEPLAYFIX_NOGRAVITYONGROUND || !IS_ONGROUND(this)) { if(GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE) this.velocity_z -= grav * 0.5f; @@ -480,7 +480,7 @@ float _Movetype_PushEntity(entity this, vector push, bool failonstartsolid) // this.origin = trace_endpos; if(trace_fraction < 1) - if(this.solid >= SOLID_TRIGGER && (!(this.flags & FL_ONGROUND) || (this.move_groundentity != trace_ent))) + if(this.solid >= SOLID_TRIGGER && (!IS_ONGROUND(this) || (this.move_groundentity != trace_ent))) _Movetype_Impact(this, trace_ent); return trace_fraction; @@ -655,7 +655,7 @@ void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy) // SV_Ph this.move_time += n * tr; if(!this.move_didgravity) - this.move_didgravity = ((this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS) && !(this.flags & FL_ONGROUND)); + this.move_didgravity = ((this.move_movetype == MOVETYPE_BOUNCE || this.move_movetype == MOVETYPE_TOSS) && !IS_ONGROUND(this)); for (int i = 0; i < n; ++i) { @@ -665,7 +665,7 @@ void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy) // SV_Ph } - if(dt > 0 && this.move_movetype != MOVETYPE_NONE && !(this.flags & FL_ONGROUND)) + if(dt > 0 && this.move_movetype != MOVETYPE_NONE && !IS_ONGROUND(this)) { // now continue the move from move_time to time diff --git a/qcsrc/common/physics/movetypes/step.qc b/qcsrc/common/physics/movetypes/step.qc index 4480bb30d..7eb553bfa 100644 --- a/qcsrc/common/physics/movetypes/step.qc +++ b/qcsrc/common/physics/movetypes/step.qc @@ -1,10 +1,10 @@ void _Movetype_Physics_Step(entity this, float dt) // SV_Physics_Step { - if(this.flags & FL_ONGROUND) + if(IS_ONGROUND(this)) { if(this.velocity_z >= (1.0 / 32.0) && UPWARD_VELOCITY_CLEARS_ONGROUND(this)) { - this.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(this); _Movetype_CheckVelocity(this); _Movetype_FlyMove(this, dt, true, '0 0 0', 0); _Movetype_LinkEdict(this, true); diff --git a/qcsrc/common/physics/movetypes/toss.qc b/qcsrc/common/physics/movetypes/toss.qc index 7b8f863a5..db3ff72da 100644 --- a/qcsrc/common/physics/movetypes/toss.qc +++ b/qcsrc/common/physics/movetypes/toss.qc @@ -2,11 +2,11 @@ void _Movetype_Physics_Toss(entity this, float dt) // SV_Physics_Toss { - if (this.flags & FL_ONGROUND) + if (IS_ONGROUND(this)) { if (this.velocity.z >= 1 / 32 && UPWARD_VELOCITY_CLEARS_ONGROUND(this)) { - this.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(this); } else if (!this.move_groundentity) { @@ -64,7 +64,7 @@ void _Movetype_Physics_Toss(entity this, float dt) // SV_Physics_Toss if (this.move_movetype == MOVETYPE_BOUNCEMISSILE) { this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 2.0); - this.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(this); } else if (this.move_movetype == MOVETYPE_BOUNCE) { @@ -77,14 +77,14 @@ void _Movetype_Physics_Toss(entity this, float dt) // SV_Physics_Toss float d = trace_plane_normal * this.velocity; if (trace_plane_normal.z > 0.7 && d < bstop && d > -bstop) { - this.flags |= FL_ONGROUND; + SET_ONGROUND(this); this.move_groundentity = trace_ent; this.velocity = '0 0 0'; this.avelocity = '0 0 0'; } else { - this.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(this); } } else @@ -92,7 +92,7 @@ void _Movetype_Physics_Toss(entity this, float dt) // SV_Physics_Toss this.velocity = _Movetype_ClipVelocity(this.velocity, trace_plane_normal, 1.0); if (trace_plane_normal.z > 0.7) { - this.flags |= FL_ONGROUND; + SET_ONGROUND(this); this.move_groundentity = trace_ent; if (trace_ent.solid == SOLID_BSP) this.move_suspendedinair = true; @@ -101,7 +101,7 @@ void _Movetype_Physics_Toss(entity this, float dt) // SV_Physics_Toss } else { - this.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(this); } } @@ -110,11 +110,11 @@ void _Movetype_Physics_Toss(entity this, float dt) // SV_Physics_Toss break; // DP revision 8918 (WHY...) - if (this.flags & FL_ONGROUND) + if (IS_ONGROUND(this)) break; } - //if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE && this.move_didgravity > 0 && !(this.flags & FL_ONGROUND)) + //if (GAMEPLAYFIX_GRAVITYUNAFFECTEDBYTICRATE && this.move_didgravity > 0 && !IS_ONGROUND(this)) // this.velocity_z -= 0.5 * dt * (this.gravity ? this.gravity : 1) * PHYS_GRAVITY(this); _Movetype_CheckWaterTransition(this); diff --git a/qcsrc/common/physics/movetypes/walk.qc b/qcsrc/common/physics/movetypes/walk.qc index 24c9c8c5e..45b1dc39c 100644 --- a/qcsrc/common/physics/movetypes/walk.qc +++ b/qcsrc/common/physics/movetypes/walk.qc @@ -14,7 +14,7 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove _Movetype_CheckVelocity(this); // do a regular slide move unless it looks like you ran into a step - bool oldonground = (this.flags & FL_ONGROUND); + bool oldonground = IS_ONGROUND(this); vector start_origin = this.origin; vector start_velocity = this.velocity; @@ -43,7 +43,7 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove // if the move did not hit the ground at any point, we're not on ground if (!(clip & 1)) - this.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(this); _Movetype_CheckVelocity(this); _Movetype_LinkEdict(this, true); @@ -137,7 +137,7 @@ void _Movetype_Physics_Walk(entity this, float dt) // SV_WalkMove _Movetype_WallFriction(this, stepnormal); } // don't do the down move if stepdown is disabled, moving upward, not in water, or the move started offground or ended onground - else if (!GAMEPLAYFIX_STEPDOWN(this) || this.waterlevel >= 3 || start_velocity.z >= (1.0 / 32.0) || !oldonground || (this.flags & FL_ONGROUND)) + else if (!GAMEPLAYFIX_STEPDOWN(this) || this.waterlevel >= 3 || start_velocity.z >= (1.0 / 32.0) || !oldonground || IS_ONGROUND(this)) { return; } diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 598e5d1ec..3147354ea 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -68,7 +68,7 @@ void ItemDraw(entity this) if(this.gravity) { Movetype_Physics_MatchServer(this, false); - if(this.flags & FL_ONGROUND) + if(IS_ONGROUND(this)) { // For some reason avelocity gets set to '0 0 0' here ... this.oldorigin = this.origin; this.gravity = 0; @@ -107,7 +107,7 @@ void ItemDrawSimple(entity this) { Movetype_Physics_MatchServer(this, false); - if(this.flags & FL_ONGROUND) + if(IS_ONGROUND(this)) this.gravity = 0; } diff --git a/qcsrc/common/triggers/subs.qc b/qcsrc/common/triggers/subs.qc index 51ef00273..3120aa33d 100644 --- a/qcsrc/common/triggers/subs.qc +++ b/qcsrc/common/triggers/subs.qc @@ -14,7 +14,7 @@ Applies some friction to this void SUB_Friction (entity this) { this.SUB_NEXTTHINK = time; - if(this.SUB_FLAGS & FL_ONGROUND) + if(IS_ONGROUND(this)) this.SUB_VELOCITY = this.SUB_VELOCITY * (1 - frametime * this.friction); } diff --git a/qcsrc/common/triggers/subs.qh b/qcsrc/common/triggers/subs.qh index 9d6274171..096022c84 100644 --- a/qcsrc/common/triggers/subs.qh +++ b/qcsrc/common/triggers/subs.qh @@ -10,7 +10,6 @@ #define SUB_THINK(e, f) setthink(e, f) #define SUB_THUNK(e) getthink(e) #define SUB_LTIME ltime -#define SUB_FLAGS flags void SUB_SetFade (entity ent, float when, float fading_time); diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc index be8666eb8..e2d6288bd 100644 --- a/qcsrc/common/triggers/teleporters.qc +++ b/qcsrc/common/triggers/teleporters.qc @@ -128,7 +128,7 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle setorigin(player, to); player.angles = to_angles; player.velocity = to_velocity; - player.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(player); player.iflags |= IFLAG_TELEPORTED | IFLAG_V_ANGLE | IFLAG_ANGLES; player.csqcmodel_teleported = 1; player.v_angle = to_angles; diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index a0c0dd2ec..a0b196e1e 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -330,7 +330,7 @@ bool bumblebee_gunner_enter(entity this, entity player) player.vehicle_reload1 = vehic.vehicle_reload1; player.vehicle_reload2 = vehic.vehicle_reload2; player.vehicle_energy = vehic.vehicle_energy; - player.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(player); RemoveGrapplingHook(player); diff --git a/qcsrc/lib/warpzone/server.qc b/qcsrc/lib/warpzone/server.qc index 5262ca6de..974145e14 100644 --- a/qcsrc/lib/warpzone/server.qc +++ b/qcsrc/lib/warpzone/server.qc @@ -176,7 +176,9 @@ void WarpZone_Touch(entity this, entity toucher) // FIXME needs a better check to know what is safe to teleport and what not if(toucher.movetype == MOVETYPE_NONE || toucher.movetype == MOVETYPE_FOLLOW || toucher.tag_entity +#if 0 || toucher.move_movetype == MOVETYPE_NONE || toucher.move_movetype == MOVETYPE_FOLLOW +#endif #ifdef CSQC || tag_networkentity #endif -- 2.39.2