本文整理汇总了C++中KeyValues::GetNextValue方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyValues::GetNextValue方法的具体用法?C++ KeyValues::GetNextValue怎么用?C++ KeyValues::GetNextValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyValues
的用法示例。
在下文中一共展示了KeyValues::GetNextValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateHotspots
//--------------------------------------------------------------------------------------------------------
void CPolygonButton::UpdateHotspots( KeyValues *data )
{
// clear out our old hotspot
if ( m_hotspotPoints )
{
delete[] m_hotspotPoints;
m_hotspotPoints = NULL;
m_numHotspotPoints = 0;
}
if ( m_visibleHotspotPoints )
{
delete[] m_visibleHotspotPoints;
m_visibleHotspotPoints = NULL;
m_numVisibleHotspotPoints = 0;
}
m_unscaledHotspotPoints.RemoveAll();
m_unscaledVisibleHotspotPoints.RemoveAll();
// read in a new one
KeyValues *points = data->FindKey( "Hotspot", false );
if ( points )
{
for ( KeyValues *value = points->GetFirstValue(); value; value = value->GetNextValue() )
{
const char *str = value->GetString();
float x, y;
if ( 2 == sscanf( str, "%f %f", &x, &y ) )
{
m_unscaledHotspotPoints.AddToTail( Vector2D( x, y ) );
}
}
}
points = data->FindKey( "VisibleHotspot", false );
if ( !points )
{
points = data->FindKey( "Hotspot", false );
}
if ( points )
{
for ( KeyValues *value = points->GetFirstValue(); value; value = value->GetNextValue() )
{
const char *str = value->GetString();
float x, y;
if ( 2 == sscanf( str, "%f %f", &x, &y ) )
{
m_unscaledVisibleHotspotPoints.AddToTail( Vector2D( x, y ) );
}
}
}
}
示例2: CheckKeyValues
void CheckKeyValues( KeyValues *pKeyValues, CUtlVector<VTFInfo_t> &vtf )
{
for ( KeyValues *pSubKey = pKeyValues->GetFirstValue(); pSubKey; pSubKey = pSubKey->GetNextValue() )
{
if ( pSubKey->GetDataType() != KeyValues::TYPE_STRING )
continue;
if ( IsTexture( pSubKey->GetString() ) )
{
int nLen = Q_strlen( pSubKey->GetString() ) + 1;
char *pTemp = (char*)_alloca( nLen );
memcpy( pTemp, pSubKey->GetString(), nLen );
Q_FixSlashes( pTemp );
int nCount = vtf.Count();
for ( int i = 0; i < nCount; ++i )
{
if ( Q_stricmp( vtf[i].m_VTFName, pTemp ) )
continue;
vtf[i].m_bFoundInVMT = true;
break;
}
}
}
for ( KeyValues *pSubKey = pKeyValues->GetFirstTrueSubKey(); pSubKey; pSubKey = pSubKey->GetNextTrueSubKey() )
{
CheckKeyValues( pSubKey, vtf );
}
}
示例3: LoadList
void CShaderPrecache::LoadList()
{
KeyValues *pKV = df_LoadDump_List();
KeyValues *pKey = pKV->GetFirstValue();
while ( pKey )
{
AddEntry( pKey->GetString() );
pKey = pKey->GetNextValue();
}
pKV->deleteThis();
}
示例4: HandleRemoveEnitity
bool CMapAdd::HandleRemoveEnitity( KeyValues *mapaddValue)
{
if(AllocPooledString(mapaddValue->GetName()) == AllocPooledString("remove:sphere"))
{
Vector RemoveVector = Vector(0,0,0);
CBaseEntity *ppEnts[256];
// CBaseEntity *ppCandidates[256];
RemoveVector.x = mapaddValue->GetFloat("x", RemoveVector.x);
RemoveVector.y = mapaddValue->GetFloat("y", RemoveVector.y);
RemoveVector.z = mapaddValue->GetFloat("z", RemoveVector.z);
int nEntCount = UTIL_EntitiesInSphere( ppEnts, 256, RemoveVector, mapaddValue->GetFloat("radius", 0), 0 );
//Look through the entities it found
KeyValues *pEntKeyValues = mapaddValue->FindKey("entities");
if(pEntKeyValues)
{
KeyValues *pEntKeyValuesRemove = pEntKeyValues->GetFirstValue();
while(pEntKeyValuesRemove)
{
int i;
for ( i = 0; i < nEntCount; i++ )
{
if ( ppEnts[i] == NULL )
continue;
if(AllocPooledString(pEntKeyValuesRemove->GetName()) == AllocPooledString("classname")) // || ( AllocPooledString(pEntKeyValuesRemove->GetName()) == ppEnts[i]->GetEntityName())
{
if(AllocPooledString(pEntKeyValuesRemove->GetString()) == AllocPooledString(ppEnts[i]->GetClassname()))
{
UTIL_Remove(ppEnts[i]);
continue;
}
}
if(AllocPooledString(pEntKeyValuesRemove->GetName()) == AllocPooledString("targetname")) // || ( AllocPooledString(pEntKeyValuesRemove->GetName()) == ppEnts[i]->GetEntityName())
{
if(AllocPooledString(pEntKeyValuesRemove->GetString()) == ppEnts[i]->GetEntityName())
{
UTIL_Remove(ppEnts[i]);
continue;
}
}
}
pEntKeyValuesRemove = pEntKeyValuesRemove->GetNextValue();
}
}
return true;
}
return false;
}
示例5: ReadGameShaders
void ReadGameShaders( CUtlVector<BasicShaderCfg_t*> &hList )
{
KeyValues *pKV = df_LoadDump_List();
KeyValues *pN = pKV->GetFirstValue();
while ( pN )
{
BasicShaderCfg_t *shader = BuildShaderData( pN->GetString() );
hList.AddToTail( shader );
pN = pN->GetNextValue();
}
pKV->deleteThis();
}
示例6: OnNewLODText
void CQCGenerator::OnNewLODText()
{
KeyValues *pEditItem = m_pLODPanel->GetItem( m_nSelectedSequence );
KeyValues *pListItem = pEditItem;
wchar_t szEditText[MAX_PATH];
pEditItem = pEditItem->GetFirstValue();
const char *name = pEditItem->GetName();
for( int i = 0; i < m_nSelectedColumn; i++ )
{
pEditItem = pEditItem->GetNextValue();
name = pEditItem->GetName();
}
m_pLODEdit->GetText( szEditText, MAX_PATH );
pListItem->SetWString( name, szEditText );
m_pLODPanel->LeaveEditMode();
m_pLODPanel->InvalidateLayout();
return;
}
示例7: OnValuesChanged
virtual void OnValuesChanged( KeyValues **pValues, int iCount )
{
bool bFoundAnything = false;
bool bWasMultiSelected = m_bMultiSelection;
m_bMultiSelection = false;
for ( int i = 0; i < iCount; i++ )
{
bool bFoundValue = false;
for ( KeyValues *pValue = pValues[i]->GetFirstValue(); pValue; pValue = pValue->GetNextValue() )
{
if ( !Q_stricmp( m_pValue->GetName(), pValue->GetName() ) )
{
if ( i > 0 )
{
if ( Q_stricmp( m_pValue->GetString(), pValue->GetString() ) )
m_bMultiSelection = true;
}
m_pValue->deleteThis();
m_pValue = pValue->MakeCopy();
bFoundAnything = true;
bFoundValue = true;
break;
}
}
if ( !bFoundValue && bFoundAnything )
m_bMultiSelection = true;
}
if ( !bFoundAnything )
m_bMultiSelection = bWasMultiSelected;
ReadValue();
};
示例8: Activate
//=============================================================================
void Addons::Activate()
{
BaseClass::Activate();
m_GplAddons->RemoveAllPanelItems();
m_addonInfoList.RemoveAll();
m_pAddonList ? m_pAddonList->deleteThis() : NULL;
//
// Get the list of addons
//
// Load particular info for each addon
if ( LoadAddonListFile( m_pAddonList ) )
{
for ( KeyValues *pCur = m_pAddonList->GetFirstValue(); pCur; pCur = pCur->GetNextValue() )
{
char szAddonDirName[60];
bool bIsVPK = true;
// If the entry in the list is a .vpk then
if ( V_stristr( pCur->GetName(), ".vpk" ) )
{
V_StripExtension( pCur->GetName(), szAddonDirName, sizeof( szAddonDirName ) );
ExtractAddonMetadata( szAddonDirName );
}
else
{
bIsVPK = false;
V_strncpy( szAddonDirName, pCur->GetName(), sizeof( szAddonDirName ) );
}
Addons::AddonInfo addonInfo;
// Copy info to the AddonInfo struct
KeyValues *pAddonInfo;
if ( LoadAddonInfoFile( pAddonInfo, szAddonDirName, bIsVPK ) )
{
// Convert JPEG image to VTF, if necessary
GetAddonImage( pCur->GetName(), addonInfo.szImageName, sizeof( addonInfo.szImageName ), bIsVPK );
// Copy values from particular keys
V_strncpy( addonInfo.szDirectory, pCur->GetName(), sizeof( addonInfo.szDirectory ) );
V_wcsncpy( addonInfo.szName, pAddonInfo->GetWString( "addontitle", g_pVGuiLocalize->Find( "#L4D360UI_Addon_None_Specified" ) ), sizeof( addonInfo.szName ) );
V_wcsncpy( addonInfo.szAuthor, pAddonInfo->GetWString( "addonauthor", g_pVGuiLocalize->Find( "#L4D360UI_Addon_None_Specified" ) ), sizeof( addonInfo.szAuthor ) );
V_wcsncpy( addonInfo.szDescription, pAddonInfo->GetWString( "addonDescription", g_pVGuiLocalize->Find( "#L4D360UI_Addon_None_Specified" ) ), sizeof( addonInfo.szDescription ) );
addonInfo.bEnabled = pCur->GetInt() != 0;
// Generate the types string based on the value of keys
bool bCampaign = false, bMaps = false, bSkin = false, bWeapon = false, bBoss = false, bCommon = false, bSurvivor = false, bSound = false, bMusic = false, bScript = false, bProp = false;
bCampaign = pAddonInfo->GetInt( "addonContent_Campaign" ) != 0;
bMaps = ( pAddonInfo->GetInt( "addonContent_Map" ) != 0 ) && !bCampaign;
bSkin = pAddonInfo->GetInt( "addonContent_Skin" ) != 0;
bWeapon = pAddonInfo->GetInt( "addonContent_weapon" ) != 0;
bBoss = pAddonInfo->GetInt( "addonContent_BossInfected" ) != 0;
bCommon = pAddonInfo->GetInt( "addonContent_CommonInfected" ) != 0;
bSurvivor = pAddonInfo->GetInt( "addonContent_Survivor" ) != 0;
bSound = pAddonInfo->GetInt( "addonContent_Sound" ) != 0;
bScript = pAddonInfo->GetInt( "addonContent_Script" ) != 0;
bMusic = pAddonInfo->GetInt( "addonContent_Music" ) != 0;
bProp = pAddonInfo->GetInt( "addonContent_prop" ) != 0;
// Make the addon types string based on the flags
addonInfo.szTypes[0] = NULL;
bCampaign ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Campaign" ), sizeof( addonInfo.szTypes ) ) : NULL;
bMaps ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Map" ), sizeof( addonInfo.szTypes ) ) : NULL;
bSkin ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Skin" ), sizeof( addonInfo.szTypes ) ) : NULL;
bWeapon ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Weapon" ), sizeof( addonInfo.szTypes ) ) : NULL;
bBoss ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Boss" ), sizeof( addonInfo.szTypes ) ) : NULL;
bCommon ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Common" ), sizeof( addonInfo.szTypes ) ) : NULL;
bSurvivor ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Survivor" ), sizeof( addonInfo.szTypes ) ) : NULL;
bSound ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Sound" ), sizeof( addonInfo.szTypes ) ) : NULL;
bScript ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Script" ), sizeof( addonInfo.szTypes ) ) : NULL;
bMusic ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Music" ), sizeof( addonInfo.szTypes ) ) : NULL;
bProp ? wcsncat( addonInfo.szTypes, g_pVGuiLocalize->Find( "#L4D360UI_Addon_Type_Props" ), sizeof( addonInfo.szTypes ) ) : NULL;
// Remove trailing ','
if ( wcslen( addonInfo.szTypes ) )
{
wchar_t *pwcComma = wcsrchr( addonInfo.szTypes, ',' );
if ( pwcComma )
{
*pwcComma = NULL;
}
}
}
m_addonInfoList.AddToTail( addonInfo );
// Get rid of the temp files
if ( bIsVPK )
{
char tempFilename[MAX_PATH];
char modPath[MAX_PATH];
GetPrimaryModDirectory( modPath, MAX_PATH );
//.........这里部分代码省略.........
示例9: CheckMaterial
//.........这里部分代码省略.........
{
Warning("ENVMAP + ENVMAPTINT : Material \"%s\"\n", pFileName );
}
// else
// {
// Warning("ENVMAP only: Material \"%s\"\n", pFileName );
// }
}
*/
/*
if ( !Q_stristr( pShaderName, "Refract" ) )
{
return;
}
if ( !DoesMaterialHaveKey( pKeyValues, "$envmap" ) )
{
bool bUsesAlpha, bIsCompressed, bIsPalettized;
int nSizeInBytes;
if ( DoesTextureUseNormal( pKeyValues->GetString( "$normalmap" ),
pFileName, bUsesAlpha, bIsCompressed, bIsPalettized, nSizeInBytes ) )
{
if ( bIsCompressed )
{
Warning("Bad : Material compressed \"%s\"\n", pFileName );
}
else
{
Warning("Bad : Material \"%s\"\n", pFileName );
}
}
}
*/
/*
if ( !Q_stristr( pShaderName, "WorldTwoTextureBlend" ) )
{
return;
}
if ( DoesMaterialHaveKey( pKeyValues, "$envmap" ) ||
DoesMaterialHaveKey( pKeyValues, "$parallaxmap" ) ||
DoesMaterialHaveKey( pKeyValues, "$bumpmap" ) ||
DoesMaterialHaveKey( pKeyValues, "$vertexcolor" ) ||
DoesMaterialHaveKey( pKeyValues, "$basetexture2" )
)
{
Warning("Bad : Material \"%s\"\n", pFileName );
}
*/
for ( KeyValues *pSubKey = pKeyValues->GetFirstValue(); pSubKey; pSubKey = pSubKey->GetNextValue() )
{
// Msg( " Checking %s\n", pSubKey->GetString() );
if ( pSubKey->GetDataType() != KeyValues::TYPE_STRING )
continue;
bool bUsesAlpha, bIsCompressed;
int nSizeInBytes;
if ( DoesTextureUseNormal( pSubKey->GetString(), pFileName, bUsesAlpha, bIsCompressed, nSizeInBytes ) )
{
if ( bUsesAlpha )
{
if ( bIsCompressed )
{
s_nNormalWithAlphaCompressedBytes += nSizeInBytes;
}
else
{
s_nNormalWithAlphaBytes += nSizeInBytes;
Msg( "Normal texture w alpha uncompressed %s\n", pSubKey->GetString() );
}
}
else
{
if ( bIsCompressed )
{
s_nNormalCompressedBytes += nSizeInBytes;
}
else
{
s_nNormalBytes += nSizeInBytes;
}
}
}
}
/*
if ( !Q_stristr( pShaderName, "VertexLitGeneric" ) )
return;
if ( !DoesMaterialHaveKey( pKeyValues, "$envmap" ) && DoesMaterialHaveKey( pKeyValues, "$bumpmap" ) )
{
Warning("BUMPMAP + no ENVMAP : Material \"%s\"\n", pFileName );
}
*/
// CheckKeyValues( pKeyValues, vtf );
}
示例10: RunLabel
bool CMapAdd::RunLabel( const char *mapaddMap, const char *szLabel)
{
if(AllocPooledString(mapaddMap) == AllocPooledString("") || !mapaddMap || !szLabel || AllocPooledString(szLabel) == AllocPooledString(""))
return false; //Failed to load!
//FileHandle_t fh = filesystem->Open(szMapadd,"r","MOD");
// Open the mapadd data file, and abort if we can't
KeyValues *pMapAdd = new KeyValues( "MapAdd" );
if(pMapAdd->LoadFromFile( filesystem, mapaddMap, "MOD" ))
{
KeyValues *pMapAdd2 = pMapAdd->FindKey(szLabel);
if(pMapAdd2)
{
KeyValues *pMapAddEnt = pMapAdd2->GetFirstTrueSubKey();
while (pMapAddEnt)
{
if(!HandlePlayerEntity(pMapAddEnt, false) && !HandleRemoveEnitity( pMapAddEnt ) && !HandleSMODEntity(pMapAddEnt) && !HandleSpecialEnitity(pMapAddEnt))
{
Vector SpawnVector = Vector(0,0,0);
QAngle SpawnAngle = QAngle(0,0,0);
SpawnVector.x = pMapAddEnt->GetFloat("x", SpawnVector.x);
SpawnVector.y = pMapAddEnt->GetFloat("y", SpawnVector.y);
SpawnVector.z = pMapAddEnt->GetFloat("z", SpawnVector.z);
SpawnAngle[PITCH] = pMapAddEnt->GetFloat("pitch", SpawnAngle[PITCH]);
SpawnAngle[YAW] = pMapAddEnt->GetFloat("yaw", SpawnAngle[YAW]);
SpawnAngle[ROLL] = pMapAddEnt->GetFloat("roll", SpawnAngle[ROLL]);
CBaseEntity *createEnt = CBaseEntity::CreateNoSpawn(pMapAddEnt->GetName(),SpawnVector,SpawnAngle);
KeyValues *pEntKeyValues = pMapAddEnt->FindKey("KeyValues");
if(pEntKeyValues && createEnt)
{
Msg("keyvalue for %s Found!\n",pMapAddEnt->GetName());
KeyValues *pEntKeyValuesAdd = pEntKeyValues->GetFirstValue();
while(pEntKeyValuesAdd && createEnt)
{
if(AllocPooledString(pEntKeyValuesAdd->GetName()) == AllocPooledString("model"))
{
PrecacheModel(pEntKeyValuesAdd->GetString(""));
createEnt->SetModel(pEntKeyValuesAdd->GetString(""));
}
/* else if(AllocPooledString(pEntKeyValuesAdd->GetName()) == AllocPooledString("name"))
{
createEnt->SetName(AllocPooledString(pEntKeyValuesAdd->GetString("")));
}
else if(AllocPooledString(pEntKeyValuesAdd->GetName()) == AllocPooledString("spawnflags"))
{
createEnt->AddSpawnFlags(pEntKeyValuesAdd->GetInt());
}*/
else
{
createEnt->KeyValue(pEntKeyValuesAdd->GetName(),pEntKeyValuesAdd->GetString(""));
}
pEntKeyValuesAdd = pEntKeyValuesAdd->GetNextValue();
}
}
//createEnt->Activate();//Is this a good idea? Not sure!
//createEnt->Spawn();
DispatchSpawn( createEnt ); //I derped
}
pMapAddEnt = pMapAddEnt->GetNextTrueSubKey(); //Got to keep this!
}
}
}
pMapAdd->deleteThis();
return true;
}