本文整理汇总了C++中SendProp类的典型用法代码示例。如果您正苦于以下问题:C++ SendProp类的具体用法?C++ SendProp怎么用?C++ SendProp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SendProp类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SendPropQuaternion
SendProp SendPropQuaternion(
const char *pVarName,
int offset,
int sizeofVar,
int nBits, // Number of bits to use when encoding.
int flags,
float fLowValue, // For floating point, low and high values.
float fHighValue, // High value. If HIGH_DEFAULT, it's (1<<nBits).
SendVarProxyFn varProxy
)
{
SendProp ret;
if(varProxy == SendProxy_QuaternionToQuaternion)
{
Assert(sizeofVar == sizeof(Quaternion));
}
if ( nBits == 32 )
flags |= SPROP_NOSCALE;
ret.m_Type = DPT_Quaternion;
ret.m_pVarName = pVarName;
ret.SetOffset( offset );
ret.m_nBits = nBits;
ret.SetFlags( flags );
ret.m_fLowValue = fLowValue;
ret.m_fHighValue = fHighValue;
ret.m_fHighLowMul = AssignRangeMultiplier( ret.m_nBits, ret.m_fHighValue - ret.m_fLowValue );
ret.SetProxyFn( varProxy );
if( ret.GetFlags() & (SPROP_COORD | SPROP_NOSCALE | SPROP_NORMAL | SPROP_COORD_MP | SPROP_COORD_MP_LOWPRECISION | SPROP_COORD_MP_INTEGRAL) )
ret.m_nBits = 0;
return ret;
}
开发者ID:Baer42,项目名称:Source-SDK-2014,代码行数:35,代码来源:dt_send.cpp
示例2: UTIL_FindInSendTable
bool UTIL_FindInSendTable(SendTable *pTable,
const char *name,
sm_sendprop_info_t *info,
unsigned int offset)
{
const char *pname;
int props = pTable->GetNumProps();
SendProp *prop;
for (int i=0; i<props; i++)
{
prop = pTable->GetProp(i);
pname = prop->GetName();
if (pname && strcmp(name, pname) == 0)
{
info->prop = prop;
info->actual_offset = offset + info->prop->GetOffset();
return true;
}
if (prop->GetDataTable())
{
if (UTIL_FindInSendTable(prop->GetDataTable(),
name,
info,
offset + prop->GetOffset())
)
{
return true;
}
}
}
return false;
}
开发者ID:pmrowla,项目名称:sourcemod-central,代码行数:34,代码来源:HalfLife2.cpp
示例3: SendTable_PrintStats
void SendTable_PrintStats( void )
{
int numTables = 0;
int numFloats = 0;
int numStrings = 0;
int numArrays = 0;
int numInts = 0;
int numVecs = 0;
int numSubTables = 0;
int numSendProps = 0;
int numFlatProps = 0;
int numExcludeProps = 0;
for ( int i=0; i < g_SendTables.Count(); i++ )
{
SendTable *st = g_SendTables[i];
numTables++;
numSendProps += st->GetNumProps();
numFlatProps += st->m_pPrecalc->GetNumProps();
for ( int j=0; j < st->GetNumProps(); j++ )
{
SendProp* sp = st->GetProp( j );
if ( sp->IsExcludeProp() )
{
numExcludeProps++;
continue; // no real sendprops
}
if ( sp->IsInsideArray() )
continue;
switch( sp->GetType() )
{
case DPT_Int : numInts++; break;
case DPT_Float : numFloats++; break;
case DPT_Vector : numVecs++; break;
case DPT_String : numStrings++; break;
case DPT_Array : numArrays++; break;
case DPT_DataTable : numSubTables++; break;
}
}
}
Msg("Total Send Table stats\n");
Msg("Send Tables : %i\n", numTables );
Msg("Send Props : %i\n", numSendProps );
Msg("Flat Props : %i\n", numFlatProps );
Msg("Int Props : %i\n", numInts );
Msg("Float Props : %i\n", numFloats );
Msg("Vector Props: %i\n", numVecs );
Msg("String Props: %i\n", numStrings );
Msg("Array Props : %i\n", numArrays );
Msg("Table Props : %i\n", numSubTables );
Msg("Exclu Props : %i\n", numExcludeProps );
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:58,代码来源:dt_send_eng.cpp
示例4: GetNextSendTable
// ============================================================================
// >> HELPER FUNCTIONS
// ============================================================================
SendTable* GetNextSendTable(SendTable* pTable)
{
for (int i=0; i < pTable->GetNumProps(); ++i)
{
SendProp* pProp = pTable->GetProp(i);
if (strcmp(pProp->GetName(), "baseclass") != 0)
continue;
return pProp->GetDataTable();
}
return NULL;
}
开发者ID:Source-Python-Dev-Team,项目名称:Source.Python,代码行数:15,代码来源:entities_props.cpp
示例5: SendPropExclude
SendProp SendPropExclude(
char *pDataTableName, // Data table name (given to BEGIN_SEND_TABLE and BEGIN_RECV_TABLE).
char *pPropName // Name of the property to exclude.
)
{
SendProp ret;
ret.SetFlags( SPROP_EXCLUDE );
ret.m_pExcludeDTName = pDataTableName;
ret.m_pVarName = pPropName;
return ret;
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:13,代码来源:dt_send.cpp
示例6: Array_SkipProp
void Array_SkipProp( const SendProp *pProp, bf_read *pIn )
{
SendProp *pArrayProp = pProp->GetArrayProp();
AssertMsg( pArrayProp, ("Array_SkipProp: missing m_pArrayProp for a property.") );
int nElements = pIn->ReadUBitLong( pProp->GetNumArrayLengthBits() );
for ( int i=0; i < nElements; i++ )
{
// skip over data
g_PropTypeFns[pArrayProp->GetType()].SkipProp( pArrayProp, pIn );
}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:13,代码来源:dt_encode.cpp
示例7: GetTeamClientCount
static cell_t GetTeamClientCount(IPluginContext *pContext, const cell_t *params)
{
int teamindex = params[1];
if (teamindex >= (int)g_Teams.size() || !g_Teams[teamindex].ClassName)
{
return pContext->ThrowNativeError("Team index %d is invalid", teamindex);
}
SendProp *pProp = g_pGameHelpers->FindInSendTable(g_Teams[teamindex].ClassName, "\"player_array\"");
ArrayLengthSendProxyFn fn = pProp->GetArrayLengthProxy();
return fn(g_Teams[teamindex].pEnt, 0);
}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:13,代码来源:teamnatives.cpp
示例8: SendPropFloat
SendProp SendPropFloat(
const char *pVarName,
// Variable name.
int offset, // Offset into container structure.
int sizeofVar,
int nBits, // Number of bits to use when encoding.
int flags,
float fLowValue, // For floating point, low and high values.
float fHighValue, // High value. If HIGH_DEFAULT, it's (1<<nBits).
SendVarProxyFn varProxy
)
{
SendProp ret;
if ( varProxy == SendProxy_FloatToFloat )
{
Assert( sizeofVar == 0 || sizeofVar == 4 );
}
if ( nBits <= 0 || nBits == 32 )
{
flags |= SPROP_NOSCALE;
fLowValue = 0.f;
fHighValue = 0.f;
}
else
{
if(fHighValue == HIGH_DEFAULT)
fHighValue = (1 << nBits);
if (flags & SPROP_ROUNDDOWN)
fHighValue = fHighValue - ((fHighValue - fLowValue) / (1 << nBits));
else if (flags & SPROP_ROUNDUP)
fLowValue = fLowValue + ((fHighValue - fLowValue) / (1 << nBits));
}
ret.m_Type = DPT_Float;
ret.m_pVarName = pVarName;
ret.SetOffset( offset );
ret.m_nBits = nBits;
ret.SetFlags( flags );
ret.m_fLowValue = fLowValue;
ret.m_fHighValue = fHighValue;
ret.m_fHighLowMul = AssignRangeMultiplier( ret.m_nBits, ret.m_fHighValue - ret.m_fLowValue );
ret.SetProxyFn( varProxy );
if( ret.GetFlags() & (SPROP_COORD | SPROP_NOSCALE | SPROP_NORMAL | SPROP_COORD_MP | SPROP_COORD_MP_LOWPRECISION | SPROP_COORD_MP_INTEGRAL ) )
ret.m_nBits = 0;
return ret;
}
开发者ID:Black-Stormy,项目名称:DoubleAction,代码行数:50,代码来源:dt_send.cpp
示例9: DataTable_ClearWriteFlags_R
void DataTable_ClearWriteFlags_R( SendTable *pTable )
{
pTable->SetWriteFlag( false );
for(int i=0; i < pTable->m_nProps; i++)
{
SendProp *pProp = &pTable->m_pProps[i];
if( pProp->m_Type == DPT_DataTable )
{
DataTable_ClearWriteFlags_R( pProp->GetDataTable() );
}
}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:14,代码来源:dt_common_eng.cpp
示例10: proxyfn
CTeamplayRoundBasedRules *GetTeamplayRoundBasedGameRulesPointer()
{
SendProp *pSendProp = SCHelpers::GetPropFromClassAndTable( "CTFGameRulesProxy", "DT_TeamplayRoundBasedRulesProxy", "teamplayroundbased_gamerules_data" );
if ( pSendProp )
{
SendTableProxyFn proxyfn = pSendProp->GetDataTableProxyFn();
if ( proxyfn )
{
CSendProxyRecipients recp;
void *pGameRules = proxyfn( NULL, NULL, NULL, &recp, 0 );
return reinterpret_cast<CTeamplayRoundBasedRules*>(pGameRules);
}
}
return NULL;
}
开发者ID:SizzlingStats,项目名称:sizzlingplugins,代码行数:15,代码来源:SC_helpers.cpp
示例11: DataTable_MaybeWriteSendTableBuffer_R
// Calls DataTable_MaybeWriteSendTable recursively.
void DataTable_MaybeWriteSendTableBuffer_R( SendTable *pTable, bf_write *pBuf )
{
DataTable_MaybeWriteSendTableBuffer( pTable, pBuf, false );
// Make sure we send child send tables..
for(int i=0; i < pTable->m_nProps; i++)
{
SendProp *pProp = &pTable->m_pProps[i];
if( pProp->m_Type == DPT_DataTable )
{
DataTable_MaybeWriteSendTableBuffer_R( pProp->GetDataTable(), pBuf );
}
}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:16,代码来源:dt_common_eng.cpp
示例12: DataTable_MaybeCreateReceiveTable_R
void DataTable_MaybeCreateReceiveTable_R( CUtlVector< SendTable * >& visited, SendTable *pTable )
{
DataTable_MaybeCreateReceiveTable( visited, pTable, false );
// Make sure we send child send tables..
for(int i=0; i < pTable->m_nProps; i++)
{
SendProp *pProp = &pTable->m_pProps[i];
if( pProp->m_Type == DPT_DataTable )
{
DataTable_MaybeCreateReceiveTable_R( visited, pProp->GetDataTable() );
}
}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:15,代码来源:dt_common_eng.cpp
示例13: Array_IsEncodedZero
bool Array_IsEncodedZero( const SendProp *pProp, bf_read *pIn )
{
SendProp *pArrayProp = pProp->GetArrayProp();
AssertMsg( pArrayProp, ("Array_IsEncodedZero: missing m_pArrayProp for a property.") );
int nElements = pIn->ReadUBitLong( pProp->GetNumArrayLengthBits() );
for ( int i=0; i < nElements; i++ )
{
// skip over data
g_PropTypeFns[pArrayProp->GetType()].IsEncodedZero( pArrayProp, pIn );
}
return nElements == 0;;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:15,代码来源:dt_encode.cpp
示例14: GetOffset
cell_t GetOffset(IPluginContext *pContext, const cell_t *params) {
Handle_t hndl = static_cast<Handle_t>(params[1]);
HandleError err;
HandleSecurity sec;
sec.pOwner = NULL;
sec.pIdentity = myself->GetIdentity();
SendProp *pProp;
if ((err=g_pHandleSys->ReadHandle(hndl, g_SendTableHandle, &sec, (void **)&pProp)) != HandleError_None)
{
return pContext->ThrowNativeError("Invalid SendProp handle %x (error %d)", hndl, err);
}
return pProp->GetOffset();
}
开发者ID:thraaawn,项目名称:tEntDev,代码行数:16,代码来源:extension.cpp
示例15: UTIL_DrawSendTable
void UTIL_DrawSendTable(FILE *fp, SendTable *pTable, int level)
{
char spaces[255];
for (int i=0; i<level; i++)
spaces[i] = ' ';
spaces[level] = '\0';
const char *name, *type;
SendProp *pProp;
fprintf(fp, "%sSub-Class Table (%d Deep): %s\n", spaces, level, pTable->GetName());
for (int i=0; i<pTable->GetNumProps(); i++)
{
pProp = pTable->GetProp(i);
name = pProp->GetName();
if (pProp->GetDataTable())
{
UTIL_DrawSendTable(fp, pProp->GetDataTable(), level + 1);
}
else
{
type = GetDTTypeName(pProp->GetType());
if (type != NULL)
{
fprintf(fp,
"%s-Member: %s (offset %d) (type %s) (bits %d)\n",
spaces,
pProp->GetName(),
pProp->GetOffset(),
type,
pProp->m_nBits);
}
else
{
fprintf(fp,
"%s-Member: %s (offset %d) (type %d) (bits %d)\n",
spaces,
pProp->GetName(),
pProp->GetOffset(),
pProp->GetType(),
pProp->m_nBits);
}
}
}
}
开发者ID:Nephyrin,项目名称:-furry-octo-nemesis,代码行数:47,代码来源:vhelpers.cpp
示例16: AddSendTable
void AddSendTable(SendTable* pTable, OffsetsMap& offsets, int offset=0, const char* baseName=NULL)
{
for (int i=0; i < pTable->GetNumProps(); ++i)
{
SendProp* pProp = pTable->GetProp(i);
if (strcmp(pProp->GetName(), "baseclass") == 0)
continue;
int currentOffset = offset + pProp->GetOffset();
char* currentName = NULL;
if (baseName == NULL) {
currentName = (char*) pProp->GetName();
}
else {
char tempName[256];
sprintf(tempName, "%s.%s", baseName, pProp->GetName());
currentName = strdup(tempName);
}
if (pProp->GetType() == DPT_DataTable)
{
AddSendTable(pProp->GetDataTable(), offsets, currentOffset, currentName);
}
else
{
offsets.insert(std::make_pair(currentName, currentOffset));
}
}
}
开发者ID:Source-Python-Dev-Team,项目名称:Source.Python,代码行数:30,代码来源:entities_props.cpp
示例17: SendPropString
SendProp SendPropString(
char *pVarName,
int offset,
int bufferLen,
int flags,
SendVarProxyFn varProxy)
{
SendProp ret;
Assert( bufferLen <= DT_MAX_STRING_BUFFERSIZE ); // You can only have strings with 8-bits worth of length.
ret.m_Type = DPT_String;
ret.m_pVarName = pVarName;
ret.SetOffset( offset );
ret.SetFlags( flags );
ret.SetProxyFn( varProxy );
return ret;
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:19,代码来源:dt_send.cpp
示例18:
const char *tools_GetTeamName(int team)
{
if (size_t(team) >= g_Teams.size())
return NULL;
if (g_teamname_offset == 0)
return NULL;
if (g_teamname_offset == -1)
{
SendProp *prop = g_pGameHelpers->FindInSendTable(g_Teams[team].ClassName, "m_szTeamname");
if (prop == NULL)
{
g_teamname_offset = 0;
return NULL;
}
g_teamname_offset = prop->GetOffset();
}
return (const char *)((unsigned char *)g_Teams[team].pEnt + g_teamname_offset);
}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:19,代码来源:teamnatives.cpp
示例19: SetTeamScore
static cell_t SetTeamScore(IPluginContext *pContext, const cell_t *params)
{
if (!g_pSM->IsMapRunning())
{
return pContext->ThrowNativeError("Cannot set team score when no map is running");
}
int teamindex = params[1];
if (teamindex >= (int)g_Teams.size() || !g_Teams[teamindex].ClassName)
{
return pContext->ThrowNativeError("Team index %d is invalid", teamindex);
}
if (m_iScore == NULL)
{
m_iScore = g_pGameConf->GetKeyValue("m_iScore");
if (m_iScore == NULL)
{
return pContext->ThrowNativeError("Failed to get m_iScore key");
}
}
static int offset = -1;
if (offset == -1)
{
SendProp *prop = g_pGameHelpers->FindInSendTable(g_Teams[teamindex].ClassName, m_iScore);
if (!prop)
{
return pContext->ThrowNativeError("Failed to get m_iScore prop");
}
offset = prop->GetOffset();
}
CBaseEntity *pTeam = g_Teams[teamindex].pEnt;
*(int *)((unsigned char *)pTeam + offset) = params[2];
edict_t *pEdict = gameents->BaseEntityToEdict(pTeam);
gamehelpers->SetEdictStateChanged(pEdict, offset);
return 1;
}
开发者ID:404UserNotFound,项目名称:sourcemod,代码行数:42,代码来源:teamnatives.cpp
示例20: UTIL_DrawSendTable_XML
void UTIL_DrawSendTable_XML(FILE *fp, SendTable *pTable, int space_count)
{
char spaces[255];
for (int i = 0; i < space_count; i++)
{
spaces[i] = ' ';
}
spaces[space_count] = '\0';
const char *type_name;
SendTable *pOtherTable;
SendProp *pProp;
fprintf(fp, " %s<sendtable name=\"%s\">\n", spaces, pTable->GetName());
for (int i = 0; i < pTable->GetNumProps(); i++)
{
pProp = pTable->GetProp(i);
fprintf(fp, " %s<property name=\"%s\">\n", spaces, pProp->GetName());
if ((type_name = GetDTTypeName(pProp->GetType())) != NULL)
{
fprintf(fp, " %s<type>%s</type>\n", spaces, type_name);
}
else
{
fprintf(fp, " %s<type>%d</type>\n", spaces, pProp->GetType());
}
fprintf(fp, " %s<offset>%d</offset>\n", spaces, pProp->GetOffset());
fprintf(fp, " %s<bits>%d</bits>\n", spaces, pProp->m_nBits);
if ((pOtherTable = pTable->GetProp(i)->GetDataTable()) != NULL)
{
UTIL_DrawSendTable_XML(fp, pOtherTable, space_count + 3);
}
fprintf(fp, " %s</property>\n", spaces);
}
fprintf(fp, " %s</sendtable>\n", spaces);
}
开发者ID:Nephyrin,项目名称:-furry-octo-nemesis,代码行数:42,代码来源:vhelpers.cpp
注:本文中的SendProp类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论