From 9f1091e432a2db424bfad2482694ee8b34edbe9c Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 25 Dec 2015 13:37:51 +1000 Subject: [PATCH] Use the ONGROUND macros --- qcsrc/client/csqcmodel_hooks.qc | 2 +- qcsrc/common/effects/qc/casings.qc | 2 +- .../gamemodes/gamemode/nexball/nexball.qc | 8 +++--- qcsrc/common/monsters/monster/shambler.qc | 2 +- qcsrc/common/monsters/sv_monsters.qc | 10 +++---- .../common/mutators/mutator/midair/midair.qc | 2 +- qcsrc/common/mutators/mutator/nades/nades.qc | 2 +- qcsrc/common/physics/movelib.qc | 4 +-- qcsrc/common/physics/movelib.qh | 2 +- qcsrc/common/physics/movetypes/movetypes.qh | 4 +++ qcsrc/common/physics/player.qh | 4 --- qcsrc/common/triggers/teleporters.qc | 2 +- qcsrc/common/turrets/sv_turrets.qc | 2 +- qcsrc/common/vehicles/sv_vehicles.qc | 4 +-- qcsrc/common/vehicles/vehicle/spiderbot.qc | 26 +++++++++---------- qcsrc/lib/csqcmodel/cl_player.qc | 6 ++--- qcsrc/server/bot/havocbot/havocbot.qc | 10 +++---- qcsrc/server/bot/havocbot/roles.qc | 2 +- qcsrc/server/bot/navigation.qc | 2 +- qcsrc/server/bot/waypoints.qc | 2 +- qcsrc/server/cheats.qc | 6 ++--- qcsrc/server/cl_player.qc | 4 +-- qcsrc/server/g_damage.qc | 2 +- qcsrc/server/g_hook.qc | 6 ++--- qcsrc/server/miscfunctions.qc | 2 +- qcsrc/server/weapons/csqcprojectile.qc | 4 +-- 26 files changed, 61 insertions(+), 61 deletions(-) diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 91f107486..322946740 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -649,7 +649,7 @@ void CSQCModel_Hook_PreDraw(bool isplayer) bool onground = 0; if(self == csqcplayer) { - if(self.flags & FL_ONGROUND) + if(IS_ONGROUND(self)) onground = 1; self.anim_prev_pmove_flags = self.flags; if(self.flags & FL_DUCKED) diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index 5d8a87d28..4d91acb54 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -49,7 +49,7 @@ void Casing_Draw(entity this) { self.move_angles_x = 0; self.move_angles_z = 0; - self.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(self); } Movetype_Physics_MatchTicrate(self, autocvar_cl_casings_ticrate, autocvar_cl_casings_sloppy); diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index 987b50c41..4a8005d6c 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -127,7 +127,7 @@ void DropOwner() DropBall(self, ownr.origin, ownr.velocity); makevectors(ownr.v_angle.y * '0 1 0'); ownr.velocity += ('0 0 0.75' - v_forward) * 1000; - ownr.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(ownr); } void GiveBall(entity plyr, entity ball) @@ -199,7 +199,7 @@ void DropBall(entity ball, vector org, vector vel) setattachment(ball, world, ""); setorigin(ball, org); ball.movetype = MOVETYPE_BOUNCE; - ball.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(ball); ball.scale = ball_scale; ball.velocity = vel; ball.nb_droptime = time; @@ -225,7 +225,7 @@ void DropBall(entity ball, vector org, vector vel) void InitBall() {SELFPARAM(); if(gameover) return; - self.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(self); self.movetype = MOVETYPE_BOUNCE; if(self.classname == "nexball_basketball") self.touch = basketball_touch; @@ -729,7 +729,7 @@ void W_Nexball_Touch() if((ball = other.ballcarried) && !other.frozen && !other.deadflag && (IS_PLAYER(attacker))) { other.velocity = other.velocity + normalize(self.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force; - other.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(other); if(!attacker.ballcarried) { LogNB("stole", attacker); diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index f30d36065..a2a42ef99 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -196,7 +196,7 @@ float M_Shambler_Attack(float attack_type, entity targ) float randomness = random(), enemy_len = vlen(self.enemy.origin - self.origin); if(time >= self.shambler_lastattack) // shambler doesn't attack much - if(self.flags & FL_ONGROUND) + if(IS_ONGROUND(self)) if(randomness <= 0.5 && enemy_len <= autocvar_g_monster_shambler_attack_smash_range) { setanim(self, self.anim_melee2, true, true, false); diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 27e124674..92abc8cd9 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -382,7 +382,7 @@ float Monster_Attack_Leap_Check(vector vel) {SELFPARAM(); if(self.state && (self.flags & FL_MONSTER)) return false; // already attacking - if(!(self.flags & FL_ONGROUND)) + if(!(IS_ONGROUND(self))) return false; // not on the ground if(self.health <= 0) return false; // called when dead? @@ -417,7 +417,7 @@ bool Monster_Attack_Leap(vector anm, void() touchfunc, vector vel, float animtim self.touch = touchfunc; self.origin_z += 1; self.velocity = vel; - self.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(self); return true; } @@ -833,7 +833,7 @@ void Monster_Move(float runspeed, float walkspeed, float stpspeed) self.last_enemycheck = time + 1; // check for enemies every second } - if(self.state == MONSTER_ATTACK_RANGED && (self.flags & FL_ONGROUND)) + if(self.state == MONSTER_ATTACK_RANGED && (IS_ONGROUND(self))) { self.state = 0; self.touch = Monster_Touch; @@ -861,7 +861,7 @@ void Monster_Move(float runspeed, float walkspeed, float stpspeed) if(vlen(self.origin - self.moveto) > 100) { float do_run = (self.enemy || self.monster_moveto); - if((self.flags & FL_ONGROUND) || ((self.flags & FL_FLY) || (self.flags & FL_SWIM))) + if((IS_ONGROUND(self)) || ((self.flags & FL_FLY) || (self.flags & FL_SWIM))) Monster_CalculateVelocity(self, self.moveto, self.origin, true, ((do_run) ? runspeed : walkspeed)); if(time > self.pain_finished) // TODO: use anim_finished instead! @@ -1203,7 +1203,7 @@ void Monster_Anim() if(self.crouch) animbits |= ANIMSTATE_DUCK; // not that monsters can crouch currently... animdecide_setstate(self, animbits, false); - animdecide_setimplicitstate(self, (self.flags & FL_ONGROUND)); + animdecide_setimplicitstate(self, (IS_ONGROUND(self))); /* // weapon entities for monsters? if (self.weaponentity) diff --git a/qcsrc/common/mutators/mutator/midair/midair.qc b/qcsrc/common/mutators/mutator/midair/midair.qc index aaae006f5..7850166a1 100644 --- a/qcsrc/common/mutators/mutator/midair/midair.qc +++ b/qcsrc/common/mutators/mutator/midair/midair.qc @@ -19,7 +19,7 @@ MUTATOR_HOOKFUNCTION(midair, PlayerDamage_Calculate) MUTATOR_HOOKFUNCTION(midair, PlayerPowerups) {SELFPARAM(); if(time >= game_starttime) - if(self.flags & FL_ONGROUND) + if(IS_ONGROUND(self)) { self.effects |= (EF_ADDITIVE | EF_FULLBRIGHT); self.midair_shieldtime = max(self.midair_shieldtime, time + autocvar_g_midair_shieldtime); diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 90c6c6561..4b65abc55 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -743,7 +743,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, self.velocity += force; UpdateCSQCProjectile(self); - if(damage <= 0 || ((self.flags & FL_ONGROUND) && IS_PLAYER(attacker))) + if(damage <= 0 || ((IS_ONGROUND(self)) && IS_PLAYER(attacker))) return; if(self.health == self.max_health) diff --git a/qcsrc/common/physics/movelib.qc b/qcsrc/common/physics/movelib.qc index 38afbe2d9..207b4c636 100644 --- a/qcsrc/common/physics/movelib.qc +++ b/qcsrc/common/physics/movelib.qc @@ -74,7 +74,7 @@ void movelib_move(vector force,float max_velocity,float drag,float theMass,float else acceleration = vlen(force); - if (self.flags & FL_ONGROUND) + if (IS_ONGROUND(self)) { if (breakforce) { @@ -150,7 +150,7 @@ void movelib_update(vector dir,float force) acceleration += self.buoyancy * '0 0 1'; } else - if(self.flags & FL_ONGROUND) + if(IS_ONGROUND(self)) ffriction = self.ground_friction; else ffriction = self.air_friction; diff --git a/qcsrc/common/physics/movelib.qh b/qcsrc/common/physics/movelib.qh index c1fd574ca..26b7033ff 100644 --- a/qcsrc/common/physics/movelib.qh +++ b/qcsrc/common/physics/movelib.qh @@ -38,7 +38,7 @@ void movelib_move_simple(vector newdir,float velo,float blendrate) self.velocity = self.velocity * (1 - blendrate) + (newdir * blendrate) * velo #define movelib_move_simple_gravity(newdir,velo,blendrate) \ - if(self.flags & FL_ONGROUND) movelib_move_simple(newdir,velo,blendrate) + if(IS_ONGROUND(self)) movelib_move_simple(newdir,velo,blendrate) void movelib_brake_simple(float force); diff --git a/qcsrc/common/physics/movetypes/movetypes.qh b/qcsrc/common/physics/movetypes/movetypes.qh index 7578ae2fa..9342ecb21 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qh +++ b/qcsrc/common/physics/movetypes/movetypes.qh @@ -1,6 +1,10 @@ #ifndef MOVETYPES_H #define MOVETYPES_H +#define IS_ONGROUND(s) boolean((s).flags & FL_ONGROUND) +#define SET_ONGROUND(s) ((s).flags |= FL_ONGROUND) +#define UNSET_ONGROUND(s) ((s).flags &= ~FL_ONGROUND) + .float move_ltime; .void()move_think; .float move_nextthink; diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index 66824bbcf..978649026 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -134,10 +134,6 @@ bool IsFlying(entity a); #define SET_JUMP_HELD(s) ((s).flags &= ~FL_JUMPRELEASED) #define UNSET_JUMP_HELD(s) ((s).flags |= FL_JUMPRELEASED) -#define IS_ONGROUND(s) boolean((s).flags & FL_ONGROUND) -#define SET_ONGROUND(s) ((s).flags |= FL_ONGROUND) -#define UNSET_ONGROUND(s) ((s).flags &= ~FL_ONGROUND) - #define WAS_ONGROUND(s) boolean((s).lastflags & FL_ONGROUND) #define ITEMS_STAT(s) ((s).items) diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc index 0ddc83310..e7d3c5fd7 100644 --- a/qcsrc/common/triggers/teleporters.qc +++ b/qcsrc/common/triggers/teleporters.qc @@ -138,7 +138,7 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle tdeath(player, teleporter, telefragger, telefragmin, telefragmax); // player no longer is on ground - player.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(player); // reset tracking of oldvelocity for impact damage (sudden velocity changes) player.oldvelocity = player.velocity; diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index ed79df128..1d58686bb 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -31,7 +31,7 @@ vector turret_aim_generic() prep = pre_pos + (self.enemy.velocity * (impact_time + mintime)); if(self.aim_flags & TFL_AIM_ZPREDICT) - if(!(self.enemy.flags & FL_ONGROUND)) + if(!IS_ONGROUND(self.enemy)) if(self.enemy.movetype == MOVETYPE_WALK || self.enemy.movetype == MOVETYPE_TOSS || self.enemy.movetype == MOVETYPE_BOUNCE) { float vz; diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 179876c32..819473fe1 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -1076,8 +1076,8 @@ void vehicles_enter(entity pl, entity veh) //veh.exteriormodeltoclient = veh.owner; //veh.tur_head.exteriormodeltoclient = veh.owner; - pl.flags &= ~FL_ONGROUND; - veh.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(pl); + UNSET_ONGROUND(veh); veh.team = pl.team; veh.flags -= FL_NOTARGET; diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index be552b372..0e8355f5a 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -134,12 +134,12 @@ float spiderbot_frame() movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit); - if(spider.flags & FL_ONGROUND) + if(IS_ONGROUND(spider)) spider.jump_delay = time; // reset now so movement can begin - //if(spider.flags & FL_ONGROUND) + //if(IS_ONGROUND(spider)) { - if(spider.flags & FL_ONGROUND) + if(IS_ONGROUND(spider)) if(spider.frame == 4 && self.tur_head.wait != 0) { sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM); @@ -149,7 +149,7 @@ float spiderbot_frame() if(!player.BUTTON_JUMP) spider.BUTTON_JUMP = 0; - if((spider.flags & FL_ONGROUND) && player.BUTTON_JUMP && !spider.BUTTON_JUMP && self.tur_head.wait < time) + if((IS_ONGROUND(spider)) && player.BUTTON_JUMP && !spider.BUTTON_JUMP && self.tur_head.wait < time) { sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM); //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n"); @@ -171,7 +171,7 @@ float spiderbot_frame() if(movefix_y == 0 && movefix_x == 0) sd = v_forward; // always do forward - spider.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(spider); spider.velocity = sd * 700 + rt * 600 + v_up * 600; spider.frame = 4; @@ -180,7 +180,7 @@ float spiderbot_frame() { if(vlen(player.movement) == 0) { - if(spider.flags & FL_ONGROUND) + if(IS_ONGROUND(spider)) { if(self.sound_nexttime < time || self.delay != 3) { @@ -210,13 +210,13 @@ float spiderbot_frame() if(player.movement_x > 0) { player.movement_x = 1; - if(spider.flags & FL_ONGROUND) + if(IS_ONGROUND(spider)) spider.frame = 0; } else if(player.movement_x < 0) { player.movement_x = -1; - if(spider.flags & FL_ONGROUND) + if(IS_ONGROUND(spider)) spider.frame = 1; } player.movement_y = 0; @@ -226,7 +226,7 @@ float spiderbot_frame() float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1); if(spider.velocity_z <= 20) // not while jumping spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity; - if(spider.flags & FL_ONGROUND) + if(IS_ONGROUND(spider)) if(self.sound_nexttime < time || self.delay != 1) { self.delay = 1; @@ -240,13 +240,13 @@ float spiderbot_frame() if(player.movement_y < 0) { player.movement_y = -1; - if(spider.flags & FL_ONGROUND) + if(IS_ONGROUND(spider)) spider.frame = 2; } else if(player.movement_y > 0) { player.movement_y = 1; - if(spider.flags & FL_ONGROUND) + if(IS_ONGROUND(spider)) spider.frame = 3; } @@ -256,7 +256,7 @@ float spiderbot_frame() float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1); if(spider.velocity_z <= 20) // not while jumping spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity; - if(spider.flags & FL_ONGROUND) + if(IS_ONGROUND(spider)) if(self.sound_nexttime < time || self.delay != 2) { self.delay = 2; @@ -572,7 +572,7 @@ spawnfunc(vehicle_spiderbot) } METHOD(Spiderbot, vr_think, void(Spiderbot thisveh)) { - if(self.flags & FL_ONGROUND) + if(IS_ONGROUND(self)) movelib_brake_simple(autocvar_g_vehicle_spiderbot_speed_stop); } METHOD(Spiderbot, vr_death, void(Spiderbot thisveh)) diff --git a/qcsrc/lib/csqcmodel/cl_player.qc b/qcsrc/lib/csqcmodel/cl_player.qc index 7bceb5383..e99730377 100644 --- a/qcsrc/lib/csqcmodel/cl_player.qc +++ b/qcsrc/lib/csqcmodel/cl_player.qc @@ -173,7 +173,7 @@ void CSQCPlayer_Physics(entity this) //this.move_movetype = MOVETYPE_WALK; // temp this.move_velocity = this.velocity; this.move_avelocity = this.avelocity; - this.move_flags = BITSET(this.move_flags, FL_ONGROUND, boolean(this.flags & FL_ONGROUND)); + this.move_flags = BITSET(this.move_flags, FL_ONGROUND, IS_ONGROUND(this)); this.move_flags = BITSET(this.move_flags, FL_WATERJUMP, boolean(this.flags & FL_WATERJUMP)); this.move_waterlevel = this.waterlevel; this.move_watertype = this.watertype; @@ -183,7 +183,7 @@ void CSQCPlayer_Physics(entity this) this.pmove_flags = ((this.flags & FL_DUCKED) ? PMF_DUCKED : 0) | (!(this.flags & FL_JUMPRELEASED) ? PMF_JUMP_HELD : 0) | - ((this.flags & FL_ONGROUND) ? PMF_ONGROUND : 0); + ((IS_ONGROUND(this)) ? PMF_ONGROUND : 0); } } @@ -282,7 +282,7 @@ void CSQCPlayer_SetCamera() const vector o = e.origin; csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED; CSQCPlayer_PredictTo(e, servercommandframe + 1, false); - CSQCPlayer_SetPredictionError(e.origin - o, e.velocity - v0, pmove_onground - boolean(e.flags & FL_ONGROUND)); + CSQCPlayer_SetPredictionError(e.origin - o, e.velocity - v0, pmove_onground - IS_ONGROUND(e)); e.origin = o; e.velocity = v0; diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index 09cfe4f1f..12efd5896 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -295,7 +295,7 @@ void havocbot_bunnyhop(vector dir) bunnyhopdistance = vlen(self.origin - gco); // Run only to visible goals - if(self.flags & FL_ONGROUND) + if(IS_ONGROUND(self)) if(self.speed==maxspeed) if(checkpvs(self.origin + self.view_ofs, self.goalcurrent)) { @@ -371,7 +371,7 @@ void havocbot_bunnyhop(vector dir) #if 0 // Release jump button if(!cvar("sv_pogostick")) - if((self.flags & FL_ONGROUND) == 0) + if((IS_ONGROUND(self)) == 0) { if(self.velocity.z < 0 || vlen(self.velocity)6) - if (!(self.flags & FL_ONGROUND)) + if (!(IS_ONGROUND(self))) { tracebox(self.origin, self.mins, self.maxs, self.origin + '0 0 -65536', MOVE_NOMONSTERS, self); if(tracebox_hits_trigger_hurt(self.origin, self.mins, self.maxs, trace_endpos )) @@ -767,7 +767,7 @@ void havocbot_movetogoal() self.aistatus &= ~AI_STATUS_DANGER_AHEAD; if(trace_fraction == 1 && self.jumppadcount == 0 && !self.goalcurrent.wphardwired ) - if((self.flags & FL_ONGROUND) || (self.aistatus & AI_STATUS_RUNNING) || self.BUTTON_JUMP == true) + if((IS_ONGROUND(self)) || (self.aistatus & AI_STATUS_RUNNING) || self.BUTTON_JUMP == true) { // Look downwards traceline(dst_ahead , dst_down, true, world); @@ -849,7 +849,7 @@ void havocbot_movetogoal() if(skill+self.bot_moveskill >= autocvar_bot_ai_bunnyhop_skilloffset) havocbot_bunnyhop(dir); - if ((dir * v_up) >= autocvar_sv_jumpvelocity*0.5 && (self.flags & FL_ONGROUND)) self.BUTTON_JUMP=1; + if ((dir * v_up) >= autocvar_sv_jumpvelocity*0.5 && (IS_ONGROUND(self))) self.BUTTON_JUMP=1; if (((dodge * v_up) > 0) && random()*frametime >= 0.2*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) self.BUTTON_JUMP=true; if (((dodge * v_up) < 0) && random()*frametime >= 0.5*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) self.havocbot_ducktime=time+0.3/bound(0.1,skill+self.bot_dodgeskill,10); } diff --git a/qcsrc/server/bot/havocbot/roles.qc b/qcsrc/server/bot/havocbot/roles.qc index 2db5dba02..f49800ff9 100644 --- a/qcsrc/server/bot/havocbot/roles.qc +++ b/qcsrc/server/bot/havocbot/roles.qc @@ -177,7 +177,7 @@ void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradi continue; // not falling - if((it.flags & FL_ONGROUND) == 0) + if((IS_ONGROUND(it)) == 0) { traceline(it.origin, it.origin + '0 0 -1500', true, world); t = pointcontents(trace_endpos + '0 0 1'); diff --git a/qcsrc/server/bot/navigation.qc b/qcsrc/server/bot/navigation.qc index a1bfb05c0..437557998 100644 --- a/qcsrc/server/bot/navigation.qc +++ b/qcsrc/server/bot/navigation.qc @@ -551,7 +551,7 @@ void navigation_markroutes(entity fixed_source_waypoint) // try a short range search for the nearest waypoints, and expand the search repeatedly if none are found // as this search is expensive we will use lower values if the bot is on the air float i, increment, maxdistance; - if(self.flags & FL_ONGROUND) + if(IS_ONGROUND(self)) { increment = 750; maxdistance = 50000; diff --git a/qcsrc/server/bot/waypoints.qc b/qcsrc/server/bot/waypoints.qc index ba1f7c88d..d159cba58 100644 --- a/qcsrc/server/bot/waypoints.qc +++ b/qcsrc/server/bot/waypoints.qc @@ -818,7 +818,7 @@ void botframe_showwaypointlinks() while (player) { if (!player.isbot) - if (player.flags & FL_ONGROUND || player.waterlevel > WATERLEVEL_NONE) + if (IS_ONGROUND(player) || player.waterlevel > WATERLEVEL_NONE) { //navigation_testtracewalk = true; head = navigation_findnearestwaypoint(player, false); diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 2a8e5d571..cb1387a9c 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -880,7 +880,7 @@ void Drag_Begin(entity dragger, entity draggee, vector touchpoint) draggee.draggravity = draggee.gravity; draggee.movetype = MOVETYPE_WALK; draggee.gravity = 0.00001; - draggee.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(draggee); draggee.draggedby = dragger; dragger.dragentity = draggee; @@ -924,7 +924,7 @@ void Drag_Finish(entity dragger) if((draggee.flags & FL_ITEM) && (vlen(draggee.velocity) < 32)) { draggee.velocity = '0 0 0'; - draggee.flags |= FL_ONGROUND; // floating items are FUN + SET_ONGROUND(draggee); // floating items are FUN } } @@ -985,7 +985,7 @@ void Drag_Update(entity dragger) entity draggee; draggee = dragger.dragentity; - draggee.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(draggee); curorigin = gettaginfo(draggee, 0); curorigin = curorigin + v_forward * dragger.draglocalvector.x + v_right * dragger.draglocalvector.y + v_up * dragger.draglocalvector.z; diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 403c28f3f..e194b026f 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -154,7 +154,7 @@ void player_anim () if(self.crouch) animbits |= ANIMSTATE_DUCK; animdecide_setstate(self, animbits, false); - animdecide_setimplicitstate(self, (self.flags & FL_ONGROUND)); + animdecide_setimplicitstate(self, (IS_ONGROUND(self))); } void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -588,7 +588,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtyp self.solid = SOLID_CORPSE; self.ballistics_density = autocvar_g_ballistics_density_corpse; // don't stick to the floor - self.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(self); // dying animation self.deadflag = DEAD_DYING; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index f792874a8..a1c4d60e0 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -855,7 +855,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d self.velocity = self.velocity + farce; self.move_velocity = self.velocity; } - self.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(self); self.move_flags &= ~FL_ONGROUND; UpdateCSQCProjectile(self); } diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 5515c57aa..54cca3e95 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -243,7 +243,7 @@ void GrapplingHookThink() if((frozen_pulling && self.aiment.frozen) || !frozen_pulling) { self.aiment.velocity = self.aiment.velocity - dv * 0.5; - self.aiment.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(self.aiment); if(self.aiment.flags & FL_PROJECTILE) UpdateCSQCProjectile(self.aiment); } @@ -255,7 +255,7 @@ void GrapplingHookThink() } } - pull_entity.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(pull_entity); } if(!frozen_pulling && !(self.aiment.flags & FL_PROJECTILE)) @@ -280,7 +280,7 @@ void GrapplingHookThink() self.realowner.velocity = dir*spd; self.realowner.movetype = MOVETYPE_FLY; - self.realowner.flags &= ~FL_ONGROUND; + UNSET_ONGROUND(self.realowner); } } diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index c6900aa95..9bd602426 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -964,7 +964,7 @@ void adaptor_think2use() void adaptor_think2use_hittype_splash() // for timed projectile detonation {SELFPARAM(); - if(!(self.flags & FL_ONGROUND)) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING + if(!(IS_ONGROUND(self))) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING self.projectiledeathtype |= HITTYPE_SPLASH; adaptor_think2use(); } diff --git a/qcsrc/server/weapons/csqcprojectile.qc b/qcsrc/server/weapons/csqcprojectile.qc index 1b7bd8231..7f3d97b94 100644 --- a/qcsrc/server/weapons/csqcprojectile.qc +++ b/qcsrc/server/weapons/csqcprojectile.qc @@ -19,7 +19,7 @@ bool CSQCProjectile_SendEntity(entity this, entity to, int sf) if(self.csqcprojectile_clientanimate) sf |= 0x80; // client animated, not interpolated - if(self.flags & FL_ONGROUND) + if(IS_ONGROUND(self)) sf |= 0x40; ft = fr = 0; @@ -71,7 +71,7 @@ bool CSQCProjectile_SendEntity(entity this, entity to, int sf) void CSQCProjectile_Check(entity e) { if(e.csqcprojectile_clientanimate) - if(e.flags & FL_ONGROUND) + if(IS_ONGROUND(e)) if(e.origin != e.csqcprojectile_oldorigin) UpdateCSQCProjectile(e); e.csqcprojectile_oldorigin = e.origin; -- 2.39.2