this.takedamage = DAMAGE_NO;
if(this.move_movetype == MOVETYPE_NONE)
- this.velocity = this.oldvelocity;
+ this.velocity = this.movedir; // .velocity must be != '0 0 0' for particle fx and decal to work
RadiusDamage(this, this.realowner, WEP_CVAR_PRI(mortar, damage), WEP_CVAR_PRI(mortar, edgedamage), WEP_CVAR_PRI(mortar, radius), NULL, NULL, WEP_CVAR_PRI(mortar, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity);
this.takedamage = DAMAGE_NO;
if(this.move_movetype == MOVETYPE_NONE)
- this.velocity = this.oldvelocity;
+ this.velocity = this.movedir; // .velocity must be != '0 0 0' for particle fx and decal to work
RadiusDamage(this, this.realowner, WEP_CVAR_SEC(mortar, damage), WEP_CVAR_SEC(mortar, edgedamage), WEP_CVAR_SEC(mortar, radius), NULL, NULL, WEP_CVAR_SEC(mortar, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity);
void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
{
- if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+ if(GetResource(this, RES_HEALTH) <= 0)
return;
if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
return; // g_projectiles_damage says to halt
- TakeResource(this, RESOURCE_HEALTH, damage);
+ TakeResource(this, RES_HEALTH, damage);
- if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+ if(GetResource(this, RES_HEALTH) <= 0)
W_PrepareExplosionByDamage(this, attacker, adaptor_think2use);
}
spamsound(this, CH_SHOTS, SND_GRENADE_STICK, VOL_BASE, ATTN_NORM);
// let it stick whereever it is
- this.oldvelocity = this.velocity;
+ this.movedir = this.velocity; // save to this temporary field, will be restored on explosion
this.velocity = '0 0 0';
set_movetype(this, MOVETYPE_NONE); // also disables gravity
this.gravity = 0; // nope, it does NOT! maybe a bug in CSQC code? TODO
spamsound(this, CH_SHOTS, SND_GRENADE_STICK, VOL_BASE, ATTN_NORM);
// let it stick whereever it is
- this.oldvelocity = this.velocity;
+ this.movedir = this.velocity; // save to this temporary field, will be restored on explosion
this.velocity = '0 0 0';
set_movetype(this, MOVETYPE_NONE); // also disables gravity
this.gravity = 0; // nope, it does NOT! maybe a bug in CSQC code? TODO
{
W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(mortar, ammo), weaponentity);
- W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage), thiswep.m_id);
+ W_SetupShot_ProjectileSize(actor, weaponentity, GREN_MINS, GREN_MAXS, false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage), thiswep.m_id);
w_shotdir = v_forward; // no TrueAim for grenades please
- Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
entity gren = new(grenade);
gren.owner = gren.realowner = actor;
gren.projectiledeathtype = thiswep.m_id;
gren.weaponentity_fld = weaponentity;
setorigin(gren, w_shotorg);
- setsize(gren, '-3 -3 -3', '3 3 3');
+ setsize(gren, GREN_MINS, GREN_MAXS);
gren.cnt = time + WEP_CVAR_PRI(mortar, lifetime);
gren.nextthink = time;
settouch(gren, W_Mortar_Grenade_Touch1);
gren.takedamage = DAMAGE_YES;
- SetResourceAmountExplicit(gren, RESOURCE_HEALTH, WEP_CVAR_PRI(mortar, health));
+ SetResourceExplicit(gren, RES_HEALTH, WEP_CVAR_PRI(mortar, health));
gren.damageforcescale = WEP_CVAR_PRI(mortar, damageforcescale);
gren.event_damage = W_Mortar_Grenade_Damage;
gren.damagedbycontents = true;
W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(mortar, ammo), weaponentity);
- W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage), thiswep.m_id | HITTYPE_SECONDARY);
+ W_SetupShot_ProjectileSize(actor, weaponentity, GREN_MINS, GREN_MAXS, false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage), thiswep.m_id | HITTYPE_SECONDARY);
w_shotdir = v_forward; // no TrueAim for grenades please
- Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
gren = new(grenade);
gren.owner = gren.realowner = actor;
gren.projectiledeathtype = thiswep.m_id | HITTYPE_SECONDARY;
gren.weaponentity_fld = weaponentity;
setorigin(gren, w_shotorg);
- setsize(gren, '-3 -3 -3', '3 3 3');
+ setsize(gren, GREN_MINS, GREN_MAXS);
gren.nextthink = time + WEP_CVAR_SEC(mortar, lifetime);
setthink(gren, adaptor_think2use_hittype_splash);
settouch(gren, W_Mortar_Grenade_Touch2);
gren.takedamage = DAMAGE_YES;
- SetResourceAmountExplicit(gren, RESOURCE_HEALTH, WEP_CVAR_SEC(mortar, health));
+ SetResourceExplicit(gren, RES_HEALTH, WEP_CVAR_SEC(mortar, health));
gren.damageforcescale = WEP_CVAR_SEC(mortar, damageforcescale);
gren.event_damage = W_Mortar_Grenade_Damage;
gren.damagedbycontents = true;
PHYS_INPUT_BUTTON_ATCK2(actor) = false;
if(actor.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH
{
- if(bot_aim(actor, weaponentity, WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true))
+ if(bot_aim(actor, weaponentity, WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true, true))
{
PHYS_INPUT_BUTTON_ATCK(actor) = true;
if(random() < 0.01) actor.bot_secondary_grenademooth = 1;
}
else
{
- if(bot_aim(actor, weaponentity, WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true))
+ if(bot_aim(actor, weaponentity, WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true, true))
{
PHYS_INPUT_BUTTON_ATCK2(actor) = true;
if(random() < 0.02) actor.bot_secondary_grenademooth = 0;
}
METHOD(Mortar, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
{
- float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(mortar, ammo);
+ float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(mortar, ammo);
ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
return ammo_amount;
}
METHOD(Mortar, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
{
- float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(mortar, ammo);
+ float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(mortar, ammo);
ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
return ammo_amount;
}
METHOD(Mortar, wr_impacteffect, void(entity thiswep, entity actor))
{
- vector org2;
- org2 = w_org + w_backoff * 12;
+ vector org2 = w_org + w_backoff * 2;
pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1);
if(!w_issilent)
sound(actor, CH_SHOTS, SND_GRENADE_IMPACT, VOL_BASE, ATTN_NORM);