示例#1
0
/**
 * Main methode of the FX.
 */
static void fs_apply(VisualFX *_this, Pixel *src, Pixel *dest, PluginInfo *info) {

	int i;
	int col;
	FSData *data = (FSData*)_this->fx_data;

	/* Get the new parameters values */
	data->min_age = 1.0f - (float)IVAL(data->min_age_p)/100.0f;
	data->max_age = 1.0f - (float)IVAL(data->max_age_p)/100.0f;
	FVAL(data->nbStars_p) = (float)data->nbStars / (float)data->maxStars;
	data->nbStars_p.change_listener(&data->nbStars_p);
	data->maxStars = IVAL(data->nbStars_limit_p);
	data->fx_mode = IVAL(data->fx_mode_p);

	/* look for events */
	if (info->sound.timeSinceLastGoom < 1) {
		fs_sound_event_occured(_this, info);
		if (goom_irand(info->gRandom,20)==1) {
			IVAL(data->fx_mode_p) = goom_irand(info->gRandom,(LAST_FX*3));
			data->fx_mode_p.change_listener(&data->fx_mode_p);
		}
	}

	/* update particules */
	for (i=0;i<data->nbStars;++i) {
		updateStar(&data->stars[i]);

		/* dead particule */
		if (data->stars[i].age>=NCOL)
			continue;

		/* choose the color of the particule */
		col = colval[(int)data->stars[i].age];

		/* draws the particule */
		info->methods.draw_line(dest,(int)data->stars[i].x,(int)data->stars[i].y,
				(int)(data->stars[i].x-data->stars[i].vx*6),
				(int)(data->stars[i].y-data->stars[i].vy*6),
				col,
				(int)info->screen.width, (int)info->screen.height);
		info->methods.draw_line(dest,(int)data->stars[i].x,(int)data->stars[i].y,
				(int)(data->stars[i].x-data->stars[i].vx*2),
				(int)(data->stars[i].y-data->stars[i].vy*2),
				col,
				(int)info->screen.width, (int)info->screen.height);
	}

	/* look for dead particules */
	for (i=0;i<data->nbStars;) {

		if ((data->stars[i].x > info->screen.width + 64)
				||((data->stars[i].vy>=0)&&(data->stars[i].y - 16*data->stars[i].vy > info->screen.height))
				||(data->stars[i].x < -64)
				||(data->stars[i].age>=NCOL)) {
			data->stars[i] = data->stars[data->nbStars-1];
			data->nbStars--;
		}
		else ++i;
	}
}
示例#2
0
/**
 * Cree une nouvelle 'bombe', c'est a dire une particule appartenant a une fusee d'artifice.
 */
static void
addABomb (FSData * fs, int mx, int my, float radius, float vage, float gravity,
    PluginInfo * info)
{

  int i = fs->nbStars;
  float ro;
  int theta;

  if (fs->nbStars >= fs->maxStars)
    return;
  fs->nbStars++;

  fs->stars[i].x = mx;
  fs->stars[i].y = my;

  ro = radius * (float) goom_irand (info->gRandom, 100) / 100.0f;
  ro *= (float) goom_irand (info->gRandom, 100) / 100.0f + 1.0f;
  theta = goom_irand (info->gRandom, 256);

  fs->stars[i].vx = ro * cos256[theta];
  fs->stars[i].vy = -0.2f + ro * sin256[theta];

  fs->stars[i].ax = 0;
  fs->stars[i].ay = gravity;

  fs->stars[i].age = 0;
  if (vage < fs->min_age)
    vage = fs->min_age;
  fs->stars[i].vage = vage;
}
示例#3
0
static void pretty_move (PluginInfo *goomInfo, float cycle, float *dist, float *dist2, float *rotangle, TentacleFXData *fx_data) {

	float tmp;

	/* many magic numbers here... I don't really like that. */
	if (fx_data->happens)
		fx_data->happens -= 1;
	else if (fx_data->lock == 0) {
		fx_data->happens = goom_irand(goomInfo->gRandom,200)?0:100+goom_irand(goomInfo->gRandom,60);
		fx_data->lock = fx_data->happens * 3 / 2;
	}
	else fx_data->lock --;

	tmp = fx_data->happens?8.0f:0;
	*dist2 = fx_data->distt2 = (tmp + 15.0f*fx_data->distt2)/16.0f;

	tmp = 30+D-90.0f*(1.0f+sin(cycle*19/20));
	if (fx_data->happens)
		tmp *= 0.6f;

	*dist = fx_data->distt = (tmp + 3.0f*fx_data->distt)/4.0f;

	if (!fx_data->happens){
		tmp = M_PI*sin(cycle)/32+3*M_PI/2;
	}
	else {
		fx_data->rotation = goom_irand(goomInfo->gRandom,500)?fx_data->rotation:goom_irand(goomInfo->gRandom,2);
		if (fx_data->rotation)
			cycle *= 2.0f*M_PI;
		else
			cycle *= -1.0f*M_PI;
		tmp = cycle - (M_PI*2.0) * floor(cycle/(M_PI*2.0));
	}

	if (abs(tmp-fx_data->rot) > abs(tmp-(fx_data->rot+2.0*M_PI))) {
		fx_data->rot = (tmp + 15.0f*(fx_data->rot+2*M_PI)) / 16.0f;
		if (fx_data->rot>2.0*M_PI)
			fx_data->rot -= 2.0*M_PI;
		*rotangle = fx_data->rot;
	}
	else if (abs(tmp-fx_data->rot) > abs(tmp-(fx_data->rot-2.0*M_PI))) {
		fx_data->rot = (tmp + 15.0f*(fx_data->rot-2.0*M_PI)) / 16.0f;
		if (fx_data->rot<0.0f)
			fx_data->rot += 2.0*M_PI;
		*rotangle = fx_data->rot;
	}
	else
		*rotangle = fx_data->rot = (tmp + 15.0f*fx_data->rot) / 16.0f;
}
示例#4
0
/**
 * Ajoute de nouvelles particules au moment d'un evenement sonore.
 */
static void fs_sound_event_occured(VisualFX *_this, PluginInfo *info) {

	FSData *data = (FSData*)_this->fx_data;
	int i;

	int max = (int)((1.0f+info->sound.goomPower)*goom_irand(info->gRandom,150)) + 100;
	float radius = (1.0f+info->sound.goomPower) * (float)(goom_irand(info->gRandom,150)+50)/300;
	int mx;
	int my;
	float vage, gravity = 0.02f;

	switch (data->fx_mode) {
		case FIREWORKS_FX:
      {  
      double dx,dy;
      do {
        mx = goom_irand(info->gRandom,info->screen.width);
	  		my = goom_irand(info->gRandom,info->screen.height);
        dx = (mx - info->screen.width/2);
        dy = (my - info->screen.height/2);
      } while (dx*dx + dy*dy < (info->screen.height/2)*(info->screen.height/2));
			vage = data->max_age * (1.0f - info->sound.goomPower);
      }
			break;
		case RAIN_FX:
      mx = goom_irand(info->gRandom,info->screen.width);
      if (mx > info->screen.width/2)
        mx = info->screen.width;
      else
        mx = 0;
			my = -(info->screen.height/3)-goom_irand(info->gRandom,info->screen.width/3);
			radius *= 1.5;
			vage = 0.002f;
			break;
		case FOUNTAIN_FX:
			my = info->screen.height+2;
			vage = 0.001f;
			radius += 1.0f;
			mx = info->screen.width / 2;
			gravity = 0.04f;
			break;
		default:
			return;
			/* my = i R A N D (info->screen.height); vage = 0.01f; */
	}

	radius *= info->screen.height / 200.0f; /* why 200 ? because the FX was developped on 320x200 */
	max *= info->screen.height / 200.0f;

	if (info->sound.timeSinceLastBigGoom < 1) {
		radius *= 1.5;
		max *= 2;
	}
	for (i=0;i<max;++i)
		addABomb (data,mx,my,radius,vage,gravity,info);
}
示例#5
0
/* *** */
void
choose_a_goom_line (PluginInfo *goomInfo, float *param1, float *param2, int *couleur, int *mode,
                    float *amplitude, int far)
{
    *mode = goom_irand(goomInfo->gRandom,3);
    *amplitude = 1.0f;
    switch (*mode) {
        case GML_CIRCLE:
            if (far) {
                *param1 = *param2 = 0.47f;
                *amplitude = 0.8f;
                break;
            }
            if (goom_irand(goomInfo->gRandom,3) == 0) {
                *param1 = *param2 = 0;
                *amplitude = 3.0f;
            }
            else if (goom_irand(goomInfo->gRandom,2)) {
                *param1 = 0.40f * goomInfo->screen.height;
                *param2 = 0.22f * goomInfo->screen.height;
            }
            else {
                *param1 = *param2 = goomInfo->screen.height * 0.35;
            }
            break;
        case GML_HLINE:
            if (goom_irand(goomInfo->gRandom,4) || far) {
                *param1 = goomInfo->screen.height / 7;
                *param2 = 6.0f * goomInfo->screen.height / 7.0f;
            }
            else {
                *param1 = *param2 = goomInfo->screen.height / 2.0f;
                *amplitude = 2.0f;
            }
            break;
        case GML_VLINE:
            if (goom_irand(goomInfo->gRandom,3) || far) {
                *param1 = goomInfo->screen.width / 7.0f;
                *param2 = 6.0f * goomInfo->screen.width / 7.0f;
            }
            else {
                *param1 = *param2 = goomInfo->screen.width / 2.0f;
                *amplitude = 1.5f;
            }
            break;
    }

    *couleur = goom_irand(goomInfo->gRandom,6);
}
/********************************************
*                  UPDATE                  *
********************************************

* WARNING: this is a 600 lines function ! (21-11-2003)
*/
guint32 *
goom_update (PluginInfo * goomInfo, gint16 data[2][512], int forceMode,
    float fps)
{
  Pixel *return_val;
  guint32 pointWidth;
  guint32 pointHeight;
  int i;
  float largfactor;             /* elargissement de l'intervalle d'�volution des points */
  Pixel *tmp;

  ZoomFilterData *pzfd;

  /* test if the config has changed, update it if so */
  pointWidth = (goomInfo->screen.width * 2) / 5;
  pointHeight = ((goomInfo->screen.height) * 2) / 5;

  /* ! etude du signal ... */
  evaluate_sound (data, &(goomInfo->sound));

  /* goom_execute_main_script(goomInfo); */

  /* ! calcul du deplacement des petits points ... */
  largfactor =
      goomInfo->sound.speedvar / 150.0f + goomInfo->sound.volume / 1.5f;

  if (largfactor > 1.5f)
    largfactor = 1.5f;

  goomInfo->update.decay_ifs--;
  if (goomInfo->update.decay_ifs > 0)
    goomInfo->update.ifs_incr += 2;
  if (goomInfo->update.decay_ifs == 0)
    goomInfo->update.ifs_incr = 0;

  if (goomInfo->update.recay_ifs) {
    goomInfo->update.ifs_incr -= 2;
    goomInfo->update.recay_ifs--;
    if ((goomInfo->update.recay_ifs == 0) && (goomInfo->update.ifs_incr <= 0))
      goomInfo->update.ifs_incr = 1;
  }

  if (goomInfo->update.ifs_incr > 0)
    goomInfo->ifs_fx.apply (&goomInfo->ifs_fx, goomInfo->p2, goomInfo->p1,
        goomInfo);

  if (goomInfo->curGState->drawPoints) {
    for (i = 1; i * 15 <= goomInfo->sound.speedvar * 80.0f + 15; i++) {
      goomInfo->update.loopvar += goomInfo->sound.speedvar * 50 + 1;

      pointFilter (goomInfo, goomInfo->p1,
          YELLOW,
          ((pointWidth - 6.0f) * largfactor + 5.0f),
          ((pointHeight - 6.0f) * largfactor + 5.0f),
          i * 152.0f, 128.0f, goomInfo->update.loopvar + i * 2032);
      pointFilter (goomInfo, goomInfo->p1, ORANGE,
          ((pointWidth / 2) * largfactor) / i + 10.0f * i,
          ((pointHeight / 2) * largfactor) / i + 10.0f * i,
          96.0f, i * 80.0f, goomInfo->update.loopvar / i);
      pointFilter (goomInfo, goomInfo->p1, VIOLET,
          ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
          ((pointHeight / 3 + 5.0f) * largfactor) / i + 10.0f * i,
          i + 122.0f, 134.0f, goomInfo->update.loopvar / i);
      pointFilter (goomInfo, goomInfo->p1, BLACK,
          ((pointHeight / 3) * largfactor + 20.0f),
          ((pointHeight / 3) * largfactor + 20.0f),
          58.0f, i * 66.0f, goomInfo->update.loopvar / i);
      pointFilter (goomInfo, goomInfo->p1, WHITE,
          (pointHeight * largfactor + 10.0f * i) / i,
          (pointHeight * largfactor + 10.0f * i) / i,
          66.0f, 74.0f, goomInfo->update.loopvar + i * 500);
    }
  }

  /* par d�faut pas de changement de zoom */
  pzfd = NULL;

  /* 
   * Test forceMode
   */
#ifdef VERBOSE
  if (forceMode != 0) {
    printf ("forcemode = %d\n", forceMode);
  }
#endif


  /* diminuer de 1 le temps de lockage */
  /* note pour ceux qui n'ont pas suivis : le lockvar permet d'empecher un */
  /* changement d'etat du plugin juste apres un autre changement d'etat. oki */
  if (--goomInfo->update.lockvar < 0)
    goomInfo->update.lockvar = 0;

  /* on verifie qu'il ne se pas un truc interressant avec le son. */
  if ((goomInfo->sound.timeSinceLastGoom == 0)
      || (forceMode > 0)
      || (goomInfo->update.cyclesSinceLastChange > TIME_BTW_CHG)) {

    /* changement eventuel de mode */
    if (goom_irand (goomInfo->gRandom, 16) == 0)
      switch (goom_irand (goomInfo->gRandom, 34)) {
        case 0:
        case 10:
          goomInfo->update.zoomFilterData.hypercosEffect =
              goom_irand (goomInfo->gRandom, 2);
        case 13:
        case 20:
        case 21:
          goomInfo->update.zoomFilterData.mode = WAVE_MODE;
          goomInfo->update.zoomFilterData.reverse = 0;
          goomInfo->update.zoomFilterData.waveEffect =
              (goom_irand (goomInfo->gRandom, 3) == 0);
          if (goom_irand (goomInfo->gRandom, 2))
            goomInfo->update.zoomFilterData.vitesse =
                (goomInfo->update.zoomFilterData.vitesse + 127) >> 1;
          break;
        case 1:
        case 11:
          goomInfo->update.zoomFilterData.mode = CRYSTAL_BALL_MODE;
          goomInfo->update.zoomFilterData.waveEffect = 0;
          goomInfo->update.zoomFilterData.hypercosEffect = 0;
          break;
        case 2:
        case 12:
          goomInfo->update.zoomFilterData.mode = AMULETTE_MODE;
          goomInfo->update.zoomFilterData.waveEffect = 0;
          goomInfo->update.zoomFilterData.hypercosEffect = 0;
          break;
        case 3:
          goomInfo->update.zoomFilterData.mode = WATER_MODE;
          goomInfo->update.zoomFilterData.waveEffect = 0;
          goomInfo->update.zoomFilterData.hypercosEffect = 0;
          break;
        case 4:
        case 14:
          goomInfo->update.zoomFilterData.mode = SCRUNCH_MODE;
          goomInfo->update.zoomFilterData.waveEffect = 0;
          goomInfo->update.zoomFilterData.hypercosEffect = 0;
          break;
        case 5:
        case 15:
        case 22:
          goomInfo->update.zoomFilterData.mode = HYPERCOS1_MODE;
          goomInfo->update.zoomFilterData.waveEffect = 0;
          goomInfo->update.zoomFilterData.hypercosEffect =
              (goom_irand (goomInfo->gRandom, 3) == 0);
          break;
        case 6:
        case 16:
          goomInfo->update.zoomFilterData.mode = HYPERCOS2_MODE;
          goomInfo->update.zoomFilterData.waveEffect = 0;
          goomInfo->update.zoomFilterData.hypercosEffect = 0;
          break;
        case 7:
        case 17:
          goomInfo->update.zoomFilterData.mode = CRYSTAL_BALL_MODE;
          goomInfo->update.zoomFilterData.waveEffect =
              (goom_irand (goomInfo->gRandom, 4) == 0);
          goomInfo->update.zoomFilterData.hypercosEffect =
              goom_irand (goomInfo->gRandom, 2);
          break;
        case 8:
        case 18:
        case 19:
          goomInfo->update.zoomFilterData.mode = SCRUNCH_MODE;
          goomInfo->update.zoomFilterData.waveEffect = 1;
          goomInfo->update.zoomFilterData.hypercosEffect = 1;
          break;
        case 29:
        case 30:
          goomInfo->update.zoomFilterData.mode = YONLY_MODE;
          break;
        case 31:
        case 32:
        case 33:
          goomInfo->update.zoomFilterData.mode = SPEEDWAY_MODE;
          break;
        default:
          goomInfo->update.zoomFilterData.mode = NORMAL_MODE;
          goomInfo->update.zoomFilterData.waveEffect = 0;
          goomInfo->update.zoomFilterData.hypercosEffect = 0;
      }
  }

  /* tout ceci ne sera fait qu'en cas de non-blocage */
  if (goomInfo->update.lockvar == 0) {
    /* reperage de goom (acceleration forte de l'acceleration du volume) */
    /* -> coup de boost de la vitesse si besoin.. */
    if (goomInfo->sound.timeSinceLastGoom == 0) {

      int i;

      goomInfo->update.goomvar++;

      /* SELECTION OF THE GOOM STATE */
      if ((!goomInfo->update.stateSelectionBlocker)
          && (goom_irand (goomInfo->gRandom, 3))) {
        goomInfo->update.stateSelectionRnd =
            goom_irand (goomInfo->gRandom, goomInfo->statesRangeMax);
        goomInfo->update.stateSelectionBlocker = 3;
      } else if (goomInfo->update.stateSelectionBlocker)
        goomInfo->update.stateSelectionBlocker--;

      for (i = 0; i < goomInfo->statesNumber; i++)
        if ((goomInfo->update.stateSelectionRnd >= goomInfo->states[i].rangemin)
            && (goomInfo->update.stateSelectionRnd <=
                goomInfo->states[i].rangemax))
          goomInfo->curGState = &(goomInfo->states[i]);

      if ((goomInfo->curGState->drawIFS) && (goomInfo->update.ifs_incr <= 0)) {
        goomInfo->update.recay_ifs = 5;
        goomInfo->update.ifs_incr = 11;
      }

      if ((!goomInfo->curGState->drawIFS) && (goomInfo->update.ifs_incr > 0)
          && (goomInfo->update.decay_ifs <= 0))
        goomInfo->update.decay_ifs = 100;

      if (!goomInfo->curGState->drawScope)
        goomInfo->update.stop_lines = 0xf000 & 5;

      if (!goomInfo->curGState->drawScope) {
        goomInfo->update.stop_lines = 0;
        goomInfo->update.lineMode = goomInfo->update.drawLinesDuration;
      }

      /* if (goomInfo->update.goomvar % 1 == 0) */
      {
        guint32 vtmp;
        guint32 newvit;

        goomInfo->update.lockvar = 50;
        newvit =
            STOP_SPEED + 1 -
            ((float) 3.5f * log10 (goomInfo->sound.speedvar * 60 + 1));
        /* retablir le zoom avant.. */
        if ((goomInfo->update.zoomFilterData.reverse)
            && (!(goomInfo->cycle % 13)) && (rand () % 5 == 0)) {
          goomInfo->update.zoomFilterData.reverse = 0;
          goomInfo->update.zoomFilterData.vitesse = STOP_SPEED - 2;
          goomInfo->update.lockvar = 75;
        }
        if (goom_irand (goomInfo->gRandom, 10) == 0) {
          goomInfo->update.zoomFilterData.reverse = 1;
          goomInfo->update.lockvar = 100;
        }

        if (goom_irand (goomInfo->gRandom, 10) == 0)
          goomInfo->update.zoomFilterData.vitesse = STOP_SPEED - 1;
        if (goom_irand (goomInfo->gRandom, 12) == 0)
          goomInfo->update.zoomFilterData.vitesse = STOP_SPEED + 1;

        /* changement de milieu.. */
        switch (goom_irand (goomInfo->gRandom, 25)) {
          case 0:
          case 3:
          case 6:
            goomInfo->update.zoomFilterData.middleY =
                goomInfo->screen.height - 1;
            goomInfo->update.zoomFilterData.middleX =
                goomInfo->screen.width / 2;
            break;
          case 1:
          case 4:
            goomInfo->update.zoomFilterData.middleX =
                goomInfo->screen.width - 1;
            break;
          case 2:
          case 5:
            goomInfo->update.zoomFilterData.middleX = 1;
            break;
          default:
            goomInfo->update.zoomFilterData.middleY =
                goomInfo->screen.height / 2;
            goomInfo->update.zoomFilterData.middleX =
                goomInfo->screen.width / 2;
        }

        if ((goomInfo->update.zoomFilterData.mode == WATER_MODE)
            || (goomInfo->update.zoomFilterData.mode == YONLY_MODE)
            || (goomInfo->update.zoomFilterData.mode == AMULETTE_MODE)) {
          goomInfo->update.zoomFilterData.middleX = goomInfo->screen.width / 2;
          goomInfo->update.zoomFilterData.middleY = goomInfo->screen.height / 2;
        }

        switch (vtmp = (goom_irand (goomInfo->gRandom, 15))) {
          case 0:
            goomInfo->update.zoomFilterData.vPlaneEffect =
                goom_irand (goomInfo->gRandom, 3)
                - goom_irand (goomInfo->gRandom, 3);
            goomInfo->update.zoomFilterData.hPlaneEffect =
                goom_irand (goomInfo->gRandom, 3)
                - goom_irand (goomInfo->gRandom, 3);
            break;
          case 3:
            goomInfo->update.zoomFilterData.vPlaneEffect = 0;
            goomInfo->update.zoomFilterData.hPlaneEffect =
                goom_irand (goomInfo->gRandom, 8)
                - goom_irand (goomInfo->gRandom, 8);
            break;
          case 4:
          case 5:
          case 6:
          case 7:
            goomInfo->update.zoomFilterData.vPlaneEffect =
                goom_irand (goomInfo->gRandom, 5)
                - goom_irand (goomInfo->gRandom, 5);
            goomInfo->update.zoomFilterData.hPlaneEffect =
                -goomInfo->update.zoomFilterData.vPlaneEffect;
            break;
          case 8:
            goomInfo->update.zoomFilterData.hPlaneEffect =
                5 + goom_irand (goomInfo->gRandom, 8);
            goomInfo->update.zoomFilterData.vPlaneEffect =
                -goomInfo->update.zoomFilterData.hPlaneEffect;
            break;
          case 9:
            goomInfo->update.zoomFilterData.vPlaneEffect =
                5 + goom_irand (goomInfo->gRandom, 8);
            goomInfo->update.zoomFilterData.hPlaneEffect =
                -goomInfo->update.zoomFilterData.hPlaneEffect;
            break;
          case 13:
            goomInfo->update.zoomFilterData.hPlaneEffect = 0;
            goomInfo->update.zoomFilterData.vPlaneEffect =
                goom_irand (goomInfo->gRandom, 10)
                - goom_irand (goomInfo->gRandom, 10);
            break;
          case 14:
            goomInfo->update.zoomFilterData.hPlaneEffect =
                goom_irand (goomInfo->gRandom, 10)
                - goom_irand (goomInfo->gRandom, 10);
            goomInfo->update.zoomFilterData.vPlaneEffect =
                goom_irand (goomInfo->gRandom, 10)
                - goom_irand (goomInfo->gRandom, 10);
            break;
          default:
            if (vtmp < 10) {
              goomInfo->update.zoomFilterData.vPlaneEffect = 0;
              goomInfo->update.zoomFilterData.hPlaneEffect = 0;
            }
        }

        if (goom_irand (goomInfo->gRandom, 5) != 0)
          goomInfo->update.zoomFilterData.noisify = 0;
        else {
          goomInfo->update.zoomFilterData.noisify =
              goom_irand (goomInfo->gRandom, 2) + 1;
          goomInfo->update.lockvar *= 2;
        }

        if (goomInfo->update.zoomFilterData.mode == AMULETTE_MODE) {
          goomInfo->update.zoomFilterData.vPlaneEffect = 0;
          goomInfo->update.zoomFilterData.hPlaneEffect = 0;
          goomInfo->update.zoomFilterData.noisify = 0;
        }

        if ((goomInfo->update.zoomFilterData.middleX == 1)
            || (goomInfo->update.zoomFilterData.middleX ==
                (signed int) goomInfo->screen.width - 1)) {
          goomInfo->update.zoomFilterData.vPlaneEffect = 0;
          if (goom_irand (goomInfo->gRandom, 2))
            goomInfo->update.zoomFilterData.hPlaneEffect = 0;
        }

        if ((signed int) newvit < goomInfo->update.zoomFilterData.vitesse) {    /* on accelere */
          pzfd = &goomInfo->update.zoomFilterData;
          if (((newvit < STOP_SPEED - 7) &&
                  (goomInfo->update.zoomFilterData.vitesse < STOP_SPEED - 6) &&
                  (goomInfo->cycle % 3 == 0))
              || (goom_irand (goomInfo->gRandom, 40) == 0)) {
            goomInfo->update.zoomFilterData.vitesse =
                STOP_SPEED - goom_irand (goomInfo->gRandom, 2)
                + goom_irand (goomInfo->gRandom, 2);
            goomInfo->update.zoomFilterData.reverse =
                !goomInfo->update.zoomFilterData.reverse;
          } else {
            goomInfo->update.zoomFilterData.vitesse =
                (newvit + goomInfo->update.zoomFilterData.vitesse * 7) / 8;
          }
          goomInfo->update.lockvar += 50;
        }
      }

      if (goomInfo->update.lockvar > 150) {
        goomInfo->update.switchIncr = goomInfo->update.switchIncrAmount;
        goomInfo->update.switchMult = 1.0f;
      }
    }
    /* mode mega-lent */
    if (goom_irand (goomInfo->gRandom, 700) == 0) {
      /* 
       * printf ("coup du sort...\n") ;
       */
      pzfd = &goomInfo->update.zoomFilterData;
      goomInfo->update.zoomFilterData.vitesse = STOP_SPEED - 1;
      goomInfo->update.zoomFilterData.pertedec = 8;
      goomInfo->update.zoomFilterData.sqrtperte = 16;
      goomInfo->update.goomvar = 1;
      goomInfo->update.lockvar += 50;
      goomInfo->update.switchIncr = goomInfo->update.switchIncrAmount;
      goomInfo->update.switchMult = 1.0f;
    }
  }

  /*
   * gros frein si la musique est calme
   */
  if ((goomInfo->sound.speedvar < 0.01f)
      && (goomInfo->update.zoomFilterData.vitesse < STOP_SPEED - 4)
      && (goomInfo->cycle % 16 == 0)) {
    pzfd = &goomInfo->update.zoomFilterData;
    goomInfo->update.zoomFilterData.vitesse += 3;
    goomInfo->update.zoomFilterData.pertedec = 8;
    goomInfo->update.zoomFilterData.sqrtperte = 16;
    goomInfo->update.goomvar = 0;
  }

  /*
   * baisser regulierement la vitesse...
   */
  if ((goomInfo->cycle % 73 == 0)
      && (goomInfo->update.zoomFilterData.vitesse < STOP_SPEED - 5)) {
    pzfd = &goomInfo->update.zoomFilterData;
    goomInfo->update.zoomFilterData.vitesse++;
  }

  /*
   * arreter de decr�menter au bout d'un certain temps
   */
  if ((goomInfo->cycle % 101 == 0)
      && (goomInfo->update.zoomFilterData.pertedec == 7)) {
    pzfd = &goomInfo->update.zoomFilterData;
    goomInfo->update.zoomFilterData.pertedec = 8;
    goomInfo->update.zoomFilterData.sqrtperte = 16;
  }

  /*
   * Permet de forcer un effet.
   */
  if ((forceMode > 0) && (forceMode <= NB_FX)) {
    pzfd = &goomInfo->update.zoomFilterData;
    pzfd->mode = forceMode - 1;
  }

  if (forceMode == -1) {
    pzfd = NULL;
  }

  /*
   * Changement d'effet de zoom !
   */
  if (pzfd != NULL) {
    int dif;

    goomInfo->update.cyclesSinceLastChange = 0;

    goomInfo->update.switchIncr = goomInfo->update.switchIncrAmount;

    dif =
        goomInfo->update.zoomFilterData.vitesse -
        goomInfo->update.previousZoomSpeed;
    if (dif < 0)
      dif = -dif;

    if (dif > 2) {
      goomInfo->update.switchIncr *= (dif + 2) / 2;
    }
    goomInfo->update.previousZoomSpeed =
        goomInfo->update.zoomFilterData.vitesse;
    goomInfo->update.switchMult = 1.0f;

    if (((goomInfo->sound.timeSinceLastGoom == 0)
            && (goomInfo->sound.totalgoom < 2)) || (forceMode > 0)) {
      goomInfo->update.switchIncr = 0;
      goomInfo->update.switchMult = goomInfo->update.switchMultAmount;
    }
  } else {
    if (goomInfo->update.cyclesSinceLastChange > TIME_BTW_CHG) {
      pzfd = &goomInfo->update.zoomFilterData;
      goomInfo->update.cyclesSinceLastChange = 0;
    } else
      goomInfo->update.cyclesSinceLastChange++;
  }

#ifdef VERBOSE
  if (pzfd) {
    printf ("GOOM: pzfd->mode = %d\n", pzfd->mode);
  }
#endif

  /* Zoom here ! */
  zoomFilterFastRGB (goomInfo, goomInfo->p1, goomInfo->p2, pzfd,
      goomInfo->screen.width, goomInfo->screen.height,
      goomInfo->update.switchIncr, goomInfo->update.switchMult);

  /*
   * Affichage tentacule
   */

  goomInfo->tentacles_fx.apply (&goomInfo->tentacles_fx, goomInfo->p1,
      goomInfo->p2, goomInfo);
  goomInfo->star_fx.apply (&goomInfo->star_fx, goomInfo->p2, goomInfo->p1,
      goomInfo);

  /*
   * Gestion du Scope
   */

  /*
   * arret demande
   */
  if ((goomInfo->update.stop_lines & 0xf000)
      || (!goomInfo->curGState->drawScope)) {
    float param1 = 0, param2 = 0, amplitude;
    int couleur;
    int mode;

    choose_a_goom_line (goomInfo, &param1, &param2, &couleur, &mode, &amplitude,
        1);
    couleur = GML_BLACK;

    goom_lines_switch_to (goomInfo->gmline1, mode, param1, amplitude, couleur);
    goom_lines_switch_to (goomInfo->gmline2, mode, param2, amplitude, couleur);
    goomInfo->update.stop_lines &= 0x0fff;
  }

  /*
   * arret aleatore.. changement de mode de ligne..
   */
  if (goomInfo->update.lineMode != goomInfo->update.drawLinesDuration) {
    goomInfo->update.lineMode--;
    if (goomInfo->update.lineMode == -1)
      goomInfo->update.lineMode = 0;
  } else if ((goomInfo->cycle % 80 == 0)
      && (goom_irand (goomInfo->gRandom, 5) == 0) && goomInfo->update.lineMode)
    goomInfo->update.lineMode--;

  if ((goomInfo->cycle % 120 == 0)
      && (goom_irand (goomInfo->gRandom, 4) == 0)
      && (goomInfo->curGState->drawScope)) {
    if (goomInfo->update.lineMode == 0)
      goomInfo->update.lineMode = goomInfo->update.drawLinesDuration;
    else if (goomInfo->update.lineMode == goomInfo->update.drawLinesDuration) {
      float param1, param2, amplitude;
      int couleur1, couleur2;
      int mode;

      goomInfo->update.lineMode--;
      choose_a_goom_line (goomInfo, &param1, &param2, &couleur1,
          &mode, &amplitude, goomInfo->update.stop_lines);

      couleur2 = 5 - couleur1;
      if (goomInfo->update.stop_lines) {
        goomInfo->update.stop_lines--;
        if (goom_irand (goomInfo->gRandom, 2))
          couleur2 = couleur1 = GML_BLACK;
      }

      goom_lines_switch_to (goomInfo->gmline1, mode, param1, amplitude,
          couleur1);
      goom_lines_switch_to (goomInfo->gmline2, mode, param2, amplitude,
          couleur2);
    }
  }

  /*
   * si on est dans un goom : afficher les lignes...
   */
  if ((goomInfo->update.lineMode != 0)
      || (goomInfo->sound.timeSinceLastGoom < 5)) {
    goomInfo->gmline2->power = goomInfo->gmline1->power;

    goom_lines_draw (goomInfo, goomInfo->gmline1, data[0], goomInfo->p2);
    goom_lines_draw (goomInfo, goomInfo->gmline2, data[1], goomInfo->p2);

    if (((goomInfo->cycle % 121) == 9)
        && (goom_irand (goomInfo->gRandom, 3) == 1)
        && ((goomInfo->update.lineMode == 0)
            || (goomInfo->update.lineMode ==
                goomInfo->update.drawLinesDuration))) {
      float param1, param2, amplitude;
      int couleur1, couleur2;
      int mode;

      choose_a_goom_line (goomInfo, &param1, &param2, &couleur1,
          &mode, &amplitude, goomInfo->update.stop_lines);
      couleur2 = 5 - couleur1;

      if (goomInfo->update.stop_lines) {
        goomInfo->update.stop_lines--;
        if (goom_irand (goomInfo->gRandom, 2))
          couleur2 = couleur1 = GML_BLACK;
      }
      goom_lines_switch_to (goomInfo->gmline1, mode, param1, amplitude,
          couleur1);
      goom_lines_switch_to (goomInfo->gmline2, mode, param2, amplitude,
          couleur2);
    }
  }

  return_val = goomInfo->p1;
  tmp = goomInfo->p1;
  goomInfo->p1 = goomInfo->p2;
  goomInfo->p2 = tmp;

  /* affichage et swappage des buffers.. */
  goomInfo->cycle++;

  goomInfo->convolve_fx.apply (&goomInfo->convolve_fx, return_val,
      goomInfo->outputBuf, goomInfo);

  return (guint32 *) goomInfo->outputBuf;
}
示例#7
0
static void tentacle_update(PluginInfo *goomInfo, Pixel *buf, Pixel *back, int W, int H,
                     short data[2][512], float rapport, int drawit, TentacleFXData *fx_data) {
	
	int tmp;
	int tmp2;

	int color;
	int colorlow;

	float dist,dist2,rotangle;

	if ((!drawit) && (fx_data->ligs>0.0f))
		fx_data->ligs = -fx_data->ligs;

	fx_data->lig += fx_data->ligs;

	if (fx_data->lig > 1.01f) {
		if ((fx_data->lig>10.0f) | (fx_data->lig<1.1f)) fx_data->ligs = -fx_data->ligs;

		if ((fx_data->lig<6.3f)&&(goom_irand(goomInfo->gRandom,30)==0))
			fx_data->dstcol=goom_irand(goomInfo->gRandom,NB_TENTACLE_COLORS);

		fx_data->col = evolutecolor(fx_data->col,fx_data->colors[fx_data->dstcol],0xff,0x01);
		fx_data->col = evolutecolor(fx_data->col,fx_data->colors[fx_data->dstcol],0xff00,0x0100);
		fx_data->col = evolutecolor(fx_data->col,fx_data->colors[fx_data->dstcol],0xff0000,0x010000);
		fx_data->col = evolutecolor(fx_data->col,fx_data->colors[fx_data->dstcol],0xff000000,0x01000000);

		color = fx_data->col;
		colorlow = fx_data->col;

		lightencolor(&color,fx_data->lig * 2.0f + 2.0f);
		lightencolor(&colorlow,(fx_data->lig/3.0f)+0.67f);

		rapport = 1.0f + 2.0f * (rapport - 1.0f);
		rapport *= 1.2f;
		if (rapport > 1.12f)
			rapport = 1.12f;

		pretty_move (goomInfo, fx_data->cycle, &dist, &dist2, &rotangle, fx_data);

		for (tmp=0;tmp<nbgrid;tmp++) {
			for (tmp2=0;tmp2<definitionx;tmp2++) {
				float val = (float)(ShiftRight(data[0][goom_irand(goomInfo->gRandom,511)],10)) * rapport;
				fx_data->vals[tmp2] = val;
			}

			grid3d_update (fx_data->grille[tmp], rotangle, fx_data->vals, dist2);
		}
		fx_data->cycle+=0.01f;
		for (tmp=0;tmp<nbgrid;tmp++)
			grid3d_draw (goomInfo, fx_data->grille[tmp],color,colorlow,dist,buf,back,W,H);
	}
	else {
		fx_data->lig = 1.05f;
		if (fx_data->ligs < 0.0f)
			fx_data->ligs = -fx_data->ligs;
		pretty_move (goomInfo, fx_data->cycle, &dist, &dist2, &rotangle, fx_data);
		fx_data->cycle+=0.1f;
		if (fx_data->cycle > 1000)
			fx_data->cycle = 0;
	}
}