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