Merge branch 'master' of git://github.com/BTAxis/naev into testmission
[naev.git] / src / player.h
blob54b92c6540443f92c87a403ad31c87112ccff1a5
1 /*
2 * See Licensing and Copyright notice in naev.h
3 */
7 #ifndef PLAYER_H
8 # define PLAYER_H
11 #include "pilot.h"
14 /* flag defines */
15 #define PLAYER_TURN_LEFT (1<<0) /**< player is turning left */
16 #define PLAYER_TURN_RIGHT (1<<1) /**< player is turning right */
17 #define PLAYER_REVERSE (1<<2) /**< player is facing opposite of vel */
18 #define PLAYER_AFTERBURNER (1<<3) /**< player is afterburning */
19 #define PLAYER_DESTROYED (1<<9) /**< player is destroyed */
20 #define PLAYER_FACE (1<<10) /**< player is facing target */
21 #define PLAYER_PRIMARY (1<<11) /**< player is shooting primary weapon */
22 #define PLAYER_PRIMARY_L (1<<12) /**< player shot primary weapon last frame. */
23 #define PLAYER_SECONDARY (1<<13) /**< player is shooting secondary weapon */
24 #define PLAYER_SECONDARY_L (1<<14) /**< player shot secondary last frame. */
25 #define PLAYER_LANDACK (1<<15) /**< player has permission to land */
26 #define PLAYER_CREATING (1<<16) /**< player is being created */
27 #define PLAYER_AUTONAV (1<<17) /**< player has autonavigation on. */
28 /* flag functions */
29 #define player_isFlag(f) (player_flags & (f)) /**< Checks for a player flag. */
30 #define player_setFlag(f) (player_flags |= (f)) /**< Sets a player flag. */
31 #define player_rmFlag(f) (player_flags &= ~(f)) /**< Removes a player flag. */
35 * the player
37 extern Pilot* player; /**< Player himself. */
38 extern char* player_name; /**< Player's name. */
39 extern unsigned int player_flags; /**< Player's flags. */
40 extern double player_crating; /**< Player's combat rating. */
41 extern int player_enemies; /**< Amount of enemies player has. */
44 * Targetting.
46 extern int planet_target; /**< Targetted planet. -1 is none. */
47 extern int hyperspace_target; /**< Targetted hyperspace route. -1 is none. */
51 * Common player sounds.
53 extern int snd_target; /**< Sound when targetting. */
54 extern int snd_jump; /**< Sound when can jump. */
55 extern int snd_nav; /**< Sound when changing nav computer. */
56 extern int snd_hail; /**< Hail sound. */
57 extern int snd_hypPowUp; /**< Hyperspace power up sound. */
58 extern int snd_hypEng; /**< Hyperspace engine sound. */
59 extern int snd_hypPowDown; /**< Hyperspace power down sound. */
60 extern int snd_hypPowUpJump; /**< Hyperspace Power up to jump sound. */
61 extern int snd_hypJump; /**< Hyperspace jump sound. */
65 * creation/cleanup
67 void player_new (void);
68 int player_newShip( Ship* ship, double px, double py,
69 double vx, double vy, double dir, const char *def_name );
70 void player_cleanup (void);
71 int gui_load (const char* name);
75 * render
77 void player_render( double dt );
81 * misc
83 void player_messageRaw ( const char *str );
84 void player_message ( const char *fmt, ... );
85 void player_clear (void);
86 void player_warp( const double x, const double y );
87 const char* player_rating (void);
88 int player_hasCredits( int amount );
89 unsigned long player_modCredits( int amount );
90 void player_hailStart (void);
91 /* Sounds. */
92 void player_playSound( int sound, int once );
93 void player_stopSound (void);
94 void player_soundPause (void);
95 void player_soundResume (void);
96 /* cargo */
97 int player_cargoOwned( const char* commodityname );
100 * player ships
102 void player_ships( char** sships, glTexture** tships );
103 int player_nships (void);
104 int player_hasShip( char* shipname );
105 Pilot* player_getShip( char* shipname );
106 char* player_getLoc( char* shipname );
107 void player_setLoc( char* shipname, char* loc );
108 void player_swapShip( char* shipname );
109 int player_shipPrice( char* shipname );
110 void player_rmShip( char* shipname );
114 * player outfits.
116 int player_outfitOwned( const Outfit *o );
117 void player_getOutfits( char** soutfits, glTexture** toutfits );
118 int player_numOutfits (void);
119 int player_addOutfit( const Outfit *o, int quantity );
120 int player_rmOutfit( const Outfit *o, int quantity );
124 * player missions
126 void player_missionFinished( int id );
127 int player_missionAlreadyDone( int id );
131 * player events
133 void player_eventFinished( int id );
134 int player_eventAlreadyDone( int id );
138 * licenses
140 void player_addLicense( char *license );
141 int player_hasLicense( char *license );
142 char **player_getLicenses( int *nlicenses );
146 * escorts
148 void player_clearEscorts (void);
149 int player_addEscorts (void);
153 * pilot related stuff
155 void player_dead (void);
156 void player_destroyed (void);
157 void player_think( Pilot* pplayer, const double dt );
158 void player_update( Pilot *pplayer, const double dt );
159 void player_updateSpecific( Pilot *pplayer, const double dt );
160 void player_brokeHyperspace (void);
161 double player_faceHyperspace (void);
165 * keybind actions
167 void player_targetHostile (void);
168 void player_targetNext( int mode );
169 void player_targetPrev( int mode );
170 void player_targetNearest (void);
171 void player_targetEscort( int prev );
172 void player_targetClear (void);
173 void player_secondaryNext (void);
174 void player_secondaryPrev (void);
175 void player_targetPlanet (void);
176 void player_land (void);
177 void player_targetHyperspace (void);
178 void player_jump (void);
179 void player_screenshot (void);
180 void player_afterburn (void);
181 void player_afterburnOver (void);
182 void player_accel( double acc );
183 void player_accelOver (void);
184 void player_startAutonav (void);
185 void player_abortAutonav( char *reason );
186 void player_startAutonavWindow( unsigned int wid, char *str);
187 void player_hail (void);
188 void player_autohail (void);
189 void player_setFireMode( int mode );
192 #endif /* PLAYER_H */