2008-02-23 01:51:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* file: goom_core.c
|
|
|
|
|
* author: Jean-Christophe Hoelt (which is not so proud of it)
|
|
|
|
|
*
|
|
|
|
|
* Contains the core of goom's work.
|
|
|
|
|
*
|
|
|
|
|
* (c)2000-2003, by iOS-software.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include <stdio.h>
|
2002-02-01 19:28:30 +00:00
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
2008-02-23 01:51:37 +00:00
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
|
|
|
|
|
#include "goom.h"
|
2002-02-01 19:28:30 +00:00
|
|
|
|
#include "goom_tools.h"
|
2008-02-23 01:51:37 +00:00
|
|
|
|
#include "goom_filters.h"
|
2002-02-01 19:28:30 +00:00
|
|
|
|
#include "lines.h"
|
2008-02-23 01:51:37 +00:00
|
|
|
|
#include "ifs.h"
|
|
|
|
|
#include "tentacle3d.h"
|
|
|
|
|
#include "gfontlib.h"
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
#include "sound_tester.h"
|
|
|
|
|
#include "goom_plugin_info.h"
|
|
|
|
|
#include "goom_fx.h"
|
|
|
|
|
#include "goomsl.h"
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
/* #define VERBOSE */
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
|
|
|
|
#define STOP_SPEED 128
|
2008-02-23 01:51:37 +00:00
|
|
|
|
/* TODO: put that as variable in PluginInfo */
|
|
|
|
|
#define TIME_BTW_CHG 300
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
static void choose_a_goom_line (PluginInfo * goomInfo, float *param1,
|
|
|
|
|
float *param2, int *couleur, int *mode, float *amplitude, int far);
|
|
|
|
|
|
|
|
|
|
static void update_message (PluginInfo * goomInfo, char *message);
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
init_buffers (PluginInfo * goomInfo, int buffsize)
|
2002-02-01 19:28:30 +00:00
|
|
|
|
{
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goomInfo->pixel = (guint32 *) malloc (buffsize * sizeof (guint32) + 128);
|
|
|
|
|
bzero (goomInfo->pixel, buffsize * sizeof (guint32) + 128);
|
|
|
|
|
goomInfo->back = (guint32 *) malloc (buffsize * sizeof (guint32) + 128);
|
|
|
|
|
bzero (goomInfo->back, buffsize * sizeof (guint32) + 128);
|
|
|
|
|
goomInfo->conv = (Pixel *) malloc (buffsize * sizeof (guint32) + 128);
|
|
|
|
|
bzero (goomInfo->conv, buffsize * sizeof (guint32) + 128);
|
|
|
|
|
|
|
|
|
|
goomInfo->outputBuf = goomInfo->conv;
|
|
|
|
|
|
|
|
|
|
goomInfo->p1 = (Pixel *) ((1 + ((uintptr_t) (goomInfo->pixel)) / 128) * 128);
|
|
|
|
|
goomInfo->p2 = (Pixel *) ((1 + ((uintptr_t) (goomInfo->back)) / 128) * 128);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**************************
|
|
|
|
|
* INIT *
|
|
|
|
|
**************************/
|
|
|
|
|
PluginInfo *
|
|
|
|
|
goom_init (guint32 resx, guint32 resy)
|
|
|
|
|
{
|
|
|
|
|
PluginInfo *goomInfo = (PluginInfo *) malloc (sizeof (PluginInfo));
|
|
|
|
|
|
2002-02-01 19:28:30 +00:00
|
|
|
|
#ifdef VERBOSE
|
2004-03-14 22:34:33 +00:00
|
|
|
|
printf ("GOOM: init (%d, %d);\n", resx, resy);
|
2002-02-01 19:28:30 +00:00
|
|
|
|
#endif
|
2008-02-23 01:51:37 +00:00
|
|
|
|
|
|
|
|
|
plugin_info_init (goomInfo, 4);
|
|
|
|
|
|
|
|
|
|
goomInfo->star_fx = flying_star_create ();
|
|
|
|
|
goomInfo->star_fx.init (&goomInfo->star_fx, goomInfo);
|
|
|
|
|
|
|
|
|
|
goomInfo->zoomFilter_fx = zoomFilterVisualFXWrapper_create ();
|
|
|
|
|
goomInfo->zoomFilter_fx.init (&goomInfo->zoomFilter_fx, goomInfo);
|
|
|
|
|
|
|
|
|
|
goomInfo->tentacles_fx = tentacle_fx_create ();
|
|
|
|
|
goomInfo->tentacles_fx.init (&goomInfo->tentacles_fx, goomInfo);
|
|
|
|
|
|
|
|
|
|
goomInfo->convolve_fx = convolve_create ();
|
|
|
|
|
goomInfo->convolve_fx.init (&goomInfo->convolve_fx, goomInfo);
|
|
|
|
|
|
|
|
|
|
plugin_info_add_visual (goomInfo, 0, &goomInfo->zoomFilter_fx);
|
|
|
|
|
plugin_info_add_visual (goomInfo, 1, &goomInfo->tentacles_fx);
|
|
|
|
|
plugin_info_add_visual (goomInfo, 2, &goomInfo->star_fx);
|
|
|
|
|
plugin_info_add_visual (goomInfo, 3, &goomInfo->convolve_fx);
|
|
|
|
|
|
|
|
|
|
goomInfo->screen.width = resx;
|
|
|
|
|
goomInfo->screen.height = resy;
|
|
|
|
|
goomInfo->screen.size = resx * resy;
|
|
|
|
|
|
|
|
|
|
init_buffers (goomInfo, goomInfo->screen.size);
|
|
|
|
|
goomInfo->gRandom = goom_random_init ((uintptr_t) goomInfo->pixel);
|
|
|
|
|
|
|
|
|
|
goomInfo->cycle = 0;
|
|
|
|
|
|
|
|
|
|
goomInfo->ifs_fx = ifs_visualfx_create ();
|
|
|
|
|
goomInfo->ifs_fx.init (&goomInfo->ifs_fx, goomInfo);
|
|
|
|
|
|
|
|
|
|
goomInfo->gmline1 = goom_lines_init (goomInfo, resx, goomInfo->screen.height,
|
|
|
|
|
GML_HLINE, goomInfo->screen.height, GML_BLACK,
|
|
|
|
|
GML_CIRCLE, 0.4f * (float) goomInfo->screen.height, GML_VERT);
|
|
|
|
|
goomInfo->gmline2 = goom_lines_init (goomInfo, resx, goomInfo->screen.height,
|
|
|
|
|
GML_HLINE, 0, GML_BLACK,
|
|
|
|
|
GML_CIRCLE, 0.2f * (float) goomInfo->screen.height, GML_RED);
|
|
|
|
|
|
|
|
|
|
gfont_load ();
|
|
|
|
|
|
|
|
|
|
/* goom_set_main_script(goomInfo, goomInfo->main_script_str); */
|
|
|
|
|
|
|
|
|
|
return goomInfo;
|
2002-02-01 19:28:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
|
void
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goom_set_resolution (PluginInfo * goomInfo, guint32 resx, guint32 resy)
|
2002-02-01 19:28:30 +00:00
|
|
|
|
{
|
2008-02-23 01:51:37 +00:00
|
|
|
|
free (goomInfo->pixel);
|
|
|
|
|
free (goomInfo->back);
|
|
|
|
|
free (goomInfo->conv);
|
|
|
|
|
|
|
|
|
|
goomInfo->screen.width = resx;
|
|
|
|
|
goomInfo->screen.height = resy;
|
|
|
|
|
goomInfo->screen.size = resx * resy;
|
|
|
|
|
|
|
|
|
|
init_buffers (goomInfo, goomInfo->screen.size);
|
|
|
|
|
|
|
|
|
|
/* init_ifs (goomInfo, resx, goomInfo->screen.height); */
|
|
|
|
|
goomInfo->ifs_fx.free (&goomInfo->ifs_fx);
|
|
|
|
|
goomInfo->ifs_fx.init (&goomInfo->ifs_fx, goomInfo);
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goom_lines_set_res (goomInfo->gmline1, resx, goomInfo->screen.height);
|
|
|
|
|
goom_lines_set_res (goomInfo->gmline2, resx, goomInfo->screen.height);
|
|
|
|
|
}
|
2003-02-02 05:26:29 +00:00
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
int
|
|
|
|
|
goom_set_screenbuffer (PluginInfo * goomInfo, void *buffer)
|
|
|
|
|
{
|
|
|
|
|
goomInfo->outputBuf = (Pixel *) buffer;
|
|
|
|
|
return 1;
|
2002-02-01 19:28:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
/********************************************
|
|
|
|
|
* UPDATE *
|
|
|
|
|
********************************************
|
|
|
|
|
|
|
|
|
|
* WARNING: this is a 600 lines function ! (21-11-2003)
|
|
|
|
|
*/
|
2004-03-14 22:34:33 +00:00
|
|
|
|
guint32 *
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goom_update (PluginInfo * goomInfo, gint16 data[2][512],
|
|
|
|
|
int forceMode, float fps, char *songTitle, char *message)
|
2002-02-01 19:28:30 +00:00
|
|
|
|
{
|
2008-02-23 01:51:37 +00:00
|
|
|
|
Pixel *return_val;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
guint32 pointWidth;
|
|
|
|
|
guint32 pointHeight;
|
|
|
|
|
int i;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
float largfactor; /* elargissement de l'intervalle d'<27>volution des points */
|
2008-02-23 01:51:37 +00:00
|
|
|
|
Pixel *tmp;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
ZoomFilterData *pzfd;
|
gst/goom/: Make goom reentrant by moving all important static variables into instance structures.
Original commit message from CVS:
* gst/goom/filters.c: (zoomFilterNew), (calculatePXandPY),
(setPixelRGB), (setPixelRGB_), (getPixelRGB), (getPixelRGB_),
(zoomFilterSetResolution), (zoomFilterDestroy),
(zoomFilterFastRGB), (pointFilter):
* gst/goom/filters.h:
* gst/goom/goom_core.c: (goom_init), (goom_set_resolution),
(goom_update), (goom_close):
* gst/goom/goom_core.h:
* gst/goom/goom_tools.h:
* gst/goom/graphic.c:
* gst/goom/gstgoom.c: (gst_goom_class_init), (gst_goom_init),
(gst_goom_dispose), (gst_goom_src_setcaps), (gst_goom_chain):
* gst/goom/gstgoom.h:
* gst/goom/lines.c: (goom_lines):
* gst/goom/lines.h:
Make goom reentrant by moving all important static variables
into instance structures.
(Fixes #329181)
2006-02-05 20:43:49 +00:00
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
/* test if the config has changed, update it if so */
|
|
|
|
|
pointWidth = (goomInfo->screen.width * 2) / 5;
|
|
|
|
|
pointHeight = ((goomInfo->screen.height) * 2) / 5;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
|
|
/* ! etude du signal ... */
|
2008-02-23 01:51:37 +00:00
|
|
|
|
evaluate_sound (data, &(goomInfo->sound));
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
/* goom_execute_main_script(goomInfo); */
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
|
|
|
|
/* ! calcul du deplacement des petits points ... */
|
gst/goom/: Make goom reentrant by moving all important static variables into instance structures.
Original commit message from CVS:
* gst/goom/filters.c: (zoomFilterNew), (calculatePXandPY),
(setPixelRGB), (setPixelRGB_), (getPixelRGB), (getPixelRGB_),
(zoomFilterSetResolution), (zoomFilterDestroy),
(zoomFilterFastRGB), (pointFilter):
* gst/goom/filters.h:
* gst/goom/goom_core.c: (goom_init), (goom_set_resolution),
(goom_update), (goom_close):
* gst/goom/goom_core.h:
* gst/goom/goom_tools.h:
* gst/goom/graphic.c:
* gst/goom/gstgoom.c: (gst_goom_class_init), (gst_goom_init),
(gst_goom_dispose), (gst_goom_src_setcaps), (gst_goom_chain):
* gst/goom/gstgoom.h:
* gst/goom/lines.c: (goom_lines):
* gst/goom/lines.h:
Make goom reentrant by moving all important static variables
into instance structures.
(Fixes #329181)
2006-02-05 20:43:49 +00:00
|
|
|
|
largfactor =
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goomInfo->sound.speedvar / 150.0f + goomInfo->sound.volume / 1.5f;
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
|
if (largfactor > 1.5f)
|
|
|
|
|
largfactor = 1.5f;
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
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);
|
2002-02-01 19:28:30 +00:00
|
|
|
|
}
|
2008-02-23 01:51:37 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
|
/* diminuer de 1 le temps de lockage */
|
|
|
|
|
/* note pour ceux qui n'ont pas suivis : le lockvar permet d'empecher un */
|
2008-02-23 01:51:37 +00:00
|
|
|
|
/* changement d'etat du plugin juste apres un autre changement d'etat. oki */
|
|
|
|
|
if (--goomInfo->update.lockvar < 0)
|
|
|
|
|
goomInfo->update.lockvar = 0;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
|
|
/* on verifie qu'il ne se pas un truc interressant avec le son. */
|
2008-02-23 01:51:37 +00:00
|
|
|
|
if ((goomInfo->sound.timeSinceLastGoom == 0)
|
|
|
|
|
|| (forceMode > 0)
|
|
|
|
|
|| (goomInfo->update.cyclesSinceLastChange > TIME_BTW_CHG)) {
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
|
|
/* changement eventuel de mode */
|
2008-02-23 01:51:37 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
}
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
|
/* tout ceci ne sera fait qu'en cas de non-blocage */
|
2008-02-23 01:51:37 +00:00
|
|
|
|
if (goomInfo->update.lockvar == 0) {
|
2004-03-14 22:34:33 +00:00
|
|
|
|
/* reperage de goom (acceleration forte de l'acceleration du volume) */
|
|
|
|
|
/* -> coup de boost de la vitesse si besoin.. */
|
2008-02-23 01:51:37 +00:00
|
|
|
|
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) */
|
2004-03-14 22:34:33 +00:00
|
|
|
|
{
|
2004-03-15 19:32:27 +00:00
|
|
|
|
guint32 vtmp;
|
|
|
|
|
guint32 newvit;
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goomInfo->update.lockvar = 50;
|
|
|
|
|
newvit =
|
|
|
|
|
STOP_SPEED + 1 -
|
|
|
|
|
((float) 3.5f * log10 (goomInfo->sound.speedvar * 60 + 1));
|
2004-03-15 19:32:27 +00:00
|
|
|
|
/* retablir le zoom avant.. */
|
2008-02-23 01:51:37 +00:00
|
|
|
|
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;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
}
|
2008-02-23 01:51:37 +00:00
|
|
|
|
if (goom_irand (goomInfo->gRandom, 10) == 0) {
|
|
|
|
|
goomInfo->update.zoomFilterData.reverse = 1;
|
|
|
|
|
goomInfo->update.lockvar = 100;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
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;
|
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
|
/* changement de milieu.. */
|
2008-02-23 01:51:37 +00:00
|
|
|
|
switch (goom_irand (goomInfo->gRandom, 25)) {
|
2004-03-15 19:32:27 +00:00
|
|
|
|
case 0:
|
2008-02-23 01:51:37 +00:00
|
|
|
|
case 3:
|
|
|
|
|
case 6:
|
|
|
|
|
goomInfo->update.zoomFilterData.middleY =
|
|
|
|
|
goomInfo->screen.height - 1;
|
|
|
|
|
goomInfo->update.zoomFilterData.middleX =
|
|
|
|
|
goomInfo->screen.width / 2;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2008-02-23 01:51:37 +00:00
|
|
|
|
case 4:
|
|
|
|
|
goomInfo->update.zoomFilterData.middleX =
|
|
|
|
|
goomInfo->screen.width - 1;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2008-02-23 01:51:37 +00:00
|
|
|
|
case 5:
|
|
|
|
|
goomInfo->update.zoomFilterData.middleX = 1;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goomInfo->update.zoomFilterData.middleY =
|
|
|
|
|
goomInfo->screen.height / 2;
|
|
|
|
|
goomInfo->update.zoomFilterData.middleX =
|
|
|
|
|
goomInfo->screen.width / 2;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
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;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
switch (vtmp = (goom_irand (goomInfo->gRandom, 15))) {
|
2004-03-15 19:32:27 +00:00
|
|
|
|
case 0:
|
2008-02-23 01:51:37 +00:00
|
|
|
|
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);
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case 3:
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goomInfo->update.zoomFilterData.vPlaneEffect = 0;
|
|
|
|
|
goomInfo->update.zoomFilterData.hPlaneEffect =
|
|
|
|
|
goom_irand (goomInfo->gRandom, 8)
|
|
|
|
|
- goom_irand (goomInfo->gRandom, 8);
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
case 5:
|
|
|
|
|
case 6:
|
|
|
|
|
case 7:
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goomInfo->update.zoomFilterData.vPlaneEffect =
|
|
|
|
|
goom_irand (goomInfo->gRandom, 5)
|
|
|
|
|
- goom_irand (goomInfo->gRandom, 5);
|
|
|
|
|
goomInfo->update.zoomFilterData.hPlaneEffect =
|
|
|
|
|
-goomInfo->update.zoomFilterData.vPlaneEffect;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case 8:
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goomInfo->update.zoomFilterData.hPlaneEffect =
|
|
|
|
|
5 + goom_irand (goomInfo->gRandom, 8);
|
|
|
|
|
goomInfo->update.zoomFilterData.vPlaneEffect =
|
|
|
|
|
-goomInfo->update.zoomFilterData.hPlaneEffect;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case 9:
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goomInfo->update.zoomFilterData.vPlaneEffect =
|
|
|
|
|
5 + goom_irand (goomInfo->gRandom, 8);
|
|
|
|
|
goomInfo->update.zoomFilterData.hPlaneEffect =
|
|
|
|
|
-goomInfo->update.zoomFilterData.hPlaneEffect;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
|
|
|
|
case 13:
|
2008-02-23 01:51:37 +00:00
|
|
|
|
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);
|
2004-03-15 19:32:27 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if (vtmp < 10) {
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goomInfo->update.zoomFilterData.vPlaneEffect = 0;
|
|
|
|
|
goomInfo->update.zoomFilterData.hPlaneEffect = 0;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
if (goom_irand (goomInfo->gRandom, 5) != 0)
|
|
|
|
|
goomInfo->update.zoomFilterData.noisify = 0;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
else {
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goomInfo->update.zoomFilterData.noisify =
|
|
|
|
|
goom_irand (goomInfo->gRandom, 2) + 1;
|
|
|
|
|
goomInfo->update.lockvar *= 2;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
if (goomInfo->update.zoomFilterData.mode == AMULETTE_MODE) {
|
|
|
|
|
goomInfo->update.zoomFilterData.vPlaneEffect = 0;
|
|
|
|
|
goomInfo->update.zoomFilterData.hPlaneEffect = 0;
|
|
|
|
|
goomInfo->update.zoomFilterData.noisify = 0;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
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;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
if ((signed int) newvit < goomInfo->update.zoomFilterData.vitesse) { /* on accelere */
|
|
|
|
|
pzfd = &goomInfo->update.zoomFilterData;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
if (((newvit < STOP_SPEED - 7) &&
|
2008-02-23 01:51:37 +00:00
|
|
|
|
(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;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
} else {
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goomInfo->update.zoomFilterData.vitesse =
|
|
|
|
|
(newvit + goomInfo->update.zoomFilterData.vitesse * 7) / 8;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
}
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goomInfo->update.lockvar += 50;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
}
|
2008-02-23 01:51:37 +00:00
|
|
|
|
|
|
|
|
|
if (goomInfo->update.lockvar > 150) {
|
|
|
|
|
goomInfo->update.switchIncr = goomInfo->update.switchIncrAmount;
|
|
|
|
|
goomInfo->update.switchMult = 1.0f;
|
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
}
|
|
|
|
|
/* mode mega-lent */
|
2008-02-23 01:51:37 +00:00
|
|
|
|
if (goom_irand (goomInfo->gRandom, 700) == 0) {
|
2004-03-14 22:34:33 +00:00
|
|
|
|
/*
|
2008-02-23 01:51:37 +00:00
|
|
|
|
* printf ("coup du sort...\n") ;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
*/
|
2008-02-23 01:51:37 +00:00
|
|
|
|
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;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
/*
|
|
|
|
|
* 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<EFBFBD>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);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Affichage de texte
|
|
|
|
|
*/
|
|
|
|
|
{
|
|
|
|
|
/*char title[1024]; */
|
|
|
|
|
char text[64];
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
|
/*
|
2008-02-23 01:51:37 +00:00
|
|
|
|
* Le message
|
2004-03-14 22:34:33 +00:00
|
|
|
|
*/
|
2008-02-23 01:51:37 +00:00
|
|
|
|
update_message (goomInfo, message);
|
|
|
|
|
|
|
|
|
|
if (fps > 0) {
|
|
|
|
|
sprintf (text, "%2.0f fps", fps);
|
|
|
|
|
goom_draw_text (goomInfo->p1, goomInfo->screen.width,
|
|
|
|
|
goomInfo->screen.height, 10, 24, text, 1, 0);
|
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
|
|
/*
|
2008-02-23 01:51:37 +00:00
|
|
|
|
* Le titre
|
2004-03-14 22:34:33 +00:00
|
|
|
|
*/
|
2008-02-23 01:51:37 +00:00
|
|
|
|
if (songTitle != NULL) {
|
|
|
|
|
strncpy (goomInfo->update.titleText, songTitle, 1023);
|
|
|
|
|
goomInfo->update.titleText[1023] = 0;
|
|
|
|
|
goomInfo->update.timeOfTitleDisplay = 200;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (goomInfo->update.timeOfTitleDisplay) {
|
|
|
|
|
goom_draw_text (goomInfo->p1, goomInfo->screen.width,
|
|
|
|
|
goomInfo->screen.height, goomInfo->screen.width / 2,
|
|
|
|
|
goomInfo->screen.height / 2 + 7, goomInfo->update.titleText,
|
|
|
|
|
((float) (190 - goomInfo->update.timeOfTitleDisplay) / 10.0f), 1);
|
|
|
|
|
goomInfo->update.timeOfTitleDisplay--;
|
|
|
|
|
if (goomInfo->update.timeOfTitleDisplay < 4)
|
|
|
|
|
goom_draw_text (goomInfo->p2, goomInfo->screen.width,
|
|
|
|
|
goomInfo->screen.height, goomInfo->screen.width / 2,
|
|
|
|
|
goomInfo->screen.height / 2 + 7, goomInfo->update.titleText,
|
|
|
|
|
((float) (190 - goomInfo->update.timeOfTitleDisplay) / 10.0f), 1);
|
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
/*
|
|
|
|
|
* Gestion du Scope
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* arret demande
|
|
|
|
|
*/
|
|
|
|
|
if ((goomInfo->update.stop_lines & 0xf000)
|
|
|
|
|
|| (!goomInfo->curGState->drawScope)) {
|
|
|
|
|
float param1, param2, amplitude;
|
|
|
|
|
int couleur;
|
|
|
|
|
int mode;
|
|
|
|
|
|
|
|
|
|
choose_a_goom_line (goomInfo, ¶m1, ¶m2, &couleur, &mode, &litude,
|
|
|
|
|
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;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
}
|
2002-02-01 19:28:30 +00:00
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
/*
|
|
|
|
|
* 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, ¶m1, ¶m2, &couleur1,
|
|
|
|
|
&mode, &litude, 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;
|
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
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, ¶m1, ¶m2, &couleur1,
|
|
|
|
|
&mode, &litude, 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
return_val = goomInfo->p1;
|
|
|
|
|
tmp = goomInfo->p1;
|
|
|
|
|
goomInfo->p1 = goomInfo->p2;
|
|
|
|
|
goomInfo->p2 = tmp;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
|
|
/* affichage et swappage des buffers.. */
|
2008-02-23 01:51:37 +00:00
|
|
|
|
goomInfo->cycle++;
|
|
|
|
|
|
|
|
|
|
goomInfo->convolve_fx.apply (&goomInfo->convolve_fx, return_val,
|
|
|
|
|
goomInfo->outputBuf, goomInfo);
|
|
|
|
|
|
|
|
|
|
return (guint32 *) goomInfo->outputBuf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************
|
|
|
|
|
* CLOSE *
|
|
|
|
|
****************************************/
|
|
|
|
|
void
|
|
|
|
|
goom_close (PluginInfo * goomInfo)
|
|
|
|
|
{
|
|
|
|
|
if (goomInfo->pixel != NULL)
|
|
|
|
|
free (goomInfo->pixel);
|
|
|
|
|
if (goomInfo->back != NULL)
|
|
|
|
|
free (goomInfo->back);
|
|
|
|
|
if (goomInfo->conv != NULL)
|
|
|
|
|
free (goomInfo->conv);
|
|
|
|
|
|
|
|
|
|
goomInfo->pixel = goomInfo->back = NULL;
|
|
|
|
|
goomInfo->conv = NULL;
|
|
|
|
|
goom_random_free (goomInfo->gRandom);
|
|
|
|
|
goom_lines_free (&goomInfo->gmline1);
|
|
|
|
|
goom_lines_free (&goomInfo->gmline2);
|
|
|
|
|
|
|
|
|
|
/* release_ifs (); */
|
|
|
|
|
goomInfo->ifs_fx.free (&goomInfo->ifs_fx);
|
|
|
|
|
goomInfo->convolve_fx.free (&goomInfo->convolve_fx);
|
|
|
|
|
goomInfo->star_fx.free (&goomInfo->star_fx);
|
|
|
|
|
goomInfo->tentacles_fx.free (&goomInfo->tentacles_fx);
|
|
|
|
|
goomInfo->zoomFilter_fx.free (&goomInfo->zoomFilter_fx);
|
|
|
|
|
|
|
|
|
|
free (goomInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* *** */
|
|
|
|
|
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;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
}
|
2008-02-23 01:51:37 +00:00
|
|
|
|
|
|
|
|
|
*couleur = goom_irand (goomInfo->gRandom, 6);
|
2002-02-01 19:28:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:51:37 +00:00
|
|
|
|
#define ECART_VARIATION 1.5
|
|
|
|
|
#define POS_VARIATION 3.0
|
|
|
|
|
#define SCROLLING_SPEED 80
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Met a jour l'affichage du message defilant
|
|
|
|
|
*/
|
2004-03-14 22:34:33 +00:00
|
|
|
|
void
|
2008-02-23 01:51:37 +00:00
|
|
|
|
update_message (PluginInfo * goomInfo, char *message)
|
2002-02-01 19:28:30 +00:00
|
|
|
|
{
|
2008-02-23 01:51:37 +00:00
|
|
|
|
|
|
|
|
|
int fin = 0;
|
|
|
|
|
|
|
|
|
|
if (message) {
|
|
|
|
|
int i = 1, j = 0;
|
|
|
|
|
|
|
|
|
|
sprintf (goomInfo->update_message.message, message);
|
|
|
|
|
for (j = 0; goomInfo->update_message.message[j]; j++)
|
|
|
|
|
if (goomInfo->update_message.message[j] == '\n')
|
|
|
|
|
i++;
|
|
|
|
|
goomInfo->update_message.numberOfLinesInMessage = i;
|
|
|
|
|
goomInfo->update_message.affiche =
|
|
|
|
|
goomInfo->screen.height +
|
|
|
|
|
goomInfo->update_message.numberOfLinesInMessage * 25 + 105;
|
|
|
|
|
goomInfo->update_message.longueur =
|
|
|
|
|
strlen (goomInfo->update_message.message);
|
|
|
|
|
}
|
|
|
|
|
if (goomInfo->update_message.affiche) {
|
|
|
|
|
int i = 0;
|
|
|
|
|
char *msg = malloc (goomInfo->update_message.longueur + 1);
|
|
|
|
|
char *ptr = msg;
|
|
|
|
|
int pos;
|
|
|
|
|
float ecart;
|
|
|
|
|
|
|
|
|
|
message = msg;
|
|
|
|
|
sprintf (msg, goomInfo->update_message.message);
|
|
|
|
|
|
|
|
|
|
while (!fin) {
|
|
|
|
|
while (1) {
|
|
|
|
|
if (*ptr == 0) {
|
|
|
|
|
fin = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (*ptr == '\n') {
|
|
|
|
|
*ptr = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
++ptr;
|
|
|
|
|
}
|
|
|
|
|
pos =
|
|
|
|
|
goomInfo->update_message.affiche -
|
|
|
|
|
(goomInfo->update_message.numberOfLinesInMessage - i) * 25;
|
|
|
|
|
pos += POS_VARIATION * (cos ((double) pos / 20.0));
|
|
|
|
|
pos -= SCROLLING_SPEED;
|
|
|
|
|
ecart = (ECART_VARIATION * sin ((double) pos / 20.0));
|
|
|
|
|
if ((fin) && (2 * pos < (int) goomInfo->screen.height))
|
|
|
|
|
pos = (int) goomInfo->screen.height / 2;
|
|
|
|
|
pos += 7;
|
|
|
|
|
|
|
|
|
|
goom_draw_text (goomInfo->p1, goomInfo->screen.width,
|
|
|
|
|
goomInfo->screen.height, goomInfo->screen.width / 2, pos, message,
|
|
|
|
|
ecart, 1);
|
|
|
|
|
message = ++ptr;
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
goomInfo->update_message.affiche--;
|
|
|
|
|
free (msg);
|
2006-03-20 17:38:48 +00:00
|
|
|
|
}
|
2002-02-01 19:28:30 +00:00
|
|
|
|
}
|