4 // ============================================================================
5 // functions and definitions exported from game_em to main program
6 // ============================================================================
8 // ----------------------------------------------------------------------------
9 // constant definitions
10 // ----------------------------------------------------------------------------
12 /* define these for backwards compatibility */
13 #define EM_ENGINE_BAD_ROLL
14 #define EM_ENGINE_BAD_SPRING
16 /* define these to use additional elements */
17 #define EM_ENGINE_USE_ADDITIONAL_ELEMENTS
19 /* internal definitions for EM engine */
20 #ifdef EM_ENGINE_BAD_ROLL
24 #ifdef EM_ENGINE_BAD_SPRING
28 /* one border for ZBORDER elements, one border for steelwall, if needed */
29 #define EM_MAX_CAVE_WIDTH (MAX_PLAYFIELD_WIDTH + 2 + 2)
30 #define EM_MAX_CAVE_HEIGHT (MAX_PLAYFIELD_HEIGHT + 2 + 2)
33 -----------------------------------------------------------------------------
34 definition of elements used in the Emerald Mine Club engine;
35 the element names have the following properties:
36 - elements that start with 'X' can be stored in a level file
37 - elements that start with 'Y' indicate moving elements
38 - elements that end with 'B' are the "backside" of moving elements
39 -----------------------------------------------------------------------------
44 Xblank = 0, /* still */
45 Yacid_splash_eB, /* hmm */
46 Yacid_splash_wB, /* hmm */
48 #ifdef EM_ENGINE_BAD_ROLL
49 Xstone_force_e, /* only use these in eater */
279 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
357 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
358 Xsand_stonesand_quickout_1,
359 Xsand_stonesand_quickout_2,
387 #ifdef EM_ENGINE_USE_ADDITIONAL_ELEMENTS
469 Xboom_bug, /* passed from explode to synchro (linked explosion);
470 transition to explode_normal */
471 Xboom_bomb, /* passed from explode to synchro (linked explosion);
472 transition to explode_normal */
473 Xboom_android, /* passed from explode to synchro;
474 transition to boom_2 */
475 Xboom_1, /* passed from explode to synchro;
476 transition to boom_2 */
477 Xboom_2, /* transition to boom[] */
479 Znormal, /* passed from synchro to explode, only in next[];
481 Zdynamite, /* passed from synchro to explode, only in next[];
483 Zplayer, /* special code to indicate player;
485 ZBORDER, /* special code to indicate border;
491 /* other definitions */
505 SAMPLE_blank = 0, /* player walks on blank */
506 SAMPLE_roll, /* player pushes stone/bomb/nut/spring */
507 SAMPLE_stone, /* stone hits ground */
508 SAMPLE_nut, /* nut hits ground */
509 SAMPLE_crack, /* stone hits nut */
510 SAMPLE_bug, /* bug moves */
511 SAMPLE_tank, /* tank moves */
512 SAMPLE_android_clone, /* android places something */
513 SAMPLE_android_move, /* android moves */
514 SAMPLE_spring, /* spring hits ground/wall/bumper, stone hits spring */
515 SAMPLE_slurp, /* spring kills alien */
516 SAMPLE_eater, /* eater sits */
517 SAMPLE_eater_eat, /* eater eats diamond */
518 SAMPLE_alien, /* alien moves */
519 SAMPLE_collect, /* player collects object */
520 SAMPLE_diamond, /* diamond/emerald hits ground */
521 SAMPLE_squash, /* stone squashes diamond */
522 SAMPLE_wonderfall, /* object falls thru wonderwall */
523 SAMPLE_drip, /* drip hits ground */
524 SAMPLE_push, /* player pushes balloon/android */
525 SAMPLE_dirt, /* player walks on dirt */
526 SAMPLE_acid, /* acid splashes */
527 SAMPLE_ball, /* ball places something */
528 SAMPLE_grow, /* growing wall grows */
529 SAMPLE_wonder, /* wonderwall is active */
530 SAMPLE_door, /* player goes thru door (gate) */
531 SAMPLE_exit_open, /* exit opens */
532 SAMPLE_exit_leave, /* player goes into exit */
533 SAMPLE_dynamite, /* player places dynamite */
534 SAMPLE_tick, /* dynamite ticks */
535 SAMPLE_press, /* player presses wheel/wind/switch */
536 SAMPLE_wheel, /* wheel moves */
537 SAMPLE_boom, /* explosion */
538 SAMPLE_time, /* time runs out */
539 SAMPLE_die, /* player dies */
545 // ----------------------------------------------------------------------------
546 // data structure definitions
547 // ----------------------------------------------------------------------------
551 int home_initial; /* number of players (initial) */
552 int home; /* number of players not yet at home */
553 /* 0 == all players at home */
555 int width; /* playfield width */
556 int height; /* playfield height */
558 int time_seconds; /* available time (seconds) */
559 int time_initial; /* available time (initial) */
560 int time; /* time remaining (runtime) */
562 boolean killed_out_of_time; /* kill player due to time out */
564 int required_initial; /* emeralds needed (initial) */
565 int required; /* emeralds needed (runtime) */
567 int score; /* score */
569 /* all below entries must be filled every time a level is read */
571 int alien_score; /* score for killing alien */
572 int amoeba_time; /* amoeba speed */
573 int android_move_cnt_initial; /* android move counter (initial) */
574 int android_move_cnt; /* android move counter */
575 int android_move_time; /* android move reset time */
576 int android_clone_cnt_initial;/* android clone counter (initial) */
577 int android_clone_cnt; /* android clone counter */
578 int android_clone_time; /* android clone reset time */
579 int ball_cnt; /* ball counter */
580 int ball_pos; /* ball array pos counter */
581 int ball_random; /* ball is random flag */
582 int ball_state_initial; /* ball active flag (initial) */
583 int ball_state; /* ball active flag */
584 int ball_time; /* ball reset time */
585 int bug_score; /* score for killing bug */
586 int diamond_score; /* score for collecting diamond */
587 int dynamite_score; /* score for collecting dynamite */
588 int eater_pos; /* eater array pos */
589 int eater_score; /* score for killing eater */
590 int emerald_score; /* score for collecting emerald */
591 int exit_score; /* score for entering exit */
592 int key_score; /* score for colleting key */
593 int lenses_cnt_initial; /* lenses counter (initial) */
594 int lenses_cnt; /* lenses counter */
595 int lenses_score; /* score for collecting lenses */
596 int lenses_time; /* lenses reset time */
597 int magnify_cnt_initial; /* magnify counter (initial) */
598 int magnify_cnt; /* magnify counter */
599 int magnify_score; /* score for collecting magnifier */
600 int magnify_time; /* magnify reset time */
601 int nut_score; /* score for cracking nut */
602 int shine_cnt; /* shine counter for emerald/diamond */
603 int slurp_score; /* score for slurping alien */
604 int tank_score; /* score for killing tank */
605 int wheel_cnt_initial; /* wheel counter (initial) */
606 int wheel_cnt; /* wheel counter */
607 int wheel_x_initial; /* wheel x pos (initial) */
608 int wheel_x; /* wheel x pos */
609 int wheel_y_initial; /* wheel y pos (initial) */
610 int wheel_y; /* wheel y pos */
611 int wheel_time; /* wheel reset time */
612 int wind_cnt_initial; /* wind counter (initial) */
613 int wind_cnt; /* wind time counter */
614 int wind_direction_initial; /* wind direction (initial) */
615 int wind_direction; /* wind direction */
616 int wind_time; /* wind reset time */
617 int wonderwall_state_initial; /* wonderwall active flag (initial) */
618 int wonderwall_state; /* wonderwall active flag */
619 int wonderwall_time_initial; /* wonderwall time (initial) */
620 int wonderwall_time; /* wonderwall time */
621 short eater_array[8][9]; /* eater data */
622 short ball_array[8][8]; /* ball data */
623 short android_array[TILE_MAX];/* android clone table */
624 int num_ball_arrays; /* number of ball data arrays used */
626 int exit_x, exit_y; /* kludge for playing player exit sound */
662 Bitmap *screenbuffer;
667 boolean level_solved;
670 boolean any_player_moving;
671 boolean any_player_snapping;
673 boolean use_single_button;
674 boolean use_snap_key_bug;
676 int last_moving_player;
677 int last_player_direction[MAX_PLAYERS];
684 short cave[EM_MAX_CAVE_WIDTH][EM_MAX_CAVE_HEIGHT];
687 struct PLAYER *ply[MAX_PLAYERS];
689 /* used for runtime values */
690 struct GameInfo_EM *game_em;
693 struct GraphicInfo_EM
697 int src_offset_x, src_offset_y;
698 int dst_offset_x, dst_offset_y;
701 Bitmap *crumbled_bitmap;
702 int crumbled_src_x, crumbled_src_y;
703 int crumbled_border_size;
704 int crumbled_tile_size;
706 boolean has_crumbled_graphics;
707 boolean preserve_background;
709 int unique_identifier; /* used to identify needed screen updates */
712 struct EngineSnapshotInfo_EM
714 struct GameInfo_EM game_em;
715 unsigned int RandomEM;
717 struct PLAYER ply[MAX_PLAYERS];
718 short Array[4][EM_MAX_CAVE_HEIGHT][EM_MAX_CAVE_WIDTH];
729 // ----------------------------------------------------------------------------
730 // exported functions
731 // ----------------------------------------------------------------------------
733 extern struct GlobalInfo_EM global_em_info;
734 extern struct GameInfo_EM game_em;
735 extern struct LevelInfo_EM native_em_level;
736 extern struct GraphicInfo_EM graphic_info_em_object[TILE_MAX][8];
737 extern struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][SPR_MAX][8];
738 extern struct EngineSnapshotInfo_EM engine_snapshot_em;
740 void em_open_all(void);
741 void em_close_all(void);
743 void InitGfxBuffers_EM(void);
745 void InitGameEngine_EM(void);
746 void GameActions_EM(byte *, boolean);
748 unsigned int InitEngineRandom_EM(int);
750 void setLevelInfoToDefaults_EM(void);
751 boolean LoadNativeLevel_EM(char *, boolean);
753 int getFieldbufferOffsetX_EM(void);
754 int getFieldbufferOffsetY_EM(void);
756 void BackToFront_EM(void);
757 void BlitScreenToBitmap_EM(Bitmap *);
758 void RedrawPlayfield_EM(boolean);
760 void LoadEngineSnapshotValues_EM(void);
761 void SaveEngineSnapshotValues_EM(void);
763 boolean checkIfAllPlayersFitToScreen(void);
765 void tab_generate(void);
766 void tab_generate_graphics_info_em(void);