本文整理汇总了C++中CryFixedStringT类的典型用法代码示例。如果您正苦于以下问题:C++ CryFixedStringT类的具体用法?C++ CryFixedStringT怎么用?C++ CryFixedStringT使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CryFixedStringT类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
int CGameStartup::Run( const char * autoStartLevelName )
{
#if defined(RELEASE_SERVER_SECURITY)
CryLogAlways("Performing Validation Checks");
if (!PerformDedicatedInstallationSanityCheck())
{
CryFatalError("Installation appears to be corrupt. Please check the log file for a list of problems.");
}
#endif
gEnv->pConsole->ExecuteString( "exec autoexec.cfg" );
if (autoStartLevelName)
{
//load savegame
if(CryStringUtils::stristr(autoStartLevelName, CRY_SAVEGAME_FILE_EXT) != 0 )
{
CryFixedStringT<256> fileName (autoStartLevelName);
// NOTE! two step trimming is intended!
fileName.Trim(" "); // first: remove enclosing spaces (outside ")
fileName.Trim("\""); // second: remove potential enclosing "
gEnv->pGame->GetIGameFramework()->LoadGame(fileName.c_str());
}
else //start specified level
{
CryFixedStringT<256> mapCmd ("map ");
mapCmd+=autoStartLevelName;
gEnv->pConsole->ExecuteString(mapCmd.c_str());
}
}
#ifdef WIN32
if (!(gEnv && gEnv->pSystem) || (!gEnv->IsEditor() && !gEnv->IsDedicated()))
{
::ShowCursor(TRUE); // Make the cursor visible again (it was hidden in InitFramework() )
if (gEnv && gEnv->pSystem && gEnv->pSystem->GetIHardwareMouse())
gEnv->pSystem->GetIHardwareMouse()->DecrementCounter();
}
AllowAccessibilityShortcutKeys(false);
for(;;)
{
ISystem *pSystem = gEnv ? gEnv->pSystem : 0;
if (!pSystem)
{
break;
}
if (pSystem->PumpWindowMessage(false) == -1)
{
break;
}
if (!Update(true, 0))
{
// need to clean the message loop (WM_QUIT might cause problems in the case of a restart)
// another message loop might have WM_QUIT already so we cannot rely only on this
pSystem->PumpWindowMessage(true);
break;
}
}
#else
// We should use bVisibleByDefault=false then...
if (gEnv && gEnv->pHardwareMouse)
gEnv->pHardwareMouse->DecrementCounter();
#if !defined(DURANGO)
for(;;)
{
if (!Update(true, 0))
{
break;
}
}
#endif
#endif //WIN32
return 0;
}
示例2: LoadObjectiveAnalysisData
void CHUDMissionObjectiveSystem::LoadObjectiveAnalysisData(const char* levelpath)
{
CryFixedStringT<128> filename;
if(levelpath==NULL)
{
filename = "Libs/UI/ObjectivesAnalysis.xml";
}
else
{
filename.Format("%s/leveldata/ObjectivesAnalysis.xml", levelpath);
}
XmlNodeRef root = GetISystem()->LoadXmlFromFile(filename.c_str());
if (root == 0)
return;
XmlNodeRef analysisDataContainerNode = root->findChild("AnalysisData");
SObjectiveAnalysisData analysisData;
SSingleObjectiveAnalysisData singleAnalysisData;
if (analysisDataContainerNode != 0)
{
for(int i = 0; i < analysisDataContainerNode->getChildCount(); ++i)
{
XmlNodeRef analysisDataNode = analysisDataContainerNode->getChild(i);
const char* szOuterId = analysisDataNode->getAttr("Id");
if (szOuterId == NULL || szOuterId[0] == '\0')
{
GameWarning("CHUDMissionObjectiveSystem::LoadObjectiveAnalysisData: Failed to load analysisdata, invalid id");
continue;
}
analysisData.m_singleObjectiveData.clear();
const int iNumSingleAnalysis = analysisDataNode->getChildCount();
bool bFailedAddedSingleAnalysis = false;
for (int j = 0; j < iNumSingleAnalysis; j++)
{
XmlNodeRef singleAnalysisDataNode = analysisDataNode->getChild(j);
const char* szSingleId;
int iUseOuterId;
// UseOuterId saves needing to duplicate text to the outer Id
bool bResult = singleAnalysisDataNode->getAttr("UseOuterId", iUseOuterId);
if (bResult && (iUseOuterId == 1))
{
szSingleId = szOuterId;
}
else
{
szSingleId = analysisDataNode->getAttr("Id");
}
if (szSingleId == NULL || szSingleId[0] == '\0')
{
GameWarning("CHUDMissionObjectiveSystem::LoadObjectiveAnalysisData: Failed to load single analysisdata section for analysis: %s, invalid id", szOuterId);
bFailedAddedSingleAnalysis = true;
break;
}
singleAnalysisData.m_id = szSingleId;
singleAnalysisDataNode->getAttr("Percent", singleAnalysisData.m_fPercent);
analysisData.m_singleObjectiveData.push_back(singleAnalysisData);
}
if (bFailedAddedSingleAnalysis || analysisData.m_singleObjectiveData.size() < 1)
{
GameWarning("CHUDMissionObjectiveSystem::LoadObjectiveAnalysisData: Failed to load analysisdata: %s, problem with section data", szOuterId);
continue;
}
analysisDataNode->getAttr("OverrideSectionID",analysisData.m_iOverrideIndex);
analysisDataNode->getAttr("AttachInWorld", analysisData.m_bAttachInWorld);
m_objectiveAnalysisData[szOuterId] = analysisData;
}
}
}
示例3: GetISystem
void COptionsManager::ResetDefaults(const char* option)
{
if(!m_pPlayerProfileManager)
return;
const char* user = m_pPlayerProfileManager->GetCurrentUser();
IPlayerProfile *pProfile = m_pPlayerProfileManager->GetCurrentProfile(user);
if(!pProfile)
return;
XmlNodeRef root = GetISystem()->LoadXmlFile("libs/config/profiles/default/attributes.xml");
bool resetAll = (option==NULL);
bool detectHardware = false;
for (int i = 0; i < root->getChildCount(); ++i)
{
XmlNodeRef enumNameNode = root->getChild(i);
const char *name = enumNameNode->getAttr("name");
const char *value = enumNameNode->getAttr("value");
if(name && value)
{
const char* attribCVar = "";
bool bWriteToCfg = false;
const bool bIsOption = IsOption(name, attribCVar, bWriteToCfg);
if(bIsOption)
{
if(!resetAll && strcmp(attribCVar,option))
continue;
if(!strcmp(attribCVar, "sys_spec_Shadows"))
{
detectHardware = true;
}
if(!strcmp(attribCVar, "hud_colorLine"))
{
CryFixedStringT<32> color;
color.Format("%d", g_pGameCVars->hud_colorLine);
SetCrysisProfileColor(color.c_str());
}
if(!strcmp(attribCVar,"pb_client"))
{
if(atoi(value)==0)
{
m_pbEnabled = false;
gEnv->pConsole->ExecuteString("net_pb_cl_enable false");
}
else
{
m_pbEnabled = true;
gEnv->pConsole->ExecuteString("net_pb_cl_enable true");
}
}
else if(!strcmp(attribCVar, "g_difficultyLevel"))
{
SetDifficulty(value);
}
else
{
ICVar *pCVar = gEnv->pConsole->GetCVar(attribCVar);
if(pCVar)
{
pCVar->Set(value);
}
}
if(!resetAll)
break;
}
}
}
if(detectHardware)
AutoDetectHardware("");
}
示例4: switch
void CGameBrowser::ConfigurationCallback(ECryLobbyService service, SConfigurationParams *requestedParams, uint32 paramCount)
{
uint32 a;
for (a=0;a<paramCount;++a)
{
switch (requestedParams[a].m_fourCCID)
{
case CLCC_LAN_USER_NAME:
{
uint32 userIndex = g_pGame->GetExclusiveControllerDeviceIndex();
IPlatformOS *pPlatformOS = gEnv->pSystem->GetPlatformOS();
IPlatformOS::TUserName tUserName = "";
if(pPlatformOS)
{
pPlatformOS->UserGetName(userIndex, tUserName);
}
// this will null terminate for us if necessary
cry_strncpy(s_profileName, tUserName.c_str(), CRYLOBBY_USER_NAME_LENGTH);
int instance = gEnv->pSystem->GetApplicationInstance();
if (instance>0)
{
size_t length = strlen(s_profileName);
if (length + 3 < CRYLOBBY_USER_NAME_LENGTH)
{
s_profileName[length] = '(';
s_profileName[length+1] = '0' + instance;
s_profileName[length+2] = ')';
s_profileName[length+3] = 0;
}
}
requestedParams[a].m_pData = s_profileName;
}
break;
#if defined(PS3) || defined(ORBIS) || USE_STEAM
case CLCC_CRYLOBBY_PRESENCE_CONVERTER:
{
SCryLobbyPresenceConverter* pConverter = (SCryLobbyPresenceConverter*)requestedParams[a].m_pData;
if (pConverter)
{
//-- Use the pConverter->m_numData data items in pConverter->m_pData to create a string in pConverter->m_pStringBuffer
//-- Use the initial value of pConverter->sizeOfStringBuffer as a maximum string length allowed, but
//-- update pConverter->sizeOfStringBuffer to the correct length when the string is filled in.
//-- Set pConverter->sizeOfStringBuffer = 0 to invalidate bad data so it isn't sent to PSN.
CryFixedStringT<MAX_PRESENCE_STRING_SIZE> strPresence;
if(CreatePresenceString(strPresence, pConverter->m_pData, pConverter->m_numData))
{
CryLog("[RichPresence] Succeeded %s", strPresence.c_str());
sprintf((char*)pConverter->m_pStringBuffer, "%s", strPresence.c_str());
pConverter->m_sizeOfStringBuffer = strlen((char*)pConverter->m_pStringBuffer);
#if defined(PS3)
if (g_pGame)
{
pConverter->m_sessionId = g_pGame->GetPendingRichPresenceSessionID();
}
#endif
}
else
{
CryLog("[RichPresence] Failed to create rich presence string");
pConverter->m_sizeOfStringBuffer = 0;
}
}
}
break;
#endif
#if defined(XENON)
case CLCC_LIVE_TITLE_ID:
requestedParams[a].m_32 = LIVE_TITLE_ID;
break;
#endif//XENON
#if defined(PS3)
case CLCC_PSN_COMMUNICATION_ID:
requestedParams[a].m_pData = (void*)&s_communication_id;
break;
case CLCC_PSN_COMMUNICATION_PASSPHRASE:
requestedParams[a].m_pData = (void*)&s_communication_passphrase;
break;
case CLCC_PSN_COMMUNICATION_SIGNATURE:
requestedParams[a].m_pData = (void*)&s_communication_signature;
break;
case CLCC_PSN_CUSTOM_MENU_GAME_INVITE_STRING:
GetXMBString("@xmb_invite_button", (SCryLobbyXMBString*)requestedParams[a].m_pData); // <= SCE_NP_CUSTOM_MENU_ACTION_CHARACTER_MAX (max 21 chars + nul)
break;
case CLCC_PSN_CUSTOM_MENU_GAME_JOIN_STRING:
GetXMBString("@xmb_join_button", (SCryLobbyXMBString*)requestedParams[a].m_pData); // <= SCE_NP_CUSTOM_MENU_ACTION_CHARACTER_MAX (max 21 chars + nul)
break;
case CLCC_PSN_INVITE_SUBJECT_STRING:
GetXMBString("@xmb_invite_sub", (SCryLobbyXMBString*)requestedParams[a].m_pData); // < SCE_NP_BASIC_SUBJECT_CHARACTER_MAX (max 17 chars + nul)
break;
case CLCC_PSN_INVITE_BODY_STRING:
GetXMBString("@xmb_invite_body", (SCryLobbyXMBString*)requestedParams[a].m_pData); // < SCE_NP_BASIC_BODY_CHARACTER_MAX (max 511 chars + nul)
break;
case CLCC_PSN_FRIEND_REQUEST_SUBJECT_STRING:
//.........这里部分代码省略.........
示例5: LoadLevelObjectivesInternal
void CHUDMissionObjectiveSystem::LoadLevelObjectivesInternal(const char* levelpath)
{
CryFixedStringT<128> filename;
if (levelpath==NULL)
{
// there is no Objectives_global.xml, but there is a file with the previous standard naming
// load the file with old name for backwards compatibility
if (!gEnv->pCryPak->IsFileExist("Libs/UI/Objectives_global.xml")
&& gEnv->pCryPak->IsFileExist("Libs/UI/Objectives_new.xml"))
{
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "File 'Objectives_new.xml' is deprecated and should be renamed to 'Objectives_global.xml'");
filename = "Libs/UI/Objectives_new.xml";
}
else
{
filename = "Libs/UI/Objectives_global.xml";
}
}
else
{
filename.Format("%s/leveldata/Objectives.xml", levelpath);
}
/*if(gEnv->bMultiplayer)
{
CGameRules *pGameRules = g_pGame->GetGameRules();
if(stricmp (pGameRules->GetEntity()->GetClass()->GetName(), "Coop"))
filename = "Libs/UI/MP_Objectives.xml";
}*/
XmlNodeRef missionObjectives = GetISystem()->LoadXmlFromFile(filename.c_str());
if (missionObjectives == 0)
return;
for(int tag = 0; tag < missionObjectives->getChildCount(); ++tag)
{
XmlNodeRef mission = missionObjectives->getChild(tag);
const char* attrib;
const char* objective;
const char* text;
const char* optional;
const char* levelName;
if (!mission->getAttr("name", &levelName))
{
levelName = mission->getTag();
}
for(int obj = 0; obj < mission->getChildCount(); ++obj)
{
XmlNodeRef objectiveNode = mission->getChild(obj);
string id(levelName);
id.append(".");
id.append(objectiveNode->getTag());
if(objectiveNode->getAttributeByIndex(0, &attrib, &objective) && objectiveNode->getAttributeByIndex(1, &attrib, &text))
{
bool secondaryObjective = false;
int attribs = objectiveNode->getNumAttributes();
for(int attribIndex = 2; attribIndex < attribs; ++attribIndex)
{
if(objectiveNode->getAttributeByIndex(attribIndex, &attrib, &optional))
{
if(attrib)
{
if(!stricmp(attrib, "Secondary"))
{
if(!stricmp(optional, "true"))
secondaryObjective = true;
}
}
}
}
m_currentMissionObjectives.push_back(CHUDMissionObjective(this, id.c_str(), objective, text, secondaryObjective));
}
else
GameWarning("Error reading mission objectives.");
}
}
}
示例6: FindHelperObject_Extended
// TODO: this whole function should be removed and FindHelperObject_Basic integrated back into FindHelperObject.
// It manages some undefined cases that appeared in C2, but it should not be needed with a strict definition of how the grabAndThrow helpers have to be defined in the objects
IStatObj::SSubObject* FindHelperObject_Extended( const char* pHelperName, EntityId objectId, int slot )
{
IStatObj::SSubObject* pSObjHelper = NULL;
IEntity* pEntity = gEnv->pEntitySystem->GetEntity( objectId );
SEntitySlotInfo info;
if (pEntity && pEntity->GetSlotInfo( slot, info ))
{
if (info.pStatObj)
{
IStatObj* pStatObj = info.pStatObj->GetCloneSourceObject(); // we use the clone source in case it exists. Because when it is cloned, only geometries are cloned. the helpers are NOT cloned.
if (!pStatObj)
pStatObj = info.pStatObj;
// special case: when the pStatObj is the root, we look for the first helper that does not have a hidden parent, whatever is its name as long as it includes pHelperName
// because: it can be child of a visible geometry (usually "main"...) even when that geometry is not the root
if (!pSObjHelper && !pStatObj->GetParentObject())
{
const int subObjectCount = pStatObj->GetSubObjectCount();
for (int sid = 0; sid < subObjectCount; ++sid)
{
IStatObj::SSubObject* pLocSObjHelper = pStatObj->GetSubObject( sid );
if ( pLocSObjHelper && (pLocSObjHelper->nType==STATIC_SUB_OBJECT_DUMMY) && strstr( pLocSObjHelper->name.c_str(), pHelperName ))
{
pLocSObjHelper = pStatObj->GetSubObject( pLocSObjHelper->nParent );
if (pLocSObjHelper && (pLocSObjHelper->nType==STATIC_SUB_OBJECT_MESH) && !pLocSObjHelper->bHidden)
{
pSObjHelper = pStatObj->GetSubObject( sid );
break;
}
}
}
}
// if all failed, we look from the parent, but by id
// because: helpers are not necesarily a subobject of their geometry, but just a child
if (!pSObjHelper && pStatObj->GetParentObject())
{
IStatObj* pParent = pStatObj->GetParentObject();
IStatObj::SSubObject* pMeSubObject = pParent->FindSubObject( pStatObj->GetGeoName() );
if (pMeSubObject)
{
const int subObjectCount = pParent->GetSubObjectCount();
for (int sid=0; sid < subObjectCount; ++sid)
{
IStatObj::SSubObject* pLocSObjHelper = pParent->GetSubObject( sid );
if ( pLocSObjHelper && (pLocSObjHelper->nType==STATIC_SUB_OBJECT_DUMMY) && (pLocSObjHelper->name==pHelperName) && (pParent->GetSubObject( pLocSObjHelper->nParent )==pMeSubObject) )
{
pSObjHelper = pLocSObjHelper;
break;
}
}
}
}
//If STILL we don't find the object, try with composed name based on geometry name (for destroyed pieces), and look on the whole hierarchy
if (!pSObjHelper)
{
CryFixedStringT<128> helperNameBuffer;
helperNameBuffer.Format("%s_%s", pStatObj->GetGeoName(), pHelperName);
pSObjHelper = pStatObj->FindSubObject( helperNameBuffer.c_str() );
if (!pSObjHelper)
{
IStatObj* pObj = pStatObj;
while (pObj->GetParentObject())
pObj = pObj->GetParentObject();
pSObjHelper = FindHelperObject_RecursivePart( pObj, helperNameBuffer.c_str() );
}
}
}
}
return pSObjHelper;
}
示例7: CryLog
void CDLCManager::OnDLCMounted(const XmlNodeRef &rootNode, const char* sDLCRootFolder)
{
CryLog( "OnDLCMounted: '%s'", sDLCRootFolder);
XmlString minVersion;
XmlString sName;
int dlcId;
if (rootNode->getAttr("minversion", minVersion) &&
rootNode->getAttr("name", sName) &&
rootNode->getAttr("id", dlcId))
{
CryLog( "DLC Name = %s, ID = %d", sName.c_str(), dlcId );
if (dlcId >= 0 && dlcId < MAX_DLC_COUNT)
{
#if (! ENTITLEMENTS_AUTHORATIVE) || defined (DEDICATED_SERVER)
//whenever we load a dlc, it is automatically allowed
m_allowedDLCs |= BIT(dlcId);
#endif
if (!IsDLCReallyLoaded(dlcId))
{
SFileVersion currentVersion = gEnv->pSystem->GetProductVersion();
SFileVersion minimumVersion = SFileVersion(minVersion.c_str());
if (currentVersion < minimumVersion)
{
char currentVersionString[MAX_VERSION_STRING];
currentVersion.ToString(currentVersionString);
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "Unable to load DLC \"%s\" because it requires version %s and current version is %s", sName.c_str(), minVersion.c_str(), currentVersionString);
RequestDLCWarning("DLCVersionMismatch",2, true);
}
else
{
XmlNodeRef crcNode = rootNode->findChild("crcs");
PopulateDLCContents(rootNode, dlcId, sName.c_str() );
//insist that CRCs are present and level folders match listed contents
if ( !crcNode || !VerifyCRCs(crcNode, sDLCRootFolder) || !CheckLevels( dlcId, sDLCRootFolder ) )
{
ClearDLCContents( dlcId );
RequestDLCWarning("DLCFileCorrupt",4, true);
CryLog("DLC \"%s\" not loaded successfully", sName.c_str());
}
else
{
CryLog("DLC \"%s\" loaded successfully", sName.c_str());
m_loadedDLCs |= BIT(dlcId);
m_dlcContents[ dlcId ].root.Format( "%s", sDLCRootFolder );
XmlNodeRef unlocksXml = rootNode->findChild("Unlocks");
if(unlocksXml)
{
DoDLCUnlocks( unlocksXml, dlcId);
}
CryFixedStringT<ICryPak::g_nMaxPath> path;
//Level Extras pak contains things which need to be accessed relative to the Level Path
//eg. Level meta data, icons and mini maps
//also contains Level Names and Rich Presence mappings
path.Format("%s/dlcLevelExtras.pak", sDLCRootFolder);
CryLog( "DLC: Opening %s as %s", path.c_str(), sDLCRootFolder );
bool success = gEnv->pCryPak->OpenPack( sDLCRootFolder, path );
//Data pak contains things which need to be accessed relative to the Game Root
//eg. Objects and Textures for new entities
path.Format("%s/dlcData.pak", sDLCRootFolder);
string gamePath = PathUtil::GetGameFolder();
CryLog( "DLC: Opening %s as %s", path.c_str(), gamePath.c_str() );
success &= gEnv->pCryPak->OpenPack( gamePath.c_str(), path );
if (success == false)
{
CRY_ASSERT_MESSAGE(success, "Failed to open DLC packs");
CryLog("Failed to open DLC packs '%s'",path.c_str());
}
else
{
//Only DLCs with data paks can have strings or levels
path.Format("%s/", sDLCRootFolder);
CryLog( "DLCManager: Adding %s to Mod paths", path.c_str() );
gEnv->pCryPak->AddMod(path.c_str());
//load string mappings for level names in this DLC
path.Format( "%s/scripts/dlc%dnames.xml", sDLCRootFolder, dlcId );
g_pGame->LoadMappedLevelNames( path.c_str() );
//and load the actual localized strings
ILocalizationManager *pLocMan = GetISystem()->GetLocalizationManager();
path.Format( "%s/scripts/dlc%d%s.xml", sDLCRootFolder, dlcId, pLocMan->GetLanguage() );
pLocMan->LoadExcelXmlSpreadsheet( path );
//see if the pack has a description
CryFixedStringT<32> descriptionKey;
descriptionKey.Format( "dlc%d_pack_description", dlcId );
SLocalizedInfoGame tempInfo;
if( pLocMan->GetLocalizedInfoByKey( descriptionKey.c_str(), tempInfo ) )
{
m_dlcContents[ dlcId ].descriptionStr.Format( "@%s", descriptionKey.c_str() );
//.........这里部分代码省略.........
示例8: fxName
bool CMaterialEffects::PlayBreakageEffect(ISurfaceType* pSurfaceType, const char* breakageType, const SMFXBreakageParams& breakageParams)
{
if (pSurfaceType == 0)
return false;
CryFixedStringT<128> fxName ("Breakage:");
fxName+=breakageType;
TMFXEffectId effectId = this->GetEffectId(fxName.c_str(), pSurfaceType->GetId());
if (effectId == InvalidEffectId)
return false;
// only play sound at the moment
SMFXRunTimeEffectParams params;
params.playflags = eMFXPF_Audio;
// if hitpos is set, use it
// otherwise use matrix (hopefully been set or 0,0,0)
if (breakageParams.CheckFlag(SMFXBreakageParams::eBRF_HitPos) && breakageParams.GetHitPos().IsZero() == false)
params.pos = breakageParams.GetHitPos();
else
params.pos = breakageParams.GetMatrix().GetTranslation();
//params.soundSemantic = eSoundSemantic_Physics_General;
const Vec3& hitImpulse = breakageParams.GetHitImpulse();
const float strength = hitImpulse.GetLengthFast();
params.AddAudioRtpc("strength", strength);
const float mass = NormalizeMass(breakageParams.GetMass());
params.AddAudioRtpc("mass", mass);
if (CMaterialEffectsCVars::Get().mfx_Debug & 2)
{
TMFXContainerPtr pEffectContainer = InternalGetEffect(effectId);
if (pEffectContainer != NULL)
{
CryLogAlways("[MFX]: %s:%s FX=%s:%s Pos=%f,%f,%f NormMass=%f F=%f Imp=%f,%f,%f RealMass=%f Vel=%f,%f,%f",
breakageType, pSurfaceType->GetName(), pEffectContainer->GetParams().libraryName.c_str(), pEffectContainer->GetParams().name.c_str(),
params.pos[0],params.pos[1],params.pos[2],
mass,
strength,
breakageParams.GetHitImpulse()[0],
breakageParams.GetHitImpulse()[1],
breakageParams.GetHitImpulse()[2],
breakageParams.GetMass(),
breakageParams.GetVelocity()[0],
breakageParams.GetVelocity()[1],
breakageParams.GetVelocity()[2]
);
}
}
/*
if (breakageParams.GetMass() == 0.0f)
{
int a = 0;
}
*/
const bool bSuccess = ExecuteEffect(effectId, params);
return bSuccess;
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:63,代码来源:MaterialEffects.cpp
示例9: file
bool CCheckpointSystem::LoadGame(const char* fileName)
{
//make sure not not save/load recursively or multiple times at once
if(CHECKPOINT_SAVE_XML_NODE || CHECKPOINT_LOAD_XML_NODE)
return false;
//set extension
FixedCheckpointString file(fileName);
SetFilenameExtension(file);
CHECKPOINT_LOAD_XML_NODE = ReadXML(file.c_str());
if(!CHECKPOINT_LOAD_XML_NODE)
return false;
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_COMMENT, "Loading checkpoint %s", file.c_str());
//check for EntityId errors
CHECKPOINT_RESAVE_NECESSARY = false;
//process meta data
SCheckpointData metaData;
if(!ReadMetaData(CHECKPOINT_LOAD_XML_NODE, metaData))
return false;
//check version number
if(metaData.m_versionNumber != CHECKPOINT_VERSION_NUMBER)
{
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_ERROR, "Checkpoint version number (%i) does not match current version (%i). Please reexport all checkpoints of this level to prevent errors!", metaData.m_versionNumber, CHECKPOINT_VERSION_NUMBER);
}
//check for level mismatch
CryFixedStringT<32> curlevelName = CCryAction::GetCryAction()->GetLevelName();
RepairLevelName(curlevelName);
if(curlevelName.empty() || stricmp(metaData.m_levelName.c_str(), curlevelName.c_str()))
{
if(!LoadCheckpointMap(metaData, curlevelName))
return false;
}
else
{
//reset the dynamic parts of the engine
ResetEngine();
}
//read actor data and respawn AI
// TODO For now, not restoring actor info (AI) - If this happens later, support needs to be added for entity pools
//RespawnAI(CHECKPOINT_LOAD_XML_NODE);
//load gametokens again
ReadGameTokens(CHECKPOINT_LOAD_XML_NODE);
//let game read
if (m_pGameHandler)
{
m_pGameHandler->OnReadData(CHECKPOINT_LOAD_XML_NODE);
}
//resets some gameplay data like action filters etc.
RestartGameplay();
//load external entities, that are controlled by flowgraph
LoadExternalEntities(CHECKPOINT_LOAD_XML_NODE);
//inform listeners
UpdateListener(metaData, false);
//trigger flowgraph node
OnCheckpointLoaded(metaData);
//draw text message on screen
//static const ColorF color (0.0f, 0.85f, 0.2f, 1.0f);
//g_pGame->GetIGameFramework()->GetIPersistantDebug()->Add2DText("Checkpoint loaded", 2.5f, color, 2.0f);
//checkpoint file sanity check
if(CHECKPOINT_RESAVE_NECESSARY)
{
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "Checkpoint file contained obsolete or wrong data, trying to re-save checkpoint.");
//resave checkpoint to fix changed entity Ids
SaveGame(metaData.m_checkPointId, fileName);
//make sure the script entity is aware of the activity
OnCheckpointLoaded(metaData);
}
CHECKPOINT_LOAD_XML_NODE = NULL;
//when a checkpoint was loaded, it becomes the most recent checkpoint
g_lastSavedCheckpoint = fileName;
//make sure the scripts are clean
//CXP : this caused a crash after some reloads, which hints to problems in the gamerules script
//gEnv->pScriptSystem->ForceGarbageCollection();
return true;
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:94,代码来源:CheckPointSystem.cpp
示例10: CRY_TODO
//-------------------------------------------------------------------------
// Process a search result.
void CGameBrowser::MatchmakingSessionSearchCallback(CryLobbyTaskID taskID, ECryLobbyError error, SCrySessionSearchResult* session, void* arg)
{
#if 0 // old frontend
CFlashFrontEnd *menu = g_pGame->GetFlashMenu();
CMPMenuHub *mpMenuHub = menu ? menu->GetMPMenu() : NULL;
#endif
CGameBrowser* pGameBrowser = (CGameBrowser*) arg;
if (error == eCLE_SuccessContinue || error == eCLE_Success)
{
#if 0 // old frontend
if(session && mpMenuHub && GameLobbyData::IsValidServer(session))
{
CUIServerList::SServerInfo si;
si.m_hostName = session->m_data.m_name;
CRY_TODO(20, 5, 2010, "In the case where too many servers have been filtered out, start a new search query and merge the results with the existing ones");
int requiredDLCs = GameLobbyData::GetSearchResultsData(session, LID_MATCHDATA_REQUIRED_DLCS);
CryLog("Found server (%s), num data (%d): with DLC version %d", si.m_hostName.c_str(), session->m_data.m_numData, requiredDLCs);
if (g_pGameCVars->g_ignoreDLCRequirements || CDLCManager::MeetsDLCRequirements(requiredDLCs, g_pGame->GetDLCManager()->GetSquadCommonDLCs()) || pGameBrowser->m_bFavouriteIdSearch)
{
si.m_numPlayers = session->m_numFilledSlots;
si.m_maxPlayers = session->m_data.m_numPublicSlots;
si.m_gameTypeName = GameLobbyData::GetGameRulesFromHash(GameLobbyData::GetSearchResultsData(session, LID_MATCHDATA_GAMEMODE));
si.m_gameTypeDisplayName = si.m_gameTypeName.c_str();
si.m_mapName = GameLobbyData::GetMapFromHash(GameLobbyData::GetSearchResultsData(session, LID_MATCHDATA_MAP));
si.m_mapDisplayName = PathUtil::GetFileName(si.m_mapName.c_str()).c_str();
si.m_friends = (session->m_numFriends>0);
si.m_reqPassword = session->m_flags&eCSSRF_RequirePassword;
uint32 variantId = GameLobbyData::GetSearchResultsData(session, LID_MATCHDATA_VARIANT);
bool bCustomVariant = false;
CPlaylistManager *pPlaylistManager = g_pGame->GetPlaylistManager();
if (pPlaylistManager)
{
const SGameVariant* pVariant = pPlaylistManager->GetVariant(variantId);
if (pVariant)
{
si.m_gameVariantName = pVariant->m_name.c_str();
si.m_gameVariantDisplayName = CHUDUtils::LocalizeString(pVariant->m_localName.c_str());
}
bCustomVariant = (variantId == pPlaylistManager->GetCustomVariant());
}
// Get more readable map name and game type
if (ILocalizationManager* pLocMgr = gEnv->pSystem->GetLocalizationManager())
{
si.m_mapDisplayName = CHUDUtils::LocalizeString(g_pGame->GetMappedLevelName(si.m_mapDisplayName.c_str()));
CryFixedStringT<64> tmpString;
tmpString.Format("ui_rules_%s", si.m_gameTypeName.c_str());
SLocalizedInfoGame outInfo;
if (pLocMgr->GetLocalizedInfoByKey(tmpString.c_str(), outInfo))
{
wstring wcharstr = outInfo.swTranslatedText;
CryStringUtils::WStrToUTF8(wcharstr, si.m_gameTypeDisplayName);
}
}
// FIXME :
// Make server id unique in some other way....
si.m_serverId = (int)session->m_id.get(); // for lack of unique ids deref the pointer location of the server. This is the id that gets sent to flash...
si.m_sessionId = session->m_id;
si.m_ping = session->m_ping;
if (pGameBrowser->m_bFavouriteIdSearch)
{
#if IMPLEMENT_PC_BLADES
if (si.m_sessionFavouriteKeyId != INVALID_SESSION_FAVOURITE_ID)
{
for (uint32 i = 0; i < pGameBrowser->m_currentSearchFavouriteIdIndex; ++i)
{
if (si.m_sessionFavouriteKeyId == pGameBrowser->m_searchFavouriteIds[i])
{
g_pGame->GetGameServerLists()->ServerFound(si, pGameBrowser->m_currentFavouriteIdSearchType, si.m_sessionFavouriteKeyId);
// Invalidate any current search favourite ids, as it has been found
pGameBrowser->m_searchFavouriteIds[i] = INVALID_SESSION_FAVOURITE_ID;
break;
}
}
}
#endif
}
else
{
mpMenuHub->AddServer(si);
}
}
}
#endif
}
else if (error != eCLE_SuccessUnreachable)
{
CryLogAlways("CGameBrowser search for sessions error %d", (int)error);
CGameLobby::ShowErrorDialog(error, NULL, NULL, NULL);
}
//.........这里部分代码省略.........
示例11: GetCacheName
//---------------------------------------------------------------------
void CVehicleWeapon::GetCacheName(const IEntityClass* pClass, const bool bIsThirdPerson, CryFixedStringT<32> &outCacheName)
{
outCacheName.Format("%s%s", pClass->GetName(), bIsThirdPerson ? "_3p" : "_fp");
}
示例12: switch
void CGameBrowser::ConfigurationCallback(ECryLobbyService service, SConfigurationParams *requestedParams, uint32 paramCount)
{
uint32 a;
for (a=0;a<paramCount;++a)
{
switch (requestedParams[a].m_fourCCID)
{
case CLCC_LAN_USER_NAME:
{
uint32 userIndex = g_pGame->GetExclusiveControllerDeviceIndex();
IPlatformOS *pPlatformOS = gEnv->pSystem->GetPlatformOS();
IPlatformOS::TUserName tUserName = "";
if(pPlatformOS)
{
pPlatformOS->UserGetName(userIndex, tUserName);
}
// this will null terminate for us if necessary
cry_strncpy(s_profileName, tUserName.c_str(), CRYLOBBY_USER_NAME_LENGTH);
int instance = gEnv->pSystem->GetApplicationInstance();
if (instance>0)
{
size_t length = strlen(s_profileName);
if (length + 3 < CRYLOBBY_USER_NAME_LENGTH)
{
s_profileName[length] = '(';
s_profileName[length+1] = '0' + instance;
s_profileName[length+2] = ')';
s_profileName[length+3] = 0;
}
}
requestedParams[a].m_pData = s_profileName;
}
break;
#if defined(ORBIS)
case CLCC_CRYLOBBY_PRESENCE_CONVERTER:
{
SCryLobbyPresenceConverter* pConverter = (SCryLobbyPresenceConverter*)requestedParams[a].m_pData;
if (pConverter)
{
//-- Use the pConverter->m_numData data items in pConverter->m_pData to create a string in pConverter->m_pStringBuffer
//-- Use the initial value of pConverter->sizeOfStringBuffer as a maximum string length allowed, but
//-- update pConverter->sizeOfStringBuffer to the correct length when the string is filled in.
//-- Set pConverter->sizeOfStringBuffer = 0 to invalidate bad data so it isn't sent to PSN.
CryFixedStringT<MAX_PRESENCE_STRING_SIZE> strPresence;
if(CreatePresenceString(strPresence, pConverter->m_pData, pConverter->m_numData))
{
CryLog("[RichPresence] Succeeded %s", strPresence.c_str());
sprintf((char*)pConverter->m_pStringBuffer, "%s", strPresence.c_str());
pConverter->m_sizeOfStringBuffer = strlen((char*)pConverter->m_pStringBuffer);
}
else
{
CryLog("[RichPresence] Failed to create rich presence string");
pConverter->m_sizeOfStringBuffer = 0;
}
}
}
break;
#endif
#if defined(DURANGO)
case CLCC_LIVE_TITLE_ID:
requestedParams[a].m_32 = DURANGO_LIVE_TITLE_ID;
break;
case CLCC_LIVE_SERVICE_CONFIG_ID:
requestedParams[a].m_pData = DURANGO_LIVE_SERVICE_CONFIG_ID;
break;
#endif//DURANGO
#if defined(ORBIS)
case CLCC_PSN_TITLE_ID:
requestedParams[a].m_pData = (void*)&s_title_id;
break;
case CLCC_PSN_TITLE_SECRET:
requestedParams[a].m_pData = (void*)&s_title_secret;
break;
case CLCC_PSN_AGE_LIMIT:
requestedParams[a].m_pData = (void*)&s_age_restrictions;
break;
case CLCC_PSN_PLUS_TEST_REQUIRED:
requestedParams[a].m_32 = FALSE;
break;
case CLCC_PSN_CREATE_SESSION_ADVERTISEMENT:
{
SCryLobbySessionAdvertisement* pAdvertisement = (SCryLobbySessionAdvertisement*)requestedParams[a].m_pData;
if (pAdvertisement)
{
pAdvertisement->m_numLanguages = s_NumLocalisedSessionAdvertisementLanguages;
pAdvertisement->m_pLocalisedLanguages = (char**)s_LocalisedLanguages;
pAdvertisement->m_pLocalisedSessionNames = (char**)s_LocalisedSessionAdvertisementName;
pAdvertisement->m_pLocalisedSessionStatus = (char**)s_LocalisedSessionAdvertisementStatus;
pAdvertisement->m_pJPGImage = (void*)s_SessionAdvertisementImage;
//.........这里部分代码省略.........
示例13: min
void CAnimationProxyDualCharacterBase::Generate1P3PPairFile()
{
const int MAX_MODELS = 128;
ICharacterModel *pCharacterModels[MAX_MODELS];
int numModels;
gEnv->pCharacterManager->GetLoadedModels(NULL, numModels);
numModels = min(numModels, MAX_MODELS);
gEnv->pCharacterManager->GetLoadedModels(pCharacterModels, numModels);
s_animCrCHashMap.clear();
for (uint32 i=0; i<numModels; ++i)
{
if (pCharacterModels[i]->GetNumInstances() > 0)
{
IAnimationSet *animSet = pCharacterModels[i]->GetICharInstanceFromModel(0)->GetIAnimationSet();
uint32 numAnims = animSet->GetAnimationCount();
for (uint32 anm = 0; anm < numAnims; anm++)
{
uint32 animCRC = animSet->GetCRCByAnimID(anm);
if (s_animCrCHashMap.find(animCRC) == s_animCrCHashMap.end())
{
int animID3P = -1;
const char *name = animSet->GetNameByAnimID(anm);
if (strlen(name) >= 255)
{
CRY_ASSERT_MESSAGE(0, string().Format("[CAnimationProxyDualCharacterBase::Generate1P3PPairFiles] Animname %s overruns buffer", name));
CryLogAlways("[CAnimationProxyDualCharacterBase::Generate1P3PPairFiles] Animname %s overruns buffer", name);
continue;
}
const char *pos = CryStringUtils::stristr(name, "_1p");
if (pos)
{
char name3P[256];
strcpy(name3P, name);
name3P[(int)(TRUNCATE_PTR)pos + 1 - (int)(TRUNCATE_PTR)name] = '3';
animID3P = animSet->GetAnimIDByName(name3P);
if (animID3P >= 0)
{
uint32 animCRCTP = animSet->GetCRCByAnimID(animID3P);
s_animCrCHashMap[animCRC] = animCRCTP;
}
}
}
}
}
}
//--- Save the file
CryFixedStringT<256> animCrC;
XmlNodeRef nodePairList = gEnv->pSystem->CreateXmlNode( "Pairs" );
for (NameHashMap::iterator iter = s_animCrCHashMap.begin(); iter != s_animCrCHashMap.end(); ++iter)
{
XmlNodeRef nodePair = nodePairList->newChild( "Pair" );
animCrC.Format("%u", iter->first);
nodePair->setAttr( "FP", animCrC.c_str());
animCrC.Format("%u", iter->second);
nodePair->setAttr( "TP", animCrC.c_str());
}
nodePairList->saveToFile(ANIMPAIR_PATHNAME);
s_animCrCHashMap.clear();
Load1P3PPairFile();
}
示例14: ChangeState
//.........这里部分代码省略.........
const float timeTillStartInSeconds = m_pGameRules->GetRemainingStartTimer();
SHUDEventWrapper::UpdateGameStartCountdown( ePreGameCountdown_MatchStarting, timeTillStartInSeconds );
}
else
{
SHUDEventWrapper::UpdateGameStartCountdown( ePreGameCountdown_WaitingForPlayers, 0.0f );
}
}
}
else if (m_state == EGRS_InGame && !gEnv->IsDedicated() )
{
if (m_introMessageShown == false) // Show only once
{
CGameRules *pGameRules = g_pGame->GetGameRules();
if (pGameRules && pGameRules->HasGameActuallyStarted())
{
if (EntityId localPlayerId = g_pGame->GetIGameFramework()->GetClientActorId())
{
int teamId = g_pGame->GetGameRules()->GetTeam(localPlayerId);
bool bTeamGame = (pGameRules->GetTeamCount() > 1);
IActor *pActor = g_pGame->GetIGameFramework()->GetClientActor();
if (pActor->GetSpectatorMode()==CActor::eASM_None && !pActor->IsDead() && (!bTeamGame || teamId!=0))
{
if (IGameRulesPlayerStatsModule *statsModule = pGameRules->GetPlayerStatsModule())
{
const SGameRulesPlayerStat *stats = statsModule->GetPlayerStats(localPlayerId);
if (stats->deaths <= 0) // Not died ever
{
if (m_startMatchString.empty() == false)
{
const char* gamemodeName = g_pGame->GetGameRules()->GetEntity()->GetClass()->GetName();
CryFixedStringT<32> strSignalName;
strSignalName.Format("StartGame%s", gamemodeName);
TAudioSignalID signalId = g_pGame->GetGameAudio()->GetSignalID(strSignalName);
CryFixedStringT<64> localisedStartString = CHUDUtils::LocalizeString( m_startMatchString.c_str() );
if (bTeamGame)
{
CryFixedStringT<16> strTeamName;
strTeamName.Format("@ui_hud_team_%d", teamId);
SHUDEventWrapper::TeamMessage(strTeamName.c_str(), teamId, SHUDEventWrapper::SMsgAudio(signalId), false, true);
SHUDEventWrapper::SimpleBannerMessage(localisedStartString.c_str(), SHUDEventWrapper::kMsgAudioNULL);
}
else
{
SHUDEventWrapper::RoundMessageNotify(localisedStartString.c_str(), SHUDEventWrapper::SMsgAudio(signalId));
}
}
}
}
m_introMessageShown = true; // Or not if has already died, but don't check again anyway.
}
}
}
}
}
else if(m_state == EGRS_PostGame && !gEnv->IsDedicated())
{
if (!gEnv->bServer)
{
m_timeInPostGame += frameTime;
示例15: fileName
int CGameStartup::Run( const char * autoStartLevelName )
{
gEnv->pConsole->ExecuteString( "exec autoexec.cfg" );
if (autoStartLevelName)
{
//load savegame
if(CryStringUtils::stristr(autoStartLevelName, ".CRYENGINEJMSF") != 0 )
{
CryFixedStringT<256> fileName (autoStartLevelName);
// NOTE! two step trimming is intended!
fileName.Trim(" "); // first: remove enclosing spaces (outside ")
fileName.Trim("\""); // second: remove potential enclosing "
gEnv->pGame->GetIGameFramework()->LoadGame(fileName.c_str());
}
else //start specified level
{
CryFixedStringT<256> mapCmd ("map ");
mapCmd+=autoStartLevelName;
gEnv->pConsole->ExecuteString(mapCmd.c_str());
}
}
#ifdef WIN32
if (!(gEnv && gEnv->pSystem) || (!gEnv->IsEditor() && !gEnv->IsDedicated()))
{
::ShowCursor(TRUE);
if (gEnv && gEnv->pSystem && gEnv->pSystem->GetIHardwareMouse())
gEnv->pSystem->GetIHardwareMouse()->DecrementCounter();
}
AllowAccessibilityShortcutKeys(false);
for (;;)
{
MSG msg;
bool bQuit = false;
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
if (msg.message != WM_QUIT)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
bQuit = true;
break;
}
}
if (bQuit)
break;
if (!Update(true, 0))
{
// need to clean the message loop (WM_QUIT might cause problems in the case of a restart)
// another message loop might have WM_QUIT already so we cannot rely only on this
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
break;
}
}
#else
// We should use bVisibleByDefault=false then...
if (gEnv && gEnv->pHardwareMouse)
gEnv->pHardwareMouse->DecrementCounter();
#ifndef GRINGO
for(;;)
{
if (!Update(true, 0))
{
break;
}
}
#endif
#endif //WIN32
return 0;
}