Example #1
0
static void toggle_congestion (void (*drawscreen_ptr) (void)) {

/* Turns the congestion display on and off.   */

 char msg[BUFSIZE];
 int inode, num_congested;

 show_nets = FALSE;
 draw_rr_toggle = DRAW_NO_RR;
 show_congestion = !show_congestion;

 if (!show_congestion) {
    update_message (default_message);
 }
 else {
    num_congested = 0;
    for (inode=0;inode<num_rr_nodes;inode++) {
       if (rr_node[inode].occ > rr_node[inode].capacity) 
          num_congested++;
    }

    sprintf (msg, "%d routing resources are overused.", num_congested);
    update_message (msg);
 }
 
 drawscreen_ptr ();
}
Example #2
0
static void
load_user_config(void)
{
    /* Don't continue adding to this list. When 2.0 rolls around bump
       the 1.4 (unnumbered) files off the list. */
    static const gchar *user_config_files[] =
    {
        "config-2.0.user", "config-1.8.user", "config-1.6.user",
        "config.user", NULL
    };
    static const gchar *auto_config_files[] =
    {
        "config-2.0.auto", "config-1.8.auto", "config-1.6.auto",
        "config.auto", NULL
    };
    static const gchar *saved_report_files[] =
    {
        "saved-reports-2.4", "saved-reports-2.0", NULL
    };
    static const gchar *stylesheet_files[] = { "stylesheets-2.0", NULL};
    static int is_user_config_loaded = FALSE;

    if (is_user_config_loaded)
        return;
    else is_user_config_loaded = TRUE;

    update_message("loading user configuration");
    try_load_config_array(user_config_files);
    update_message("loading auto configuration");
    try_load_config_array(auto_config_files);
    update_message("loading saved reports");
    try_load_config_array(saved_report_files);
    update_message("loading stylesheets");
    try_load_config_array(stylesheet_files);
}
Example #3
0
t_point Search(string destination) {
    int tempID = keywordSearchIntersections(destination);
    if (tempID >= 0) {
        update_message(getIntersectionName(tempID));
        return LatLontoCoordinate(getIntersectionPosition(tempID));
    }
    else {
        update_message("No such street intersection(s)");
        return t_point(-1, -1);
    }
}
Example #4
0
static struct sprite *
newsprite(lua_State *L, struct sprite_pack *pack, int id) {
	if (id == ANCHOR_ID) {
		return newanchor(L);
	}
	int sz = sprite_size(pack, id);
	if (sz == 0) {
		return NULL;
	}
	struct sprite * s = (struct sprite *)lua_newuserdata(L, sz);
	sprite_init(s, pack, id, sz);
	int i;
	for (i=0;;i++) {
		int childid = sprite_component(s, i);
		if (childid < 0)
			break;
		if (i==0) {
			lua_newtable(L);
			lua_pushvalue(L,-1);
			lua_setuservalue(L, -3);	// set uservalue for sprite
		}
		struct sprite *c = newsprite(L, pack, childid);
		c->name = sprite_childname(s, i);
		sprite_mount(s, i, c);
		update_message(c, pack, id, i, s->frame);
		if (c) {
			lua_rawseti(L, -2, i+1);
		}
	}
	if (i>0) {
		lua_pop(L,1);
	}
	return s;
}
static void
mateconf_notify (MateConfClient *client, guint id, MateConfEntry *entry, gpointer data)
{
    BastileWidget *swidget;

    if (g_str_equal (PUBLISH_TO_KEY, mateconf_entry_get_key (entry))) {
        swidget = BASTILE_WIDGET (data);
        update_message (swidget);
    }
}
Example #6
0
void update_screen (int priority, char *msg, enum pic_type 
            pic_on_screen_val, boolean crit_path_button_enabled) {

/* Updates the screen if the user has requested graphics.  The priority  *
 * value controls whether or not the Proceed button must be clicked to   *
 * continue.  Saves the pic_on_screen_val to allow pan and zoom redraws. */

 if (!show_graphics)         /* Graphics turned off */
    return;  


/* If it's the type of picture displayed has changed, set up the proper  *
 * buttons.                                                              */

 if (pic_on_screen != pic_on_screen_val) {
    if (pic_on_screen_val == PLACEMENT && pic_on_screen == NO_PICTURE) {
       create_button ("Window", "Toggle Nets", toggle_nets);
    }

    else if (pic_on_screen_val == ROUTING && pic_on_screen == PLACEMENT) {
       create_button ("Toggle Nets", "Toggle RR", toggle_rr);
       create_button ("Toggle RR", "Congestion", toggle_congestion);

       if (crit_path_button_enabled) 
          create_button ("Congestion", "Crit. Path", highlight_crit_path);
    }

    else if (pic_on_screen_val == PLACEMENT && pic_on_screen == ROUTING) {
       destroy_button ("Toggle RR");
       destroy_button ("Congestion");

       if (crit_path_button_enabled) 
          destroy_button ("Crit. Path");
    }
 }

/* Save the main message. */

 strncpy (default_message, msg, BUFSIZE);

 pic_on_screen = pic_on_screen_val;
 update_message (msg); 
 drawscreen();
 if (priority >= gr_automode) {

    event_loop(highlight_blocks, drawscreen);
 }

 else {
    flushinput();
 }
}
Example #7
0
static void toggle_nets (void (*drawscreen_ptr) (void)) {

/* Enables/disables drawing of nets when a the user clicks on a button.    *
 * Also disables drawing of routing resources.  See graphics.c for details *
 * of how buttons work.                                                    */

 show_nets = !show_nets;
 draw_rr_toggle = DRAW_NO_RR; 
 show_congestion = FALSE;

 update_message (default_message);
 drawscreen_ptr ();
}
Example #8
0
static void
load_system_config(void)
{
    static int is_system_config_loaded = FALSE;
    gchar *system_config;

    if (is_system_config_loaded) return;

    update_message("loading system configuration");
    /* FIXME: use runtime paths from gnc-path.c here */
    system_config = g_build_filename(config_path, "config", NULL);
    is_system_config_loaded = gfec_try_load(system_config);
    g_free(system_config);
}
Example #9
0
static void toggle_rr (void (*drawscreen_ptr) (void)) {

/* Cycles through the options for viewing the routing resources available   *
 * in an FPGA.  If a routing isn't on screen, the routing graph hasn't been *
 * built, and this routine doesn't switch the view. Otherwise, this routine *
 * switches to the routing resource view.  Clicking on the toggle cycles    *
 * through the options:  DRAW_NO_RR, DRAW_ALL_RR, DRAW_ALL_BUT_BUFFERS_RR,  *
 * DRAW_NODES_AND_SBOX_RR, and DRAW_NODES_RR.                               */

 draw_rr_toggle = (draw_rr_toggle + 1) % (DRAW_NODES_RR + 1);
 show_nets = FALSE;
 show_congestion = FALSE;

 update_message (default_message);
 drawscreen_ptr ();
}
Example #10
0
static void
update_data(int dataset_used, struct dataset *dataset)
{
  int  i, j, k;

  if (dataset_used == 0) return;

  for (k=0; k<state->dataset_used; ++k) g_free(state->dataset[k].data);
  g_free(state->dataset);
  state->dataset_used = dataset_used;
  state->dataset = dataset;

  for (j=0; j<2; ++j) {
    state->min[j] = state->max[j] = dataset[0].data[j];
  }
  for (k=0; k<dataset_used; ++k) {
    int rows = dataset[k].rows;
    int cols = dataset[k].cols;
    double *data = dataset[k].data;
    for (i=0; i<rows; ++i) {
      for (j=0; j<cols; ++j) {
        double x = data[i*cols+j];
        int jj = j>1 ? 1 : j;
        if (x < state->min[jj]) state->min[jj] = x;
        if (x > state->max[jj]) state->max[jj] = x;
      }
    }
  }

  for (j=0; j<2; ++j) {
    if (state->min[j] == state->max[j]) {
      state->min[j] -= 1;
      state->max[j] += 1;
    }
    if (state->min[j] > 0 && 4*state->min[j] <= state->max[j]) {
      /* at most extend the horizontal range by anoth 33.3% */
      state->min[j] = 0;
    }
    if (state->max[j] < 0 && 2*state->max[j] >= state->min[j]) {
      /* at most double the vertical range */
      state->max[j] = 0;
    }
  }

  update_message(NULL);
}
Example #11
0
void
newDocCB( Widget w, XtPointer client_data, 
 		XtPointer call_data)
{
	Widget widget;
	
	widget = get_document_text(w, "newDocCB");
	XmTextSetString(widget, "");
	
	widget = get_widget_by_name(w, "newDocCB", "lineTextField");
	XmTextFieldSetString(widget, "");
	
	update_message(w, "newDocCB", "Created new empty file.");
	set_save_path(NULL);
	set_been_saved(False);
	
	update_document_linecount(w, "newDocCB");
	update_window_title(w, "newDocCB");
}
Example #12
0
void step_graphis (double overlap_ratio, int vpin_cnt)
{
   t_bound_box initial_coords = t_bound_box(0,0,100,100);

   init_graphics("Analytical Placer - verbose mode", WHITE);
   set_visible_world(initial_coords);

   std::ostringstream str_buf;
   str_buf  << "Added " << vpin_cnt << " virtual pins; overlap ratio = " << overlap_ratio;
   std::string disp_str = str_buf.str();
   update_message(disp_str);

   if(!created_button) {
     create_button ("Window", "Toggle Lines", act_on_toggle_nets_button); // name is UTF-8
     created_button = true;
   }
   drawscreen();
   event_loop(NULL, NULL, NULL, drawscreen);   
}
Example #13
0
void begin_graphics (void)
{
   t_bound_box initial_coords = t_bound_box(0,0,100,100);

   init_graphics("Analytical Placer - Final View", WHITE);
   set_visible_world(initial_coords);

   std::ostringstream str_buf;
   str_buf << cells.size() << " cells placed with " << nets.size() << " nets";
   std::string disp_str = str_buf.str();
   update_message(disp_str);

   if(!created_button) {
     create_button ("Window", "Toggle Lines", act_on_toggle_nets_button); // name is UTF-8
     created_button = true;
   }
   event_loop(NULL, NULL, NULL, drawscreen);   
   //t_bound_box old_coords = get_visible_world(); //save the current view for later
}
Example #14
0
static void drawInit( int sizex, int sizey, char* seqName, char* filename, float score) {

 int i,k=0;
 int x,y;
 char* c;
 c =(char*)malloc(sizeof(char)*1000);
 


/* initialize display */
 init_graphics("RNA");


/* still picture drawing allows user to zoom, etc. */
 init_world (0.,0.,CELLSIZE*sizex,CELLSIZE*sizey);
 //event_loop(button_press, drawscreen);   

/* animation section */
 clearscreen();
 init_postscript(filename);
 clearscreen();
 
 sprintf(c, "%s%s%s%d%s%f%s", "RNA: ", seqName, ", length = ", sizex, ", energy = ",-score/1000.0, " kal/mol");
 //printf(" output string is %s\n",c);
 update_message("RNA secondary structure");
 flushinput();
 
 drawtext (sizex*CELLSIZE/2,sizey*CELLSIZE/10,c,1.0e6);
 flushinput();
 setcolor (BLACK);
 setlinewidth(1);
 setlinestyle (SOLID);
 for (i=0;i<=sizex;i++) {
    drawline (i*CELLSIZE,(sizey/2-1)*CELLSIZE,i*CELLSIZE,CELLSIZE*sizey/2);
    flushinput();
 }
 drawline(0,(sizey/2-1)*CELLSIZE, sizex*CELLSIZE, CELLSIZE*(sizey/2-1));
 drawline(0,sizey*CELLSIZE/2, sizex*CELLSIZE, CELLSIZE*sizey/2);
 flushinput();
 free(c);
}
/**
 * bastile_keyserver_sync_show
 * @keys: The keys to synchronize
 * 
 * Shows a synchronize window.
 * 
 * Returns the new window.
 **/
GtkWindow*
bastile_keyserver_sync_show (GList *keys, GtkWindow *parent)
{
    BastileWidget *swidget;
    GtkWindow *win;
    GtkWidget *w;
    guint n, notify_id;
    gchar *t;
    
    swidget = bastile_widget_new_allow_multiple ("keyserver-sync", parent);
    g_return_val_if_fail (swidget != NULL, NULL);
    
    win = GTK_WINDOW (bastile_widget_get_widget (swidget, swidget->name));
    
    /* The details message */
    n = g_list_length (keys);
    t = g_strdup_printf (ngettext ("<b>%d key is selected for synchronizing</b>", 
                                   "<b>%d keys are selected for synchronizing</b>", n), n);
    
    w = GTK_WIDGET (bastile_widget_get_widget (swidget, "detail-message"));
    g_return_val_if_fail (swidget != NULL, win);
    gtk_label_set_markup (GTK_LABEL (w), t);
    g_free (t);
            
    /* The right help message */
    update_message (swidget);
    notify_id = bastile_mateconf_notify (PUBLISH_TO_KEY, mateconf_notify, swidget);
    g_signal_connect (win, "destroy", G_CALLBACK (unhook_notification), 
                      GINT_TO_POINTER (notify_id));

    keys = g_list_copy (keys);
    g_return_val_if_fail (!keys || BASTILE_IS_OBJECT (keys->data), win);
    g_object_set_data_full (G_OBJECT (swidget), "publish-keys", keys, 
                            (GDestroyNotify)g_list_free);
    
    return win;
}
Example #16
0
void
includeFileCB( Widget w, XtPointer client_data, 
 		XtPointer call_data)
{
	char *file_data, *c_path;
	Widget widget;
	XmFileSelectionBoxCallbackStruct *res;
	XmTextPosition pos;
	
	res = (XmFileSelectionBoxCallbackStruct *) call_data; 
	c_path = XmStringUnparse(res->value, 
	    NULL, XmCHARSET_TEXT, XmCHARSET_TEXT, NULL, 0, XmOUTPUT_ALL); 
	file_data = get_file_contents(w, "fileOpenCB", c_path);
	widget = get_document_text(w, "fileOpenCB");
	pos = XmTextGetInsertionPosition(widget);
	XmTextInsert(widget, pos, file_data);
	
	update_document_linecount(w, "includeFileCB");
	update_message(w, "fileOpenCB", "Included file.");
	
	XtFree(c_path);
	XtFree(file_data);
	XtUnmanageChild(w);
}
Example #17
0
static void highlight_crit_path (void (*drawscreen_ptr) (void)) {

/* Highlights all the blocks and nets on the critical path.                 */

 t_linked_int *critical_path_head, *critical_path_node;
 int inode, iblk, inet, num_nets_seen;
 static int nets_to_highlight = 1;
 char msg[BUFSIZE];

 if (nets_to_highlight == 0) {   /* Clear the display of all highlighting. */
    nets_to_highlight = 1;
    deselect_all ();
    update_message (default_message);
    drawscreen_ptr ();
    return;
 }
    
 critical_path_head = allocate_and_load_critical_path ();
 critical_path_node = critical_path_head;
 num_nets_seen = 0;

 while (critical_path_node != NULL)  {

    inode = critical_path_node->data;
    get_tnode_block_and_output_net (inode, &iblk, &inet);

    if (num_nets_seen == nets_to_highlight)            /* Last block */
       block_color[iblk] = MAGENTA;
    else if (num_nets_seen == nets_to_highlight - 1)   /* 2nd last block */
       block_color[iblk] = YELLOW;
    else if (num_nets_seen < nets_to_highlight)    /* Earlier block */
       block_color[iblk] = DARKGREEN;

    if (inet != OPEN) {
       num_nets_seen++;

       if (num_nets_seen < nets_to_highlight)   /* First nets. */
          net_color[inet] = DARKGREEN;
       else if (num_nets_seen == nets_to_highlight) 
          net_color[inet] = CYAN;               /* Last (new) net. */
    }

    critical_path_node = critical_path_node->next;
 }

 if (nets_to_highlight == num_nets_seen) {
    nets_to_highlight = 0;
    sprintf (msg, "All %d nets on the critical path highlighted.", 
            num_nets_seen);
 }
 else {
    sprintf (msg, "First %d nets on the critical path highlighted.", 
            nets_to_highlight);
    nets_to_highlight++;
 }

 free_int_list (&critical_path_head);

 update_message (msg);
 drawscreen_ptr ();
}
/* show global message, wait until 'Proceed' pressed then draw screen                                 */
void waitLoop () {
	event_loop(buttonPress,mouseMove,keyPress,drawScreen);
	drawScreen();
	update_message(glabel);
}
Example #19
0
/* the main game function */
static int play_game()
{ 
   ALLEGRO_TIMER *inc_counter;
   int gameover = 0;
   int cyclenum = 0;

   /* init */
   score = 0;

   init_view();
   init_player();
   init_badguys();
   init_bullets();
   init_explode();
   init_message();

   #define TIMER_SPEED  ALLEGRO_BPS_TO_SECS(30*(cyclenum+2))

   inc_counter = al_create_timer(TIMER_SPEED);
   al_start_timer(inc_counter);

   while (!gameover) {

      /* move everyone */
      while ((al_get_timer_count(inc_counter) > 0) && (!gameover)) {
	 update_view();
	 update_bullets();
	 update_explode();
	 update_message();

	 if (update_badguys()) {
	    if (advance_view()) {
	       cyclenum++;
	       al_set_timer_count(inc_counter, 0);
	       lay_attack_wave(TRUE);
	       advance_player(TRUE);
	    }
	    else {
	       lay_attack_wave(FALSE);
	       advance_player(FALSE);
	    }
	 }

	 gameover = update_player();

	 al_set_timer_count(inc_counter, al_get_timer_count(inc_counter)-1);
      }

      /* take a screenshot? */
      if (key[ALLEGRO_KEY_PRINTSCREEN]) {
	 static int ss_count = 0;

	 char fname[80];

	 sprintf(fname, "speed%03d.tga", ++ss_count);

	 al_save_bitmap(fname, al_get_backbuffer(screen));

	 while (key[ALLEGRO_KEY_PRINTSCREEN])
	    poll_input_wait();

	 al_set_timer_count(inc_counter, 0);
      }

      /* toggle fullscreen window */
      if (key[ALLEGRO_KEY_F]) {
         int flags = al_get_display_flags(screen);
         al_set_display_flag(screen, ALLEGRO_FULLSCREEN_WINDOW,
            !(flags & ALLEGRO_FULLSCREEN_WINDOW));

         while (key[ALLEGRO_KEY_F])
            poll_input_wait();
      }

      /* draw everyone */
      draw_view();
   }

   /* cleanup */
   al_destroy_timer(inc_counter);

   shutdown_view();
   shutdown_player();
   shutdown_badguys();
   shutdown_bullets();
   shutdown_explode();
   shutdown_message();

   if (gameover < 0) {
      sfx_ping(1);
      return FALSE;
   }

   return TRUE;
}
Example #20
0
File: vram.c Project: pepone42/gngb
void blit_screen(void)
{
  update_key();
  update_message();  
  cur_mode->blit();
}
Example #21
0
static void highlight_blocks (float x, float y) {

/* This routine is called when the user clicks in the graphics area. *
 * It determines if a clb was clicked on.  If one was, it is         *
 * highlighted in green, it's fanin nets and clbs are highlighted in *
 * blue and it's fanout is highlighted in red.  If no clb was        *
 * clicked on (user clicked on white space) any old highlighting is  *
 * removed.  Note that even though global nets are not drawn, their  *
 * fanins and fanouts are highlighted when you click on a block      *
 * attached to them.                                                 */

 int i, j, k, hit, bnum, ipin, netnum, fanblk;
 int class;
 float io_step;
 char msg[BUFSIZE];

 io_step = clb_width/io_rat;
 deselect_all ();

 hit = 0;
 for (i=0;i<=nx+1;i++) {
    if (x <= x_clb_left[i]+clb_width) {
       if (x >= x_clb_left[i]) 
          hit = 1;
       break;
    }
 }
 if (!hit) {
    update_message (default_message);
    drawscreen();
    return;
 }

 hit = 0;
 for (j=0;j<=ny+1;j++) {
    if (y <= y_clb_bottom[j]+clb_width) {
       if (y >= y_clb_bottom[j])
          hit = 1;
       break;
    }
 }
 if (!hit) {
    update_message (default_message); 
    drawscreen();
    return;
 }

/* The user selected the clb at location (i,j). */
 if (clb[i][j].type == CLB) {
    if (clb[i][j].occ == 0) {
       update_message (default_message); 
       drawscreen ();
       return;
    }
    bnum = clb[i][j].u.block;
 }
 else {   /* IO block clb */
    if (i == 0 || i == nx+1)      /* Vertical columns of IOs */
       k = (int) ((y - y_clb_bottom[j]) / io_step);
    else 
       k = (int) ((x - x_clb_left[i]) / io_step);

    if (k >= clb[i][j].occ) {   /* Empty spot */
       update_message (default_message); 
       drawscreen();
       return;
    }
    bnum = clb[i][j].u.io_blocks[k];
 }

/* Highlight fanin and fanout. */

 if (block[bnum].type == OUTPAD) {
    netnum = block[bnum].nets[0];    /* Only net. */
    net_color[netnum] = BLUE;        /* Outpad drives nothing */
    fanblk = net[netnum].blocks[0];    /* Net driver */
    block_color[fanblk] = BLUE;
 }

 else if (block[bnum].type == INPAD) {
    netnum = block[bnum].nets[0];    /* Only net. */
    net_color[netnum] = RED;         /* Driven by INPAD */

/* Highlight fanout blocks in RED */

    for (ipin=1;ipin<net[netnum].num_pins;ipin++) { 
       fanblk = net[netnum].blocks[ipin];
       block_color[fanblk] = RED;
    }
 }

 else {       /* CLB block. */
    for (k=0;k<pins_per_clb;k++) {     /* Each pin on a CLB */
       netnum = block[bnum].nets[k];

       if (netnum == OPEN)
          continue;

       class = clb_pin_class[k];

       if (class_inf[class].type == DRIVER) {  /* Fanout */
          net_color[netnum] = RED;
          for (ipin=1;ipin<net[netnum].num_pins;ipin++) { 
             fanblk = net[netnum].blocks[ipin];
             block_color[fanblk] = RED;
          }
       }

       else {         /* This net is fanin to the block. */
          net_color[netnum] = BLUE;
          fanblk = net[netnum].blocks[0];
          block_color[fanblk] = BLUE;
       }
    }
 }
Example #22
0
/********************************************
*                  UPDATE                  *
********************************************

* WARNING: this is a 600 lines function ! (21-11-2003)
*/
uint32_t *goom_update (PluginInfo *goomInfo, int16_t data[2][512],
                      int forceMode, float fps, const char *songTitle, const char *message)
{
    Pixel *return_val;
    uint32_t pointWidth;
    uint32_t 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) */
                {
                    uint32_t vtmp;
                    uint32_t 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)) && (visual_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);

        /*
         * Affichage de texte
         */
        {
            /*char title[1024];*/
            char text[64];

            /*
             * Le message
             */
            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);
            }

            /*
             * Le titre
             */
            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);
            }
        }

        /*
         * 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, &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 (uint32_t*)goomInfo->outputBuf;
}