MCPcopy Create free account
hub / github.com/assaultcube/AC / decodepitch

Function decodepitch

source/src/protocol.cpp:559–567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

557}
558
559float decodepitch(int r)
560{
561 const int thres = (1 << 22) + (1 << 22) / 3;
562 r = (r << (24 - PITCHBITS)) - (1 << 23);
563 if(r > thres) r = r * 4 - thres * 3;
564 else if(r < -thres) r = r * 4 + thres * 3;
565 float p = float(r) * MAXPITCH / (1 << 24);
566 return clamp(p, -MAXPITCH, MAXPITCH);
567}
568
569int encodeyaw(float y) // yaw value quantisation: simple rounded integer
570{

Callers 2

parsepositionsFunction · 0.85
processFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected