rnd-20050314-1-src
[rocksndiamonds.git] / src / game_em / main_em.h
index e1173bcb1ca471ecb5f6f06a16c99c2e1378e99e..17cb9f73df67ebc4380f9b546301b18936068e1e 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef MAIN_EM_H
 #define MAIN_EM_H
 
+#include "../engines.h"
+
+
 /* 2000-07-30T11:06:03Z ---------------------------------------------------- */
 
 #define EM_MAX_CAVE_WIDTH              102
 #define EM_ENGINE_BAD_ROLL
 #define EM_ENGINE_BAD_SPRING
 
+
+/*
+  -----------------------------------------------------------------------------
+  definition of elements used in the Emerald Mine Club engine;
+  the element names have the following properties:
+  - elements that start with an 'X' can be stored in a level file;
+  - elements that start with an 'Y' indicate moving elements;
+  - elements that end with a 'B' are the "backside" of a moving element.
+  -----------------------------------------------------------------------------
+*/
+
 enum
 {
   Xblank = 0,          /* still */
@@ -246,6 +260,22 @@ enum
   Xball_2,
   Xball_2B,
   Yball_eat,
+
+#if 1
+  Ykey_1_eat,
+  Ykey_2_eat,
+  Ykey_3_eat,
+  Ykey_4_eat,
+  Ykey_5_eat,
+  Ykey_6_eat,
+  Ykey_7_eat,
+  Ykey_8_eat,
+  Ylenses_eat,
+  Ymagnify_eat,
+  Ygrass_eat,
+  Ydirt_eat,
+#endif
+
   Xgrow_ns,
   Ygrow_ns_eat,
   Xgrow_ew,
@@ -332,6 +362,18 @@ enum
   Xfake_door_6,
   Xfake_door_7,
   Xfake_door_8,
+
+#if 1
+  Xfake_acid_1,
+  Xfake_acid_2,
+  Xfake_acid_3,
+  Xfake_acid_4,
+  Xfake_acid_5,
+  Xfake_acid_6,
+  Xfake_acid_7,
+  Xfake_acid_8,
+#endif
+
   Xsteel_1,
   Xsteel_2,
   Xsteel_3,
@@ -425,74 +467,132 @@ enum
   TILE_MAX
 };
 
+enum
+{
+  SPR_still = 0,
+  SPR_walk  = 1,
+  SPR_push  = 5,
+  SPR_spray = 9,
+
+  SPR_MAX   = 13
+};
+
+enum
+{
+  SAMPLE_blank = 0,    /* player walks on blank */
+  SAMPLE_roll,         /* player pushes stone/bomb/nut/spring */
+  SAMPLE_stone,                /* stone hits ground */
+  SAMPLE_nut,          /* nut hits ground */
+  SAMPLE_crack,                /* stone hits nut */
+  SAMPLE_bug,          /* bug moves */
+  SAMPLE_tank,         /* tank moves */
+  SAMPLE_android_clone,        /* android places something */
+  SAMPLE_android_move, /* android moves */
+  SAMPLE_spring,       /* spring hits ground/wall/bumper, stone hits spring */
+  SAMPLE_slurp,                /* spring kills alien */
+  SAMPLE_eater,                /* eater sits */
+  SAMPLE_eater_eat,    /* eater eats diamond */
+  SAMPLE_alien,                /* alien moves */
+  SAMPLE_collect,      /* player collects object */
+  SAMPLE_diamond,      /* diamond/emerald hits ground */
+  SAMPLE_squash,       /* stone squashes diamond */
+  SAMPLE_wonderfall,   /* object falls thru wonderwall */
+  SAMPLE_drip,         /* drip hits ground */
+  SAMPLE_push,         /* player pushes balloon/android */
+  SAMPLE_dirt,         /* player walks on dirt */
+  SAMPLE_acid,         /* acid splashes */
+  SAMPLE_ball,         /* ball places something */
+  SAMPLE_grow,         /* growing wall grows */
+  SAMPLE_wonder,       /* wonderwall is active */
+  SAMPLE_door,         /* player goes thru door (gate) */
+  SAMPLE_exit_open,    /* exit opens */
+  SAMPLE_exit_leave,   /* player goes into exit */
+  SAMPLE_dynamite,     /* player places dynamite */
+  SAMPLE_tick,         /* dynamite ticks */
+  SAMPLE_press,                /* player presses wheel/wind/switch */
+  SAMPLE_wheel,                /* wheel moves */
+  SAMPLE_boom,         /* explosion */
+  SAMPLE_time,         /* time runs out */
+  SAMPLE_die,          /* player dies */
+
+  SAMPLE_MAX
+};
+
 struct LEVEL
 {
-  unsigned int home_initial;          /* number of players (initial) */
-  unsigned int home;                  /* number of players not yet at home */
-                                      /* 0 == all players at home */
-
-  unsigned int width;                 /* playfield width */
-  unsigned int height;                /* playfield height */
-  unsigned int time_initial;          /* time remaining (initial) */
-  unsigned int time;                  /* time remaining (runtime) */
-  unsigned int required_initial;      /* emeralds needed (initial) */
-  unsigned int required;              /* emeralds needed (runtime) */
-  unsigned int score;                 /* score */
-
-  /* fill in all below /every/ time you read a level */
-  unsigned int alien_score;           /* alien popped by stone/spring score */
-  unsigned int amoeba_time;           /* amoeba speed */
-  unsigned int android_move_cnt_initial; /* android move time counter (initial) */
-  unsigned int android_move_cnt;      /* android move time counter */
-  unsigned int android_move_time;     /* android move reset time */
-  unsigned int android_clone_cnt_initial; /* android clone time counter (initial) */
-  unsigned int android_clone_cnt;     /* android clone time counter */
-  unsigned int android_clone_time;    /* android clone reset time */
-  unsigned int ball_cnt;              /* ball time counter */
-  unsigned int ball_pos;              /* ball array pos counter */
-  unsigned int ball_random;           /* ball is random flag */
-  unsigned int ball_state_initial;    /* ball currently on flag (initial) */
-  unsigned int ball_state;            /* ball currently on flag */
-  unsigned int ball_time;             /* ball reset time */
-  unsigned int bug_score;             /* bug popped by stone/spring score */
-  unsigned int diamond_score;         /* diamond collect score */
-  unsigned int dynamite_score;        /* dynamite collect scoer*/
-  unsigned int eater_pos;             /* eater array pos */
-  unsigned int eater_score;           /* eater popped by stone/spring score */
-  unsigned int emerald_score;         /* emerald collect score */
-  unsigned int exit_score;            /* exit score */
-  unsigned int key_score;             /* key collect score */
-  unsigned int lenses_cnt_initial;    /* lenses time counter (initial) */
-  unsigned int lenses_cnt;            /* lenses time counter */
-  unsigned int lenses_score;          /* lenses collect score */
-  unsigned int lenses_time;           /* lenses reset time */
-  unsigned int magnify_cnt_initial;   /* magnify time counter (initial) */
-  unsigned int magnify_cnt;           /* magnify time counter */
-  unsigned int magnify_score;         /* magnify collect score */
-  unsigned int magnify_time;          /* magnify reset time */
-  unsigned int nut_score;             /* nut crack score */
-  unsigned int shine_cnt;             /* shine counter for emerald/diamond */
-  unsigned int slurp_score;           /* slurp alien score */
-  unsigned int tank_score;            /* tank popped by stone/spring */
-  unsigned int wheel_cnt_initial;     /* wheel time counter (initial) */
-  unsigned int wheel_cnt;             /* wheel time counter */
-  unsigned int wheel_x_initial;       /* wheel x pos (initial) */
-  unsigned int wheel_x;               /* wheel x pos */
-  unsigned int wheel_y_initial;       /* wheel y pos (initial) */
-  unsigned int wheel_y;               /* wheel y pos */
-  unsigned int wheel_time;            /* wheel reset time */
-  unsigned int wind_cnt_initial;      /* wind time counter (initial) */
-  unsigned int wind_cnt;              /* wind time counter */
-  unsigned int wind_direction_initial;/* wind direction (initial) */
-  unsigned int wind_direction;        /* wind direction */
-  unsigned int wind_time;             /* wind reset time */
-  unsigned int wonderwall_state_initial; /* wonderwall currently on flag (initial) */
-  unsigned int wonderwall_state;      /* wonderwall currently on flag */
-  unsigned int wonderwall_time_initial;/* wonderwall time (initial) */
-  unsigned int wonderwall_time;       /* wonderwall time */
-  unsigned short eater_array[8][9];   /* eater data */
-  unsigned short ball_array[8][8];    /* ball data */
-  unsigned short android_array[TILE_MAX]; /* android clone table */
+  unsigned int home_initial;           /* number of players (initial) */
+  unsigned int home;                   /* number of players not yet at home */
+                                       /* 0 == all players at home */
+
+  unsigned int width;                  /* playfield width */
+  unsigned int height;                 /* playfield height */
+
+  unsigned int time_seconds;           /* available time (seconds) */
+  unsigned int time_initial;           /* available time (initial) */
+  unsigned int time;                   /* time remaining (runtime) */
+
+  boolean killed_out_of_time;          /* kill player due to time out */
+
+  unsigned int required_initial;       /* emeralds needed (initial) */
+  unsigned int required;               /* emeralds needed (runtime) */
+
+  unsigned int score;                  /* score */
+
+  /* all below entries must be filled every time a level is read */
+
+  unsigned int alien_score;            /* score for killing alien */
+  unsigned int amoeba_time;            /* amoeba speed */
+  unsigned int android_move_cnt_initial;/* android move counter (initial) */
+  unsigned int android_move_cnt;       /* android move counter */
+  unsigned int android_move_time;      /* android move reset time */
+  unsigned int android_clone_cnt_initial;/* android clone counter (initial) */
+  unsigned int android_clone_cnt;      /* android clone counter */
+  unsigned int android_clone_time;     /* android clone reset time */
+  unsigned int ball_cnt;               /* ball counter */
+  unsigned int ball_pos;               /* ball array pos counter */
+  unsigned int ball_random;            /* ball is random flag */
+  unsigned int ball_state_initial;     /* ball active flag (initial) */
+  unsigned int ball_state;             /* ball active flag */
+  unsigned int ball_time;              /* ball reset time */
+  unsigned int bug_score;              /* score for killing bug */
+  unsigned int diamond_score;          /* score for collecting diamond */
+  unsigned int dynamite_score;         /* score for collecting dynamite */
+  unsigned int eater_pos;              /* eater array pos */
+  unsigned int eater_score;            /* score for killing eater */
+  unsigned int emerald_score;          /* score for collecting emerald */
+  unsigned int exit_score;             /* score for entering exit */
+  unsigned int key_score;              /* score for colleting key */
+  unsigned int lenses_cnt_initial;     /* lenses counter (initial) */
+  unsigned int lenses_cnt;             /* lenses counter */
+  unsigned int lenses_score;           /* score for collecting lenses */
+  unsigned int lenses_time;            /* lenses reset time */
+  unsigned int magnify_cnt_initial;    /* magnify counter (initial) */
+  unsigned int magnify_cnt;            /* magnify counter */
+  unsigned int magnify_score;          /* score for collecting magnifier */
+  unsigned int magnify_time;           /* magnify reset time */
+  unsigned int nut_score;              /* score for cracking nut */
+  unsigned int shine_cnt;              /* shine counter for emerald/diamond */
+  unsigned int slurp_score;            /* score for slurping alien */
+  unsigned int tank_score;             /* score for killing tank */
+  unsigned int wheel_cnt_initial;      /* wheel counter (initial) */
+  unsigned int wheel_cnt;              /* wheel counter */
+  unsigned int wheel_x_initial;                /* wheel x pos (initial) */
+  unsigned int wheel_x;                        /* wheel x pos */
+  unsigned int wheel_y_initial;                /* wheel y pos (initial) */
+  unsigned int wheel_y;                        /* wheel y pos */
+  unsigned int wheel_time;             /* wheel reset time */
+  unsigned int wind_cnt_initial;       /* wind counter (initial) */
+  unsigned int wind_cnt;               /* wind time counter */
+  unsigned int wind_direction_initial; /* wind direction (initial) */
+  unsigned int wind_direction;         /* wind direction */
+  unsigned int wind_time;              /* wind reset time */
+  unsigned int wonderwall_state_initial;/* wonderwall active flag (initial) */
+  unsigned int wonderwall_state;       /* wonderwall active flag */
+  unsigned int wonderwall_time_initial;        /* wonderwall time (initial) */
+  unsigned int wonderwall_time;                /* wonderwall time */
+  unsigned short eater_array[8][9];    /* eater data */
+  unsigned short ball_array[8][8];     /* ball data */
+  unsigned short android_array[TILE_MAX];/* android clone table */
 };
 
 struct PLAYER
@@ -513,21 +613,62 @@ struct PLAYER
   unsigned int oldx;
   unsigned int oldy;
 
+  unsigned int last_move_dir;
+
   unsigned joy_n:1;
   unsigned joy_e:1;
   unsigned joy_s:1;
   unsigned joy_w:1;
-  unsigned joy_fire:1;
+  unsigned joy_snap:1;
+  unsigned joy_drop:1;
   unsigned joy_stick:1;
   unsigned joy_spin:1;
 };
 
+
+/* ------------------------------------------------------------------------- */
+/* definitions and structures for use by the main game functions             */
+/* ------------------------------------------------------------------------- */
+
+/* values for native Emerald Mine game version */
+#define FILE_VERSION_EM_V3     3
+#define FILE_VERSION_EM_V4     4
+#define FILE_VERSION_EM_V5     5
+#define FILE_VERSION_EM_V6     6
+
+#define FILE_VERSION_EM_ACTUAL FILE_VERSION_EM_V6
+
+struct GlobalInfo_EM
+{
+  Bitmap *screenbuffer;
+};
+
 struct LevelInfo_EM
 {
+  int file_version;
+
+  unsigned short cave[EM_MAX_CAVE_WIDTH][EM_MAX_CAVE_HEIGHT];
+
   struct LEVEL *lev;
   struct PLAYER *ply1, *ply2;
+};
 
-  unsigned short cave[EM_MAX_CAVE_WIDTH][EM_MAX_CAVE_HEIGHT];
+struct GraphicInfo_EM
+{
+  Bitmap *bitmap;
+  int src_x, src_y;
+  int src_offset_x, src_offset_y;
+  int dst_offset_x, dst_offset_y;
+  int width, height;
+
+  Bitmap *crumbled_bitmap;
+  int crumbled_src_x, crumbled_src_y;
+  int crumbled_border_size;
+
+  boolean has_crumbled_graphics;
+  boolean preserve_background;
+
+  int unique_identifier;       /* used to identify needed screen updates */
 };
 
 #endif /* MAIN_EM_H */