| 112 | } |
| 113 | |
| 114 | void parsepositions(ucharbuf &p) |
| 115 | { |
| 116 | int type; |
| 117 | while(p.remaining()) switch(type = getint(p)) |
| 118 | { |
| 119 | case SV_POS: // position of another client |
| 120 | case SV_POSC: |
| 121 | case SV_POSC2: |
| 122 | case SV_POSC3: |
| 123 | case SV_POSC4: |
| 124 | { |
| 125 | int cn, f, yaw, pitch, z; |
| 126 | vec o, vel; |
| 127 | if(type != SV_POS) |
| 128 | { |
| 129 | bitbuf<ucharbuf> q(p); |
| 130 | cn = q.getbits(5); |
| 131 | int usefactor = type - SV_POSC + 7; |
| 132 | o.x = q.getbits(usefactor + 4) / DMF; |
| 133 | o.y = q.getbits(usefactor + 4) / DMF; |
| 134 | yaw = q.getbits(YAWBITS); |
| 135 | pitch = q.getbits(PITCHBITS); |
| 136 | f = q.getbits(FLAGBITS); |
| 137 | if(f & (1 << 9)) |
| 138 | { |
| 139 | vel.x = (q.getbits(4) - 8) / DVELF; |
| 140 | vel.y = (q.getbits(4) - 8) / DVELF; |
| 141 | vel.z = (q.getbits(4) - 8) / DVELF; |
| 142 | } |
| 143 | else vel.x = vel.y = vel.z = 0.0f; |
| 144 | int full = q.getbits(1); |
| 145 | int s = q.rembits(); |
| 146 | if(s < 3) s += 8; |
| 147 | if(full) s = 11; |
| 148 | z = q.getbits(s); |
| 149 | } |
| 150 | else |
| 151 | { |
| 152 | cn = getint(p); |
| 153 | o.x = getuint(p)/DMF; |
| 154 | o.y = getuint(p)/DMF; |
| 155 | z = getuint(p); |
| 156 | uint64_t ff = getuintn(p, (YAWBITS + PITCHBITS + FLAGBITS + 7) / 8); |
| 157 | yaw = (ff >> (FLAGBITS + PITCHBITS)) & ((1 << YAWBITS) - 1); |
| 158 | pitch = (ff >> FLAGBITS) & ((1 << PITCHBITS) - 1); |
| 159 | f = ff & ((1 << FLAGBITS) - 1); |
| 160 | if(f & (1 << 9)) |
| 161 | { |
| 162 | vel.x = getint(p)/DVELF; |
| 163 | vel.y = getint(p)/DVELF; |
| 164 | vel.z = getint(p)/DVELF; |
| 165 | } |
| 166 | else vel.x = vel.y = vel.z = 0.0f; |
| 167 | } |
| 168 | if(f & (1 << 10)) z = -z; |
| 169 | o.z = z / DMF; |
| 170 | int seqcolor = (f>>6)&1; |
| 171 | playerent *d = getclient(cn); |
no test coverage detected