1 /**
2  * @file spaceship.h
3  * @brief Handle the player's spaceship
4  * @created 2006-11-17
5  * @date 2012-08-28
6  * @author Jean-Michel Martin de Santero
7  * @author Bruno Ethvignot
8  */
9 /*
10  * copyright (c) 1998-2015 TLK Games all rights reserved
11  * $Id: spaceship.h,v 1.27 2012/08/25 15:55:00 gurumeditation Exp $
12  *
13  * Powermanga is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * Powermanga is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26  * MA  02110-1301, USA.
27  */
28 #ifndef __SPACESHIP__
29 #define __SPACESHIP__
30 
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35 
36 /** Spaceship invincibility time */
37 #define SPACESHIP_INVINCIBILITY_TIME 15
38 /** There are 5 options for each level */
39 #define SPACESHIP_MAX_OPTION_LEVELS 5
40 
41  /** The differents types of spaceships */
42   typedef enum
43   {
44     SPACESHIP_TYPE_1,
45     SPACESHIP_TYPE_2,
46     SPACESHIP_TYPE_3,
47     SPACESHIP_TYPE_4,
48     SPACESHIP_TYPE_5,
49       /** Maximum number of types spaceships */
50     SPACESHIP_NUM_OF_TYPES
51   }
52   SPACESHIP_TYPES;
53 
54   /** Structure of spaceship's player */
55   typedef struct spaceship_struct
56   {
57     /** Structure of the sprite images */
58     sprite spr;
59     /** Horizontal speed */
60     float x_speed;
61     /** Vertical speed */
62     float y_speed;
63     /** TRUE if display spaceship's white mask */
64     bool is_white_mask_displayed;
65     /* TRUE if display spaceship */
66     bool is_visible;
67     /** Invincibility time */
68     Sint16 invincibility_delay;
69     /** Invincibility counter time */
70     Sint16 invincibility_count;
71     /** Number of gems collected from 0 to 11 */
72     Sint16 gems_count;
73     /** Number of satellite protections from 0 to 5 */
74     Sint16 num_of_satellites;
75     /** Number of extra gun from 0 to 2 */
76     Sint16 num_of_extraguns;
77     /** Type of vessel from SPACESHIP_TYPE_1 to SPACESHIP_TYPE_5 */
78     Sint16 type;
79     /** Time before 2 shots */
80     Sint32 fire_rate;
81     /** Shot force 2 tempo counter */
82     Sint32 fire_rate_enhanced;
83     /* level of options, from 0 (none) to 5 (maxi) */
84     /** Speed booster (0 = freezed) */
85     Sint16 speed_booster;
86     /** Front shot force 1 */
87     Sint16 shot_front_basic;
88     /** Rear shot force 1 */
89     Sint16 shot_rear_basic;
90     /** Right shot force 1 */
91     Sint16 shot_right_basic;
92     /** Left shot force 1 */
93     Sint16 shot_left_basic;
94     /** Front shot force 2 */
95     Sint16 shot_front_enhanced;
96     /** Rear shot force 2 */
97     Sint16 shot_rear_enhanced;
98     /** Right shot force 2 */
99     Sint16 shot_right_enhanced;
100     /** Left shot force 2 */
101     Sint16 shot_left_enhanced;
102     /** TRUE if vessel has just changed */
103     bool has_just_upgraded;
104   } spaceship_struct;
105 
106   bool spaceship_once_init (void);
107 #ifdef PNG_EXPORT_ENABLE
108   bool spaceship_extract (void);
109 #endif
110   void spaceship_free (void);
111   spaceship_struct *spaceship_get (void);
112   void spaceship_energy_restore (void);
113   void spaceship_invincibility (void);
114   void spaceship_show (void);
115   void spaceship_initialize (void);
116   void spaceship_gameover (void);
117   void spaceship_downgrading (void);
118   void spaceship_set_invincibility (Sint16 invincibility);
119   void spaceship_control_movements (void);
120   bool spaceship_upgrading (void);
121   void spaceship_most_powerfull (void);
122   bool spaceship_enemy_collision (enemy * foe, float speed_x, float speed_y);
123   bool spaceship_shot_collision (Sint32 x1, Sint32 y1, shot_struct * bullet);
124   void spaceship_speed_control (void);
125   void spaceship_draw (void);
126 
127   extern bool spaceship_disappears;
128   extern Sint32 spaceship_appears_count;
129   extern bool spaceship_is_dead;
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif
136