back to the text
/*----------------------------------------------------
*
* SOUP.c - app variables and draw functions
*
*--------------------------------------------------*/
#include "INCLUDES.h"
static int SOUPNUM, SOUPGO, WLNUM, STNUM;
static int A;
static int eye = 0;
static int E = 24;
static int strobe = 1, line_move = -25, stro_move = -25;
static float B=1;
void soup_of_squares(int, int);
void strobe_spots(int);
void white_lines(int);
void sourwall();
/*--------------------------------------------------*/
/*--------------------------------------------------*/
/*--------------------------------------------------*/
/*--------------------------------------------------*/
/*----------------------------------------------------
*
* DRAW functions
*
*--------------------------------------------------*/
void draw_SOUP()
{
float dummy[1] = {0.0};
float fog[5] = {20.0, 40.0, .2, 0.0, 0.0};
/* controls - {start,thickest,R,G,B }*/
fogvertex(FG_VTX_LIN, fog);
cpack(0xff000030); clear(); zclear();
rotate(-150,'x');
translate(0.0, .75, -2.0);
scale(0.65, 0.65, 0.65);
fogvertex(FG_ON,dummy); /* turns fog function ON */
/*----------------------------*/
soup_of_squares(SOUPNUM, SOUPGO);
pushmatrix();
translate(0.0, 0.0, 0.0);
rotate(900,'z');
soup_of_squares(SOUPNUM, SOUPGO);
rotate(900,'z');
soup_of_squares(SOUPNUM, SOUPGO);
rotate(900,'z');
soup_of_squares(SOUPNUM, SOUPGO);
popmatrix();
/*----------------------------*/
texbind(TX_TEXTURE_0, img_list[A]);
sourwall();
texbind(TX_TEXTURE_0, 0);
fogvertex(FG_OFF,dummy);
/*----------------------------*/
strobe_spots(STNUM);
/*----------------------------*/
white_lines(WLNUM);
/*----------------------------*/
if(eye)
{
strobe = strobe + 1;
if (strobe==5) strobe = 1;
line_move = line_move + 1;
if (line_move==-1) line_move =-25;
stro_move = stro_move + 1;
if (stro_move==2) stro_move =-50;
B = B + .4;
if (B < 1 && B > 0) A = 9;
else if (B < 2 && B > 1) A = 10;
else if (B < 3 && B > 2) A = 11;
else if (B < 4 && B > 3) A = 12;
else if (B < 5 && B > 4) A = 13;
else if (B < 6 && B > 5) A = 14;
else if (B < 7 && B > 6) A = 15;
else if (B < 8 && B > 7) A = 16;
else if (B < 9 && B > 8) A = 17;
else if (B < 10 && B > 9) A = 18;
else if (B < 11 && B > 10) A = 19;
else if (B < 12 && B > 11) A = 20;
else if (B < 13 && B > 12) A = 21;
else if (B < 14 && B > 13) A = 22;
else if (B < 15 && B > 14) A = 23;
else if (B >= 15)
{
A = 9;
B = 0;
}
}
eye=!eye;
SOUPGO = SOUPGO - 1;
if (SOUPGO == -50) SOUPGO = 0;
}
/*--------------------------------------------------*/
void soup_of_squares(int SOUPNUM, int SOUPGO)
{
cpack(0x0000ff);
for (SOUPNUM = -180; SOUPNUM < 180; SOUPNUM+=9)
{
pushmatrix();
translate(0.0, 10.0, SOUPGO);
translate(0.0, 10.0, SOUPNUM);
rotate(900, 'x');
scale(10.0, 3, 0.0);
callobj(GLobjSqrIndex);
popmatrix();
}
}
/*--------------------------------------------------*/
void strobe_spots(int STNUM)
{
for (STNUM = 0; STNUM < 150; STNUM+=1)
{
pushmatrix();
if (strobe==1) cpack(0xffffffff);
else cpack(0x000000);
/*translate(0.0, 0, stro_move);*/
translate(-10.0 + drand48() * 20.0,
-10.0 + drand48() * 20.0,
-10.0 + drand48() * 20.0);
scale(0.1, 0.1, 0.0);
callobj(GLobjSqrIndex);
popmatrix();
}
}
/*--------------------------------------------------*/
void white_lines(int WLNUM)
{
texbind(TX_TEXTURE_0, img_list[E]);
blendfunction(BF_SA, BF_MSA);
cpack(0xa0ffffff);
for (WLNUM = 0; WLNUM < 25; WLNUM+=1)
{
pushmatrix();
translate(0.0, 0, line_move*(drand48() * 20.0));
translate(-10.0 + drand48() * 20.0, 3.0, 0.0);
scale(.5, 10.0, 0.0);
callobj(GLobjSqrIndex);
popmatrix();
}
blendfunction(BF_ONE, BF_ZERO);
texbind(TX_TEXTURE_0, 0);
}
/*--------------------------------------------------*/
void sourwall()
{
cpack(0xffffffff);
callobj(GLobjCylIndex);
/* cutomized in OBJECTS.c */
}
/*--------------------------------------------------*/