1 /***************************************************************************
2                           bricks.h  -  description
3                              -------------------
4     begin                : Thu Sep 6 2001
5     copyright            : (C) 2001 by Michael Speck
6     email                : kulkanie@gmx.net
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef __BRICKS_H
19 #define __BRICKS_H
20 
21 /* extra conversion item */
22 typedef struct {
23 	int  type; /* extra of type */
24 	char c;   /* is assigned to this character */
25 } Extra_Conv;
26 /* brick conversion item */
27 typedef struct {
28 	char c;   /* is assigned to this character */
29 	int  type; /* extra of type */
30 	int  id; /* pic id */
31 	int  dur;
32 	int  score;
33 } Brick_Conv;
34 
35 /*
36 ====================================================================
37 Init bricks from level data, set the warp limit (percent) and
38 add regenerating bricks. As this function is called when
39 initializing a level it does not use the 'cur_game' context.
40 'score_mod' is percentual and 100 means normal score.
41 ====================================================================
42 */
43 void bricks_init( Game *game, int game_type, Level *level, int score_mod, int rel_warp_limit  );
44 /*
45 ====================================================================
46 Hit brick and remove if destroyed. 'metal' means the ball
47 destroys any brick with the first try.
48 type and imp are used for shrapnell creation.
49 'extra' contains the pushed extra if one was released.
50 'paddle' is the paddle that initiated hit either by shot or ball.
51 Return true on destruction
52 ====================================================================
53 */
54 int brick_hit( int mx, int my, int metal, int type, Vector imp, Paddle *paddle );
55 /*
56 ====================================================================
57 Make brick at mx,my loose 'points' duration. It must have been
58 previously checked that this operation is completely valid.
59 It does not update net_bricks or the player's duration reference.
60 ====================================================================
61 */
62 void brick_loose_dur( int mx, int my, int points );
63 
64 /*
65 ====================================================================
66 Initiate a brick explosion.
67 ====================================================================
68 */
69 void brick_start_expl( int x, int y, int time, Paddle *paddle );
70 
71 /* add a modification to the list. if 'mod' is HT_HIT and the
72  * tile is empty it is an HT_REMOVE. 'type' is the type of
73  * the responsible source and 'src' its impact vector. */
74 void bricks_add_mod( int x, int y, int mod, int dest_type, Vector imp, Paddle *paddle );
75 void bricks_add_grow_mod( int x, int y, int id );
76 
77 /* update regeneration and explosion of bricks */
78 void bricks_update( int ms );
79 
80 /* return the character that represents the brick with this type id */
81 char brick_get_char( int type );
82 
83 #endif
84