c3f05e6e0e5c6921c5bf1ce8c927a22dfb785738
[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 "collision.h"
20
21 /* Times: */
22
23 #define TUX_SAFE_TIME 16
24 #define TUX_INVINCIBLE_TIME 10000
25 #define TIME_WARNING 20000     /* When to alert player they're low on time! */
26
27 typedef struct player_input_type
28 {
29  int right;
30  int left;
31  int up;
32  int down;
33  int fire;
34  int old_fire;
35 }
36 player_input_type;
37
38 typedef struct player_type 
39 {
40  player_input_type input;
41  int got_coffee;
42  int size;
43  int skidding;
44  int safe;
45  int duck;
46  int dying;
47  int dir;
48  int jumping;
49  int frame_main;
50  int frame;
51  int lives;
52  float x;
53  float y;
54  float xm;
55  float ym;
56  float width;
57  float height;
58  timer_type invincible_timer;
59  timer_type jump_timer;
60  unsigned int updated;
61  itop_type it;
62 }
63 player_type;
64
65 texture_type tux_life,
66  tux_right[3],  tux_left[3],
67  bigtux_right[3],  bigtux_left[3],
68  bigtux_right_jump,  bigtux_left_jump,
69  ducktux_right,  ducktux_left,
70  skidtux_right,  skidtux_left,
71  firetux_right[3],  firetux_left[3],
72  bigfiretux_right[3],  bigfiretux_left[3],
73  bigfiretux_right_jump,  bigfiretux_left_jump,
74  duckfiretux_right,  duckfiretux_left,
75  skidfiretux_right,  skidfiretux_left,
76  cape_right[2],  cape_left[2],
77  bigcape_right[2],  bigcape_left[2];
78
79 void player_init(player_type* pplayer);
80 void player_level_begin(player_type* pplayer);
81 void player_action(player_type* pplayer);
82 void player_input(player_type* pplayer);
83 void player_grabdistros(player_type *pplayer);
84 void player_draw(player_type* pplayer);
85 void player_collision(player_type* pplayer,void* p_c_object, int c_object);
86 void player_kill(player_type *pplayer, int mode);
87 void player_dying(player_type *pplayer);
88 void player_remove_powerups(player_type *pplayer);
89 void player_keep_in_bounds(player_type *pplayer);
90
91 #endif /*SUPERTUX_PLAYER_H*/