Skip to content

Commit

Permalink
misc map features
Browse files Browse the repository at this point in the history
- add sniper hecu grunt
- add npc_dropweapons cvar
- interpolate sprite movement
  • Loading branch information
wootguy committed Jan 6, 2025
1 parent b08f0ab commit a7b86a0
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dlls/env/CSprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ IMPLEMENT_SAVERESTORE(CSprite, CPointEntity)
void CSprite::Spawn(void)
{
pev->solid = SOLID_NOT;
pev->movetype = MOVETYPE_NONE;
pev->movetype = MOVETYPE_NOCLIP;
pev->effects = 0;
pev->frame = 0;

Expand Down
2 changes: 2 additions & 0 deletions dlls/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ cvar_t mp_antiblock ={"mp_antiblock", "1", FCVAR_SERVER, 0, 0 };
cvar_t mp_antiblock_cooldown ={"mp_antiblock_cooldown", "3", FCVAR_SERVER, 0, 0 };
cvar_t mp_min_score_mult ={"mp_min_score_mult", "20", FCVAR_SERVER, 0, 0 };
cvar_t mp_hevsuit_voice ={"mp_hevsuit_voice", "0", FCVAR_SERVER, 0, 0 };
cvar_t npc_dropweapons ={"npc_dropweapons", "1", FCVAR_SERVER, 0, 0 };

cvar_t soundvariety={"mp_soundvariety","0", FCVAR_SERVER, 0, 0 };
cvar_t mp_npcidletalk={"mp_npcidletalk","1", FCVAR_SERVER, 0, 0 };
Expand Down Expand Up @@ -414,6 +415,7 @@ void GameDLLInit( void )
CVAR_REGISTER (&mp_antiblock_cooldown);
CVAR_REGISTER (&mp_min_score_mult);
CVAR_REGISTER (&mp_hevsuit_voice);
CVAR_REGISTER (&npc_dropweapons);

CVAR_REGISTER (&mp_chattime);

Expand Down
1 change: 1 addition & 0 deletions dlls/game/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ EXPORT extern cvar_t mp_antiblock; // enables player swapping with +use
EXPORT extern cvar_t mp_antiblock_cooldown; // how long a player needs to wait before swapping again after a "rude" swap
EXPORT extern cvar_t mp_min_score_mult; // minimum score multiplier for death penalties
EXPORT extern cvar_t mp_hevsuit_voice; // enable/disable the hev suit voice
EXPORT extern cvar_t npc_dropweapons; // enable/disable npcs dropping weapons

// Enables classic func_pushable physics (which is horribly broken, but fun)
// The higher your FPS, the faster you can boost pushables. You also get boosted.
Expand Down
1 change: 1 addition & 0 deletions dlls/game/gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ void execMapCfg() {
"nomedkit",
"nomaptrans",
"mp_npcidletalk",
"npc_dropweapons",
};

static unordered_set<string> itemNames = {
Expand Down
2 changes: 1 addition & 1 deletion dlls/monster/CBarney.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ void CBarney::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir

void CBarney::Killed( entvars_t *pevAttacker, int iGib )
{
if ( pev->body < BARNEY_BODY_GUNGONE )
if ( pev->body < BARNEY_BODY_GUNGONE && npc_dropweapons.value )
{// drop the gun!
Vector vecGunPos;
Vector vecGunAngles;
Expand Down
4 changes: 4 additions & 0 deletions dlls/monster/CBaseGrunt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,10 @@ void CBaseGrunt::DropEquipmentToss(const char* cname, Vector vecGunPos, Vector v
}

bool CBaseGrunt::DropEquipment(int attachmentIdx, int equipMask, Vector velocity, Vector aVelocity) {
if (!npc_dropweapons.value) {
return false;
}

Vector vecGunPos;
Vector vecGunAngles;
GetAttachment(attachmentIdx, vecGunPos, vecGunAngles);
Expand Down
1 change: 1 addition & 0 deletions dlls/monster/CBaseGrunt.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#define HGRUNT_GRENADELAUNCHER ( 1 << 2)
#define HGRUNT_SHOTGUN ( 1 << 3)
#define HGRUNT_ROCKETLAUNCHER ( 1 << 6)
#define HGRUNT_SNIPERRIFLE ( 1 << 7)

#define GRUNT_SENTENCE_VOLUME (float)0.35 // volume of grunt sentences

Expand Down
16 changes: 14 additions & 2 deletions dlls/monster/CHGrunt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define GUN_SHOTGUN 1
#define GUN_NONE 2
#define GUN_ROCKETLAUNCHER 3
#define GUN_SNIPERRIFLE 4

class CHGrunt : public CBaseGrunt
{
Expand Down Expand Up @@ -99,7 +100,7 @@ void CHGrunt::Spawn() {
m_skinFrames = 2;
BaseSpawn();

if (FBitSet(pev->weapons, HGRUNT_SHOTGUN))
if (m_iEquipment & MEQUIP_SHOTGUN)
{
SetBodygroup(GUN_GROUP, GUN_SHOTGUN);
m_cClipSize = 8;
Expand All @@ -112,6 +113,14 @@ void CHGrunt::Spawn() {
m_flDistLook = 4096.0;
maxShootDist = 4096;
}
else if (m_iEquipment & MEQUIP_SNIPER)
{
SetBodygroup(GUN_GROUP, GUN_SNIPERRIFLE);
m_cClipSize = 1;
m_flDistTooFar = 4096.0;
m_flDistLook = 4096.0;
maxShootDist = 4096;
}
else
{
m_cClipSize = GRUNT_CLIP_SIZE;
Expand All @@ -123,7 +132,7 @@ void CHGrunt::Spawn() {
else
pev->skin = m_skinBase + 1; // dark skin

if (FBitSet(pev->weapons, HGRUNT_SHOTGUN))
if (m_iEquipment & MEQUIP_SHOTGUN)
{
SetBodygroup(HEAD_GROUP, HEAD_SHOTGUN);
}
Expand Down Expand Up @@ -169,6 +178,9 @@ void CHGrunt::Precache()
if (FBitSet(pev->weapons, HGRUNT_ROCKETLAUNCHER)) {
m_iEquipment |= MEQUIP_RPG;
}
if (FBitSet(pev->weapons, HGRUNT_SNIPERRIFLE)) {
m_iEquipment |= MEQUIP_SNIPER;
}

BasePrecache();

Expand Down
2 changes: 1 addition & 1 deletion dlls/monster/COtis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ void COtis::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir,

void COtis::Killed( entvars_t *pevAttacker, int iGib )
{
if ( GetBodygroup( OtisBodyGroup::Weapons ) == OtisWeapon::DesertEagle )
if ( GetBodygroup( OtisBodyGroup::Weapons ) == OtisWeapon::DesertEagle && npc_dropweapons.value)
{// drop the gun!
Vector vecGunPos;
Vector vecGunAngles;
Expand Down
4 changes: 2 additions & 2 deletions dlls/monster/CShockTrooper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ void CShockTrooper::GibMonster()
Vector vecGunPos;
Vector vecGunAngles;

if (GetBodygroup(STrooperBodyGroup::Weapons) != STrooperWeapon::None)
if (GetBodygroup(STrooperBodyGroup::Weapons) != STrooperWeapon::None && npc_dropweapons.value)
{ // throw a gun if the grunt has one
GetAttachment(0, vecGunPos, vecGunAngles);

Expand Down Expand Up @@ -923,7 +923,7 @@ void CShockTrooper::HandleAnimEvent(MonsterEvent_t* pEvent)
{
case STROOPER_AE_DROP_GUN:
{
if (GetBodygroup(STrooperBodyGroup::Weapons) != STrooperWeapon::None)
if (GetBodygroup(STrooperBodyGroup::Weapons) != STrooperWeapon::None && npc_dropweapons.value)
{
Vector vecGunPos;
//Zero this out so we don't end up with garbage angles later on
Expand Down

0 comments on commit a7b86a0

Please sign in to comment.