3329c4883abf31a2965ae2ec26d65155b86b2dd1
[rocksndiamonds.git] / src / game_em / emerald.h
1 #ifndef EMERALD_H
2 #define EMERALD_H
3
4 /* 2000-07-30T11:06:03Z */
5
6 // ----------------------------------------------------------------------------
7 // constant definitions
8 // ----------------------------------------------------------------------------
9
10 /* define these for backwards compatibility */
11 #define EM_ENGINE_BAD_ROLL
12 #define EM_ENGINE_BAD_SPRING
13
14 /* define these to use additional elements */
15 #define EM_ENGINE_USE_ADDITIONAL_ELEMENTS
16
17 /* internal definitions for EM engine */
18 #ifdef EM_ENGINE_BAD_ROLL
19 #define BAD_ROLL
20 #endif
21
22 #ifdef EM_ENGINE_BAD_SPRING
23 #define BAD_SPRING
24 #endif
25
26 /* one border for ZBORDER elements, one border for steelwall, if needed */
27 #define EM_MAX_CAVE_WIDTH               (MAX_PLAYFIELD_WIDTH  + 2 + 2)
28 #define EM_MAX_CAVE_HEIGHT              (MAX_PLAYFIELD_HEIGHT + 2 + 2)
29
30 /*
31   -----------------------------------------------------------------------------
32   definition of elements used in the Emerald Mine Club engine;
33   the element names have the following properties:
34   - elements that start with 'X' can be stored in a level file
35   - elements that start with 'Y' indicate moving elements
36   - elements that end with 'B' are the "backside" of moving elements
37   -----------------------------------------------------------------------------
38 */
39
40 enum
41 {
42   Xblank = 0,           /* still */
43   Yacid_splash_eB,      /* hmm */
44   Yacid_splash_wB,      /* hmm */
45
46 #ifdef EM_ENGINE_BAD_ROLL
47   Xstone_force_e,       /* only use these in eater */
48   Xstone_force_w,
49   Xnut_force_e,
50   Xnut_force_w,
51   Xspring_force_e,
52   Xspring_force_w,
53   Xemerald_force_e,
54   Xemerald_force_w,
55   Xdiamond_force_e,
56   Xdiamond_force_w,
57   Xbomb_force_e,
58   Xbomb_force_w,
59 #endif
60
61   Xstone,
62   Xstone_pause,
63   Xstone_fall,
64   Ystone_s,
65   Ystone_sB,
66   Ystone_e,
67   Ystone_eB,
68   Ystone_w,
69   Ystone_wB,
70   Xnut,
71   Xnut_pause,
72   Xnut_fall,
73   Ynut_s,
74   Ynut_sB,
75   Ynut_e,
76   Ynut_eB,
77   Ynut_w,
78   Ynut_wB,
79   Xbug_n,
80   Xbug_e,
81   Xbug_s,
82   Xbug_w,
83   Xbug_gon,
84   Xbug_goe,
85   Xbug_gos,
86   Xbug_gow,
87   Ybug_n,
88   Ybug_nB,
89   Ybug_e,
90   Ybug_eB,
91   Ybug_s,
92   Ybug_sB,
93   Ybug_w,
94   Ybug_wB,
95   Ybug_w_n,
96   Ybug_n_e,
97   Ybug_e_s,
98   Ybug_s_w,
99   Ybug_e_n,
100   Ybug_s_e,
101   Ybug_w_s,
102   Ybug_n_w,
103   Ybug_stone,
104   Ybug_spring,
105   Xtank_n,
106   Xtank_e,
107   Xtank_s,
108   Xtank_w,
109   Xtank_gon,
110   Xtank_goe,
111   Xtank_gos,
112   Xtank_gow,
113   Ytank_n,
114   Ytank_nB,
115   Ytank_e,
116   Ytank_eB,
117   Ytank_s,
118   Ytank_sB,
119   Ytank_w,
120   Ytank_wB,
121   Ytank_w_n,
122   Ytank_n_e,
123   Ytank_e_s,
124   Ytank_s_w,
125   Ytank_e_n,
126   Ytank_s_e,
127   Ytank_w_s,
128   Ytank_n_w,
129   Ytank_stone,
130   Ytank_spring,
131   Xandroid,
132   Xandroid_1_n,
133   Xandroid_2_n,
134   Xandroid_1_e,
135   Xandroid_2_e,
136   Xandroid_1_w,
137   Xandroid_2_w,
138   Xandroid_1_s,
139   Xandroid_2_s,
140   Yandroid_n,
141   Yandroid_nB,
142   Yandroid_ne,
143   Yandroid_neB,
144   Yandroid_e,
145   Yandroid_eB,
146   Yandroid_se,
147   Yandroid_seB,
148   Yandroid_s,
149   Yandroid_sB,
150   Yandroid_sw,
151   Yandroid_swB,
152   Yandroid_w,
153   Yandroid_wB,
154   Yandroid_nw,
155   Yandroid_nwB,
156   Xspring,
157   Xspring_pause,
158   Xspring_e,
159   Xspring_w,
160   Xspring_fall,
161   Yspring_s,
162   Yspring_sB,
163   Yspring_e,
164   Yspring_eB,
165   Yspring_w,
166   Yspring_wB,
167   Yspring_kill_e,
168   Yspring_kill_eB,
169   Yspring_kill_w,
170   Yspring_kill_wB,
171   Xeater_n,
172   Xeater_e,
173   Xeater_w,
174   Xeater_s,
175   Yeater_n,
176   Yeater_nB,
177   Yeater_e,
178   Yeater_eB,
179   Yeater_s,
180   Yeater_sB,
181   Yeater_w,
182   Yeater_wB,
183   Yeater_stone,
184   Yeater_spring,
185   Xalien,
186   Xalien_pause,
187   Yalien_n,
188   Yalien_nB,
189   Yalien_e,
190   Yalien_eB,
191   Yalien_s,
192   Yalien_sB,
193   Yalien_w,
194   Yalien_wB,
195   Yalien_stone,
196   Yalien_spring,
197   Xemerald,
198   Xemerald_pause,
199   Xemerald_fall,
200   Xemerald_shine,
201   Yemerald_s,
202   Yemerald_sB,
203   Yemerald_e,
204   Yemerald_eB,
205   Yemerald_w,
206   Yemerald_wB,
207   Yemerald_eat,
208   Yemerald_stone,
209   Xdiamond,
210   Xdiamond_pause,
211   Xdiamond_fall,
212   Xdiamond_shine,
213   Ydiamond_s,
214   Ydiamond_sB,
215   Ydiamond_e,
216   Ydiamond_eB,
217   Ydiamond_w,
218   Ydiamond_wB,
219   Ydiamond_eat,
220   Ydiamond_stone,
221   Xdrip_fall,
222   Xdrip_stretch,
223   Xdrip_stretchB,
224   Xdrip_eat,
225   Ydrip_s1,
226   Ydrip_s1B,
227   Ydrip_s2,
228   Ydrip_s2B,
229   Xbomb,
230   Xbomb_pause,
231   Xbomb_fall,
232   Ybomb_s,
233   Ybomb_sB,
234   Ybomb_e,
235   Ybomb_eB,
236   Ybomb_w,
237   Ybomb_wB,
238   Ybomb_eat,
239   Xballoon,
240   Yballoon_n,
241   Yballoon_nB,
242   Yballoon_e,
243   Yballoon_eB,
244   Yballoon_s,
245   Yballoon_sB,
246   Yballoon_w,
247   Yballoon_wB,
248   Xgrass,
249   Ygrass_nB,
250   Ygrass_eB,
251   Ygrass_sB,
252   Ygrass_wB,
253   Xdirt,
254   Ydirt_nB,
255   Ydirt_eB,
256   Ydirt_sB,
257   Ydirt_wB,
258   Xacid_ne,
259   Xacid_se,
260   Xacid_s,
261   Xacid_sw,
262   Xacid_nw,
263   Xacid_1,
264   Xacid_2,
265   Xacid_3,
266   Xacid_4,
267   Xacid_5,
268   Xacid_6,
269   Xacid_7,
270   Xacid_8,
271   Xball_1,
272   Xball_1B,
273   Xball_2,
274   Xball_2B,
275   Yball_eat,
276
277 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
278   Ykey_1_eat,
279   Ykey_2_eat,
280   Ykey_3_eat,
281   Ykey_4_eat,
282   Ykey_5_eat,
283   Ykey_6_eat,
284   Ykey_7_eat,
285   Ykey_8_eat,
286   Ylenses_eat,
287   Ymagnify_eat,
288   Ygrass_eat,
289   Ydirt_eat,
290 #endif
291
292   Xgrow_ns,
293   Ygrow_ns_eat,
294   Xgrow_ew,
295   Ygrow_ew_eat,
296   Xwonderwall,
297   XwonderwallB,
298   Xamoeba_1,
299   Xamoeba_2,
300   Xamoeba_3,
301   Xamoeba_4,
302   Xamoeba_5,
303   Xamoeba_6,
304   Xamoeba_7,
305   Xamoeba_8,
306   Xdoor_1,
307   Xdoor_2,
308   Xdoor_3,
309   Xdoor_4,
310   Xdoor_5,
311   Xdoor_6,
312   Xdoor_7,
313   Xdoor_8,
314   Xkey_1,
315   Xkey_2,
316   Xkey_3,
317   Xkey_4,
318   Xkey_5,
319   Xkey_6,
320   Xkey_7,
321   Xkey_8,
322   Xwind_n,
323   Xwind_e,
324   Xwind_s,
325   Xwind_w,
326   Xwind_nesw,
327   Xwind_stop,
328   Xexit,
329   Xexit_1,
330   Xexit_2,
331   Xexit_3,
332   Xdynamite,
333   Ydynamite_eat,
334   Xdynamite_1,
335   Xdynamite_2,
336   Xdynamite_3,
337   Xdynamite_4,
338   Xbumper,
339   XbumperB,
340   Xwheel,
341   XwheelB,
342   Xswitch,
343   XswitchB,
344   Xsand,
345   Xsand_stone,
346   Xsand_stonein_1,
347   Xsand_stonein_2,
348   Xsand_stonein_3,
349   Xsand_stonein_4,
350   Xsand_stonesand_1,
351   Xsand_stonesand_2,
352   Xsand_stonesand_3,
353   Xsand_stonesand_4,
354
355 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
356   Xsand_stonesand_quickout_1,
357   Xsand_stonesand_quickout_2,
358 #endif
359
360   Xsand_stoneout_1,
361   Xsand_stoneout_2,
362   Xsand_sandstone_1,
363   Xsand_sandstone_2,
364   Xsand_sandstone_3,
365   Xsand_sandstone_4,
366   Xplant,
367   Yplant,
368   Xlenses,
369   Xmagnify,
370   Xdripper,
371   XdripperB,
372   Xfake_blank,
373   Xfake_blankB,
374   Xfake_grass,
375   Xfake_grassB,
376   Xfake_door_1,
377   Xfake_door_2,
378   Xfake_door_3,
379   Xfake_door_4,
380   Xfake_door_5,
381   Xfake_door_6,
382   Xfake_door_7,
383   Xfake_door_8,
384
385 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
386   Xfake_acid_1,
387   Xfake_acid_2,
388   Xfake_acid_3,
389   Xfake_acid_4,
390   Xfake_acid_5,
391   Xfake_acid_6,
392   Xfake_acid_7,
393   Xfake_acid_8,
394 #endif
395
396   Xsteel_1,
397   Xsteel_2,
398   Xsteel_3,
399   Xsteel_4,
400   Xwall_1,
401   Xwall_2,
402   Xwall_3,
403   Xwall_4,
404   Xround_wall_1,
405   Xround_wall_2,
406   Xround_wall_3,
407   Xround_wall_4,
408   Xdecor_1,
409   Xdecor_2,
410   Xdecor_3,
411   Xdecor_4,
412   Xdecor_5,
413   Xdecor_6,
414   Xdecor_7,
415   Xdecor_8,
416   Xdecor_9,
417   Xdecor_10,
418   Xdecor_11,
419   Xdecor_12,
420   Xalpha_0,
421   Xalpha_1,
422   Xalpha_2,
423   Xalpha_3,
424   Xalpha_4,
425   Xalpha_5,
426   Xalpha_6,
427   Xalpha_7,
428   Xalpha_8,
429   Xalpha_9,
430   Xalpha_excla,
431   Xalpha_quote,
432   Xalpha_comma,
433   Xalpha_minus,
434   Xalpha_perio,
435   Xalpha_colon,
436   Xalpha_quest,
437   Xalpha_a,
438   Xalpha_b,
439   Xalpha_c,
440   Xalpha_d,
441   Xalpha_e,
442   Xalpha_f,
443   Xalpha_g,
444   Xalpha_h,
445   Xalpha_i,
446   Xalpha_j,
447   Xalpha_k,
448   Xalpha_l,
449   Xalpha_m,
450   Xalpha_n,
451   Xalpha_o,
452   Xalpha_p,
453   Xalpha_q,
454   Xalpha_r,
455   Xalpha_s,
456   Xalpha_t,
457   Xalpha_u,
458   Xalpha_v,
459   Xalpha_w,
460   Xalpha_x,
461   Xalpha_y,
462   Xalpha_z,
463   Xalpha_arrow_e,
464   Xalpha_arrow_w,
465   Xalpha_copyr,
466
467   Xboom_bug,            /* passed from explode to synchro (linked explosion);
468                            transition to explode_normal */
469   Xboom_bomb,           /* passed from explode to synchro (linked explosion);
470                            transition to explode_normal */
471   Xboom_android,        /* passed from explode to synchro;
472                            transition to boom_2 */
473   Xboom_1,              /* passed from explode to synchro;
474                            transition to boom_2 */
475   Xboom_2,              /* transition to boom[] */
476
477   Znormal,              /* passed from synchro to explode, only in next[];
478                            no picture */
479   Zdynamite,            /* passed from synchro to explode, only in next[];
480                            no picture */
481   Zplayer,              /* special code to indicate player;
482                            no picture */
483   ZBORDER,              /* special code to indicate border;
484                            no picture */
485
486   TILE_MAX
487 };
488
489 /* other definitions */
490
491 enum
492 {
493   SPR_still = 0,
494   SPR_walk  = 1,
495   SPR_push  = 5,
496   SPR_spray = 9,
497
498   SPR_MAX   = 13
499 };
500
501 enum
502 {
503   SAMPLE_blank = 0,     /* player walks on blank */
504   SAMPLE_roll,          /* player pushes stone/bomb/nut/spring */
505   SAMPLE_stone,         /* stone hits ground */
506   SAMPLE_nut,           /* nut hits ground */
507   SAMPLE_crack,         /* stone hits nut */
508   SAMPLE_bug,           /* bug moves */
509   SAMPLE_tank,          /* tank moves */
510   SAMPLE_android_clone, /* android places something */
511   SAMPLE_android_move,  /* android moves */
512   SAMPLE_spring,        /* spring hits ground/wall/bumper, stone hits spring */
513   SAMPLE_slurp,         /* spring kills alien */
514   SAMPLE_eater,         /* eater sits */
515   SAMPLE_eater_eat,     /* eater eats diamond */
516   SAMPLE_alien,         /* alien moves */
517   SAMPLE_collect,       /* player collects object */
518   SAMPLE_diamond,       /* diamond/emerald hits ground */
519   SAMPLE_squash,        /* stone squashes diamond */
520   SAMPLE_wonderfall,    /* object falls thru wonderwall */
521   SAMPLE_drip,          /* drip hits ground */
522   SAMPLE_push,          /* player pushes balloon/android */
523   SAMPLE_dirt,          /* player walks on dirt */
524   SAMPLE_acid,          /* acid splashes */
525   SAMPLE_ball,          /* ball places something */
526   SAMPLE_grow,          /* growing wall grows */
527   SAMPLE_wonder,        /* wonderwall is active */
528   SAMPLE_door,          /* player goes thru door (gate) */
529   SAMPLE_exit_open,     /* exit opens */
530   SAMPLE_exit_leave,    /* player goes into exit */
531   SAMPLE_dynamite,      /* player places dynamite */
532   SAMPLE_tick,          /* dynamite ticks */
533   SAMPLE_press,         /* player presses wheel/wind/switch */
534   SAMPLE_wheel,         /* wheel moves */
535   SAMPLE_boom,          /* explosion */
536   SAMPLE_time,          /* time runs out */
537   SAMPLE_die,           /* player dies */
538
539   SAMPLE_MAX
540 };
541
542
543 // ----------------------------------------------------------------------------
544 // data structure definitions
545 // ----------------------------------------------------------------------------
546
547 struct LEVEL
548 {
549   int home_initial;             /* number of players (initial) */
550   int home;                     /* number of players not yet at home */
551                                 /* 0 == all players at home */
552
553   int width;                    /* playfield width */
554   int height;                   /* playfield height */
555
556   int time_seconds;             /* available time (seconds) */
557   int time_initial;             /* available time (initial) */
558   int time;                     /* time remaining (runtime) */
559
560   boolean killed_out_of_time;   /* kill player due to time out */
561
562   int required_initial;         /* emeralds needed (initial) */
563   int required;                 /* emeralds needed (runtime) */
564
565   int score;                    /* score */
566
567   /* all below entries must be filled every time a level is read */
568
569   int alien_score;              /* score for killing alien */
570   int amoeba_time;              /* amoeba speed */
571   int android_move_cnt_initial; /* android move counter (initial) */
572   int android_move_cnt;         /* android move counter */
573   int android_move_time;        /* android move reset time */
574   int android_clone_cnt_initial;/* android clone counter (initial) */
575   int android_clone_cnt;        /* android clone counter */
576   int android_clone_time;       /* android clone reset time */
577   int ball_cnt;                 /* ball counter */
578   int ball_pos;                 /* ball array pos counter */
579   int ball_random;              /* ball is random flag */
580   int ball_state_initial;       /* ball active flag (initial) */
581   int ball_state;               /* ball active flag */
582   int ball_time;                /* ball reset time */
583   int bug_score;                /* score for killing bug */
584   int diamond_score;            /* score for collecting diamond */
585   int dynamite_score;           /* score for collecting dynamite */
586   int eater_pos;                /* eater array pos */
587   int eater_score;              /* score for killing eater */
588   int emerald_score;            /* score for collecting emerald */
589   int exit_score;               /* score for entering exit */
590   int key_score;                /* score for colleting key */
591   int lenses_cnt_initial;       /* lenses counter (initial) */
592   int lenses_cnt;               /* lenses counter */
593   int lenses_score;             /* score for collecting lenses */
594   int lenses_time;              /* lenses reset time */
595   int magnify_cnt_initial;      /* magnify counter (initial) */
596   int magnify_cnt;              /* magnify counter */
597   int magnify_score;            /* score for collecting magnifier */
598   int magnify_time;             /* magnify reset time */
599   int nut_score;                /* score for cracking nut */
600   int shine_cnt;                /* shine counter for emerald/diamond */
601   int slurp_score;              /* score for slurping alien */
602   int tank_score;               /* score for killing tank */
603   int wheel_cnt_initial;        /* wheel counter (initial) */
604   int wheel_cnt;                /* wheel counter */
605   int wheel_x_initial;          /* wheel x pos (initial) */
606   int wheel_x;                  /* wheel x pos */
607   int wheel_y_initial;          /* wheel y pos (initial) */
608   int wheel_y;                  /* wheel y pos */
609   int wheel_time;               /* wheel reset time */
610   int wind_cnt_initial;         /* wind counter (initial) */
611   int wind_cnt;                 /* wind time counter */
612   int wind_direction_initial;   /* wind direction (initial) */
613   int wind_direction;           /* wind direction */
614   int wind_time;                /* wind reset time */
615   int wonderwall_state_initial; /* wonderwall active flag (initial) */
616   int wonderwall_state;         /* wonderwall active flag */
617   int wonderwall_time_initial;  /* wonderwall time (initial) */
618   int wonderwall_time;          /* wonderwall time */
619   short eater_array[8][9];      /* eater data */
620   short ball_array[8][8];       /* ball data */
621   short android_array[TILE_MAX];/* android clone table */
622   int num_ball_arrays;          /* number of ball data arrays used */
623
624   int exit_x, exit_y;           /* kludge for playing player exit sound */
625 };
626
627 struct PLAYER
628 {
629   int num;
630   int exists;
631   int alive_initial;
632   int alive;
633
634   int dynamite;
635   int dynamite_cnt;
636   int keys;
637   int anim;
638
639   int x_initial;
640   int y_initial;
641   int x;
642   int y;
643   int oldx;
644   int oldy;
645
646   int last_move_dir;
647
648   int joy_n:1;
649   int joy_e:1;
650   int joy_s:1;
651   int joy_w:1;
652   int joy_snap:1;
653   int joy_drop:1;
654   int joy_stick:1;
655   int joy_spin:1;
656 };
657
658 #endif  // EMERALD_H