fixed a few bugs. (One of them thanks to a patch from Ricardo). Made more code cleanu...
[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
23 /* Times: */
24
25 #define TUX_SAFE_TIME 750
26 #define TUX_INVINCIBLE_TIME 10000
27 #define TIME_WARNING 20000     /* When to alert player they're low on time! */
28
29 typedef struct player_keymap_type
30 {
31  int jump;
32  int duck;
33  int left;
34  int right;
35  int fire;
36 }
37 player_keymap_type;
38
39 typedef struct player_input_type
40 {
41  int right;
42  int left;
43  int up;
44  int down;
45  int fire;
46  int old_fire;
47 }
48 player_input_type;
49
50 typedef struct player_type 
51 {
52  player_input_type input;
53  player_keymap_type keymap;
54  int got_coffee;
55  int size;
56  int duck;
57  int dying;
58  int dir;
59  int jumping;
60  int frame_main;
61  int frame;
62  int lives;
63  base_type base;
64  timer_type invincible_timer;
65  timer_type jump_timer;
66  timer_type skidding_timer;
67  timer_type safe_timer;
68 }
69 player_type;
70
71 texture_type tux_life,
72  tux_right[3],  tux_left[3],
73  bigtux_right[3],  bigtux_left[3],
74  bigtux_right_jump,  bigtux_left_jump,
75  ducktux_right,  ducktux_left,
76  skidtux_right,  skidtux_left,
77  firetux_right[3],  firetux_left[3],
78  bigfiretux_right[3],  bigfiretux_left[3],
79  bigfiretux_right_jump,  bigfiretux_left_jump,
80  duckfiretux_right,  duckfiretux_left,
81  skidfiretux_right,  skidfiretux_left,
82  cape_right[2],  cape_left[2],
83  bigcape_right[2],  bigcape_left[2];
84
85 void player_init(player_type* pplayer);
86 int player_keydown_event(player_type* pplayer, SDLKey key);
87 int player_keyup_event(player_type* pplayer, SDLKey key);
88 void player_level_begin(player_type* pplayer);
89 void player_action(player_type* pplayer);
90 void player_input(player_type* pplayer);
91 void player_grabdistros(player_type *pplayer);
92 void player_draw(player_type* pplayer);
93 void player_collision(player_type* pplayer,void* p_c_object, int c_object);
94 void player_kill(player_type *pplayer, int mode);
95 void player_dying(player_type *pplayer);
96 void player_remove_powerups(player_type *pplayer);
97 void player_keep_in_bounds(player_type *pplayer);
98
99 #endif /*SUPERTUX_PLAYER_H*/