]> icculus.org git repositories - crow/jumpnbump.git/blob - globals.h
Cleaned up.
[crow/jumpnbump.git] / globals.h
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <conio.h>
4 #include <dpmi.h>
5 #include <sys/nearptr.h>
6 #include <pc.h>
7 #include <string.h>
8 #include <time.h>
9 #include <math.h>
10 #include <dj.h>
11
12 #define KEY_PL1_LEFT 0xcb
13 #define KEY_PL1_RIGHT   0xcd
14 #define KEY_PL1_JUMP 0xc8
15 #define KEY_PL2_LEFT 0x1e
16 #define KEY_PL2_RIGHT   0x20
17 #define KEY_PL2_JUMP 0x11
18
19 #define NUM_POBS 200
20 #define NUM_OBJECTS 200
21 #define NUM_FLIES 20
22 #define NUM_LEFTOVERS 50
23
24 #define OBJ_SPRING 0
25 #define OBJ_SPLASH 1
26 #define OBJ_SMOKE 2
27 #define OBJ_YEL_BUTFLY 3
28 #define OBJ_PINK_BUTFLY 4
29 #define OBJ_FUR 5
30 #define OBJ_FLESH 6
31 #define OBJ_FLESH_TRACE 7
32
33 #define OBJ_ANIM_SPRING 0
34 #define OBJ_ANIM_SPLASH 1
35 #define OBJ_ANIM_SMOKE 2
36 #define OBJ_ANIM_YEL_BUTFLY_RIGHT 3
37 #define OBJ_ANIM_YEL_BUTFLY_LEFT 4
38 #define OBJ_ANIM_PINK_BUTFLY_RIGHT 5
39 #define OBJ_ANIM_PINK_BUTFLY_LEFT 6
40 #define OBJ_ANIM_FLESH_TRACE 7
41
42 #define MOD_MENU 0
43 #define MOD_GAME 1
44 #define MOD_SCORES 2
45
46 #define SFX_JUMP 0
47 #define SFX_LAND 1
48 #define SFX_DEATH 2
49 #define SFX_SPRING 3
50 #define SFX_SPLASH 4
51 #define SFX_FLY 5
52
53 #define SFX_JUMP_FREQ 15000
54 #define SFX_LAND_FREQ 15000
55 #define SFX_DEATH_FREQ 20000
56 #define SFX_SPRING_FREQ 15000
57 #define SFX_SPLASH_FREQ 12000
58 #define SFX_FLY_FREQ 12000
59
60
61 struct {
62         char joy_enabled, mouse_enabled, num_mouse_buttons;
63         char no_sound, no_gore, fireworks;
64         char error_str[256];
65         char draw_page, view_page;
66         struct {
67                 int num_pobs;
68                 struct {
69                         int x, y;
70                         int image;
71                         char *pob_data;
72                         int back_buf_ofs;
73                 } pobs[NUM_POBS];
74         } page_info[2];
75         char *pob_backbuf[2];
76 } main_info;
77
78 struct {
79         char enabled, dead_flag;
80         int bumps;
81         int bumped[4];
82         int x, y;
83         int x_add, y_add;
84         char direction, jump_ready, jump_abort, in_water;
85         int anim, frame, frame_tick, image;
86 } player[4];
87
88 struct {
89         int num_frames;
90         int restart_frame;
91         struct {
92                 int image;
93                 int ticks;
94         } frame[4];
95 } player_anims[7];
96
97 struct {
98         char used, type;
99         int x, y;
100         int x_add, y_add;
101         int x_acc, y_acc;
102         int anim;
103         int frame, ticks;
104         int image;
105 } objects[300];
106
107 struct {
108         int x, y;
109         int raw_x, raw_y;
110         char but1, but2;
111         struct {
112                 int x1, x2, x3;
113                 int y1, y2, y3;
114         } calib_data;
115 } joy;
116
117 struct {
118         char but1, but2, but3;
119 } mouse;
120
121 char datfile_name[256];
122
123 char *background_pic;
124 char *mask_pic;
125
126 char *rabbit_gobs;
127 char *font_gobs;
128
129
130 // main.c
131
132 void steer_players(void);
133 void position_player(short player_num);
134 void fireworks(void);
135 void add_object(char type, short x, short y, long x_add, long y_add, short anim, short frame);
136 void update_objects(void);
137 char add_pob(char page, short x, short y, short image, char *pob_data);
138 void draw_pobs(char page);
139 void redraw_pob_backgrounds(char page);
140 char add_leftovers(char page, short x, short y, short image, char *pob_data);
141 void draw_leftovers(char page);
142 char init_level(short level);
143 void deinit_level(void);
144 char init_program(int argc, char *argv[]);
145 void deinit_program(void);
146 void read_joy(void);
147 char calib_joy(char type);
148 void read_mouse(void);
149 unsigned short rnd(unsigned short max);
150 char read_level(void);
151 FILE *dat_open(char *file_name, char *dat_name, char *mode);
152 int dat_filelen(char *file_name, char *dat_name);
153 void write_calib_data(void);
154
155
156 // menu.c
157
158 char menu(void);
159 char menu_init(void);
160 void menu_deinit(void);
161
162
163 // gfx.c
164
165 void open_screen(void);
166 void wait_vrt(void);
167 #if 0
168 void get_block(char page, short x, short y, short width, short height, char *buffer);
169 void put_block(char page, short x, short y, short width, short height, char *buffer);
170 #endif
171 void put_text(char page, int x, int y, char *text, char align);
172 void put_pob(char page, short x, short y, short image, char *pob_data, char mask, char *mask_pic);
173 char pob_col(short x1, short y1, short image1, char *pob_data1, short x2, short y2, short image2, char *pob_data2);
174 short pob_width(short image, char *pob_data);
175 short pob_height(short image, char *pob_data);
176 short pob_hs_x(short image, char *pob_data);
177 short pob_hs_y(short image, char *pob_data);
178 char read_pcx(FILE * handle, char *buffer, long buf_len, char *pal);
179
180 // gfx.s
181
182 void get_block(char page, long x, long y, long width, long height, char *buffer);
183 void put_block(char page, long x, long y, long width, long height, char *buffer);
184
185
186 // interrpt.c
187
188 volatile char last_keys[50];
189
190 char hook_keyb_handler(void);
191 void remove_keyb_handler(void);
192 char key_pressed(unsigned char key);