From a7b86a0c58a9dbf9a7d4b1cb6dff2aef25989e23 Mon Sep 17 00:00:00 2001 From: wootguy Date: Sun, 5 Jan 2025 17:19:00 -0800 Subject: [PATCH] misc map features - add sniper hecu grunt - add npc_dropweapons cvar - interpolate sprite movement --- dlls/env/CSprite.cpp | 2 +- dlls/game/game.cpp | 2 ++ dlls/game/game.h | 1 + dlls/game/gamerules.cpp | 1 + dlls/monster/CBarney.cpp | 2 +- dlls/monster/CBaseGrunt.cpp | 4 ++++ dlls/monster/CBaseGrunt.h | 1 + dlls/monster/CHGrunt.cpp | 16 ++++++++++++++-- dlls/monster/COtis.cpp | 2 +- dlls/monster/CShockTrooper.cpp | 4 ++-- 10 files changed, 28 insertions(+), 7 deletions(-) diff --git a/dlls/env/CSprite.cpp b/dlls/env/CSprite.cpp index 031562db..be045d1a 100644 --- a/dlls/env/CSprite.cpp +++ b/dlls/env/CSprite.cpp @@ -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; diff --git a/dlls/game/game.cpp b/dlls/game/game.cpp index 0e66d5b7..e1092748 100644 --- a/dlls/game/game.cpp +++ b/dlls/game/game.cpp @@ -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 }; @@ -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); diff --git a/dlls/game/game.h b/dlls/game/game.h index 02426791..4ca914d9 100644 --- a/dlls/game/game.h +++ b/dlls/game/game.h @@ -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. diff --git a/dlls/game/gamerules.cpp b/dlls/game/gamerules.cpp index fa312ea9..b282551b 100644 --- a/dlls/game/gamerules.cpp +++ b/dlls/game/gamerules.cpp @@ -199,6 +199,7 @@ void execMapCfg() { "nomedkit", "nomaptrans", "mp_npcidletalk", + "npc_dropweapons", }; static unordered_set itemNames = { diff --git a/dlls/monster/CBarney.cpp b/dlls/monster/CBarney.cpp index 73fbd81e..11bcc182 100644 --- a/dlls/monster/CBarney.cpp +++ b/dlls/monster/CBarney.cpp @@ -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; diff --git a/dlls/monster/CBaseGrunt.cpp b/dlls/monster/CBaseGrunt.cpp index 6aa9fe8c..9dc2974f 100644 --- a/dlls/monster/CBaseGrunt.cpp +++ b/dlls/monster/CBaseGrunt.cpp @@ -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); diff --git a/dlls/monster/CBaseGrunt.h b/dlls/monster/CBaseGrunt.h index eba85e9a..b32a7cbe 100644 --- a/dlls/monster/CBaseGrunt.h +++ b/dlls/monster/CBaseGrunt.h @@ -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 diff --git a/dlls/monster/CHGrunt.cpp b/dlls/monster/CHGrunt.cpp index 61208fe5..8fdffd28 100644 --- a/dlls/monster/CHGrunt.cpp +++ b/dlls/monster/CHGrunt.cpp @@ -22,6 +22,7 @@ #define GUN_SHOTGUN 1 #define GUN_NONE 2 #define GUN_ROCKETLAUNCHER 3 +#define GUN_SNIPERRIFLE 4 class CHGrunt : public CBaseGrunt { @@ -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; @@ -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; @@ -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); } @@ -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(); diff --git a/dlls/monster/COtis.cpp b/dlls/monster/COtis.cpp index 8fcac03b..31bed1ac 100644 --- a/dlls/monster/COtis.cpp +++ b/dlls/monster/COtis.cpp @@ -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; diff --git a/dlls/monster/CShockTrooper.cpp b/dlls/monster/CShockTrooper.cpp index 92c99ad5..e0c9da07 100644 --- a/dlls/monster/CShockTrooper.cpp +++ b/dlls/monster/CShockTrooper.cpp @@ -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); @@ -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