tux.kick_timer.start(KICKING_TIME);
set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
physic.set_velocity_x((dir == LEFT) ? -3.5 : 3.5);
- play_sound(sounds[SND_KICK],SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_KICK], this);
}
}
check_horizontal_bump();
if(mode == KICK && changed != dir)
{
- float scroll_x = Sector::current()->camera->get_translation().x;
-
- /* handle stereo sound (number 10 should be tweaked...)*/
- if (base.x < scroll_x + screen->w/2 - 10)
- play_sound(sounds[SND_RICOCHET], SOUND_LEFT_SPEAKER);
- else if (base.x > scroll_x + screen->w/2 + 10)
- play_sound(sounds[SND_RICOCHET], SOUND_RIGHT_SPEAKER);
- else
- play_sound(sounds[SND_RICOCHET], SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_RICOCHET], get_pos());
}
}
dying = DYING_NOT; // now the bomb hurts
timer.start(EXPLODETIME);
- float scroll_x = Sector::current()->camera->get_translation().x;
-
- /* play explosion sound */ // FIXME: is the stereo all right? maybe we should use player cordinates...
- if (base.x < scroll_x + screen->w/2 - 10)
- play_sound(sounds[SND_EXPLODE], SOUND_LEFT_SPEAKER);
- else if (base.x > scroll_x + screen->w/2 + 10)
- play_sound(sounds[SND_EXPLODE], SOUND_RIGHT_SPEAKER);
- else
- play_sound(sounds[SND_EXPLODE], SOUND_CENTER_SPEAKER);
-
+ sound_manager->play_sound(sounds[SND_EXPLODE], this);
} else if(mode == BOMB_EXPLODE) {
remove_me();
return;
// start shaking when tux is below the stalactite and at least 40 pixels
// near
if(tux.base.x + 32 > base.x - RANGE && tux.base.x < base.x + 32 + RANGE
- && tux.base.y + tux.base.height > base.y) {
+ && tux.base.y + tux.base.height > base.y
+ && tux.dying == DYING_NOT) {
timer.start(SHAKETIME);
mode = STALACTITE_SHAKING;
}
// go in wait mode when back in water
if(dying == DYING_NOT
- && gettile(base.x, base.y+ base.height)->attributes & Tile::WATER
+ && gettile(base.x, base.y + base.height)
+ && gettile(base.x, base.y + base.height)->attributes & Tile::WATER
&& physic.get_velocity_y() <= 0 && mode == NORMAL)
{
mode = FISH_WAIT;
fall();
- if (mode == BGM_BIG)
+ if (mode == BGM_BIG && tux.dying == DYING_NOT)
{
if ((tux.base.x + tux.base.width/2 > base.x + base.width/2) && v_dir == LEFT)
{
Sector::current()->add_score(Vector(base.x, base.y),
50 * player_status.score_multiplier);
- play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER);
+
+ sound_manager->play_sound(sounds[SND_SQUISH], get_pos());
player_status.score_multiplier++;
dying = DYING_SQUISHED;
make_player_jump(player);
Sector::current()->add_score(Vector(base.x, base.y),
50 * player_status.score_multiplier);
- play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_SQUISH], get_pos());
player_status.score_multiplier++;
return;
if (mode == NORMAL || mode == KICK)
{
/* Flatten! */
- play_sound(sounds[SND_STOMP], SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_STOMP], get_pos());
mode = FLAT;
set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
physic.set_velocity_x(0);
timer.start(4000);
} else if (mode == FLAT) {
/* Kick! */
- play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_KICK], this);
if (player->base.x < base.x + (base.width/2)) {
physic.set_velocity_x(5);
score * player_status.score_multiplier);
/* Play death sound: */
- play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_FALL], this);
}
void
/* Get kicked if were flat */
if (mode == FLAT && !dying)
{
- play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER);
+ sound_manager->play_sound(sounds[SND_KICK], this);
// Hit from left side
if (player->base.x < base.x) {