// Look for special flags like SPROP_COORD, SPROP_NOSCALE, and SPROP_NORMAL and
// decode if they're there. Fills in fVal and returns true if it decodes anything.
static inline bool DecodeSpecialFloat( CBitRead &entityBitBuffer, const CSVCMsg_SendTable::sendprop_t *pSendProp, float &fVal )
{
	int flags = pSendProp->flags();

	if ( flags & SPROP_COORD )
	{
		fVal = entityBitBuffer.ReadBitCoord();
		return true;
	}
	else if ( flags & SPROP_COORD_MP )
	{
		fVal = entityBitBuffer.ReadBitCoordMP( kCW_None );
		return true;
	}
	else if ( flags & SPROP_COORD_MP_LOWPRECISION )
	{
		fVal = entityBitBuffer.ReadBitCoordMP( kCW_LowPrecision );
		return true;
	}
	else if ( flags & SPROP_COORD_MP_INTEGRAL )
	{
		fVal = entityBitBuffer.ReadBitCoordMP( kCW_Integral );
		return true;
	}
	else if ( flags & SPROP_NOSCALE )
	{
		fVal = entityBitBuffer.ReadBitFloat();
		return true;
	}
	else if ( flags & SPROP_NORMAL )
	{
		fVal = entityBitBuffer.ReadBitNormal();
		return true;
	}
	else if ( flags & SPROP_CELL_COORD )
	{
		fVal = entityBitBuffer.ReadBitCellCoord( pSendProp->num_bits(), kCW_None );
		return true;
	}
	else if ( flags & SPROP_CELL_COORD_LOWPRECISION )
	{
		fVal = entityBitBuffer.ReadBitCellCoord( pSendProp->num_bits(), kCW_LowPrecision );
		return true;
	}
	else if ( flags & SPROP_CELL_COORD_INTEGRAL )
	{
		fVal = entityBitBuffer.ReadBitCellCoord( pSendProp->num_bits(), kCW_Integral );
		return true;
	}

	return false;
}
Example #2
0
static inline bool decode_special_float(CBitRead& entityBitBuffer, const CSVCMsg_SendTable::sendprop_t* pSendProp, float& fVal) {
    // Look for special flags like SPROP_COORD, SPROP_NOSCALE, and SPROP_NORMAL and
    // decode if they're there. Fills in fVal and returns true if it decodes anything.
	int flags = pSendProp->flags();

	if(flags & SPROP_COORD) {
		fVal = entityBitBuffer.ReadBitCoord();
		return true;
	} else if(flags & SPROP_COORD_MP) {
		fVal = entityBitBuffer.ReadBitCoordMP(kCW_None);
		return true;
	} else if(flags & SPROP_COORD_MP_LOWPRECISION) {
		fVal = entityBitBuffer.ReadBitCoordMP(kCW_LowPrecision);
		return true;
	} else if(flags & SPROP_COORD_MP_INTEGRAL) {
		fVal = entityBitBuffer.ReadBitCoordMP(kCW_Integral);
		return true;
	} else if(flags & SPROP_NOSCALE) {
		fVal = entityBitBuffer.ReadBitFloat();
		return true;
	} else if(flags & SPROP_NORMAL) {
		fVal = entityBitBuffer.ReadBitNormal();
		return true;
	} else if(flags & SPROP_CELL_COORD) {
		fVal = entityBitBuffer.ReadBitCellCoord(pSendProp->num_bits(), kCW_None);
		return true;
	} else if(flags & SPROP_CELL_COORD_LOWPRECISION) {
		fVal = entityBitBuffer.ReadBitCellCoord(pSendProp->num_bits(), kCW_LowPrecision);
		return true;
	} else if(flags & SPROP_CELL_COORD_INTEGRAL) {
		fVal = entityBitBuffer.ReadBitCellCoord(pSendProp->num_bits(), kCW_Integral);
		return true;
	}

	return false;
}