All pastes #76762 Raw Edit

robertj

public text v1 · immutable
·published 2006-07-02 02:55 UTC
rendered paste body
        void sendmonsterpos() {            ENetPacket * packet = enet_packet_create (NULL, MAXTRANS, ENET_PACKET_FLAG_RELIABLE);            uchar *start = packet->data;            uchar *p = start;            putint(p, SV_POS);            putint(p, clientnum);            putuint(p, (int)(o.x*DMF));              // quantize coordinates to 1/4th of a cube, between 1 and 3 bytes            putuint(p, (int)(o.y*DMF));            putuint(p, (int)(o.z*DMF));            putuint(p, (int)yaw);            putint(p, (int)pitch);            putint(p, (int)roll);            putint(p, (int)(vel.x*DVELF));          // quantize to itself, almost always 1 byte            putint(p, (int)(vel.y*DVELF));            putint(p, (int)(vel.z*DVELF));            putint(p, (int)physstate | (!gravity.iszero()<<4));                   if(!gravity.iszero())            {                putint(p, (int)(gravity.x*DVELF));      // quantize to itself, almost always 1 byte                putint(p, (int)(gravity.y*DVELF));                putint(p, (int)(gravity.z*DVELF));            };           // pack rest in 1 byte: strafe:2, move:2, state:3, reserved:1           putint(p, (strafe&3) | ((move&3)<<2) | (state<<4) );           enet_packet_resize(packet, p-start);           process(packet, clientnum);           if(packet->referenceCount==0) enet_packet_destroy(packet);	}