Ejemplo n.º 1
0
// Lists all doors in the same movement group as this one
int CBaseDoor::GetDoorMovementGroup( CBaseDoor *pDoorList[], int listMax )
{
	int count = 0;
	CBaseEntity	*pTarget = NULL;

	// Block all door pieces with the same targetname here.
	if ( GetEntityName() != NULL_STRING )
	{
		for (;;)
		{
			pTarget = gEntList.FindEntityByName( pTarget, GetEntityName(), NULL );

			if ( pTarget != this )
			{
				if ( !pTarget )
					break;

				CBaseDoor *pDoor = dynamic_cast<CBaseDoor *>(pTarget);

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

	return count;
}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropCrane::Activate( void )
{
	BaseClass::Activate();

	// If we load a game, we don't need to set this all up again.
	if ( m_hCraneMagnet )
		return;

	// Find our magnet
	if ( m_iszMagnetName == NULL_STRING )
	{
		Warning( "prop_vehicle_crane %s has no magnet entity specified!\n", STRING(GetEntityName()) );
		UTIL_Remove( this );
		return;
	}

	m_hCraneMagnet = dynamic_cast<CPhysMagnet *>(gEntList.FindEntityByName( NULL, STRING(m_iszMagnetName) ));
	if ( !m_hCraneMagnet )
	{
		Warning( "prop_vehicle_crane %s failed to find magnet %s.\n", STRING(GetEntityName()), STRING(m_iszMagnetName) );
		UTIL_Remove( this );
		return;
	}

	// We want the magnet to cast a long shadow
	m_hCraneMagnet->SetShadowCastDistance( 2048 );

	// Create our constraint group
	constraint_groupparams_t group;
	group.Defaults();
	m_pConstraintGroup = physenv->CreateConstraintGroup( group );
	m_hCraneMagnet->SetConstraintGroup( m_pConstraintGroup );

	// Create our crane tip
	Vector vecOrigin;
	QAngle vecAngles;
	GetCraneTipPosition( &vecOrigin, &vecAngles );
	m_hCraneTip = CCraneTip::Create( m_hCraneMagnet, m_pConstraintGroup, vecOrigin, vecAngles );
	if ( !m_hCraneTip )
	{
		UTIL_Remove( this );
		return;
	}
	m_pConstraintGroup->Activate();

	// Make a rope to connect 'em
	int iIndex = m_hCraneMagnet->LookupAttachment("magnetcable_a");
	m_hRope = CRopeKeyframe::Create( this, m_hCraneMagnet, 1, iIndex );
	if ( m_hRope )
	{
		m_hRope->m_Width = 3;
		m_hRope->m_nSegments = ROPE_MAX_SEGMENTS / 2;
		m_hRope->EnableWind( false );
		m_hRope->SetupHangDistance( 0 );
		m_hRope->m_RopeLength = (m_hCraneMagnet->GetAbsOrigin() - m_hCraneTip->GetAbsOrigin()).Length() * 1.1;
	}

	// Start with the magnet off
	TurnMagnetOff();
}
Ejemplo n.º 3
0
bool CFuncLadderEndPoint::Validate()
{
	// Find the the other end
	Vector startPos = GetAbsOrigin();
	
	CFuncLadderEndPoint *other = dynamic_cast< CFuncLadderEndPoint * >( GetNextTarget() );
	if ( !other )
	{
		DevMsg( 1, "func_ladderendpoint(%s) without matching target\n", STRING(GetEntityName()) );
		return false;
	}

	Vector endPos = other->GetAbsOrigin();

	CFuncLadder *ladder = ( CFuncLadder * )CreateEntityByName( "func_useableladder" );
	if ( ladder )
	{
		ladder->SetEndPoints( startPos, endPos );
		ladder->SetAbsOrigin( GetAbsOrigin() );
		ladder->SetParent( GetParent() );
		ladder->SetName( GetEntityName() );
		ladder->Spawn();
	}

	// Delete both endpoints
	UTIL_Remove( other );
	UTIL_Remove( this );

	return true;
}
static void Put( const char *name, const TNetInputValue &value )
{
	FILE *fout = 0;

	if (dump)
	{
		fout = fopen("netinput.log", "at");
	}

	FILETIME tm;
	GetSystemTimeAsFileTime(&tm);
	ITextModeConsole *pTMC = gEnv->pSystem->GetITextModeConsole();

	if (lastFrame != gEnv->pRenderer->GetFrameID())
	{
		ypos = 0;
		lastFrame = gEnv->pRenderer->GetFrameID();
		tstamp = (uint64(tm.dwHighDateTime) << 32) | tm.dwLowDateTime;
	}

	float white[] = {1, 1, 1, 1};
	char buf[256];

	if (const Vec3 *pVec = value.GetPtr<Vec3>())
	{
		sprintf(buf, "%s: %f %f %f", name, pVec->x, pVec->y, pVec->z);
		gEnv->pRenderer->Draw2dLabel(10.f, (float)(ypos += 20), 2.f, white, false, "%s", buf);

		if (pTMC)
		{
			pTMC->PutText( 0, ypos / 20, buf );
		}

		if (fout)
		{
			fprintf(fout, "%I64d %s %s %f %f %f\n", tstamp, GetEntityName(), name, pVec->x, pVec->y, pVec->z);
		}
	}
	else if (const float *pFloat = value.GetPtr<float>())
	{
		sprintf(buf, "%s: %f", name, *pFloat);
		gEnv->pRenderer->Draw2dLabel(10.f, (float)(ypos += 20), 2, white, false, "%s", buf);

		if (pTMC)
		{
			pTMC->PutText( 0, ypos / 20, buf );
		}

		if (fout)
		{
			fprintf(fout, "%I64d %s %s %f\n", tstamp, GetEntityName(), name, *pFloat);
		}
	}

	if (fout)
	{
		fclose(fout);
	}
}
Ejemplo n.º 5
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CEnvBeam::Spawn( void )
{
	if ( !m_iszSpriteName )
	{
		SetThink( &CEnvBeam::SUB_Remove );
		return;
	}

	BaseClass::Spawn();

	m_noiseAmplitude = MIN(MAX_BEAM_NOISEAMPLITUDE, m_noiseAmplitude);

	// Check for tapering
	if ( HasSpawnFlags( SF_BEAM_TAPEROUT ) )
	{
		SetWidth( m_boltWidth );
		SetEndWidth( 0 );
	}
	else
	{
		SetWidth( m_boltWidth );
		SetEndWidth( GetWidth() );	// Note: EndWidth is not scaled
	}

	if ( ServerSide() )
	{
		SetThink( &CEnvBeam::UpdateThink );
		SetNextThink( gpGlobals->curtime );
		SetFireTime( gpGlobals->curtime );

		if ( GetEntityName() != NULL_STRING )
		{
			if ( !(m_spawnflags & SF_BEAM_STARTON) )
			{
				AddEffects( EF_NODRAW );
				m_active = 0;
				SetNextThink( TICK_NEVER_THINK );
			}
			else
			{
				m_active = 1;
			}
		}
	}
	else
	{
		m_active = 0;
		if ( !GetEntityName() || FBitSet(m_spawnflags, SF_BEAM_STARTON) )
		{
			SetThink( &CEnvBeam::StrikeThink );
			SetNextThink( gpGlobals->curtime + 1.0f );
		}
	}

}
Ejemplo n.º 6
0
void CStructure::StartTurn()
{
	BaseClass::StartTurn();

	FindGround();

	if (!GetSupplier() && !dynamic_cast<CCPU*>(this))
	{
		if (GetPlayerOwner())
			GetPlayerOwner()->RemoveUnit(this);
		SetSupplier(NULL);
	}

	if (GetSupplier() && !GetSupplier()->GetPlayerOwner())
	{
		GetSupplier()->RemoveChild(this);
		if (GetPlayerOwner())
			GetPlayerOwner()->RemoveUnit(this);
		SetSupplier(NULL);
	}

	if (GetPlayerOwner() == NULL)
		return;

	if (IsConstructing())
	{
		m_iTurnsToConstruct--;

		if (m_iTurnsToConstruct == (size_t)0)
		{
			GetDigitanksPlayer()->AppendTurnInfo(tstring("Construction finished on ") + GetEntityName());
			CompleteConstruction();

			GetDigitanksPlayer()->AddActionItem(this, ACTIONTYPE_NEWSTRUCTURE);
		}
		else
			GetDigitanksPlayer()->AppendTurnInfo(tsprintf(tstring("Constructing ") + GetEntityName() + " (%d turns left)", m_iTurnsToConstruct.Get()));
	}

	if (IsUpgrading())
	{
		m_iTurnsToUpgrade--;

		if (m_iTurnsToUpgrade == (size_t)0)
		{
			GetDigitanksPlayer()->AppendTurnInfo(GetEntityName() + " finished upgrading.");

			UpgradeComplete();
		}
		else
			GetDigitanksPlayer()->AppendTurnInfo(tsprintf(tstring("Upgrading ") + GetEntityName() + " (%d turns left)", GetTurnsToUpgrade()));
	}
}
Ejemplo n.º 7
0
//-----------------------------------------------------------------------------
// Purpose: If we've got a speaker, add ourselves to the list of microphones that want to listen
//-----------------------------------------------------------------------------
void CEnvMicrophone::ActivateSpeaker( void )
{
	// If we're enabled, set the dsp_speaker preset to my specified one
	if ( !m_bDisabled )
	{
		ConVarRef dsp_speaker( "dsp_speaker" );
		if ( dsp_speaker.IsValid() )
		{
			int iDSPPreset = m_iSpeakerDSPPreset;
			if ( !iDSPPreset )
			{
				// Reset it to the default
				iDSPPreset = atoi( dsp_speaker.GetDefault() );
			}
			DevMsg( 2, "Microphone %s set dsp_speaker to %d.\n", STRING(GetEntityName()), iDSPPreset);
			dsp_speaker.SetValue( m_iSpeakerDSPPreset );
		}
	}

	if ( m_iszSpeakerName != NULL_STRING )
	{
		// We've got a speaker to play heard sounds through. To do this, we need to add ourselves 
		// to the list of microphones who want to be told whenever a sound is played.
		if ( s_Microphones.Find(this) == -1 )
		{
			s_Microphones.AddToTail( this );
		}
	}
}
//-----------------------------------------------------------------------------
// Purpose: Pick up a specified object
// Input  : &inputdata - 
//-----------------------------------------------------------------------------
void CNPC_CombineDropship::InputPickup( inputdata_t &inputdata )
{
	// Can't pickup if we're already carrying something
	if ( m_hContainer )
	{
		Warning("npc_combinedropship %s was told to pickup, but is already carrying something.\n", STRING(GetEntityName()) );
		return;
	}

	string_t iszTargetName = inputdata.value.StringID();
	if ( iszTargetName == NULL_STRING )
	{
		Warning("npc_combinedropship %s tried to pickup with no specified pickup target.\n", STRING(GetEntityName()) );
		return;
	}
	CBaseEntity *pTarget = gEntList.FindEntityByName( NULL, iszTargetName, NULL );
	if ( !pTarget )
	{
		Warning("npc_combinedropship %s couldn't find pickup target named %s\n", STRING(GetEntityName()), STRING(iszTargetName) );
		return;
	}

	// Start heading to the point
	m_hPickupTarget = pTarget;
	// Disable collisions to my target
	m_hPickupTarget->SetOwnerEntity(this);
	if ( m_NPCState == NPC_STATE_IDLE )
	{
		SetState( NPC_STATE_ALERT );
	}
	m_iLandState = LANDING_SWOOPING;
	m_flLandingSpeed = GetAbsVelocity().Length();
}
//-----------------------------------------------------------------------------
// Purpose: Called after spawning on map load or on a load from save game.
//-----------------------------------------------------------------------------
void CNPC_CombineDropship::Activate( void )
{
	BaseClass::Activate();
	
	// check for valid template
	if (!m_sNPCTemplateData)
	{
		//
		// This must be the first time we're activated, not a load from save game.
		// Look up the template in the template database.
		//
		if (!m_sNPCTemplate)
		{
			Warning( "npc_template_maker %s has no template NPC!\n", GetEntityName() );
			return;
		}
		else
		{
			m_sNPCTemplateData = Templates_FindByTargetName(STRING(m_sNPCTemplate));
			if ( m_sNPCTemplateData == NULL_STRING )
			{
				Warning( "Template NPC %s not found!\n", STRING(m_sNPCTemplate) );
				return;
			}
		}
	}

}
Ejemplo n.º 10
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CNPC_VehicleDriver::InputGotoPathCorner( inputdata_t &inputdata )
{
	string_t iszPathName = inputdata.value.StringID();
	if ( iszPathName != NULL_STRING )
	{
		CBaseEntity *pEntity = gEntList.FindEntityByName( NULL, iszPathName );
		if ( !pEntity )
		{
			Warning("npc_vehicledriver %s couldn't find entity named %s\n", STRING(GetEntityName()), STRING(iszPathName) );
			return;
		}

		ClearWaypoints();

		// Drive to the point
		SetGoalEnt( pEntity );
		if ( m_NPCState == NPC_STATE_IDLE )
		{
			SetState( NPC_STATE_ALERT );
		}
		SetCondition( COND_PROVOKED );

		// Force him to start forward
		InputStartForward( inputdata );
	}
}
Ejemplo n.º 11
0
void CWorldItem::Spawn( void )
{
	CBaseEntity *pEntity = NULL;

	switch (m_iType) 
	{
	case 44: // ITEM_BATTERY:
		pEntity = CBaseEntity::Create( "item_battery", GetLocalOrigin(), GetLocalAngles() );
		break;
	case 45: // ITEM_SUIT:
		pEntity = CBaseEntity::Create( "item_suit", GetLocalOrigin(), GetLocalAngles() );
		break;
	}

	if (!pEntity)
	{
		Warning("unable to create world_item %d\n", m_iType );
	}
	else
	{
		pEntity->m_target = m_target;
		pEntity->SetName( GetEntityName() );
		pEntity->ClearSpawnFlags();
		pEntity->AddSpawnFlags( m_spawnflags );
	}

	UTIL_RemoveImmediate( this );
}
Ejemplo n.º 12
0
void CFuncBrush::Spawn( void )
{
	SetMoveType( MOVETYPE_PUSH );  // so it doesn't get pushed by anything

	SetSolid( SOLID_VPHYSICS );
	AddEFlags( EFL_USE_PARTITION_WHEN_NOT_SOLID );

	if ( m_iSolidity == BRUSHSOLID_NEVER )
	{
		AddSolidFlags( FSOLID_NOT_SOLID );
	}

	SetModel( STRING( GetModelName() ) );

	if ( m_iDisabled )
		TurnOff();
	
	// If it can't move/go away, it's really part of the world
	if ( !GetEntityName() || !m_iParent )
		AddFlag( FL_WORLDBRUSH );

	CreateVPhysics();

	// Slam the object back to solid - if we really want it to be solid.
	if ( m_bSolidBsp )
	{
		SetSolid( SOLID_BSP );
	}
}
void CPoseController::InputGetFMod( inputdata_t &inputdata )
{
	DevMsg( "FMod values for pose controller %s\nTYPE: %i\nTIME OFFSET: %f\nRATE: %f\nAMPLITUDE: %f\n", 
			STRING(GetEntityName()), 
			m_nFModType.Get(), 
			m_fFModTimeOffset.Get(), 
			m_fFModRate.Get(), 
			m_fFModAmplitude.Get() );
}
Ejemplo n.º 14
0
//-----------------------------------------------------------------------------
// Activate!
//-----------------------------------------------------------------------------
void CPathTrack::Activate( void )
{
	BaseClass::Activate();

	if ( GetEntityName() != NULL_STRING )		// Link to next, and back-link
	{
		Link();
	}
}
Ejemplo n.º 15
0
void CTemplateNPCMaker::Precache()
{
	BaseClass::Precache();

	if ( !m_iszTemplateData )
	{
		//
		// This must be the first time we're activated, not a load from save game.
		// Look up the template in the template database.
		//
		if (!m_iszTemplateName)
		{
			Warning( "npc_template_maker %s has no template NPC!\n", STRING(GetEntityName()) );
			UTIL_Remove( this );
			return;
		}
		else
		{
			m_iszTemplateData = Templates_FindByTargetName(STRING(m_iszTemplateName));
			if ( m_iszTemplateData == NULL_STRING )
			{
				DevWarning( "npc_template_maker %s: template NPC %s not found!\n", STRING(GetEntityName()), STRING(m_iszTemplateName) );
				UTIL_Remove( this );
				return;
			}
		}
	}

	Assert( m_iszTemplateData != NULL_STRING );

	// If the mapper marked this as "preload", then instance the entity preache stuff and delete the entity
	//if ( !HasSpawnFlags(SF_NPCMAKER_NOPRELOADMODELS) )
	if ( m_iszTemplateData != NULL_STRING )
	{
		CBaseEntity *pEntity = NULL;
		MapEntity_ParseEntity( pEntity, STRING(m_iszTemplateData), NULL );
		if ( pEntity != NULL )
		{
			PrecacheTemplateEntity( pEntity );
			UTIL_RemoveImmediate( pEntity );
		}
	}
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : &inputdata - 
//-----------------------------------------------------------------------------
void CEnvScreenOverlay::InputStartOverlay( inputdata_t &inputdata )
{
	if ( m_iszOverlayNames[0] == NULL_STRING )
	{
		Warning("env_screenoverlay %s has no overlays to display.\n", STRING(GetEntityName()) );
		return;
	}

	m_flStartTime = gpGlobals->curtime;
}
//-----------------------------------------------------------------------------
// Precache 
//-----------------------------------------------------------------------------
void CParticleSystem::Precache( void )
{
	const char *pParticleSystemName = STRING( m_iszEffectName );
	if ( pParticleSystemName == NULL || pParticleSystemName[0] == 0 )
	{
		Warning( "info_particle_system (%s) has no particle system name specified!\n", GetEntityName().ToCStr() );
	}

	PrecacheParticleSystem( pParticleSystemName );
}
Ejemplo n.º 18
0
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CEnvInstructorHint::InputEndHint( inputdata_t &inputdata )
{
	static int s_InstructorServerHintEventStop = 0;
	IGameEvent * event = gameeventmanager->CreateEvent( "instructor_server_hint_stop", false, &s_InstructorServerHintEventStop );
	if ( event )
	{
		event->SetString( "hint_name", GetEntityName().ToCStr() );

		gameeventmanager->FireEvent( event );
	}
}
Ejemplo n.º 19
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
CPointTemplate *CEnvEntityMaker::FindTemplate()
{
	// Find our point_template
	CPointTemplate *pTemplate = dynamic_cast<CPointTemplate *>(gEntList.FindEntityByName( NULL, STRING(m_iszTemplate) ));
	if ( !pTemplate )
	{
		Warning( "env_entity_maker %s failed to find template %s.\n", GetEntityName().ToCStr(), STRING(m_iszTemplate) );
	}

	return pTemplate;
}
Ejemplo n.º 20
0
void CDialogueManager::InputStartDialogue(inputdata_t &inputData)
{
	// If our options have been disabled we don't care anymore:
	if (!m_bOptionAvailable[0] && !m_bOptionAvailable[1] && !m_bOptionAvailable[2])
		return;

	OnStartDialogue.FireOutput(this, this);

	// Run Event here:
	g_pGameRules->StartDialogueScene(szDialogueScene.ToCStr(), GetEntityName().ToCStr(), m_bOptionAvailable[0], m_bOptionAvailable[1], m_bOptionAvailable[2]);
}
void CEnvScreenOverlay::InputStopOverlay( inputdata_t &inputdata )
{
	if ( m_iszOverlayNames[0] == NULL_STRING )
	{
		Warning("env_screenoverlay %s has no overlays to display.\n", STRING(GetEntityName()) );
		return;
	}

	m_flStartTime = -1;
	m_bIsActive = false; 
}
Ejemplo n.º 22
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CBaseDoor::Activate( void )
{
	BaseClass::Activate();

	CBaseDoor *pDoorList[64];
	m_bDoorGroup = true;

	// force movement groups to sync!!!
	int doorCount = GetDoorMovementGroup( pDoorList, ARRAYSIZE(pDoorList) );
	for ( int i = 0; i < doorCount; i++ )
	{
		if ( pDoorList[i]->m_vecMoveDir == m_vecMoveDir )
		{
			bool error = false;
			if ( pDoorList[i]->IsRotatingDoor() )
			{
				error = ( pDoorList[i]->GetLocalAngles() != GetLocalAngles() ) ? true : false;
			}
			else 
			{
				error = ( pDoorList[i]->GetLocalOrigin() != GetLocalOrigin() ) ? true : false;
			}
			if ( error )
			{
				// don't do group blocking
				m_bDoorGroup = false;
#ifdef HL1_DLL
				// UNDONE: This should probably fixup m_vecPosition1 & m_vecPosition2
				Warning("Door group %s has misaligned origin!\n", STRING(GetEntityName()) );
#endif
			}
		}
	}
	
	switch ( m_toggle_state )
	{
	case TS_AT_TOP:
		UpdateAreaPortals( true );
		break;
	case TS_AT_BOTTOM:
		UpdateAreaPortals( false );
		break;
	default:
		break;
	}

#ifdef HL1_DLL
	// Get a handle to my filter entity if there is one
	if (m_iBlockFilterName != NULL_STRING)
	{
		m_hBlockFilter = dynamic_cast<CBaseFilter *>(gEntList.FindEntityByName( NULL, m_iBlockFilterName, NULL ));
	}
#endif
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CNPC_CraneDriver::Activate( void )
{
	BaseClass::Activate();

	m_hCrane = dynamic_cast<CPropCrane*>((CBaseEntity*)m_hVehicleEntity);
	if ( !m_hCrane )
	{
		Warning( "npc_cranedriver %s couldn't find his crane named %s.\n", STRING(GetEntityName()), STRING(m_iszVehicleName) );
		UTIL_Remove( this );
		return;
	}
}
Ejemplo n.º 24
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CNPC_VehicleDriver::Activate( void )
{
	BaseClass::Activate();

	// Restore doesn't need to do this
	if ( m_hVehicleEntity )
		return;

	// Make sure we've got a vehicle
	if ( m_iszVehicleName == NULL_STRING )
	{
		Warning( "npc_vehicledriver %s has no vehicle to drive.\n", STRING(GetEntityName()) );
		UTIL_Remove( this );
		return;
	}

	m_hVehicleEntity = (gEntList.FindEntityByName( NULL, STRING(m_iszVehicleName) ));
	if ( !m_hVehicleEntity )
	{
		Warning( "npc_vehicledriver %s couldn't find his vehicle named %s.\n", STRING(GetEntityName()), STRING(m_iszVehicleName) );
		UTIL_Remove( this );
		return;
	}

	m_pVehicleInterface = m_hVehicleEntity->GetServerVehicle();
	Assert( m_pVehicleInterface );
	if ( !m_pVehicleInterface->NPC_CanDrive() )
	{
		Warning( "npc_vehicledriver %s doesn't know how to drive vehicle %s.\n", STRING(GetEntityName()), STRING(m_hVehicleEntity->GetEntityName()) );
		UTIL_Remove( this );
		return;
	}

	// We've found our vehicle. Move to it and start following it.
	SetAbsOrigin( m_hVehicleEntity->WorldSpaceCenter() );
	m_pVehicleInterface->NPC_SetDriver( this );

	RecalculateSpeeds();
}
Ejemplo n.º 25
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CGameUI::Deactivate( CBaseEntity *pActivator )
{
	CBasePlayer *pPlayer = m_player;

	AssertMsg(pPlayer, "CGameUI deactivated without a player!");

	if (pPlayer)
	{
		// Re-enable player motion
		if ( FBitSet( m_spawnflags, SF_GAMEUI_FREEZE_PLAYER ) )
		{
			m_player->RemoveFlag( FL_ATCONTROLS );
		}

		// Restore weapons
		if ( FBitSet( m_spawnflags, SF_GAMEUI_HIDE_WEAPON ) )
		{
			// Turn the hud back on
			pPlayer->m_Local.m_iHideHUD &= ~HIDEHUD_WEAPONSELECTION;

			if ( m_hSaveWeapon.Get() )
			{
				m_player->Weapon_Switch( m_hSaveWeapon.Get() );
				m_hSaveWeapon = NULL;
			}

			if ( pPlayer->GetActiveWeapon() )
			{
				pPlayer->GetActiveWeapon()->Deploy();
			}
		}

		// Announce that the player is no longer controlling through us
		m_playerOff.FireOutput( pPlayer, this, 0 );

		// Clear out the axis controls
		m_xaxis.Set( 0, pPlayer, this );
		m_yaxis.Set( 0, pPlayer, this );
		m_attackaxis.Set( 0, pPlayer, this );
		m_attack2axis.Set( 0, pPlayer, this );
		m_nLastButtonState = 0;
		m_player = NULL;
	}
	else
	{
		Warning("%s Deactivate(): I have no player when called by %s!\n", GetEntityName().ToCStr(), pActivator->GetEntityName().ToCStr());
	}
	
	// Stop thinking
	SetNextThink( TICK_NEVER_THINK );
}
Ejemplo n.º 26
0
//-----------------------------------------------------------------------------
// Purpose: Input handler for setting the breakable's mass.
//-----------------------------------------------------------------------------
void CBreakable::InputSetMass( inputdata_t &inputdata )
{
	IPhysicsObject * vPhys = VPhysicsGetObject();
	if ( vPhys )
	{
		float toMass = inputdata.value.Float();
		Assert(toMass > 0);
		vPhys->SetMass( toMass );
	}
	else
	{
		Warning( "Tried to call SetMass() on %s but it has no physics.\n", GetEntityName().ToCStr() );
	}
}
void CEnvScreenOverlay::InputSwitchOverlay( inputdata_t &inputdata )
{
	int iNewOverlay = inputdata.value.Int() - 1;
	iNewOverlay = abs( iNewOverlay );

	if ( m_iszOverlayNames[iNewOverlay] == NULL_STRING )
	{
		Warning("env_screenoverlay %s has no overlays to display.\n", STRING(GetEntityName()) );
		return;
	}

	m_iDesiredOverlay = iNewOverlay;
	m_flStartTime = gpGlobals->curtime;
}
Ejemplo n.º 28
0
//-----------------------------------------------------------------------------
// Purpose: Precache the target NPC
//-----------------------------------------------------------------------------
void CNPCMaker::Precache( void )
{
	BaseClass::Precache();

	const char *pszNPCName = STRING( m_iszNPCClassname );
	if ( !pszNPCName || !pszNPCName[0] )
	{
		Warning("npc_maker %s has no specified NPC-to-spawn classname.\n", STRING(GetEntityName()) );
	}
	else
	{
		UTIL_PrecacheOther( pszNPCName );
	}
}
Ejemplo n.º 29
0
void CProjectedDecal::Activate()
{
	BaseClass::Activate();

	if ( !GetEntityName() )
	{
		StaticDecal();
	}
	else
	{
		// if there IS a targetname, the decal sprays itself on when it is triggered.
		SetThink ( &CProjectedDecal::SUB_DoNothing );
		SetUse(&CProjectedDecal::TriggerDecal);
	}
}
Ejemplo n.º 30
0
void CASW_Spawner::Precache()
{
	BaseClass::Precache();

	InitAlienClassName();
	const char *pszNPCName = STRING( m_AlienClassName );
	if ( !pszNPCName || !pszNPCName[0] )
	{
		Warning("asw_spawner %s has no specified alien-to-spawn classname.\n", STRING(GetEntityName()) );
	}
	else
	{
		UTIL_PrecacheOther( pszNPCName );
	}
}