当前位置: 首页>>代码示例>>C++>>正文


C++ CASW_Player类代码示例

本文整理汇总了C++中CASW_Player的典型用法代码示例。如果您正苦于以下问题:C++ CASW_Player类的具体用法?C++ CASW_Player怎么用?C++ CASW_Player使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CASW_Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CC_ASW_Ent_Create

//------------------------------------------------------------------------------
// Purpose: Create an NPC of the given type
//------------------------------------------------------------------------------
void CC_ASW_Ent_Create( const CCommand& args )
{
	MDLCACHE_CRITICAL_SECTION();

	bool allowPrecache = CBaseEntity::IsPrecacheAllowed();
	CBaseEntity::SetAllowPrecache( true );

	// Try to create entity
	CBaseEntity *entity = dynamic_cast< CBaseEntity * >( CreateEntityByName(args[1]) );
	if (entity)
	{
		entity->Precache();		

		// Now attempt to drop into the world
		CASW_Player* pPlayer = ToASW_Player( UTIL_GetCommandClient() );
		if (!pPlayer)
			return;

		trace_t tr;
		UTIL_TraceLine( pPlayer->GetCrosshairTracePos() + Vector( 0, 0, 30 ),
			pPlayer->GetCrosshairTracePos(), MASK_SOLID, 
			pPlayer, COLLISION_GROUP_NONE, &tr );

		if ( tr.fraction != 0.0 )
		{
			// Raise the end position a little up off the floor, place the npc and drop him down
			tr.endpos.z += 12;
			entity->Teleport( &tr.endpos, NULL, NULL );
			// this was causing aliens to spawn under ground 
			//UTIL_DropToFloor( entity, MASK_SOLID );
		}
		DispatchSpawn(entity);
	}
	CBaseEntity::SetAllowPrecache( allowPrecache );
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:38,代码来源:asw_concommands.cpp

示例2: asw_drop_ammo_f

void asw_drop_ammo_f(const CCommand &args)
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	if (!pPlayer)
		return;
	
	CASW_Marine *pMarine = pPlayer->GetMarine();
	if (!pMarine)
		return;

	int iBagSlot = atoi(args[1]);

	CASW_Weapon_Ammo_Bag *pBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetWeapon(0));
	if (pBag)
	{
		if (pBag->DropAmmoPickup(iBagSlot))
		{
			return;
		}
	}

	pBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetWeapon(1));
	if (pBag)
	{
		if (pBag->DropAmmoPickup(iBagSlot))
		{
			return;
		}
	}
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:30,代码来源:asw_concommands.cpp

示例3: asw_marine_spectate_f

void asw_marine_spectate_f(const CCommand &args)
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	if ( args.ArgC() < 2 )
	{
		Msg( "Usage: asw_marine_spectate [marine_num]\n" );
		return;
	}

	CASW_Game_Resource* pGameResource = ASWGameResource();
	if (!pGameResource)
		return;

	int iMarine = atof(args[1]);
	if (iMarine < 0 || iMarine >= pGameResource->GetMaxMarineResources())
		return;

	CASW_Marine_Resource* pMR = pGameResource->GetMarineResource(iMarine);
	if (!pMR)
	{
		Msg("No marine resource in that index\n");
		return;
	}

	CASW_Marine *pMarine = pMR->GetMarineEntity();
	if (!pMarine)
	{
		Msg("No live marine in that slot\n");
		return;
	}
		
	pPlayer->SetSpectatingMarine(pMarine);
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:33,代码来源:asw_concommands.cpp

示例4: asw_alien_batch_f

// creates a batch of aliens at the mouse cursor
void asw_alien_batch_f( const CCommand& args )
{
    MDLCACHE_CRITICAL_SECTION();

    bool allowPrecache = CBaseEntity::IsPrecacheAllowed();
    CBaseEntity::SetAllowPrecache( true );

    // find spawn point
    CASW_Player* pPlayer = ToASW_Player(UTIL_GetCommandClient());
    if (!pPlayer)
        return;
    CASW_Marine *pMarine = pPlayer->GetMarine();
    if (!pMarine)
        return;
    trace_t tr;
    Vector forward;

    AngleVectors( pMarine->EyeAngles(), &forward );
    UTIL_TraceLine(pMarine->EyePosition(),
                   pMarine->EyePosition() + forward * 300.0f,MASK_SOLID,
                   pMarine, COLLISION_GROUP_NONE, &tr );
    if ( tr.fraction != 0.0 )
    {
        // trace to the floor from this spot
        Vector vecSrc = tr.endpos;
        tr.endpos.z += 12;
        UTIL_TraceLine( vecSrc + Vector(0, 0, 12),
                        vecSrc - Vector( 0, 0, 512 ) ,MASK_SOLID,
                        pMarine, COLLISION_GROUP_NONE, &tr );

        ASWSpawnManager()->SpawnAlienBatch( "asw_parasite", 25, tr.endpos, vec3_angle );
    }

    CBaseEntity::SetAllowPrecache( allowPrecache );
}
开发者ID:docfinorlias,项目名称:asb2,代码行数:36,代码来源:asw_spawn_manager.cpp

示例5: SetupMove

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CASW_Prediction::SetupMove( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper *pHelper, 
	CMoveData *move )
{
	// Call the default SetupMove code.
	BaseClass::SetupMove( player, ucmd, pHelper, move );
	
	CASW_Player *pASWPlayer = static_cast<CASW_Player*>( player );
	if ( !asw_allow_detach.GetBool() )
	{		
		if ( pASWPlayer && pASWPlayer->GetMarine() )
		{
			// this forces horizontal movement
			move->m_vecAngles.x = 0;
			move->m_vecViewAngles.x = 0;
		}
	}

	CBaseEntity *pMoveParent = player->GetMoveParent();
	if (!pMoveParent)
	{
		move->m_vecAbsViewAngles = move->m_vecViewAngles;
	}
	else
	{
		matrix3x4_t viewToParent, viewToWorld;
		AngleMatrix( move->m_vecViewAngles, viewToParent );
		ConcatTransforms( pMoveParent->EntityToWorldTransform(), viewToParent, viewToWorld );
		MatrixAngles( viewToWorld, move->m_vecAbsViewAngles );
	}
	CASW_MoveData *pASWMove = static_cast<CASW_MoveData*>( move );
	pASWMove->m_iForcedAction = ucmd->forced_action;
	// setup trace optimization
	g_pGameMovement->SetupMovementBounds( move );
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:37,代码来源:asw_prediction.cpp

示例6: asw_test_turret_f

void asw_test_turret_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	
	if (pPlayer && pPlayer->GetMarine())
	{
		CASW_Marine *pMarine = pPlayer->GetMarine();
		if (pMarine->m_hRemoteTurret.Get())
		{
			pMarine->m_hRemoteTurret->StopUsingTurret();//m_hUser = NULL;
			pMarine->m_hRemoteTurret = NULL;
			return;
		}
		CBaseEntity* pEntity = NULL;
		while ((pEntity = gEntList.FindEntityByClassname( pEntity, "asw_remote_turret" )) != NULL)
		{
			CASW_Remote_Turret* pTurret = dynamic_cast<CASW_Remote_Turret*>(pEntity);			
			if (pTurret)
			{
				pTurret->StartedUsingTurret(pMarine);
				pMarine->m_hRemoteTurret = pTurret;
				Msg("Set turret\n");
				return;
			}
		}
	}	
	Msg("Failed to find a turret\n");
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:28,代码来源:asw_concommands.cpp

示例7: asw_room_info_f

void asw_room_info_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	if ( pPlayer && pPlayer->GetMarine() && missionchooser && missionchooser->RandomMissions() )
	{
		IASW_Room_Details *pRoom = missionchooser->RandomMissions()->GetRoomDetails( pPlayer->GetMarine()->GetAbsOrigin() );
		if ( !pRoom )
		{
			Msg(" Couldn't find room\n" );
		}
		else
		{
			char buf[MAX_PATH];
			pRoom->GetFullRoomName( buf, MAX_PATH );
			Msg( " Room name: %s\n", buf );
			Msg( " Room tags: " );
			int nNumTags = pRoom->GetNumTags();
			for ( int i = 0; i < nNumTags; ++ i )
			{
				Msg( "%s    ", pRoom->GetTag( i ) );
			}
			Msg( "\n" );
		}
	}
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:25,代码来源:asw_concommands.cpp

示例8: asw_path_end_f

void asw_path_end_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	if ( !pPlayer || !ASWPathUtils() )
		return;

	if ( !pPlayer->GetMarine() )
		return;

	Vector vecPathEnd = pPlayer->GetMarine()->GetAbsOrigin();
	debugoverlay->AddBoxOverlay( g_vecPathStart, Vector(-10, -10, -10 ), Vector(10, 10, 10) , vec3_angle, 255, 0, 0, 255, 30.0f );
	debugoverlay->AddBoxOverlay( vecPathEnd, Vector(-10, -10, -10 ), Vector(10, 10, 10) , vec3_angle, 255, 255, 0, 255, 30.0f );

	AI_Waypoint_t *pWaypoint = ASWPathUtils()->BuildRoute( g_vecPathStart, vecPathEnd, NULL, 100, NAV_NONE, bits_BUILD_GET_CLOSE );
	if ( !pWaypoint )
	{
		Msg( "Failed to find route\n" );
		return;
	}

	if ( UTIL_ASW_DoorBlockingRoute( pWaypoint, true ) )
	{
		Msg(" Route blocked by sealed/locked door\n" );
	}

	ASWPathUtils()->DebugDrawRoute( g_vecPathStart, pWaypoint );
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:27,代码来源:asw_path_utils.cpp

示例9: asw_live_marines_f

void asw_live_marines_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	if (!pPlayer)
		return;

	Msg("Has live marines: %d\n", pPlayer->HasLiveMarines());
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:8,代码来源:asw_concommands.cpp

示例10: OnTakeDamage

int CASW_Barrel_Explosive::OnTakeDamage( const CTakeDamageInfo &info )
{
	int saveFlags = m_takedamage;

	// don't be destroyed by buzzers
	if ( info.GetAttacker() && info.GetAttacker()->Classify() == CLASS_ASW_BUZZER )
	{
		return 0;
	}

	// prevent barrel exploding when knocked around
	if ( info.GetDamageType() & DMG_CRUSH )
		return 0;
	
	CASW_Marine* pMarine = NULL;
	if ( info.GetAttacker() && info.GetAttacker()->Classify() == CLASS_ASW_MARINE )
	{
		m_hAttacker = info.GetAttacker();

		pMarine = assert_cast< CASW_Marine* >( info.GetAttacker() );
		// prevent AI marines blowing up barrels as it makes the player ANGRY ANGRY
		if ( pMarine && !pMarine->IsInhabited() )
			return 0;
	}

	// don't burst open if melee'd
	if ( info.GetDamageType() & ( DMG_CLUB | DMG_SLASH ) )
	{
		m_takedamage = DAMAGE_EVENTS_ONLY;

		if( !m_bMeleeHit )
		{
			if ( pMarine )
			{
				IGameEvent * event = gameeventmanager->CreateEvent( "physics_melee" );
				if ( event )
				{
					CASW_Player *pCommander = pMarine->GetCommander();
					event->SetInt( "attacker", pCommander ? pCommander->GetUserID() : 0 );
					event->SetInt( "entindex", entindex() );
					gameeventmanager->FireEvent( event );
				}
			}
			m_bMeleeHit = true;
		}
	}

	if ( pMarine )
	{
		pMarine->HurtJunkItem(this, info);
	}

	// skip the breakable prop's complex damage handling and just hurt us
	int iResult = CBaseEntity::OnTakeDamage(info);
	m_takedamage = saveFlags;

	return iResult;
}
开发者ID:BenLubar,项目名称:riflemod,代码行数:58,代码来源:asw_barrel_explosive.cpp

示例11: asw_suicide_f

void asw_suicide_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
		
	if (pPlayer && pPlayer->GetMarine() && pPlayer->GetMarine()->GetHealth() > 0)
	{
		pPlayer->GetMarine()->Suicide();
	}
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:9,代码来源:asw_concommands.cpp

示例12: GetCommander

void CASW_Weapon_Freeze_Grenades::DelayedAttack( void )
{
	m_bShotDelayed = false;
	
	CASW_Player *pPlayer = GetCommander();
	if ( !pPlayer )
		return;

	CASW_Marine *pMarine = GetMarine();
	if ( !pMarine || pMarine->GetWaterLevel() == 3 )
		return;
	
#ifndef CLIENT_DLL		
	Vector vecSrc = pMarine->GetOffhandThrowSource();

	Vector vecDest = pPlayer->GetCrosshairTracePos();
	Vector newVel = UTIL_LaunchVector( vecSrc, vecDest, GetThrowGravity() ) * 28.0f;
	
	float fGrenadeRadius = GetBoomRadius( pMarine );
	if (asw_debug_marine_damage.GetBool())
	{
		Msg( "Freeze grenade radius = %f \n", fGrenadeRadius );
	}
	pMarine->GetMarineSpeech()->Chatter( CHATTER_GRENADE );

	// freeze aliens completely, plus the freeze duration
	float flFreezeAmount = 1.0f + MarineSkills()->GetSkillBasedValueByMarine(pMarine, ASW_MARINE_SKILL_GRENADES, ASW_MARINE_SUBSKILL_GRENADE_FREEZE_DURATION);

	if (ASWGameRules())
		ASWGameRules()->m_fLastFireTime = gpGlobals->curtime;

	CASW_Grenade_Freeze *pGrenade = CASW_Grenade_Freeze::Freeze_Grenade_Create( 
		1.0f,
		flFreezeAmount,
		fGrenadeRadius,
		0,
		vecSrc, pMarine->EyeAngles(), newVel, AngularImpulse(0,0,0), pMarine, this );
	if ( pGrenade )
	{
		pGrenade->SetGravity( GetThrowGravity() );
		pGrenade->SetExplodeOnWorldContact( true );
	}
	
#endif
		// decrement ammo
	m_iClip1 -= 1;

#ifndef CLIENT_DLL
	DestroyIfEmpty( true );
#endif

	m_flSoonestPrimaryAttack = gpGlobals->curtime + ASW_FLARES_FASTEST_REFIRE_TIME;
	if (m_iClip1 > 0)		// only force the fire wait time if we have ammo for another shot
		m_flNextPrimaryAttack = gpGlobals->curtime + GetFireRate();
	else
		m_flNextPrimaryAttack = gpGlobals->curtime;
}
开发者ID:detoxhby,项目名称:SwarmDirector2,代码行数:57,代码来源:asw_weapon_freeze_grenades.cpp

示例13: asw_LeaveMarinef

void asw_LeaveMarinef()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());;

	if (pPlayer && pPlayer->GetMarine())
	{
		pPlayer->LeaveMarines();
	}
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:9,代码来源:asw_concommands.cpp

示例14: asw_stop_burning_f

void asw_stop_burning_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
	
	if (pPlayer && pPlayer->GetMarine())
	{
		CASW_Marine *pMarine = pPlayer->GetMarine();
		pMarine->Extinguish();
	}
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:10,代码来源:asw_concommands.cpp

示例15: asw_build_speech_durations_f

void asw_build_speech_durations_f()
{
	CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());	
	
	if (!pPlayer || !MarineProfileList() || !pPlayer->GetMarine())
		return;
	Msg("Saving speech durations...");
	MarineProfileList()->SaveSpeechDurations(pPlayer->GetMarine());
	Msg("Done!\n");
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:10,代码来源:asw_concommands.cpp


注:本文中的CASW_Player类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。