-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbullet.h
89 lines (64 loc) · 1.61 KB
/
bullet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef BULLET_H
#define BULLET_H
#include <math.h>
#include <SDL.h>
#include <SDL_image.h>
#include "graphic.h"
typedef enum
{
minus_blue,
minus_black,
minus_red,
minus_big_brown,
ball_blue,
ball_black,
ball_red,
blue_one,
blue_zero,
red_one,
red_zero,
plus_red,
plus_big_brown,
bullet_z,
greycode,
venn_elipse,
dot_black,
dot_blue,
e_blue,
BULLET_TYPE_MAX
}bullet_type;
typedef enum
{
player_team,
enemy_team
}bullet_team;
typedef struct enemy enemy;
typedef struct bullet bullet;
struct bullet
{
bullet_type type;
bullet_team team;
/* needed to prevent collision between enemy and his own bullet */
enemy *shot_by;
double x, y;
double dir_x, dir_y;
int splitter;
double speed;
Uint32 last_move;
int power;
bullet *next;
bullet *prev;
};
extern int init_bullet(void);
extern bullet *new_bullet(const bullet_team team, const bullet_type type, enemy *shot_by, const double x, const double y,
const double dir_x, const double dir_y, const int splitter, const double speed, const int power);
extern void free_bullet(bullet *object);
extern bullet *get_first_bullet(void);
extern int get_bullet_w(const bullet_type type);
extern int get_bullet_h(const bullet_type type);
extern void move_all_bullets(void);
extern void blit_all_bullets(SDL_Surface *dst);
extern void extend_all_bullets_timestamp(const Uint32 time);
extern void free_all_bullets(void);
extern void splitter_bullet(const bullet *blt, enemy *shot_by, const double x, const double y, const int w, const int h, const int amount);
#endif