Fix xenmaker sprite effects.

Fix xenmaker monsters not fading after death.
This commit is contained in:
Giegue
2023-10-21 14:01:48 -03:00
parent 8ed6c4eb2b
commit f57c7760f7
3 changed files with 10 additions and 21 deletions

View File

@@ -65,8 +65,6 @@ public:
int m_iMonsterIndex;// index of the monster that will be created. int m_iMonsterIndex;// index of the monster that will be created.
float m_flGround; // z coord of the ground under me, used to make sure no monsters are under the spawner
float m_flBeamRadius; // Maximum beam strike radius. float m_flBeamRadius; // Maximum beam strike radius.
int m_iBeamAlpha; int m_iBeamAlpha;
int m_iBeamCount; // Number of single beam instances. int m_iBeamCount; // Number of single beam instances.

View File

@@ -78,11 +78,14 @@ public:
inline void SetBrightness( int brightness ) { pev->renderamt = brightness; } inline void SetBrightness( int brightness ) { pev->renderamt = brightness; }
inline void AnimateAndDie( float framerate ) inline void AnimateAndDie( float framerate )
{ {
SetThink(&CMSprite::AnimateUntilDead); pev->effects = 0;
SetThink(&CMSprite::AnimateUntilDead);
pev->framerate = framerate; pev->framerate = framerate;
pev->dmgtime = gpGlobals->time + (m_maxFrame / framerate); pev->dmgtime = gpGlobals->time + (m_maxFrame / framerate);
pev->nextthink = gpGlobals->time; pev->nextthink = gpGlobals->time;
m_lastTime = gpGlobals->time;
pev->frame = 0;
} }
void EXPORT AnimateUntilDead( void ); void EXPORT AnimateUntilDead( void );

View File

@@ -136,7 +136,6 @@ void CMXenMaker::Spawn()
SetUse(&CMXenMaker::CyclicUse); // drop one monster each time we fire SetUse(&CMXenMaker::CyclicUse); // drop one monster each time we fire
SetThink(&CMXenMaker::SUB_DoNothing); SetThink(&CMXenMaker::SUB_DoNothing);
m_flGround = 0;
pev->classname = MAKE_STRING("env_xenmaker"); pev->classname = MAKE_STRING("env_xenmaker");
} }
@@ -158,15 +157,6 @@ void CMXenMaker::Precache(void)
//========================================================= //=========================================================
void CMXenMaker::StartEffect(void) void CMXenMaker::StartEffect(void)
{ {
if (!m_flGround)
{
// setup altitude
TraceResult tr;
UTIL_TraceLine(pev->origin, pev->origin - Vector(0, 0, 2048), ignore_monsters, ENT(pev), &tr);
m_flGround = tr.vecEndPos.z;
}
if (!FBitSet(pev->spawnflags, SF_XENMAKER_NO_SPAWN)) if (!FBitSet(pev->spawnflags, SF_XENMAKER_NO_SPAWN))
{ {
// monstermaker incorrectly setup // monstermaker incorrectly setup
@@ -178,17 +168,15 @@ void CMXenMaker::StartEffect(void)
edict_t *pent; edict_t *pent;
Vector mins = pev->origin - Vector(34, 34, 0); Vector mins = pev->origin - Vector(34, 34, 34);
Vector maxs = pev->origin + Vector(34, 34, 0); Vector maxs = pev->origin + Vector(34, 34, 34);
maxs.z = pev->origin.z;
mins.z = m_flGround;
edict_t *pList[2]; edict_t *pList[2];
int count = UTIL_EntitiesInBox(pList, 2, mins, maxs, FL_CLIENT | FL_MONSTER); int count = UTIL_EntitiesInBox(pList, 2, mins, maxs, FL_CLIENT | FL_MONSTER);
if (!count) if (!count)
{ {
// Attempt to spawn monster // Attempt to spawn monster
pent = spawn_monster(m_iMonsterIndex, pev->origin, pev->angles, SF_MONSTER_FALL_TO_GROUND, NULL); pent = spawn_monster(m_iMonsterIndex, pev->origin, pev->angles, SF_MONSTER_FADECORPSE, NULL);
if (pent == NULL) if (pent == NULL)
{ {
ALERT(at_console, "[MONSTER] XenMaker - failed to spawn monster! targetname: \"%s\"\n", STRING(pev->targetname)); ALERT(at_console, "[MONSTER] XenMaker - failed to spawn monster! targetname: \"%s\"\n", STRING(pev->targetname));