Esempio n. 1
0
//------------------------------------------------------------------------
void CGunTurret::UpdateGoal(IEntity *pTarget, float deltaTime)
{
	Vec3 shootPos = PredictTargetPos(pTarget,false);

	if(m_turretparams.sweep_time != 0.f && !m_fireparams.hints.empty())
		shootPos = GetSweepPos(pTarget, shootPos);

	if(m_fireparams.deviation_amount != 0.f)
		UpdateDeviation(deltaTime, shootPos);

	float goalYaw(0.f), goalPitch(0.f);

	if(!GetTargetAngles(shootPos, goalYaw, goalPitch))
		return;

	if(!IsTargetAimable(goalYaw,goalPitch))
	{
		if(DebugTurret()) CryLog("UpdateGoal: %s IsTargetAimable failed (yaw: %.2f, pitch: %.2f)", pTarget->GetName(), goalYaw, goalPitch);

		return;
	}

	// if (cry_fabsf(m_goalYaw-goalYaw)<0.0001f && cry_fabsf(m_goalPitch-m_goalPitch)<0.0001f )
	//     return;
	m_goalPitch = goalPitch;
	m_goalYaw = goalYaw;
	GetGameObject()->ChangedNetworkState(ASPECT_GOALORIENTATION);
}
//------------------------------------------------------------------------
float CGameRulesCommonDamageHandling::GetVehicleForeignCollisionMultiplier( const IVehicle& vehicle, const SCollisionEntityInfo& colliderInfo, const CGameRules::SCollisionHitInfo& colHitInfo ) const
{
	float result = 1.0f;
	
	//Vehicle to vehicle collision
	if (colliderInfo.pEntityVehicle)
	{
		const float vehicleMass = vehicle.GetMass();
		const float vehicleColliderMass = colliderInfo.pEntityVehicle->GetMass();

		const float targetSpeedSqr = colHitInfo.target_velocity.len2();

		if ((vehicleMass > vehicleColliderMass * 1.5f) && (targetSpeedSqr > 0.01f))
		{
			//Reduce damage for collisions with large mass ratios, to avoid instant-killing
			const float ratio = 1.0f + (0.35f * min(10.0f, vehicleMass * __fres(vehicleColliderMass))) * min(1.0f, targetSpeedSqr * 0.31623f);
			result = __fres(ratio);

			if (DebugCollisions())
			{
				CryLog("Vehicle/Vehicle (%s <- %s), collision mult: %.2f", vehicle.GetEntity()->GetName(), colliderInfo.pEntity->GetName(), result);
			}
		}
	}

	return result;
}
void CMelee::GenerateAndQueueMeleeAction() const
{
	const SMeleeTags& tags = m_pMeleeParams->meleetags;
	const CWeaponMelee::EMeleeStatus meleeStatus = static_cast<CWeaponMelee*> (m_pWeapon)->GetMeleeAttackAction();

	const char* pActionName = NULL;

	switch( meleeStatus )
	{
	case CWeaponMelee::EMeleeStatus_Left:
		GenerateAndQueueMeleeActionForStatus( tags.tag_params_combo_left );
		pActionName = "MeleeCombo";
		break;
	case CWeaponMelee::EMeleeStatus_Right:
		GenerateAndQueueMeleeActionForStatus( tags.tag_params_combo_right );
		pActionName = "MeleeCombo";
		break;
	case CWeaponMelee::EMeleeStatus_KillingBlow:
		GenerateAndQueueMeleeActionForStatus( tags.tag_params_combo_killingblow );
		pActionName = "MeleeKillingBlow";
		break;
	default:
		CryLog( "[Melee] Attempted to run a melee action when the status was unknown" );
		break;
	}
}
//------------------------------------------------------------------------
void CGameRulesHoldObjectiveBase::Init( XmlNodeRef xml )
{
	const int numChildren = xml->getChildCount();
	for (int childIdx = 0; childIdx < numChildren; ++ childIdx)
	{
		XmlNodeRef xmlChild = xml->getChild(childIdx);
		if (!stricmp(xmlChild->getTag(), "SpawnParams"))
		{
			const char *pType = 0;
			if (xmlChild->getAttr("type", &pType))
			{
				if (!stricmp(pType, "avoid"))
				{
					m_spawnPOIType = eSPT_Avoid;
				}
				else
				{
					CryLog("CGameRulesHoldObjectiveBase::Init: ERROR: Unknown spawn point of interest type ('%s')", pType);
				}
				xmlChild->getAttr("distance", m_spawnPOIDistance);
			}
		}
		else if (!stricmp(xmlChild->getTag(), "EffectData"))
		{
			InitEffectData(xmlChild);
		}
	}

	for (int i = 0; i < HOLD_OBJECTIVE_MAX_ENTITIES; ++ i)
	{
		m_entities[i].Reset();
	}
}
Esempio n. 5
0
TBitfield AutoEnum_GetBitfieldFromString(const char * inString, const char ** inArray, int arraySize)
{
	unsigned int reply = 0;

	if (inString && inString[0] != '\0') // Avoid a load of work if the string's NULL or empty
	{
		const char * startFrom = inString;

		assert (arraySize > 0);

		char skipThisString[32];
		size_t skipChars = cry_copyStringUntilFindChar(skipThisString, inArray[0], sizeof(skipThisString), '_');
		size_t foundAtIndex = 0;

#if DO_PARSE_BITFIELD_STRING_LOGS
		CryLog("AutoEnum_GetBitfieldFromString: Parsing '%s' (skipping first %d chars '%s%s' of each string in array)", inString, skipChars, skipThisString, skipChars ? "_" : "");
#endif

		do
		{
			char gotToken[32];
			foundAtIndex = cry_copyStringUntilFindChar(gotToken, startFrom, sizeof(gotToken), '|');
			startFrom += foundAtIndex;

			bool done = false;
			for (int i = 0; i < arraySize; ++ i)
			{
				if (0 == stricmp(inArray[i] + skipChars, gotToken))
				{
					CRY_ASSERT_MESSAGE((reply & BIT(i)) == 0, string().Format("Bit '%s' already turned on! Does it feature more than once in string '%s'?", gotToken, inString));

#if DO_PARSE_BITFIELD_STRING_LOGS
					CryLog("AutoEnum_GetBitfieldFromString: Token = '%s' = BIT(%d) = %d, remaining string = '%s'", gotToken, i, BIT(i), foundAtIndex ? startFrom : "");
#endif

					reply |= BIT(i);
					done = true;
					break;
				}
			}
			CRY_ASSERT_MESSAGE(done, string().Format("No flag called '%s' in list", gotToken));
		}
		while (foundAtIndex);
	}

	return reply;
}
Esempio n. 6
0
//-------------------------------------------------------------------------
bool CGameBrowser::DoFavouriteIdSearch()
{
	CryLog("[UI] DoFavouriteIdSearch");

	bool bResult = false;

	return bResult;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CGameRules, ClMidMigrationJoin)
{
	CryLog("CGameRules::ClMidMigrationJoin() state=%i, timeSinceChange=%f", params.m_state, params.m_timeSinceStateChanged);
	CGame::EHostMigrationState newState = CGame::EHostMigrationState(params.m_state);
	float timeOfChange = gEnv->pTimer->GetAsyncCurTime() - params.m_timeSinceStateChanged;
	g_pGame->SetHostMigrationStateAndTime(newState, timeOfChange);
	return true;
}
//------------------------------------------------------------------------
CGameRulesCommonDamageHandling::CGameRulesCommonDamageHandling()
: m_pGameRules(NULL)
{
	CryLog("GameRulesCommonDamageHandling::GameRulesCommonDamageHandling()");
	
	IEntityClassRegistry * pClassReg = gEnv->pEntitySystem->GetClassRegistry();
	m_pEnvironmentalWeaponClass = pClassReg->FindClass("EnvironmentalWeapon");
}
//------------------------------------------------------------------------
void CMatchMakingHandler::Search( int freeSlots, int maxResults, SCrySessionSearchData* searchParameters, int numSearchParameters )
{
	//might still want equivalents of these
	//m_findGameTimeout = GetFindGameTimeout();
	//m_findGameResults.clear();

	SCrySessionSearchParam param;

	param.m_type = FIND_GAME_SESSION_QUERY;

	param.m_data = searchParameters;
	param.m_numFreeSlots = freeSlots;
	CRY_ASSERT(param.m_numFreeSlots > 0);
	param.m_maxNumReturn = maxResults;
	param.m_ranked = false;

	int curData = 0;

	CRY_ASSERT_MESSAGE( numSearchParameters < FIND_GAMES_SEARCH_NUM_DATA, "Session search data buffer overrun" );
	searchParameters[ numSearchParameters ].m_operator = eCSSO_Equal;
	searchParameters[ numSearchParameters ].m_data.m_id = LID_MATCHDATA_VERSION;
	searchParameters[ numSearchParameters ].m_data.m_type = eCLUDT_Int32;
	searchParameters[ numSearchParameters ].m_data.m_int32 = GameLobbyData::GetVersion();
	numSearchParameters++;

	param.m_numData = numSearchParameters;

	++s_currentMMSearchID;
#if defined(TRACK_MATCHMAKING)
	if( CMatchmakingTelemetry* pMMTel = g_pGame->GetMatchMakingTelemetry() )
	{
		pMMTel->AddEvent( SMMStartSearchEvent( param, s_currentMMSearchID ) );
	}
#endif

	ECryLobbyError result = g_pGame->GetGameBrowser()->StartSearchingForServers(&param, CMatchMakingHandler::SearchCallback, this, false);
	if (result == eCLE_Success)
	{
		CryLog("MatchMakingHandler::Search() search successfully started, ");//setting s_bShouldBeSearching to FALSE to prevent another one starting");
	}
	else
	{
		CryLog("MatchMakingHandler::Search() search failed to start (error=%i)", result);// setting s_bShouldBeSearching to TRUE so we start another one when the timeout occurs", result);
	}
	
}
void CMatchMakingHandler::MMLog( const char* message, bool isError )
{
	if( isError )
	{
		CryLog( "MMHandlerError: %s", message );
	}
	else
	{
		CryLog( "MMHandlerLog: %s", message );
	} 

	if( CMatchmakingTelemetry* pMMTel = g_pGame->GetMatchMakingTelemetry() )
	{
		pMMTel->AddEvent( SMMGenericLogEvent( message, isError ) );
	}

}
Esempio n. 11
0
/* static */
bool CGameBrowser::CreatePresenceString(CryFixedStringT<MAX_PRESENCE_STRING_SIZE> &out, SCryLobbyUserData *pData, uint32 numData)
{
	bool result = true;

	if(numData > 0)
	{
		CRY_ASSERT_MESSAGE(pData[CRichPresence::eRPT_String].m_id == RICHPRESENCE_ID, "");

		// pData[0] indicates the type of rich presence we setting, i.e. frontend, lobby, in-game
		// additional pData's are parameters that can be passed into the rich presence string, only used for gameplay at the moment
		switch(pData[CRichPresence::eRPT_String].m_int32)
		{
		case RICHPRESENCE_FRONTEND:
			LocalisePresenceString(out, "@mp_rp_frontend");
			break;

		case RICHPRESENCE_LOBBY:
			LocalisePresenceString(out, "@mp_rp_lobby");
			break;

		case RICHPRESENCE_GAMEPLAY:
			if(numData == 3)
			{
				const int gameModeId = pData[CRichPresence::eRPT_Param1].m_int32;
				const int mapId = pData[CRichPresence::eRPT_Param2].m_int32;
				LocaliseInGamePresenceString( out, "@mp_rp_gameplay", gameModeId, mapId );
			}
#if !defined(_RELEASE)
			else
			{
				CRY_ASSERT_MESSAGE(numData == 3, "Invalid data passed for gameplay rich presence state");
				result = false;
			}
#endif
			break;

		case RICHPRESENCE_SINGLEPLAYER:
			LocalisePresenceString(out, "@mp_rp_singleplayer");
			break;

		case RICHPRESENCE_IDLE:
			LocalisePresenceString(out, "@mp_rp_idle");
			break;

		default:
			CRY_ASSERT_MESSAGE(false, "[RichPresence] unknown rich presence type given");
			result = false;
			break;
		}
	}
	else
	{
		CryLog("[RichPresence] Failed to set rich presence because numData was 0 or there was no hud");
		result = false;
	}

	return result;
}
Esempio n. 12
0
//------------------------------------------------------------------------
void CParachute::PhysicalizeCanvas(bool enable)
{
    IEntity* pCanvas = m_pEntitySystem->GetEntity(m_canvasId);
    if (!pCanvas)
        return;

    if (enable)
    {
        SEntityPhysicalizeParams params;
        params.type = PE_RIGID;
        params.mass = 0;
        pCanvas->Physicalize(params);

        IPhysicalEntity* pPhysics = pCanvas->GetPhysics();
        if (!pPhysics)
            return;

        // add parachute physics geometry
        m_paraPhysIds.clear();
        m_paraPhysIds.resize(8);

        for(int iCel=0; iCel<7; iCel++)
        {
            SWing *pCel = &m_aCels[iCel];

            m_paraPhysIds.push_back( AddCel(pPhysics, iCel+1, pCel) );

            pCel->fSurface = pCel->vSize.x * pCel->vSize.y;

            pCel->pLiftPointsMap = &m_LiftPointsMap;
            pCel->pDragPointsMap = &m_DragPointsMap;
        }
        Vec3 minExt(0.0f,0.0f,0.95f), maxExt(0.5f,0.3f,1.9f);
        m_paraPhysIds.push_back( AddBox(&minExt, &maxExt, 70.0f) );

        pe_params_part pp;
        pp.partid = m_paraPhysIds.back();
        pp.flagsAND = ~(geom_collides);
        pPhysics->SetParams(&pp);

        pe_status_dynamics stats;
        pPhysics->GetStatus(&stats);
        CryLog("Parachute mass: %f", stats.mass);
    }
    else
    {
        IPhysicalEntity* pPhysics = pCanvas->GetPhysics();
        if (pPhysics)
        {
            // remove parachute geometry
            for (std::vector<int>::iterator it = m_paraPhysIds.begin(); it != m_paraPhysIds.end(); ++it)
            {
                pPhysics->RemoveGeometry(*it);
            }
        }
        m_paraPhysIds.clear();
    }
}
Esempio n. 13
0
//------------------------------------------------------------------------
void CGameRules::StoreMigratingPlayer(IActor* pActor)
{
	if (pActor == NULL)
	{
		GameWarning("Invalid data for migrating player");
		return;
	}

	IEntity* pEntity = pActor->GetEntity();
	EntityId id = pEntity->GetId();
	bool registered = false;

	uint16 channelId = pActor->GetChannelId();
	CRY_ASSERT(channelId);

	bool bShouldAdd = true;

	CGameLobby *pGameLobby = g_pGame->GetGameLobby();
	CRY_ASSERT(pGameLobby);
	if (pGameLobby)
	{
		SCryMatchMakingConnectionUID conId = pGameLobby->GetConnectionUIDFromChannelID((int) channelId);
		if (pGameLobby->GetSessionNames().Find(conId) == SSessionNames::k_unableToFind)
		{
			CryLog("CGameRules::StoreMigratingPlayer() player %s (channelId=%u) has already left the game, not storing", pEntity->GetName(), channelId);
			bShouldAdd = false;
		}
	}

	if (bShouldAdd && (!m_hostMigrationCachedEntities.empty()))
	{
		if (!stl::find(m_hostMigrationCachedEntities, pActor->GetEntityId()))
		{
			bShouldAdd = false;
		}
	}

	if (bShouldAdd)
	{
		for (uint32 index = 0; index < m_migratingPlayerMaxCount; ++index)
		{
			if (!m_pMigratingPlayerInfo[index].InUse())
			{
				m_pMigratingPlayerInfo[index].SetData(pEntity->GetName(), id, GetTeam(id), pEntity->GetWorldPos(), pEntity->GetWorldAngles(), pActor->GetHealth());
				m_pMigratingPlayerInfo[index].SetChannelID(channelId);
				registered = true;
				break;
			}
		}
	}

	pEntity->Hide(true);		// Hide the player, they will be unhidden when they rejoin

	if (!registered && bShouldAdd)
	{
		GameWarning("Too many migrating players!");
	}
}
Esempio n. 14
0
void CReadSendPacket::SendMsg(SOCKET Socket, SMessage message)
{
	//CryLog("[CryMasterServer] Send message packet...");

	SPacket SPacket;
	Packet* p = new Packet();
	p->create();

	/****************************Обязательный блок************************************/

	p->writeInt(PACKET_MESSAGE);                                 // Тип пакета
	p->writeString(gClientEnv->clientVersion);           // Версия пакета

	/*******************************Тело пакета****************************************/

	p->writeString(message.message);
	p->writeInt(message.area);                            

	p->writeString(EndBlock);                                    // Завершающий блок 

	p->padPacketTo8ByteLen();
	p->encodeBlowfish(gClientEnv->bBlowFish);
	p->appendChecksum(false);
	p->appendMore8Bytes();


	int size = p->getPacketSize();
	char* packet = (char*)p->getBytesPtr();

	SPacket.addr = Socket;
	SPacket.data = packet;
	SPacket.size = size;

	gClientEnv->pPacketQueue->InsertPacket(SPacket);


	if(gClientEnv->bDebugMode)
	{
		CryLog("[CryMasterServer] Message packet size = %d",size);
		CryLog("[CryMasterServer] Message packet data = %s",message.message);
		CryLog("[CryMasterServer] Message packet type = %d",message.area);

		PacketDebugger::Debug(packet, size, "SendPacketsDebugg.txt");
	}
}
Esempio n. 15
0
//-------------------------------------------------------------------------
void CGameLobbyManager::MoveUsers(CGameLobby *pFromLobby)
{
	CryLog("[GameLobbyManager] MoveUsers pFromLobby %p pToLobby %p", pFromLobby, m_nextLobby);

	if(m_nextLobby)
	{
		m_nextLobby->MoveUsers(pFromLobby);
	}
}
Esempio n. 16
0
//------------------------------------------------------------------------
bool CGameRules::OnFinalise(SHostMigrationInfo& hostMigrationInfo, uint32& state)
{
	if (!g_pGame->GetIGameFramework()->ShouldMigrateNub(hostMigrationInfo.m_session))
	{
		return true;
	}

	CryLogAlways("[Host Migration]: CGameRules::OnFinalise() started");
	//if (m_hostMigrationClientHasRejoined)
	{
		CCCPOINT(HostMigration_OnFinalise);

		if (!hostMigrationInfo.IsNewHost())
		{
			FlushPhysicsQueues();
	
			int numEntities = m_hostMigrationCachedEntities.size();
			CryLog("    removing %i entities", numEntities);
			for (int i = 0; i < numEntities; ++ i)
			{
				EntityId entId = m_hostMigrationCachedEntities[i];
				gEnv->pEntitySystem->RemoveEntity(entId, true);

				TEntityTeamIdMap::iterator entityTeamsIt = m_entityteams.begin();
				for (; entityTeamsIt != m_entityteams.end(); ++ entityTeamsIt)
				{
					EntityId entityId = entityTeamsIt->first;
					if (entityId == entId)
					{
						int teamId = entityTeamsIt->second;
						if (teamId)
						{
							// Remove this entity from the team lists
							TPlayers &playersVec = m_playerteams[teamId];
							stl::find_and_erase(playersVec, entId);

							m_entityteams.erase(entityTeamsIt);
						}
						break;
					}
				}
			}
		}

		m_hostMigrationCachedEntities.clear();

		HostMigrationResumeAddingPlayers();

		g_pGame->PlayerIdSet(g_pGame->GetIGameFramework()->GetClientActorId());

		CryLogAlways("[Host Migration]: CGameRules::OnFinalise() finished - success");
		return true;
	}

	CryLogAlways("[Host Migration]: CGameRules::OnFinalise() finished - failure");
	return false;
}
static void LogLuaCacheResource(const char* whoIsRequesting, const char* type, const char* resourceName, const int flags)
{
#if LOG_CACHE_RESOURCES_FROM_LUA
	if (resourceName && resourceName[0])
	{
		CryLog("[GAME CACHE LUA] by '%s' : %s - %s Flags(%d)", whoIsRequesting, type, resourceName, flags);
	}
#endif
}
Esempio n. 18
0
void CPersistantDebug::AddEntityTag(const SEntityTagParams& params, const char *tagContext)
{
    // Create tag
    SEntityTag tag;
    tag.params = params;
    tag.params.column = max(1, tag.params.column);
    tag.params.visibleTime = max(0.f, tag.params.visibleTime);
    tag.params.fadeTime = max(0.f, tag.params.fadeTime);
    if (tagContext != NULL && *tagContext != '\0')
        tag.params.tagContext = tagContext;
    tag.totalTime = tag.params.visibleTime + tag.params.fadeTime;
    tag.totalFadeTime = tag.params.fadeTime;
    tag.vScreenPos.zero();

    SObj *obj = FindObj(params.entity);
    if (!obj)
    {
        // Create new object to push back
        SObj sobj;
        sobj.obj = eOT_EntityTag;
        sobj.entityId = params.entity;
        sobj.entityHeight = 0.f;
        sobj.timeRemaining = tag.totalTime;
        sobj.totalTime = tag.totalTime;
        sobj.columns.resize(params.column);
        AddToTagList(sobj.tags, tag);

        m_objects[entityTagsContext].push_back(sobj);
    }
    else
    {
        obj->timeRemaining = max(obj->timeRemaining, tag.totalTime);
        obj->totalTime = obj->timeRemaining;
        int size = max(int(obj->columns.size()), params.column);
        if (obj->columns.size() < size)
            obj->columns.resize(size);

        AddToTagList(obj->tags, tag);
    }

    if (m_pETLog->GetIVal() > 0)
    {
        IEntity *ent = gEnv->pEntitySystem->GetEntity(params.entity);
        if (ent)
        {
            CryLog("[Entity Tag] %s added tag: %s", ent->GetName(), params.text.c_str());

            if (m_pETLog->GetIVal() > 1)
            {
                char text[256];
                _snprintf(text, sizeof(text), "[Entity Tag] %s", params.text.c_str());
                gEnv->pAISystem->Record(ent->GetAI(), IAIRecordable::E_NONE, text);
            }
        }
    }
}
//------------------------------------------------------------------------
float CMatchMakingHandler::LegacyC2MatchMakingScore( SCrySessionSearchResult* session, CGameLobby *lobby, bool includeRand )
{
	//Creates sub metrics (between 0-1 (1 being best))

	CGameLobbyCVars *pGameLobbyCVars = CGameLobbyCVars::Get();
	const CGameLobby::EActiveStatus activeStatus = (CGameLobby::EActiveStatus) GameLobbyData::GetSearchResultsData( session, LID_MATCHDATA_ACTIVE );

	const float pingScale = pGameLobbyCVars ? pGameLobbyCVars->gl_findGamePingScale : 1.f;
	const float idealPlayerCount = pGameLobbyCVars ? pGameLobbyCVars->gl_findGameIdealPlayerCount : 1.f;

	float pingSubMetric = 1.0f - clamp_tpl((session->m_ping / pingScale), 0.0f, 1.0f);					//300ms or above gives you a 0 rating
	float playerSubMetric = clamp_tpl((float)session->m_numFilledSlots / idealPlayerCount, 0.0f, 1.0f);					//more players the better
	float lobbySubMetric = (activeStatus != CGameLobby::eAS_Lobby) ? 0.0f : 1.f;		// Prefer games that haven't started yet

	float skillSubMetric = 0.f;
	const int skillRank = lobby->CalculateAverageSkill();
	const int sessionSkillRank = GameLobbyData::GetSearchResultsData(session, LID_MATCHDATA_SKILL);
	if (skillRank)
	{										
		float diff = (float) abs(skillRank - sessionSkillRank);
		float fracDiff = diff / (float) skillRank;
		skillSubMetric = 1.f - MIN(fracDiff, 1.f);
		skillSubMetric = (skillSubMetric * skillSubMetric);
	}

	int32 languageId = lobby->GetCurrentLanguageId();

	float languageSubMetric = 0.f;
	if (languageId == GameLobbyData::GetSearchResultsData(session, LID_MATCHDATA_LANGUAGE))
	{
		languageSubMetric = 1.f;
	}

	float randomSubMetric = ((float) (g_pGame->GetRandomNumber() & 0xffff)) / ((float) 0xffff);

	if(pGameLobbyCVars)
	{
		pingSubMetric *= pGameLobbyCVars->gl_findGamePingMultiplier;
		playerSubMetric *= pGameLobbyCVars->gl_findGamePlayerMultiplier;
		lobbySubMetric *= pGameLobbyCVars->gl_findGameLobbyMultiplier;
		skillSubMetric *= pGameLobbyCVars->gl_findGameSkillMultiplier;
		languageSubMetric *= pGameLobbyCVars->gl_findGameLanguageMultiplier;
		randomSubMetric *= pGameLobbyCVars->gl_findGameRandomMultiplier;
	}

	float score = pingSubMetric + playerSubMetric + lobbySubMetric + skillSubMetric + languageSubMetric;
	
	if( includeRand )
	{
		score += randomSubMetric;
	}

	CryLog("MMLua: Final Score %.2f", score );

	return score;
}
Esempio n. 20
0
//------------------------------------------------------------------------
void CGunTurret::InternalStopFire(bool sec)
{
	if(g_pGameCVars->i_debug_turrets)
		CryLog("%s StopFire(%i)", GetEntity()->GetName(), sec ? 2 : 1);

	if(!sec)
		CWeapon::StopFire();
	else if(m_fm2)
		m_fm2->StopFire();
}
Esempio n. 21
0
void CDataPatchDownloader::DataFailedToDownload(
	CDownloadableResourcePtr		inResource)
{
	// nothing to do, leave CRC at default value
	CryLog("Failed to download data patch");
	if (m_pListener)
	{
		m_pListener->DataPatchNotAvailable();
	}
}
Esempio n. 22
0
//---------------------------------------
void CMiscAnnouncer::Reset()
{
	CryLog("CMiscAnnouncer::Reset()");

	for (TWeaponFiredMap::iterator it=m_weaponFiredMap.begin(); it != m_weaponFiredMap.end(); ++it)
	{
		SOnWeaponFired &onWeaponFired = it->second;
		onWeaponFired.Reset();
	}
}
Esempio n. 23
0
//AddSpawnLocation and RemoveSpawnLocation should not be called at run time as they will corrupt the networking index data
void CGameRulesSpawningBase::AddSpawnLocation(EntityId location, bool isInitialSpawn, bool doVisTest, const char *pGroupName)
{
	if (isInitialSpawn)
	{
		TSpawnLocations *pGroup = GetSpawnLocationsFromGroup(m_initialSpawnLocations, pGroupName);
		stl::push_back_unique(*pGroup, location);
		if (g_pGameCVars->g_debugSpawnPointsRegistration != 0)
			CryLog("[SPAWN POINT]Adding initial spawn point to game rules, Id = '%d' (group='%s'). Number of initial Spawn points in group = '%" PRISIZE_T "'", location, pGroupName, pGroup->size());
	}
	else
	{
		stl::push_back_unique(m_spawnLocations, location);
		if (g_pGameCVars->g_debugSpawnPointsRegistration != 0)
			CryLog("[SPAWN POINT]Adding spawn point to game rules, Id = '%d'. Number of Spawn points = '%" PRISIZE_T "'", location, m_spawnLocations.size());
	}

	stl::push_back_unique(m_allSpawnLocations, location);
	std::sort(m_allSpawnLocations.begin(), m_allSpawnLocations.end(), compare_spawns_name_only());	// We now rely on the order of the table to save memory by not binding spawn points to the network
}
Esempio n. 24
0
void CDLCManager::OnDLCMountFinished(int nPacksFound)
{
	CryLog( "OnDLCMountFinished nPacksFound:%d", nPacksFound);

	CryLog( "DLC: Loaded DLCs flags are 0x%x", GetLoadedDLCs() );

	if( nPacksFound > 0 )
	{
		//we should rescan for any levels added by the DLCs
		ILevelSystem *pLevelSystem = g_pGame->GetIGameFramework()->GetILevelSystem();
		pLevelSystem->Rescan("levels", ILevelSystem::TAG_MAIN);
	}
	
#if ! ENTITLEMENTS_AUTHORATIVE
	//on consoles, after DLC is loaded, we know about what DLC is allowed
	m_allowedDLCUpToDate = true;
#endif

}
//------------------------------------------------------------------------
CGameRulesMPDamageHandling::CGameRulesMPDamageHandling()
{
	CryLog("CGameRulesMPDamageHandling::CGameRulesMPDamageHandling()");
#ifdef SERVER_CHECKS
	m_checkCounter = 0;
#endif

	m_localMeleeScreenFxTimer = 0.f;
	m_entityLastDamageUpdateTimer = 0.f;
}
//------------------------------------------------------------------------
IMPLEMENT_RMI(CGameRules, ClHostMigrationPlayerJoined)
{
	const EntityId playerId = params.entityId;
#if !defined(_RELEASE)
	IEntity *pPlayer = gEnv->pEntitySystem->GetEntity(playerId);
	CryLog("CGameRules::ClHostMigrationPlayerJoined() '%s'", pPlayer ? pPlayer->GetName() : "<NULL>");
#endif
	// todo: ui
	return true;
}
Esempio n. 27
0
/// Registers a feature test (does not take ownership of test)
void CFeatureTestMgr::RegisterFeatureTest(IFeatureTest* pFeatureTest)
{
	assert(pFeatureTest);
	if (pFeatureTest)
	{
		if (!stl::push_back_unique(m_featureTests, pFeatureTest))
		{
			CryLog("Feature test case already registered: %s", pFeatureTest->Name());
		}
	}
}
Esempio n. 28
0
// static
void CGameLobbyManager::UserSignoutCallback(CryLobbyTaskID taskID, ECryLobbyError error, void *pArg)
{
	CryLog("UserSignoutCallback error %d", error);

	CGameLobbyManager *pLobbyMgr =(CGameLobbyManager*)pArg;

	if(pLobbyMgr && pLobbyMgr->m_signOutTaskID == taskID)
	{
		pLobbyMgr->m_signOutTaskID = CryLobbyInvalidTaskID;
	}
}
Esempio n. 29
0
void CWorldState::CreateChild(const char * entityName)
{
	if(worldStateXml)
	{
		CryLog("CWorldState::CreateEntityChild()");
		worldStateXml->newChild(entityName);
		worldStateXml->saveToFile(szSaveFile);
	}
	else
		return;
}
Esempio n. 30
0
// IConsoleVarSink
bool CBatchSyncVarsSink::OnBeforeVarChange( ICVar *pVar,const char *sNewValue )
{
#if LOG_CVAR_USAGE
	CryLog("[CVARS]: [CHANGED] CBatchSyncVarsSink::OnBeforeVarChange(): variable [%s] with a value of [%s]; %s changing to [%s]",
		pVar->GetName(),
		pVar->GetString(),
		(gEnv->bServer) ? "SERVER" : "CLIENT",
		sNewValue);
#endif // LOG_CVAR_USAGE
	return true;
}