bad_guy vs. player collision fixes.
[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 #include "physic.h"
24
25 /* Times: */
26
27 #define TUX_SAFE_TIME 750
28 #define TUX_INVINCIBLE_TIME 10000
29 #define TIME_WARNING 20000     /* When to alert player they're low on time! */
30
31 /* One-ups... */
32
33 #define DISTROS_LIFEUP 100
34
35 /* Scores: */
36
37 #define SCORE_BRICK 5
38 #define SCORE_DISTRO 25
39
40 typedef struct player_keymap_type
41 {
42  int jump;
43  int duck;
44  int left;
45  int right;
46  int fire;
47 }
48 player_keymap_type;
49
50 typedef struct player_input_type
51 {
52  int right;
53  int left;
54  int up;
55  int down;
56  int fire;
57  int old_fire;
58 }
59 player_input_type;
60
61 void player_input_init(player_input_type* pplayer_input);
62
63 typedef struct player_type 
64 {
65  player_input_type input;
66  player_keymap_type keymap;
67  int score;
68  int distros;
69  int got_coffee;
70  int size;
71  int duck;
72  int dying;
73  int dir;
74  int jumping;
75  int frame_main;
76  int frame;
77  int lives;
78  base_type base;
79  base_type old_base;
80  base_type previous_base;
81  timer_type invincible_timer;
82  timer_type skidding_timer;
83  timer_type safe_timer;
84  timer_type frame_timer;
85  physic_type vphysic;
86  physic_type hphysic;
87 }
88 player_type;
89
90 extern texture_type tux_life,
91  tux_right[3],  tux_left[3],
92  bigtux_right[3],  bigtux_left[3],
93  bigtux_right_jump,  bigtux_left_jump,
94  ducktux_right,  ducktux_left,
95  skidtux_right,  skidtux_left,
96  firetux_right[3],  firetux_left[3],
97  bigfiretux_right[3],  bigfiretux_left[3],
98  bigfiretux_right_jump,  bigfiretux_left_jump,
99  duckfiretux_right,  duckfiretux_left,
100  skidfiretux_right,  skidfiretux_left,
101  cape_right[2],  cape_left[2],
102  bigcape_right[2],  bigcape_left[2];
103
104 void player_init(player_type* pplayer);
105 int player_key_event(player_type* pplayer, SDLKey key, int state);
106 void player_level_begin(player_type* pplayer);
107 void player_action(player_type* pplayer);
108 void player_input(player_type* pplayer);
109 void player_grabdistros(player_type *pplayer);
110 void player_draw(player_type* pplayer);
111 void player_collision(player_type* pplayer,void* p_c_object, int c_object);
112 void player_kill(player_type *pplayer, int mode);
113 void player_dying(player_type *pplayer);
114 void player_remove_powerups(player_type *pplayer);
115 void player_keep_in_bounds(player_type *pplayer);
116 int player_on_ground(player_type *pplayer);
117 int player_under_solid(player_type *pplayer);
118
119 #endif /*SUPERTUX_PLAYER_H*/