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 CAVE_WIDTH MAX_PLAYFIELD_WIDTH
52 #define CAVE_HEIGHT MAX_PLAYFIELD_HEIGHT
54 /* additional padding for Zborder elements and linked cave buffer columns */
55 #define CAVE_BUFFER_XOFFSET 4
56 #define CAVE_BUFFER_YOFFSET 2
57 #define CAVE_BUFFER_WIDTH (CAVE_WIDTH + 2 * CAVE_BUFFER_XOFFSET)
58 #define CAVE_BUFFER_HEIGHT (CAVE_HEIGHT + 2 * CAVE_BUFFER_YOFFSET)
61 -----------------------------------------------------------------------------
62 definition of elements used in the Emerald Mine Club engine;
63 the element names (mostly) have the following properties:
64 - elements that start with 'X' can be stored in a level file
65 - elements that start with 'Y' indicate moving or active elements
66 - elements that end with 'B' are the "backside" of moving elements
67 -----------------------------------------------------------------------------
89 Xfake_acid_1, /* newly added to EM engine */
396 Xfake_amoeba, /* dripper */
419 Xsand_stonesand_quickout_1, /* newly added to EM engine */
420 Xsand_stonesand_quickout_2,
422 Xslide_ns, /* growing wall */
516 Ykey_1_blank, /* newly added to EM engine */
529 Xboom_bug, /* passed from explode to synchro (linked explosion);
530 transition to explode_normal */
531 Xboom_bomb, /* passed from explode to synchro (linked explosion);
532 transition to explode_normal */
533 Xboom_android, /* passed from explode to synchro;
534 transition to boom_2 */
535 Xboom_1, /* passed from explode to synchro;
536 transition to boom_2 */
537 Xboom_2, /* transition to boom[] */
539 Znormal, /* passed from synchro to explode, only in next[];
541 Zdynamite, /* passed from synchro to explode, only in next[];
543 Zplayer, /* special code to indicate player;
545 Zborder, /* special code to indicate border;
551 /* other definitions */
577 SOUND_blank = 0, /* player walks on blank */
578 SOUND_roll, /* player pushes stone/bomb/nut/spring */
579 SOUND_stone, /* stone hits ground */
580 SOUND_nut, /* nut hits ground */
581 SOUND_crack, /* stone hits nut */
582 SOUND_bug, /* bug moves */
583 SOUND_tank, /* tank moves */
584 SOUND_android_clone, /* android places something */
585 SOUND_android_move, /* android moves */
586 SOUND_spring, /* spring hits ground/wall/bumper, stone hits spring */
587 SOUND_slurp, /* spring kills alien */
588 SOUND_eater, /* eater sits */
589 SOUND_eater_eat, /* eater eats diamond */
590 SOUND_alien, /* alien moves */
591 SOUND_collect, /* player collects object */
592 SOUND_diamond, /* diamond/emerald hits ground */
593 SOUND_squash, /* stone squashes diamond */
594 SOUND_wonderfall, /* object falls thru wonderwall */
595 SOUND_drip, /* drip hits ground */
596 SOUND_push, /* player pushes spring/balloon/android */
597 SOUND_dirt, /* player digs into dirt */
598 SOUND_acid, /* acid splashes */
599 SOUND_ball, /* ball places something */
600 SOUND_slide, /* slide wall grows */
601 SOUND_wonder, /* wonderwall is active */
602 SOUND_door, /* player goes thru door (gate) */
603 SOUND_exit_open, /* exit opens */
604 SOUND_exit_leave, /* player goes into exit */
605 SOUND_dynamite, /* player places dynamite */
606 SOUND_tick, /* dynamite ticks */
607 SOUND_press, /* player presses wheel/wind/switch */
608 SOUND_wheel, /* wheel moves */
609 SOUND_boom, /* explosion */
610 SOUND_time, /* time runs out */
611 SOUND_die, /* player dies */
617 // ----------------------------------------------------------------------------
618 // data structure definitions
619 // ----------------------------------------------------------------------------
623 int width; /* cave width */
624 int height; /* cave height */
626 int left; /* cave left edge */
627 int top; /* cave top edge */
628 int right; /* cave right edge */
629 int bottom; /* cave bottom edge */
631 int time; /* time remaining */
632 int gems_needed; /* emeralds needed */
633 int score; /* score */
635 int eater_score; /* score for killing eater */
636 int alien_score; /* score for killing alien */
637 int bug_score; /* score for killing bug */
638 int tank_score; /* score for killing tank */
639 int slurp_score; /* score for slurping alien with spring */
640 int nut_score; /* score for cracking nut to emerald */
641 int emerald_score; /* score for collecting emerald */
642 int diamond_score; /* score for collecting diamond */
643 int dynamite_score; /* score for collecting dynamite */
644 int key_score; /* score for colleting key */
645 int lenses_score; /* score for collecting lenses */
646 int magnify_score; /* score for collecting magnifier */
647 int exit_score; /* score for entering exit */
649 int android_move_time; /* android move reset time */
650 int android_clone_time; /* android clone reset time */
651 int ball_time; /* ball reset time */
652 int amoeba_time; /* amoeba speed */
653 int wonderwall_time; /* wonderwall time */
654 int wheel_time; /* wheel reset time */
655 int wheel_x; /* wheel x pos */
656 int wheel_y; /* wheel y pos */
657 int lenses_time; /* lenses reset time */
658 int magnify_time; /* magnify reset time */
659 int wind_time; /* wind reset time */
660 int wind_direction; /* wind direction */
662 int ball_random; /* ball is random flag */
663 int ball_state; /* ball active flag */
664 int wonderwall_state; /* wonderwall active flag */
665 int wheel_cnt; /* wheel counter */
666 int lenses_cnt; /* lenses counter */
667 int magnify_cnt; /* magnify counter */
668 int wind_cnt; /* wind time counter */
670 int android_move_cnt; /* android move counter */
671 int android_clone_cnt; /* android clone counter */
672 int ball_cnt; /* ball counter */
673 int ball_pos; /* ball array pos counter */
674 int eater_pos; /* eater array pos */
675 int shine_cnt; /* shine counter for emerald/diamond */
677 int num_ball_arrays; /* number of ball data arrays used */
679 int home_initial; /* number of players (initial) */
680 int home; /* number of players not yet at home */
681 /* 0 == all players at home */
683 boolean killed_out_of_time; /* kill player due to time out */
685 int exit_x, exit_y; /* kludge for playing player exit sound */
687 short eater_array[8][9]; /* eater data */
688 short ball_array[8][8]; /* ball data */
689 short android_array[TILE_MAX]; /* android clone data */
691 short cavebuf[CAVE_BUFFER_WIDTH][CAVE_BUFFER_HEIGHT];
692 short nextbuf[CAVE_BUFFER_WIDTH][CAVE_BUFFER_HEIGHT];
693 short drawbuf[CAVE_BUFFER_WIDTH][CAVE_BUFFER_HEIGHT];
694 short boombuf[CAVE_BUFFER_WIDTH][CAVE_BUFFER_HEIGHT];
696 short *cavecol[CAVE_BUFFER_WIDTH];
697 short *nextcol[CAVE_BUFFER_WIDTH];
698 short *drawcol[CAVE_BUFFER_WIDTH];
699 short *boomcol[CAVE_BUFFER_WIDTH];