home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / thx / source / theatrix / timefold.cpp < prev    next >
C/C++ Source or Header  |  1995-04-25  |  1KB  |  52 lines

  1. #include <dos.h>
  2. #include "standard.h"
  3. #include "handler.h"
  4. #include "timefold.h"
  5.  
  6.  
  7. // The following "resolution map" defines fire patterns for differing
  8. // rate settings.
  9. static char* freqentry[] =
  10.   {
  11.   "                 *",            // 1
  12.   "        *        *",            // 2
  13.   "*      *      *   ",            // 3
  14.   "*    *   *    *   ",            // 4
  15.   "*   *   *   *   * ",            // 5
  16.   "*  *  *  *  *  *  ",            // 6
  17.   "*  * *  * *  * *  ",            // 7
  18.   "* * *  * * *  * * ",            // 8
  19.   "* * * * * * * * * ",            // 9
  20.   " * * *** * * * * *",            // 1
  21.   " ** * ** * ** * **",            // 11
  22.   " ** ** ** ** ** **",            // 12
  23.   " *** *** *** *** *",            // 13
  24.   " *** **** *** ****",            // 14
  25.   " ****** ****** ***",            // 15
  26.   " ******** ********",            // 16
  27.   " *****************",            // 17
  28.   "******************"             // 18
  29.   };
  30.  
  31. void TimerFolder::add_timer(Hand* h,int rate,callback cb)
  32.   {
  33.   for (int i=0;i<CLOCKTICKS;i++)
  34.     {
  35.     if (freqentry[rate-1][i]=='*')
  36.       tick[i].add(h,cb);
  37.     }
  38.   }
  39.  
  40. void TimerFolder::del_timer(Hand* h,int,callback cb)
  41.   {
  42.   for (int i=0;i<CLOCKTICKS;i++)
  43.     tick[i].del(h,cb);
  44.   }
  45.  
  46. void TimerFolder::reset()
  47.   {
  48.   for (int i=0;i<CLOCKTICKS;i++)
  49.     tick[i].reset();
  50.   }
  51.  
  52.