102 lines
2.5 KiB
C++
Raw Normal View History

2017-12-18 02:39:44 +03:00
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#if !defined( OEM_BUILD )
#include "extdll.h"
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "weapons.h"
#include "nodes.h"
#include "player.h"
#include "gamerules.h"
#ifndef CLIENT_DLL
LINK_ENTITY_TO_CLASS( laser_spot, CLaserSpot )
2017-12-18 02:39:44 +03:00
//=========================================================
//=========================================================
CLaserSpot *CLaserSpot::CreateSpot( void )
{
CLaserSpot *pSpot = GetClassPtr( (CLaserSpot *)NULL );
pSpot->Spawn();
2016-07-31 18:48:50 +05:00
pSpot->pev->classname = MAKE_STRING( "laser_spot" );
2017-12-18 02:39:44 +03:00
return pSpot;
}
//=========================================================
//=========================================================
CLaserSpot *CLaserSpot::CreateSpot( const char* spritename )
{
CLaserSpot *pSpot = CreateSpot();
SET_MODEL(ENT(pSpot->pev), spritename);
return pSpot;
}
//=========================================================
//=========================================================
void CLaserSpot::Spawn( void )
{
2016-07-31 18:48:50 +05:00
Precache();
2017-12-18 02:39:44 +03:00
pev->movetype = MOVETYPE_NONE;
pev->solid = SOLID_NOT;
pev->rendermode = kRenderGlow;
pev->renderfx = kRenderFxNoDissipation;
pev->renderamt = 255;
2016-07-31 18:48:50 +05:00
SET_MODEL( ENT( pev ), "sprites/laserdot.spr" );
2017-12-18 02:39:44 +03:00
UTIL_SetOrigin( this, pev->origin );
};
//=========================================================
// Suspend- make the laser sight invisible.
//=========================================================
void CLaserSpot::Suspend( float flSuspendTime )
{
pev->effects |= EF_NODRAW;
2016-07-31 18:48:50 +05:00
2017-12-18 02:39:44 +03:00
//LRC: -1 means suspend indefinitely
if (flSuspendTime == -1)
{
SetThink( NULL );
}
else
{
2016-06-04 18:24:23 +05:00
SetThink( &CLaserSpot::Revive );
2017-12-18 02:39:44 +03:00
SetNextThink( flSuspendTime );
}
}
//=========================================================
// Revive - bring a suspended laser sight back.
//=========================================================
void CLaserSpot::Revive( void )
{
pev->effects &= ~EF_NODRAW;
SetThink( NULL );
}
void CLaserSpot::Precache( void )
{
2016-07-31 18:48:50 +05:00
PRECACHE_MODEL( "sprites/laserdot.spr" );
2016-06-25 23:21:01 +05:00
}
2017-12-18 02:39:44 +03:00
#endif
#endif