1 struct moving_bubble
2 {
3   float x;
4   float y;
5   float velx;
6   float vely;
7 
8   int lastpaintx;
9   int lastpainty;
10   int evil;
11 
12   unsigned char falling;
13   unsigned char color;
14 };
15 
16 struct player_state
17 {
18   unsigned char field[14][16];
19 
20   int bubble;
21   int next_bubble;
22 
23   float angle;
24   int right;
25 
26   int dirty_minx;
27   int dirty_miny;
28   int dirty_maxx;
29   int dirty_maxy;
30   float last_angle;
31 
32   int score;
33   int ready;
34 
35   struct moving_bubble mbubbles[256];
36 
37   unsigned char evil_bubbles[128];
38   int evil_bubble_count;
39   int max_evil;
40   unsigned int evil_bubble_seed;
41 };
42 
43 extern int time_stepms;
44 extern float time_step;
45 static const int field_height = 14;
46 static const int max_field_width = 8;
47 static const float bubble_speed = 500;
48 static const int max_x = 414 - 190;
49 #define WIDTH(y) (((y) & 1) ? 7 : 8)
50 
51 #define SET_RECT(r, xv, yv, wv, hv) do { (r).x = (xv); (r).y = (yv); (r).w = (wv); (r).h = (hv); } while(0)
52 
53 extern SDL_Surface* screen;
54 
55 extern SDL_Surface* logo;
56 extern SDL_Surface* background;
57 extern SDL_Surface* base[129];
58 extern SDL_Surface* bubbles[8];
59 
60 static const int width = 640;
61 static const int height = 480;
62 extern int fullscreen;
63 extern int sound_enable;
64 
65 extern unsigned int rng_seed;
66 
67 int stick(struct player_state* p, int bx, int by, int color);
68 void mark_dirty(struct player_state* p, int x, int y, int width, int height);
69 void cond_blit(struct player_state* p, SDL_Surface* source, SDL_Rect* source_rect, SDL_Surface* dest, SDL_Rect* dest_rect);
70 void show_splash();
71 void shoot(struct player_state* p, int color, int velocity);
72 void init_player(struct player_state* p);
73 
74 unsigned int rng();
75 
76 void load_images();
77 SDL_Surface* get_image(const char* name);
78 
79 void load_font();
80 int has_char(int font, int ch);
81 void print_string(int font, int x, int y, const wchar_t* string, int align);
82 int string_width(int font, const wchar_t* string, size_t length);
83