本文整理汇总了C++中SendProp类的典型用法代码示例。如果您正苦于以下问题:C++ SendProp类的具体用法?C++ SendProp怎么用?C++ SendProp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SendProp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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 );
}
示例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;
}
示例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;
}
示例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 );
}
}
示例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);
}
示例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;
}
示例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() );
}
}
}
示例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;
}
示例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 );
}
}
}
示例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() );
}
}
}
示例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;;
}
示例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();
}
示例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);
}
}
}
}