home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include "../h/rtc.h"
- #include "../h/umac.h"
-
- #define MAX 2000 /* 1 mn at tick 4 */
-
-
- extern int Magic_Circus;
-
- extern struct chg chg;
-
- short pts[MAX * 7];
-
- int check();
- int play();
- short *idx = pts;
- int nbp;
- int enough = NO;
-
- main(argc, argv)
- int argc;
- char **argv;
- {
- extern int terminate;
- int fi = -1;
- int q, rate = 2;
-
- switch (argc) {
- case 1 :
- fi = 0;
- break;
- case 2 :
- fi = open(*(argv+1), 0);
- if (fi < 0) {
- printf("can't open input file\n");
- exit(1);
- }
- break;
- default :
- printf("bad arg\n");
- exit(2);
- break;
- }
- nbp = read(fi, pts, MAX * 14);
- if (nbp == MAX * 14) {
- printf("file too big\n");
- exit(3);
- }
- if (nbp % 7) {
- printf("invalid file\n");
- exit(4);
- }
- nbp /= 14;
-
- printf("%d points\n",nbp);
-
- Magic_Circus = NO;
- control(check, play);
- while (!enough) {
- printf(" more ? ");
- QUERY(q);
- if (q == 'n') {
- enough = YES;
- break;
- }
- dsprate(rate);
- printf(" slower ? ");
- QUERY(q);
- if (q == 'y') {
- if (rate < 4) {
- ++rate;
- chg.g_rate.valg = rate;
- chg.g_rate.set = YES;
- }
- }
- dsprate(rate);
- printf(" faster ? ");
- QUERY(q);
- if (q == 'y') {
- if (rate > 2) {
- --rate;
- chg.g_rate.valg = rate;
- chg.g_rate.set = YES;
- }
- }
- }
- while (!terminate) {
- nap(10);
- }
- release("ok\n");
- }
-
-
- dsprate(r)
- int r;
- {
- switch (r) {
- case 2:
- printf(" normal speed");
- break;
-
- case 3:
- printf(" half speed ");
- break;
-
- case 4:
- printf(" quater speed ");
- break;
- }
- }
-
-
- check()
- {
- }
-
-
- play()
- {
- static int count = 0;
- register int i;
- short shdi;
-
- if (count == 0) {
- if (enough) {
- terminate = YES;
- return;
- }
- idx = pts;
- count = nbp;
- }
- --count;
- for (i = 0; i < NJOINTS; ++i) {
- chg.a_motion.vala[i] = *idx++;
- }
- chg.a_motion.set = POS;
- shdi = (*idx++) >> 4;
- chg.g_hand.set = YES;
- chg.g_hand.valg = shdi;
- }
-