by Spike » Wed Sep 22, 2010 9:41 am
bitwise truths:
255 = 1+2+4+8+16+32+64+128.
254 = 2+4+8+16+32+64+128.
255&1 = 1
254&1 = 0
1|3 = 3
1|2 = 3
1|1 = 1
When using bitfields, it helps to give names to the individual bits (as in all programming, magic values are bad).
x&y = 1 where both x and y = 1, 0 where either is 0. if 1, the dimensions match and the ent can be seen.
Note that this is 'bitwise and' and not 'logical and', and thus your result value is only 0 or 1, but the bits that are set are as set. See the .items field for a practical example in quake. Where a bit is set, you have a hud item visible in your sbar, where its 0, you don't. Dimension_see/send is just a pair of masks. When they cancel each other out (see&seen == 0), the ent is not visible.
.