home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 57 / af057sub.adf / ISL_2_0.lha / frames.c < prev    next >
C/C++ Source or Header  |  1993-10-18  |  2KB  |  80 lines

  1. /*
  2.    frames.c - Copyright but freely distributable as part of the ISL package
  3.    (c) 1993 by Grizzly Bear Labs.  This is a small example of how to generate
  4.    an ISL stage using a c program - look at it and learn, but don't bother
  5.    generating the frames because they are boring!  :-)
  6. */
  7.  
  8. #define INC 16
  9. #define MAX ((INC*INC*2)-1)
  10. #define RATIO (169.0 / (MAX * MAX))
  11.  
  12. main()
  13. {
  14.     int frames = 1, t, cnt = -1, toggle = 0;
  15.     float pos;
  16.  
  17.     printf("STAGE\nMAXFRAMES %d\n\n", MAX + 1);
  18.  
  19.     printf("CAMERA \"CAMERA\"\n");
  20.     printf("POSITION FRAMES 1 1 XYZ 0.0 -600.0 -100.0\n");
  21.     printf("ALIGN FRAMES 1 1 XYZ 0.0 0.0 0.0\n");
  22.     printf("SIZE FRAMES 1 1 XYZ 320.0 640.0 233.333333\n\n");
  23.  
  24.     printf("GLOBALS \"GLOBALS\"\n");
  25.     printf("ACTOR FRAMES 1 1 BRUSH \"\" 0 BACKDROP \"\" 0 ");
  26.     printf("AMBIENT RGB 0.0 0.0 0.0 HORIZON RGB 0.0 255.0 255.0 ");
  27.     printf("+ZENITH RGB 255.0 0.0 255.0 -ZENITH RGB 255.0 0.0 255.0 ");
  28.     printf("FOG BTL 0.0 0.0 0.0 FOG RGB 0.0 0.0 0.0 ");
  29.     printf("STARFIELD 0.0 TRANSITION 0 SKYBLEND 255\n\n");
  30.  
  31.     printf("LIGHT \"LIGHTSOURCE\"\n");
  32.     printf("ACTOR FRAMES 1 %d SPHERICAL SHADOW ", MAX + 1);
  33.     printf("RGB 512.0 512.0 512.0 TRANSITION 0\n");
  34.     printf("POSITION FRAMES 1 1 XYZ 102.0 -158.000473 102.666656\n");
  35.     printf("ALIGN FRAMES 1 1 XYZ 0.0 0.0 0.0\n");
  36.     printf("SIZE FRAMES 1 1 XYZ 32.0 32.0 32.0\n\n");
  37.  
  38.     printf("OBJECT \"GROUND\"\n");
  39.     printf("ACTOR FRAMES 1 %d NAME \"Bounce.imp/objects/ground\" ", MAX + 1);
  40.     printf("CYCLE 0.0 0.0 TRANSITION 0\n");
  41.     printf("POSITION FRAMES 1 1 XYZ 0.0 0.0 -201.000320\n");
  42.     printf("ALIGN FRAMES 1 1 XYZ 0.0 0.0 0.0\n");
  43.     printf("SIZE FRAMES 1 1 XYZ 320.0 200.0 1.0\n\n");
  44.  
  45.     printf("OBJECT \"BALL\"\n");
  46.     printf("ACTOR FRAMES 1 %d NAME \"Bounce.imp/objects/ball\" ", MAX + 1);
  47.     printf("CYCLE 0.0 0.0 TRANSITION 0\n");
  48.     for (t = 1; t < MAX; t++) {
  49.         cnt++;
  50.         if (cnt == INC) {
  51.             toggle = toggle ? 0 : 1;
  52.             cnt = 0;
  53.         }
  54.         if (toggle)
  55.             continue;
  56.         pos = ((float) (t * t)) * RATIO;
  57.         printf("POSITION FRAMES %d %d XYZ 0.0 0.0 -%.6f\n",
  58.             frames, frames, pos);
  59.         frames++;
  60.     }
  61.  
  62.     for (t = MAX; t > 0; t--) {
  63.         cnt++;
  64.         if (cnt == INC) {
  65.             toggle = toggle ? 0 : 1;
  66.             cnt = 0;
  67.         }
  68.         if (toggle)
  69.             continue;
  70.         pos = ((float) (t * t)) * RATIO;
  71.         printf("POSITION FRAMES %d %d XYZ 0.0 0.0 -%.6f\n",
  72.             frames, frames, pos);
  73.         frames++;
  74.     }
  75.     printf("ALIGN FRAMES 1 1 XYZ 0.0 0.0 0.0\n");
  76.     printf("SIZE FRAMES 1 1 XYZ 32.0 32.0 32.0\n\n");
  77.  
  78. }
  79.  
  80.