]> icculus.org git repositories - crow/jumpnbump.git/blob - globals.h
Modified Linux source.
[crow/jumpnbump.git] / globals.h
1 #ifndef __GLOBALS_H
2 #define __GLOBALS_H
3
4 #include "config.h"
5
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <strings.h>
10 #include <time.h>
11 #include <math.h>
12 #include <dj.h>
13
14 #ifdef DOS
15 # include <conio.h>
16 # include <dpmi.h>
17 # include <sys/nearptr.h>
18 # include <pc.h>
19 #endif
20
21 #ifdef USE_SDL
22 # include <sys/stat.h>
23 # include <SDL/SDL.h>
24 # include <SDL/SDL_mixer.h>
25 #endif
26
27 #ifndef USE_SDL
28 #define KEY_PL1_LEFT 0xcb
29 #define KEY_PL1_RIGHT   0xcd
30 #define KEY_PL1_JUMP 0xc8
31 #define KEY_PL2_LEFT 0x1e
32 #define KEY_PL2_RIGHT   0x20
33 #define KEY_PL2_JUMP 0x11
34 #else
35 #define KEY_PL1_LEFT SDLK_LEFT
36 #define KEY_PL1_RIGHT   SDLK_RIGHT
37 #define KEY_PL1_JUMP SDLK_UP
38 #define KEY_PL2_LEFT SDLK_a
39 #define KEY_PL2_RIGHT   SDLK_d
40 #define KEY_PL2_JUMP SDLK_w
41 #define KEY_PL3_LEFT SDLK_j
42 #define KEY_PL3_RIGHT   SDLK_l
43 #define KEY_PL3_JUMP SDLK_i
44 #define KEY_PL4_LEFT SDLK_KP4
45 #define KEY_PL4_RIGHT   SDLK_KP6
46 #define KEY_PL4_JUMP SDLK_KP8
47 #endif
48
49 #define NUM_POBS 200
50 #define NUM_OBJECTS 200
51 #define NUM_FLIES 20
52 #define NUM_LEFTOVERS 50
53
54 #define OBJ_SPRING 0
55 #define OBJ_SPLASH 1
56 #define OBJ_SMOKE 2
57 #define OBJ_YEL_BUTFLY 3
58 #define OBJ_PINK_BUTFLY 4
59 #define OBJ_FUR 5
60 #define OBJ_FLESH 6
61 #define OBJ_FLESH_TRACE 7
62
63 #define OBJ_ANIM_SPRING 0
64 #define OBJ_ANIM_SPLASH 1
65 #define OBJ_ANIM_SMOKE 2
66 #define OBJ_ANIM_YEL_BUTFLY_RIGHT 3
67 #define OBJ_ANIM_YEL_BUTFLY_LEFT 4
68 #define OBJ_ANIM_PINK_BUTFLY_RIGHT 5
69 #define OBJ_ANIM_PINK_BUTFLY_LEFT 6
70 #define OBJ_ANIM_FLESH_TRACE 7
71
72 #define MOD_MENU 0
73 #define MOD_GAME 1
74 #define MOD_SCORES 2
75
76 #define SFX_JUMP 0
77 #define SFX_LAND 1
78 #define SFX_DEATH 2
79 #define SFX_SPRING 3
80 #define SFX_SPLASH 4
81 #define SFX_FLY 5
82
83 #define SFX_JUMP_FREQ 15000
84 #define SFX_LAND_FREQ 15000
85 #define SFX_DEATH_FREQ 20000
86 #define SFX_SPRING_FREQ 15000
87 #define SFX_SPLASH_FREQ 12000
88 #define SFX_FLY_FREQ 12000
89
90
91 struct {
92         char joy_enabled, mouse_enabled, num_mouse_buttons;
93         char no_sound, no_gore, fireworks;
94         char error_str[256];
95         int draw_page, view_page;
96         struct {
97                 int num_pobs;
98                 struct {
99                         int x, y;
100                         int image;
101                         char *pob_data;
102                         int back_buf_ofs;
103                 } pobs[NUM_POBS];
104         } page_info[2];
105         char *pob_backbuf[2];
106 } main_info;
107
108 struct {
109         char enabled, dead_flag;
110         int bumps;
111         int bumped[4];
112         int x, y;
113         int x_add, y_add;
114         char direction, jump_ready, jump_abort, in_water;
115         int anim, frame, frame_tick, image;
116 } player[4];
117
118 struct {
119         int num_frames;
120         int restart_frame;
121         struct {
122                 int image;
123                 int ticks;
124         } frame[4];
125 } player_anims[7];
126
127 struct {
128         char used, type;
129         int x, y;
130         int x_add, y_add;
131         int x_acc, y_acc;
132         int anim;
133         int frame, ticks;
134         int image;
135 } objects[300];
136
137 struct {
138         int x, y;
139         int raw_x, raw_y;
140         char but1, but2;
141         struct {
142                 int x1, x2, x3;
143                 int y1, y2, y3;
144         } calib_data;
145 } joy;
146
147 struct {
148         char but1, but2, but3;
149 } mouse;
150
151 char datfile_name[256];
152
153 char *background_pic;
154 char *mask_pic;
155
156 char *rabbit_gobs;
157 char *font_gobs;
158
159
160 /* main.c */
161
162 void steer_players(void);
163 void position_player(short player_num);
164 void fireworks(void);
165 void add_object(char type, short x, short y, long x_add, long y_add, short anim, short frame);
166 void update_objects(void);
167 char add_pob(char page, short x, short y, short image, char *pob_data);
168 void draw_pobs(int page);
169 void redraw_pob_backgrounds(int page);
170 char add_leftovers(int page, short x, short y, short image, char *pob_data);
171 void draw_leftovers(int page);
172 char init_level(short level);
173 void deinit_level(void);
174 char init_program(int argc, char *argv[]);
175 void deinit_program(void);
176 void read_joy(void);
177 char calib_joy(char type);
178 void read_mouse(void);
179 unsigned short rnd(unsigned short max);
180 char read_level(void);
181 FILE *dat_open(char *file_name, char *dat_name, char *mode);
182 int dat_filelen(char *file_name, char *dat_name);
183 void write_calib_data(void);
184
185
186 /* menu.c */
187
188 char menu(void);
189 char menu_init(void);
190 void menu_deinit(void);
191
192
193 /* gfx.c */
194
195 void open_screen(void);
196 void wait_vrt(void);
197 #if 0
198 void get_block(char page, short x, short y, short width, short height, char *buffer);
199 void put_block(char page, short x, short y, short width, short height, char *buffer);
200 #endif
201 void put_text(char page, int x, int y, char *text, char align);
202 void put_pob(char page, short x, short y, short image, char *pob_data, char mask, char *mask_pic);
203 char pob_col(short x1, short y1, short image1, char *pob_data1, short x2, short y2, short image2, char *pob_data2);
204 short pob_width(short image, char *pob_data);
205 short pob_height(short image, char *pob_data);
206 short pob_hs_x(short image, char *pob_data);
207 short pob_hs_y(short image, char *pob_data);
208 char read_pcx(FILE * handle, char *buffer, long buf_len, char *pal);
209
210 /* gfx.c */
211
212 void get_block(char page, long x, long y, long width, long height, char *buffer);
213 void put_block(char page, long x, long y, long width, long height, char *buffer);
214
215 #ifdef LINUX
216 long filelength(int handle);
217 void setpalette(int index, int count, char *palette);
218 void fillpalette(int red, int green, int blue);
219 void flippage(long page);
220 void fs_toggle();
221 char *get_vgaptr(long, long, long);
222 #endif
223
224 /* interrpt.c */
225
226 extern char last_keys[50];
227
228 char hook_keyb_handler(void);
229 void remove_keyb_handler(void);
230 char key_pressed(unsigned char key);
231
232 #ifdef LINUX
233 char intr_sysupdate();
234 #endif
235
236 /* sound-linux.c */
237 #ifdef LINUX
238
239 void load_song(FILE *, signed int);
240 void play_song();
241 void update_song();
242 void initsound();
243 void songquit();
244
245 #endif
246
247 #endif