Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions dlls/rpg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ bool CRpg::GetItemInfo(ItemInfo* p)

bool CRpg::Deploy()
{
m_fLaserSwitchReady = true;

if (m_iClip == 0)
{
return DefaultDeploy("models/v_rpg.mdl", "models/p_rpg.mdl", RPG_DRAW_UL, "rpg");
Expand Down Expand Up @@ -506,6 +508,12 @@ void CRpg::PrimaryAttack()

void CRpg::SecondaryAttack()
{
// switch the laser only once per a key press (not while holding).
if (!m_fLaserSwitchReady)
return;

m_fLaserSwitchReady = false;

m_fSpotActive = !m_fSpotActive;

#ifndef CLIENT_DLL
Expand All @@ -520,6 +528,14 @@ void CRpg::SecondaryAttack()
}


void CRpg::ItemPostFrame()
{
m_fLaserSwitchReady |= (m_pPlayer->pev->button & IN_ATTACK2) == 0;

CBasePlayerWeapon::ItemPostFrame();
}


void CRpg::WeaponIdle()
{
UpdateSpot();
Expand Down
2 changes: 2 additions & 0 deletions dlls/weapons.h
Original file line number Diff line number Diff line change
Expand Up @@ -796,12 +796,14 @@ class CRpg : public CBasePlayerWeapon
void PrimaryAttack() override;
void SecondaryAttack() override;
void WeaponIdle() override;
void ItemPostFrame() override;

void UpdateSpot();
bool ShouldWeaponIdle() override { return true; }

CLaserSpot* m_pSpot;
bool m_fSpotActive;
bool m_fLaserSwitchReady;
int m_cActiveRockets; // how many missiles in flight from this launcher right now?

bool UseDecrement() override
Expand Down