hlsdk-xash3d/dlls/cthulhu/laserspot.cpp

85 lines
1.8 KiB
C++
Executable File

#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "weapons.h"
#include "nodes.h"
#include "player.h"
#include "gamerules.h"
LINK_ENTITY_TO_CLASS( laser_spot, CLaserSpot );
//=========================================================
CLaserSpot *CLaserSpot::CreateSpot( void )
{
CLaserSpot *pSpot = GetClassPtr( (CLaserSpot *)NULL );
pSpot->Spawn();
pSpot->pev->classname = MAKE_STRING("laser_spot");
return pSpot;
}
//=========================================================
//=========================================================
CLaserSpot *CLaserSpot::CreateSpot( const char* spritename )
{
CLaserSpot *pSpot = CreateSpot();
SET_MODEL(ENT(pSpot->pev), spritename);
return pSpot;
}
//=========================================================
//=========================================================
void CLaserSpot::Spawn( void )
{
Precache( );
pev->movetype = MOVETYPE_NONE;
pev->solid = SOLID_NOT;
pev->rendermode = kRenderGlow;
pev->renderfx = kRenderFxNoDissipation;
pev->renderamt = 255;
SET_MODEL(ENT(pev), "sprites/laserdot.spr");
UTIL_SetOrigin( this, pev->origin );
};
//=========================================================
// Suspend- make the laser sight invisible.
//=========================================================
void CLaserSpot::Suspend( float flSuspendTime )
{
pev->effects |= EF_NODRAW;
//LRC: -1 means suspend indefinitely
if (flSuspendTime == -1)
{
SetThink( NULL );
}
else
{
SetThink( Revive );
SetNextThink( flSuspendTime );
}
}
//=========================================================
// Revive - bring a suspended laser sight back.
//=========================================================
void CLaserSpot::Revive( void )
{
pev->effects &= ~EF_NODRAW;
SetThink( NULL );
}
void CLaserSpot::Precache( void )
{
PRECACHE_MODEL("sprites/laserdot.spr");
};