implemented the bf_read natives
authorBorja Ferrer <faluco@alliedmods.net>
Sun Mar 11 21:09:05 2007 +0000 (2007-03-11)
changeset 598991d7e247a2c
parent 597 2309b109e2af
child 599 3a098eff4890
implemented the bf_read natives
message hooks now receive the bf_read handle
core/smn_bitbuffer.cpp
core/smn_usermsgs.cpp
core/sourcemod.h
plugins/include/bitbuffer.inc
public/IUserMessages.h
     1.1 --- a/core/smn_bitbuffer.cpp	Sun Mar 11 19:26:47 2007 +0000
     1.2 +++ b/core/smn_bitbuffer.cpp	Sun Mar 11 21:09:05 2007 +0000
     1.3 @@ -328,7 +328,310 @@
     1.4  	return 1;
     1.5  }
     1.6  
     1.7 -REGISTER_NATIVES(wrbitbufnatives)
     1.8 +static cell_t smn_BfReadBool(IPluginContext *pCtx, const cell_t *params)
     1.9 +{
    1.10 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
    1.11 +	HandleError herr;
    1.12 +	HandleSecurity sec;
    1.13 +	bf_read *pBitBuf;
    1.14 +
    1.15 +	sec.pOwner = NULL;
    1.16 +	sec.pIdentity = g_pCoreIdent;
    1.17 +
    1.18 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
    1.19 +		!= HandleError_None)
    1.20 +	{
    1.21 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
    1.22 +	}
    1.23 +
    1.24 +	return pBitBuf->ReadOneBit() ? 1 : 0;
    1.25 +}
    1.26 +
    1.27 +static cell_t smn_BfReadByte(IPluginContext *pCtx, const cell_t *params)
    1.28 +{
    1.29 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
    1.30 +	HandleError herr;
    1.31 +	HandleSecurity sec;
    1.32 +	bf_read *pBitBuf;
    1.33 +
    1.34 +	sec.pOwner = NULL;
    1.35 +	sec.pIdentity = g_pCoreIdent;
    1.36 +
    1.37 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
    1.38 +		!= HandleError_None)
    1.39 +	{
    1.40 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
    1.41 +	}
    1.42 +
    1.43 +	return pBitBuf->ReadByte();
    1.44 +}
    1.45 +
    1.46 +static cell_t smn_BfReadChar(IPluginContext *pCtx, const cell_t *params)
    1.47 +{
    1.48 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
    1.49 +	HandleError herr;
    1.50 +	HandleSecurity sec;
    1.51 +	bf_read *pBitBuf;
    1.52 +
    1.53 +	sec.pOwner = NULL;
    1.54 +	sec.pIdentity = g_pCoreIdent;
    1.55 +
    1.56 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
    1.57 +		!= HandleError_None)
    1.58 +	{
    1.59 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
    1.60 +	}
    1.61 +
    1.62 +	return pBitBuf->ReadChar();
    1.63 +}
    1.64 +
    1.65 +static cell_t smn_BfReadShort(IPluginContext *pCtx, const cell_t *params)
    1.66 +{
    1.67 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
    1.68 +	HandleError herr;
    1.69 +	HandleSecurity sec;
    1.70 +	bf_read *pBitBuf;
    1.71 +
    1.72 +	sec.pOwner = NULL;
    1.73 +	sec.pIdentity = g_pCoreIdent;
    1.74 +
    1.75 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
    1.76 +		!= HandleError_None)
    1.77 +	{
    1.78 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
    1.79 +	}
    1.80 +
    1.81 +	return pBitBuf->ReadShort();
    1.82 +}
    1.83 +
    1.84 +static cell_t smn_BfReadWord(IPluginContext *pCtx, const cell_t *params)
    1.85 +{
    1.86 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
    1.87 +	HandleError herr;
    1.88 +	HandleSecurity sec;
    1.89 +	bf_read *pBitBuf;
    1.90 +
    1.91 +	sec.pOwner = NULL;
    1.92 +	sec.pIdentity = g_pCoreIdent;
    1.93 +
    1.94 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
    1.95 +		!= HandleError_None)
    1.96 +	{
    1.97 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
    1.98 +	}
    1.99 +
   1.100 +	return pBitBuf->ReadWord();
   1.101 +}
   1.102 +
   1.103 +static cell_t smn_BfReadNum(IPluginContext *pCtx, const cell_t *params)
   1.104 +{
   1.105 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
   1.106 +	HandleError herr;
   1.107 +	HandleSecurity sec;
   1.108 +	bf_read *pBitBuf;
   1.109 +
   1.110 +	sec.pOwner = NULL;
   1.111 +	sec.pIdentity = g_pCoreIdent;
   1.112 +
   1.113 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
   1.114 +		!= HandleError_None)
   1.115 +	{
   1.116 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
   1.117 +	}
   1.118 +
   1.119 +	return static_cast<cell_t>(pBitBuf->ReadLong());
   1.120 +}
   1.121 +
   1.122 +static cell_t smn_BfReadFloat(IPluginContext *pCtx, const cell_t *params)
   1.123 +{
   1.124 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
   1.125 +	HandleError herr;
   1.126 +	HandleSecurity sec;
   1.127 +	bf_read *pBitBuf;
   1.128 +
   1.129 +	sec.pOwner = NULL;
   1.130 +	sec.pIdentity = g_pCoreIdent;
   1.131 +
   1.132 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
   1.133 +		!= HandleError_None)
   1.134 +	{
   1.135 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
   1.136 +	}
   1.137 +
   1.138 +	return sp_ftoc(pBitBuf->ReadFloat());
   1.139 +}
   1.140 +
   1.141 +static cell_t smn_BfReadString(IPluginContext *pCtx, const cell_t *params)
   1.142 +{
   1.143 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
   1.144 +	HandleError herr;
   1.145 +	HandleSecurity sec;
   1.146 +	bf_read *pBitBuf;
   1.147 +	char *buf;
   1.148 +
   1.149 +	sec.pOwner = NULL;
   1.150 +	sec.pIdentity = g_pCoreIdent;
   1.151 +
   1.152 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
   1.153 +		!= HandleError_None)
   1.154 +	{
   1.155 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
   1.156 +	}
   1.157 +
   1.158 +	pCtx->LocalToPhysAddr(params[2], (cell_t **)&buf);
   1.159 +	if (!pBitBuf->ReadString(buf, params[3], params[4] ? true : false))
   1.160 +	{
   1.161 +		return pCtx->ThrowNativeError("Destination string buffer is too short, try increasing its size");
   1.162 +	}
   1.163 +
   1.164 +	return 1;
   1.165 +}
   1.166 +
   1.167 +static cell_t smn_BfReadEntity(IPluginContext *pCtx, const cell_t *params)
   1.168 +{
   1.169 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
   1.170 +	HandleError herr;
   1.171 +	HandleSecurity sec;
   1.172 +	bf_read *pBitBuf;
   1.173 +
   1.174 +	sec.pOwner = NULL;
   1.175 +	sec.pIdentity = g_pCoreIdent;
   1.176 +
   1.177 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
   1.178 +		!= HandleError_None)
   1.179 +	{
   1.180 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
   1.181 +	}
   1.182 +
   1.183 +	return pBitBuf->ReadShort();
   1.184 +}
   1.185 +
   1.186 +static cell_t smn_BfReadAngle(IPluginContext *pCtx, const cell_t *params)
   1.187 +{
   1.188 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
   1.189 +	HandleError herr;
   1.190 +	HandleSecurity sec;
   1.191 +	bf_read *pBitBuf;
   1.192 +
   1.193 +	sec.pOwner = NULL;
   1.194 +	sec.pIdentity = g_pCoreIdent;
   1.195 +
   1.196 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
   1.197 +		!= HandleError_None)
   1.198 +	{
   1.199 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
   1.200 +	}
   1.201 +
   1.202 +	return sp_ftoc(pBitBuf->ReadBitAngle(params[2]));
   1.203 +}
   1.204 +
   1.205 +static cell_t smn_BfReadCoord(IPluginContext *pCtx, const cell_t *params)
   1.206 +{
   1.207 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
   1.208 +	HandleError herr;
   1.209 +	HandleSecurity sec;
   1.210 +	bf_read *pBitBuf;
   1.211 +
   1.212 +	sec.pOwner = NULL;
   1.213 +	sec.pIdentity = g_pCoreIdent;
   1.214 +
   1.215 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
   1.216 +		!= HandleError_None)
   1.217 +	{
   1.218 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
   1.219 +	}
   1.220 +
   1.221 +	return sp_ftoc(pBitBuf->ReadBitCoord());
   1.222 +}
   1.223 +
   1.224 +static cell_t smn_BfReadVecCoord(IPluginContext *pCtx, const cell_t *params)
   1.225 +{
   1.226 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
   1.227 +	HandleError herr;
   1.228 +	HandleSecurity sec;
   1.229 +	bf_read *pBitBuf;
   1.230 +
   1.231 +	sec.pOwner = NULL;
   1.232 +	sec.pIdentity = g_pCoreIdent;
   1.233 +
   1.234 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
   1.235 +		!= HandleError_None)
   1.236 +	{
   1.237 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
   1.238 +	}
   1.239 +
   1.240 +	cell_t *pVec;
   1.241 +	pCtx->LocalToPhysAddr(params[2], &pVec);
   1.242 +
   1.243 +	Vector vec;
   1.244 +	pBitBuf->ReadBitVec3Coord(vec);
   1.245 +
   1.246 +	pVec[0] = sp_ftoc(vec.x);
   1.247 +	pVec[1] = sp_ftoc(vec.y);
   1.248 +	pVec[2] = sp_ftoc(vec.z);
   1.249 +
   1.250 +	return 1;
   1.251 +}
   1.252 +
   1.253 +static cell_t smn_BfReadVecNormal(IPluginContext *pCtx, const cell_t *params)
   1.254 +{
   1.255 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
   1.256 +	HandleError herr;
   1.257 +	HandleSecurity sec;
   1.258 +	bf_read *pBitBuf;
   1.259 +
   1.260 +	sec.pOwner = NULL;
   1.261 +	sec.pIdentity = g_pCoreIdent;
   1.262 +
   1.263 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
   1.264 +		!= HandleError_None)
   1.265 +	{
   1.266 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
   1.267 +	}
   1.268 +
   1.269 +	cell_t *pVec;
   1.270 +	pCtx->LocalToPhysAddr(params[2], &pVec);
   1.271 +
   1.272 +	Vector vec;
   1.273 +	pBitBuf->ReadBitVec3Normal(vec);
   1.274 +
   1.275 +	pVec[0] = sp_ftoc(vec.x);
   1.276 +	pVec[1] = sp_ftoc(vec.y);
   1.277 +	pVec[2] = sp_ftoc(vec.z);
   1.278 +
   1.279 +	return 1;
   1.280 +}
   1.281 +
   1.282 +static cell_t smn_BfReadAngles(IPluginContext *pCtx, const cell_t *params)
   1.283 +{
   1.284 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
   1.285 +	HandleError herr;
   1.286 +	HandleSecurity sec;
   1.287 +	bf_read *pBitBuf;
   1.288 +
   1.289 +	sec.pOwner = NULL;
   1.290 +	sec.pIdentity = g_pCoreIdent;
   1.291 +
   1.292 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
   1.293 +		!= HandleError_None)
   1.294 +	{
   1.295 +		return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
   1.296 +	}
   1.297 +
   1.298 +	cell_t *pAng;
   1.299 +	pCtx->LocalToPhysAddr(params[2], &pAng);
   1.300 +
   1.301 +	QAngle ang;
   1.302 +	pBitBuf->ReadBitAngles(ang);
   1.303 +
   1.304 +	pAng[0] = sp_ftoc(ang.x);
   1.305 +	pAng[1] = sp_ftoc(ang.y);
   1.306 +	pAng[2] = sp_ftoc(ang.z);
   1.307 +
   1.308 +	return 1;
   1.309 +}
   1.310 +
   1.311 +REGISTER_NATIVES(bitbufnatives)
   1.312  {
   1.313  	{"BfWriteBool",				smn_BfWriteBool},
   1.314  	{"BfWriteByte",				smn_BfWriteByte},
   1.315 @@ -344,5 +647,19 @@
   1.316  	{"BfWriteVecCoord",			smn_BfWriteVecCoord},
   1.317  	{"BfWriteVecNormal",		smn_BfWriteVecNormal},
   1.318  	{"BfWriteAngles",			smn_BfWriteAngles},
   1.319 +	{"BfReadBool",				smn_BfReadBool},
   1.320 +	{"BfReadByte",				smn_BfReadByte},
   1.321 +	{"BfReadChar",				smn_BfReadChar},
   1.322 +	{"BfReadShort",				smn_BfReadShort},
   1.323 +	{"BfReadWord",				smn_BfReadWord},
   1.324 +	{"BfReadNum",				smn_BfReadNum},
   1.325 +	{"BfReadFloat",				smn_BfReadFloat},
   1.326 +	{"BfReadString",			smn_BfReadString},
   1.327 +	{"BfReadEntity",			smn_BfReadEntity},
   1.328 +	{"BfReadAngle",				smn_BfReadAngle},
   1.329 +	{"BfReadCoord",				smn_BfReadCoord},
   1.330 +	{"BfReadVecCoord",			smn_BfReadVecCoord},
   1.331 +	{"BfReadVecNormal",			smn_BfReadVecNormal},
   1.332 +	{"BfReadAngles",			smn_BfReadAngles},
   1.333  	{NULL,						NULL}
   1.334  };
     2.1 --- a/core/smn_usermsgs.cpp	Sun Mar 11 19:26:47 2007 +0000
     2.2 +++ b/core/smn_usermsgs.cpp	Sun Mar 11 21:09:05 2007 +0000
     2.3 @@ -18,7 +18,11 @@
     2.4  #include "smn_usermsgs.h"
     2.5  
     2.6  HandleType_t g_WrBitBufType;
     2.7 +HandleType_t g_RdBitBufType;
     2.8  Handle_t g_CurMsgHandle;
     2.9 +Handle_t g_ReadBufHandle;
    2.10 +bf_read g_ReadBitBuf;
    2.11 +
    2.12  int g_MsgPlayers[256];
    2.13  bool g_IsMsgInExec = false;
    2.14  
    2.15 @@ -45,15 +49,30 @@
    2.16  
    2.17  void UsrMessageNatives::OnSourceModAllInitialized()
    2.18  {
    2.19 +	HandleAccess sec;
    2.20 +	sec.access[HandleAccess_Delete] |= HANDLE_RESTRICT_IDENTITY;
    2.21 +
    2.22  	g_WrBitBufType = g_HandleSys.CreateType("BitBufWriter", this, 0, NULL, NULL, g_pCoreIdent, NULL);
    2.23 +	g_RdBitBufType = g_HandleSys.CreateType("BitBufReader", this, 0, NULL, &sec, g_pCoreIdent, NULL);
    2.24 +
    2.25 +	g_ReadBufHandle = g_HandleSys.CreateHandle(g_RdBitBufType, &g_ReadBitBuf, NULL, g_pCoreIdent, NULL);
    2.26 +
    2.27  	g_PluginSys.AddPluginsListener(this);
    2.28  }
    2.29  
    2.30  void UsrMessageNatives::OnSourceModShutdown()
    2.31  {
    2.32 +	HandleSecurity sec;
    2.33 +	sec.pIdentity = g_pCoreIdent;
    2.34 +
    2.35 +	g_HandleSys.FreeHandle(g_ReadBufHandle, &sec);
    2.36 +
    2.37  	g_HandleSys.RemoveType(g_WrBitBufType, g_pCoreIdent);
    2.38 +	g_HandleSys.RemoveType(g_RdBitBufType, g_pCoreIdent);
    2.39 +
    2.40  	g_PluginSys.RemovePluginsListener(this);
    2.41  	g_WrBitBufType = 0;
    2.42 +	g_RdBitBufType = 0;
    2.43  }
    2.44  
    2.45  void UsrMessageNatives::OnHandleDestroy(HandleType_t type, void *object)
    2.46 @@ -221,8 +240,10 @@
    2.47  	cell_t res;
    2.48  	size_t size = _FillInPlayers(g_MsgPlayers, pFilter);
    2.49  
    2.50 +	g_ReadBitBuf.StartReading(bf->GetBasePointer(), bf->GetNumBytesWritten());
    2.51 +
    2.52  	m_Hook->PushCell(msg_id);
    2.53 -	m_Hook->PushCell(0); //:TODO: push handle!
    2.54 +	m_Hook->PushCell(g_ReadBufHandle);
    2.55  	m_Hook->PushArray(g_MsgPlayers, size);
    2.56  	m_Hook->PushCell(size);
    2.57  	m_Hook->PushCell(pFilter->IsReliable());
    2.58 @@ -235,8 +256,10 @@
    2.59  	cell_t res = static_cast<cell_t>(Pl_Continue);
    2.60  	size_t size = _FillInPlayers(g_MsgPlayers, pFilter);
    2.61  
    2.62 +	g_ReadBitBuf.StartReading(bf->GetBasePointer(), bf->GetNumBytesWritten());
    2.63 +
    2.64  	m_Intercept->PushCell(msg_id);
    2.65 -	m_Intercept->PushCell(0); //:TODO: push handle!
    2.66 +	m_Intercept->PushCell(g_ReadBufHandle);
    2.67  	m_Intercept->PushArray(g_MsgPlayers, size);
    2.68  	m_Intercept->PushCell(size);
    2.69  	m_Intercept->PushCell(pFilter->IsReliable());
     3.1 --- a/core/sourcemod.h	Sun Mar 11 19:26:47 2007 +0000
     3.2 +++ b/core/sourcemod.h	Sun Mar 11 21:09:05 2007 +0000
     3.3 @@ -102,5 +102,6 @@
     3.4  
     3.5  extern SourceModBase g_SourceMod;
     3.6  extern HandleType_t g_WrBitBufType;
     3.7 +extern HandleType_t g_RdBitBufType;
     3.8  
     3.9  #endif //_INCLUDE_SOURCEMOD_GLOBALHEADER_H_
     4.1 --- a/plugins/include/bitbuffer.inc	Sun Mar 11 19:26:47 2007 +0000
     4.2 +++ b/plugins/include/bitbuffer.inc	Sun Mar 11 21:09:05 2007 +0000
     4.3 @@ -133,7 +133,7 @@
     4.4  /**
     4.5   * Writes a 3D vector of coordinates to a writable bitbuffer (bf_write).
     4.6   *
     4.7 - * @param bif			bf_write handle to write to.
     4.8 + * @param bf			bf_write handle to write to.
     4.9   * @param coord			Coordinate array to write.
    4.10   * @noreturn
    4.11   * @error				Invalid or incorrect Handle.
    4.12 @@ -143,7 +143,7 @@
    4.13  /**
    4.14   * Writes a 3D normal vector to a writable bitbuffer (bf_write).
    4.15   *
    4.16 - * @param bif			bf_write handle to write to.
    4.17 + * @param bf			bf_write handle to write to.
    4.18   * @param vec			Vector to write.
    4.19   * @noreturn
    4.20   * @error				Invalid or incorrect Handle.
    4.21 @@ -153,9 +153,143 @@
    4.22  /**
    4.23   * Writes a 3D angle vector to a writable bitbuffer (bf_write).
    4.24   *
    4.25 - * @param bif			bf_write handle to write to.
    4.26 + * @param bf			bf_write handle to write to.
    4.27   * @param angles		Angle vector to write.
    4.28   * @noreturn
    4.29   * @error				Invalid or incorrect Handle.
    4.30   */
    4.31  native BfWriteAngles(Handle:bf, Float:angles[3]);
    4.32 +
    4.33 +/** 
    4.34 + * Reads a single bit from a readable bitbuffer (bf_read).
    4.35 + *
    4.36 + * @param bf			bf_read handle to read from.
    4.37 + * @return			Bit value read.
    4.38 + * @error				Invalid or incorrect Handle.
    4.39 + */
    4.40 +native bool:BfReadBool(Handle:bf);
    4.41 +
    4.42 +/**
    4.43 + * Reads a byte from a readable bitbuffer (bf_read).
    4.44 + *
    4.45 + * @param bf			bf_read handle to read from.
    4.46 + * @return			Byte value read (read as 8bit).
    4.47 + * @error				Invalid or incorrect Handle.
    4.48 + */
    4.49 +native BfReadByte(Handle:bf);
    4.50 +
    4.51 +/**
    4.52 + * Reads a character from a readable bitbuffer (bf_read).
    4.53 + *
    4.54 + * @param bf			bf_read handle to read from.
    4.55 + * @return			Character value read.
    4.56 + * @error				Invalid or incorrect Handle.
    4.57 + */
    4.58 +native BfReadChar(Handle:bf);
    4.59 +
    4.60 +/**
    4.61 + * Reads a 16bit integer from a readable bitbuffer (bf_read).
    4.62 + *
    4.63 + * @param bf			bf_read handle to read from.
    4.64 + * @return			Integer value read (read as 16bit).
    4.65 + * @error				Invalid or incorrect Handle.
    4.66 + */
    4.67 +native BfReadShort(Handle:bf);
    4.68 +
    4.69 +/**
    4.70 + * Reads a 16bit unsigned integer from a readable bitbuffer (bf_read).
    4.71 + *
    4.72 + * @param bf			bf_read handle to read from.
    4.73 + * @return			Integer value read (read as 16bit).
    4.74 + * @error				Invalid or incorrect Handle.
    4.75 + */
    4.76 +native BfReadWord(Handle:bf);
    4.77 +
    4.78 +/**
    4.79 + * Reads a normal integer to a readable bitbuffer (bf_read).
    4.80 + *
    4.81 + * @param bf			bf_read handle to read from.
    4.82 + * @return			Integer value read (read as 32bit).
    4.83 + * @error				Invalid or incorrect Handle.
    4.84 + */
    4.85 +native BfReadNum(Handle:bf);
    4.86 +
    4.87 +/**
    4.88 + * Reads a floating point number from a readable bitbuffer (bf_read).
    4.89 + *
    4.90 + * @param bf			bf_read handle to read from.
    4.91 + * @return			Floating point value read.
    4.92 + * @error				Invalid or incorrect Handle.
    4.93 + */
    4.94 +native Float:BfReadFloat(Handle:bf);
    4.95 +
    4.96 +/**
    4.97 + * Reads a string from a readable bitbuffer (bf_read).
    4.98 + *
    4.99 + * @param bf			bf_read handle to read from.
   4.100 + * @param buffer		Destination string buffer.
   4.101 + * @param maxlength		Maximum length of output string buffer.
   4.102 + * @param Line			If true the buffer will be copied until it reaches a '\n' or a null terminator.
   4.103 + * @noreturn
   4.104 + * @error				Invalid or incorrect Handle, destination string buffer was too short.
   4.105 + */
   4.106 +native BfReadString(Handle:bf, String:buffer[], maxlength, bool:Line=false);
   4.107 +
   4.108 +/**
   4.109 + * Reads an entity from a readable bitbuffer (bf_read).
   4.110 + * @note This is a wrapper around BfReadShort().
   4.111 + *
   4.112 + * @param bf			bf_read handle to read from.
   4.113 + * @return			Entity index read.
   4.114 + * @error				Invalid or incorrect Handle.
   4.115 + */
   4.116 +native BfReadEntity(Handle:bf);
   4.117 +
   4.118 +/**
   4.119 + * Reads a bit angle from a readable bitbuffer (bf_read).
   4.120 + *
   4.121 + * @param bf			bf_read handle to read from.
   4.122 + * @param numBits		Optional number of bits to use.
   4.123 + * @return			Angle read.
   4.124 + * @error				Invalid or incorrect Handle.
   4.125 + */
   4.126 +native Float:BfReadAngle(Handle:bf, numBits=8);
   4.127 +
   4.128 +/**
   4.129 + * Reads a coordinate from a readable bitbuffer (bf_read).
   4.130 + *
   4.131 + * @param bf			bf_read handle to read from.
   4.132 + * @return			Coordinate read.
   4.133 + * @error				Invalid or incorrect Handle.
   4.134 + */
   4.135 +native Float:BfReadCoord(Handle:bf);
   4.136 +
   4.137 +/**
   4.138 + * Reads a 3D vector of coordinates from a readable bitbuffer (bf_read).
   4.139 + *
   4.140 + * @param bf			bf_read handle to read from.
   4.141 + * @param coord			Destination coordinate array.
   4.142 + * @noreturn
   4.143 + * @error				Invalid or incorrect Handle.
   4.144 + */
   4.145 +native BfReadVecCoord(Handle:bf, Float:coord[3]);
   4.146 +
   4.147 +/**
   4.148 + * Reads a 3D normal vector from a readable bitbuffer (bf_read).
   4.149 + *
   4.150 + * @param bf			bf_read handle to read from.
   4.151 + * @param vec			Destination vector array.
   4.152 + * @noreturn
   4.153 + * @error				Invalid or incorrect Handle.
   4.154 + */
   4.155 +native BfReadVecNormal(Handle:bf, Float:vec[3]);
   4.156 +
   4.157 +/**
   4.158 + * Reads a 3D angle vector from a readable bitbuffer (bf_read).
   4.159 + *
   4.160 + * @param bf			bf_read handle to read from.
   4.161 + * @param angles		Destination angle vector.
   4.162 + * @noreturn
   4.163 + * @error				Invalid or incorrect Handle.
   4.164 + */
   4.165 +native BfReadAngles(Handle:bf, Float:angles[3]);
     5.1 --- a/public/IUserMessages.h	Sun Mar 11 19:26:47 2007 +0000
     5.2 +++ b/public/IUserMessages.h	Sun Mar 11 21:09:05 2007 +0000
     5.3 @@ -59,7 +59,7 @@
     5.4  		 * @param msg_id		Message Id.
     5.5  		 * @param bf			bf_write structure containing written bytes.
     5.6  		 * @param pFtiler		Recipient filter.
     5.7 -		 * @return				True to allow message, false to scrap it.
     5.8 +		 * @return				Pl_Continue to allow message, Pl_Stop or Pl_Handled to scrap it.
     5.9  		 */
    5.10  		virtual ResultType InterceptUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter)
    5.11  		{