本文整理汇总了C++中CASW_Marine_Resource类的典型用法代码示例。如果您正苦于以下问题:C++ CASW_Marine_Resource类的具体用法?C++ CASW_Marine_Resource怎么用?C++ CASW_Marine_Resource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CASW_Marine_Resource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASWGameResource
bool CASW_Mission_Manager::AllMarinesKnockedOut()
{
if (!ASWGameRules() || !ASWGameResource())
return false;
// can't be all dead if we haven't left briefing yet!
if (ASWGameRules()->GetGameState() < ASW_GS_INGAME)
return false;
int iMax = ASWGameResource()->GetMaxMarineResources();
for (int i=0;i<iMax;i++)
{
CASW_Marine_Resource *pMarineResource = ASWGameResource()->GetMarineResource(i);
if (pMarineResource)
{
CASW_Marine *m = pMarineResource->GetMarineEntity();
if (m)
{
if (!m->m_bKnockedOut)
{
return false;
}
}
}
}
return true;
}
示例2: GetMarineResource
// uses the marine list to quickly find all marines within a box
int CASW_Game_Resource::EnumerateMarinesInBox(Vector &mins, Vector &maxs)
{
m_iNumEnumeratedMarines = 0;
for (int i=0;i<GetMaxMarineResources();i++)
{
CASW_Marine_Resource *pMR = GetMarineResource(i);
if (!pMR)
continue;
CASW_Marine *pMarine = pMR->GetMarineEntity();
if (!pMarine)
continue;
#ifdef CLIENT_DLL
if (asw_debug_clientside_avoidance.GetBool())
{
Vector mid = (pMarine->WorldAlignMins() + pMarine->WorldAlignMaxs()) / 2.0f;
Vector omin = pMarine->WorldAlignMins() - mid;
Vector omax = pMarine->WorldAlignMaxs() - mid;
debugoverlay->AddBoxOverlay( mid, omin, omax, vec3_angle, 0, 0, 255, true, 0 );
}
#endif
Vector omins = pMarine->WorldAlignMins() + pMarine->GetAbsOrigin();
Vector omaxs = pMarine->WorldAlignMaxs() + pMarine->GetAbsOrigin();
if (IsBoxIntersectingBox(mins, maxs, omins, omaxs))
{
m_pEnumeratedMarines[m_iNumEnumeratedMarines] = pMR->GetMarineEntity();
m_iNumEnumeratedMarines++;
if (m_iNumEnumeratedMarines >=12)
break;
}
}
return m_iNumEnumeratedMarines;
}
示例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);
}
示例4: ASWGameResource
void CASW_Director::OnMarineStartedHack( CASW_Marine *pMarine, CBaseEntity *pComputer )
{
CASW_Game_Resource *pGameResource = ASWGameResource();
if ( !pGameResource )
return;
//Msg( " Marine started hack!\n" );
// reset intensity so we can have a big fight without relaxing immediately
for ( int i=0;i<pGameResource->GetMaxMarineResources();i++ )
{
CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(i);
if ( !pMR )
continue;
pMR->GetIntensity()->Reset();
}
float flQuickStart = RandomFloat( 2.0f, 5.0f );
if ( m_HordeTimer.GetRemainingTime() > flQuickStart )
{
m_HordeTimer.Start( flQuickStart );
}
// TODO: Instead have some kind of 'is in a big fight' state?
}
示例5: CreateEntityByName
void CJaS_Marine_Jack::Spawn()
{
CASW_Marine_Resource *pResource = dynamic_cast<CASW_Marine_Resource *>( CreateEntityByName( "asw_marine_resource" ) );
pResource->SetProfileIndex( 6 );
pResource->SetMarineEntity( this );
SetMarineResource( pResource );
pResource->Spawn();
m_pProfileOverride = pResource->GetProfile();
SelectModelFromProfile();
SetModelFromProfile();
CBaseCombatWeapon *pWeapon = dynamic_cast<CBaseCombatWeapon *>( CreateEntityByName( "asw_weapon_sniper_rifle" ) );
if ( pWeapon )
{
pWeapon->Spawn();
pWeapon->GiveDefaultAmmo();
pWeapon->m_iClip1 = 9999;
GiveAmmo(9999, pWeapon->GetPrimaryAmmoType());
Weapon_Equip_In_Index( pWeapon, 0 );
Weapon_Switch( pWeapon );
}
m_bConstantSlowHeal = true;
m_hSquadFormation = static_cast<CASW_SquadFormation *>( CreateEntityByName( "asw_squadformation" ) );
m_hSquadFormation->Leader( this );
SetRenderColor( 0x99, 0x40, 0x40 );
BaseClass::Spawn();
}
示例6: UTIL_TraceHull
bool CASW_Spawn_Manager::ValidSpawnPoint( const Vector &vecPosition, const Vector &vecMins, const Vector &vecMaxs, bool bCheckGround, float flMarineNearDistance )
{
// check if we can fit there
trace_t tr;
UTIL_TraceHull( vecPosition,
vecPosition + Vector( 0, 0, 1 ),
vecMins,
vecMaxs,
MASK_NPCSOLID,
NULL,
COLLISION_GROUP_NONE,
&tr );
if( tr.fraction != 1.0 )
return false;
// check there's ground underneath this point
if ( bCheckGround )
{
UTIL_TraceHull( vecPosition + Vector( 0, 0, 1 ),
vecPosition - Vector( 0, 0, 64 ),
vecMins,
vecMaxs,
MASK_NPCSOLID,
NULL,
COLLISION_GROUP_NONE,
&tr );
if( tr.fraction == 1.0 )
return false;
}
if ( flMarineNearDistance > 0 )
{
CASW_Game_Resource* pGameResource = ASWGameResource();
float distance = 0.0f;
for ( int i=0 ; i < pGameResource->GetMaxMarineResources() ; i++ )
{
CASW_Marine_Resource* pMR = pGameResource->GetMarineResource(i);
if ( pMR && pMR->GetMarineEntity() && pMR->GetMarineEntity()->GetHealth() > 0 )
{
distance = pMR->GetMarineEntity()->GetAbsOrigin().DistTo( vecPosition );
if ( distance < flMarineNearDistance )
{
return false;
}
}
}
}
return true;
}
示例7: ASWGameResource
void StatsReport::OnThink()
{
int nMarine = 0;
m_pObjectiveMap->ClearBlips();
C_ASW_Game_Resource *pGameResource = ASWGameResource();
for ( int i = 0; i < pGameResource->GetMaxMarineResources() && nMarine < ASW_STATS_REPORT_MAX_PLAYERS; i++ )
{
CASW_Marine_Resource *pMR = pGameResource->GetMarineResource( i );
if ( pMR )
{
Vector vPos;
vPos.x = pMR->m_TimelinePosX.GetValueAtInterp( m_pStatGraphPlayer->m_fTimeInterp );
vPos.y = pMR->m_TimelinePosY.GetValueAtInterp( m_pStatGraphPlayer->m_fTimeInterp );
vPos.z = 0.0f;
bool bDead = ( pMR->m_TimelineHealth.GetValueAtInterp( m_pStatGraphPlayer->m_fTimeInterp ) <= 0.0f );
m_pObjectiveMap->AddBlip( MapBlip_t( vPos, bDead ? Color( 255, 255, 255, 255 ) : getColorPerIndex(pMR->GetCommanderIndex()), bDead ? MAP_BLIP_TEXTURE_DEATH : MAP_BLIP_TEXTURE_NORMAL ) );
if ( m_pReadyCheckImages[ nMarine ]->IsVisible() )
{
C_ASW_Player *pPlayer = pMR->GetCommander();
if ( pPlayer )
{
if ( !pMR->IsInhabited() || ASWGameResource()->IsPlayerReady( pPlayer ) )
{
m_pReadyCheckImages[ i ]->SetImage( "swarm/HUD/TickBoxTicked" );
}
else if ( pPlayer == ASWGameResource()->GetLeader() )
{
m_pReadyCheckImages[ i ]->SetImage( "swarm/PlayerList/LeaderIcon" );
}
else
{
m_pReadyCheckImages[ i ]->SetImage( "swarm/HUD/TickBoxEmpty" );
}
}
}
nMarine++;
}
}
for ( int i = 0; i < ASW_STATS_REPORT_MAX_PLAYERS; i++ )
{
}
}
示例8: ASWGameResource
void CASW_Campaign_Save::UpdateLastCommanders()
{
// save which marines the players have selected
// add which marines he has selected
CASW_Game_Resource *pGameResource = ASWGameResource();
if ( !pGameResource )
return;
// first check there were some marines selected (i.e. we're not in the campaign lobby map)
int iNumMarineResources = 0;
for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
{
if (pGameResource->GetMarineResource(i))
iNumMarineResources++;
}
if ( iNumMarineResources <= 0 )
return;
char buffer[256];
for (int i=0;i<ASW_NUM_MARINE_PROFILES;i++)
{
// look for a marine info for this marine
bool bFound = false;
for (int k=0;k<pGameResource->GetMaxMarineResources();k++)
{
CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(k);
if (pMR && pMR->GetProfileIndex() == i && pMR->GetCommander())
{
CASW_Player *pPlayer = pMR->GetCommander();
if (pPlayer)
{
// store the commander who has this marine
Q_snprintf(buffer, sizeof(buffer), "%s%s",pPlayer->GetPlayerName(), pPlayer->GetASWNetworkID());
m_LastCommanders[i] = AllocPooledString(buffer);
m_LastMarineResourceSlot[i] = k;
m_LastPrimaryMarines[i] = pPlayer->IsPrimaryMarine(i);
bFound = true;
break;
}
}
}
if (!bFound)
{
m_LastCommanders[i] = AllocPooledString("");
m_LastMarineResourceSlot[i] = 0;
}
}
}
示例9: AddMarineResource
bool CASW_Game_Resource::AddMarineResource( CASW_Marine_Resource *m, int nPreferredSlot )
{
if ( nPreferredSlot != -1 )
{
CASW_Marine_Resource *pExisting = static_cast<CASW_Marine_Resource*>( m_MarineResources[ nPreferredSlot ].Get() );
if ( pExisting != NULL )
{
// if the existing is owned by someone else, then we abort
if ( pExisting->GetCommander() != m->GetCommander() )
return false;
SetRosterSelected( pExisting->GetProfileIndex(), 0 );
UTIL_Remove( pExisting );
}
m_MarineResources.Set( nPreferredSlot, m );
// the above causes strange cases where the client copy of this networked array is incorrect
// so we flag each element dirty to cause a complete update, which seems to fix the problem
for (int k=0;k<ASW_MAX_MARINE_RESOURCES;k++)
{
m_MarineResources.GetForModify(k);
}
return true;
}
for (int i=0;i<ASW_MAX_MARINE_RESOURCES;i++)
{
if (m_MarineResources[i] == NULL) // found a free slot
{
m_MarineResources.Set(i, m);
// the above causes strange cases where the client copy of this networked array is incorrect
// so we flag each element dirty to cause a complete update, which seems to fix the problem
for (int k=0;k<ASW_MAX_MARINE_RESOURCES;k++)
{
m_MarineResources.GetForModify(k);
}
return true;
}
}
Msg("Couldn't add new marine resource to list as no free slots\n");
return false;
}
示例10: ASWGameResource
void CMOD_Player_Performance::WriteToHUD(const char* messagename, int rating)
{
#if 0
for ( int i=0;i<ASWGameResource()->GetMaxMarineResources();i++ )
{
CASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource(i);
if ( !pMR )
continue;
CASW_Player *pPlayer = pMR->GetCommander();
if ( pPlayer && pPlayer->GetMarine() )
{
CSingleUserRecipientFilter user( pPlayer );
UserMessageBegin( user, messagename );
WRITE_SHORT( rating );
MessageEnd();
}
}
#endif
}
示例11: GetMaxMarineResources
int CASW_Game_Resource::CountAllAliveMarines( void )
{
int m = GetMaxMarineResources();
int iMarines = 0;
for ( int i = 0; i < m; i++ )
{
CASW_Marine_Resource *pMR = GetMarineResource( i );
if ( !pMR )
continue;
CASW_Marine *pMarine = pMR->GetMarineEntity();
if ( !pMarine )
continue;
if ( pMR->GetHealthPercent() > 0 )
{
iMarines++;
}
}
return iMarines;
}
示例12: Msg
void CASW_Spawn_Manager::UpdateCandidateNodes()
{
// don't update too frequently
if ( m_CandidateUpdateTimer.HasStarted() && !m_CandidateUpdateTimer.IsElapsed() )
return;
m_CandidateUpdateTimer.Start( asw_candidate_interval.GetFloat() );
if ( !GetNetwork() || !GetNetwork()->NumNodes() )
{
m_vecHordePosition = vec3_origin;
if ( asw_director_debug.GetBool() )
Msg("Error: Can't spawn hordes as this map has no node network\n");
return;
}
CASW_Game_Resource *pGameResource = ASWGameResource();
if ( !pGameResource )
return;
Vector vecSouthMarine = vec3_origin;
Vector vecNorthMarine = vec3_origin;
for ( int i=0; i<pGameResource->GetMaxMarineResources(); i++ )
{
CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(i);
if ( !pMR )
continue;
CASW_Marine *pMarine = pMR->GetMarineEntity();
if ( !pMarine || pMarine->GetHealth() <= 0 )
continue;
if ( vecSouthMarine == vec3_origin || vecSouthMarine.y > pMarine->GetAbsOrigin().y )
{
vecSouthMarine = pMarine->GetAbsOrigin();
}
if ( vecNorthMarine == vec3_origin || vecNorthMarine.y < pMarine->GetAbsOrigin().y )
{
vecNorthMarine = pMarine->GetAbsOrigin();
}
}
if ( vecSouthMarine == vec3_origin || vecNorthMarine == vec3_origin ) // no live marines
return;
int iNumNodes = GetNetwork()->NumNodes();
m_northCandidateNodes.Purge();
m_southCandidateNodes.Purge();
for ( int i=0 ; i<iNumNodes; i++ )
{
CAI_Node *pNode = GetNetwork()->GetNode( i );
if ( !pNode || pNode->GetType() != NODE_GROUND )
continue;
Vector vecPos = pNode->GetPosition( CANDIDATE_ALIEN_HULL );
// find the nearest marine to this node
float flDistance = 0;
CASW_Marine *pMarine = dynamic_cast<CASW_Marine*>(UTIL_ASW_NearestMarine( vecPos, flDistance ));
if ( !pMarine )
return;
if ( flDistance > asw_horde_max_distance.GetFloat() || flDistance < asw_horde_min_distance.GetFloat() )
continue;
// check node isn't in an exit trigger
bool bInsideEscapeArea = false;
for ( int d=0; d<m_EscapeTriggers.Count(); d++ )
{
if ( m_EscapeTriggers[d]->CollisionProp()->IsPointInBounds( vecPos ) )
{
bInsideEscapeArea = true;
break;
}
}
if ( bInsideEscapeArea )
continue;
if ( vecPos.y >= vecSouthMarine.y )
{
if ( asw_director_debug.GetInt() == 3 )
{
NDebugOverlay::Box( vecPos, -Vector( 5, 5, 5 ), Vector( 5, 5, 5 ), 32, 32, 128, 10, 60.0f );
}
m_northCandidateNodes.AddToTail( i );
}
if ( vecPos.y <= vecNorthMarine.y )
{
m_southCandidateNodes.AddToTail( i );
if ( asw_director_debug.GetInt() == 3 )
{
NDebugOverlay::Box( vecPos, -Vector( 5, 5, 5 ), Vector( 5, 5, 5 ), 128, 32, 32, 10, 60.0f );
}
}
}
}
示例13: CC_asw_teleport
void CC_asw_teleport( const CCommand &args )
{
CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
if ( !pPlayer )
return;
Vector vTargetPos = pPlayer->GetAbsOrigin();
// fires a command from the console
if ( args.ArgC() < 2 )
{
trace_t tr;
Vector vPlayerForward;
pPlayer->EyeVectors( &vPlayerForward, NULL, NULL );
UTIL_TraceLine( pPlayer->GetAbsOrigin(), pPlayer->GetAbsOrigin() + vPlayerForward * 10000.0f, MASK_SOLID, pPlayer, COLLISION_GROUP_NONE, &tr );
if ( tr.DidHit() )
{
vTargetPos = tr.endpos;
}
}
else
{
// find the named entity
CBaseEntity *target = gEntList.FindEntityByName( NULL, args[1] );
if ( !target )
{
int i = atoi( args[1] );
if ( i != 0 )
{
target = CBaseEntity::Instance( i );
if ( !target )
{
Msg( "Couldn't find entity!\n" );
return;
}
}
else
{
Msg( "Couldn't find entity!\n" );
return;
}
}
vTargetPos = target->GetAbsOrigin();
}
CASW_Marine *pMarine = pPlayer->GetMarine();
if ( !pMarine )
{
for ( int i = 0; i < ASWGameResource()->GetMaxMarineResources(); ++i )
{
CASW_Marine_Resource *pMR = ASWGameResource()->GetMarineResource( i );
if ( !pMR )
continue;
if ( pMR->GetMarineEntity() && pMR->GetMarineEntity()->GetCommander() == pPlayer )
{
pMarine = pMR->GetMarineEntity();
break;
}
}
}
if ( pMarine )
{
// Teleport the dude under our control
Vector vecPos = vTargetPos;//pNearest->GetOrigin();
pMarine->Teleport( &vecPos, NULL, NULL );
}
}
示例14: asw_marine_skill_f
void asw_marine_skill_f(const CCommand &args)
{
CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());
if (!ASWGameRules())
return;
if (!pPlayer)
return;
CASW_Game_Resource* pGameResource = ASWGameResource();
if (!pGameResource)
return;
CASW_Marine_Profile *pProfile = NULL;
CASW_Marine *pMarine = pPlayer->GetMarine();
if (pMarine)
{
pProfile = pMarine->GetMarineProfile();
}
else
{
// find the first marine info that belongs to us
for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
{
CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(i);
if (pMR && pMR->GetCommander() == pPlayer)
{
pProfile = pMR->GetProfile();
break;
}
}
}
if ( !pProfile )
return;
if ( args.ArgC() < 2 )
{
Msg("Usage: asw_marine_skill [SkillSlot] - reports the number of skill points of the current marine in that skill\n asw_marine_skill [SkillSlot] [x] - sets that skill to the specified number of skill points (0-5)\n");
Msg("SkillSlot goes from 0 to 4 for your skills, slot 5 is spare skill points.\n");
return;
}
int nSkillSlot = atoi(args[1]);
if ( nSkillSlot < 0 || nSkillSlot >= ASW_NUM_SKILL_SLOTS )
{
Msg("nSkillSlot out of bounds\n");
return;
}
if ( args.ArgC() < 3 )
{
int iSkillPoints = ASWGameResource()->GetMarineSkill( pProfile->m_ProfileIndex, nSkillSlot );
Msg( "Marine skill[%d] is %s = %d\n", nSkillSlot, SkillToString( pProfile->GetSkillMapping( nSkillSlot ) ), iSkillPoints );
}
else
{
int iNewPoints = atoi(args[2]);
ASWGameResource()->SetMarineSkill( pProfile->m_ProfileIndex, nSkillSlot, iNewPoints );
int iSkillPoints = ASWGameResource()->GetMarineSkill( pProfile->m_ProfileIndex, nSkillSlot );
Msg( "Marine skill[%d] is now %s = %d\n", nSkillSlot, SkillToString( pProfile->GetSkillMapping( nSkillSlot ) ), iSkillPoints );
}
}
示例15: filter
void CASW_Grenade_PRifle::Detonate()
{
if ( !ASWGameResource() )
return;
m_takedamage = DAMAGE_NO;
CPASFilter filter( GetAbsOrigin() );
Vector vecForward = GetAbsVelocity();
VectorNormalize(vecForward);
trace_t tr;
Vector vecDir = -vecForward;
//te->GaussExplosion( filter, 0.0,
//GetAbsOrigin(), vecDir, 0 );
CEffectData data;
data.m_vOrigin = GetAbsOrigin();
DispatchEffect( "aswstunexplo", data );
EmitSound("ASW_Weapon_PRifle.StunGrenadeExplosion");
UTIL_TraceLine ( GetAbsOrigin(), GetAbsOrigin() + 60*vecForward, MASK_SHOT,
this, COLLISION_GROUP_NONE, &tr);
if ((tr.m_pEnt != GetWorldEntity()) || (tr.hitbox != 0))
{
// non-world needs smaller decals
if( tr.m_pEnt && !tr.m_pEnt->IsNPC() )
{
UTIL_DecalTrace( &tr, "SmallScorch" );
}
}
else
{
UTIL_DecalTrace( &tr, "Scorch" );
}
UTIL_ASW_ScreenShake( GetAbsOrigin(), 25.0, 150.0, 1.0, 750, SHAKE_START );
int nPreviousStunnedAliens = ASWGameResource()->m_iElectroStunnedAliens;
// do just 1 damage...
CTakeDamageInfo info( this, GetOwnerEntity(), 1, DMG_SHOCK );
info.SetWeapon( m_hCreatorWeapon );
RadiusDamage ( info , GetAbsOrigin(), m_DmgRadius, CLASS_NONE, NULL );
// count as a shot fired
CASW_Marine *pMarine = dynamic_cast<CASW_Marine*>(GetOwnerEntity());
if ( pMarine && pMarine->GetMarineResource() )
{
CASW_Marine_Resource *pMR = pMarine->GetMarineResource();
pMR->UsedWeapon(NULL, 1);
int nAliensStunned = ASWGameResource()->m_iElectroStunnedAliens - nPreviousStunnedAliens;
if ( nAliensStunned >= 6 && pMR->IsInhabited() && pMR->GetCommander() )
{
pMR->GetCommander()->AwardAchievement( ACHIEVEMENT_ASW_STUN_GRENADE );
pMR->m_bStunGrenadeMedal = true;
}
}
UTIL_Remove( this );
}