|
faluco@505
|
1 |
/** |
|
faluco@505
|
2 |
* vim: set ts=4 : |
|
faluco@505
|
3 |
* =============================================================== |
|
faluco@505
|
4 |
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved. |
|
faluco@505
|
5 |
* =============================================================== |
|
faluco@505
|
6 |
* |
|
faluco@505
|
7 |
* This file is part of the SourceMod/SourcePawn SDK. This file may only be used |
|
faluco@505
|
8 |
* or modified under the Terms and Conditions of its License Agreement, which is found |
|
faluco@505
|
9 |
* in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins |
|
faluco@505
|
10 |
* may change at any time. To view the latest information, see: |
|
faluco@505
|
11 |
* http://www.sourcemod.net/license.php |
|
faluco@505
|
12 |
* |
|
faluco@505
|
13 |
* Version: $Id$ |
|
faluco@505
|
14 |
*/ |
|
faluco@505
|
15 |
|
|
faluco@505
|
16 |
#if defined _bitbuffer_included |
|
faluco@505
|
17 |
#endinput |
|
faluco@505
|
18 |
#endif |
|
faluco@505
|
19 |
#define _bitbuffer_included |
|
faluco@505
|
20 |
|
|
faluco@505
|
21 |
/** |
|
faluco@505
|
22 |
* Writes a single bit to a writable bitbuffer (bf_write). |
|
faluco@505
|
23 |
* |
|
faluco@505
|
24 |
* @param bf bf_write handle to write to. |
|
faluco@505
|
25 |
* @param bit Bit to write (true for 1, false for 0). |
|
faluco@505
|
26 |
* @noreturn |
|
faluco@505
|
27 |
* @error Invalid or incorrect Handle. |
|
faluco@505
|
28 |
*/ |
|
faluco@505
|
29 |
native BfWriteBool(Handle:bf, bool:bit); |
|
faluco@505
|
30 |
|
|
faluco@505
|
31 |
/** |
|
faluco@505
|
32 |
* Writes a byte to a writable bitbuffer (bf_write). |
|
faluco@505
|
33 |
* |
|
faluco@505
|
34 |
* @param bf bf_write handle to write to. |
|
faluco@505
|
35 |
* @param byte Byte to write (value will be written as 8bit). |
|
faluco@505
|
36 |
* @noreturn |
|
faluco@505
|
37 |
* @error Invalid or incorrect Handle. |
|
faluco@505
|
38 |
*/ |
|
faluco@505
|
39 |
native BfWriteByte(Handle:bf, byte); |
|
faluco@505
|
40 |
|
|
faluco@505
|
41 |
/** |
|
faluco@505
|
42 |
* Writes a byte to a writable bitbuffer (bf_write). |
|
faluco@505
|
43 |
* |
|
faluco@505
|
44 |
* @param bf bf_write handle to write to. |
|
faluco@505
|
45 |
* @param chr Character to write. |
|
faluco@505
|
46 |
* @noreturn |
|
faluco@505
|
47 |
* @error Invalid or incorrect Handle. |
|
faluco@505
|
48 |
*/ |
|
faluco@505
|
49 |
native BfWriteChar(Handle:bf, chr); |
|
faluco@505
|
50 |
|
|
faluco@505
|
51 |
/** |
|
faluco@505
|
52 |
* Writes a 16bit integer to a writable bitbuffer (bf_write). |
|
faluco@505
|
53 |
* |
|
faluco@505
|
54 |
* @param bf bf_write handle to write to. |
|
faluco@505
|
55 |
* @param num Integer to write (value will be written as 16bit). |
|
faluco@505
|
56 |
* @noreturn |
|
faluco@505
|
57 |
* @error Invalid or incorrect Handle. |
|
faluco@505
|
58 |
*/ |
|
faluco@505
|
59 |
native BfWriteShort(Handle:bf, num); |
|
faluco@505
|
60 |
|
|
faluco@505
|
61 |
/** |
|
faluco@505
|
62 |
* Writes a 16bit unsigned integer to a writable bitbuffer (bf_write). |
|
faluco@505
|
63 |
* |
|
faluco@505
|
64 |
* @param bf bf_write handle to write to. |
|
faluco@505
|
65 |
* @param num Integer to write (value will be written as 16bit). |
|
faluco@505
|
66 |
* @noreturn |
|
faluco@505
|
67 |
* @error Invalid or incorrect Handle. |
|
faluco@505
|
68 |
*/ |
|
faluco@505
|
69 |
native BfWriteWord(Handle:bf, num); |
|
faluco@505
|
70 |
|
|
faluco@505
|
71 |
/** |
|
faluco@505
|
72 |
* Writes a normal integer to a writable bitbuffer (bf_write). |
|
faluco@505
|
73 |
* |
|
faluco@505
|
74 |
* @param bf bf_write handle to write to. |
|
faluco@505
|
75 |
* @param num Integer to write (value will be written as 32bit). |
|
faluco@505
|
76 |
* @noreturn |
|
faluco@505
|
77 |
* @error Invalid or incorrect Handle. |
|
faluco@505
|
78 |
*/ |
|
faluco@505
|
79 |
native BfWriteNum(Handle:bf, num); |
|
faluco@505
|
80 |
|
|
faluco@505
|
81 |
/** |
|
faluco@505
|
82 |
* Writes a floating point number to a writable bitbuffer (bf_write). |
|
faluco@505
|
83 |
* |
|
faluco@505
|
84 |
* @param bf bf_write handle to write to. |
|
faluco@505
|
85 |
* @param num Number to write. |
|
faluco@505
|
86 |
* @noreturn |
|
faluco@505
|
87 |
* @error Invalid or incorrect Handle. |
|
faluco@505
|
88 |
*/ |
|
faluco@505
|
89 |
native BfWriteFloat(Handle:bf, Float:num); |
|
faluco@505
|
90 |
|
|
faluco@505
|
91 |
/** |
|
faluco@505
|
92 |
* Writes a string to a writable bitbuffer (bf_write). |
|
faluco@505
|
93 |
* |
|
faluco@505
|
94 |
* @param bf bf_write handle to write to. |
|
faluco@505
|
95 |
* @param string Text string to write. |
|
faluco@505
|
96 |
* @noreturn |
|
faluco@505
|
97 |
* @error Invalid or incorrect Handle. |
|
faluco@505
|
98 |
*/ |
|
faluco@505
|
99 |
native BfWriteString(Handle:bf, const String:string[]); |
|
faluco@505
|
100 |
|
|
faluco@505
|
101 |
/** |
|
faluco@505
|
102 |
* Writes an entity to a writable bitbuffer (bf_write). |
|
faluco@505
|
103 |
* @note This is a wrapper around BfWriteShort(). |
|
faluco@505
|
104 |
* |
|
faluco@505
|
105 |
* @param bf bf_write handle to write to. |
|
faluco@505
|
106 |
* @param ent Entity index to write. |
|
faluco@505
|
107 |
* @noreturn |
|
faluco@505
|
108 |
* @error Invalid or incorrect Handle, or invalid entity. |
|
faluco@505
|
109 |
*/ |
|
faluco@505
|
110 |
native BfWriteEntity(Handle:bf, ent); |
|
faluco@505
|
111 |
|
|
faluco@505
|
112 |
/** |
|
faluco@505
|
113 |
* Writes a bit angle to a writable bitbuffer (bf_write). |
|
faluco@505
|
114 |
* |
|
faluco@505
|
115 |
* @param bf bf_write handle to write to. |
|
faluco@505
|
116 |
* @param angle Angle to write. |
|
faluco@505
|
117 |
* @param numBits Optional number of bits to use. |
|
faluco@505
|
118 |
* @noreturn |
|
faluco@505
|
119 |
* @error Invalid or incorrect Handle. |
|
faluco@505
|
120 |
*/ |
|
faluco@505
|
121 |
native BfWriteAngle(Handle:bf, Float:angle, numBits=8); |
|
faluco@505
|
122 |
|
|
faluco@505
|
123 |
/** |
|
faluco@505
|
124 |
* Writes a coordinate to a writable bitbuffer (bf_write). |
|
faluco@505
|
125 |
* |
|
faluco@505
|
126 |
* @param bf bf_write handle to write to. |
|
faluco@505
|
127 |
* @param coord Coordinate to write. |
|
faluco@505
|
128 |
* @noreturn |
|
faluco@505
|
129 |
* @error Invalid or incorrect Handle. |
|
faluco@505
|
130 |
*/ |
|
faluco@505
|
131 |
native BfWriteCoord(Handle:bf, Float:coord); |
|
faluco@505
|
132 |
|
|
faluco@505
|
133 |
/** |
|
faluco@505
|
134 |
* Writes a 3D vector of coordinates to a writable bitbuffer (bf_write). |
|
faluco@505
|
135 |
* |
|
faluco@505
|
136 |
* @param bif bf_write handle to write to. |
|
faluco@505
|
137 |
* @param coord Coordinate array to write. |
|
faluco@505
|
138 |
* @noreturn |
|
faluco@505
|
139 |
* @error Invalid or incorrect Handle. |
|
faluco@505
|
140 |
*/ |
|
faluco@505
|
141 |
native BfWriteVecCoord(Handle:bf, Float:coord[3]); |
|
faluco@505
|
142 |
|
|
faluco@505
|
143 |
/** |
|
faluco@505
|
144 |
* Writes a 3D normal vector to a writable bitbuffer (bf_write). |
|
faluco@505
|
145 |
* |
|
faluco@505
|
146 |
* @param bif bf_write handle to write to. |
|
faluco@505
|
147 |
* @param vec Vector to write. |
|
faluco@505
|
148 |
* @noreturn |
|
faluco@505
|
149 |
* @error Invalid or incorrect Handle. |
|
faluco@505
|
150 |
*/ |
|
faluco@505
|
151 |
native BfWriteVecNormal(Handle:bf, Float:vec[3]); |
|
faluco@505
|
152 |
|
|
faluco@505
|
153 |
/** |
|
faluco@505
|
154 |
* Writes a 3D angle vector to a writable bitbuffer (bf_write). |
|
faluco@505
|
155 |
* |
|
faluco@505
|
156 |
* @param bif bf_write handle to write to. |
|
faluco@505
|
157 |
* @param angles Angle vector to write. |
|
faluco@505
|
158 |
* @noreturn |
|
faluco@505
|
159 |
* @error Invalid or incorrect Handle. |
|
faluco@505
|
160 |
*/ |
|
faluco@505
|
161 |
native BfWriteAngles(Handle:bf, Float:angles[3]); |