cleanup of setup value fonts on setup screens
[rocksndiamonds.git] / src / game_mm / export_mm.h
1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2024 by Artsoft Entertainment
5 //                  Holger Schemel
6 //                  info@artsoft.org
7 //                  https://www.artsoft.org/
8 // ----------------------------------------------------------------------------
9 // export_mm.h
10 // ============================================================================
11
12 #ifndef EXPORT_MM_H
13 #define EXPORT_MM_H
14
15 // ============================================================================
16 // functions and definitions exported from game_mm to main program
17 // ============================================================================
18
19 // ----------------------------------------------------------------------------
20 // constant definitions
21 // ----------------------------------------------------------------------------
22
23 #define MM_MAX_PLAYFIELD_WIDTH          MAX_PLAYFIELD_WIDTH
24 #define MM_MAX_PLAYFIELD_HEIGHT         MAX_PLAYFIELD_HEIGHT
25
26 #define MM_STD_PLAYFIELD_WIDTH          16
27 #define MM_STD_PLAYFIELD_HEIGHT         12
28
29 #define MM_MAX_PLAYFIELD_SIZE           (MM_MAX_PLAYFIELD_WIDTH *       \
30                                          MM_MAX_PLAYFIELD_HEIGHT)
31
32 #define MAX_NUM_AMOEBA                  100
33 #define MAX_NUM_BEAMERS                 8
34
35 #define MAX_LASER_LEN                   256
36 #define MAX_LASER_ENERGY                100
37 #define MAX_LASER_OVERLOAD              100
38
39 #define MM_LEVEL_SCORE_ELEMENTS         16
40
41 #define MM_MAX_BALL_CONTENTS            16
42
43 #define MM_MAX_LEVEL_NAME_LEN           32
44 #define MM_MAX_LEVEL_AUTHOR_LEN         32
45
46
47 #define EL_MM_START_1_NATIVE            0
48 #define EL_MM_END_1_NATIVE              159
49
50 #define EL_MM_CHAR_START_NATIVE         160
51 #define EL_MM_CHAR_END_NATIVE           239
52
53 #define EL_MM_START_2_NATIVE            240
54 #define EL_MM_END_2_NATIVE              430
55
56 #define EL_MM_START_3_NATIVE            431
57 #define EL_MM_END_3_NATIVE              450
58
59 #define EL_MM_RUNTIME_START_NATIVE      500
60 #define EL_MM_RUNTIME_END_NATIVE        504
61
62 // elements to be specially mapped
63 #define EL_MM_EMPTY_NATIVE              0
64 #define EL_DF_EMPTY_NATIVE              304
65
66 // sounds
67 #define SND_MM_GAME_LEVELTIME_CHARGING  0
68 #define SND_MM_GAME_HEALTH_CHARGING     1
69
70
71 // ----------------------------------------------------------------------------
72 // data structure definitions
73 // ----------------------------------------------------------------------------
74
75 struct CycleList
76 {
77   int x, y;
78   int steps;
79 };
80
81 struct MovingList
82 {
83   int x, y;
84   int dir;
85 };
86
87 struct DamageList
88 {
89   int x, y;
90   int edge, angle;
91   boolean is_mirror;
92 };
93
94 struct BeamerInfo
95 {
96   int x, y;
97   int num;
98 };
99
100 struct PacMan
101 {
102   int XP, YP;
103   int Dr;
104 };
105
106 struct LaserInfo
107 {
108   struct XY start_edge;
109   int start_angle;
110
111   int current_angle;
112
113   struct DamageList damage[MAX_LASER_LEN + 10];
114   int num_damages;
115
116   struct XY edge[MAX_LASER_LEN + 10];
117   int num_edges;
118
119   struct BeamerInfo beamer[MAX_NUM_BEAMERS][2];
120   int beamer_edge[MAX_NUM_BEAMERS];
121   int beamer_nr[MAX_NUM_BEAMERS];
122   int num_beamers;
123
124   boolean overloaded;
125   int overload_value;
126
127   boolean fuse_off;
128   int fuse_x, fuse_y;
129
130   int dest_element;
131   int dest_element_last;
132   int dest_element_last_x;
133   int dest_element_last_y;
134   boolean stops_inside_element;
135
136   boolean redraw;
137
138   int wall_mask;
139 };
140
141 struct GameInfo_MM
142 {
143   boolean LevelSolved;
144   boolean GameOver;
145
146   struct CycleList cycle[MM_MAX_PLAYFIELD_SIZE];
147   int num_cycle;
148
149   struct MovingList pacman[MM_MAX_PLAYFIELD_SIZE];
150   int num_pacman;
151
152   int score;
153   int energy_left;
154   int kettles_still_needed;
155   int lights_still_needed;
156   int num_keys;
157   int ball_choice_pos;          // current content element choice position
158   boolean laser_red, laser_green, laser_blue;
159
160   boolean has_mcduffin;
161   boolean level_solved;
162   boolean game_over;
163   int game_over_cause;
164   char *game_over_message;
165
166   boolean cheat_no_overload;
167   boolean cheat_no_explosion;
168
169   int laser_overload_value;
170   boolean laser_enabled;
171 };
172
173 struct LevelInfo_MM
174 {
175   int file_version;             // version of file the level was stored with
176   int game_version;             // version of game engine to play this level
177   boolean encoding_16bit_field;         // level contains 16-bit elements
178
179   int fieldx;
180   int fieldy;
181   int time;
182   int kettles_needed;
183   boolean auto_count_kettles;
184   boolean mm_laser_red, mm_laser_green, mm_laser_blue;
185   boolean df_laser_red, df_laser_green, df_laser_blue;
186   char name[MM_MAX_LEVEL_NAME_LEN + 1];
187   char author[MM_MAX_LEVEL_AUTHOR_LEN + 1];
188   int score[MM_LEVEL_SCORE_ELEMENTS];
189   int amoeba_speed;
190   int time_fuse;
191   int time_bomb;
192   int time_ball;
193   int time_block;
194
195   int num_ball_contents;
196   int ball_choice_mode;
197   int ball_content[MM_MAX_BALL_CONTENTS];
198   boolean rotate_ball_content;
199   boolean explode_ball;
200
201   short field[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
202 };
203
204 struct EngineSnapshotInfo_MM
205 {
206   struct GameInfo_MM game_mm;
207
208   struct LaserInfo laser;
209
210   short Ur[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
211   short Hit[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
212   short Box[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
213   short Angle[MAX_PLAYFIELD_WIDTH][MAX_PLAYFIELD_HEIGHT];
214
215   short LX, LY;
216   short XS, YS;
217   short ELX, ELY;
218   short CT, Ct;
219
220   int last_LX, last_LY, last_hit_mask;
221   int hold_x, hold_y;
222   int pacman_nr;
223
224   DelayCounter rotate_delay;
225   DelayCounter pacman_delay;
226   DelayCounter energy_delay;
227   DelayCounter overload_delay;
228 };
229
230
231 // ----------------------------------------------------------------------------
232 // exported functions
233 // ----------------------------------------------------------------------------
234
235 extern struct GameInfo_MM game_mm;
236 extern struct LevelInfo_MM native_mm_level;
237 extern struct EngineSnapshotInfo_MM engine_snapshot_mm;
238
239 extern short Ur[MM_MAX_PLAYFIELD_WIDTH][MM_MAX_PLAYFIELD_HEIGHT];
240
241 void mm_open_all(void);
242
243 void InitElementProperties_MM(void);
244
245 void InitGfxBuffers_MM(void);
246
247 void InitGameEngine_MM(void);
248 void InitGameActions_MM(void);
249 void GameActions_MM(struct MouseActionInfo);
250
251 void DrawLaser_MM(void);
252 void DrawTileCursor_MM(int, int, boolean);
253
254 boolean ClickElement(int, int, int);
255
256 unsigned int InitEngineRandom_MM(int);
257
258 void setLevelInfoToDefaults_MM(void);
259 void copyInternalEngineVars_MM(void);
260 boolean LoadNativeLevel_MM(char *, boolean);
261 void SaveNativeLevel_MM(char *);
262
263 int getFieldbufferOffsetX_MM(void);
264 int getFieldbufferOffsetY_MM(void);
265
266 int getFlippedTileX_MM(int);
267 int getFlippedTileY_MM(int);
268 int getFlippedTileXY_MM(int);
269
270 void BlitScreenToBitmap_MM(Bitmap *);
271 void RedrawPlayfield_MM(void);
272
273 void LoadEngineSnapshotValues_MM(void);
274 void SaveEngineSnapshotValues_MM(void);
275
276 int getButtonFromTouchPosition(int, int, int, int);
277
278 #endif  // EXPORT_MM_H