Exemple #1
0
static void
finish_prepare_screenshot (GdkRectangle *rectangle)
{
  GdkRectangle rect;
  GdkWindow *window;

  window = find_current_window ();
  screenshot = screenshot_get_pixbuf (window, rectangle);

  if (screenshot_config->take_window_shot)
    {
      switch (screenshot_config->border_effect[0])
        {
        case 's': /* shadow */
          screenshot_add_shadow (&screenshot);
          break;
        case 'b': /* border */
          screenshot_add_border (&screenshot);
          break;
        case 'n': /* none */
        default:
          break;
        }
    }

  /* release now the lock, it was acquired when we were finding the window */
  screenshot_release_lock ();

  if (screenshot == NULL)
    {
      screenshot_show_error_dialog (NULL,
                                    _("Unable to take a screenshot of the current window"),
                                    NULL);
      exit (1);
    }

  flash = cheese_flash_new ();

  if (rectangle != NULL)
    rect = *rectangle;
  else
    screenshot_get_window_rect (window, &rect);

  cheese_flash_fire (flash, &rect);
  play_sound_effect (window);

  g_object_unref (flash);

  if (screenshot_config->copy_to_clipboard)
    {
      screenshot_save_to_clipboard ();
      gtk_main_quit ();

      return;
    }

  screenshot_ensure_icc_profile (window);
  screenshot_build_filename_async (screenshot_config->last_save_dir,
                                   build_filename_ready_cb, screenshot);
}
Exemple #2
0
    void play_spell_fizzle( Mobile::Character* caster )
	{
	  play_object_centered_effect( caster,
								   0x3735, // HARDCODE
								   0,
								   30 );
	  play_sound_effect( caster, 0x5D ); // HARDCODE
	}
Exemple #3
0
void city_destruction_sound()
{
	struct sound_effect city_destroyed_sound =
	{
	{6,7,8,9,10,12,13},
	{0xAA,0x07,0x10,0x10,0x10,0x38,0x00},
	7
	};
	play_sound_effect(city_destroyed_sound);
}
Exemple #4
0
void explosion_sound()
{
	struct sound_effect explosion_sound =
	{
	{6,7,8,9,10,12,13},
	{0x1F,0x07,0x10,0x10,0x10,0x38,0x00},
	7
	};
	play_sound_effect(explosion_sound);
}
Exemple #5
0
void missile_fired_sound()
{
	struct sound_effect gunshot = 
	{
	{6,7,8,9,10,12,13},
	{0x10,0x07,0x10,0x10,0x10,0x53,0x00},
	7
	};
	play_sound_effect(gunshot);
}
static void
finish_prepare_screenshot (char *initial_uri, GdkWindow *window, GdkRectangle *rectangle)
{  
  ScreenshotDialog *dialog;
  gboolean include_mask = (!take_window_shot && !take_area_shot);

  /* always disable window border for full-desktop or selected-area screenshots */
  if (!take_window_shot)
    screenshot = screenshot_get_pixbuf (window, rectangle, include_pointer, FALSE, include_mask);
  else
    {
      screenshot = screenshot_get_pixbuf (window, rectangle, include_pointer, include_border, include_mask);

      switch (border_effect[0])
        {
        case 's': /* shadow */
          screenshot_add_shadow (&screenshot);
          break;
        case 'b': /* border */
          screenshot_add_border (&screenshot);
          break;
        case 'n': /* none */
        default:
          break;
        }
    }

  /* release now the lock, it was acquired when we were finding the window */
  screenshot_release_lock ();

  if (screenshot == NULL)
    {
      screenshot_show_error_dialog (NULL,
                                    _("Unable to take a screenshot of the current window"),
                                    NULL);
      exit (1);
    }

  play_sound_effect (window);

  dialog = screenshot_dialog_new (screenshot, initial_uri, take_window_shot);
  g_free (initial_uri);

  screenshot_save_start (screenshot, save_done_notification, dialog);

  run_dialog (dialog);
}
Exemple #7
0
void sounds::process_sound_markers( player *p )
{
    bool is_deaf = p->is_deaf();
    const float volume_multiplier = p->hearing_ability();
    const int weather_vol = weather_data(g->weather).sound_attn;

    for( const auto &sound_event_pair : sounds_since_last_turn ) {
        const int volume = sound_event_pair.second.volume * volume_multiplier;
        const std::string& sfx_id = sound_event_pair.second.id;
        const std::string& sfx_variant = sound_event_pair.second.variant;
        const int max_volume = std::max( volume, sound_event_pair.second.volume ); // For deafness checks
        int dist = rl_dist( p->pos3(), sound_event_pair.first );
        bool ambient = sound_event_pair.second.ambient;

        // Too far away, we didn't hear it!
        if( dist > volume ) {
            continue;
        }

        if( is_deaf ) {
            // Has to be here as well to work for stacking deafness (loud noises prolong deafness)
            if( !p->is_immune_effect( "deaf" ) && rng((max_volume - dist) / 2, (max_volume - dist)) >= 150 ) {
                // Prolong deafness, but not as much as if it was freshly applied
                int duration = std::min(40, (max_volume - dist - 130) / 8);
                p->add_effect( "deaf", duration );
                if( !p->has_trait( "DEADENED" ) ) {
                    p->add_msg_if_player( m_bad, _("Your eardrums suddenly ache!") );
                    if( p->pain < 10 ) {
                        p->mod_pain( rng( 0, 2 ) );
                    }
                }
            }
            // We're deaf, skip rest of processing.
            continue;
        }

        // Player volume meter includes all sounds from their tile and adjacent tiles
        // TODO: Add noises from vehicle player is in.
        if( dist <= 1 ) {
            p->volume = std::max( p->volume, volume );
        }

        // Check for deafness
        if( !p->is_immune_effect( "deaf" ) && rng((max_volume - dist) / 2, (max_volume - dist)) >= 150 ) {
            int duration = (max_volume - dist - 130) / 4;
            p->add_effect("deaf", duration);
            is_deaf = true;
            continue;
        }

        // At this point we are dealing with attention (as opposed to physical effects)
        // so reduce volume by the amount of ambient noise from the weather.
        const int mod_vol = (sound_event_pair.second.volume - weather_vol) * volume_multiplier;

        // The noise was drowned out by the surroundings.
        if( mod_vol - dist < 0 ) {
            continue;
        }

        // See if we need to wake someone up
        if( p->has_effect("sleep")) {
            if( (!(p->has_trait("HEAVYSLEEPER") ||
                   p->has_trait("HEAVYSLEEPER2")) && dice(2, 15) < mod_vol - dist) ||
                (p->has_trait("HEAVYSLEEPER") && dice(3, 15) < mod_vol - dist) ||
                (p->has_trait("HEAVYSLEEPER2") && dice(6, 15) < mod_vol - dist) ) {
                //Not kidding about sleep-thru-firefight
                p->wake_up();
                add_msg(m_warning, _("Something is making noise."));
            } else {
                continue;
            }
        }

        const tripoint &pos = sound_event_pair.first;
        const std::string &description = sound_event_pair.second.description;
        if( !ambient && ( pos != p->pos3() ) && !g->m.pl_sees( pos, dist ) ) {
            if( p->activity.ignore_trivial != true ) {
                std::string query;
                if( description.empty() ) {
                    query = _("Heard a noise!");
                } else {
                    query = string_format(_("Heard %s!"),
                                          sound_event_pair.second.description.c_str());
                }

                if( g->cancel_activity_or_ignore_query(query.c_str()) ) {
                    p->activity.ignore_trivial = true;
                    for( auto activity : p->backlog ) {
                        activity.ignore_trivial = true;
                    }
                }
            }
        }

        // Only print a description if it exists
        if( !description.empty() ) {
            // If it came from us, don't print a direction
            if( pos == p->pos3() ) {
                std::string uppercased = description;
                capitalize_letter(uppercased, 0);
                add_msg("%s", uppercased.c_str());
            } else {
                // Else print a direction as well
                std::string direction = direction_name( direction_from( p->pos3(), pos ) );
                add_msg(m_warning, _("From the %s you hear %s"), direction.c_str(), description.c_str());
            }
        }

        // Play the sound effect, if any.
        if(!sfx_id.empty()) {
            int heard_volume = volume - dist;
            // for our sfx API, 100 is "normal" volume, so scale accordingly
            heard_volume *= 10;
            play_sound_effect(sfx_id, sfx_variant, heard_volume);
            //add_msg("Playing sound effect %s, %s, %d", sfx_id.c_str(), sfx_variant.c_str(), heard_volume);
        }

        // If Z coord is different, draw even when you can see the source
        const bool diff_z = pos.z != p->posz();
        // Place footstep markers.
        if( pos == p->pos3() || p->sees( pos ) ) {
            // If we are or can see the source, don't draw a marker.
            continue;
        }

        int err_offset;
        if( mod_vol / dist < 2 ) {
            err_offset = 3;
        } else if( mod_vol / dist < 3 ) {
            err_offset = 2;
        } else {
            err_offset = 1;
        }

        // Enumerate the valid points the player *cannot* see.
        // Unless the source is on a different z-level, then any point is fine
        std::vector<tripoint> unseen_points;
        tripoint newp = pos;
        int &newx = newp.x;
        int &newy = newp.y;
        for( newx = pos.x - err_offset; newx <= pos.x + err_offset; newx++ ) {
            for ( newy = pos.y - err_offset; newy <= pos.y + err_offset; newy++ ) {
                if( diff_z || !p->sees( newp ) ) {
                    unseen_points.emplace_back( newp );
                }
            }
        }
        // Then place the sound marker in a random one.
        if( !unseen_points.empty() ) {
            sound_markers.emplace( random_entry( unseen_points ),
                                   sound_event_pair.second );
        }
    }
    sounds_since_last_turn.clear();
}