Skip to content

Commit

Permalink
grenade belt finally
Browse files Browse the repository at this point in the history
  • Loading branch information
BenLubar committed Jul 21, 2024
1 parent 6730353 commit ae29cf2
Show file tree
Hide file tree
Showing 25 changed files with 423 additions and 465 deletions.
2 changes: 1 addition & 1 deletion reactivedrop/scripts/asw_weapon_freeze_grenades.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
WeaponData
{
// Weapon data is loaded by both the Game and Client DLLs.
"viewmodel" "models/swarm/Flare/flareweapon.mdl"
"viewmodel" "models/swarm/marine/attachments/grenade_belt.mdl"
"playermodel" "models/swarm/grenades/grenadebox.mdl"
"playermodel_skin" "1"
"anim_prefix" "ar2"
Expand Down
2 changes: 1 addition & 1 deletion reactivedrop/scripts/asw_weapon_gas_grenades.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
WeaponData
{
// Weapon data is loaded by both the Game and Client DLLs.
"viewmodel" "models/swarm/Flare/flareweapon.mdl"
"viewmodel" "models/swarm/marine/attachments/grenade_belt.mdl"
"playermodel" "models/swarm/grenades/grenadebox.mdl"
"playermodel_skin" "2"
"anim_prefix" "ar2"
Expand Down
2 changes: 1 addition & 1 deletion reactivedrop/scripts/asw_weapon_grenades.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
WeaponData
{
// Weapon data is loaded by both the Game and Client DLLs.
"viewmodel" "models/swarm/Flare/flareweapon.mdl"
"viewmodel" "models/swarm/marine/attachments/grenade_belt.mdl"
"playermodel" "models/swarm/grenades/grenadebox.mdl"
"anim_prefix" "ar2"
"bucket" "0"
Expand Down
2 changes: 1 addition & 1 deletion reactivedrop/scripts/asw_weapon_incendiary_grenades.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
WeaponData
{
// Weapon data is loaded by both the Game and Client DLLs.
"viewmodel" "models/swarm/Flare/flareweapon.mdl"
"viewmodel" "models/swarm/marine/attachments/grenade_belt.mdl"
"playermodel" "models/swarm/grenades/grenadebox.mdl"
"playermodel_skin" "3"
"anim_prefix" "ar2"
Expand Down
2 changes: 1 addition & 1 deletion reactivedrop/scripts/asw_weapon_stun_grenades.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
WeaponData
{
// Weapon data is loaded by both the Game and Client DLLs.
"viewmodel" "models/swarm/Flare/flareweapon.mdl"
"viewmodel" "models/swarm/marine/attachments/grenade_belt.mdl"
"playermodel" "models/swarm/grenades/grenadebox.mdl"
"playermodel_skin" "4"
"anim_prefix" "ar2"
Expand Down
20 changes: 20 additions & 0 deletions reactivedrop/scripts/game_sounds_asw_weapons.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1893,3 +1893,23 @@

"wave" "weapons/3D/reloads/shieldrifle_C.wav"
}

"ASW_Grenade.Throw"
{
"channel" "CHAN_AUTO"
"volume" "0.6"
"pitch" "95, 105"
"soundlevel" "SNDLVL_60dB"

"wave" "^weapons\3D\flare\throw_grenade.wav"
}

"ASW_Mine.Throw"
{
"channel" "CHAN_AUTO"
"volume" "0.6"
"pitch" "95, 105"
"soundlevel" "SNDLVL_60dB"

"wave" "^weapons\slam\throw.wav"
}
2 changes: 2 additions & 0 deletions src/game/client/swarm_sdk_client.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ if exist ..\..\devtools\bin\postbuild.cmd ..\..\devtools\bin\postbuild.cmd clien
<ClInclude Include="..\..\public\steam\steam_api_internal.h" />
<ClInclude Include="..\shared\swarm\asw_computer_area_shared.h" />
<ClInclude Include="..\shared\swarm\asw_weapon_flechette2_shared.h" />
<ClInclude Include="..\shared\swarm\asw_weapon_grenade_box_shared.h" />
<ClInclude Include="..\shared\swarm\asw_weapon_rifle_burst_shared.h" />
<ClInclude Include="..\shared\swarm\rd_computer_vscript_shared.h" />
<ClInclude Include="..\shared\swarm\rd_crafting_defs.h" />
Expand Down Expand Up @@ -848,6 +849,7 @@ if exist ..\..\devtools\bin\postbuild.cmd ..\..\devtools\bin\postbuild.cmd clien
<ClCompile Include="..\shared\swarm\asw_weapon_freeze_grenades.cpp" />
<ClCompile Include="..\shared\swarm\asw_weapon_gas_grenades_shared.cpp" />
<ClCompile Include="..\shared\swarm\asw_weapon_grenades.cpp" />
<ClCompile Include="..\shared\swarm\asw_weapon_grenade_box_shared.cpp" />
<ClCompile Include="..\shared\swarm\asw_weapon_grenade_launcher.cpp" />
<ClCompile Include="..\shared\swarm\asw_weapon_hack_tool_shared.cpp" />
<ClCompile Include="..\shared\swarm\asw_weapon_healamp_gun_shared.cpp" />
Expand Down
4 changes: 2 additions & 2 deletions src/game/server/swarm/asw_gas_grenade_projectile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
extern ConVar sk_plr_dmg_asw_gas_grenades;
extern ConVar sk_npc_dmg_asw_gas_grenades;

#define GAS_GRENADE_MODEL "models/swarm/grenades/HandGrenadeProjectile.mdl"
#define GAS_GRENADE_MODEL "models/swarm/grenades/GasGrenadeProjectile.mdl"

extern ConVar asw_gas_grenade_duration;
extern ConVar asw_gas_grenade_fuse;
Expand Down Expand Up @@ -87,7 +87,7 @@ void CASW_Gas_Grenade_Projectile::Spawn( void )
Precache( );

SetModel( GAS_GRENADE_MODEL );
m_nSkin = 2;
m_nSkin = 0;
UTIL_SetSize( this, Vector( -2, -2, -2 ), Vector( 2, 2, 2 ) );
SetSolid( SOLID_BBOX );

Expand Down
10 changes: 6 additions & 4 deletions src/game/server/swarm/asw_grenade_cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "tier0/memdbgon.h"

#define CLUSTER_GRENADE_MODEL "models/swarm/grenades/HandGrenadeProjectile.mdl"
#define LAUNCHER_GRENADE_MODEL "models/swarm/grenades/GrenadeLauncherProjectile.mdl"

extern ConVar sk_plr_dmg_asw_r_g;
extern ConVar asw_grenade_vindicator_radius;
Expand Down Expand Up @@ -78,9 +79,9 @@ END_SCRIPTDESC();
void CASW_Grenade_Cluster::Spawn( void )
{
Precache();
SetModel( CLUSTER_GRENADE_MODEL );
SetModel( m_CreatorWeaponClass == CLASS_ASW_GRENADE_LAUNCHER ? LAUNCHER_GRENADE_MODEL : CLUSTER_GRENADE_MODEL );
m_nSkin = 0;

SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE );

m_flDamage = sk_plr_dmg_asw_r_g.GetFloat();
Expand Down Expand Up @@ -110,7 +111,7 @@ void CASW_Grenade_Cluster::Spawn( void )
m_fEarliestTouchDetonationTime = GetEarliestTouchDetonationTime();

m_iClusters = 0;
m_bMaster = true;
m_bMaster = true;

//EmitSound( "ASWGrenade.Alarm" );
SetFuseLength(asw_cluster_grenade_fuse.GetFloat());
Expand Down Expand Up @@ -138,7 +139,8 @@ void CASW_Grenade_Cluster::Precache()
{
BaseClass::Precache();

PrecacheModel(CLUSTER_GRENADE_MODEL);
PrecacheModel( CLUSTER_GRENADE_MODEL );
PrecacheModel( LAUNCHER_GRENADE_MODEL );
PrecacheScriptSound( "ASWGrenade.Alarm" );
PrecacheParticleSystem( "explosion_grenade" );
}
Expand Down
2 changes: 2 additions & 0 deletions src/game/server/swarm_sdk_server.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ if exist ..\..\devtools\bin\postbuild.cmd ..\..\devtools\bin\postbuild.cmd serve
<ClCompile Include="..\shared\swarm\asw_weapon_freeze_grenades.cpp" />
<ClCompile Include="..\shared\swarm\asw_weapon_gas_grenades_shared.cpp" />
<ClCompile Include="..\shared\swarm\asw_weapon_grenades.cpp" />
<ClCompile Include="..\shared\swarm\asw_weapon_grenade_box_shared.cpp" />
<ClCompile Include="..\shared\swarm\asw_weapon_grenade_launcher.cpp" />
<ClCompile Include="..\shared\swarm\asw_weapon_hack_tool_shared.cpp" />
<ClCompile Include="..\shared\swarm\asw_weapon_healamp_gun_shared.cpp" />
Expand Down Expand Up @@ -1794,6 +1795,7 @@ if exist ..\..\devtools\bin\postbuild.cmd ..\..\devtools\bin\postbuild.cmd serve
<ClInclude Include="..\shared\swarm\asw_weapon_freeze_grenades.h" />
<ClInclude Include="..\shared\swarm\asw_weapon_gas_grenades_shared.h" />
<ClInclude Include="..\shared\swarm\asw_weapon_grenades.h" />
<ClInclude Include="..\shared\swarm\asw_weapon_grenade_box_shared.h" />
<ClInclude Include="..\shared\swarm\asw_weapon_grenade_launcher.h" />
<ClInclude Include="..\shared\swarm\asw_weapon_hack_tool_shared.h" />
<ClInclude Include="..\shared\swarm\asw_weapon_healamp_gun_shared.h" />
Expand Down
10 changes: 5 additions & 5 deletions src/game/shared/swarm/asw_equipment_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ static CASW_EquipItem s_ExtraEquips[ASW_NUM_EQUIP_EXTRA] =
&asw_ammo_count_freeze_grenades, &asw_ammo_count_freeze_grenades,
NULL, NULL,
0, 0, 2.2f, 1, MARINE_CLASS_UNDEFINED,
false, false, false, ASW_OFFHAND_THROW,
false, true, false, ASW_OFFHAND_THROW,
0, 0,
},
{
Expand Down Expand Up @@ -718,7 +718,7 @@ static CASW_EquipItem s_ExtraEquips[ASW_NUM_EQUIP_EXTRA] =
&asw_ammo_count_grenades, &asw_ammo_count_grenades,
NULL, NULL,
80, 0, 2.2f, 1, MARINE_CLASS_UNDEFINED,
false, false, false, ASW_OFFHAND_THROW,
false, true, false, ASW_OFFHAND_THROW,
0, 0,
},
{
Expand Down Expand Up @@ -748,7 +748,7 @@ static CASW_EquipItem s_ExtraEquips[ASW_NUM_EQUIP_EXTRA] =
&asw_ammo_count_gas_grenades, &asw_ammo_count_gas_grenades,
NULL, NULL,
0, 0, 2.2f, 1, MARINE_CLASS_MEDIC,
false, false, false, ASW_OFFHAND_THROW,
false, true, false, ASW_OFFHAND_THROW,
0, 0,
},

Expand Down Expand Up @@ -803,7 +803,7 @@ static CASW_EquipItem s_ExtraEquips[ASW_NUM_EQUIP_EXTRA] =
&asw_ammo_count_stun_grenades, &asw_ammo_count_stun_grenades,
NULL, NULL,
0, 0, 2.2f, 1, MARINE_CLASS_UNDEFINED,
false, false, false, ASW_OFFHAND_THROW,
false, true, false, ASW_OFFHAND_THROW,
0, 0,
},
{
Expand All @@ -813,7 +813,7 @@ static CASW_EquipItem s_ExtraEquips[ASW_NUM_EQUIP_EXTRA] =
&asw_ammo_count_incendiary_grenades, &asw_ammo_count_incendiary_grenades,
NULL, NULL,
0, 0, 2.2f, 1, MARINE_CLASS_NCO,
false, false, false, ASW_OFFHAND_THROW,
false, true, false, ASW_OFFHAND_THROW,
0, 0,
},
{
Expand Down
117 changes: 2 additions & 115 deletions src/game/shared/swarm/asw_weapon_freeze_grenades.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,96 +50,12 @@ extern ConVar asw_debug_marine_damage;
// Save/Restore
//---------------------------------------------------------
BEGIN_DATADESC( CASW_Weapon_Freeze_Grenades )
DEFINE_FIELD( m_flSoonestPrimaryAttack, FIELD_TIME ),
END_DATADESC()

#endif /* not client */

CASW_Weapon_Freeze_Grenades::CASW_Weapon_Freeze_Grenades()
{
m_fMinRange1 = 0;
m_fMaxRange1 = 2048;

m_fMinRange2 = 256;
m_fMaxRange2 = 1024;

m_flSoonestPrimaryAttack = gpGlobals->curtime;
}


CASW_Weapon_Freeze_Grenades::~CASW_Weapon_Freeze_Grenades()
{

}

//-----------------------------------------------------------------------------
// Purpose:
// Output : Activity
//-----------------------------------------------------------------------------
Activity CASW_Weapon_Freeze_Grenades::GetPrimaryAttackActivity( void )
{
return ACT_VM_PRIMARYATTACK;
}

bool CASW_Weapon_Freeze_Grenades::OffhandActivate()
{
if (!GetMarine() || GetMarine()->GetFlags() & FL_FROZEN) // don't allow this if the marine is frozen
return false;
PrimaryAttack();

return true;
}

#define FLARE_PROJECTILE_AIR_VELOCITY 400

void CASW_Weapon_Freeze_Grenades::PrimaryAttack( void )
{
CASW_Player *pPlayer = GetCommander();

if (!pPlayer)
return;

CASW_Marine *pMarine = GetMarine();
bool bThisActive = (pMarine && pMarine->GetActiveWeapon() == this);

// grenade weapon is lost when all grenades are gone
if ( UsesClipsForAmmo1() && m_iClip1 <= 0 )
{
return;
}

if (pMarine && gpGlobals->curtime > m_flDelayedFire) // firing from a marine
{
#ifdef CLIENT_DLL
if ( !prediction->InPrediction() || prediction->IsFirstTimePredicted() )
{
pMarine->DoAnimationEvent( PLAYERANIMEVENT_THROW_GRENADE );
}
#else
pMarine->DoAnimationEvent( PLAYERANIMEVENT_THROW_GRENADE );

pMarine->OnWeaponFired( this, 1 );
#endif

// start our delayed attack
m_bShotDelayed = true;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = m_flDelayedFire = gpGlobals->curtime + asw_grenade_throw_delay.GetFloat();
if (!bThisActive && pMarine->GetActiveASWWeapon())
{
// if we're offhand activating, make sure our primary weapon can't fire until we're done
//pMarine->GetActiveASWWeapon()->m_flNextPrimaryAttack = m_flNextPrimaryAttack + 0.4f;

// reactivedrop: preventing cheating, firing flare can greatly
// increase fire rate for primary weapon, when using with scripts
pMarine->GetActiveASWWeapon()->m_flNextPrimaryAttack =
MAX(pMarine->GetActiveASWWeapon()->m_flNextPrimaryAttack,
m_flNextPrimaryAttack + 0.4f);
pMarine->GetActiveASWWeapon()->m_bIsFiring = false;
}
}
}


#ifndef CLIENT_DLL
float CASW_Weapon_Freeze_Grenades::GetBoomRadius( CASW_Marine *pMarine )
{
Expand Down Expand Up @@ -206,36 +122,7 @@ void CASW_Weapon_Freeze_Grenades::DelayedAttack( void )

void CASW_Weapon_Freeze_Grenades::Precache()
{
BaseClass::Precache();
}

// flares don't reload
bool CASW_Weapon_Freeze_Grenades::Reload()
{
return false;
}

void CASW_Weapon_Freeze_Grenades::ItemPostFrame( void )
{
BaseClass::ItemPostFrame();

if ( m_bInReload )
return;

CBasePlayer *pOwner = GetCommander();
BaseClass::Precache();

if ( pOwner == NULL )
return;

//Allow a refire as fast as the player can click
if ( ( ( pOwner->m_nButtons & IN_ATTACK ) == false ) && ( m_flSoonestPrimaryAttack < gpGlobals->curtime ) )
{
m_flNextPrimaryAttack = gpGlobals->curtime - 0.1f;
}
UTIL_PrecacheOther( "asw_grenade_freeze" );
}

int CASW_Weapon_Freeze_Grenades::ASW_SelectWeaponActivity(int idealActivity)
{
// we just use the normal 'no weapon' anims for this
return idealActivity;
}
Loading

0 comments on commit ae29cf2

Please sign in to comment.