Remove static label from game functions
[kraptor.git] / src / bomba.c
blob1e790bb17f62cafbcff8cc8d36b24e7f56f48b9a
1 // --------------------------------------------------------
2 // bomba.c
3 // --------------------------------------------------------
4 // Copyright (c) Kronoman
5 // En memoria de mi querido padre
6 // --------------------------------------------------------
7 // Este modulo contiene todo lo relacionado con las bombas
8 // del jugador...
9 // --------------------------------------------------------
10 #ifndef BOMBA_C
11 #define BOMBA_C
13 #include <allegro.h>
14 #include "bomba.h"
15 #include "mapa.h"
16 #include "sonido.h"
17 #include "explos.h"
18 #include "kfbuffer.h"
19 #include "azar.h"
21 /* globales exportadas, setearlas al lanzar una bomba, ver jugador.c */
22 int bomba_esta_activa = FALSE; // esta la bomba funcionando en este momento?
23 int bomba_detonacion = 0; // tiempo de detonacion (30 = 1 segundo explotando)
24 SAMPLE *bomba_sonido = NULL; // sonido de detonacion
26 /* mueve la bomba */
27 void mover_bomba()
29 int i;
30 if (!bomba_esta_activa) return;
32 // sonido de explosiones al azar...
33 if (rand()%100 < 25)
34 tocar_sonido_paneado(rand()%ANCHO_FB,
35 explo_cache_snd[rand()%3],
36 rand_ex(128, 200),
37 rand_ex(800, 1300));
39 bomba_detonacion--;
40 if (bomba_detonacion <= 0)
42 /* sonido estruendoso de explosion */
43 if (rand()%100 < 95)
44 for (i = 0; i < rand()%3+1; i++)
45 tocar_sonido_paneado(rand()%ANCHO_FB,
46 explo_cache_snd[rand()%3],
47 rand_ex(196, 256),
48 rand_ex(800, 1300));
50 bomba_esta_activa = FALSE;
51 bomba_detonacion = 0;
55 /* dibuja la explosion de la bomba, actualmente, todo blanco... horrible! */
56 void dibujar_bomba(BITMAP *bmp)
58 if (!bomba_esta_activa) return;
60 clear_to_color(bmp, makecol(255,255,255) );
64 /* produce una detonacion total del piso del juego,
65 pasarle en x el 'scroll_mapa' */
66 void detonar_totalmente_el_piso(int y)
68 int x1,y1;
69 /* DEBUG: esto detona con retroactividad, es decir todo el mapa hacia atras! */
70 for (y1 = y / H_GR; y1 < GRILLA_H; y1++)
71 for (x1 = 0; x1 < GRILLA_W; x1++)
72 explotar_fondo(x1, y1, rand()%100+100);
76 #endif