diff --git a/data/Makefile.am b/data/Makefile.am index 1388232..e94b1f0 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -142,6 +142,16 @@ nobase_dist_gamedata_DATA = images/background.png \ images/intro_plataform.png \ images/left.png \ images/right.png \ + sounds/truck_reverse.wav \ + sounds/truck.wav \ + sounds/toonhit.wav \ + sounds/fish.wav \ + sounds/vase.wav \ + sounds/anvil.wav \ + sounds/boing.wav \ + sounds/bag_place.wav \ + sounds/bag_land.wav \ + sounds/splop.wav \ klickclack.ttf \ burbanks.ttf diff --git a/data/burbanks.ttf b/data/burbanks.ttf new file mode 100644 index 0000000..dc0ab42 Binary files /dev/null and b/data/burbanks.ttf differ diff --git a/data/images/intro_plataform.png b/data/images/intro_plataform.png new file mode 100644 index 0000000..82d8962 Binary files /dev/null and b/data/images/intro_plataform.png differ diff --git a/data/sounds/anvil.wav b/data/sounds/anvil.wav new file mode 100644 index 0000000..e27be11 Binary files /dev/null and b/data/sounds/anvil.wav differ diff --git a/data/sounds/bag_land.wav b/data/sounds/bag_land.wav new file mode 100644 index 0000000..b7bff34 Binary files /dev/null and b/data/sounds/bag_land.wav differ diff --git a/data/sounds/bag_place.wav b/data/sounds/bag_place.wav new file mode 100644 index 0000000..4c2f117 Binary files /dev/null and b/data/sounds/bag_place.wav differ diff --git a/data/sounds/boing.wav b/data/sounds/boing.wav new file mode 100644 index 0000000..a2fbb74 Binary files /dev/null and b/data/sounds/boing.wav differ diff --git a/data/sounds/fish.wav b/data/sounds/fish.wav new file mode 100644 index 0000000..54f3638 Binary files /dev/null and b/data/sounds/fish.wav differ diff --git a/data/sounds/splop.wav b/data/sounds/splop.wav new file mode 100644 index 0000000..5bdf92f Binary files /dev/null and b/data/sounds/splop.wav differ diff --git a/data/sounds/toonhit.wav b/data/sounds/toonhit.wav new file mode 100644 index 0000000..bb02d16 Binary files /dev/null and b/data/sounds/toonhit.wav differ diff --git a/data/sounds/truck.wav b/data/sounds/truck.wav new file mode 100644 index 0000000..2af0248 Binary files /dev/null and b/data/sounds/truck.wav differ diff --git a/data/sounds/truck_reverse.wav b/data/sounds/truck_reverse.wav new file mode 100644 index 0000000..f81055e Binary files /dev/null and b/data/sounds/truck_reverse.wav differ diff --git a/data/sounds/vase.wav b/data/sounds/vase.wav new file mode 100644 index 0000000..ac6375e Binary files /dev/null and b/data/sounds/vase.wav differ diff --git a/src/beans.c b/src/beans.c index 6405977..3bbbe72 100644 --- a/src/beans.c +++ b/src/beans.c @@ -345,13 +345,37 @@ const char *images_names[NUM_IMAGES] = { }; enum { - SND_NONE, + SND_TRUCK_REVERSE, + SND_TRUCK, + SND_TOONHIT, + SND_FISH, + SND_VASE, + SND_ANVIL, + + SND_SPLOP, + + SND_BOING, + + SND_BAG_PLACE, + SND_BAG_LAND, NUM_SOUNDS }; const char *sound_names[NUM_SOUNDS] = { - "sounds/none.wav", + "sounds/truck_reverse.wav", + "sounds/truck.wav", + "sounds/toonhit.wav", + "sounds/fish.wav", + "sounds/vase.wav", + "sounds/anvil.wav", + + "sounds/splop.wav", + + "sounds/boing.wav", + + "sounds/bag_place.wav", + "sounds/bag_land.wav", }; /* Para el motor de botones */ @@ -1683,7 +1707,8 @@ int game_loop (void) { snprintf (buffer, sizeof (buffer), "%d", score); score_p = draw_text_with_shadow (ttf24_klickclack, 2, buffer, blanco, negro); } - /* TODO: Sonido de poner bolsa */ + + if (use_sound) Mix_PlayChannel (-1, sounds[SND_BAG_PLACE], 0); if (bag_stack == (nivel + 1) * 10) { /* Activar la pantalla de next_level */ @@ -1787,11 +1812,12 @@ int game_loop (void) { k = COLLIDER_PENGUIN_1 + bags; - /* Reproducir el sonido de "Agarrar bolsa" */ + if (use_sound) Mix_PlayChannel (-1, sounds[SND_BAG_LAND], 0); if (bags >= 6) { /* Esta bolsa crasheó al pingüino */ printf ("Penguin Crash\n"); + if (use_sound) Mix_PlayChannel (-1, sounds[SND_TOONHIT], 0); if (vidas > 0) { try_visible = TRUE; printf ("Try again visible\n"); @@ -1801,7 +1827,7 @@ int game_loop (void) { SDL_FreeSurface (vidas_p); snprintf (buffer, sizeof (buffer), "%d", vidas); vidas_p = draw_text_with_shadow (ttf24_klickclack, 2, buffer, blanco, negro); - /* TODO: Reproducir aquí el sonido de golpe */ + if (use_sound) Mix_PlayChannel (-1, sounds[SND_TOONHIT], 0); } else { gameover_visible = TRUE; printf ("Game Over visible\n"); @@ -1825,9 +1851,8 @@ int game_loop (void) { if (i == SDL_TRUE) { bags = 7; - /* TODO: Reproducir el sonido de golpe de yunque */ crash_anim = 0; - + if (use_sound) Mix_PlayChannel (-1, sounds[SND_TOONHIT], 0); printf ("Penguin Crash by anvil\n"); if (vidas > 0 && try_visible == FALSE) { try_visible = TRUE; @@ -1860,7 +1885,7 @@ int game_loop (void) { SDL_FreeSurface (vidas_p); snprintf (buffer, sizeof (buffer), "%d", vidas); vidas_p = draw_text_with_shadow (ttf24_klickclack, 2, buffer, blanco, negro); - /* TODO: Reproducir sonido boing */ + if (use_sound) Mix_PlayChannel (-1, sounds[SND_BOING], 0); /* TODO: Mostrar la notificación de 1 vida */ airbone--; @@ -1876,7 +1901,7 @@ int game_loop (void) { if (i == SDL_TRUE) { bags = 8; - /* TODO: Reproducir el sonido de golpe de pescado */ + if (use_sound) Mix_PlayChannel (-1, sounds[SND_TOONHIT], 0); crash_anim = 0; if (vidas > 0 && try_visible == FALSE) { try_visible = TRUE; @@ -1903,7 +1928,7 @@ int game_loop (void) { if (i == SDL_TRUE) { bags = 9; - /* TODO: Reproducir el sonido de golpe de florero */ + if (use_sound) Mix_PlayChannel (-1, sounds[SND_TOONHIT], 0); crash_anim = 0; if (vidas > 0 && try_visible == FALSE) { @@ -1929,16 +1954,20 @@ int game_loop (void) { if (thisbag->bag <= 3 && j == 0) { /* Eliminar del airbone */ airbone--; + if (use_sound) Mix_PlayChannel (-1, sounds[SND_SPLOP], 0); } else if (thisbag->bag == 5 && j == 0) { /* Eliminar el yunque del airbone */ airbone--; + if (use_sound) Mix_PlayChannel (-1, sounds[SND_ANVIL], 0); anvil_out = FALSE; } else if (thisbag->bag == 6 && j == 0) { /* Eliminar el pescado del airbone */ airbone--; + if (use_sound) Mix_PlayChannel (-1, sounds[SND_FISH], 0); fish_out = FALSE; } else if (thisbag->bag == 7 && j == 0) { airbone--; + if (use_sound) Mix_PlayChannel (-1, sounds[SND_VASE], 0); flower_out = FALSE; } @@ -2215,6 +2244,12 @@ int game_loop (void) { } if (next_level_visible == NEXT_LEVEL) { + if (animacion == 0) { + if (use_sound) Mix_PlayChannel (-1, sounds[SND_TRUCK], 0); + } else if (animacion == 56) { + if (use_sound) Mix_PlayChannel (-1, sounds[SND_TRUCK_REVERSE], 0); + } + if (animacion < 52) { /* Presentar el texto del camión descargado */ rect.w = texts[TEXT_UNLOADED]->w; @@ -2425,7 +2460,7 @@ void setup (void) { colliders_hazard_fish[9] = collider_new_block (11, 18); if (use_sound) { - /*for (g = 0; g < NUM_SOUNDS; g++) { + for (g = 0; g < NUM_SOUNDS; g++) { sprintf (buffer_file, "%s%s", systemdata_path, sound_names[g]); sounds[g] = Mix_LoadWAV (buffer_file); @@ -2439,7 +2474,7 @@ void setup (void) { exit (1); } Mix_VolumeChunk (sounds[g], MIX_MAX_VOLUME / 2); - }*/ + } /* Cargar la música */ //sprintf (buffer_file, "%s%s", systemdata_path, MUS_CARNIE);