Lost Soul / Shadow Walker: Refactoring, cleanup

This commit is contained in:
1upD 2018-10-06 22:34:08 -04:00
parent b7873d0529
commit 4ac6828023
2 changed files with 12 additions and 74 deletions

View File

@ -1,25 +1,12 @@
//========= Copyright Valve Corporation, All rights reserved. ============// //=//=============================================================================//
// This is a skeleton file for use when creating a new
// NPC. Copy and rename this file for the new
// NPC and add the copy to the build.
// //
// Leave this file in the build until we ship! Allowing // Purpose: A frightening flying creature with the appearance of a burning skull.
// this file to be rebuilt with the rest of the game ensures // May be familiar to first person shooter fans.
// that it stays up to date with the rest of the NPC code.
// //
// Replace occurances of CNPC_ShadowWalker with the new NPC's // npc_lost_soul is a modified version of a manhack inspired by Mallikas'
// classname. Don't forget the lower-case occurance in // HalloweenVilleFour entry, Satanophobia, as well as Doom.
// LINK_ENTITY_TO_CLASS()
// //
// // Author: 1upD
// ASSUMPTIONS MADE:
//
// You're making a character based on CAI_BaseNPC. If this
// is not true, make sure you replace all occurances
// of 'CAI_BaseNPC' in this file with the appropriate
// parent class.
//
// You're making a human-sized NPC that walks.
// //
//=============================================================================// //=============================================================================//
#include "cbase.h" #include "cbase.h"
@ -61,37 +48,6 @@
// memdbgon must be the last include file in a .cpp file!!! // memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h" #include "tier0/memdbgon.h"
//=========================================================
// Private activities
//=========================================================
//int ACT_MYCUSTOMACTIVITY = -1;
//=========================================================
// Custom schedules
//=========================================================
//enum
//{
// SCHED_MYCUSTOMSCHEDULE = LAST_SHARED_SCHEDULE,
//};
//=========================================================
// Custom tasks
//=========================================================
//enum
//{
// TASK_MYCUSTOMTASK = LAST_SHARED_TASK,
//};
//=========================================================
// Custom Conditions
//=========================================================
//enum
//{
// COND_MYCUSTOMCONDITION = LAST_SHARED_CONDITION,
//};
ConVar sk_lostsoul_health("sk_lostsoul_health", "0"); ConVar sk_lostsoul_health("sk_lostsoul_health", "0");
ConVar sk_lostsoul_melee_dmg("sk_lostsoul_melee_dmg", "0"); ConVar sk_lostsoul_melee_dmg("sk_lostsoul_melee_dmg", "0");
@ -290,9 +246,8 @@ int CNPC_LostSoul::OnTakeDamage_Alive(const CTakeDamageInfo &info)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CNPC_LostSoul::DeathSound(const CTakeDamageInfo &info) void CNPC_LostSoul::DeathSound(const CTakeDamageInfo &info)
{ {
StopSound("NPC_Lost_Soul.Stunned"); CPASAttenuationFilter filter2(this, "NPC_LostSoul.Die");
CPASAttenuationFilter filter2(this, "NPC_Lost_Soul.Die"); EmitSound(filter2, entindex(), "NPC_LostSoul.Die");
EmitSound(filter2, entindex(), "NPC_Lost_Soul.Die");
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -337,7 +292,7 @@ void CNPC_LostSoul::PlayFlySound(void)
// Play special engine every once in a while // Play special engine every once in a while
if (gpGlobals->curtime > m_flNextEngineSoundTime && flEnemyDist < 48) if (gpGlobals->curtime > m_flNextEngineSoundTime && flEnemyDist < 48)
{ {
m_flNextEngineSoundTime = gpGlobals->curtime + random->RandomFloat(3.0, 10.0); m_flNextEngineSoundTime = gpGlobals->curtime + random->RandomFloat(0.5, 2.0);
EmitSound("NPC_LostSoul.Float"); EmitSound("NPC_LostSoul.Float");
} }
@ -479,34 +434,17 @@ void CNPC_LostSoul::MoveToTarget(float flInterval, const Vector &vMoveTarget)
myAccel = flDist / flInterval; myAccel = flDist / flInterval;
} }
/*
// Boost vertical movement
if ( targetDir.z > 0 )
{
// Z acceleration is faster when we thrust upwards.
// This is to help keep manhacks out of water.
myZAccel *= 5.0;
}
*/
// Clamp vertical movement // Clamp vertical movement
if (myZAccel > flDist / flInterval) if (myZAccel > flDist / flInterval)
{ {
myZAccel = flDist / flInterval; myZAccel = flDist / flInterval;
} }
// Scale by our engine force
//myAccel *= m_fEnginePowerScale;
//myZAccel *= m_fEnginePowerScale;
MoveInDirection(flInterval, targetDir, myAccel, myZAccel, myDecay); MoveInDirection(flInterval, targetDir, myAccel, myZAccel, myDecay);
// calc relative banking targets // calc relative banking targets
Vector forward, right; Vector forward, right;
GetVectors(&forward, &right, NULL); GetVectors(&forward, &right, NULL);
//m_vTargetBanking.x = 40 * DotProduct(forward, targetDir);
//m_vTargetBanking.z = 40 * DotProduct(right, targetDir);
//m_vTargetBanking.y = 0.0;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -486,9 +486,9 @@ void CNPC_ShadowWalker::PlaySound(string_t soundname, bool required /*= false */
{ {
if (required || gpGlobals->curtime > m_flNextSoundTime) if (required || gpGlobals->curtime > m_flNextSoundTime)
{ {
m_flNextSoundTime = gpGlobals->curtime + random->RandomFloat(1.0, 2.0); m_flNextSoundTime = gpGlobals->curtime + random->RandomFloat(0.5, 1.0);
CPASAttenuationFilter filter2(this, STRING(soundname)); //CPASAttenuationFilter filter2(this, STRING(soundname));
EmitSound(filter2, entindex(), STRING(soundname)); EmitSound(STRING(soundname));
} }
} }