3 This program "Emerald Mine for X11"
4 is copyright © 2009 David Tritscher. All rights reserved.
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions
10 1. Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
13 2. The origin of this software must not be misrepresented; you must
14 not claim that you wrote the original software. If you use this
15 software in a product, an acknowledgment in the product
16 documentation would be appreciated but is not required.
18 3. Altered source versions must be plainly marked as such, and must
19 not be misrepresented as being the original software.
21 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
22 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 /* 2007-03-31 06:22:47
36 * emerald mine game engine defines
39 // ----------------------------------------------------------------------------
40 // EM game engine source code was altered for integration in Rocks'n'Diamonds
41 // ----------------------------------------------------------------------------
47 // ----------------------------------------------------------------------------
48 // constant definitions
49 // ----------------------------------------------------------------------------
51 /* define these to use additional elements */
52 #define EM_ENGINE_USE_ADDITIONAL_ELEMENTS
54 /* with border for steelwall, if needed (when converted from R'n'D level) */
55 #define CAVE_WIDTH (MAX_PLAYFIELD_WIDTH + 2)
56 #define CAVE_HEIGHT (MAX_PLAYFIELD_HEIGHT + 2)
58 /* with border for Zborder elements (surrounding the visible playfield) */
59 #define CAVE_BUFFER_XOFFSET 4
60 #define CAVE_BUFFER_YOFFSET 2
61 #define CAVE_BUFFER_WIDTH (CAVE_WIDTH + 2 * CAVE_BUFFER_XOFFSET)
62 #define CAVE_BUFFER_HEIGHT (CAVE_HEIGHT + 2 * CAVE_BUFFER_YOFFSET)
65 -----------------------------------------------------------------------------
66 definition of elements used in the Emerald Mine Club engine;
67 the element names have the following properties:
68 - elements that start with 'X' can be stored in a level file
69 - elements that start with 'Y' indicate moving elements
70 - elements that end with 'B' are the "backside" of moving elements
71 -----------------------------------------------------------------------------
93 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
402 Xfake_amoeba, /* dripper */
425 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
426 Xsand_stonesand_quickout_1,
427 Xsand_stonesand_quickout_2,
430 Xslidewall_ns, /* growing wall */
524 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
539 Xboom_bug, /* passed from explode to synchro (linked explosion);
540 transition to explode_normal */
541 Xboom_bomb, /* passed from explode to synchro (linked explosion);
542 transition to explode_normal */
543 Xboom_android, /* passed from explode to synchro;
544 transition to boom_2 */
545 Xboom_1, /* passed from explode to synchro;
546 transition to boom_2 */
547 Xboom_2, /* transition to boom[] */
549 Znormal, /* passed from synchro to explode, only in next[];
551 Zdynamite, /* passed from synchro to explode, only in next[];
553 Zplayer, /* special code to indicate player;
555 Zborder, /* special code to indicate border;
561 /* other definitions */
587 SOUND_blank = 0, /* player walks on blank */
588 SOUND_roll, /* player pushes stone/bomb/nut/spring */
589 SOUND_stone, /* stone hits ground */
590 SOUND_nut, /* nut hits ground */
591 SOUND_crack, /* stone hits nut */
592 SOUND_bug, /* bug moves */
593 SOUND_tank, /* tank moves */
594 SOUND_android_clone, /* android places something */
595 SOUND_android_move, /* android moves */
596 SOUND_spring, /* spring hits ground/wall/bumper, stone hits spring */
597 SOUND_slurp, /* spring kills alien */
598 SOUND_eater, /* eater sits */
599 SOUND_eater_eat, /* eater eats diamond */
600 SOUND_alien, /* alien moves */
601 SOUND_collect, /* player collects object */
602 SOUND_diamond, /* diamond/emerald hits ground */
603 SOUND_squash, /* stone squashes diamond */
604 SOUND_wonderfall, /* object falls thru wonderwall */
605 SOUND_drip, /* drip hits ground */
606 SOUND_push, /* player pushes spring/balloon/android */
607 SOUND_dirt, /* player digs into dirt */
608 SOUND_acid, /* acid splashes */
609 SOUND_ball, /* ball places something */
610 SOUND_slidewall, /* slide wall grows */
611 SOUND_wonder, /* wonderwall is active */
612 SOUND_door, /* player goes thru door (gate) */
613 SOUND_exit_open, /* exit opens */
614 SOUND_exit_leave, /* player goes into exit */
615 SOUND_dynamite, /* player places dynamite */
616 SOUND_tick, /* dynamite ticks */
617 SOUND_press, /* player presses wheel/wind/switch */
618 SOUND_wheel, /* wheel moves */
619 SOUND_boom, /* explosion */
620 SOUND_time, /* time runs out */
621 SOUND_die, /* player dies */
627 // ----------------------------------------------------------------------------
628 // data structure definitions
629 // ----------------------------------------------------------------------------
633 int home_initial; /* number of players (initial) */
634 int home; /* number of players not yet at home */
635 /* 0 == all players at home */
637 int width; /* playfield width */
638 int height; /* playfield height */
640 int left; /* playfield left edge */
641 int top; /* playfield top edge */
642 int right; /* playfield right edge */
643 int bottom; /* playfield bottom edge */
645 int time_seconds; /* available time (seconds) */
646 int time_initial; /* available time (initial) */
647 int time; /* time remaining (runtime) */
649 boolean killed_out_of_time; /* kill player due to time out */
651 int required_initial; /* emeralds needed (initial) */
652 int required; /* emeralds needed (runtime) */
654 int score; /* score */
656 /* all below entries must be filled every time a level is read */
658 int alien_score; /* score for killing alien */
659 int amoeba_time; /* amoeba speed */
660 int android_move_cnt_initial; /* android move counter (initial) */
661 int android_move_cnt; /* android move counter */
662 int android_move_time; /* android move reset time */
663 int android_clone_cnt_initial;/* android clone counter (initial) */
664 int android_clone_cnt; /* android clone counter */
665 int android_clone_time; /* android clone reset time */
666 int ball_cnt; /* ball counter */
667 int ball_pos; /* ball array pos counter */
668 int ball_random; /* ball is random flag */
669 int ball_state_initial; /* ball active flag (initial) */
670 int ball_state; /* ball active flag */
671 int ball_time; /* ball reset time */
672 int bug_score; /* score for killing bug */
673 int diamond_score; /* score for collecting diamond */
674 int dynamite_score; /* score for collecting dynamite */
675 int eater_pos; /* eater array pos */
676 int eater_score; /* score for killing eater */
677 int emerald_score; /* score for collecting emerald */
678 int exit_score; /* score for entering exit */
679 int key_score; /* score for colleting key */
680 int lenses_cnt_initial; /* lenses counter (initial) */
681 int lenses_cnt; /* lenses counter */
682 int lenses_score; /* score for collecting lenses */
683 int lenses_time; /* lenses reset time */
684 int magnify_cnt_initial; /* magnify counter (initial) */
685 int magnify_cnt; /* magnify counter */
686 int magnify_score; /* score for collecting magnifier */
687 int magnify_time; /* magnify reset time */
688 int nut_score; /* score for cracking nut */
689 int shine_cnt; /* shine counter for emerald/diamond */
690 int slurp_score; /* score for slurping alien */
691 int tank_score; /* score for killing tank */
692 int wheel_cnt_initial; /* wheel counter (initial) */
693 int wheel_cnt; /* wheel counter */
694 int wheel_x_initial; /* wheel x pos (initial) */
695 int wheel_x; /* wheel x pos */
696 int wheel_y_initial; /* wheel y pos (initial) */
697 int wheel_y; /* wheel y pos */
698 int wheel_time; /* wheel reset time */
699 int wind_cnt_initial; /* wind counter (initial) */
700 int wind_cnt; /* wind time counter */
701 int wind_direction_initial; /* wind direction (initial) */
702 int wind_direction; /* wind direction */
703 int wind_time; /* wind reset time */
704 int wonderwall_state_initial; /* wonderwall active flag (initial) */
705 int wonderwall_state; /* wonderwall active flag */
706 int wonderwall_time_initial; /* wonderwall time (initial) */
707 int wonderwall_time; /* wonderwall time */
708 short eater_array[8][9]; /* eater data */
709 short ball_array[8][8]; /* ball data */
710 short android_array[TILE_MAX];/* android clone table */
711 int num_ball_arrays; /* number of ball data arrays used */
713 int exit_x, exit_y; /* kludge for playing player exit sound */
715 short cavebuf[CAVE_BUFFER_WIDTH][CAVE_BUFFER_HEIGHT];
716 short nextbuf[CAVE_BUFFER_WIDTH][CAVE_BUFFER_HEIGHT];
717 short drawbuf[CAVE_BUFFER_WIDTH][CAVE_BUFFER_HEIGHT];
718 short boombuf[CAVE_BUFFER_WIDTH][CAVE_BUFFER_HEIGHT];
720 short *cavecol[CAVE_BUFFER_WIDTH];
721 short *nextcol[CAVE_BUFFER_WIDTH];
722 short *drawcol[CAVE_BUFFER_WIDTH];
723 short *boomcol[CAVE_BUFFER_WIDTH];