Esempio n. 1
0
/* <6a3b8> ../cstrike/dlls/doors.cpp:508 */
void CBaseDoor::DoorTouch(CBaseEntity *pOther)
{
	entvars_t *pevToucher = pOther->pev;

	// Ignore touches by dead players
	if (pevToucher->deadflag != DEAD_NO)
		return;

	// If door has master, and it's not ready to trigger,
	// play 'locked' sound
	if (!FStringNull(m_sMaster) && !UTIL_IsMasterTriggered(m_sMaster, pOther))
	{
		PlayLockSounds(pev, &m_ls, TRUE, FALSE);
	}

	// If door is somebody's target, then touching does nothing.
	// You have to activate the owner (e.g. button).
	if (!FStringNull(pev->targetname))
	{
		// play locked sound
		PlayLockSounds(pev, &m_ls, TRUE, FALSE);
		return;
	}

	// remember who activated the door
	m_hActivator = pOther;

	if (DoorActivate())
	{
		// Temporarily disable the touch function, until movement is finished.
		SetTouch(NULL);
	}
}
Esempio n. 2
0
void CPython::Holster( int skiplocal /* = 0 */ )
{
	if (m_fInZoom == TRUE) 
	{
		m_pPlayer->b_EstaEnZoom = FALSE;

		#ifndef CLIENT_DLL
				if (!FStringNull (v_model) )
				m_pPlayer->pev->viewmodel = v_model;
				else
				m_pPlayer->pev->viewmodel = MAKE_STRING("models/weapons/357/v_357.mdl");
		#else
				if (!FStringNull (v_model) )
				m_pPlayer->pev->viewmodel = v_model;
				else
				LoadVModel ( "models/weapons/357/v_357.mdl", m_pPlayer );
		#endif
		m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 0; // 0 means reset to default fov
		m_fInZoom = FALSE;
	}

	m_fInReload = FALSE;// cancel any reload in progress.

//	if ( m_fInZoom )
//	{
//		SecondaryAttack();
//	}

	m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0;
	m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
	SendWeaponAnim( PYTHON_IDLE1 );//PYTHON_HOLSTER
}
Esempio n. 3
0
void CCineMonster::Spawn(void)
{
	// pev->solid = SOLID_TRIGGER;
	// UTIL_SetSize(pev, Vector(-8, -8, -8), Vector(8, 8, 8));
	pev->solid = SOLID_NOT;

// REMOVE: The old side-effect
#if 0
	if ( m_iszIdle )
		m_fMoveTo = 4;
#endif

	// if no targetname, start now
	if(FStringNull(pev->targetname) || !FStringNull(m_iszIdle))
	{
		SetThink(&CCineMonster::CineThink);
		pev->nextthink = gpGlobals->time + 1.0;
		// Wait to be used?
		if(pev->targetname)
			m_startTime = gpGlobals->time + 1E6;
	}
	if(pev->spawnflags & SF_SCRIPT_NOINTERRUPT)
		m_interruptable = FALSE;
	else
		m_interruptable = TRUE;
}
Esempio n. 4
0
void CBaseDoor::DoorTouch( CBaseEntity *pOther )
{
	if( !FStringNull( m_iChainTarget ))
		ChainTouch( pOther );

	m_bDoorTouched = true;

	// ignore touches by anything but players and pushables
	if( !pOther->IsPlayer() && !pOther->IsPushable()) return;

	m_hActivator = pOther; // remember who activated the door

	// If door has master, and it's not ready to trigger, 
	// play 'locked' sound
	if( IsLockedByMaster( ))
		PlayLockSounds( pev, &m_ls, TRUE, FALSE );
	
	// If door is somebody's target, then touching does nothing.
	// You have to activate the owner (e.g. button).
	// g-cont. but allow touch for chain doors
	if( !FStringNull( pev->targetname ) && FStringNull( m_iChainTarget ))
	{
		// play locked sound
		PlayLockSounds( pev, &m_ls, TRUE, FALSE );
		return; 
	}

	if( DoorActivate( ))
	{
		// temporarily disable the touch function, until movement is finished.
		SetTouch( NULL );
	}
}
void CBaseDelay :: SUB_UseTargets( CBaseEntity *pActivator, USE_TYPE useType, float value )
{
	//
	// exit immediatly if we don't have a target or kill target
	//
	if (FStringNull(pev->target) && !m_iszKillTarget)
		return;

	//
	// check for a delay
	//
	if (m_flDelay != 0)
	{
		// create a temp object to fire at a later time
		CBaseDelay *pTemp = GetClassPtr( (CBaseDelay *)NULL);
		pTemp->pev->classname = MAKE_STRING("DelayedUse");

		pTemp->SetNextThink( m_flDelay );

		pTemp->SetThink(&CBaseDelay:: DelayThink );
		
		// Save the useType
		pTemp->pev->button = (int)useType;
		pTemp->m_iszKillTarget = m_iszKillTarget;
		pTemp->m_flDelay = 0; // prevent "recursion"
		pTemp->pev->target = pev->target;

		//LRC - Valve had a hacked thing here to avoid breaking
		// save/restore. In Spirit that's not a problem.
		// I've moved m_hActivator into this class, for the "elegant" fix.
		pTemp->m_hActivator = pActivator;

		return;
	}

	//
	// kill the killtargets
	//

	if ( m_iszKillTarget )
	{
		edict_t *pentKillTarget = NULL;

		ALERT( at_aiconsole, "KillTarget: %s\n", STRING(m_iszKillTarget) );
		//LRC- now just USE_KILLs its killtarget, for consistency.
		FireTargets( STRING(m_iszKillTarget), pActivator, this, USE_KILL, 0);
	}
	
	//
	// fire targets
	//
	if (!FStringNull(pev->target))
	{
		FireTargets( STRING(pev->target), pActivator, this, useType, value );
	}
}
//=========================================================
// TryMakeMonster-  check that it's ok to drop a monster.
//=========================================================
void CMonsterMaker::TryMakeMonster( void )
{
	if ( m_iMaxLiveChildren > 0 && m_cLiveChildren >= m_iMaxLiveChildren )
	{// not allowed to make a new one yet. Too many live ones out right now.
		return;
	}

	if ( !m_flGround )
	{
		// set altitude. Now that I'm activated, any breakables, etc should be out from under me. 
		TraceResult tr;

		UTIL_TraceLine ( pev->origin, pev->origin - Vector ( 0, 0, 2048 ), ignore_monsters, ENT(pev), &tr );
		m_flGround = tr.vecEndPos.z;
	}

	Vector mins = pev->origin - Vector( 34, 34, 0 );
	Vector maxs = pev->origin + Vector( 34, 34, 0 );
	maxs.z = pev->origin.z;
	mins.z = m_flGround;

	CBaseEntity *pList[2];
	int count = UTIL_EntitiesInBox( pList, 2, mins, maxs, FL_CLIENT|FL_MONSTER );
	if ( count )
	{
		// don't build a stack of monsters!
		return;
	}

	if (m_fSpawnDelay)
	{
		// If I have a target, fire. (no locus)
		if ( !FStringNull ( pev->target ) )
		{
			// delay already overloaded for this entity, so can't call SUB_UseTargets()
			FireTargets( STRING(pev->target), this, this, USE_TOGGLE, 0 );
		}

//		ALERT(at_console,"Making Monster in %f seconds\n",m_fSpawnDelay);
		SetThink(&CMonsterMaker:: MakeMonsterThink );
		SetNextThink( m_fSpawnDelay );
	}
	else
	{
//		ALERT(at_console,"No delay. Making monster.\n",m_fSpawnDelay);
		CBaseMonster* pMonst = MakeMonster();

		// If I have a target, fire! (the new monster is the locus)
		if ( !FStringNull ( pev->target ) )
		{
			FireTargets( STRING(pev->target), pMonst, this, USE_TOGGLE, 0 );
		}
	}
}
Esempio n. 7
0
void CLightning::Spawn( void )
{
	if ( FStringNull( m_iszSpriteName ) )
	{
		SetThink( SUB_Remove );
		return;
	}
	pev->solid = SOLID_NOT;							// Remove model & collisions
	Precache( );

	pev->dmgtime = gpGlobals->time;

	if ( ServerSide() )
	{
		SetThink( NULL );
		if ( pev->dmg > 0 )
		{
			SetThink( DamageThink );
			pev->nextthink = gpGlobals->time + 0.1;
		}
		if ( pev->targetname )
		{
			if ( !(pev->spawnflags & SF_BEAM_STARTON) )
			{
				pev->effects = EF_NODRAW;
				m_active = 0;
				pev->nextthink = 0;
			}
			else
				m_active = 1;
		
			SetUse( ToggleUse );
		}
	}
	else
	{
		m_active = 0;
		if ( !FStringNull(pev->targetname) )
		{
			SetUse( StrikeUse );
		}
		if ( FStringNull(pev->targetname) || FBitSet(pev->spawnflags, SF_BEAM_STARTON) )
		{
			SetThink( StrikeThink );
			pev->nextthink = gpGlobals->time + 1.0;
		}
	}
}
Esempio n. 8
0
void CMultiSource::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{
	int i = 0;

	// Find the entity in our list
	while (i < m_iTotal)
	{
		if (m_rgEntities[i++] == pCaller)
			break;
	}

	// if we didn't find it, report error and leave
	if (i > m_iTotal)
	{
		ALERT(at_console, "MultiSrc:Used by non member %s.\n", STRING(pCaller->pev->classname));
		return;
	}

	// CONSIDER: a Use input to the multisource always toggles.
	// Could check useType for ON/OFF/TOGGLE
	m_rgTriggered[i - 1] ^= 1;

	if (IsTriggered(pActivator))
	{
		ALERT(at_aiconsole, "Multisource %s enabled (%d inputs)\n", STRING(pev->targetname), m_iTotal);
		USE_TYPE useType = USE_TOGGLE;

		if (!FStringNull(m_globalstate))
		{
			useType = USE_ON;
		}

		SUB_UseTargets(NULL, useType, 0);
	}
}
Esempio n. 9
0
void CAmbientGeneric :: Precache( void )
{
	char* szSoundFile = (char*) STRING(pev->message);

	if ( !FStringNull( pev->message ) && strlen( szSoundFile ) > 1 )
	{
		if (*szSoundFile != '!')
			PRECACHE_SOUND(szSoundFile);
	}
	// init all dynamic modulation parms
	InitModulationParms();

	if ( !FBitSet (pev->spawnflags, AMBIENT_SOUND_START_SILENT ) )
	{
		// start the sound ASAP
		if (m_fLooping)
			m_fActive = TRUE;
	}
	if ( m_fActive )
	{
		UTIL_EmitAmbientSound ( ENT(pev), pev->origin, szSoundFile, 
				(m_dpv.vol * 0.01), m_flAttenuation, SND_SPAWNING, m_dpv.pitch);

		pev->nextthink = gpGlobals->time + 0.1;
	}
}
Esempio n. 10
0
void COsprey::FlyThink( void )
{
	StudioFrameAdvance( );
	pev->nextthink = gpGlobals->time + 0.1;

	if ( m_pGoalEnt == NULL && !FStringNull(pev->target) )// this monster has a target
	{
		m_pGoalEnt = CBaseEntity::Instance( FIND_ENTITY_BY_TARGETNAME ( NULL, STRING( pev->target ) ) );
		UpdateGoal( );
	}

	if (gpGlobals->time > m_startTime + m_dTime)
	{
		if (m_pGoalEnt->pev->speed == 0)
		{
			SetThink( DeployThink );
		}
		do {
			m_pGoalEnt = CBaseEntity::Instance( FIND_ENTITY_BY_TARGETNAME ( NULL, STRING( m_pGoalEnt->pev->target ) ) );
		} while (m_pGoalEnt->pev->speed < 400 && !HasDead());
		UpdateGoal( );
	}

	Flight( );
	ShowDamage( );
}
Esempio n. 11
0
void CLaser::Spawn(void)
{
	if(FStringNull(pev->model))
	{
		SetThink(&CLaser::SUB_Remove);
		return;
	}
	pev->solid = SOLID_NOT; // Remove model & collisions
	Precache();

	SetThink(&CLaser::StrikeThink);
	pev->flags |= FL_CUSTOMENTITY;

	PointsInit(pev->origin, pev->origin);

	if(!m_pSprite && m_iszSpriteName)
		m_pSprite = CSprite::SpriteCreate(STRING(m_iszSpriteName), pev->origin, TRUE);
	else
		m_pSprite = NULL;

	if(m_pSprite)
		m_pSprite->SetTransparency(kRenderGlow, pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z, pev->renderamt, pev->renderfx);

	if(pev->targetname && !(pev->spawnflags & SF_BEAM_STARTON))
		TurnOff();
	else
		TurnOn();
}
//
// Doors not tied to anything (e.g. button, another door) can be touched, to make them activate.
//
void CBaseDoor::DoorTouch( CBaseEntity *pOther )
{
	entvars_t*	pevToucher = pOther->pev;
	
	// Ignore touches by anything but players
	if (!FClassnameIs(pevToucher, "player"))
		return;

	// If door has master, and it's not ready to trigger, 
	// play 'locked' sound

	if (m_sMaster && !UTIL_IsMasterTriggered(m_sMaster, pOther))
		PlayLockSounds(pev, &m_ls, TRUE, FALSE);
	
	// If door is somebody's target, then touching does nothing.
	// You have to activate the owner (e.g. button).
	//LRC- allow flags to override this
	if (!FStringNull(pev->targetname) && !FBitSet(pev->spawnflags,SF_DOOR_FORCETOUCHABLE))
	{
		// play locked sound
		PlayLockSounds(pev, &m_ls, TRUE, FALSE);
		return; 
	}
	
	m_hActivator = pOther;// remember who activated the door

	if (DoorActivate( ))
		SetTouch( NULL ); // Temporarily disable the touch function, until movement is finished.
}
Esempio n. 13
0
//=========================================================
// CWeaponBox - GiveAmmo
//=========================================================
int CWeaponBox::GiveAmmo( int iCount, char *szName, int iMax, int *pIndex/* = NULL*/ )
{
	int i;

	for (i = 1; i < MAX_AMMO_SLOTS && !FStringNull( m_rgiszAmmo[i] ); i++)
	{
		if (stricmp( szName, STRING( m_rgiszAmmo[i])) == 0)
		{
			if (pIndex)
				*pIndex = i;

			int iAdd = min( iCount, iMax - m_rgAmmo[i]);
			if (iCount == 0 || iAdd > 0)
			{
				m_rgAmmo[i] += iAdd;

				return i;
			}
			return -1;
		}
	}
	if (i < MAX_AMMO_SLOTS)
	{
		if (pIndex)
			*pIndex = i;

		m_rgiszAmmo[i] = MAKE_STRING( szName );
		m_rgAmmo[i] = iCount;

		return i;
	}
	ALERT( at_console, "out of named ammo slots\n");
	return i;
}
Esempio n. 14
0
void CPathTrack :: Link( void  )
{
	edict_t *pentTarget;

	if ( !FStringNull(pev->target) )
	{
		pentTarget = FIND_ENTITY_BY_TARGETNAME( NULL, STRING(pev->target) );
		if ( !FNullEnt(pentTarget) )
		{
			m_pnext = CPathTrack::Instance( pentTarget );

			if ( m_pnext )		// If no next pointer, this is the end of a path
			{
				m_pnext->SetPrevious( this );
			}
		}
		else
			ALERT( at_console, "Dead end link %s\n", STRING(pev->target) );
	}

	// Find "alternate" path
	if ( m_altName )
	{
		pentTarget = FIND_ENTITY_BY_TARGETNAME( NULL, STRING(m_altName) );
		if ( !FNullEnt(pentTarget) )
		{
			m_paltpath = CPathTrack::Instance( pentTarget );

			if ( m_paltpath )		// If no next pointer, this is the end of a path
			{
				m_paltpath->SetPrevious( this );
			}
		}
	}
}
Esempio n. 15
0
// lists all doors in the same movement group as this one
int CBaseDoor :: GetDoorMovementGroup( CBaseDoor *pDoorList[], int listMax )
{
	CBaseEntity *pTarget = NULL;
	int count = 0;

	// block all door pieces with the same targetname here.
	if( !FStringNull( pev->targetname ))
	{
		while(( pTarget = UTIL_FindEntityByTargetname( pTarget, STRING( pev->targetname ))) != NULL )
		{
			if( pTarget != this && FClassnameIs( pTarget, GetClassname() ))
			{
				CBaseDoor *pDoor = (CBaseDoor *)pTarget;

				if( pDoor && count < listMax )
				{
					pDoorList[count] = pDoor;
					count++;
				}
			}
		}
	}

	return count;
}
Esempio n. 16
0
void CAK74::Spawn( )
{
	pev->classname = MAKE_STRING("weapon_AK47"); // hack to allow for old names
	Precache( );
//	SET_MODEL(ENT(pev), "models/weapons/ak-47/w_AK47.mdl");
	
	if (!FStringNull (v_model) )
	SET_MODEL( ENT(pev), STRING(w_model) );
	else
	SET_MODEL(ENT(pev), "models/weapons/ak-47/w_AK47.mdl");

	m_iId = WEAPON_AK74;

	if (pev->armorvalue)
	{ 
		if ((pev->armorvalue > AK74_DEFAULT_AMMO) && (pev->armorvalue < 0))
		pev->armorvalue = AK74_DEFAULT_AMMO;

		m_iDefaultAmmo = pev->armorvalue;
	}
	else
	m_iDefaultAmmo = AK74_DEFAULT_AMMO;

	m_fDefaultAnim = 0;//not really necessary, I guess

	FallInit();// get ready to fall down.
}
Esempio n. 17
0
void CInfoCommentary :: GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax)
{
	if (!szModel || !*szModel)
	{
		ALERT(at_error, "cycler at %.0f %.0f %0.f missing modelname", pev->origin.x, pev->origin.y, pev->origin.z );
		REMOVE_ENTITY(ENT(pev));
		return;
	}

	//ignored on subsequent calls
	char* szSoundFile = (char*) STRING(pev->message);

	if ( !FStringNull( pev->message ) && strlen( szSoundFile ) > 1 )
	{
		PRECACHE_SOUND(szSoundFile);
	}
	//ignored on subsequent calls

	pev->classname		= MAKE_STRING("info_commentary");
	PRECACHE_MODEL( szModel );
	SET_MODEL(ENT(pev),	szModel);

	CCycler::Spawn( );

	UTIL_SetSize(pev, vecMin, vecMax);
}
Esempio n. 18
0
/* <694a5> ../cstrike/dlls/doors.cpp:791 */
void CBaseDoor::DoorHitBottom(void)
{
	if (!(pev->spawnflags & SF_DOOR_SILENT))
	{
		STOP_SOUND(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseMoving));
		EMIT_SOUND(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseArrived), VOL_NORM, ATTN_NORM);
	}

	assert(m_toggle_state == TS_GOING_DOWN);
	m_toggle_state = TS_AT_BOTTOM;

	// Re-instate touch method, cycle is complete
	if (pev->spawnflags & SF_DOOR_USE_ONLY)
	{
		// use only door
		SetTouch(NULL);
	}
	else
	{
		// touchable door
		SetTouch(&CBaseDoor::DoorTouch);
	}

	// this isn't finished
	SUB_UseTargets(m_hActivator, USE_TOGGLE, 0);

	// Fire the close target (if startopen is set, then "top" is closed) - netname is the close target
	if (!FStringNull(pev->netname) && !(pev->spawnflags & SF_DOOR_START_OPEN))
	{
		FireTargets(STRING(pev->netname), m_hActivator, this, USE_TOGGLE, 0);
	}
}
Esempio n. 19
0
int CBaseEntity::Restore( CRestore &restore )
{
	int status;

	status = restore.ReadEntVars( "ENTVARS", pev );

	if ( status )
		status = restore.ReadFields( "BASE", this, m_SaveData, ARRAYSIZE(m_SaveData) );

	//LLAPb begin
	//Precache script

	//if ( status )
		//status = restore.ReadScriptVars( "SAMOGON" ... );

	//Find function "LOAD", pass args to it, but don't call it!!!
	//LLAPb end

    if ( pev->modelindex != 0 && !FStringNull(pev->model) )
	{
		Vector mins, maxs;
		mins = pev->mins;	// Set model is about to destroy these
		maxs = pev->maxs;


		PRECACHE_MODEL( (char *)STRING(pev->model) );
		SET_MODEL(ENT(pev), STRING(pev->model));
		UTIL_SetSize(pev, mins, maxs);	// Reset them
	}

	return status;
}
Esempio n. 20
0
/* <ccd07> ../cstrike/dlls/h_cycler.cpp:468 */
void CWreckage::__MAKE_VHOOK(Precache)()
{
	if (!FStringNull(pev->model))
	{
		PRECACHE_MODEL((char *)STRING(pev->model));
	}
}
Esempio n. 21
0
void CRadiomsg :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{

	CBaseEntity *pPlayer = UTIL_FindEntityByClassname ( NULL,"player" );

	char	txt [256];
	sprintf ( txt, STRING(m_iszText));
	int		len = strlen ( txt );


	MESSAGE_BEGIN( MSG_ONE, gmsgRadioMsg, NULL, pPlayer->pev );

		WRITE_COORD ( gpGlobals->time );
		WRITE_LONG	( m_iHead );
		WRITE_LONG	( len );

		for ( int i=0; i<180; i++ ) {
			WRITE_BYTE	( txt[i] );	}


	MESSAGE_END();


	if ( FStringNull ( m_iszSentence ) )
		return;

//	EMIT_SOUND_SUIT(pPlayer->edict(), STRING(m_iszSentence) );

	EMIT_SOUND_DYN(pPlayer->edict(), CHAN_STATIC, STRING(m_iszSentence), 1.0, ATTN_NORM, 0, 100);


}
Esempio n. 22
0
BOOL CMultiSource::__MAKE_VHOOK(IsTriggered)(CBaseEntity *)
{
	// Is everything triggered?
	int i = 0;

	// Still initializing?
	if (pev->spawnflags & SF_MULTI_INIT)
		return FALSE;

	while (i < m_iTotal)
	{
		if (m_rgTriggered[i] == 0)
			break;
		i++;
	}

	if (i == m_iTotal)
	{
		if (FStringNull(m_globalstate) || gGlobalState.EntityGetState(m_globalstate) == GLOBAL_ON)
		{
			return TRUE;
		}
	}

	return FALSE;
}
Esempio n. 23
0
void CTriggerSubModel :: ChangeSub ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
	if ( FStringNull ( pev->target ) )
		return;

	edict_t *pentTarget = FIND_ENTITY_BY_TARGETNAME ( NULL, STRING(pev->target) );

	if ( FNullEnt(pentTarget) )
	{
		ALERT ( at_console, "CTriggerSubModel : pas d'entite s appelant %s\n", STRING(pev->target) );
		return;
	}

	CBaseEntity *pTarget = Instance( pentTarget );

	if ( pTarget->MyMonsterPointer() == NULL )
	{
		ALERT ( at_console, "CTriggerSubModel : %s n est pas un monstre\n", STRING(pev->target) );
		return;
	}

	CBaseMonster *pMonster = (CBaseMonster*)pTarget;
	
	pMonster->SetBodygroup( m_iBodygroup, m_iSubmodel);
}
Esempio n. 24
0
void CCineMonster::Spawn( void )
{
	// SetSolidType( SOLID_TRIGGER );
	// SetSize( Vector(-8, -8, -8), Vector(8, 8, 8));
	SetSolidType( SOLID_NOT );


	// REMOVE: The old side-effect
#if 0
	if( m_iszIdle )
		m_fMoveTo = 4;
#endif

	// if no targetname, start now
	if( !HasTargetname() || !FStringNull( m_iszIdle ) )
	{
		SetThink( &CCineMonster::CineThink );
		SetNextThink( gpGlobals->time + 1.0 );
		// Wait to be used?
		if( HasTargetname() )
			m_startTime = gpGlobals->time + 1E6;
	}
	if( GetSpawnFlags().Any( SF_SCRIPT_NOINTERRUPT ) )
		m_interruptable = false;
	else
		m_interruptable = true;
}
Esempio n. 25
0
//=========================================================
// StartMonster
//=========================================================
void CSquadMonster :: StartMonster( void )
{
    CBaseMonster :: StartMonster();

    if ( ( m_afCapability & bits_CAP_SQUAD ) && !InSquad() )
    {
        if ( !FStringNull( pev->netname ) )
        {
            // if I have a groupname, I can only recruit if I'm flagged as leader
            if ( !( pev->spawnflags & SF_SQUADMONSTER_LEADER ) )
            {
                return;
            }
        }

        // try to form squads now.
        int iSquadSize = SquadRecruit( 1024, 4 );

        if ( iSquadSize )
        {
            ALERT ( at_aiconsole, "Squad of %d %s formed\n", iSquadSize, STRING( pev->classname ) );
        }

        if ( IsLeader() && FClassnameIs ( pev, "monster_human_grunt" ) )
        {
            SetBodygroup( 1, 1 ); // UNDONE: truly ugly hack
            pev->skin = 0;
        }

    }
}
Esempio n. 26
0
/*
	BOOL				 m_bUspSilAdd;//usp
	BOOL				 m_bMp5SilAdd;//mp5
	BOOL				 m_bM16SilAdd;//m16
*/
void CMP5::Spawn( )
{
	pev->classname = MAKE_STRING("weapon_9mmAR"); // hack to allow for old names
	Precache( );

	if (!FStringNull (v_model) )
	SET_MODEL( ENT(pev), STRING(w_model) );
	else
	SET_MODEL(ENT(pev), "models/weapons/MP5/w_MP5.mdl");

	m_iId = WEAPON_MP5;

    m_fDefaultAnim = SILENCER_OFF_FULLAUTO; //to define on startup if the silencer added or not
//	m_iDefaultAmmo = 30; //SP: MP5_DEFAULT_GIVE;


	if (pev->armorvalue)
	{ 
		if ((pev->armorvalue > MP5_MAX_CLIP) && (pev->armorvalue < 0))
		pev->armorvalue = MP5_MAX_CLIP;

		m_iDefaultAmmo = pev->armorvalue;
	}
	else m_iDefaultAmmo = MP5_DEFAULT_GIVE; 



//	m_bMp5SilAdd = FALSE;     // Have we been initialised

	FallInit();// get ready to fall down.
}
void COsprey::FlyThink( void )
{
	StudioFrameAdvance( );
	SetNextThink( 0.1 );

	if ( m_pGoalEnt == NULL && !FStringNull(pev->target) )// this monster has a target
	{
		m_pGoalEnt = UTIL_FindEntityByTargetname( NULL, STRING( pev->target ) );
		UpdateGoal( );
	}

	if (gpGlobals->time > m_startTime + m_dTime)
	{
		if (m_pGoalEnt->pev->speed == 0)
		{
			SetThink(&COsprey:: DeployThink );
		}
		int loopbreaker = 100; //LRC - <slap> don't loop indefinitely!
		do {
			m_pGoalEnt = UTIL_FindEntityByTargetname( NULL, STRING( m_pGoalEnt->pev->target ) );
			loopbreaker--; //LRC
		} while (m_pGoalEnt->pev->speed < 400 && !HasDead() && loopbreaker > 0);
		UpdateGoal( );
	}

	Flight( );
	ShowDamage( );
}
Esempio n. 28
0
void CFuncVehicle::Restart()
{
	ALERT(at_console, "M_speed = %f\n", m_speed);

	pev->speed = 0;
	pev->velocity = g_vecZero;
	pev->avelocity = g_vecZero;
	pev->impulse = int(m_speed);

	m_dir = 1;
	m_flTurnStartTime = -1;
	m_flUpdateSound = -1;
	m_pDriver = nullptr;

	if (FStringNull(pev->target))
	{
		ALERT(at_console, "Vehicle with no target");
	}

	UTIL_SetOrigin(pev, pev->oldorigin);
	STOP_SOUND(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noise));

	NextThink(pev->ltime + 0.1f, FALSE);
	SetThink(&CFuncVehicle::Find);
}
Esempio n. 29
0
void CLegacyCineMonster :: CineSpawn( char *szModel )
{
    PRECACHE_MODEL(szModel);
    SET_MODEL(ENT(pev), szModel);
    UTIL_SetSize(pev, Vector(-16, -16, 0), Vector(16, 16, 64));

    pev->solid			= SOLID_SLIDEBOX;
    pev->movetype		= MOVETYPE_STEP;
    pev->effects		= 0;
    pev->health			= 1;
    pev->yaw_speed		= 10;

    // ugly alpha hack, can't set ints from the bsp.
    pev->sequence		= (int)pev->impulse;
    ResetSequenceInfo( );
    pev->framerate = 0.0;

    m_bloodColor = BLOOD_COLOR_RED;

    // if no targetname, start now
    if ( FStringNull(pev->targetname) )
    {
        SetThink( &CLegacyCineMonster::CineThink );
        pev->nextthink += 1.0;
    }
}
Esempio n. 30
0
/* <2469b9> ../cstrike/dlls/wpn_shared/wpn_c4.cpp:50 */
void CC4::__MAKE_VHOOK(Spawn)(void)
{
	SET_MODEL(edict(), "models/w_backpack.mdl");

	pev->frame = 0;
	pev->body = 3;
	pev->sequence = 0;
	pev->framerate = 0;

	m_iId = WEAPON_C4;
	m_iDefaultAmmo = C4_DEFAULT_GIVE;
	m_bStartedArming = false;
	m_fArmedTime = 0;

	if (!FStringNull(pev->targetname))
	{
		pev->effects |= EF_NODRAW;
		DROP_TO_FLOOR(edict());

		return;
	}

	FallInit();
	SetThink(&CBasePlayerItem::FallThink);
	pev->nextthink = UTIL_WeaponTimeBase() + 0.1;
}