Source for formula is from linuxdoom-1.10.
i = I_GetTime(); tics = i - lasttic; lasttic = i; if (tics > 20) tics = 20; for (i=0 ; i<tics*2 ; i+=2) screens[ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff; for ( ; i<20*2 ; i+=2) screens[ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
I_GetTime returns time elapsed from an arbitrary starting point in units of 1/TICRATE seconds, with TICRATE = 35 (don't believe i_system.c:87). So i gets assigned the number of tics that have occured since the last time a frame update finished, and then the code prints exactly i pink dots. If it takes i * 1/TICRATE seconds to make each frame, then the number of frames per second is TICRATE / i (factor label; just flip). 22.214.171.124 02:34, 20 September 2007 (UTC)