home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / msysjour / vol05 / 05 / based / animate.c < prev    next >
Text File  |  1990-09-01  |  2KB  |  75 lines

  1. // animate.c RHS uses .LST file to display objects for animation
  2.  
  3. #include<stdio.h>
  4. #include<dos.h>
  5. #include<conio.h>
  6. #include"list.h"
  7.  
  8. #define SCREENSIZE 4000
  9. #define SCREEN_ADDRESS 0xb8000000
  10.  
  11. void fp_show_object(unsigned far *object);
  12. void bp_show_object(unsigned far *object);
  13. void main(int argc, char **argv);
  14.  
  15. unsigned far *screen = (void far *)SCREEN_ADDRESS;
  16. void fp_show_object(unsigned far *object)
  17.     {
  18.     unsigned i;
  19.     unsigned far *sptr = screen;
  20.  
  21.     for(i = 0; i < SCREENSIZE/2; i++, *sptr++ = *object++)
  22.         ;
  23.     }
  24.  
  25. unsigned _based(screen) *bptr;
  26. void bp_show_object(unsigned far *object)
  27.     {
  28.     unsigned i;
  29.  
  30.     bptr = 0;
  31.  
  32.     for(i = 0; i < SCREENSIZE/2; i++, *bptr++ = *object++)
  33.         ;
  34.     }
  35.  
  36. void main(int argc, char **argv)
  37.     {
  38.     void far *L;
  39.     void far *object;
  40.     char *screen = "APPART";
  41.     unsigned numobjects, i, based = 0;
  42.     unsigned lih;
  43.  
  44.     if(argc < 2 || argc > 3)
  45.         error_exit(0,
  46.            "Usage: ANIMATE <filename.LST> [/Based pointer display]");
  47.  
  48.     if(argc == 3 &&
  49.             ((*argv[2]=='-' || *argv[2]=='/') &&
  50.             (argv[2][1]=='b' || argv[2][1]=='B')))
  51.         based = 1;
  52.  
  53.     if(L = ListRestore(argv[1]))
  54.         {
  55.         numobjects = ListGetNumItems(L);
  56.  
  57.         while(1)
  58.             {
  59.             lih = ListGetItem(L);
  60.             for(i = 0; i < numobjects; i++)
  61.                 {
  62.                 if(object = ListItemGetObject(L, lih))
  63.                     if(based)
  64.                         bp_show_object((unsigned far *)object);
  65.                     else
  66.                         fp_show_object((unsigned far *)object);
  67.                 lih = ListItemGetNextItem(L,lih);
  68.                 }
  69.             if(kbhit())
  70.                 break;
  71.             }
  72.         }
  73.     }
  74.  
  75.