// ---------------------------------------------------------------------------- void CMannequinAGState::AddListener( const char* name, IAnimationGraphStateListener* pListener ) { SListener listener; cry_strcpy(listener.name, name); listener.pListener = pListener; stl::push_back_unique( m_listeners, listener ); }
//==================================================================== // MannLog //==================================================================== void Log(const IActionController &actionControllerI, const char *format, ...) { const CActionController &actionController = (const CActionController &)actionControllerI; char outputBufferLog[MAX_WARNING_LENGTH]; const uint32 outputBufferSize = sizeof(outputBufferLog); va_list args; va_start(args, format); vsnprintf(outputBufferLog, outputBufferSize, format, args); outputBufferLog[outputBufferSize-1] = '\0'; va_end(args); if (mn_logToFile) { gEnv->pSystem->Warning( VALIDATOR_MODULE_ANIMATION, VALIDATOR_WARNING, 0, 0, "Mann: %s", outputBufferLog ); } if (actionController.GetFlag(AC_DebugDraw)) { savedMsgs[savedMsgIndex].savedMsgType = SMT_WARNING; cry_strcpy(savedMsgs[savedMsgIndex].savedMsg, outputBufferLog); savedMsgs[savedMsgIndex].renderFrame = gEnv->pRenderer->GetFrameID(); savedMsgs[savedMsgIndex].isNew = true; savedMsgs[savedMsgIndex].isUsed = true; savedMsgIndex = (savedMsgIndex + 1) % maxSavedMsgs; } }
void CClipVolumeProxy::SerializeXML(XmlNodeRef &entityNodeXML, bool loading) { if(loading) { LOADING_TIME_PROFILE_SECTION; if(XmlNodeRef pVolumeNode = entityNodeXML->findChild( "ClipVolume" )) { const char* szFileName = NULL; if(pVolumeNode->getAttr("GeometryFileName",&szFileName)) { // replace %level% by level path char szFilePath[_MAX_PATH]; const int nAliasNameLen = sizeof("%level%")-1; cry_strcpy(szFilePath, gEnv->p3DEngine->GetLevelFilePath(szFileName+nAliasNameLen)); if(m_pEntity && LoadFromFile(szFilePath)) gEnv->p3DEngine->UpdateClipVolume(m_pClipVolume, m_pRenderMesh, m_pBspTree, m_pEntity->GetWorldTM(), !m_pEntity->IsHidden(), m_pEntity->GetName()); } } } else { XmlNodeRef volumeNode = entityNodeXML->newChild( "ClipVolume" ); volumeNode->setAttr( "GeometryFileName", m_GeometryFileName ); } }
void CEntityClassRegistry::LoadClasses( const char *sRootPath,bool bOnlyNewClasses ) { ICryPak *pCryPak = gEnv->pCryPak; _finddata_t fd; char filename[_MAX_PATH]; string sPath = sRootPath; sPath.TrimRight("/\\"); string sSearch = sPath + "/*.ent"; intptr_t handle = pCryPak->FindFirst( sSearch, &fd, 0); if (handle != -1) { int res = 0; do { // Animation file found, load it. cry_strcpy(filename,sPath); cry_strcat(filename,"/"); cry_strcat(filename,fd.name); // Load xml file. XmlNodeRef root = m_pSystem->LoadXmlFromFile(filename); if (root) { LoadClassDescription(root,bOnlyNewClasses); } res = pCryPak->FindNext( handle,&fd ); } while (res >= 0); pCryPak->FindClose(handle); } }
//------------------------------------------------------------------------ void CGameRulesHoldObjectiveBase::ReadAudioSignal( const XmlNodeRef node, const char* name, CAudioSignalPlayer* signalPlayer ) { if(node->haveAttr(name)) { char signalName[32]; cry_strcpy(signalName, node->getAttr(name)); signalPlayer->SetSignal(signalName); } }
SCreateChannelResult CGameClientNub::CreateChannel(INetChannel* pChannel, const char* pRequest) { if (pRequest && !gEnv->pNetwork->IsRebroadcasterEnabled()) { GameWarning("CGameClientNub::CreateChannel: pRequest is non-null, it should not be"); CRY_ASSERT(false); SCreateChannelResult res(eDC_GameError); cry_strcpy(res.errorMsg, "CGameClientNub::CreateChannel: pRequest is non-null, it should not be"); return res; } if (m_pClientChannel) { if (gEnv->pNetwork->IsRebroadcasterEnabled()) { // A client channel has already been set up so this must be a rebroadcaster (peer to peer) channel pChannel->SetPeer(m_pGameContext->GetNetContext()); SCreateChannelResult res(reinterpret_cast<IGameChannel*>(pChannel)); return res; } else { GameWarning("CGameClientNub::CreateChannel: m_pClientChannel is non-null, it should not be"); CRY_ASSERT(false); SCreateChannelResult res(eDC_GameError); cry_strcpy(res.errorMsg, "CGameClientNub::CreateChannel: m_pClientChannel is non-null, it should not be"); return res; } } if (CCryAction::GetCryAction()->IsGameSessionMigrating()) { pChannel->SetMigratingChannel(true); } m_pClientChannel = new CGameClientChannel(pChannel, m_pGameContext, this); ICVar* pPass = gEnv->pConsole->GetCVar("sv_password"); if (pPass && gEnv->bMultiplayer) pChannel->SetPassword(pPass->GetString()); return SCreateChannelResult(m_pClientChannel); }
bool CGameStartup::GetRestartMod(char* pModNameBuffer, int modNameBufferSizeInBytes) { if (m_reqModUnload) { if (modNameBufferSizeInBytes > 0) pModNameBuffer[0] = 0; return true; } if (m_reqModName.empty()) return false; cry_strcpy(pModNameBuffer, modNameBufferSizeInBytes, m_reqModName.c_str()); return true; }
void CResourceCompilerHelper::GetOutputFilename(const char* szFilePath, char* buffer, size_t bufferSizeInBytes) { const char* const ext = GetExtension(szFilePath); if (ext) { if (stricmp(ext, "tif") == 0 || stricmp(ext, "hdr") == 0) { ReplaceExtension(szFilePath, "dds", buffer, bufferSizeInBytes); return; } } cry_strcpy(buffer, bufferSizeInBytes, szFilePath); }
// little helper function (to stay independent) void CResourceCompilerHelper::ReplaceExtension(const char* path, const char* new_ext, char* buffer, size_t bufferSizeInBytes) { const char* const ext = GetExtension(path); SettingsManagerHelpers::CFixedString<char, 512> p; if(ext) { p.set(path, ext - path); p.append(new_ext); } else { p.set(path); p.append("."); p.append(new_ext); } cry_strcpy(buffer, bufferSizeInBytes, p.c_str()); }
SUnlock::SUnlock(XmlNodeRef node, int rank) { m_name[0] = '\0'; m_rank = rank; m_reincarnation = 0; m_unlocked = false; m_type = eUT_Invalid; DesignerWarning(strcmpi(node->getTag(), "unlock") == 0 || strcmpi(node->getTag(), "allow") == 0, "expect tag of unlock or allow at %d", node->getLine()); const char * theName = node->getAttr("name"); const char * theType = node->getAttr("type"); const char * theReincarnationLevel = node->getAttr("reincarnation"); // These pointers should always be valid... if an attribute isn't found, getAttr returns a pointer to an empty string [TF] assert (theName && theType); if (theType && theType[0] != '\0') { m_type = SUnlock::GetUnlockTypeFromName(theType); cry_strcpy(m_name, theName); bool expectName = (m_type == eUT_Loadout || m_type == eUT_Weapon || m_type == eUT_Attachment || m_type == eUT_Playlist || m_type == eUT_CreateCustomClass); bool gotName = (theName[0] != '\0'); if (expectName != gotName && m_type != eUT_Invalid) // If it's invalid, we'll already have displayed a warning... { GameWarning("[PROGRESSION] An unlock of type '%s' %s have a name but XML says name='%s'", theType, expectName ? "should" : "shouldn't", theName); } } else { GameWarning("[PROGRESSION] XML node contains an 'unlock' tag with no type (name='%s')", theName); } if (theReincarnationLevel != NULL && theReincarnationLevel[0] != '\0') { m_reincarnation = atoi(theReincarnationLevel); CPlayerProgression *pPlayerProgression = CPlayerProgression::GetInstance(); DesignerWarning(m_reincarnation > 0 && m_reincarnation < pPlayerProgression->GetMaxReincarnations()+1, "Unlock %s reincarnation parameter is outside of the range 0 - %d", theName, pPlayerProgression->GetMaxReincarnations()+1); } }
//------------------------------------------------------------------------ bool CVehiclePartTread::Init(IVehicle* pVehicle, const CVehicleParams& table, IVehiclePart* parent, CVehicle::SPartInitInfo& initInfo, int partType) { if (!CVehiclePartBase::Init(pVehicle, table, parent, initInfo, eVPT_Tread)) return false; CVehicleParams subTable = table.findChild("Tread"); // Tread subtable if (!subTable) return false; string filename = subTable.getAttr("filename"); if (filename.empty()) return false; subTable.getAttr("uvSpeedMultiplier", m_uvSpeedMultiplier); if (table.haveAttr("component")) { if (CVehicleComponent* pComponent = static_cast<CVehicleComponent*>(m_pVehicle->GetComponent(table.getAttr("component")))) pComponent->AddPart(this); } m_slot = GetEntity()->LoadCharacter(m_slot, filename); m_pCharInstance = GetEntity()->GetCharacter(m_slot); if (!m_pCharInstance) return false; if (subTable.haveAttr("materialName")) { string materialName = subTable.getAttr("materialName"); materialName.MakeLower(); IMaterial* pMaterial = 0; const char* subMtlName = 0; int subMtlSlot = -1; // find tread material IEntityRenderProxy *pRenderProxy = (IEntityRenderProxy*)GetEntity()->GetProxy(ENTITY_PROXY_RENDER); if (pRenderProxy) { pMaterial = pRenderProxy->GetRenderMaterial(m_slot); if (pMaterial) { // if matname doesn't fit, look in submaterials if (string(pMaterial->GetName()).MakeLower().find(materialName) == string::npos) { for (int i=0; i < pMaterial->GetSubMtlCount(); ++i) { if (string(pMaterial->GetSubMtl(i)->GetName()).MakeLower().find(materialName) != string::npos) { subMtlName = pMaterial->GetSubMtl(i)->GetName(); subMtlSlot = i; break; } } } } } if (pMaterial) { // clone IMaterial *pCloned = pMaterial->GetMaterialManager()->CloneMultiMaterial(pMaterial, subMtlName); if (pCloned) { pRenderProxy->SetSlotMaterial(m_slot, pCloned); pMaterial = pCloned; m_pMaterial = pMaterial; } if (subMtlSlot > -1) m_pShaderResources = pMaterial->GetShaderItem(subMtlSlot).m_pShaderResources; else m_pShaderResources = pMaterial->GetShaderItem().m_pShaderResources; } if (m_pShaderResources) { for (int i = 0; i < EFTT_MAX; ++i) { if (!m_pShaderResources->GetTexture(i)) continue; SEfTexModificator& modif = *m_pShaderResources->GetTexture(i)->AddModificator(); modif.SetMember("m_eMoveType[0]", 1.0f); // ETMM_Fixed: u = m_OscRate[0] + sourceU modif.SetMember("m_OscRate[0]", 0.0f); } } } char wheelName[256]; IDefaultSkeleton& rIDefaultSkeleton = m_pCharInstance->GetIDefaultSkeleton(); for (int i=0; i<rIDefaultSkeleton.GetJointCount(); ++i) { const char* boneName = rIDefaultSkeleton.GetJointNameByID(i); if (0 != boneName) { // extract wheel name const size_t len = strcspn(boneName, "_"); if (len < strlen(boneName) && len < sizeof(wheelName)) { cry_strcpy(wheelName, boneName, len); CVehiclePartSubPartWheel* pWheel = (CVehiclePartSubPartWheel*)m_pVehicle->GetPart(wheelName); if (pWheel) { SWheelInfo wheelInfo; wheelInfo.slot = pWheel->m_slot; wheelInfo.jointId = i; wheelInfo.pWheel = pWheel; m_wheels.push_back(wheelInfo); m_lastWheelIndex = pWheel->GetWheelIndex(); } } } } m_pVehicle->SetObjectUpdate(this, IVehicle::eVOU_AlwaysUpdate); m_state = eVGS_Default; return true; }
//------------------------------------------------------------------------ void CPlaylistActivityTracker::DataDownloaded( CDownloadableResourcePtr inResource ) { //get the task type of the resource by finding it in our vector ERequestTaskType taskType = eRTT_MaxCount; for( int i = 0; i < eRTT_MaxCount; i++ ) { if( m_downloadableResources[ i ] == inResource ) { taskType = (ERequestTaskType)i; break; } } if( taskType == eRTT_RequestActivity ) { bool dataRead = false; //parse xml int bufferSize = -1; char* buffer; inResource->GetRawData( &buffer, &bufferSize ); //debug output data stream to log CryLog( "PlaylistActivity: Full processed Data %s", buffer ); IXmlParser* parser = GetISystem()->GetXmlUtils()->CreateXmlParser(); XmlNodeRef topNode = parser->ParseBuffer(buffer, bufferSize, false); if( topNode && stricmp( topNode->getTag(), "playlists" ) == 0 ) { //Iterate over playlists const int numberOfPlaylistElements = topNode->getChildCount(); int destPlaylistIdx = 0; //separate index to write to in case there are non-playlist node for(int playlistIdx = 0; playlistIdx < numberOfPlaylistElements && destPlaylistIdx < MAX_PLAYLISTS; ++playlistIdx ) { //get and check playlist node const XmlNodeRef playlistNode = topNode->getChild( playlistIdx ); if( playlistNode && stricmp( playlistNode->getTag(), "playlist" ) == 0 ) { PlaylistActivity& currentPlaylist = m_activityData[ destPlaylistIdx ]; //copy name and Id into structure const char* playlistName = NULL; if( playlistNode->getAttr( "name", &playlistName ) ) { cry_strcpy( currentPlaylist.name, playlistName ); } int id = 0; if( playlistNode->getAttr( "index", id ) ) { currentPlaylist.id = id; } //clear totals currentPlaylist.nPlayers = 0; currentPlaylist.nGames = 0; //Iterate over variants const int numberOfVariantElements = playlistNode->getChildCount(); currentPlaylist.nVariants = 0; //use count as index to write to in case there are non-variant nodes for(int variantIdx = 0; variantIdx < numberOfVariantElements && currentPlaylist.nVariants < MAX_VARIANTS; ++variantIdx ) { //get and check variant node const XmlNodeRef variantNode = playlistNode->getChild( variantIdx ); if( variantNode && stricmp( variantNode->getTag(), "variant" ) == 0 ) { VariantActivity& currentVariant = currentPlaylist.variants[ currentPlaylist.nVariants ]; //copy data into structure const char* variantName = NULL; if( variantNode->getAttr( "name", &variantName ) ) { cry_strcpy( currentVariant.name, variantName ); } int variantId = 0; if( variantNode->getAttr( "index", variantId ) ) { currentVariant.id = variantId; } int count = 0; if( variantNode->getAttr( "players", count ) ) { currentVariant.nPlayers = count; //increase total currentPlaylist.nPlayers += count; } if( variantNode->getAttr( "games", count ) ) { currentVariant.nGames = count; //increase total currentPlaylist.nGames += count; } currentPlaylist.nVariants++; dataRead = true; } } destPlaylistIdx++; } }//end loop m_nKnownPlaylists = destPlaylistIdx; } if( m_currentActivityCallback ) { m_currentActivityCallback( dataRead, m_activityData, m_nKnownPlaylists ); } } else { //other requests don't have a payload to deliver to us } ReleaseResourceReference( inResource ); }
//------------------------------------------------------------------------ SCreateChannelResult CGameServerNub::CreateChannel(INetChannel *pChannel, const char *pRequest) { CRY_ASSERT(m_maxPlayers); CGameServerChannel *pNewChannel; if (!pRequest) { CRY_ASSERT(false); SCreateChannelResult res(eDC_GameError); return res; } SParsedConnectionInfo info = m_pGameContext->ParseConnectionInfo(pRequest); if (!info.allowConnect) { GameWarning( "Not allowed to connect to server: %s", info.errmsg.c_str() ); SCreateChannelResult res(info.cause); cry_strcpy(res.errorMsg, info.errmsg.c_str()); return res; } if (int(m_channels.size()) >= m_maxPlayers) { SCreateChannelResult res(eDC_ServerFull); cry_strcpy(res.errorMsg, string().Format("Disallowing more than %d players",m_maxPlayers).c_str()); return res; } if (info.isMigrating && CCryAction::GetCryAction()->IsGameSessionMigrating()) { pChannel->SetMigratingChannel(true); } pNewChannel = GetOnHoldChannelFor(pChannel); if (!pNewChannel) { pNewChannel = new CGameServerChannel(pChannel, m_pGameContext, this); if (pChannel->GetSession() != CrySessionInvalidHandle) { // There is a valid CrySessionHandle created by the lobby so use this as the channel id // as it contains information that can identify the connection in the lobby. pNewChannel->SetChannelId(pChannel->GetSession()); } else { // No valid CrySessionHandle so create an id here. pNewChannel->SetChannelId(++m_genId); } if (m_channels.find(pNewChannel->GetChannelId()) != m_channels.end()) { CryFatalError("CGameServerNub::CreateChannel: Trying to create channel with duplicate id %d", pNewChannel->GetChannelId()); } m_channels.insert(TServerChannelMap::value_type(pNewChannel->GetChannelId(), pNewChannel)); } else { pNewChannel->SetNetChannel(pChannel); #if !NEW_BANDWIDTH_MANAGEMENT pNewChannel->SetupNetChannel(pChannel); #endif // NEW_BANDWIDTH_MANAGEMENT } ICVar* pPass = gEnv->pConsole->GetCVar("sv_password"); if (pPass && gEnv->bMultiplayer) { pChannel->SetPassword(pPass->GetString()); } pChannel->SetNickname(info.playerName.c_str()); // Host migration if (info.isMigrating && CCryAction::GetCryAction()->IsGameSessionMigrating()) { // Enable the game rules to find the migrating player details by channel id IGameFramework *pGameFramework = gEnv->pGame->GetIGameFramework(); IGameRules *pGameRules = pGameFramework->GetIGameRulesSystem()->GetCurrentGameRules(); if(pGameRules) { EntityId playerID = pGameRules->SetChannelForMigratingPlayer(info.playerName.c_str(), pNewChannel->GetChannelId()); if (playerID) { CryLog("CGameServerNub::CreateChannel() assigning actor %d '%s' to channel %d", playerID, info.playerName.c_str(), pNewChannel->GetChannelId()); pNewChannel->SetPlayerId(playerID); } else { CryLog("CGameServerNub::CreateChannel() failed to assign actor '%s' to channel %d", info.playerName.c_str(), pNewChannel->GetChannelId()); } } else { CryLog("[host migration] terminating because game rules is NULL, game session migrating %d session 0x%08x", CCryAction::GetCryAction()->IsGameSessionMigrating(), pChannel->GetSession()); gEnv->pNetwork->TerminateHostMigration(pChannel->GetSession()); } } m_netchannels.insert(TNetServerChannelMap::value_type(pChannel, pNewChannel->GetChannelId())); return SCreateChannelResult(pNewChannel); }
//-------------------------------------------------------------------------------------------------- // Name: Initialise // Desc: Initialises post effect activation system from data // Uses the xml node name for the post effect, and activeValue and nonActiveValue attributes //-------------------------------------------------------------------------------------------------- void CPostEffectActivationSystem::Initialise(const IItemParamsNode* postEffectListXmlNode) { if(postEffectListXmlNode) { const IItemParamsNode* postEffectXmlNode = NULL; SPostEffectParam* param = NULL; int childCount = postEffectListXmlNode->GetChildCount(); int postEffectCount = childCount; const IItemParamsNode* vecsXmlNode = postEffectListXmlNode->GetChild("vecs"); if(vecsXmlNode) { postEffectCount--; } m_postEffectParam.resize(postEffectCount); int paramIndex=0; for(int c=0; c<childCount; c++) { postEffectXmlNode = postEffectListXmlNode->GetChild(c); if(postEffectXmlNode && postEffectXmlNode != vecsXmlNode) { param = &m_postEffectParam[paramIndex]; cry_strcpy(param->name, postEffectXmlNode->GetName()); postEffectXmlNode->GetAttribute("activeValue",param->activeValue); postEffectXmlNode->GetAttribute("nonActiveValue",param->nonActiveValue); int forceValue = 0; postEffectXmlNode->GetAttribute("forceValue",forceValue); param->forceValue = (forceValue) ? true : false; paramIndex++; } } if(vecsXmlNode) { SPostEffectParamVec* paramVec = NULL; const int vecCount = vecsXmlNode->GetChildCount(); m_postEffectParamVec.resize(vecCount); for(int i=0; i<vecCount; i++) { postEffectXmlNode = vecsXmlNode->GetChild(i); paramVec = &m_postEffectParamVec[i]; cry_strcpy(paramVec->name, postEffectXmlNode->GetName()); Vec3 vecValue(0.0f,0.0f,0.0f); float wValue = 0.0f; postEffectXmlNode->GetAttribute("activeVec3",vecValue); postEffectXmlNode->GetAttribute("activeW",wValue); paramVec->activeValue = Vec4(vecValue,wValue); postEffectXmlNode->GetAttribute("nonActiveVec3",vecValue); postEffectXmlNode->GetAttribute("nonActiveW",wValue); paramVec->nonActiveValue = Vec4(vecValue,wValue); int forceValue = 0; postEffectXmlNode->GetAttribute("forceValue",forceValue); paramVec->forceValue = (forceValue) ? true : false; } } } }//-------------------------------------------------------------------------------------------------
void Prologue( const char * function, const char * format ) { cry_strcpy(m_function, function); m_format = format; }
bool CControllerInputRenderInfo::SetText(const char * text) { m_type = kCITV_text; return cry_strcpy(m_text, CHUDUtils::LocalizeString(text, NULL, NULL)); }
//------------------------------------------------------------------------ void CMatchMakingHandler::OnSearchResult( SCrySessionSearchResult* pSession ) { //session will expire at the end of the callback //so copy it into a results structure (we need lots of details to pass to the matchmaking part //store it in a map (indexed via sessionID?) //pass the index to the lua CGameLobbyManager* pLobbyManager = g_pGame->GetGameLobbyManager(); if( pLobbyManager ) { CGameLobby* pLobby = pLobbyManager->GetGameLobby(); //first check if this result refers to a lobby we're in/hosting if( pLobby->IsCurrentSessionId( pSession->m_id ) ) { //this is the session for the lobby we are in, early out return; } //also check secondary lobby if( CGameLobby* pSecondaryLobby = pLobbyManager->GetNextGameLobby() ) { if( ( pSecondaryLobby->IsCurrentSessionId( pSession->m_id ) ) ) { //this is the session for the lobby we are going to, early out return; } } const CGameLobby::EActiveStatus activeStatus = (CGameLobby::EActiveStatus) GameLobbyData::GetSearchResultsData( pSession, LID_MATCHDATA_ACTIVE ); bool bIsBadServer = pLobby->IsBadServer( pSession->m_id ); const int skillRank = pLobby->CalculateAverageSkill(); const int sessionSkillRank = GameLobbyData::GetSearchResultsData( pSession, LID_MATCHDATA_SKILL ); const int sessionLanguageId = GameLobbyData::GetSearchResultsData( pSession, LID_MATCHDATA_LANGUAGE ); float sessionScore = LegacyC2MatchMakingScore( pSession, pLobby, false ); int32 region = 0; #if GAMELOBBY_USE_COUNTRY_FILTERING region = GameLobbyData::GetSearchResultsData( pSession, LID_MATCHDATA_COUNTRY ); #endif //GAMELOBBY_USE_COUNTRY_FILTERING #if defined(TRACK_MATCHMAKING) if( CMatchmakingTelemetry* pMMTel = g_pGame->GetMatchMakingTelemetry() ) { pMMTel->AddEvent( SMMFoundSessionEvent( pSession, activeStatus, skillRank - sessionSkillRank, region, sessionLanguageId, bIsBadServer, sessionScore ) ); } #endif //defined(TRACK_MATCHMAKING) HSCRIPTFUNCTION scriptFunction; if( m_pScript->GetValue( "OnSearchResult", scriptFunction ) ) { //Make a table to hold the search result SmartScriptTable result( gEnv->pScriptSystem ); SessionDetails newSession; newSession.m_id = pSession->m_id; cry_strcpy( newSession.m_name, pSession->m_data.m_name ); //capture the session ID in a map std::pair< TSessionIdMap::iterator, bool > insertResult = m_sessionIdMap.insert( std::make_pair( m_sessionIdIndex++, newSession ) ); if( insertResult.second ) { CryLog( "MMLua: Adding a server with parameters ping %d, status %d, avSkill %d", pSession->m_ping, activeStatus, sessionSkillRank ); result->SetValue( "SessionId", insertResult.first->first ); result->SetValue( "SearchId", s_currentMMSearchID ); float timeSinceStarted = gEnv->pTimer->GetFrameStartTime().GetSeconds() - m_startTime; result->SetValue( "TimeFound", timeSinceStarted ); //make a sub table to hold all the known session parameters SmartScriptTable parameters( gEnv->pScriptSystem ); result->SetValue( "Parameters", parameters ); parameters->SetValue( "ActiveStatus", activeStatus ); parameters->SetValue( "ServerAvSkill", sessionSkillRank ); parameters->SetValue( "Region", region ); parameters->SetValue( "Language", sessionLanguageId ); parameters->SetValue( "BadServer", bIsBadServer ); parameters->SetValue( "Ping", pSession->m_ping ); parameters->SetValue( "FilledSlots", pSession->m_numFilledSlots ); Script::Call( gEnv->pScriptSystem, scriptFunction, m_pScript, result ); gEnv->pScriptSystem->ReleaseFunc( scriptFunction ); } } } }
virtual void GetConfiguration( SFlowNodeConfig &config ) { #ifndef _RELEASE static char pPresetsHelp[1024] = ""; if (pPresetsHelp[0] == 0) { cry_strcpy(pPresetsHelp, "Preset input values. When this is used, all parameter inputs are ignored.\n" ); for (int i = 0; i < NUM_PRESETS; i++) { char buf[300]; cry_sprintf(buf, "-- %s : Angle: (%4.3f,%4.3f,%4.3f) Shift: (%4.3f,%4.3f,%4.3f ) Freq: %3.1f Random: %3.1f Distance: %3.1f RangeMin: %3.1f RangeMax: %3.1f sustainDuration: %3.1f FadeInDur: %3.1f FadeOutDur: %3.1f \n", m_Presets[i].pName, m_Presets[i].angle.x, m_Presets[i].angle.y, m_Presets[i].angle.z, m_Presets[i].shift.x, m_Presets[i].shift.y, m_Presets[i].shift.z, m_Presets[i].frequency, m_Presets[i].randomness, m_Presets[i].distance, m_Presets[i].rangeMin, m_Presets[i].rangeMax, m_Presets[i].sustainDuration, m_Presets[i].fadeInDuration, m_Presets[i].fadeOutDuration ); cry_strcat(pPresetsHelp, buf); } } static char pPresetsEnumDef[100] = ""; if (pPresetsEnumDef[0] == 0) { cry_strcpy(pPresetsEnumDef, "enum_int:NoPreset=0," ); for (int i = 0; i < NUM_PRESETS; i++) { char buf[100]; cry_sprintf(buf, "%s=%1d,", m_Presets[i].pName, i + 1 ); cry_strcat(pPresetsEnumDef, buf); } } #endif static const SInputPortConfig in_config[] = { InputPortConfig_Void ( "Trigger", _HELP("Trigger to start shaking")), InputPortConfig<int> ( "Restrict", ER_None, _HELP("Restriction"), 0, _UICONFIG("enum_int:None=0,NoVehicle=1,InVehicle=2")), InputPortConfig<int> ( "View", VT_FirstPerson, _HELP("Which view to use. FirstPerson or Current (might be Trackview)."), 0, _UICONFIG("enum_int:FirstPerson=0,Current=1")), InputPortConfig<bool> ( "GroundOnly", false, _HELP("Apply shake only when the player is standing on the ground")), InputPortConfig<bool> ( "Smooth", false, _HELP("Smooth shakes avoid sudden direction changes.")), InputPortConfig<Vec3> ( "Angle", Vec3(0.7f, 0.7f, 0.7f), _HELP("Shake Angles")), InputPortConfig<Vec3> ( "Shift", Vec3(0.01f, 0.01f, 0.01f), _HELP("Shake shifting")), InputPortConfig<float>( "Frequency", 12.0f, _HELP("Frequency. Can be changed dynamically."), 0, _UICONFIG("v_min=0,v_max=100")), InputPortConfig<float>( "Randomness", 1.f, _HELP("Randomness")), InputPortConfig<float>( "Distance", 0.0f, _HELP("Distance to effect source. If an entity is asociated to the node, distance from that entity to the current camera will be used instead")), InputPortConfig<float>( "RangeMin", 0.0f, _HELP("Maximum strength effect range")), InputPortConfig<float>( "RangeMax", 30.0f, _HELP("Effect range")), InputPortConfig<float>( "SustainDuration", 0.f, _HELP("duration of the non fading part of the shake. (total duration is fadein + this + fadeout ). -1 = permanent")), InputPortConfig<float>( "FadeInDuration", 0.f, _HELP("Fade in time (seconds)")), InputPortConfig<float>( "FadeOutDuration", 3.f, _HELP("Fade out time (seconds)")), InputPortConfig_Void ( "Stop", _HELP("Stop the shaking (will fade out)")), #ifdef _RELEASE InputPortConfig<int> ( "Preset", 0, _HELP("Preset input values. When this is used, all parameter inputs are ignored.")), #else InputPortConfig<int> ( "Preset", 0, pPresetsHelp, 0, _UICONFIG(pPresetsEnumDef)), #endif {0} }; config.nFlags |= EFLN_TARGET_ENTITY; config.sDescription = _HELP("Camera View Shake node. If an entity is provided, its position will be used for the distance calculations instead of the raw 'distance' input."); config.pInputPorts = in_config; config.pOutputPorts = 0; config.SetCategory(EFLN_APPROVED); }