/*
   frames.c - Copyright but freely distributable as part of the ISL 1.0
   package (c) 1992 by John T. Grieggs.  This is a small example of how
   to generate an ISL stage using a c program - look at it and learn,
   but don't bother generating the frames because they are boring!  :-)
*/

#define INC 16
#define MAX ((INC*INC*2)-1)
#define RATIO (169.0 / (MAX * MAX))

main()
{
	int frames = 1, t, cnt = -1, toggle = 0;
	float pos;

	printf("STAGE\nMAXFRAMES %d\n\n", MAX + 1);

	printf("CAMERA \"CAMERA\"\n");
	printf("POSITION FRAMES 1 1 XYZ 0.0 -600.0 -100.0\n");
	printf("ALIGN FRAMES 1 1 XYZ 0.0 0.0 0.0\n");
	printf("SIZE FRAMES 1 1 XYZ 320.0 640.0 233.333333\n\n");

	printf("GLOBALS \"GLOBALS\"\n");
	printf("ACTOR FRAMES 1 1 BRUSH \"\" 0 BACKDROP \"\" 0 ");
	printf("AMBIENT RGB 0.0 0.0 0.0 HORIZON RGB 0.0 255.0 255.0 ");
	printf("+ZENITH RGB 255.0 0.0 255.0 -ZENITH RGB 255.0 0.0 255.0 ");
	printf("FOG BTL 0.0 0.0 0.0 FOG RGB 0.0 0.0 0.0 ");
	printf("STARFIELD 0.0 TRANSITION 0 SKYBLEND 255\n\n");

	printf("LIGHT \"LIGHTSOURCE\"\n");
	printf("ACTOR FRAMES 1 %d SPHERICAL SHADOW ", MAX + 1);
	printf("RGB 512.0 512.0 512.0 TRANSITION 0\n");
	printf("POSITION FRAMES 1 1 XYZ 102.0 -158.000473 102.666656\n");
	printf("ALIGN FRAMES 1 1 XYZ 0.0 0.0 0.0\n");
	printf("SIZE FRAMES 1 1 XYZ 32.0 32.0 32.0\n\n");

	printf("OBJECT \"GROUND\"\n");
	printf("ACTOR FRAMES 1 %d NAME \"Bounce.imp/objects/ground\" ", MAX + 1);
	printf("CYCLE 0.0 0.0 TRANSITION 0\n");
	printf("POSITION FRAMES 1 1 XYZ 0.0 0.0 -201.000320\n");
	printf("ALIGN FRAMES 1 1 XYZ 0.0 0.0 0.0\n");
	printf("SIZE FRAMES 1 1 XYZ 320.0 200.0 1.0\n\n");

	printf("OBJECT \"BALL\"\n");
	printf("ACTOR FRAMES 1 %d NAME \"Bounce.imp/objects/ball\" ", MAX + 1);
	printf("CYCLE 0.0 0.0 TRANSITION 0\n");
	for (t = 1; t < MAX; t++) {
		cnt++;
		if (cnt == INC) {
			toggle = toggle ? 0 : 1;
			cnt = 0;
		}
		if (toggle)
			continue;
		pos = ((float) (t * t)) * RATIO;
		printf("POSITION FRAMES %d %d XYZ 0.0 0.0 -%.6f\n",
			frames, frames, pos);
		frames++;
	}

	for (t = MAX; t > 0; t--) {
		cnt++;
		if (cnt == INC) {
			toggle = toggle ? 0 : 1;
			cnt = 0;
		}
		if (toggle)
			continue;
		pos = ((float) (t * t)) * RATIO;
		printf("POSITION FRAMES %d %d XYZ 0.0 0.0 -%.6f\n",
			frames, frames, pos);
		frames++;
	}
	printf("ALIGN FRAMES 1 1 XYZ 0.0 0.0 0.0\n");
	printf("SIZE FRAMES 1 1 XYZ 32.0 32.0 32.0\n\n");

}

