1 
2 /**
3  *
4  * @file jj1bullet.h
5  *
6  * Part of the OpenJazz project
7  *
8  * @par History:
9  * - 23rd August 2005: Created OpenJazz.h
10  * - 31st January 2006: Created level.h from parts of OpenJazz.h
11  * - 4th February 2009: Created events.h from parts of level.h
12  * - 11th February 2009: Created bullet.h from parts of events.h
13  * - 1st August 2012: Renamed bullet.h to jj1bullet.h
14  *
15  * @par Licence:
16  * Copyright (c) 2005-2012 Alister Thomson
17  *
18  * OpenJazz is distributed under the terms of
19  * the GNU General Public License, version 2.0
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24  *
25  */
26 
27 
28 #ifndef _BULLET_H
29 #define _BULLET_H
30 
31 
32 #include "level/movable.h"
33 
34 #include "OpenJazz.h"
35 
36 
37 // Constants
38 
39 // Indexes for elements of the bullet set
40 #define B_SPRITE       0
41 #define B_XSPEED       4
42 #define B_YSPEED       8
43 #define B_GRAVITY     12
44 #define B_FINISHANIM  16
45 #define B_FINISHSOUND 17
46 #define B_BEHAVIOUR   18
47 #define B_BEHAVIOR    18
48 #define B_STARTSOUND  19
49 
50 // Survival time
51 #define T_BULLET 1000
52 #define T_TNT    300
53 
54 
55 // Classes
56 
57 class JJ1Bird;
58 class JJ1Event;
59 class JJ1LevelPlayer;
60 class Sprite;
61 
62 /// JJ1Bullet
63 class JJ1Bullet : public Movable {
64 
65 	private:
66 		JJ1Bullet*      next; ///< The next bullet
67 		JJ1LevelPlayer* source; ///< Source player. If NULL, was fired by an event
68 		Sprite*         sprite; ///< Sprite
69 		signed char*    set; ///< Bullet type properties
70 		int             direction; ///< 0: Left, 1: Right, 2: L (lower), 3: R (lower)
71 		unsigned int    time; ///< Time at which the bullet will self-destruct
72 
73 		JJ1Bullet* remove ();
74 
75 	public:
76 		JJ1Bullet  (JJ1Bullet* nextBullet, JJ1LevelPlayer* sourcePlayer, fixed startX, fixed startY, signed char *bullet, int newDirection, unsigned int ticks);
77 		~JJ1Bullet ();
78 
79 		JJ1LevelPlayer* getSource ();
80 		JJ1Bullet*      step      (unsigned int ticks);
81 		void            draw      (int change);
82 
83 };
84 
85 #endif
86 
87