huge CVS merge, see ChangeLog for details.
[supertux.git] / src / player.h
1 //
2 // Interface: player/tux
3 //
4 // Description: 
5 //
6 //
7 // Author: Tobias Glaesser <tobi.web@gmx.de>, (C) 2003
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12
13 #ifndef SUPERTUX_PLAYER_H
14 #define SUPERTUX_PLAYER_H
15
16 #include <SDL.h>
17 #include "bitmask.h"
18 #include "type.h"
19 #include "timer.h"
20 #include "texture.h"
21 #include "collision.h"
22 #include "sound.h"
23
24 /* Times: */
25
26 #define TUX_SAFE_TIME 750
27 #define TUX_INVINCIBLE_TIME 10000
28 #define TIME_WARNING 20000     /* When to alert player they're low on time! */
29
30 typedef struct player_keymap_type
31 {
32  int jump;
33  int duck;
34  int left;
35  int right;
36  int fire;
37 }
38 player_keymap_type;
39
40 typedef struct player_input_type
41 {
42  int right;
43  int left;
44  int up;
45  int down;
46  int fire;
47  int old_fire;
48 }
49 player_input_type;
50
51 typedef struct player_type 
52 {
53  player_input_type input;
54  player_keymap_type keymap;
55  int got_coffee;
56  int size;
57  int duck;
58  int dying;
59  int dir;
60  int jumping;
61  int frame_main;
62  int frame;
63  int lives;
64  base_type base;
65  timer_type invincible_timer;
66  timer_type jump_timer;
67  timer_type skidding_timer;
68  timer_type safe_timer;
69 }
70 player_type;
71
72 extern texture_type tux_life,
73  tux_right[3],  tux_left[3],
74  bigtux_right[3],  bigtux_left[3],
75  bigtux_right_jump,  bigtux_left_jump,
76  ducktux_right,  ducktux_left,
77  skidtux_right,  skidtux_left,
78  firetux_right[3],  firetux_left[3],
79  bigfiretux_right[3],  bigfiretux_left[3],
80  bigfiretux_right_jump,  bigfiretux_left_jump,
81  duckfiretux_right,  duckfiretux_left,
82  skidfiretux_right,  skidfiretux_left,
83  cape_right[2],  cape_left[2],
84  bigcape_right[2],  bigcape_left[2];
85
86 void player_init(player_type* pplayer);
87 int player_keydown_event(player_type* pplayer, SDLKey key);
88 int player_keyup_event(player_type* pplayer, SDLKey key);
89 void player_level_begin(player_type* pplayer);
90 void player_action(player_type* pplayer);
91 void player_input(player_type* pplayer);
92 void player_grabdistros(player_type *pplayer);
93 void player_draw(player_type* pplayer);
94 void player_collision(player_type* pplayer,void* p_c_object, int c_object);
95 void player_kill(player_type *pplayer, int mode);
96 void player_dying(player_type *pplayer);
97 void player_remove_powerups(player_type *pplayer);
98 void player_keep_in_bounds(player_type *pplayer);
99
100 #endif /*SUPERTUX_PLAYER_H*/