Exemplo n.º 1
0
boolean Demo_ReadPacket(void)
{
    static byte     ptime;
    int             nowtime = DEMOTIC;
    demopacket_header_t hdr;

    if(!playback)
        return false;

    if(lzEOF(playdemo))
    {
        Demo_StopPlayback();
        // Any interested parties?
        DD_CallHooks(HOOK_DEMO_STOP, false, 0);
        return false;
    }

    if(readInfo.first)
    {
        readInfo.first = false;
        readInfo.begintime = nowtime;
        ptime = lzGetC(playdemo);
    }

    // Check if the packet can be read.
    if(Net_TimeDelta(nowtime - readInfo.begintime, ptime) < 0)
        return false; // Can't read yet.

    // Read the packet.
    lzRead(&hdr, sizeof(hdr), playdemo);

    // Get the packet.
    netBuffer.length = hdr.length - 1;
    netBuffer.player = 0; // From the server.
    netBuffer.msg.type = lzGetC(playdemo);
    lzRead(netBuffer.msg.data, (long) netBuffer.length, playdemo);
    //netBuffer.cursor = netBuffer.msg.data;

/*#if _DEBUG
Con_Printf("RDP: pt=%i ang=%i ld=%i len=%i type=%i\n", ptime,
           hdr.angle, hdr.lookdir, hdr.length, netBuffer.msg.type);
#endif*/

    // Read the next packet time.
    ptime = lzGetC(playdemo);

    return true;
}
Exemplo n.º 2
0
 void read(de::dint8 *data, int len)
 {
     lzRead(data, len, &file());
 }