X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fshotgun.qc;h=8faac3d5d03d7e2a4f2dd8f98e9303a572a36ea5;hp=a3f9c111a8bbb71792158331cf547e7dc24d15f8;hb=62d736d8c3a51baf5fa3a4265e39a2b773704a91;hpb=820589b53e6802eb4c5ea563bb58d48c4f4aa9e1 diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index a3f9c111a..8faac3d5d 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -2,13 +2,13 @@ #ifdef SVQC -void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, float isprimary, float ammocount, float damage, float bullets, float spread, float solidpenetration, float force) +void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, float isprimary, float ammocount, float damage, float bullets, float spread, float solidpenetration, float force, entity bullet_trail_effect) { W_DecreaseAmmo(thiswep, actor, ammocount, weaponentity); - W_SetupShot(actor, weaponentity, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), damage * bullets); + W_SetupShot(actor, weaponentity, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), damage * bullets, thiswep.m_id); for(int sc = 0;sc < bullets;sc = sc + 1) - fireBullet(actor, weaponentity, w_shotorg, w_shotdir, spread, solidpenetration, damage, force, WEP_SHOTGUN.m_id, 0); + fireBullet(actor, weaponentity, w_shotorg, w_shotdir, spread, solidpenetration, damage, force, thiswep.m_id, bullet_trail_effect); Send_Effect(EFFECT_SHOTGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, ammocount); @@ -68,7 +68,7 @@ void W_Shotgun_Melee_Think(entity this) + (v_up * swing_factor * WEP_CVAR_SEC(shotgun, melee_swing_up)) + (v_right * swing_factor * WEP_CVAR_SEC(shotgun, melee_swing_side))); - WarpZone_traceline_antilag(this, this.realowner.origin + this.realowner.view_ofs, targpos, false, this.realowner, ((IS_CLIENT(this.realowner)) ? ANTILAG_LATENCY(this.realowner) : 0)); + WarpZone_traceline_antilag(this.realowner, this.realowner.origin + this.realowner.view_ofs, targpos, false, this.realowner, ((IS_CLIENT(this.realowner)) ? ANTILAG_LATENCY(this.realowner) : 0)); // draw lightning beams for debugging //te_lightning2(NULL, targpos, this.realowner.origin + this.realowner.view_ofs + v_forward * 5 - v_up * 5); @@ -77,7 +77,7 @@ void W_Shotgun_Melee_Think(entity this) is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || IS_MONSTER(trace_ent)); if((trace_fraction < 1) // if trace is good, apply the damage and remove this - && (trace_ent.takedamage == DAMAGE_AIM) + && (trace_ent.takedamage != DAMAGE_NO) && (trace_ent != this.swing_alreadyhit) && (is_player || WEP_CVAR_SEC(shotgun, melee_nonplayerdamage))) { @@ -91,11 +91,11 @@ void W_Shotgun_Melee_Think(entity this) //print(strcat(this.realowner.netname, " hitting ", target_victim.netname, " with ", strcat(ftos(swing_damage), " damage (factor: ", ftos(swing_factor), ") at "), ftos(time), " seconds.\n")); Damage(target_victim, this.realowner, this.realowner, - swing_damage, WEP_SHOTGUN.m_id | HITTYPE_SECONDARY, + swing_damage, WEP_SHOTGUN.m_id | HITTYPE_SECONDARY, this.weaponentity_fld, this.realowner.origin + this.realowner.view_ofs, v_forward * WEP_CVAR_SEC(shotgun, force)); - if(accuracy_isgooddamage(this.realowner, target_victim)) { accuracy_add(this.realowner, WEP_SHOTGUN.m_id, 0, swing_damage); } + if(accuracy_isgooddamage(this.realowner, target_victim)) { accuracy_add(this.realowner, WEP_SHOTGUN, 0, swing_damage); } // draw large red flash for debugging //te_customflash(targpos, 200, 2, '15 0 0'); @@ -136,7 +136,8 @@ void W_Shotgun_Attack2(Weapon thiswep, entity actor, .entity weaponentity, int f meleetemp.realowner = actor; setthink(meleetemp, W_Shotgun_Melee_Think); meleetemp.nextthink = time + WEP_CVAR_SEC(shotgun, melee_delay) * W_WeaponRateFactor(actor); - W_SetupShot_Range(actor, weaponentity, true, 0, SND_Null, 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range)); + meleetemp.weaponentity_fld = weaponentity; + W_SetupShot_Range(actor, weaponentity, true, 0, SND_Null, 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range), WEP_SHOTGUN.m_id | HITTYPE_SECONDARY); } // alternate secondary weapon frames @@ -151,13 +152,14 @@ void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, .entity weaponentity } sound(actor, CH_WEAPON_SINGLE, SND_Null, VOL_BASE, ATTN_NORM); // kill previous sound - W_Shotgun_Attack(WEP_SHOTGUN, actor, weaponentity, true, + W_Shotgun_Attack(thiswep, actor, weaponentity, true, WEP_CVAR_PRI(shotgun, ammo), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, bullets), WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), - WEP_CVAR_PRI(shotgun, force)); // actually is secondary, but we trick the last shot into playing full reload sound + WEP_CVAR_PRI(shotgun, force), + EFFECT_BULLET_WEAK); // actually is secondary, but we trick the last shot into playing full reload sound weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready); } void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity, int fire) @@ -170,13 +172,14 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity return; } - W_Shotgun_Attack(WEP_SHOTGUN, actor, weaponentity, false, + W_Shotgun_Attack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(shotgun, ammo), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, bullets), WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), - WEP_CVAR_PRI(shotgun, force)); + WEP_CVAR_PRI(shotgun, force), + EFFECT_BULLET_WEAK); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame2); } @@ -213,7 +216,8 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit WEP_CVAR_PRI(shotgun, bullets), WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), - WEP_CVAR_PRI(shotgun, force)); + WEP_CVAR_PRI(shotgun, force), + EFFECT_BULLET_WEAK); actor.(weaponentity).shotgun_primarytime = time + WEP_CVAR_PRI(shotgun, refire) * W_WeaponRateFactor(actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(shotgun, animtime), w_ready); } @@ -231,7 +235,8 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit WEP_CVAR_PRI(shotgun, bullets), WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), - WEP_CVAR_PRI(shotgun, force)); + WEP_CVAR_PRI(shotgun, force), + EFFECT_BULLET_WEAK); actor.(weaponentity).shotgun_primarytime = time + WEP_CVAR_SEC(shotgun, alt_refire) * W_WeaponRateFactor(actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), W_Shotgun_Attack3_Frame1); } @@ -250,7 +255,7 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit METHOD(Shotgun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(shotgun, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(shotgun, ammo); return ammo_amount; } METHOD(Shotgun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) @@ -264,7 +269,7 @@ METHOD(Shotgun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapon case 2: // secondary triple shot { float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(shotgun, ammo); - ammo_amount += actor.(weaponentity).(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo); + ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(shotgun, ammo); return ammo_amount; } default: return false; // secondary unavailable