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