View Single Post
Re: FPS dependent code
Old
  (#2)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: FPS dependent code - 30-10-2009

In bot.cpp in BotSpawnInit function:
PHP Code:
   pBot->fTimePrevThink gpGlobals->time;
   
pBot->fTimePrevThink2 gpGlobals->time;
   
pBot->fTimeFrameInterval 0.0;

   
pBot->i_msecval 0;                // KWo - 17.03.2007
   
pBot->f_msecvalrest 0.0;          // KWo - 17.03.2007 
And the clue is somewhere at the end of the function BotThink in bot.cpp (almost at bottom of that file):
PHP Code:
// this is Leon Hartwig's method for computing the msec value
   
f_msecval = (gpGlobals->time pBot->fTimePrevThink2) * 1000.0;
   
pBot->fTimePrevThink2 gpGlobals->time;

   
i_msecvalrest 0;                         // KWo - 17.03.2007
   
i_msecval = (int) (f_msecval);             // KWo - 17.03.2007
   
if (i_msecval 10)                        // KWo - 17.03.2007
   
{
      
f_msecval f_msecval - (float)(i_msecval) + pBot->f_msecvalrest;
      
i_msecvalrest = (int)(f_msecval);
      
pBot->f_msecvalrest f_msecval - (float)(i_msecvalrest);
   }
   
i_msecval i_msecval i_msecvalrest;

   if (
i_msecval 1)
      
i_msecval 1// don't allow the msec delay to be null
   
else if (i_msecval 100)
      
i_msecval 100// don't allow it to last longer than 100 milliseconds either

   
g_engfuncs.pfnRunPlayerMove (pEdictvecMoveAnglespBot->f_move_speedpBot->f_sidemove_speed0pEdict->v.button0, (unsigned chari_msecval);    // KWo - 25.09.2006 - thanks to THE_STORM 
  
Reply With Quote