rnd-20060607-1-src
[rocksndiamonds.git] / src / main.h
index 96ce9f7f0eb7bdfc74fe8c9f137104a7d208ad39..ddd1218669d2e0a7377e412f899928b971edb27d 100644 (file)
 #define NUM_ELEMENT_PROPERTIES         90
 
 #define NUM_EP_BITFIELDS               ((NUM_ELEMENT_PROPERTIES + 31) / 32)
-#define EP_BITFIELD_BASE               0
+#define EP_BITFIELD_BASE_NR            0
 
+#define EP_BITMASK_BASE_DEFAULT                (1 << EP_CAN_MOVE_INTO_ACID)
 #define EP_BITMASK_DEFAULT             0
 
 #define PROPERTY_BIT(p)                        (1 << ((p) % 32))
 #define CE_CREATION_OF_X               37
 #define CE_SCORE_GETS_ZERO             38
 #define CE_SCORE_GETS_ZERO_OF_X                39
+#define CE_VALUE_CHANGES               40
+#define CE_VALUE_CHANGES_OF_X          41
+#define CE_SCORE_CHANGES               42
+#define CE_SCORE_CHANGES_OF_X          43
 
-#define NUM_CHANGE_EVENTS              40
+#define NUM_CHANGE_EVENTS              44
+
+#define NUM_CE_BITFIELDS               ((NUM_CHANGE_EVENTS + 31) / 32)
 
 #define CE_BITMASK_DEFAULT             0
 
+#define CH_EVENT_BITFIELD_NR(e)                (e / 32)
+#define CH_EVENT_BIT(e)                        (1 << ((e) % 32))
+
 #define CH_EVENT_VAR(e,c)              (element_info[e].change->has_event[c])
 #define CH_ANY_EVENT_VAR(e,c)          (element_info[e].has_change_event[c])
 
 #define CA_SET_LEVEL_GEMS              7
 #define CA_SET_LEVEL_SCORE             8
 #define CA_SET_LEVEL_WIND              9
-#define CA_SET_LEVEL_GRAVITY           10
+#define CA_SET_PLAYER_GRAVITY          10
 #define CA_SET_PLAYER_KEYS             11
 #define CA_SET_PLAYER_SPEED            12
 #define CA_SET_PLAYER_SHIELD           13
                                 IS_EDITOR_CASCADE_ACTIVE(e)   ? (e) - 1 : (e))
 
 #define EL_NAME(e)             ((e) >= 0 ? element_info[e].token_name : "(?)")
+#define MV_TEXT(d)             ((d) == MV_NONE  ? "MV_NONE"  :         \
+                                (d) == MV_LEFT  ? "MV_LEFT"  :         \
+                                (d) == MV_RIGHT ? "MV_RIGHT" :         \
+                                (d) == MV_UP    ? "MV_UP"    :         \
+                                (d) == MV_DOWN  ? "MV_DOWN"  : "(various)")
 
 /* fundamental game speed values */
 #define MICROLEVEL_SCROLL_DELAY        50      /* delay for scrolling micro level */
 
 #define NUM_BELTS              4
 #define NUM_BELT_PARTS         3
+#define NUM_ENVELOPES          4
 #define MIN_ENVELOPE_XSIZE     1
 #define MIN_ENVELOPE_YSIZE     1
 #define MAX_ENVELOPE_XSIZE     30
 #define STD_ELEMENT_CONTENTS   4
 #define MAX_ELEMENT_CONTENTS   8
 
-#define LEVEL_SCORE_ELEMENTS   16      /* level elements with score */
-
 /* often used screen positions */
 #define SX                     8
 #define SY                     8
 #define SC_CRYSTAL             11
 #define SC_PEARL               12
 #define SC_SHIELD              13
+#define SC_UNKNOWN_14          14
+#define SC_UNKNOWN_15          15
+
+#define LEVEL_SCORE_ELEMENTS   16      /* level elements with score */
 
 
 /* "real" level file elements */
 #define PROGRAM_VERSION_MAJOR          3
 #define PROGRAM_VERSION_MINOR          2
 #define PROGRAM_VERSION_PATCH          0
-#define PROGRAM_VERSION_BUILD          8
+#define PROGRAM_VERSION_BUILD          9
 
 #define PROGRAM_TITLE_STRING           "Rocks'n'Diamonds"
 #define PROGRAM_AUTHOR_STRING          "Holger Schemel"
 #define FILE_VERSION_1_2               VERSION_IDENT(1,2,0,0)
 #define FILE_VERSION_1_4               VERSION_IDENT(1,4,0,0)
 #define FILE_VERSION_2_0               VERSION_IDENT(2,0,0,0)
+#define FILE_VERSION_3_0               VERSION_IDENT(3,0,0,0)
 
 /* file version does not change for every program version, but is changed
    when new features are introduced that are incompatible with older file
    versions, so that they can be treated accordingly */
-#define FILE_VERSION_ACTUAL            FILE_VERSION_2_0
+#define FILE_VERSION_ACTUAL            FILE_VERSION_3_0
 
 #define GAME_VERSION_1_0               FILE_VERSION_1_0
 #define GAME_VERSION_1_2               FILE_VERSION_1_2
 #define GAME_VERSION_1_4               FILE_VERSION_1_4
 #define GAME_VERSION_2_0               FILE_VERSION_2_0
+#define GAME_VERSION_3_0               FILE_VERSION_3_0
 
 #define GAME_VERSION_ACTUAL            VERSION_IDENT(PROGRAM_VERSION_MAJOR, \
                                                      PROGRAM_VERSION_MINOR, \
@@ -1803,6 +1823,14 @@ struct Content
   int e[3][3];
 };
 
+struct EnvelopeInfo
+{
+  int xsize;
+  int ysize;
+
+  char text[MAX_ENVELOPE_TEXT_LEN + 1];
+};
+
 struct LevelSetInfo
 {
   int music[MAX_LEVELS];
@@ -1817,6 +1845,13 @@ struct LevelFileInfo
   char *filename;
 };
 
+struct DateInfo
+{
+  int year;
+  int month;
+  int day;
+};
+
 struct LevelInfo
 {
   struct LevelFileInfo file_info;
@@ -1829,6 +1864,8 @@ struct LevelInfo
   int file_version;    /* file format version the level is stored with    */
   int game_version;    /* game release version the level was created with */
 
+  struct DateInfo creation_date;
+
   boolean encoding_16bit_field;                /* level contains 16-bit elements  */
   boolean encoding_16bit_yamyam;       /* yamyam contains 16-bit elements */
   boolean encoding_16bit_amoeba;       /* amoeba contains 16-bit elements */
@@ -1841,8 +1878,7 @@ struct LevelInfo
   char name[MAX_LEVEL_NAME_LEN + 1];
   char author[MAX_LEVEL_AUTHOR_LEN + 1];
 
-  char envelope_text[4][MAX_ENVELOPE_TEXT_LEN + 1];
-  int envelope_xsize[4], envelope_ysize[4];
+  struct EnvelopeInfo envelope[NUM_ENVELOPES];
 
   int score[LEVEL_SCORE_ELEMENTS];
 
@@ -1904,9 +1940,9 @@ struct LevelInfo
   int can_move_into_acid_bits; /* bitfield to store property for elements */
   int dont_collide_with_bits;  /* bitfield to store property for elements */
 
-  int initial_player_stepsize; /* initial player speed */
+  int initial_player_stepsize[MAX_PLAYERS];    /* initial player speed */
+  boolean initial_player_gravity[MAX_PLAYERS];
 
-  boolean initial_gravity;
   boolean em_slippery_gems;    /* EM style "gems slip from wall" behaviour */
   boolean use_spring_bug;      /* for compatibility with old levels */
   boolean use_time_orb_bug;    /* for compatibility with old levels */