home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C++ Games Programming
/
CPPGAMES.ISO
/
thx
/
source
/
theatrix
/
timefold.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-25
|
1KB
|
52 lines
#include <dos.h>
#include "standard.h"
#include "handler.h"
#include "timefold.h"
// The following "resolution map" defines fire patterns for differing
// rate settings.
static char* freqentry[] =
{
" *", // 1
" * *", // 2
"* * * ", // 3
"* * * * ", // 4
"* * * * * ", // 5
"* * * * * * ", // 6
"* * * * * * * ", // 7
"* * * * * * * * ", // 8
"* * * * * * * * * ", // 9
" * * *** * * * * *", // 1
" ** * ** * ** * **", // 11
" ** ** ** ** ** **", // 12
" *** *** *** *** *", // 13
" *** **** *** ****", // 14
" ****** ****** ***", // 15
" ******** ********", // 16
" *****************", // 17
"******************" // 18
};
void TimerFolder::add_timer(Hand* h,int rate,callback cb)
{
for (int i=0;i<CLOCKTICKS;i++)
{
if (freqentry[rate-1][i]=='*')
tick[i].add(h,cb);
}
}
void TimerFolder::del_timer(Hand* h,int,callback cb)
{
for (int i=0;i<CLOCKTICKS;i++)
tick[i].del(h,cb);
}
void TimerFolder::reset()
{
for (int i=0;i<CLOCKTICKS;i++)
tick[i].reset();
}