ddstring_t *Str_PrependChar(ddstring_t *str, char ch) { char prepend[2]; prepend[0] = ch; prepend[1] = '\0'; return Str_Prepend(str, prepend); }
boolean Demo_BeginPlayback(const char* fileName) { ddstring_t buf; if(playback) return false; // Already in playback. if(netGame || isClient) return false; // Can't do it. // Check that we aren't recording anything. { int i; for(i = 0; i < DDMAXPLAYERS; ++i) { if(clients[i].recording) return false; }} // Compose the real file name. Str_InitStd(&buf); Str_Set(&buf, fileName); if(!F_IsAbsolute(&buf)) { Str_Prepend(&buf, demoPath); } F_ExpandBasePath(&buf, &buf); F_ToNativeSlashes(&buf, &buf); // Open the demo file. playdemo = lzOpen(Str_Text(&buf), "rp"); Str_Free(&buf); if(!playdemo) return false; // Failed to open the file. // OK, let's begin the demo. playback = true; isServer = false; isClient = true; readInfo.first = true; viewangleDelta = 0; lookdirDelta = 0; demoFrameZ = 1; demoZ = 0; startFOV = fieldOfView; demoStartTic = DEMOTIC; memset(posDelta, 0, sizeof(posDelta)); // Start counting frames from here. /* if(ArgCheck("-timedemo")) r_framecounter = 0; */ return true; }