rnd-20070413-1-src
[rocksndiamonds.git] / src / main.h
index 3bd3d6bebe75a2c1b0b449e262b0d4ed115c828c..2f323f279a3f05d55b2581c18a276339dfb4c0c9 100644 (file)
 #define IS_OBSOLETE(e)         HAS_PROPERTY(e, EP_OBSOLETE)
 
 /* special macros used in game engine */
+#define IS_FILE_ELEMENT(e)     ((e) >= 0 &&                            \
+                                (e) <= NUM_FILE_ELEMENTS)
+
+#define IS_DRAWABLE_ELEMENT(e) ((e) >= 0 &&                            \
+                                (e) <= NUM_DRAWABLE_ELEMENTS)
+
+#define IS_RUNTIME_ELEMENT(e)  ((e) >= 0 &&                            \
+                                (e) <= NUM_RUNTIME_ELEMENTS)
+
+#define IS_VALID_ELEMENT(e)    ((e) >= 0 &&                            \
+                                (e) <= MAX_NUM_ELEMENTS)
+
 #define IS_CUSTOM_ELEMENT(e)   ((e) >= EL_CUSTOM_START &&              \
                                 (e) <= EL_CUSTOM_END)
 
                                 (d) == MV_UP    ? "MV_UP"    :         \
                                 (d) == MV_DOWN  ? "MV_DOWN"  : "(various)")
 
+#define ELEMENT_ACTIVE(e)      (ActiveElement[e])
+
+#define FONT_ACTIVE(f)         (ActiveFont[f])
+
+
 /* fundamental game speed values */
 #define MICROLEVEL_SCROLL_DELAY        50      /* delay for scrolling micro level */
 #define MICROLEVEL_LABEL_DELAY 250     /* delay for micro level label */
 
 #define MAX_NUM_AMOEBA         100
 
-#define NUM_BELTS              4
-#define NUM_BELT_PARTS         3
 #define NUM_ENVELOPES          4
 #define MIN_ENVELOPE_XSIZE     1
 #define MIN_ENVELOPE_YSIZE     1
 #define EL_EMC_DRIPPER_ACTIVE          (EL_FIRST_RUNTIME_REAL + 70)
 #define EL_EMC_SPRING_BUMPER_ACTIVE    (EL_FIRST_RUNTIME_REAL + 71)
 
+#define NUM_DRAWABLE_ELEMENTS          (EL_FIRST_RUNTIME_REAL + 72)
+
 /* "unreal" (and therefore not drawable) runtime elements */
-#define EL_FIRST_RUNTIME_UNREAL                (EL_FIRST_RUNTIME_REAL + 72)
+#define EL_FIRST_RUNTIME_UNREAL                (NUM_DRAWABLE_ELEMENTS)
 
 #define EL_BLOCKED                     (EL_FIRST_RUNTIME_UNREAL + 0)
 #define EL_EXPLOSION                   (EL_FIRST_RUNTIME_UNREAL + 1)
 #define NUM_FONTS                      37
 #define NUM_INITIAL_FONTS              4
 
+#if 0
 #define FONT_ACTIVE(f)                                                   \
        ((f) == FONT_MENU_1             ? FONT_MENU_1_ACTIVE            : \
         (f) == FONT_MENU_2             ? FONT_MENU_2_ACTIVE            : \
         (f) == FONT_INPUT_2            ? FONT_INPUT_2_ACTIVE           : \
         (f) == FONT_LEVEL_NUMBER       ? FONT_LEVEL_NUMBER_ACTIVE      : \
         (f))
-
+#endif
 
 /* values for game_status (must match special image configuration suffixes) */
 #define GAME_MODE_DEFAULT              0
 #define PROGRAM_VERSION_MAJOR          3
 #define PROGRAM_VERSION_MINOR          2
 #define PROGRAM_VERSION_PATCH          4
-#define PROGRAM_VERSION_BUILD          0
+#define PROGRAM_VERSION_BUILD          1
 
 #define PROGRAM_TITLE_STRING           "Rocks'n'Diamonds"
 #define PROGRAM_AUTHOR_STRING          "Holger Schemel"
@@ -2456,6 +2474,9 @@ struct ElementInfo
 
   int collect_score;           /* runtime score value for collecting */
 
+  /* count of this element on playfield, calculated after each frame */
+  int element_count;
+
   /* ---------- internal values used in level editor ---------- */
 
   int access_type;             /* walkable or passable */
@@ -2667,6 +2688,9 @@ extern int                        GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern int                     GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern int                     GfxDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 
+extern int                     ActiveElement[MAX_NUM_ELEMENTS];
+extern int                     ActiveFont[NUM_FONTS];
+
 extern int                     lev_fieldx, lev_fieldy;
 extern int                     scroll_x, scroll_y;