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)
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)
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);
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);
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:
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';
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))
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;
// 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;
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;
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;
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;
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;
#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)
#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;
#elif defined(SVQC)
#define PHYS_FIXANGLE(s) ((s).fixangle)
- #define PHYS_MOVETYPE(s) ((s).move_movetype)
bool Physics_Valid(string thecvar);
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;
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();
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;
this.SUB_LTIME = ReadCoord();
this.solid = SOLID_BSP;
- this.move_movetype = MOVETYPE_PUSH;
+ set_movetype(this, MOVETYPE_PUSH);
this.use = door_use;
LinkDoors(this);
door_init_startopen(this);
this.move_time = time;
- this.move_movetype = MOVETYPE_PUSH;
+ set_movetype(this, MOVETYPE_PUSH);
}
if(sf & SF_TRIGGER_RESET)
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);
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);
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);
// but we will need these
train_next(this);
- this.move_movetype = MOVETYPE_PUSH;
+ set_movetype(this, MOVETYPE_PUSH);
this.move_time = time;
}
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;
}
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 != "")
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;
}
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;
}
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
}
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;
}
}
} 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;
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;
if(mt == MOVETYPE_PUSH || mt == MOVETYPE_FAKEPUSH || mt == MOVETYPE_PHYSICS)
{
this.move_qcphysics = false;
- this.movetype = mt;
+ set_movetype(this, mt);
return;
}
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;
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;
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')