#include <SDL.h>
#include <SDL_image.h>
-#ifndef NOSOUND
-#include <SDL_mixer.h>
-#endif
-
#ifdef LINUX
#include <pwd.h>
#include <sys/types.h>
SND_EXCELLENT,
SND_COFFEE,
SND_SHOOT,
- NUM_SOUNDS
+ SND_LIFEUP
};
char * soundfilenames[NUM_SOUNDS] = {
DATA_PREFIX "/sounds/upgrade.wav",
DATA_PREFIX "/sounds/excellent.wav",
DATA_PREFIX "/sounds/coffee.wav",
- DATA_PREFIX "/sounds/shoot.wav"
+ DATA_PREFIX "/sounds/shoot.wav",
+ DATA_PREFIX "/sounds/lifeup.wav"
};
* bigcape_right[2], * bigcape_left[2],
* ducktux_right, * ducktux_left,
* skidtux_right, * skidtux_left;
-#ifndef NOSOUND
-Mix_Chunk * sounds[NUM_SOUNDS];
-Mix_Music * song;
-#endif
unsigned char * tiles[15];
bouncy_distro_type bouncy_distros[NUM_BOUNCY_DISTROS];
broken_brick_type broken_bricks[NUM_BROKEN_BRICKS];
{
tux_size = !tux_size;
}
+ else if (key == SDLK_END)
+ {
+ distros += 50;
+ }
}
#ifdef JOY_YES
else if (event.type == SDL_JOYAXISMOTION)
tux_dir == LEFT)
{
tux_skidding = SKID_TIME;
-#ifndef NOSOUND
+
playsound(sounds[SND_SKID]);
-#endif
+
}
tux_dir = RIGHT;
}
tux_dir == RIGHT)
{
tux_skidding = SKID_TIME;
-#ifndef NOSOUND
playsound(sounds[SND_SKID]);
-#endif
}
tux_dir = LEFT;
}
{
jumping = YES;
-#ifndef NOSOUND
if (tux_size == SMALL)
playsound(sounds[SND_JUMP]);
else
playsound(sounds[SND_BIGJUMP]);
-#endif
}
}
}
if (tux_y >= 480)
{
-#ifndef NOSOUND
if (use_sound)
{
if (Mix_PlayingMusic())
Mix_HaltMusic();
}
-#endif
if (next_level)
{
if (distro_counter <= 0)
change(tux_x, tux_y, scroll_x, 'a');
-#ifndef NOSOUND
playsound(sounds[SND_DISTRO]);
-#endif
score = score + SCORE_DISTRO;
distros++;
}
if (distro_counter <= 0)
change(tux_x + 31, tux_y, scroll_x, 'a');
-#ifndef NOSOUND
playsound(sounds[SND_DISTRO]);
-#endif
score = score + SCORE_DISTRO;
distros++;
}
distros = distros - DISTROS_LIFEUP;
lives++;
+ playsound(sounds[SND_LIFEUP]);
}
/* Play death sound: */
-#ifndef NOSOUND
playsound(sounds[SND_FALL]);
-#endif
}
}
}
if (upgrades[i].kind == UPGRADE_MINTS)
{
-#ifndef NOSOUND
playsound(sounds[SND_EXCELLENT]);
-#endif
tux_size = BIG;
super_bkgd_time = 8;
}
else if (upgrades[i].kind == UPGRADE_COFFEE)
{
-#ifndef NOSOUND
playsound(sounds[SND_COFFEE]);
-#endif
tux_got_coffee = YES;
super_bkgd_time = 4;
}
else if (upgrades[i].kind == UPGRADE_HERRING)
{
-#ifndef NOSOUND
playsound(sounds[SND_HERRING]);
-#endif
tux_invincible_time = 200;
super_bkgd_time = 4;
}
{
bad_guys[i].dir = !bad_guys[i].dir;
-#ifndef NOSOUND
if (bad_guys[i].mode == KICK)
playsound(sounds[SND_RICOCHET]);
-#endif
}
}
bad_guys[j].dying = FALLING;
bad_guys[j].ym = -8;
-#ifndef NOSOUND
playsound(sounds[SND_FALL]);
-#endif
add_score(bad_guys[i].x - scroll_x,
bad_guys[i].y, 100);
add_score(bad_guys[i].x - scroll_x, bad_guys[i].y,
50 * score_multiplier);
-#ifndef NOSOUND
playsound(sounds[SND_SQUISH]);
-#endif
}
else if (bad_guys[i].kind == BAD_LAPTOP)
{
bad_guys[i].y,
25 * score_multiplier);
-#ifndef NOSOUND
/* playsound(sounds[SND_SQUISH]); */
-#endif
}
else if (bad_guys[i].kind == -1)
{
{
bad_guys[i].dying = FALLING;
bad_guys[i].ym = -8;
-#ifndef NOSOUND
playsound(sounds[SND_FALL]);
-#endif
}
}
}
{
bad_guys[i].dying = FALLING;
bad_guys[i].ym = -8;
-#ifndef NOSOUND
playsound(sounds[SND_FALL]);
-#endif
}
}
}
sprintf(str, "%d", highscore);
drawtext("HIGH", 0, 20, letters_blue, NO_UPDATE);
- drawtext(str, 80, 20, letters_gold, NO_UPDATE);
+ drawtext(str, 96, 20, letters_gold, NO_UPDATE);
if (time_left >= 50 || (frame % 10) < 5)
{
/* Keep playing music: */
-#ifndef NOSOUND
if (use_sound)
{
if (!Mix_PlayingMusic())
Mix_PlayMusic(song, 1);
}
}
-#endif
/* Pause til next frame: */
}
while (!done && !quit);
-#ifndef NOSOUND
if (use_sound)
{
if (Mix_PlayingMusic())
Mix_HaltMusic();
}
-#endif
unloadlevelgfx();
unloadlevelsong();
{
char * song_path;
-#ifndef NOSOUND
song_path = (char *) malloc(sizeof(char) * (strlen(DATA_PREFIX) +
strlen(song_title) + 8));
song = load_song(DATA_PREFIX "/music/ji_turn.it");
free(song_path);
-#endif
}
void unloadlevelsong(void)
{
-#ifndef NOSOUND
if (use_sound)
{
Mix_FreeMusic(song);
}
-#endif
}
void loadshared(void)
{
-#ifndef NOSOUND
int i;
-#endif
/* Tuxes: */
/* Sound effects: */
-#ifndef NOSOUND
if (use_sound)
{
for (i = 0; i < NUM_SOUNDS; i++)
sounds[i] = load_sound(soundfilenames[i]);
+
}
-#endif
}
SDL_FreeSurface(img_golden_herring);
-#ifndef NOSOUND
if (use_sound)
{
for (i = 0; i < NUM_SOUNDS; i++)
Mix_FreeChunk(sounds[i]);
}
-#endif
}
if (distro_counter <= 0)
change(x, y, sx, 'a');
-#ifndef NOSOUND
playsound(sounds[SND_DISTRO]);
-#endif
score = score + SCORE_DISTRO;
distros++;
}
/* Get some score: */
-#ifndef NOSOUND
playsound(sounds[SND_BRICK]);
-#endif
score = score + SCORE_BRICK;
}
}
add_bouncy_brick(((x + sx + 1) / 32) * 32,
(y / 32) * 32);
-#ifndef NOSOUND
playsound(sounds[SND_BRICK]);
-#endif
}
add_bouncy_distro(((x + sx + 1) / 32) * 32,
(y / 32) * 32 - 32);
-#ifndef NOSOUND
playsound(sounds[SND_DISTRO]);
-#endif
score = score + SCORE_DISTRO;
distros++;
}
UPGRADE_COFFEE);
}
-#ifndef NOSOUND
playsound(sounds[SND_UPGRADE]);
-#endif
}
else if (shape(x, y, sx) == '!')
{
if (shape(x, y, sx) == '$')
{
change(x, y, sx, '.');
-#ifndef NOSOUND
playsound(sounds[SND_DISTRO]);
-#endif
if (bounciness == BOUNCE)
{
{
bad_guys[i].dying = FALLING;
bad_guys[i].ym = -8;
-#ifndef NOSOUND
playsound(sounds[SND_FALL]);
-#endif
}
}
}
{
upgrades[i].xm = -upgrades[i].xm;
upgrades[i].ym = -8;
-#ifndef NOSOUND
playsound(sounds[SND_BUMP_UPGRADE]);
-#endif
}
}
}
{
tux_ym = -16;
-#ifndef NOSOUND
playsound(sounds[SND_HURT]);
-#endif
if (tux_dir == RIGHT)
tux_xm = -8;
bullets[found].y = y;
bullets[found].ym = BULLET_STARTING_YM;
-#ifndef NOSOUND
playsound(sounds[SND_SHOOT]);
-#endif
}
}