From: TimePath Date: Sat, 6 Aug 2016 05:47:09 +0000 (+1000) Subject: Use set_movetype everywhere X-Git-Tag: xonotic-v0.8.2~754 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ad0825bdcb97b45779a73953aee838cdea09c308;p=xonotic%2Fxonotic-data.pk3dir.git Use set_movetype everywhere --- diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 4015828e5..6d58ac77a 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -19,7 +19,7 @@ void SUB_Stop(entity this, entity toucher) { this.velocity = this.avelocity = '0 0 0'; - this.move_movetype = MOVETYPE_NONE; + set_movetype(this, MOVETYPE_NONE); } void Projectile_ResetTrail(entity this, vector to) @@ -330,7 +330,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) this.maxs = '0 0 0'; this.colormod = '0 0 0'; settouch(this, SUB_Stop); - this.move_movetype = MOVETYPE_TOSS; + set_movetype(this, MOVETYPE_TOSS); this.alphamod = 1; switch (this.cnt) @@ -340,7 +340,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) loopsound(this, CH_SHOTS_SINGLE, SND(ELECTRO_FLY), VOL_BASE, ATTEN_NORM); this.mins = '-4 -4 -4'; this.maxs = '4 4 4'; - this.move_movetype = MOVETYPE_BOUNCE; + set_movetype(this, MOVETYPE_BOUNCE); settouch(this, func_null); this.bouncefactor = WEP_CVAR_SEC(electro, bouncefactor); this.bouncestop = WEP_CVAR_SEC(electro, bouncestop); @@ -358,7 +358,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) case PROJECTILE_GRENADE_BOUNCING: this.mins = '-3 -3 -3'; this.maxs = '3 3 3'; - this.move_movetype = MOVETYPE_BOUNCE; + set_movetype(this, MOVETYPE_BOUNCE); settouch(this, func_null); this.bouncefactor = WEP_CVAR(mortar, bouncefactor); this.bouncestop = WEP_CVAR(mortar, bouncestop); @@ -376,21 +376,21 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) case PROJECTILE_PORTO_RED: this.colormod = '2 1 1'; this.alphamod = 0.5; - this.move_movetype = MOVETYPE_BOUNCE; + set_movetype(this, MOVETYPE_BOUNCE); settouch(this, func_null); break; case PROJECTILE_PORTO_BLUE: this.colormod = '1 1 2'; this.alphamod = 0.5; - this.move_movetype = MOVETYPE_BOUNCE; + set_movetype(this, MOVETYPE_BOUNCE); settouch(this, func_null); break; case PROJECTILE_HAGAR_BOUNCING: - this.move_movetype = MOVETYPE_BOUNCE; + set_movetype(this, MOVETYPE_BOUNCE); settouch(this, func_null); break; case PROJECTILE_CRYLINK_BOUNCING: - this.move_movetype = MOVETYPE_BOUNCE; + set_movetype(this, MOVETYPE_BOUNCE); settouch(this, func_null); break; case PROJECTILE_FIREBALL: @@ -400,7 +400,7 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) break; case PROJECTILE_FIREMINE: loopsound(this, CH_SHOTS_SINGLE, SND(FIREBALL_FLY), VOL_BASE, ATTEN_NORM); - this.move_movetype = MOVETYPE_BOUNCE; + set_movetype(this, MOVETYPE_BOUNCE); settouch(this, func_null); this.mins = '-4 -4 -4'; this.maxs = '4 4 4'; @@ -460,16 +460,16 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) if (this.gravity) { if (this.move_movetype == MOVETYPE_FLY) - this.move_movetype = MOVETYPE_TOSS; + set_movetype(this, MOVETYPE_TOSS); if (this.move_movetype == MOVETYPE_BOUNCEMISSILE) - this.move_movetype = MOVETYPE_BOUNCE; + set_movetype(this, MOVETYPE_BOUNCE); } else { if (this.move_movetype == MOVETYPE_TOSS) - this.move_movetype = MOVETYPE_FLY; + set_movetype(this, MOVETYPE_FLY); if (this.move_movetype == MOVETYPE_BOUNCE) - this.move_movetype = MOVETYPE_BOUNCEMISSILE; + set_movetype(this, MOVETYPE_BOUNCEMISSILE); } if (!(this.count & 0x80)) diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index a4ade3836..47f2df9a9 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -154,7 +154,7 @@ NET_HANDLE(casings, bool isNew) if (isNew) IL_PUSH(g_drawables, casing); casing.velocity = casing.velocity + 2 * prandomvec(); casing.avelocity = '0 250 0' + 100 * prandomvec(); - casing.move_movetype = MOVETYPE_BOUNCE; + set_movetype(casing, MOVETYPE_BOUNCE); settouch(casing, Casing_Touch); casing.move_time = time; casing.event_damage = Casing_Damage; diff --git a/qcsrc/common/effects/qc/gibs.qc b/qcsrc/common/effects/qc/gibs.qc index 78f1a27cc..267b3f319 100644 --- a/qcsrc/common/effects/qc/gibs.qc +++ b/qcsrc/common/effects/qc/gibs.qc @@ -170,7 +170,7 @@ void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector // TODO remove some gibs according to cl_nogibs gib = RubbleNew("gib"); - gib.move_movetype = MOVETYPE_BOUNCE; + set_movetype(gib, MOVETYPE_BOUNCE); gib.gravity = 1; gib.solid = SOLID_CORPSE; gib.cnt = specnum; diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc b/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc index 013479242..fb8cb7171 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc @@ -117,15 +117,15 @@ void cpicon_construct(entity this) setmodel(this.icon_realmodel, MDL_Null); setorigin(this.icon_realmodel, this.origin); setsize(this.icon_realmodel, CPICON_MIN, CPICON_MAX); - this.icon_realmodel.move_movetype = MOVETYPE_NOCLIP; + set_movetype(this.icon_realmodel, MOVETYPE_NOCLIP); this.icon_realmodel.solid = SOLID_NOT; } if(this.iscaptured) { this.icon_realmodel.solid = SOLID_BBOX; } - this.move_movetype = MOVETYPE_NOCLIP; + set_movetype(this, MOVETYPE_NOCLIP); this.solid = SOLID_NOT; - this.move_movetype = MOVETYPE_NOCLIP; + set_movetype(this, MOVETYPE_NOCLIP); this.move_time = time; this.drawmask = MASK_NORMAL; this.alpha = 1; diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc index 0135f467e..9de2ade72 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc @@ -33,7 +33,7 @@ void ons_generator_ray_spawn(vector org) setmodel(e, MDL_ONS_RAY); setorigin(e, org); e.angles = randomvec() * 360; - e.move_movetype = MOVETYPE_NONE; + set_movetype(e, MOVETYPE_NONE); e.alpha = 0; e.scale = random() * 5 + 8; e.move_time = time + 0.05; @@ -152,9 +152,9 @@ void generator_construct(entity this) setmodel(this, MDL_ONS_GEN); setsize(this, GENERATOR_MIN, GENERATOR_MAX); - this.move_movetype = MOVETYPE_NOCLIP; + set_movetype(this, MOVETYPE_NOCLIP); this.solid = SOLID_BBOX; - this.move_movetype = MOVETYPE_NOCLIP; + set_movetype(this, MOVETYPE_NOCLIP); this.move_time = time; this.drawmask = MASK_NORMAL; this.alpha = 1; diff --git a/qcsrc/common/mutators/mutator/nades/net.qc b/qcsrc/common/mutators/mutator/nades/net.qc index 9488e02a5..e2659c7af 100644 --- a/qcsrc/common/mutators/mutator/nades/net.qc +++ b/qcsrc/common/mutators/mutator/nades/net.qc @@ -31,7 +31,7 @@ void orb_setup(entity e) e.draw = orb_draw; IL_PUSH(g_drawables, e); e.health = 255; - e.move_movetype = MOVETYPE_NONE; + set_movetype(e, MOVETYPE_NONE); e.solid = SOLID_NOT; e.drawmask = MASK_NORMAL; e.scale = 0.01; diff --git a/qcsrc/common/physics/movetypes/movetypes.qc b/qcsrc/common/physics/movetypes/movetypes.qc index 090144dd1..0b27f727a 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qc +++ b/qcsrc/common/physics/movetypes/movetypes.qc @@ -15,17 +15,13 @@ #ifdef SVQC void set_movetype(entity this, int mt) { - if(mt == MOVETYPE_PHYSICS || mt == MOVETYPE_PUSH || mt == MOVETYPE_FAKEPUSH) - { - this.movetype = this.move_movetype = mt; // we still set move_movetype, for other code that checks movetype + this.move_movetype = mt; + if (mt == MOVETYPE_PHYSICS || mt == MOVETYPE_PUSH || mt == MOVETYPE_FAKEPUSH) { this.move_qcphysics = false; - return; } - - this.move_movetype = mt; - - if(!this.move_qcphysics) + if (!this.move_qcphysics) { this.movetype = mt; + } } #elif defined(CSQC) void set_movetype(entity this, int mt) diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index aac321813..f120e9fe6 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -168,7 +168,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK) #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; @@ -245,7 +244,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK) #elif defined(SVQC) #define PHYS_FIXANGLE(s) ((s).fixangle) - #define PHYS_MOVETYPE(s) ((s).move_movetype) bool Physics_Valid(string thecvar); diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 8563349fd..997a9d78e 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -194,7 +194,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) if(sf & ISF_MODEL) { this.drawmask = MASK_NORMAL; - this.move_movetype = MOVETYPE_TOSS; + set_movetype(this, MOVETYPE_TOSS); if (isnew) IL_PUSH(g_drawables, this); this.draw = ItemDraw; this.solid = SOLID_TRIGGER; @@ -254,7 +254,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) this.gravity = 1; this.pushable = true; //this.angles = '0 0 0'; - this.move_movetype = MOVETYPE_TOSS; + set_movetype(this, MOVETYPE_TOSS); this.velocity_x = ReadCoord(); this.velocity_y = ReadCoord(); this.velocity_z = ReadCoord(); diff --git a/qcsrc/common/triggers/func/conveyor.qc b/qcsrc/common/triggers/func/conveyor.qc index 8bd6016f2..73ceb6394 100644 --- a/qcsrc/common/triggers/func/conveyor.qc +++ b/qcsrc/common/triggers/func/conveyor.qc @@ -154,7 +154,7 @@ void conveyor_init(entity this) IL_PUSH(g_drawables, this); this.drawmask = MASK_NORMAL; - this.move_movetype = MOVETYPE_NONE; + set_movetype(this, MOVETYPE_NONE); this.model = ""; this.solid = SOLID_TRIGGER; this.move_time = time; diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index a0fb12a4c..f89f67d7f 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -815,7 +815,7 @@ NET_HANDLE(ENT_CLIENT_DOOR, bool isnew) this.SUB_LTIME = ReadCoord(); this.solid = SOLID_BSP; - this.move_movetype = MOVETYPE_PUSH; + set_movetype(this, MOVETYPE_PUSH); this.use = door_use; LinkDoors(this); @@ -824,7 +824,7 @@ NET_HANDLE(ENT_CLIENT_DOOR, bool isnew) door_init_startopen(this); this.move_time = time; - this.move_movetype = MOVETYPE_PUSH; + set_movetype(this, MOVETYPE_PUSH); } if(sf & SF_TRIGGER_RESET) diff --git a/qcsrc/common/triggers/func/plat.qc b/qcsrc/common/triggers/func/plat.qc index 341ca460f..396636e8c 100644 --- a/qcsrc/common/triggers/func/plat.qc +++ b/qcsrc/common/triggers/func/plat.qc @@ -168,7 +168,7 @@ NET_HANDLE(ENT_CLIENT_PLAT, bool isnew) this.classname = "plat"; this.solid = SOLID_BSP; - this.move_movetype = MOVETYPE_PUSH; + set_movetype(this, MOVETYPE_PUSH); this.drawmask = MASK_NORMAL; this.draw = plat_draw; if (isnew) IL_PUSH(g_drawables, this); @@ -177,7 +177,7 @@ NET_HANDLE(ENT_CLIENT_PLAT, bool isnew) plat_reset(this); // also called here - this.move_movetype = MOVETYPE_PUSH; + set_movetype(this, MOVETYPE_PUSH); this.move_time = time; plat_spawn_inside_trigger(this); diff --git a/qcsrc/common/triggers/func/train.qc b/qcsrc/common/triggers/func/train.qc index 29c7d0a7b..247bfb0fc 100644 --- a/qcsrc/common/triggers/func/train.qc +++ b/qcsrc/common/triggers/func/train.qc @@ -307,7 +307,7 @@ NET_HANDLE(ENT_CLIENT_TRAIN, bool isnew) this.classname = "func_train"; this.solid = SOLID_BSP; - this.move_movetype = MOVETYPE_PUSH; + set_movetype(this, MOVETYPE_PUSH); this.drawmask = MASK_NORMAL; this.draw = train_draw; if (isnew) IL_PUSH(g_drawables, this); @@ -325,7 +325,7 @@ NET_HANDLE(ENT_CLIENT_TRAIN, bool isnew) // but we will need these train_next(this); - this.move_movetype = MOVETYPE_PUSH; + set_movetype(this, MOVETYPE_PUSH); this.move_time = time; } diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 5ec7b41fd..effeff956 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -174,11 +174,11 @@ void trigger_push_touch(entity this, entity toucher) switch(toucher.move_movetype) { case MOVETYPE_FLY: - toucher.move_movetype = MOVETYPE_TOSS; + set_movetype(toucher, MOVETYPE_TOSS); toucher.gravity = 1; break; case MOVETYPE_BOUNCEMISSILE: - toucher.move_movetype = MOVETYPE_BOUNCE; + set_movetype(toucher, MOVETYPE_BOUNCE); toucher.gravity = 1; break; } diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 71181f209..cc2ef8c4d 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -1349,7 +1349,7 @@ bool turret_initialize(entity this, Turret tur) this.tur_head.owner = this; this.tur_head.takedamage = DAMAGE_NO; this.tur_head.solid = SOLID_NOT; - this.tur_head.move_movetype = this.move_movetype; + set_movetype(this.tur_head, this.move_movetype); if(!this.tur_defend) if(this.target != "") diff --git a/qcsrc/common/turrets/turret/ewheel.qc b/qcsrc/common/turrets/turret/ewheel.qc index 62d7222ce..2a6245cd0 100644 --- a/qcsrc/common/turrets/turret/ewheel.qc +++ b/qcsrc/common/turrets/turret/ewheel.qc @@ -257,7 +257,7 @@ void ewheel_draw(entity this) METHOD(EWheel, tr_setup, void(EWheel this, entity it)) { it.gravity = 1; - it.move_movetype = MOVETYPE_BOUNCE; + set_movetype(it, MOVETYPE_BOUNCE); it.move_time = time; it.draw = ewheel_draw; } diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index 3f55280e8..14e9a28d5 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -652,7 +652,7 @@ void walker_draw(entity this) METHOD(WalkerTurret, tr_setup, void(WalkerTurret this, entity it)) { it.gravity = 1; - it.move_movetype = MOVETYPE_BOUNCE; + set_movetype(it, MOVETYPE_BOUNCE); it.move_time = time; it.draw = walker_draw; } diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index 277326ffd..0d6217774 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -545,7 +545,7 @@ METHOD(Racer, vr_enter, void(Racer thisveh, entity instance)) if(instance.owner.flagcarried) setorigin(instance.owner.flagcarried, '-190 0 96'); #elif defined(CSQC) - instance.move_movetype = MOVETYPE_BOUNCE; + set_movetype(instance, MOVETYPE_BOUNCE); #endif } diff --git a/qcsrc/ecs/systems/physics.qc b/qcsrc/ecs/systems/physics.qc index 8646b29cc..f5052b376 100644 --- a/qcsrc/ecs/systems/physics.qc +++ b/qcsrc/ecs/systems/physics.qc @@ -26,7 +26,7 @@ void sys_phys_update(entity this, float dt) sys_phys_pregame_hold(this); if (IS_SVQC) { - if (PHYS_MOVETYPE(this) == MOVETYPE_NONE) { return; } + if (this.move_movetype == MOVETYPE_NONE) { return; } // when we get here, disableclientprediction cannot be 2 this.disableclientprediction = (this.move_qcphysics) ? -1 : 0; } @@ -86,9 +86,9 @@ void sys_phys_update(entity this, float dt) } } 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 + } else if (this.move_movetype == MOVETYPE_NOCLIP + || this.move_movetype == MOVETYPE_FLY + || this.move_movetype == MOVETYPE_FLY_WORLDONLY || MUTATOR_CALLHOOK(IsFlying, this)) { this.com_phys_friction = PHYS_FRICTION(this); this.com_phys_vel_max = PHYS_MAXSPEED(this) * maxspeed_mod; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index fe307fc01..da388a1ca 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -2428,7 +2428,7 @@ void DrownPlayer(entity this) void Player_Physics(entity this) { - this.movetype = ((this.move_qcphysics) ? MOVETYPE_NONE : this.move_movetype); + set_movetype(this, ((this.move_qcphysics) ? MOVETYPE_NONE : this.move_movetype)); if(!this.move_qcphysics) return; @@ -2438,7 +2438,7 @@ void Player_Physics(entity this) if(mt == MOVETYPE_PUSH || mt == MOVETYPE_FAKEPUSH || mt == MOVETYPE_PHYSICS) { this.move_qcphysics = false; - this.movetype = mt; + set_movetype(this, mt); return; } diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 7d477ac57..fe3c4d1d1 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1993,7 +1993,7 @@ void Physics_Frame() FOREACH_ENTITY_FLOAT(pure_data, false, { - if(IS_CLIENT(it) || it.classname == "" || it.movetype == MOVETYPE_PUSH || it.movetype == MOVETYPE_FAKEPUSH || it.movetype == MOVETYPE_PHYSICS) + if(IS_CLIENT(it) || it.classname == "" || it.move_movetype == MOVETYPE_PUSH || it.move_movetype == MOVETYPE_FAKEPUSH || it.move_movetype == MOVETYPE_PHYSICS) continue; int mt = it.move_movetype; @@ -2001,11 +2001,11 @@ void Physics_Frame() if(mt == MOVETYPE_PUSH || mt == MOVETYPE_FAKEPUSH || mt == MOVETYPE_PHYSICS) { it.move_qcphysics = false; - it.movetype = mt; + set_movetype(it, mt); continue; } - it.movetype = ((it.move_qcphysics) ? MOVETYPE_NONE : it.move_movetype); + set_movetype(it, ((it.move_qcphysics) ? MOVETYPE_NONE : it.move_movetype)); if(it.move_movetype == MOVETYPE_NONE) continue; diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index a10edf45b..b896f183e 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -369,7 +369,7 @@ LABEL(cvar_fail) return; } - this.move_movetype = this.movetype; + set_movetype(this, this.movetype); // support special -1 and -2 angle from radiant if (this.angles == '0 -1 0')