Updated Damage_Apply and TraceAttack functions to cache which weapon was

used to attack.

Also a few more weapon fixes. When will it ever be done???
This commit is contained in:
Marco Cawthorne 2019-09-17 02:29:00 +02:00
parent f5e46fa15f
commit 18fda226f6
59 changed files with 262 additions and 207 deletions

View File

@ -345,7 +345,7 @@ HUD_DrawLogo(void)
drawpic(
pos,
sprintf("sprites/640_logo.spr_%i.tga", f),
[256, 48],
[256,48],
[1,1,1],
1.0f,
DRAWFLAG_ADDITIVE

View File

@ -14,7 +14,7 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#define GS_DEVELOPER
//#define GS_DEVELOPER
.float gflags;

View File

@ -157,10 +157,10 @@ void func_breakable::PlayerTouch(void)
if (fDamage >= health) {
touch = __NULL__;
Damage_Apply(this, other, fDamage, absmin, FALSE);
Damage_Apply(this, other, fDamage, absmin, FALSE, 0);
if ((m_iMaterial == MATERIAL_GLASS) || (m_iMaterial == MATERIAL_COMPUTER)) {
Damage_Apply(other, this, fDamage / 4, other.origin, FALSE);
Damage_Apply(other, this, fDamage / 4, other.origin, FALSE, 0);
}
}
}

View File

@ -238,7 +238,7 @@ void func_door_rotating::Touch(void)
void func_door_rotating::Blocked(void)
{
if (m_iDamage) {
Damage_Apply(other, this, m_iDamage, other.origin, FALSE);
Damage_Apply(other, this, m_iDamage, other.origin, FALSE, 0);
}
if (m_flWait >= 0) {

View File

@ -72,7 +72,7 @@ void func_rotating :: Blocked ( void )
}
if (other.takedamage == DAMAGE_YES) {
Damage_Apply(other, this, m_flDamage, other.origin, TRUE);
Damage_Apply(other, this, m_flDamage, other.origin, TRUE, 0);
}
}

View File

@ -89,7 +89,7 @@ class func_train:CBaseTrigger
void
func_train::Blocked(void)
{
Damage_Apply(other, this, m_flDamage, other.origin, TRUE);
Damage_Apply(other, this, m_flDamage, other.origin, TRUE, 0);
}
void

View File

@ -53,6 +53,7 @@ void infodecal(void)
int i = 0;
int b = 0;
float frac = 1.0f;
vector endpos = [0,0,0];
vector vpos = self.origin;
if (serverkeyfloat("*bspversion") != 30) {
@ -113,6 +114,7 @@ void infodecal(void)
for (i = 0; i < 6; i++) {
if ( tmp[i].fraction < frac ) {
frac = tmp[i].fraction;
endpos = tmp[i].endpos;
b = i;
}
}
@ -126,6 +128,11 @@ void infodecal(void)
return;
}
/* FIXME: more universal check? */
if (getsurfacetexture(trace_ent, getsurfacenearpoint(trace_ent, endpos)) == "sky") {
return;
}
makevectors(vectoangles(tmp[b].endpos - self.origin ));
vector cpl = v_forward - (v_forward * tmp[b].normal) * tmp[b].normal;

View File

@ -41,7 +41,7 @@ void item_food :: Touch ( void )
bevOwner.m_iReady = TRUE;
}
Damage_Apply(other, this, -1, other.origin, FALSE);
Damage_Apply(other, this, -1, other.origin, FALSE, 0);
solid = SOLID_NOT;
remove( this );
}

View File

@ -94,7 +94,7 @@ void trigger_hurt::Touch(void)
}
}
Damage_Apply(other, this, m_iDamage, other.origin, FALSE);
Damage_Apply(other, this, m_iDamage, other.origin, FALSE, 0);
// Shut it down if used once
if (spawnflags & SF_HURT_ONCE) {

View File

@ -35,7 +35,7 @@ Suicide command 'kill' executes this function.
*/
void Game_ClientKill(void)
{
Damage_Apply(self, self, self.health, self.origin, TRUE);
Damage_Apply(self, self, self.health, self.origin, TRUE, 0);
}
/*

View File

@ -97,7 +97,7 @@ Damage_Apply
Generic function that applies damage, pain and suffering
=================
*/
void Damage_Apply(entity eTarget, entity eAttacker, float iDamage, vector vHitPos, int iSkipArmor)
void Damage_Apply(entity eTarget, entity eAttacker, float iDamage, vector vHitPos, int iSkipArmor, int iWeapon)
{
if (eTarget.flags & FL_GODMODE) {
return;
@ -278,7 +278,7 @@ Damage_Radius(vector org, entity attacker, float dmg, float radius, int check)
new_dmg = rint(dmg * diff);
if (diff > 0) {
Damage_Apply(e, attacker, new_dmg, pos, 0);
Damage_Apply(e, attacker, new_dmg, pos, FALSE, 0);
/* approximate, feel free to tweak */
if (e.movetype == MOVETYPE_WALK) {

View File

@ -109,6 +109,6 @@ void Ammo_BuySecondary(void);
void Animation_PlayerTop(float fFrame);
void Animation_PlayerTopTemp(float fFrame, float fTime);
void Damage_Apply(entity eTarget, entity eAttacker, float iDamage, vector vHitPos, int iSkipArmor);
void Damage_Apply(entity, entity, float, vector, int, int);
#define NULL __NULL__

View File

@ -24,9 +24,9 @@ void Effect_CreateExplosion( vector vPos );
void Effect_GibHuman( vector vPos);
void Footsteps_Update( void );
void Vox_Broadcast(string sMessage);
void TraceAttack_FireBullets( int iShots, vector vPos, int iDamage, vector vecAccuracy);
void TraceAttack_FireBullets(int , vector, int, vector, int);
void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadius, int iCheckClip );
void Damage_Apply( entity eTarget, entity eAttacker, float fDamage, vector vHitPos, int iSkipArmor );
void Damage_Apply( entity, entity, float, vector, int, int);
void Client_TriggerCamera( entity eTarget, vector vPos, vector vEndPos, float fResetTime );
void Game_Input(void);

View File

@ -144,7 +144,7 @@ Nodes_Init(void)
dprint("[^2NODES^7] Rebuilding node tree...");
/* run through the ents and rebuild the tree */
for (entity a = world; a = find(a, ::classname, "info_node");) {
for (entity a = world; (a = find(a, ::classname, "info_node"));) {
int iID = g_iNodes++;
g_pNodes = memrealloc(g_pNodes, sizeof(node_t), iID, g_iNodes);
node_t *n = g_pNodes + iID;

View File

@ -58,7 +58,7 @@ Game_ClientDisconnect(void)
void
Game_ClientKill(void)
{
Damage_Apply(self, self, self.health, self.origin, TRUE);
Damage_Apply(self, self, self.health, self.origin, TRUE, 0);
}
void

View File

@ -47,7 +47,7 @@ void Game_ClientDisconnect(void)
void Game_ClientKill(void)
{
Damage_Apply(self, self, self.health, self.origin, TRUE);
Damage_Apply(self, self, self.health, self.origin, TRUE, 0);
}
void Game_PlayerPreThink(void)
{

View File

@ -58,7 +58,7 @@ Game_ClientDisconnect(void)
void
Game_ClientKill(void)
{
Damage_Apply(self, self, self.health, self.origin, TRUE);
Damage_Apply(self, self, self.health, self.origin, TRUE, 0);
}
void

View File

@ -24,7 +24,7 @@
/* cast a single bullet shot */
void
TraceAttack_FireSingle(vector vPos, vector vAngle, int iDamage)
TraceAttack_FireSingle(vector vPos, vector vAngle, int iDamage, int iWeapon)
{
string tex;
vector range;
@ -70,7 +70,7 @@ TraceAttack_FireSingle(vector vPos, vector vAngle, int iDamage)
iDamage *= 3;
}
#endif
Damage_Apply(trace_ent, self, iDamage, trace_endpos, FALSE);
Damage_Apply(trace_ent, self, iDamage, trace_endpos, FALSE, iWeapon);
}
if (trace_ent.iBleeds == TRUE) {
@ -110,14 +110,14 @@ TraceAttack_FireSingle(vector vPos, vector vAngle, int iDamage)
#ifdef PENETRATION
if (iTotalPenetrations > 0) {
iTotalPenetrations -= 1;
TraceAttack_FireSingle(trace_endpos + (v_forward * 2), vAngle, iDamage);
TraceAttack_FireSingle(trace_endpos + (v_forward * 2), vAngle, iDamage, iWeapon);
}
#endif
}
/* fire a given amount of shots */
void
TraceAttack_FireBullets(int iShots, vector vPos, int iDamage, vector vecSpread)
TraceAttack_FireBullets(int iShots, vector vPos, int iDamage, vector vecSpread, int iWeapon)
{
vector vDir;
makevectors(self.v_angle);
@ -129,7 +129,7 @@ TraceAttack_FireBullets(int iShots, vector vPos, int iDamage, vector vecSpread)
vDir = aim(self, 100000);
vDir += Math_CRandom() * vecSpread[0] * v_right;
vDir += Math_CRandom() * vecSpread[1] * v_up;
TraceAttack_FireSingle(vPos, vDir, iDamage);
TraceAttack_FireSingle(vPos, vDir, iDamage, iWeapon);
iShots--;
}
}

View File

@ -54,7 +54,7 @@ Game_ClientDisconnect(void)
void
Game_ClientKill(void)
{
Damage_Apply(self, self, self.health, self.origin, TRUE);
Damage_Apply(self, self, self.health, self.origin, TRUE, WEAPON_NONE);
}
void
@ -162,6 +162,42 @@ Game_RunClientCommand(void)
QPhysics_Run(self);
}
void
Game_SetNewParms(void)
{
parm1 =
parm2 =
parm3 =
parm4 =
parm5 =
parm6 =
parm7 =
parm8 =
parm9 =
parm10 =
parm11 =
parm12 =
parm13 =
parm14 =
parm15 =
parm16 =
parm17 =
parm18 =
parm19 =
parm20 =
parm21 =
parm22 =
parm23 =
parm24 =
parm25 =
parm26 =
parm27 =
parm28 =
parm29 =
parm30 = 0;
}
void
Game_DecodeChangeParms(void)
{
@ -204,6 +240,7 @@ void
Game_SetChangeParms(void)
{
player pl = (player)self;
parm1 = g_landmarkpos[0];
parm2 = g_landmarkpos[1];
parm3 = g_landmarkpos[2];
@ -215,7 +252,6 @@ Game_SetChangeParms(void)
parm9 = pl.velocity[2];
parm10 = pl.g_items;
parm11 = pl.activeweapon;
parm12 = pl.ammo_9mm;
parm13 = pl.ammo_357;
parm14 = pl.ammo_buckshot;
@ -228,7 +264,6 @@ Game_SetChangeParms(void)
parm21 = pl.ammo_tripmine;
parm22 = pl.ammo_snark;
parm23 = pl.ammo_hornet;
parm24 = pl.glock_mag;
parm25 = pl.mp5_mag;
parm26 = pl.python_mag;
@ -356,9 +391,3 @@ Game_ParseClientCommand(string cmd)
clientcommand(self, cmd);
}
void
Game_SetNewParms(void)
{
}

View File

@ -16,12 +16,12 @@
/* someone dieded */
void
Damage_Obituary(entity eCulprit, entity eTarget, float weapon, float flags)
Damage_Obituary(entity c, entity t, float weapon, float flags)
{
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EV_OBITUARY);
WriteString(MSG_MULTICAST, eCulprit.netname);
WriteString(MSG_MULTICAST, eTarget.netname);
WriteString(MSG_MULTICAST, c.netname);
WriteString(MSG_MULTICAST, t.netname);
WriteByte(MSG_MULTICAST, weapon);
WriteByte(MSG_MULTICAST, flags);
msg_entity = self;
@ -30,70 +30,63 @@ Damage_Obituary(entity eCulprit, entity eTarget, float weapon, float flags)
/* generic function that applies damage, pain and suffering */
void
Damage_Apply(entity eTarget, entity eCulprit, float fDmg, vector pos, int a)
Damage_Apply(entity t, entity c, float dmg, vector pos, int a, int w)
{
if (eTarget.flags & FL_GODMODE) {
if (t.flags & FL_GODMODE) {
return;
}
/* skip armor */
if (!a)
if (eTarget.armor && fDmg > 0) {
if (t.armor && dmg > 0) {
float flArmor;
float flNewDamage;
flNewDamage = fDmg * 0.2;
flArmor = (fDmg - flNewDamage) * 0.5;
flNewDamage = dmg * 0.2;
flArmor = (dmg - flNewDamage) * 0.5;
if (flArmor > eTarget.armor) {
flArmor = eTarget.armor;
if (flArmor > t.armor) {
flArmor = t.armor;
flArmor *= (1/0.5);
flNewDamage = fDmg - flArmor;
eTarget.armor = 0;
flNewDamage = dmg - flArmor;
t.armor = 0;
} else {
eTarget.armor -= flArmor;
t.armor -= flArmor;
}
fDmg = flNewDamage;
dmg = flNewDamage;
}
fDmg = rint(fDmg);
eTarget.health -= fDmg;
dmg = rint(dmg);
t.health -= dmg;
if (fDmg > 0) {
eTarget.dmg_take = fDmg;
eTarget.dmg_inflictor = eCulprit;
} else if (eTarget.max_health && eTarget.health > eTarget.max_health) {
eTarget.health = eTarget.max_health;
if (dmg > 0) {
t.dmg_take = dmg;
t.dmg_inflictor = c;
} else if (t.max_health && t.health > t.max_health) {
t.health = t.max_health;
}
// Target is dead and a client....
if (eTarget.health <= 0) {
if (eTarget.flags & FL_CLIENT) {
eTarget.deaths++;
forceinfokey(eTarget, "*deaths", ftos(eTarget.deaths));
if (t.health <= 0) {
if (t.flags & FL_CLIENT) {
t.deaths++;
forceinfokey(t, "*deaths", ftos(t.deaths));
}
if (eTarget.flags & FL_CLIENT || eTarget.flags & FL_MONSTER)
if (eCulprit.flags & FL_CLIENT)
if (eTarget == eCulprit)
eCulprit.frags--;
if (t.flags & FL_CLIENT || t.flags & FL_MONSTER)
if (c.flags & FL_CLIENT)
if (t == c)
c.frags--;
else
eCulprit.frags++;
c.frags++;
}
entity eOld = self;
self = eTarget;
self = t;
if (self.health <= 0) {
if (eTarget.flags & FL_MONSTER || eTarget.flags & FL_CLIENT) {
float w = 0;
/* FIXME: this is unreliable. the culprit might have
* already switched weapons. FIX THIS */
if (eCulprit.flags & FL_CLIENT) {
player pl = (player)eCulprit;
w = pl.activeweapon;
}
Damage_Obituary(eCulprit, eTarget, w, 0);
if (t.flags & FL_MONSTER || t.flags & FL_CLIENT) {
Damage_Obituary(c, t, w, 0);
}
self.vDeath(trace_surface_id);
} else {
@ -105,30 +98,30 @@ Damage_Apply(entity eTarget, entity eCulprit, float fDmg, vector pos, int a)
/* physical check of whether or not we can trace important parts of an ent */
float
Damage_CheckTrace(entity eTarget, vector vecHitPos)
Damage_CheckTrace(entity t, vector vecHitPos)
{
/* We're lazy. Who cares */
if (eTarget.solid == SOLID_BSP) {
if (t.solid == SOLID_BSP) {
return TRUE;
}
traceline(vecHitPos, eTarget.origin, 1, self);
traceline(vecHitPos, t.origin, 1, self);
if (trace_fraction == 1) {
return TRUE;
}
traceline(vecHitPos, eTarget.origin + [15,15,0], 1, self);
traceline(vecHitPos, t.origin + [15,15,0], 1, self);
if (trace_fraction == 1) {
return TRUE;
}
traceline(vecHitPos, eTarget.origin + [-15,-15,0], 1, self);
traceline(vecHitPos, t.origin + [-15,-15,0], 1, self);
if (trace_fraction == 1) {
return TRUE;
}
traceline(vecHitPos, eTarget.origin + [-15,15,0], 1, self);
traceline(vecHitPos, t.origin + [-15,15,0], 1, self);
if (trace_fraction == 1) {
return TRUE;
}
traceline(vecHitPos, eTarget.origin + [15,-15,0], 1, self);
traceline(vecHitPos, t.origin + [15,-15,0], 1, self);
if (trace_fraction == 1) {
return TRUE;
}
@ -169,7 +162,7 @@ Damage_Radius(vector org, entity attacker, float dmg, float radius, int check)
new_dmg = rint(dmg * diff);
if (diff > 0) {
Damage_Apply(e, attacker, new_dmg, pos, 0);
Damage_Apply(e, attacker, new_dmg, pos, FALSE, 0);
/* approximate, feel free to tweak */
if (e.movetype == MOVETYPE_WALK) {

View File

@ -14,4 +14,4 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
void Damage_Apply(entity, entity, float, vector, int);
void Damage_Apply(entity, entity, float, vector, int, int);

View File

@ -30,7 +30,7 @@ void item_healthkit::touch(void)
if (other.health >= other.max_health) {
return;
}
Damage_Apply(other, this, -20, this.origin, TRUE);
Damage_Apply(other, this, -20, this.origin, TRUE, 0);
sound(this, CHAN_ITEM, "items/smallmedkit1.wav", 1, ATTN_NORM);
Logging_Pickup(other, this, __NULL__);

View File

@ -141,7 +141,7 @@ float BaseGun_PrimaryFire( void ) {
BaseGun_ShotMultiplierHandle( wptTable[ self.weapon ].iBullets );
BaseGun_AccuracyCalc();
TraceAttack_FireBullets( wptTable[ self.weapon ].iBullets, ( self.origin + self.view_ofs ), wptTable[self.weapon].iDamage, [self.fAccuracy, self.fAccuracy] );
TraceAttack_FireBullets( wptTable[ self.weapon ].iBullets, ( self.origin + self.view_ofs), wptTable[self.weapon].iDamage, [self.fAccuracy, self.fAccuracy], self.weapon);
Animation_ShootWeapon( self );
self.(wptTable[ self.weapon ].iMagfld) -= 1;

View File

@ -41,7 +41,7 @@ int BaseMelee_Attack( void ) {
Effect_Impact( IMPACT_FLESH, trace_endpos, trace_plane_normal );
sound( self, CHAN_WEAPON, sprintf( "weapons/knife_hit%d.wav", floor( ( random() * 4 ) + 1 ) ), 1, ATTN_NORM );
}
Damage_Apply( trace_ent, self, wptTable[ self.weapon ].iDamage, trace_endpos, FALSE );
Damage_Apply( trace_ent, self, wptTable[ self.weapon ].iDamage, trace_endpos, FALSE, self.weapon);
} else {
Effect_Impact( IMPACT_MELEE, trace_endpos, trace_plane_normal );
}

View File

@ -124,7 +124,7 @@ void WeaponFLASHBANG_Throw( void ) {
return;
}
if ( other.classname == "func_breakable" ) {
Damage_Apply( other, self, 50, self.origin, FALSE );
Damage_Apply( other, self, 50, self.origin, FALSE, 0);
}
sound( self, CHAN_WEAPON, sprintf( "weapons/grenade_hit%d.wav", floor( random() * 3 ) + 1 ), 1, ATTN_NORM );
}

View File

@ -94,7 +94,7 @@ void WeaponGLOCK18_PrimaryFire( void ) {
if ( self.iMag_GLOCK18 ) {
BaseGun_ShotMultiplierHandle( 1 );
BaseGun_AccuracyCalc();
TraceAttack_FireBullets( 1, ( self.origin + self.view_ofs ), 25, [self.fAccuracy,self.fAccuracy]);
TraceAttack_FireBullets( 1, ( self.origin + self.view_ofs ), 25, [self.fAccuracy,self.fAccuracy], WEAPON_GLOCK18);
self.iMag_GLOCK18 -= 1;
}
}

View File

@ -105,7 +105,7 @@ void WeaponHEGRENADE_Throw( void ) {
return;
}
if ( ( other.classname == "func_breakable" ) && ( other.material == MATERIAL_GLASS ) ) {
Damage_Apply( other, self, other.health, self.origin, FALSE );
Damage_Apply( other, self, other.health, self.origin, FALSE, WEAPON_HEGRENADE);
}
sound( self, CHAN_WEAPON, "weapons/he_bounce-1.wav", 1, ATTN_NORM );

View File

@ -114,7 +114,7 @@ void WeaponSMOKEGRENADE_Throw( void ) {
return;
}
if ( other.classname == "func_breakable" ) {
Damage_Apply( other, self, 50, self.origin, FALSE );
Damage_Apply( other, self, 50, self.origin, FALSE, 0);
self.velocity = Caliber_Reflect( self.velocity, trace_plane_normal );
}
sound( self, CHAN_WEAPON, sprintf( "weapons/grenade_hit%d.wav", floor( random() * 3 ) + 1 ), 1, ATTN_NORM );

View File

@ -148,12 +148,12 @@ w_eagle_primary(void)
/* Actual firing */
if (pl.a_ammo3 == 1) {
#ifdef SSQC
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 34, [0, 0]);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 34, [0, 0], WEAPON_EAGLE);
#endif
pl.w_attack_next = 0.5f;
} else {
#ifdef SSQC
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 34, [0.1,0.1]);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 34, [0.1,0.1], WEAPON_EAGLE);
#endif
pl.w_attack_next = 0.2f;
}

View File

@ -147,7 +147,7 @@ w_grapple_primary(void)
vector src = Weapons_GetCameraPos();
traceline(src, src + (v_forward * 32), FALSE, pl);
if (trace_ent.takedamage == DAMAGE_YES && trace_ent.iBleeds) {
Damage_Apply(trace_ent, pl, 25, trace_endpos, FALSE);
Damage_Apply(trace_ent, pl, 25, trace_endpos, FALSE, WEAPON_GRAPPLE);
}
#endif
pl.w_attack_next = 0.5f;

View File

@ -151,7 +151,7 @@ w_knife_primary(void)
}
if (trace_ent.takedamage) {
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE );
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE, WEAPON_KNIFE);
if (!trace_ent.iBleeds) {
return;

View File

@ -162,7 +162,7 @@ w_m249_primary(void)
View_SetMuzzleflash(MUZZLE_RIFLE);
Weapons_ViewPunchAngle([-5,0,0]);
#else
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 8, [0.052,0.052]);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 8, [0.052,0.052], WEAPON_M249);
int r = (float)input_sequence % 3;
switch (r) {

View File

@ -107,7 +107,7 @@ penguin_ai(void)
self.weapon = 0.5f + random();
penguin_squeak(self);
input_buttons = 2;
Damage_Apply(self, world, 1, self.origin, TRUE);
Damage_Apply(self, world, 1, self.origin, TRUE, 0);
makevectors(self.angles);
traceline(self.origin, self.origin + (v_forward * 128), 0, self);
@ -115,7 +115,7 @@ penguin_ai(void)
if (trace_ent.takedamage == DAMAGE_YES) {
float pit = 100 + random(0,10);
sound(self, CHAN_BODY, "squeek/sqk_deploy1.wav", 1.0, ATTN_NORM, pit);
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE);
Damage_Apply(trace_ent, self.goalentity, 10, trace_endpos, FALSE, WEAPON_PENGUIN);
}
if (self.aiment.health <= 0) {
@ -157,6 +157,7 @@ w_penguin_deploy(void)
{
entity pingu = spawn();
pingu.owner = self;
pingu.goalentity = self;
pingu.netname = "Penguin";
pingu.classname = "snark"; /* so snarks and pingus don't attack e/o */
setmodel(pingu, "models/w_penguin.mdl");

View File

@ -57,7 +57,7 @@ void
w_pipewrench_updateammo(player pl)
{
#ifdef SSQC
Weapons_UpdateAmmo(pl, __NULL__, __NULL__, __NULL__);
Weapons_UpdateAmmo(pl, -1, -1, -1);
#endif
}
@ -104,7 +104,7 @@ w_pipewrench_primary(void)
}
Weapons_MakeVectors();
src = pl.origin + pl.view_ofs;
src = Weapons_GetCameraPos();
traceline(src, src + (v_forward * 32), FALSE, pl);
if (trace_fraction >= 1.0) {
@ -148,7 +148,7 @@ w_pipewrench_primary(void)
}
if (trace_ent.takedamage) {
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE );
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE, WEAPON_PIPEWRENCH);
if (!trace_ent.iBleeds) {
return;
@ -193,36 +193,42 @@ w_pipewrench_release(void)
vector src;
player pl = (player)self;
if (pl.w_attack_next > 0.0f) {
if (pl.w_attack_next > 0.0) {
return;
}
src = pl.origin + pl.view_ofs;
Weapons_MakeVectors();
traceline(src, src + v_forward * 64, FALSE, self);
if (pl.a_ammo1 == 1) {
#ifdef SSQC
int hitsound = 0;
string snd;
#endif
/* attack! */
Weapons_MakeVectors();
src = Weapons_GetCameraPos();
traceline(src, src + (v_forward * 64), FALSE, pl);
if (trace_fraction < 1.0) {
#ifdef SSQC
if (trace_ent.takedamage == DAMAGE_YES) {
hitsound = floor(random(1, 2));
/* TODO Damage is 45 - 200+ (?) */
Damage_Apply(trace_ent, self, 200, trace_endpos, FALSE);
}
else {
Damage_Apply(trace_ent, pl, 200, trace_endpos, FALSE, WEAPON_PIPEWRENCH);
} else {
hitsound = 3;
}
/* don't bother with decals, we got squibs */
if (trace_ent.iBleeds) {
Effect_CreateBlood(trace_endpos, [0,0,0]);
} else {
Effect_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal);
}
#endif
Weapons_ViewAnimation(PIPE_ATTACKBIGHIT);
Weapons_ViewPunchAngle([-10,0,0]);
} else {
Weapons_ViewAnimation(PIPE_ATTACKBIGMISS);
}
#ifdef SSQC
snd = "weapons/pwrench_big_miss.wav";
switch (hitsound) {
@ -244,7 +250,7 @@ w_pipewrench_release(void)
}
/* Pure cosmetics start here */
if (pl.w_idle_next) {
if (pl.w_idle_next > 0.0) {
return;
}
@ -313,7 +319,7 @@ weapon_t w_pipewrench =
.holster = w_pipewrench_holster,
.primary = w_pipewrench_primary,
.secondary = w_pipewrench_secondary,
.reload = __NULL__,
.reload = w_pipewrench_release,
.release = w_pipewrench_release,
.crosshair = __NULL__,
.precache = w_pipewrench_precache,

View File

@ -14,6 +14,10 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef CSQC
var int PART_SHOCKPIECE;
#endif
enum
{
SHOCKRIFLE_IDLE1,
@ -35,6 +39,10 @@ w_shockrifle_precache(void)
precache_sound("weapons/shock_fire.wav");
precache_sound("weapons/shock_impact.wav");
precache_sound("weapons/shock_recharge.wav");
#ifdef CSQC
PART_SHOCKPIECE = particleeffectnum("shockrifle.shockrifle_piece");
#endif
}
int
@ -101,8 +109,13 @@ w_shockrifle_shoothornet(void)
{
static void Hornet_Touch(void) {
if (other.takedamage == DAMAGE_YES) {
Damage_Apply(other, self.owner, 10, trace_endpos, FALSE);
Damage_Apply(other, self.owner, 10, trace_endpos, FALSE, WEAPON_SHOCKRIFLE);
}
if (other.iBleeds) {
Effect_CreateBlood(trace_endpos, [0,0,0]);
} else {
Effect_CreateSpark(self.origin, trace_plane_normal);
}
remove(self);
}
@ -153,6 +166,7 @@ w_shockrifle_release(void)
} else {
Weapons_ViewAnimation(SHOCKRIFLE_IDLE2);
}
pl.w_idle_next = 3.333333f;
}
@ -185,6 +199,9 @@ w_shockrifle_primary(void)
pl.ammo_shock--;
Weapons_UpdateAmmo(pl, -1, pl.ammo_shock, -1);
#else
Weapons_MakeVectors();
vector src = Weapons_GetCameraPos() + (v_forward * 16) + (v_up * -8);
pointparticles(PART_SHOCKPIECE, src, v_forward * 1000, 1);
pl.a_ammo2--;
#endif
@ -278,8 +295,8 @@ weapon_t w_shockrifle =
.draw = w_shockrifle_draw,
.holster = w_shockrifle_holster,
.primary = w_shockrifle_primary,
.secondary = __NULL__,
.reload = __NULL__,
.secondary = w_shockrifle_release,
.reload = w_shockrifle_release,
.release = w_shockrifle_release,
.crosshair = w_shockrifle_crosshair,
.precache = w_shockrifle_precache,

View File

@ -120,7 +120,7 @@ w_sniperrifle_primary(void)
/* Actual firing */
#ifdef SSQC
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 40, [0.00873, 0.00873]);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 40, [0.00873, 0.00873], WEAPON_SNIPERRIFLE);
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/sniper_fire.wav", 1, ATTN_NORM);
pl.sniper_mag--;
@ -213,9 +213,9 @@ w_sniperrifle_crosshair(void)
#ifdef CSQC
player pl = (player)self;
static vector cross_pos;
if (pl.viewzoom == 1.0f) {
cross_pos = (video_res / 2) + [-12,-12];
cross_pos = video_mins + (video_res / 2) + [-12,-12];
drawsubpic(
cross_pos,
[24,24],
@ -227,7 +227,7 @@ w_sniperrifle_crosshair(void)
DRAWFLAG_NORMAL
);
} else {
cross_pos = (video_res / 2) + [-128,-128];
cross_pos = video_mins + (video_res / 2) + [-128,-128];
drawsubpic(
cross_pos,
[256,256],

View File

@ -131,7 +131,7 @@ w_sporelauncher_primary(void)
string hitsnd;
if (other.takedamage == DAMAGE_YES) {
Damage_Apply(other, self.owner, 50, trace_endpos, FALSE);
Damage_Apply(other, self.owner, 50, trace_endpos, FALSE, WEAPON_SPORELAUNCHER);
}
r = floor(random(0,3));

View File

@ -106,7 +106,7 @@ void QPhysics_Run ( entity eTarget )
if ( ( self.flags & FL_ONGROUND ) && self.movetype == MOVETYPE_WALK && ( flFallVel > 580 )) {
float fFallDamage = ( flFallVel - 580 ) * ( 100 / ( 1024 - 580 ) );
Damage_Apply( self, world, fFallDamage, self.origin, FALSE );
Damage_Apply( self, world, fFallDamage, self.origin, FALSE, 0);
sound(self, CHAN_AUTO, "player/pl_fallpain3.wav", 1.0, ATTN_NORM);
}
#endif

View File

@ -135,7 +135,7 @@ void w_cannon_primary(void)
return;
}
TraceAttack_FireBullets(20, pl.origin + pl.view_ofs, 5, [0.08716,0.04362]);
TraceAttack_FireBullets(20, pl.origin + pl.view_ofs, 5, [0.08716,0.04362], WEAPON_CANNON);
pl.cannon_mag -= 2;
Weapons_PlaySound(pl, CHAN_WEAPON, "cannon/fire.wav", 1, ATTN_NORM);
Weapons_UpdateAmmo(pl, pl.cannon_mag, pl.ammo_buckshot, __NULL__);
@ -165,7 +165,7 @@ void w_cannon_secondary(void)
return;
}
TraceAttack_FireBullets(10, pl.origin + pl.view_ofs, 5, [0.08716,0.04362]);
TraceAttack_FireBullets(10, pl.origin + pl.view_ofs, 5, [0.08716,0.04362], WEAPON_CANNON);
pl.cannon_mag--;
Weapons_PlaySound(pl, CHAN_WEAPON, "cannon/fire.wav", 1, ATTN_NORM);
Weapons_UpdateAmmo(pl, pl.cannon_mag, pl.ammo_buckshot, __NULL__);

View File

@ -94,7 +94,7 @@ void w_chainsaw_primary(void)
pl.velocity = normalize(trace_ent.origin - pl.origin) * 240;
}
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE );
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE, WEAPON_CHAINSAW);
Weapons_PlaySound(pl, CHAN_WEAPON, "sh/chainsaw_cutintoflesh.wav", 1, ATTN_NORM);
} else {
Effect_CreateSpark(trace_endpos, trace_plane_normal);

View File

@ -120,9 +120,9 @@ void w_hammer_release(void)
hitsound = floor(random(1, 4));
if (trace_ent.classname == "player")
Damage_Apply(trace_ent, self, 50, trace_endpos, FALSE);
Damage_Apply(trace_ent, self, 50, trace_endpos, FALSE, WEAPON_HAMMER);
else
Damage_Apply(trace_ent, self, 100, trace_endpos, FALSE);
Damage_Apply(trace_ent, self, 100, trace_endpos, FALSE, WEAPON_HAMMER);
if (trace_ent.classname == "monster_scientist") {
trace_ent.movetype = MOVETYPE_TOSS;
@ -142,7 +142,7 @@ void w_hammer_release(void)
#ifdef SSQC
if (trace_ent.takedamage) {
hitsound = floor(random(1, 4));
Damage_Apply(trace_ent, self, 200, trace_endpos, FALSE);
Damage_Apply(trace_ent, self, 200, trace_endpos, FALSE, WEAPON_HAMMER);
} else {
if (trace_fraction < 1.0) {
hitsound = 4;

View File

@ -136,7 +136,7 @@ w_crowbar_primary(void)
}
if (trace_ent.takedamage) {
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE );
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE, WEAPON_CROWBAR);
if (!trace_ent.iBleeds) {
return;

View File

@ -119,7 +119,7 @@ w_dbs_primary(void)
#endif
#ifdef SSQC
TraceAttack_FireBullets(4, pl.origin + pl.view_ofs, 14, [0.17365,0.04362]);
TraceAttack_FireBullets(4, pl.origin + pl.view_ofs, 14, [0.17365,0.04362], WEAPON_DBS);
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/sbarrel1.wav", 1, ATTN_NORM);
pl.shotgun_mag--;
Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_shells, __NULL__);

View File

@ -118,7 +118,7 @@ w_sbs_primary(void)
#endif
#ifdef SSQC
TraceAttack_FireBullets(4, pl.origin + pl.view_ofs, 6, [0.17365,0.04362]);
TraceAttack_FireBullets(4, pl.origin + pl.view_ofs, 6, [0.17365,0.04362], WEAPON_SBS);
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/sbarrel1.wav", 1, ATTN_NORM);
pl.shotgun_mag--;
Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_shells, __NULL__);

View File

@ -139,7 +139,7 @@ w_umbrella_primary(void)
}
if (trace_ent.takedamage) {
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE );
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE, WEAPON_UMBRELLA);
if (!trace_ent.iBleeds) {
return;

View File

@ -129,7 +129,7 @@ w_wrench_primary(void)
}
if (trace_ent.takedamage) {
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE );
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE, WEAPON_WRENCH);
if (!trace_ent.iBleeds) {
return;

View File

@ -123,20 +123,21 @@ void Crossbolt_Touch(void) {
/* walls, etc. */
if (other.takedamage != DAMAGE_YES) {
Effect_CreateSpark(self.origin, trace_plane_normal);
sound(self, 1, "weapons/xbow_hit1.wav", 1.0f, ATTN_NORM);
remove(self);
return;
}
/* anything else that can take damage */
Damage_Apply(other, self.owner, 50, trace_endpos, FALSE);
Damage_Apply(other, self.owner, 50, trace_endpos, FALSE, WEAPON_CROSSBOW);
if (random() < 0.5) {
sound(self, 1, "weapons/xbow_hitbod1.wav", 1.0f, ATTN_NORM);
} else {
sound(self, 1, "weapons/xbow_hitbod2.wav", 1.0f, ATTN_NORM);
}
if (other.iBleeds == TRUE) {
if (other.iBleeds == FALSE) {
Effect_CreateSpark(self.origin, trace_plane_normal);
} else {
Effect_CreateBlood(self.origin, [0,0,0]);
@ -293,7 +294,7 @@ w_crossbow_crosshair(void)
vector cross_pos;
vector aicon_pos;
cross_pos = (video_res / 2) + [-12,-12];
cross_pos = video_mins + (video_res / 2) + [-12,-12];
drawsubpic(
cross_pos,
[24,24],

View File

@ -136,7 +136,7 @@ w_crowbar_primary(void)
}
if (trace_ent.takedamage) {
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE );
Damage_Apply(trace_ent, pl, 10, trace_endpos, FALSE, WEAPON_CROWBAR);
if (!trace_ent.iBleeds) {
return;

View File

@ -145,7 +145,7 @@ void w_egon_crosshair(void)
{
#ifdef CSQC
static vector cross_pos;
cross_pos = (video_res / 2) + [-12,-12];
cross_pos = video_mins + (video_res / 2) + [-12,-12];
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [72/128,48/128], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
HUD_DrawAmmo2();
vector aicon_pos = video_mins + [video_res[0] - 48, video_res[1] - 42];

View File

@ -158,7 +158,7 @@ void w_gauss_fire(int one)
}
if (trace_ent.takedamage == DAMAGE_YES) {
Damage_Apply(trace_ent, self, iDamage, trace_endpos, FALSE);
Damage_Apply(trace_ent, self, iDamage, trace_endpos, FALSE, WEAPON_GAUSS);
sound(trace_ent, CHAN_ITEM, sprintf("weapons/electro%d.wav", random(0,3)+4), 1, ATTN_NORM);
}
#else
@ -196,7 +196,7 @@ void w_gauss_fire(int one)
iLoop--;
#ifdef SSQC
if (trace_ent.takedamage == DAMAGE_YES) {
Damage_Apply(trace_ent, self, iDamage, trace_endpos, FALSE);
Damage_Apply(trace_ent, self, iDamage, trace_endpos, FALSE, WEAPON_GAUSS);
sound(trace_ent, CHAN_ITEM, sprintf("weapons/electro%d.wav", random(0,3)+4), 1, ATTN_NORM);
}
@ -357,7 +357,7 @@ void w_gauss_crosshair(void)
vector cross_pos;
vector aicon_pos;
cross_pos = (video_res / 2) + [-12,-12];
cross_pos = video_mins + (video_res / 2) + [-12,-12];
aicon_pos = video_mins + [video_res[0] - 48, video_res[1] - 42];
drawsubpic(

View File

@ -131,7 +131,7 @@ w_glock_primary(void)
}
#else
pl.glock_mag--;
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 8, [0.01,0,01]);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 8, [0.01,0,01], WEAPON_GLOCK);
sound(pl, CHAN_WEAPON, "weapons/pl_gun3.wav", 1.0f, ATTN_NORM);
if (self.flags & FL_CROUCHING)
@ -176,7 +176,7 @@ w_glock_secondary(void)
}
#else
pl.glock_mag--;
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 8, [0.1,0.1]);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 8, [0.1,0.1], WEAPON_GLOCK);
sound(pl, CHAN_WEAPON, "weapons/pl_gun3.wav", 1.0f, ATTN_NORM);
if (self.flags & FL_CROUCHING)
@ -266,7 +266,7 @@ w_glock_hud(void)
vector cross_pos;
vector aicon_pos;
cross_pos = (video_res / 2) + [-12,-12];
cross_pos = video_mins + (video_res / 2) + [-12,-12];
aicon_pos = video_mins + [video_res[0] - 48, video_res[1] - 42];
drawsubpic(

View File

@ -84,7 +84,7 @@ void w_handgrenade_throw(void)
static void WeaponFrag_Throw_Touch( void )
{
if (other.takedamage == DAMAGE_YES) {
Damage_Apply(other, self.owner, 15, self.origin, FALSE);
Damage_Apply(other, self.owner, 15, self.origin, FALSE, WEAPON_HANDGRENADE);
}
int r = floor(random(0,6));
string sample = sprintf("weapons/g_bounce%i.wav", r);
@ -113,24 +113,24 @@ void w_handgrenade_throw(void)
eGrenade.owner = pl;
eGrenade.classname = "remove_me";
eGrenade.solid = SOLID_BBOX;
//eGrenade.angles = vectoangles( vDir );
eGrenade.frame = 1;
eGrenade.velocity = vecThrow;
eGrenade.movetype = MOVETYPE_BOUNCE;
eGrenade.think = WeaponFrag_Throw_Explode;
eGrenade.touch = WeaponFrag_Throw_Touch;
eGrenade.nextthink = time + 4.0f;
eGrenade.frame = 1;
setmodel( eGrenade, "models/w_grenade.mdl" );
eGrenade.frame = 1;
setorigin( eGrenade, vecSrc );
setsize( eGrenade, [0,0,0], [0,0,0] );
setorigin( eGrenade, vecSrc );
}
#endif
void w_handgrenade_draw(void)
{
#ifdef CSQC
Weapons_SetModel("models/v_grenade.mdl");
Weapons_ViewAnimation(HANDGRENADE_DRAW);
#endif
}
void w_handgrenade_holster(void)
@ -146,7 +146,7 @@ void w_handgrenade_primary(void)
/* We're abusing this network variable for the holding check */
if (pl.a_ammo3 > 0) {
return;
return;
}
/* Ammo check */
@ -163,19 +163,11 @@ void w_handgrenade_primary(void)
#ifdef CSQC
Weapons_ViewAnimation(HANDGRENADE_PULLPIN);
#endif
pl.a_ammo3 = 1;
pl.a_ammo3 = 1;
pl.w_attack_next = 0.5f;
pl.w_idle_next = 0.5f;
}
void w_handgrenade_secondary(void)
{
}
void w_handgrenade_reload(void)
{
}
void w_handgrenade_hud(void)
{
@ -208,21 +200,26 @@ void w_handgrenade_release(void)
pl.w_idle_next = 0.5f;
} else if (pl.a_ammo3 == 2) {
#ifdef CSQC
//Weapons_ViewAnimation(HANDGRENADE_DRAW);
Weapons_ViewAnimation(HANDGRENADE_DRAW);
#else
if (!pl.ammo_handgrenade) {
Weapons_RemoveItem(pl, WEAPON_HANDGRENADE);
}
#endif
pl.w_attack_next = 0.5f;
pl.w_idle_next = 0.5f;
pl.a_ammo3 = 0;
}
}
float w_handgrenade_aimanim(void)
float
w_handgrenade_aimanim(void)
{
return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
}
void w_handgrenade_hudpic(int s, vector pos)
void
w_handgrenade_hudpic(int s, vector pos)
{
#ifdef CSQC
if (s) {
@ -244,8 +241,8 @@ weapon_t w_handgrenade =
w_handgrenade_draw,
w_handgrenade_holster,
w_handgrenade_primary,
w_handgrenade_secondary,
w_handgrenade_reload,
w_handgrenade_release,
w_handgrenade_release,
w_handgrenade_release,
w_handgrenade_hud,
w_handgrenade_precache,

View File

@ -95,7 +95,7 @@ w_hornetgun_shoothornet(void)
{
static void Hornet_Touch(void) {
if (other.takedamage == DAMAGE_YES) {
Damage_Apply(other, self.owner, 10, trace_endpos, FALSE);
Damage_Apply(other, self.owner, 10, trace_endpos, FALSE, WEAPON_HORNETGUN);
}
remove(self);
}
@ -242,7 +242,7 @@ w_hornetgun_crosshair(void)
vector cross_pos;
vector aicon_pos;
cross_pos = (video_res / 2) + [-12,-12];
cross_pos = video_mins + (video_res / 2) + [-12,-12];
aicon_pos = video_mins + [video_res[0] - 48, video_res[1] - 42];
drawsubpic(

View File

@ -135,9 +135,9 @@ w_mp5_primary(void)
#else
/* singleplayer is more accurate */
if (cvar("sv_playerslots") == 1) {
TraceAttack_FireBullets(1, Weapons_GetCameraPos(), 8, [0.025,0.025]);
TraceAttack_FireBullets(1, Weapons_GetCameraPos(), 8, [0.025,0.025], WEAPON_MP5);
} else {
TraceAttack_FireBullets(1, Weapons_GetCameraPos(), 8, [0.05,0.05]);
TraceAttack_FireBullets(1, Weapons_GetCameraPos(), 8, [0.05,0.05], WEAPON_MP5);
}
if (random() < 0.5) {
@ -268,7 +268,7 @@ w_mp5_crosshair(void)
vector cross_pos;
vector aicon_pos;
cross_pos = (video_res / 2) + [-12,-12];
cross_pos = video_mins + (video_res / 2) + [-12,-12];
drawsubpic(
cross_pos,

View File

@ -128,7 +128,7 @@ w_python_primary(void)
Weapons_ViewAnimation(PYTHON_FIRE1);
#else
pl.python_mag--;
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 40, [0.008, 0.008]);
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 40, [0.008, 0.008], WEAPON_PYTHON);
if (random() < 0.5) {
sound(pl, CHAN_WEAPON, "weapons/357_shot1.wav", 1, ATTN_NORM);
@ -236,7 +236,7 @@ w_python_crosshair(void)
vector cross_pos;
vector aicon_pos;
cross_pos = (video_res / 2) + [-12,-12];
cross_pos = video_mins + (video_res / 2) + [-12,-12];
drawsubpic(
cross_pos,
[24,24],

View File

@ -249,7 +249,7 @@ void w_rpg_hud(void)
lerp = Math_Lerp(18,6, trace_fraction);
jitter[0] = (random(0,2) - 2) * (1 - trace_fraction);
jitter[1] = (random(0,2) - 2) * (1 - trace_fraction);
cross_pos = (video_res / 2) + ([-lerp,-lerp] / 2);
cross_pos = video_mins + (video_res / 2) + ([-lerp,-lerp] / 2);
drawsubpic(
cross_pos + jitter,
[lerp,lerp],
@ -261,7 +261,7 @@ void w_rpg_hud(void)
DRAWFLAG_ADDITIVE
);
} else {
cross_pos = (video_res / 2) + [-12,-12];
cross_pos = video_mins + (video_res / 2) + [-12,-12];
drawsubpic(
cross_pos,
[24,24],

View File

@ -122,9 +122,9 @@ void w_shotgun_primary(void)
#ifdef SSQC
/* Singleplayer is more accurate */
if (cvar("sv_playerslots") == 1) {
TraceAttack_FireBullets(6, pl.origin + pl.view_ofs, 5, [0.08716,0.08716]);
TraceAttack_FireBullets(6, pl.origin + pl.view_ofs, 5, [0.08716,0.08716], WEAPON_SHOTGUN);
} else {
TraceAttack_FireBullets(4, pl.origin + pl.view_ofs, 5, [0.08716,0.04362]);
TraceAttack_FireBullets(4, pl.origin + pl.view_ofs, 5, [0.08716,0.04362], WEAPON_SHOTGUN);
}
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/sbarrel1.wav", 1, ATTN_NORM);
pl.shotgun_mag--;
@ -164,9 +164,9 @@ void w_shotgun_secondary(void)
#ifdef SSQC
/* Singleplayer is more accurate */
if (cvar("sv_playerslots") == 1) {
TraceAttack_FireBullets(12, pl.origin + pl.view_ofs, 5, [0.08716,0.08716]);
TraceAttack_FireBullets(12, pl.origin + pl.view_ofs, 5, [0.08716,0.08716], WEAPON_SHOTGUN);
} else {
TraceAttack_FireBullets(8, pl.origin + pl.view_ofs, 5, [0.17365,0.04362]);
TraceAttack_FireBullets(8, pl.origin + pl.view_ofs, 5, [0.17365,0.04362], WEAPON_SHOTGUN);
}
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/dbarrel1.wav", 1, ATTN_NORM);
pl.shotgun_mag -= 2;
@ -263,7 +263,7 @@ void w_shotgun_crosshair(void)
{
#ifdef CSQC
static vector cross_pos;
cross_pos = (video_res / 2) + [-12,-12];
cross_pos = video_mins + (video_res / 2) + [-12,-12];
drawsubpic(cross_pos, [24,24], "sprites/crosshairs.spr_0.tga", [48/128,24/128], [0.1875, 0.1875], [1,1,1], 1, DRAWFLAG_NORMAL);
HUD_DrawAmmo1();
HUD_DrawAmmo2();

View File

@ -88,7 +88,7 @@ void w_snark_deploy(void)
self.weapon = 0.5f + random();
sound(self, CHAN_VOICE, sprintf("squeek/sqk_hunt%d.wav",floor(random(1,4))), 1.0, ATTN_NORM);
input_buttons = 2;
Damage_Apply(self, world, 1, self.origin, TRUE);
Damage_Apply(self, world, 1, self.origin, TRUE, 0);
makevectors(self.angles);
traceline(self.origin, self.origin + (v_forward * 128), 0, self);
@ -96,7 +96,7 @@ void w_snark_deploy(void)
if (trace_ent.takedamage == DAMAGE_YES) {
float pit = 100 + random(0,10);
sound(self, CHAN_BODY, "squeek/sqk_deploy1.wav", 1.0, ATTN_NORM, pit);
Damage_Apply(trace_ent, self, 10, trace_endpos, FALSE);
Damage_Apply(trace_ent, self.goalentity, 10, trace_endpos, FALSE, WEAPON_SNARK);
}
if (self.aiment.health <= 0) {
@ -115,6 +115,7 @@ void w_snark_deploy(void)
static void snark_pain(int i) { }
entity snark = spawn();
snark.owner = self;
snark.goalentity = self;
snark.netname = "Snark";
snark.classname = "snark";
setmodel(snark, "models/w_squeak.mdl");

View File

@ -38,7 +38,7 @@ void w_tripmine_precache(void)
void w_tripmine_updateammo(player pl)
{
#ifdef SSQC
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_tripmine, __NULL__);
Weapons_UpdateAmmo(pl, -1, pl.ammo_tripmine, -1);
#endif
}
string w_tripmine_wmodel(void)
@ -69,11 +69,9 @@ int w_tripmine_pickup(int new)
void w_tripmine_draw(void)
{
#ifdef CSQC
Weapons_SetModel("models/v_tripmine.mdl");
Weapons_ViewAnimation(TRIPMINE_DRAW);
#ifdef SSQC
player pl = (player)self;
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_tripmine, __NULL__);
#endif
}
void w_tripmine_holster(void)
@ -170,6 +168,8 @@ void w_tripmine_parse(void)
void w_tripmine_primary(void)
{
player pl = (player)self;
vector src;
if (pl.w_attack_next > 0.0) {
return;
}
@ -184,47 +184,37 @@ void w_tripmine_primary(void)
}
#endif
src = Weapons_GetCameraPos();
Weapons_MakeVectors();
traceline(Weapons_GetCameraPos(), Weapons_GetCameraPos() + v_forward * 64, FALSE, pl);
traceline(src, src + v_forward * 64, FALSE, pl);
if (trace_fraction == 1.0f) {
if (trace_fraction == 1.0) {
return;
}
#ifdef CSQC
pl.a_ammo2--;
Weapons_ViewAnimation(TRIPMINE_FIRE2);
#ifdef SSQC
#else
entity mine = spawn();
setmodel(mine, "models/v_tripmine.mdl");
setorigin(mine, trace_endpos);
mine.angles = vectoangles( trace_plane_normal );
setorigin(mine, trace_endpos - (v_forward * 8));
mine.angles = vectoangles( trace_plane_normal );
setorigin(mine, trace_endpos - (v_forward * 8));
mine.think = w_tripmine_ready;
mine.nextthink = time + 4.0f;
mine.SendEntity = w_tripmine_sendentity;
mine.SendFlags = 1;
//mine.owner = pl;
sound(mine, CHAN_WEAPON, "weapons/mine_charge.wav", 1, ATTN_NORM);
sound(self, CHAN_WEAPON, "weapons/mine_deploy.wav", 1, ATTN_NORM);
pl.ammo_tripmine--;
if (pl.ammo_tripmine <= 0) {
Weapons_RemoveItem(pl, WEAPON_TRIPMINE);
} else {
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_tripmine, __NULL__);
}
sound(self, CHAN_WEAPON, "weapons/mine_deploy.wav", 1, ATTN_NORM);
#endif
pl.w_attack_next = 0.5f;
pl.w_idle_next = 2.5f;
}
void w_tripmine_secondary(void)
{
}
void w_tripmine_reload(void)
{
pl.a_ammo3 = 1;
pl.w_attack_next =
pl.w_idle_next = 0.5f;
}
void w_tripmine_release(void)
{
int r;
@ -233,6 +223,19 @@ void w_tripmine_release(void)
return;
}
if (pl.a_ammo3 == 1) {
Weapons_ViewAnimation(TRIPMINE_DRAW);
#ifdef SSQC
if (pl.ammo_tripmine <= 0) {
Weapons_RemoveItem(pl, WEAPON_TRIPMINE);
}
#endif
pl.a_ammo3 = 0;
pl.w_attack_next = 0.5f;
pl.w_idle_next = 3.0f;
return;
}
r = floor(random(0,3));
switch (r) {
@ -285,8 +288,8 @@ weapon_t w_tripmine =
w_tripmine_draw,
w_tripmine_holster,
w_tripmine_primary,
w_tripmine_secondary,
w_tripmine_reload,
w_tripmine_release,
w_tripmine_release,
w_tripmine_release,
w_tripmine_hud,
w_tripmine_precache,