1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2024 by Artsoft Entertainment
7 // https://www.artsoft.org/
8 // ----------------------------------------------------------------------------
10 // ============================================================================
15 // ============================================================================
16 // external functions and definitions imported from main program to game_em
17 // ============================================================================
19 #include "import_em.h"
22 // ============================================================================
23 // functions and definitions that are exported from game_em to main program
24 // ============================================================================
26 #include "export_em.h"
29 // ============================================================================
30 // internal functions and definitions that are not exported to main program
31 // ============================================================================
36 // ----------------------------------------------------------------------------
37 // constant definitions
38 // ----------------------------------------------------------------------------
40 // values for native Emerald Mine game version
41 #define FILE_VERSION_EM_UNKNOWN 0
42 #define FILE_VERSION_EM_V1 1
43 #define FILE_VERSION_EM_V2 2
44 #define FILE_VERSION_EM_V3 3
45 #define FILE_VERSION_EM_V4 4 // (there really was no version 4)
46 #define FILE_VERSION_EM_V5 5
47 #define FILE_VERSION_EM_V6 6
49 #define FILE_VERSION_EM_ACTUAL FILE_VERSION_EM_V6
51 // screen sizes and positions for EM engine
55 extern int TILESIZE_VAR;
57 #define TILEX TILESIZE_VAR
58 #define TILEY TILESIZE_VAR
60 extern int SCR_FIELDX, SCR_FIELDY;
62 #define MAX_BUF_XSIZE (SCR_FIELDX + 2 * CAVE_BUFFER_XOFFSET)
63 #define MAX_BUF_YSIZE (SCR_FIELDY + 2 * CAVE_BUFFER_YOFFSET)
65 // often used screen positions
69 #define SXSIZE (SCR_FIELDX * TILEX)
70 #define SYSIZE (SCR_FIELDY * TILEY)
73 #define PLAY_ELEMENT_SOUND FALSE
76 // ----------------------------------------------------------------------------
77 // macro function definitions
78 // ----------------------------------------------------------------------------
80 #define ROUNDED_DIVIDE(x, y) (((x) + (y) - 1) / (y))
82 #define SECONDS_TO_FRAMES(x) ((x) * FRAMES_PER_SECOND)
83 #define FRAMES_TO_SECONDS(x) ((x) / FRAMES_PER_SECOND)
85 #define SECONDS_TO_CYCLES(x) ROUNDED_DIVIDE((x) * FRAMES_PER_SECOND, 8)
86 #define CYCLES_TO_SECONDS(x) ROUNDED_DIVIDE((x) * 8, FRAMES_PER_SECOND)
88 #define DISPLAY_TIME(x) ROUNDED_DIVIDE(x, FRAMES_PER_SECOND)
90 #define CAVE_POS_X(x) ((x) - lev.left)
91 #define CAVE_POS_Y(x) ((x) - lev.top)
94 // ----------------------------------------------------------------------------
95 // data structure definitions
96 // ----------------------------------------------------------------------------
98 // ----------------------------------------------------------------------------
100 // ----------------------------------------------------------------------------
102 extern struct CAVE cav;
103 extern struct LOGIC lev;
104 extern struct PLAYER ply[MAX_PLAYERS];
106 extern struct LevelInfo_EM native_em_level;
107 extern struct GraphicInfo_EM graphic_info_em_object[GAME_TILE_MAX][8];
108 extern struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][PLY_MAX][8];
109 extern struct GameInfo_EM game_em;
111 extern Bitmap *screenBitmap;
114 // ----------------------------------------------------------------------------
115 // exported functions
116 // ----------------------------------------------------------------------------