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 any_player_moving;
668 boolean any_player_snapping;
670 boolean use_single_button;
671 boolean use_snap_key_bug;
673 int last_moving_player;
674 int last_player_direction[MAX_PLAYERS];
681 short cave[EM_MAX_CAVE_WIDTH][EM_MAX_CAVE_HEIGHT];
684 struct PLAYER *ply[MAX_PLAYERS];
686 /* used for runtime values */
687 struct GameInfo_EM *game_em;
690 struct GraphicInfo_EM
694 int src_offset_x, src_offset_y;
695 int dst_offset_x, dst_offset_y;
698 Bitmap *crumbled_bitmap;
699 int crumbled_src_x, crumbled_src_y;
700 int crumbled_border_size;
701 int crumbled_tile_size;
703 boolean has_crumbled_graphics;
704 boolean preserve_background;
706 int unique_identifier; /* used to identify needed screen updates */
709 struct EngineSnapshotInfo_EM
711 struct GameInfo_EM game_em;
712 unsigned int RandomEM;
714 struct PLAYER ply[MAX_PLAYERS];
715 short Array[4][EM_MAX_CAVE_HEIGHT][EM_MAX_CAVE_WIDTH];
726 /* ------------------------------------------------------------------------- */
727 /* exported functions */
728 /* ------------------------------------------------------------------------- */
730 extern struct GlobalInfo_EM global_em_info;
731 extern struct GameInfo_EM game_em;
732 extern struct LevelInfo_EM native_em_level;
733 extern struct GraphicInfo_EM graphic_info_em_object[TILE_MAX][8];
734 extern struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][SPR_MAX][8];
735 extern struct EngineSnapshotInfo_EM engine_snapshot_em;
737 extern void em_open_all(void);
738 extern void em_close_all(void);
740 extern void InitGfxBuffers_EM(void);
742 extern void InitGameEngine_EM(void);
743 extern void GameActions_EM(byte *, boolean);
745 extern unsigned int InitEngineRandom_EM(int);
747 extern void setLevelInfoToDefaults_EM(void);
748 extern boolean LoadNativeLevel_EM(char *, boolean);
750 extern int getFieldbufferOffsetX_EM(void);
751 extern int getFieldbufferOffsetY_EM(void);
753 extern void BackToFront_EM(void);
754 extern void BlitScreenToBitmap_EM(Bitmap *);
755 extern void RedrawPlayfield_EM(boolean);
757 extern void LoadEngineSnapshotValues_EM(void);
758 extern void SaveEngineSnapshotValues_EM(void);
760 extern boolean checkIfAllPlayersFitToScreen(void);
762 extern void tab_generate(void);
763 extern void tab_generate_graphics_info_em(void);
765 #endif /* EXPORT_H */