Agrego la música de fondo.
parent
f716b57ff9
commit
6f610846fc
|
@ -153,6 +153,8 @@ nobase_dist_gamedata_DATA = images/background.png \
|
||||||
sounds/bag_place.wav \
|
sounds/bag_place.wav \
|
||||||
sounds/bag_land.wav \
|
sounds/bag_land.wav \
|
||||||
sounds/splop.wav \
|
sounds/splop.wav \
|
||||||
|
music/beans1.ogg \
|
||||||
|
music/beans2.ogg \
|
||||||
klickclack.ttf \
|
klickclack.ttf \
|
||||||
burbanks.ttf \
|
burbanks.ttf \
|
||||||
comicrazybi.ttf
|
comicrazybi.ttf
|
||||||
|
|
Binary file not shown.
Binary file not shown.
41
src/beans.c
41
src/beans.c
|
@ -361,6 +361,9 @@ const char *sound_names[NUM_SOUNDS] = {
|
||||||
"sounds/bag_land.wav",
|
"sounds/bag_land.wav",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define MUS_BEANS_1 "music/beans1.ogg"
|
||||||
|
#define MUS_BEANS_2 "music/beans2.ogg"
|
||||||
|
|
||||||
/* Para el motor de botones */
|
/* Para el motor de botones */
|
||||||
enum {
|
enum {
|
||||||
BUTTON_NONE,
|
BUTTON_NONE,
|
||||||
|
@ -675,7 +678,7 @@ Collider *colliders_hazard_fish[10];
|
||||||
int color_penguin = 0;
|
int color_penguin = 0;
|
||||||
|
|
||||||
Mix_Chunk * sounds[NUM_SOUNDS];
|
Mix_Chunk * sounds[NUM_SOUNDS];
|
||||||
Mix_Music * mus_carnie;
|
Mix_Music * music[2];
|
||||||
|
|
||||||
BeanBag *first_bag = NULL;
|
BeanBag *first_bag = NULL;
|
||||||
BeanBag *last_bag = NULL;
|
BeanBag *last_bag = NULL;
|
||||||
|
@ -807,12 +810,20 @@ int game_intro (void) {
|
||||||
|
|
||||||
SDL_BlitSurface (texts[TEXT_PLAY_GAME], NULL, screen, &rect);
|
SDL_BlitSurface (texts[TEXT_PLAY_GAME], NULL, screen, &rect);
|
||||||
|
|
||||||
|
Mix_VolumeMusic (MIX_MAX_VOLUME / 2); /* 50% */
|
||||||
|
Mix_PlayMusic (music[0], 1);
|
||||||
|
|
||||||
SDL_Flip (screen);
|
SDL_Flip (screen);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
last_time = SDL_GetTicks ();
|
last_time = SDL_GetTicks ();
|
||||||
num_rects = 0;
|
num_rects = 0;
|
||||||
|
|
||||||
|
if (!Mix_PlayingMusic ()) {
|
||||||
|
map = RANDOM (2);
|
||||||
|
Mix_PlayMusic (music[map], 1);
|
||||||
|
}
|
||||||
|
|
||||||
while (SDL_PollEvent(&event) > 0) {
|
while (SDL_PollEvent(&event) > 0) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
|
@ -1014,6 +1025,11 @@ int game_explain (void) {
|
||||||
last_time = SDL_GetTicks ();
|
last_time = SDL_GetTicks ();
|
||||||
num_rects = 0;
|
num_rects = 0;
|
||||||
|
|
||||||
|
if (!Mix_PlayingMusic ()) {
|
||||||
|
map = RANDOM (2);
|
||||||
|
Mix_PlayMusic (music[map], 1);
|
||||||
|
}
|
||||||
|
|
||||||
while (SDL_PollEvent(&event) > 0) {
|
while (SDL_PollEvent(&event) > 0) {
|
||||||
/* fprintf (stdout, "Evento: %i\n", event.type);*/
|
/* fprintf (stdout, "Evento: %i\n", event.type);*/
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
|
@ -1307,12 +1323,18 @@ int game_loop (void) {
|
||||||
do {
|
do {
|
||||||
last_time = SDL_GetTicks ();
|
last_time = SDL_GetTicks ();
|
||||||
|
|
||||||
|
if (!Mix_PlayingMusic ()) {
|
||||||
|
map = RANDOM (2);
|
||||||
|
Mix_PlayMusic (music[map], 1);
|
||||||
|
}
|
||||||
|
|
||||||
while (SDL_PollEvent(&event) > 0) {
|
while (SDL_PollEvent(&event) > 0) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
/* Vamos a cerrar la aplicación */
|
/* Vamos a cerrar la aplicación */
|
||||||
done = GAME_QUIT;
|
done = GAME_QUIT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
/* Tengo un Mouse Down */
|
/* Tengo un Mouse Down */
|
||||||
if (event.button.button != SDL_BUTTON_LEFT) break;
|
if (event.button.button != SDL_BUTTON_LEFT) break;
|
||||||
|
@ -2183,19 +2205,20 @@ void setup (void) {
|
||||||
Mix_VolumeChunk (sounds[g], MIX_MAX_VOLUME / 2);
|
Mix_VolumeChunk (sounds[g], MIX_MAX_VOLUME / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cargar la música */
|
/* Cargar las músicas de fondo */
|
||||||
//sprintf (buffer_file, "%s%s", systemdata_path, MUS_CARNIE);
|
sprintf (buffer_file, "%s%s", systemdata_path, MUS_BEANS_1);
|
||||||
//mus_carnie = Mix_LoadMUS (buffer_file);
|
music[0] = Mix_LoadMUS (buffer_file);
|
||||||
|
sprintf (buffer_file, "%s%s", systemdata_path, MUS_BEANS_2);
|
||||||
|
music[1] = Mix_LoadMUS (buffer_file);
|
||||||
|
|
||||||
/*if (mus_carnie == NULL) {
|
if (music[0] == NULL || music[1] == NULL) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("Failed to load data file:\n"
|
_("Failed to load a music file.\n"
|
||||||
"%s\n"
|
|
||||||
"The error returned by SDL is:\n"
|
"The error returned by SDL is:\n"
|
||||||
"%s\n"), buffer_file, SDL_GetError ());
|
"%s\n"), SDL_GetError ());
|
||||||
SDL_Quit ();
|
SDL_Quit ();
|
||||||
exit (1);
|
exit (1);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TTF_Init () < 0) {
|
if (TTF_Init () < 0) {
|
||||||
|
|
Loading…
Reference in New Issue