Ejemplo n.º 1
0
void WindowPlanes::addProp()
{
    QPointer<Prop> prop=new Prop(this);//0代表是子弱代表炸弹
    time=QTime::currentTime();
    qsrand(time.msec()*100000+time.second()*10000);
    int temp=qrand()%2;

    if(temp==0)
    {
        prop->mytype=0;
        prop->pixmap=&pixmap_prop0;
    }
    else
    {
        prop->mytype=1;
        prop->pixmap=&pixmap_prop1;
    }
    prop->setNumber(getNumber());
    prop->setSize(prop->pixmap->size());

    prop->setY(-prop->height());
    time=QTime::currentTime();
    qsrand(time.msec()*100000+time.second()*10000);
    prop->setX(qrand()%(int)(width()-prop->width()));


    prop->go();

    emit play_music("out_porp");

    //qDebug()<<"add double bullet ok";
}
Ejemplo n.º 2
0
void game_over_init(void)
{
    winsys_set_display_func( main_loop );
    winsys_set_idle_func( main_loop );
    winsys_set_reshape_func( reshape );
    winsys_set_mouse_func( mouse_cb );
    winsys_set_motion_func( ui_event_motion_func );
    winsys_set_passive_motion_func( ui_event_motion_func );

    remove_all_bonuses();

    halt_sound( "flying_sound" );
    halt_sound( "rock_sound" );
    halt_sound( "ice_sound" );
    halt_sound( "snow_sound" );

    play_music( "game_over" );

    aborted = g_game.race_aborted;

    if ( !aborted ) {
        update_player_score( get_player_data( local_player() ) );
    }

    if ( (!g_game.practicing &&!aborted) || (!g_game.practicing && aborted && !game_abort_is_for_tutorial())) {
        race_won = was_current_race_won();
        init_starting_tutorial_step(-100);
    }

    g_game.needs_save_or_display_rankings=false;
    g_game.rankings_displayed=false;
}
Ejemplo n.º 3
0
void play_music_once(const std::string &file)
{
	// Clear list so it's not replayed.
	current_track_list.clear();
	current_track = music_track(file);
	play_music();
}
Ejemplo n.º 4
0
int			launch_sdl(t_sdl *sdl)
{
  TTF_Font		*font288;
  TTF_Font		*font200;
  SDL_Event		event;

  sdl->screen = NULL;
  sdl->music = NULL;
  if ((sdl->screen = init_sdl(sdl->screen)) == NULL)
    return (EXIT_FAILURE);
  if ((font288 = TTF_OpenFont("game_over.ttf", FONT_SIZE1)) == NULL)
    abort();
  if ((font200 = TTF_OpenFont("game_over.ttf", 100)) == NULL)
    abort();
  intro_corewar(font288, "CoreWar", sdl->screen, 0);
  intro_corewar(font200, "An original game by Victor A. Vyssotsky, Robert " \
		"Morris Sr. & M. Douglas McIlroy", sdl->screen, 100);
  intro_corewar(font200, "Coded by Le Gang de la Toundra", sdl->screen, 200);
  intro_corewar(font200, "(Insert coin to play)", sdl->screen, 400);
  SDL_Flip(sdl->screen);
  while (1)
    {
      SDL_WaitEvent(&event);
      if (event.type == SDL_KEYUP)
	break;
    }
  sdl->music = play_music(sdl->music);
  return (EXIT_SUCCESS);
}
Ejemplo n.º 5
0
void WindowPlanes::addenemy3_3()
{
    QPointer<Enemy> enemy=new Enemy(this);
    enemy->setNumber(getNumber());
    enemy->mytype=3;
#ifdef Q_OS_SYMBIAN_V5//判断qt的版朊    enemy->speed=6300;
#else
    //enemy->speed=6300;
    enemy->speed=3800;
#endif

    enemy->pixmap=&pixmap_enemy3_1;
    enemy->setSize(enemy->pixmap->size());
    enemy->blast1=&pixmap_enemy3_1;
    enemy->blast2=&pixmap_enemy3_2;
    enemy->blast3=&pixmap_enemy3_3;
    enemy->blast4=&pixmap_enemy3_4;
    enemy->blast5=&pixmap_enemy3_5;
    enemy->blast6=&pixmap_enemy3_6;
    enemy->blast7=&pixmap_enemy3_7;
    enemy->blast8=&pixmap_enemy3_8;
    enemy->blast9=&pixmap_enemy3_9;
    enemy->HP=15;
    enemy->score=30000;

    enemy->setY(-enemy->height());
    time=QTime::currentTime();
    qsrand(time.msec()*100000+time.second()*10000);
    //qDebug()<<"qrand():"<<qrand()<<time.msec()+time.second()*1000;
    enemy->setX(qrand()%(int)(width()-enemy->width()));
    enemy->go();
    emit play_music("flying");
}
Ejemplo n.º 6
0
void schedule_behaviour() {
  // called at 100 Hz / 10ms
    
  if (behaviour == BEHAVIOUR_CALIB){
    return;
  }

  if (!get_input_bit(IO_INPUT_1)) {
    play_music();
  }
  
  copro_update();
  update_ori();
  uint8_t new_behaviour = behaviour;
  
  switch (behaviour) {
    case BEHAVIOUR_LINE:     new_behaviour = behaviour_follow_line(); break;
    case BEHAVIOUR_OBSTACLE: new_behaviour = behaviour_obstacle_avoidance(); break;
  }

  if (new_behaviour != behaviour) {
    behaviour=new_behaviour;
    switch (behaviour) {
      case BEHAVIOUR_LINE:     behaviour_follow_line_start(); break;
      case BEHAVIOUR_OBSTACLE: behaviour_obstacle_avoidance_start(); break;
    }
  }
}
Ejemplo n.º 7
0
void AudioManager::play_audio(AudioClip *inClip)
{
	if (_init && inClip)
	{
		if (inClip->type == TEXENG_AUDIO_FX) play_fx(inClip);
		else play_music(inClip);
	}
}
Ejemplo n.º 8
0
void sceneShow::show_scene(int n)
{
    if (n < 0) {
        return;
    }
    if (scene_list.size() <= n) {
        std::cout << "ERROR: Scene List[" << n << "] invalid. List size is " << image_scenes.size() << "." << std::endl;
        return;
    }
    CURRENT_FILE_FORMAT::file_scene_list scene = scene_list.at(n);
    input.clean();

    for (int i=0; i<SCENE_OBJECTS_N; i++) {
        input.read_input();
        int scene_seek_n = scene.objects[i].seek_n;
        //std::cout << ">> sceneShow::show_scene - i: " << i << ", scene_seek_n: " << scene_seek_n << std::endl;

        if (_interrupt_scene == true || input.p1_input[BTN_START] == 1) {
            scene_seek_n = -1;
            break;
        }

        if (scene_seek_n != -1) {
            int scene_type = scene.objects[i].type;
            //std::cout << "### scene_type[" << scene_type << "]" << std::endl;
            if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_TEXT) {
                show_text(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_AREA) {
                clear_area(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_SCREEN) {
                graphLib.clear_area(0 ,0, RES_W, RES_H, 0, 0, 0);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_IMAGE) {
                show_image(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_VIEWPOINT) {
                show_viewpoint(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_MUSIC) {
                play_music(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_SFX) {
                play_sfx(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_ANIMATION) {
                show_animation(scene_seek_n, scene.objects[i].repeat_value, scene.objects[i].repeat_type);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_STOP_MUSIC) {
                soundManager.stop_music();
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SUBSCENE) {
                show_scene(scene_seek_n);
            } else {
                std::cout << ">> sceneShow::show_scene - unknown scene_type[" << scene_type << "]" << std::endl;
            }
            std::cout << "show_scene::DELAY[" << i << "][" << scene.objects[i].delay_after << "]" << std::endl;
            if (input.waitScapeTime(scene.objects[i].delay_after) == 1) {
                _interrupt_scene = true;
            }
        } else {
            break;
        }
    }
    std::cout << "show_scene::DONE" << std::endl;
}
Ejemplo n.º 9
0
void play_music_config(const config &music_node)
{
	music_track track( music_node );

	if (!track.valid() && !track.id().empty()) {
		ERR_AUDIO << "cannot open track '" << track.id() << "'; disabled in this playlist." << std::endl;
	}

	// If they say play once, we don't alter playlist.
	if (track.play_once()) {
		current_track = track;
		play_music();
		return;
	}

	// Clear play list unless they specify append.
	if (!track.append()) {
		current_track_list.clear();
	}

	if(track.valid()) {
		// Avoid 2 tracks with the same name, since that can cause an infinite loop
		// in choose_track(), 2 tracks with the same name will always return the
		// current track and track_ok() doesn't allow that.
		std::vector<music_track>::const_iterator itor = current_track_list.begin();
		while(itor != current_track_list.end()) {
			if(track == *itor) break;
			++itor;
		}

		if(itor == current_track_list.end()) {
			current_track_list.push_back(track);
		} else {
			ERR_AUDIO << "tried to add duplicate track '" << track.file_path() << "'" << std::endl;
		}
	}

	// They can tell us to start playing this list immediately.
	if (track.immediate()) {
		current_track = track;
		play_music();
	} else if (!track.append()) { // Make sure the current track is finished
		current_track.set_play_once(true);
	}
}
Ejemplo n.º 10
0
 /*
  * This thread just plays the new level beep sound effect
  * on a separate thread once you clear a level. It is only
  * called once a level at the beginning.
  */
 virtual void Entry(void)
 {
     //while (true) //play it once, not forever....
     {
         {
             if (env.music)
                 play_music("afplay /usr/share/sks3/next_level.mp3 -v 3 &");
         }
     }
 }
Ejemplo n.º 11
0
void racing_init(void) 
{
    player_data_t *plyr = get_player_data( local_player() );
    
    winsys_set_display_func( main_loop );
    winsys_set_idle_func( main_loop );
    winsys_set_reshape_func( reshape );
    winsys_set_mouse_func( NULL );
    winsys_set_motion_func( NULL );
    winsys_set_passive_motion_func( NULL );
    winsys_set_mouse_func( NULL );
    
    /* Initialize view */
    if ( getparam_view_mode() < 0 || 
        getparam_view_mode() >= NUM_VIEW_MODES ) 
    {
        setparam_view_mode( ABOVE );
    }
    set_view_mode( plyr, (view_mode_t)getparam_view_mode() );
    
    /* We need to reset controls here since callbacks won't have been
     called in paused mode. This results in duplication between this
     code and init_physical_simulation.  Oh well. */
    left_turn = right_turn = paddling = False;
    trick_modifier = False;
    charging = False;
    plyr->control.turn_fact = 0.0;
    plyr->control.turn_animation = 0.0;
    plyr->control.is_braking = False;
    plyr->control.is_paddling = False;
    plyr->control.jumping = False;
    plyr->control.jump_charging = False;
    
#ifdef __APPLE__
    plyr->control.is_flying=False;
    plyr->control.fly_total_time=0;
#endif
    
    /* Set last_terrain to a value not used below */
    last_terrain = 0;
    
    if ( g_game.prev_mode != PAUSED ) {
        init_physical_simulation();
    }
    
    last_terrain = 0;
    
    g_game.race_aborted = False;
#ifdef __APPLE__
    g_game.race_time_over = False;
#endif
    
    play_music( "racing" );
    /* play_sound( "start_race", 0 ); */
}
Ejemplo n.º 12
0
void WindowPlanes::bulletToDouble()
{
    time_double_bullet_begin.start();//记录双子弹状态是从什么时候开始的
    save_timer_bullet_to_single = 15000;
    pixmap_bullet=&pixmap_bullet2;
    bullet_type=2;

    emit play_music("double_saler");

    timer_bullet_to_single.start(15000);
}
Ejemplo n.º 13
0
static void draw(void)
{
   int x, y, offx, offy;
   float c = 1;
   static char logo_text1[] = "Allegro";
   static char logo_text2[] = "";
   /* XXX commented out because the font doesn't contain the characters for
    * anything other than "Allegro 4.2"
    */
   /* static char logo_text2[] = "5.0"; */

   if (progress < 0.5f) {
      c = progress / 0.5f;
      al_clear_to_color(al_map_rgb_f(c, c, c));
   } else {
      if (!already_played_midi) {
         play_music(DEMO_MIDI_INTRO, 0);
         already_played_midi = 1;
      }

      c = 1;
      al_clear_to_color(al_map_rgb_f(c, c, c));

      x = screen_width / 2;
      y = screen_height / 2 - 3 * al_get_font_line_height(demo_font_logo) / 2;

      offx = 0;
      if (progress < 1.0f) {
         offx =
            (int)(al_get_text_width(demo_font_logo, logo_text1) *
                  (1.0f - 2.0f * (progress - 0.5f)));
      }

      demo_textprintf_centre(demo_font_logo, x + 6 - offx,
                           y + 5, al_map_rgba_f(0.125, 0.125, 0.125, 0.25), logo_text1);
      demo_textprintf_centre(demo_font_logo, x - offx, y,
                           al_map_rgba_f(1, 1, 1, 1), logo_text1);

      if (progress >= 1.5f) {
         y += 3 * al_get_font_line_height(demo_font_logo) / 2;
         offy = 0;
         if (progress < 2.0f) {
            offy = (int)((screen_height - y) * (1.0f - 2.0f * (progress - 1.5f)));
         }

         demo_textprintf_centre(demo_font_logo, x + 6,
                              y + 5 + offy, al_map_rgba_f(0.125, 0.125, 0.125, 0.25),
                              logo_text2);
         demo_textprintf_centre(demo_font_logo, x, y + offy,
                              al_map_rgba_f(1, 1, 1, 1), logo_text2);
      }
   }
}
Ejemplo n.º 14
0
static void credits_init(void) 
{
    winsys_set_display_func( main_loop );
    winsys_set_idle_func( main_loop );
    winsys_set_reshape_func( reshape );
    winsys_set_mouse_func( mouse_cb );
    winsys_set_motion_func( ui_event_motion_func );
    winsys_set_passive_motion_func( ui_event_motion_func );
    
    y_offset = 0;
    
    play_music( "credits_screen" );
}
Ejemplo n.º 15
0
void MusicMng::play_music(s32 pos)
{
	if (pos >= 0 && pos < (s32)m_list.size())
	{
#ifdef UNICODE
		std::string str = Helper::Utf16ToACP(m_list[pos]);
		const c8 * name = str.c_str();
#else
		const c8 * name = m_list[pos].c_str();
#endif
		play_music(name);
	}
}
Ejemplo n.º 16
0
// --------------------------------------------------------------
// object which gives a temporary boost to luck
// --------------------------------------------------------------
void t_luck_object::activate_trigger( t_army* army, t_adv_map_point const& point, 
		                              t_direction direction, t_adventure_frame* frame )
{
	int  i;
	bool any_award = false;

	// loop through all heroes/creatures in the army and award temporary statistic based on subtype

	t_creature_array& creatures = army->get_creatures();


	for (i = 0; i < t_creature_array::k_size; i++)
	{
		if (creatures[i].get_number() == 0)
			continue;
		if (creatures[i].has_temporary_bonus( get_type() ))
			continue;
		add_bonus( creatures[i] );
		any_award = true;
	}

	// determine what response to print
	if (army->get_owner()->is_computer())
		return;

	t_basic_dialog*          dialog;
	std::string              text;

	dialog = new t_basic_dialog;
	if (any_award)
	{
		text = get_text( "initial" );
		add_icons( dialog );
	}
	else
	{
		text = get_text( "empty" );
	}

	dialog->set_text( text );
	dialog->add_ok_button();
	dialog->set_title( get_name() );
	dialog->open( get_dialog_bottom( point ), true, k_align_bottom );
	t_sound_cache music = get_music_playing();
	stop_music();
	get_dialog_sound( k_dialog_sound_luck )->play( get_sound_volume() );
	dialog->run_modal();
    // Update stats.
    frame->update_army();
	play_music( music );
}
Ejemplo n.º 17
0
// stop or start sounds when minimized
void handle_adventure_sound_minimization(bool minimized)
{
	static bool was_minimized = false;
	static bool music_is_saved = false;
	static int former_music_volume;
	static t_sound_cache saved_music;

	if (minimized == false && !was_minimized) // never have minimized yet
		return;

	// go through the current managed sound list and make sure a sound
	t_active_sounds::iterator iter;

	if (minimized)
		was_minimized = true;

	// handle music
	if (music_is_saved && !minimized) 
		play_music( saved_music );
	else if (minimized)
	{
		music_is_saved = true;
		saved_music = get_music_playing();
	//	if (saved_music)
	//		former_music_volume = saved_music->get_volume();
		stop_music();
	}

	// traverse the list of active sounds and process each
	for( iter = active_sounds.begin(); iter != active_sounds.end(); ++iter )
	{
		t_managed_sound * playing_sound = (*iter).get();
		if (minimized) // fade out the sound
		{
			playing_sound->set_former_volume(playing_sound->get_sound_ptr()->get_volume());
			playing_sound->get_sound_ptr()->set_volume(k_almost_min_volume);
		}
		else // restore prior volume level
		{
			if (playing_sound->get_sound_ptr())
			{
				playing_sound->get_sound_ptr()->set_volume(playing_sound->get_former_volume() );
			}
			else
			{
				minimized = minimized; // debug hook for a bug??
			}
		}
	}
}
Ejemplo n.º 18
0
void t_sanctuary::activate_trigger( t_army* army, t_adv_map_point const& point, 
									t_direction direction, 
									t_adventure_frame* frame )
{
	t_dialog_sanctuary*				dialog;
	t_player*						player = army->get_owner();
	std::string						text;
	t_screen_point					zero(0,0);

	resurrect_heroes( *army, k_text_sanctuary_resurrects_heroes, frame );
	dialog = new t_dialog_sanctuary( frame );

	if (!empty())
	{
		dialog->set_text( get_text( "denied" ) );
		dialog->enable_entry( false );
	}
	else if (m_paid[army->get_owner_number()])
	{
		dialog->set_text( get_text( "paid" ) );
		dialog->enable_entry( true );
	}
	else
	{
		dialog->set_text( get_text( "initial" ));
		dialog->enable_entry( player->get_funds()[k_gold] >= k_rental_fee);
	}
	dialog->set_title( get_name() );

	t_sound_cache music = get_music_playing();
	stop_music();
	get_dialog_sound( k_dialog_sound_sanctuary )->play( get_sound_volume() );
	switch (dialog->run_modal())
	{
		case k_choice_cancel:
			return;

		case k_choice_enter:
			if (!m_paid[army->get_owner_number()])
			{
				player->spend( k_gold, k_rental_fee );
				m_paid[army->get_owner_number()] = true;
			}
			set_owner( army->get_owner_number() );
			swap( army->get_creatures() );
			frame->destroy_army( army );
			break;
	}
	play_music( music );
}
Ejemplo n.º 19
0
void
SoundManager::enable_music(bool enable)
{
  if(device == 0)
    return;
  music_enabled = enable;
  if(music_enabled) {
    play_music(current_music);
  } else {
    if(music_source) {
      delete music_source;
      music_source = 0;
    }
  }
}
Ejemplo n.º 20
0
void
SoundManager::enable_music(bool enable)
{
  if(device == NULL)
    return;

  music_enabled = enable;
  if(music_enabled) {
    play_music(current_music);
  } else {
    if(music_source) {
      music_source.reset();
    }
  }
}
Ejemplo n.º 21
0
void play_music_repeatedly(const std::string &id)
{
	// Can happen if scenario doesn't specify.
	if (id.empty())
		return;

	current_track_list.clear();
	current_track_list.push_back(music_track(id));

	// If we're already playing it, don't interrupt.
	if (current_track != id) {
		current_track = music_track(id);
		play_music();
	}
}
Ejemplo n.º 22
0
bool init_sound() {
	LOG_AUDIO << "Initializing audio...\n";
	if(SDL_WasInit(SDL_INIT_AUDIO) == 0)
		if(SDL_InitSubSystem(SDL_INIT_AUDIO) == -1)
			return false;

	if(!mix_ok) {
		if(Mix_OpenAudio(preferences::sample_rate(), MIX_DEFAULT_FORMAT, 2, preferences::sound_buffer_size()) == -1) {
			mix_ok = false;
			ERR_AUDIO << "Could not initialize audio: " << Mix_GetError() << std::endl;
			return false;
		}

		mix_ok = true;
		Mix_AllocateChannels(n_of_channels);
		Mix_ReserveChannels(n_reserved_channels);

		channel_chunks.clear();
		channel_chunks.resize(n_of_channels, nullptr);
		channel_ids.resize(n_of_channels, -1);

		Mix_GroupChannel(bell_channel, SOUND_BELL);
		Mix_GroupChannel(timer_channel, SOUND_TIMER);
		Mix_GroupChannels(source_channel_start, source_channel_last, SOUND_SOURCES);
		Mix_GroupChannels(UI_sound_channel_start, UI_sound_channel_last, SOUND_UI);
		Mix_GroupChannels(n_reserved_channels, n_of_channels - 1, SOUND_FX);

		set_sound_volume(preferences::sound_volume());
		set_UI_volume(preferences::UI_volume());
		set_music_volume(preferences::music_volume());
		set_bell_volume(preferences::bell_volume());

		Mix_ChannelFinished(channel_finished_hook);

		LOG_AUDIO << "Audio initialized.\n";

		DBG_AUDIO << "Channel layout: " << n_of_channels << " channels (" << n_reserved_channels << " reserved)\n"
				  << "    " << bell_channel << " - bell\n"
				  << "    " << timer_channel << " - timer\n"
				  << "    " << source_channel_start << ".." << source_channel_last << " - sound sources\n"
				  << "    " << UI_sound_channel_start << ".." << UI_sound_channel_last << " - UI\n"
				  << "    " << UI_sound_channel_last + 1 << ".." << n_of_channels - 1 << " - sound effects\n";

		play_music();
	}
	return true;
}
Ejemplo n.º 23
0
Archivo: combat.c Proyecto: rj76/kq
/*! \brief Enemies defeated the player
 * \author Josh Bolduc
 * \date created ????????
 * \date updated
 *
 * Play some sad music and set the dead flag so that the game
 * will return to the main menu.
 */
static void enemies_win (void)
{
   play_music ("rain.s3m", 0);
   battle_render (0, 0, 0);
   /*  RB FIXME: rest()?  */
   blit2screen (0, 0);
   kq_wait (1000);
   sprintf (strbuf, _("%s was defeated!"), party[pidx[0]].name);
   menubox (double_buffer, 152 - (strlen (strbuf) * 4), 48, strlen (strbuf), 1,
            BLUE);
   print_font (double_buffer, 160 - (strlen (strbuf) * 4), 56, strbuf,
               FNORMAL);
   blit2screen (0, 0);
   wait_enter ();
   do_transition (TRANS_FADE_OUT, 4);
   alldead = 1;
}
Ejemplo n.º 24
0
void WindowPlanes::addBullet()
{
    QPointer<Bullet> bullet= new Bullet(this);
    bullet->setNumber(getNumber());
    bullet->mytype=bullet_type;
    //qDebug()<<"bullet_type:"<<bullet_type;

    bullet->pixmap=pixmap_bullet;

    bullet->setSize(pixmap_bullet->size());
    //qDebug()<<"planes pos:"<<planes->x()<<planes->y()<<planes->width()<<planes->height();
    bullet->setX(planes->x()+planes->width()/2-bullet->width()/2);
    bullet->setY(planes->y()-bullet->height());

    bullet->go();
    emit play_music("bullet");
}
Ejemplo n.º 25
0
void
reset_game_state(void)
{
	extern int last_highscore;

	SDL_ShowCursor(SDL_DISABLE);

	last_highscore = -1;
	gc.score = 0;
	gc.ships_left = 2;
	gc.level_tics = 0;
	gc.multiplier = 1;

	gc.cur_level = settings.static_settings->start_level;

	ship.is_alive = 0;
	gc.tics_remaining = 0;

	/* last_death_tic = -70; */

	memset(&game_stat_counters, 0, sizeof(game_stat_counters));

	ships_text_width = string_width_in_pixels(font_small, "ships");

	reset_level();
	reset_eye();
	reset_water();
	reset_background();
	reset_arena();
	reset_particles();
	reset_explosions();
	reset_missiles();
	reset_bombs();
	reset_lasers();
	reset_foes();
	reset_powerups();
	reset_in_game_texts();
	reset_ship_powerups();

	set_inner_state(IS_WAVE_TITLE);

	play_music(MUS_STAGE_1);
}
Ejemplo n.º 26
0
void
mnp_alarm_instance_raise (MnpAlarmInstance *alarm)
{
  MnpAlarmInstancePrivate *priv = ALARM_INSTANCE_PRIVATE(alarm);
  MnpAlarmItem *item = priv->item;

  show_notification(alarm);
  if (item->sound == MNP_SOUND_BEEP)
	  gdk_beep();
  else if(item->sound == MNP_SOUND_MUSIC) {
	  play_music();
  }
  if (!priv->repeat) {
	  /* raised alarm should be deleted */
	  alarm_del(priv->item);
  } else {
	  g_signal_emit (alarm, signals[ALARM_CHANGED], 0);			
  }
}
Ejemplo n.º 27
0
Racing::Racing()
{
	m_rightTurn = false;
	m_leftTurn = false;
	m_trickModifier = false;
	m_paddling = false;
	m_charging = false;
	m_braking = false;
	
    // Initialize view
    if ( getparam_view_mode() < 0 || 
		getparam_view_mode() >= NUM_VIEW_MODES ) 
    {
		setparam_view_mode( ABOVE );
    }
    set_view_mode( players[0], (view_mode_t)getparam_view_mode() );

    // We need to reset controls here since callbacks won't have been
    //   called in paused mode. This results in duplication between this
    //   code and init_physical_simulation.  Oh well. 

    players[0].control.turn_fact = 0.0;
    players[0].control.turn_animation = 0.0;
    players[0].control.is_braking = false;
    players[0].control.is_paddling = false;
    players[0].control.jumping = false;
    players[0].control.jump_charging = false;
	players[0].max_speed = 0;

    // Set last_terrain to a value not used below
    m_lastTerrain = 0;
    
    if ( GameMode::prevmode != PAUSED ) {
		init_physical_simulation();
    }

    gameMgr->abortRace(false);
	
	init_snow(players[0].view.pos);
		
    play_music( "racing" );	
}
Ejemplo n.º 28
0
/*
	Purpose: test the music functions
	Input  : the array of music notes
	Returns: ouputs music 
	Assume : nothing
*/
int main()
{
	int j = 0;
	int i = 0;
	int music[104];
	
	music = get_music();
	
	start_music();
	
	for (i = 0; i < 104; i++){
		play_music(music[i]);
		while (j < 32000)
			j++
	}
	stop_music();
	
	
	return 0;
}
Ejemplo n.º 29
0
void commit_music_changes()
{
	played_before.clear();

	// Play-once is OK if still playing.
	if (current_track.play_once())
		return;

	// If current track no longer on playlist, change it.
	BOOST_FOREACH (const music_track &m, current_track_list) {
		if (current_track == m)
			return;
	}

	// Victory empties playlist: if next scenario doesn't specify one...
	if (current_track_list.empty())
		return;

	// FIXME: we don't pause ms_before on this first track.  Should we?
	current_track = choose_track();
	play_music();
}
Ejemplo n.º 30
0
Paused::Paused()
{
	int centerX = getparam_x_resolution() / 2;
	int centerY = getparam_y_resolution() / 2;
	
	mp_backgroundFrm = new pp::Frame(pp::Vec2d(centerX-120,centerY-100),
								  pp::Vec2d(240,200));
	
	mp_pausedLbl = new pp::Label(pp::Vec2d(centerX,centerY+90),"paused",_("Paused"));
	mp_pausedLbl->alignment.center();
	mp_pausedLbl->alignment.top();
	

	mp_configBtn = new pp::Button(pp::Vec2d(centerX-150,centerY-15),
				     	pp::Vec2d(300, 40),
				     	"button_label",
				     	_("Configuration") );
	
    mp_configBtn->setHilitFontBinding("button_label_hilit");
	mp_configBtn->signalClicked.Connect(pp::CreateSlot(this,&Paused::configuration));
	
	mp_resumeBtn = new pp::Button(pp::Vec2d(centerX-150,centerY-55),
				     	pp::Vec2d(300, 40),
				     	"button_label",
				     	_("Resume") );
	
    mp_resumeBtn->setHilitFontBinding("button_label_hilit");
	mp_resumeBtn->signalClicked.Connect(pp::CreateSlot(this,&Paused::resume));

	mp_quitBtn = new pp::Button(pp::Vec2d(centerX-150,centerY-95),
				     	pp::Vec2d(300, 40),
				     	"button_label",
				     	_("Quit") );
	
    mp_quitBtn->setHilitFontBinding("button_label_hilit");
	mp_quitBtn->signalClicked.Connect(pp::CreateSlot(this,&Paused::quit));

	play_music( "paused" );
}