//----------------------------------------------------------------------------- // Purpose: // // //----------------------------------------------------------------------------- void CWeaponMolotov::PrimaryAttack( void ) { CBasePlayer *pPlayer = ToBasePlayer( GetOwner() ); if (!pPlayer) { return; } Vector vecSrc = pPlayer->WorldSpaceCenter(); Vector vecFacing = pPlayer->BodyDirection3D( ); vecSrc = vecSrc + vecFacing * 18.0; // BUGBUG: is this some hack because it's not at the eye position???? vecSrc.z += 24.0f; // Player may have turned to face a wall during the throw anim in which case // we don't want to throw the SLAM into the wall if (ObjectInWay()) { vecSrc = pPlayer->WorldSpaceCenter() + vecFacing * 5.0; } Vector vecAiming = pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES ); vecAiming.z += 0.20; // Raise up so passes through reticle ThrowMolotov(vecSrc, vecAiming*800); pPlayer->RemoveAmmo( 1, m_iSecondaryAmmoType ); // Don't fire again until fire animation has completed //m_flNextPrimaryAttack = gpGlobals->curtime + CurSequenceDuration(); //<<TEMP>> - till real animation is avaible m_flNextPrimaryAttack = gpGlobals->curtime + 1.0; m_flNextSecondaryAttack = gpGlobals->curtime + 1.0; m_bNeedDraw = true; }
//----------------------------------------------------------------------------- // Purpose: // // //----------------------------------------------------------------------------- void CWeaponBrickbat::Throw( void ) { CBasePlayer *pPlayer = ToBasePlayer( GetOwner() ); if (!pPlayer) { return; } Vector vecSrc = pPlayer->WorldSpaceCenter(); Vector vecFacing = pPlayer->BodyDirection3D( ); vecSrc = vecSrc + vecFacing * 18.0; vecSrc.z += 24.0f; // Player may have turned to face a wall during the throw anim in which case // we don't want to throw the SLAM into the wall if (ObjectInWay()) { vecSrc = pPlayer->WorldSpaceCenter() + vecFacing * 5.0; } Vector vecAiming = pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES ); vecAiming.z += 0.20; // Raise up so passes through reticle ThrowBrickbat(vecSrc, vecAiming*800, sk_plr_dmg_brickbat.GetFloat()); pPlayer->RemoveAmmo( 1, m_iPrimaryAmmoType ); SendWeaponAnim(ACT_VM_THROW); // Don't fire again until fire animation has completed float flSequenceEndTime = gpGlobals->curtime + SequenceDuration(); pPlayer->m_flNextAttack = m_flNextPrimaryAttack = m_flNextSecondaryAttack = flSequenceEndTime; m_bNeedThrow = false; m_bNeedDraw = true; }