4 // ============================================================================
5 // external functions and definitions imported from main program to game_em
6 // ============================================================================
8 #include "../engines.h"
11 // ============================================================================
12 // functions and definitions that are exported from game_em to main program
13 // ============================================================================
18 // ============================================================================
19 // internal functions and definitions that are not exported to main program
20 // ============================================================================
25 // ----------------------------------------------------------------------------
26 // constant definitions
27 // ----------------------------------------------------------------------------
29 /* values for native Emerald Mine game version */
30 #define FILE_VERSION_EM_UNKNOWN 0
31 #define FILE_VERSION_EM_V1 1
32 #define FILE_VERSION_EM_V2 2
33 #define FILE_VERSION_EM_V3 3
34 #define FILE_VERSION_EM_V4 4 /* (there really was no version 4) */
35 #define FILE_VERSION_EM_V5 5
36 #define FILE_VERSION_EM_V6 6
38 #define FILE_VERSION_EM_ACTUAL FILE_VERSION_EM_V6
40 /* screen sizes and positions for EM engine */
44 extern int TILESIZE_VAR;
46 #define TILEX TILESIZE_VAR
47 #define TILEY TILESIZE_VAR
49 extern int SCR_FIELDX, SCR_FIELDY;
51 #define MAX_BUF_XSIZE (SCR_FIELDX + 2 * CAVE_BUFFER_XOFFSET)
52 #define MAX_BUF_YSIZE (SCR_FIELDY + 2 * CAVE_BUFFER_YOFFSET)
54 /* often used screen positions */
58 #define SXSIZE (SCR_FIELDX * TILEX)
59 #define SYSIZE (SCR_FIELDY * TILEY)
62 #define PLAY_ELEMENT_SOUND FALSE
65 // ----------------------------------------------------------------------------
66 // macro function definitions
67 // ----------------------------------------------------------------------------
69 #define ROUNDED_DIVIDE(x, y) (((x) + (y) - 1) / (y))
71 #define SECONDS_TO_FRAMES(x) ((x) * FRAMES_PER_SECOND)
72 #define FRAMES_TO_SECONDS(x) ((x) / FRAMES_PER_SECOND)
74 #define SECONDS_TO_CYCLES(x) ROUNDED_DIVIDE((x) * FRAMES_PER_SECOND, 8)
75 #define CYCLES_TO_SECONDS(x) ROUNDED_DIVIDE((x) * 8, FRAMES_PER_SECOND)
77 #define DISPLAY_TIME(x) ROUNDED_DIVIDE(x, FRAMES_PER_SECOND)
79 #define CAVE_POS_X(x) ((x) - lev.left)
80 #define CAVE_POS_Y(x) ((x) - lev.top)
83 // ----------------------------------------------------------------------------
84 // data structure definitions
85 // ----------------------------------------------------------------------------
87 // ----------------------------------------------------------------------------
89 // ----------------------------------------------------------------------------
91 extern struct CAVE cav;
92 extern struct LOGIC lev;
93 extern struct PLAYER ply[MAX_PLAYERS];
95 extern struct LevelInfo_EM native_em_level;
96 extern struct GraphicInfo_EM graphic_info_em_object[GAME_TILE_MAX][8];
97 extern struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][PLY_MAX][8];
98 extern struct GameInfo_EM game_em;
100 extern Bitmap *screenBitmap;
103 // ----------------------------------------------------------------------------
104 // exported functions
105 // ----------------------------------------------------------------------------