-
Notifications
You must be signed in to change notification settings - Fork 0
/
defines.h
285 lines (215 loc) · 5.76 KB
/
defines.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#ifndef _DEFINES_H
#define _DEFINES_H
#include <z80.h>
#include <arch/zx.h>
#include <arch/zx/sp1.h>
#include <input.h>
#define BACKGROUND_GREEN 0x60
#define Y_POS 0
#define X_POS 1
#define UNDEF 250
#define NONE 0
#define WON_LEVEL 10
#define DOG_AWAKEN 30
#define ELECTRIFIED 40
#define FALLING_HEARTS 50
#define YES 1
#define CLEAN 1
#define BIN_Y1 15
#define BIN_Y2 16
#define WALKING_LEFT 1
#define WALKING_RIGHT 2
#define JUMPING 3
#define FALLING 4
#define WALKING_UP 59
#define WALKING_DOWN 60
#define FALLING_FLOOR 69
#define BITE 55
#define OXYGEN 99
#define FIGHTING 5
#define CAT_IN_ROPE 6
#define CAT_IN_ROPE1 7
#define CAT_IN_ROPE2 8
#define CAT_IN_ROPE3 9
#define CAT_IN_SHELVE 20
#define CAT_ON_HIGH 10
#define JUMPING_PUSHED 11
#define SWIMMING 12
#define JUMP_UP 0
#define JUMP_RIGHT 1
#define JUMP_LEFT 2
#define CAT_IN_BIN 3
#define CAT_IN_FENCE 4
#define HIGHER_BIN_X 2 // bins are from 1 - 5
#define HIGHER_BIN_X2 4
#define FLOOR_Y 21
#define AUX_BINCAT 0
#define SPIDER 48 // (16 * 2) + 16
#define RIGHTC1 0
#define RIGHTC2 64
#define LEFTC1 128
#define LEFTC2 192
#define JLEFTC1 256
#define JRIGHTC1 320
#define JUMPINGC1 384
#define BORED 448
#define HANGING 512
#define FALL_OFFSET 576
#define AUX_PHONE 0
#define AUX_ZAP 48 // + 16x2 + 8x2
#define AUX_ARROWRIGHT 96
#define AUX_ARROWLEFT 144
#define AUX_BROOM 192
#define AUX_BROOM2 240
#define SWIM_RC1 0
#define SWIM_RC2 32 // 24 + 8
#define SWIM_LC1 64
#define SWIM_LC2 96
#define SWIM_UP1 128
#define SWIM_DOWN1 160
#define MISIOFFSET 33
#define OUCHOFFSET 65
#define LOVEOFFSET 97
#define Y_AXIS 0
#define X_AXIS 1
#define FISHES_HORIZ_DIR 2
#define FISHES_VERT_DIR 3
#define LEVELFINISHED 100
#define UP 64
#define DOWN 128
#define LEFT 1
#define RIGHT 2
#define FISH_LEFT 'B'
#define FISH_RIGHT 'A'
#define BIRD 244
#define FRAME_CHANGE 2
#define DOG1 0
#define DOG2 48
#define DOGFIGHTING1 96
#define DOGFIGHTING2 144
#define SONG_RESTART 250
#define UDG_UDG_CORAZON_01 134
#define UDG_UDG_CORAZON_02 135
#define MAX_X 32
extern struct sp1_Rect;
extern struct prota misifu;
extern struct freesprite aux_object;
extern struct sp1_ss *dogr1sp;
extern struct sp1_ss *bincatsp;
extern struct sp1_ss *birdsp;
extern struct sp1_Rect full_screen;
extern uint8_t level_x_max;
extern uint8_t level_x_min;
extern uint8_t window_shown;
// shared vars
extern uint8_t x, y;
extern uint8_t paws;
// game required vars
// useful for controlling amount of things to eat (mouses, fishes, ...)
/*extern char left;
extern char right;*/
extern uint8_t eaten_items;
extern uint8_t frame;
extern uint8_t x_malo;
extern uint8_t bincat_appears;
extern uint8_t enemy_apears;
extern uint8_t row1_moving;
extern uint8_t bincat_in_bin;
extern uint8_t dog_offset;
// keeps animation frames when something takes longer
extern uint8_t anim_frames;
//extern uint8_t udgxs[];
extern uint8_t first_keypress;
extern uint8_t idx;
extern uint8_t idx_j;
extern uint8_t random_value;
extern uint8_t opened_window;
extern uint8_t opened_window_frames;
extern uint8_t level;
extern uint8_t lives;
extern uint8_t last_success_level; // to see user progress
extern uint8_t repaint_lives;
extern uint8_t level_time;
extern uint16_t total_points;
extern uint8_t tiles_lvl1[];
extern uint8_t floor_holes[][12];
// level 2 cheese
extern const uint8_t hole_empty[];
extern const uint8_t hole_mouse[];
extern const uint8_t cheese2[];
extern const uint8_t curtain[];
extern uint8_t sprite_protar1[];
extern uint8_t sprite_protar2[];
extern uint8_t sprite_protar3[];
extern uint8_t sprite_dog1[];
extern uint8_t sprite_dog2[];
extern uint8_t sprite_dog3[];
extern uint8_t sprite_bincat1[];
extern uint8_t sprite_bincat2[];
extern uint8_t sprite_bincat3[];
extern uint8_t sprite_bird1[];
extern uint8_t auxiliar1[];
extern uint8_t auxiliar2[];
extern uint8_t sprite_swim1[];
extern uint8_t sprite_swim2[];
extern uint8_t sprite_swim3[];
extern uint8_t sprite_swim4[];
// level 1
extern struct udgstruct windows[14];
extern const uint8_t bin_places2[];
// variable used for free objects (e.g. kitchen object thrown from window)
extern uint8_t horizontal_direction;
extern inline void add_sprites_for_all_levels();
struct prota {
struct sp1_ss* sp;
uint8_t x;
uint8_t y;
uint8_t initial_jump_y;
uint8_t draw_additional;
unsigned int offset;
uint8_t in_bin;
uint8_t state;
uint8_t last_key;
};
struct freesprite {
struct sp1_ss* sp;
uint8_t offset;
uint8_t y;
uint8_t x;
};
struct udgstruct {
uint8_t y;
uint8_t x;
char has_item;
};
extern JOYFUNC joy;
extern udk_t joy_keys;
extern uint16_t in;
extern void all_lives_lost();
extern void show_cupids();
extern void print_points(uint8_t row, uint8_t col);
extern void reset_misifu_position();
// reference: https://github.com/z88dk/z88dk/blob/master/include/_DEVELOPMENT/sdcc/arch/zx/sp1.h#L83
// extern void page(uint8_t bank);
extern void check_keys();
extern void check_level7_keys();
extern void dog_checks();
extern void check_swim();
extern void check_fsm();
extern void print_room_walls(uint8_t initial_window, uint8_t paper_color, uint8_t ink_color);
extern void paint_chair(uint8_t col, uint8_t color);
extern void paint_portrait(uint8_t color);
extern void paint_chair2(uint8_t col, uint8_t color);
extern void detect_fall_in_chair(uint8_t x_chair, uint8_t bin);
extern void paint_table(uint8_t col, uint8_t color);
extern void paint_lamp(uint8_t row, uint8_t color);
extern void get_out_of_level_generic(uint8_t fall);
extern void detect_cat_in_window(uint8_t offset);
extern void move_broom();
extern inline struct sp1_ss * add_sprite_swim();
extern struct sp1_ss * add_sprite_protar1();
extern inline struct sp1_ss * add_sprite_bird();
extern void detect_fall_in_table(uint8_t offset);
extern void move_right_and_left();
extern void assign_hearts();
#endif