本文整理汇总了C++中CASW_Game_Resource::GetMaxMarineResources方法的典型用法代码示例。如果您正苦于以下问题:C++ CASW_Game_Resource::GetMaxMarineResources方法的具体用法?C++ CASW_Game_Resource::GetMaxMarineResources怎么用?C++ CASW_Game_Resource::GetMaxMarineResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CASW_Game_Resource
的用法示例。
在下文中一共展示了CASW_Game_Resource::GetMaxMarineResources方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateLastCommanders
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;
}
}
}
示例2: OnMarineStartedHack
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?
}
示例3: asw_gimme_ammo_f
void asw_gimme_ammo_f(void)
{
CASW_Game_Resource *pGameResource = ASWGameResource();
if ( !pGameResource )
return;
for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
{
if (pGameResource->GetMarineResource(i) != NULL && pGameResource->GetMarineResource(i)->GetMarineEntity())
{
CASW_Marine *pMarine = pGameResource->GetMarineResource(i)->GetMarineEntity();
for (int k=0;k<ASW_MAX_MARINE_WEAPONS;k++)
{
CASW_Weapon *pWeapon = pMarine->GetASWWeapon(k);
if (!pWeapon)
continue;
// refill bullets in the gun
pWeapon->m_iClip1 = pWeapon->GetMaxClip1();
pWeapon->m_iClip2 = pWeapon->GetMaxClip2();
// give the marine a load of ammo of that type
pMarine->GiveAmmo(10000, pWeapon->GetPrimaryAmmoType());
pMarine->GiveAmmo(10000, pWeapon->GetSecondaryAmmoType());
}
}
}
}
示例4: 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);
}
示例5: ValidSpawnPoint
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;
}
示例6: Event_AlienKilled
// increase intensity as aliens are killed (particularly if they're close to the marines)
void CASW_Director::Event_AlienKilled( CBaseEntity *pAlien, const CTakeDamageInfo &info )
{
if ( !pAlien )
return;
CASW_Game_Resource *pGameResource = ASWGameResource();
if ( !pGameResource )
return;
bool bDangerous = pAlien->Classify() == CLASS_ASW_SHIELDBUG; // shieldbug
bool bVeryDangerous = pAlien->Classify() == CLASS_ASW_QUEEN; // queen
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;
CASW_Intensity::IntensityType stress = CASW_Intensity::MILD;
if ( bVeryDangerous )
{
stress = CASW_Intensity::EXTREME;
}
else if ( bDangerous )
{
stress = CASW_Intensity::HIGH;
}
else
{
float distance = pMarine->GetAbsOrigin().DistTo( pAlien->GetAbsOrigin() );
if ( distance > asw_intensity_far_range.GetFloat() )
{
stress = CASW_Intensity::MILD;
}
else
{
stress = CASW_Intensity::MODERATE;
}
}
pMR->GetIntensity()->Increase( stress );
}
ASWArena()->Event_AlienKilled( pAlien, info );
}
示例7: asw_gimme_health_f
void asw_gimme_health_f(void)
{
CASW_Game_Resource *pGameResource = ASWGameResource();
if ( !pGameResource )
return;
for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
{
if (pGameResource->GetMarineResource(i) != NULL && pGameResource->GetMarineResource(i)->GetMarineEntity())
{
CASW_Marine *pMarine = pGameResource->GetMarineResource(i)->GetMarineEntity();
pMarine->AddSlowHeal( pMarine->GetMaxHealth() - pMarine->GetHealth(), 3, NULL );
}
}
}
示例8: listmarineresources_server_f
void listmarineresources_server_f(void)
{
CASW_Game_Resource *pGameResource = ASWGameResource();
if ( !pGameResource )
return;
for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
{
if (pGameResource->GetMarineResource(i) == NULL)
Msg("MarineResource %d = empty\n", i);
else
{
Msg("MarineResource %d = present, profileindex %d, commander %d commander index %d\n",
i, pGameResource->GetMarineResource(i)->m_MarineProfileIndex,
pGameResource->GetMarineResource(i)->GetCommander(),
pGameResource->GetMarineResource(i)->m_iCommanderIndex.Get());
}
}
}
示例9: UpdateMarineRooms
// randomly generated levels provide data about each room in the level
// we check that here to react to special rooms
void CASW_Director::UpdateMarineRooms()
{
CASW_Game_Resource *pGameResource = ASWGameResource();
if ( !pGameResource || !missionchooser || !missionchooser->RandomMissions())
return;
for ( int i=0;i<pGameResource->GetMaxMarineResources();i++ )
{
CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(i);
if ( !pMR || !pMR->GetMarineEntity() || pMR->GetMarineEntity()->GetHealth() <= 0 )
continue;
IASW_Room_Details* pRoom = missionchooser->RandomMissions()->GetRoomDetails( pMR->GetMarineEntity()->GetAbsOrigin() );
if ( !pRoom )
continue;
if ( !m_bFinale && pRoom->HasTag( "Escape" ) )
{
UpdateMarineInsideEscapeRoom( pMR->GetMarineEntity() );
}
}
}
示例10: TeleportPlayersToSpawn
void CASW_Arena::TeleportPlayersToSpawn()
{
if ( !ASWGameRules() )
return;
CBaseEntity *pSpot = NULL;
CASW_Game_Resource *pGameResource = ASWGameResource();
for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
{
if (pGameResource->GetMarineResource(i) != NULL && pGameResource->GetMarineResource(i)->GetMarineEntity())
{
CASW_Marine *pMarine = pGameResource->GetMarineResource(i)->GetMarineEntity();
if ( pMarine->GetHealth() > 0 )
{
pSpot = ASWGameRules()->GetMarineSpawnPoint( pSpot );
if ( pSpot )
{
pMarine->Teleport( &pSpot->GetAbsOrigin(), &pSpot->GetAbsAngles(), &vec3_origin );
}
}
}
}
}
示例11: CheckMissionComplete
bool CASW_Mission_Manager::CheckMissionComplete()
{
bool bFailed = false;
bool bSuccess = true;
bool bAtLeastOneObjective = false;
// notify all objectives about this event
if ( !ASWGameResource() )
return false;
int iIncomplete = 0;
int iNumObjectives = 0;
bool bEscapeIncomplete = false;
for (int i=0;i<ASW_MAX_OBJECTIVES;i++)
{
CASW_Objective* pObjective = ASWGameResource()->GetObjective(i);
if (pObjective)
{
bAtLeastOneObjective = true;
iNumObjectives++;
if (!pObjective->IsObjectiveComplete() && !pObjective->IsObjectiveOptional())
{
bSuccess = false;
iIncomplete++;
if (iIncomplete == 1 && !m_bDoneLeavingChatter)
{
CASW_Objective_Escape *pEscape = dynamic_cast<CASW_Objective_Escape*>(pObjective);
if (pEscape)
bEscapeIncomplete = true;
}
}
if (pObjective->IsObjectiveFailed())
{
bFailed = true;
}
}
}
m_bAllMarinesDead = AllMarinesDead();
if ( m_bAllMarinesDead && ( gpGlobals->curtime > m_flLastMarineDeathTime + asw_last_marine_dead_delay.GetFloat() || GameTimescale()->GetCurrentTimescale() < 1.0f ) )
{
bFailed = true;
}
m_bAllMarinesKnockedOut = AllMarinesKnockedOut();
if (m_bAllMarinesKnockedOut)
bFailed = true;
if (bSuccess && bAtLeastOneObjective)
{
MissionSuccess();
return true;
}
else if (bFailed)
{
MissionFail();
return true;
}
else
{
if (bEscapeIncomplete && iIncomplete)
{
// make a marine do the 'time to leave' speech
if ( ASWGameResource() )
{
CASW_Game_Resource *pGameResource = ASWGameResource();
// count how many live marines we have
int iNearby = 0;
for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
{
CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(i);
CASW_Marine *pMarine = pMR ? pMR->GetMarineEntity() : NULL;
if (pMarine && pMarine->GetHealth() > 0)
iNearby++;
}
int iChatter = random->RandomInt(0, iNearby-1);
for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
{
CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(i);
CASW_Marine *pMarine = pMR ? pMR->GetMarineEntity() : NULL;
if (pMarine && pMarine->GetHealth() > 0)
{
if (iChatter <= 0)
{
pMarine->GetMarineSpeech()->QueueChatter(CHATTER_TIME_TO_LEAVE, gpGlobals->curtime + 3.0f, gpGlobals->curtime + 6.0f);
break;
}
iChatter--;
}
}
}
m_bDoneLeavingChatter = true;
}
}
return false;
}
示例12: UpdateCandidateNodes
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: 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 );
}
}