rnd-20030201-2-src
[rocksndiamonds.git] / src / main.h
index af8c540fbc2b6c52b2f50558abaddea2953fbe54..24bcc8469af2aee49f7eb4a4784fe9daa6c992b5 100644 (file)
 #define IS_TUBE(e)             (Properties2[e] & EP_BIT_TUBE)
 #define IS_EM_SLIPPERY_WALL(e) (Properties2[e] & EP_BIT_EM_SLIPPERY_WALL)
 
+#define IS_CUSTOM_ELEMENT(e)   ((e) >= EL_CUSTOM_START &&      \
+                                (e) <= EL_CUSTOM_END)
+
 #define IS_PLAYER(x,y)         (ELEM_IS_PLAYER(StorePlayer[x][y]))
 
 #define IS_FREE(x,y)           (Feld[x][y] == EL_EMPTY && !IS_PLAYER(x,y))
 
 #define PLAYER_NR_GFX(g,i)     ((g) + i * (IMG_PLAYER2 - IMG_PLAYER1))
 
+#define ANIM_FRAMES(g)         (graphic_info[g].anim_frames)
+#define ANIM_DELAY(g)          (graphic_info[g].anim_delay)
+#define ANIM_MODE(g)           (graphic_info[g].anim_mode)
+
+#define IS_ANIMATED(g)         (ANIM_FRAMES(g) > 1)
+#define IS_NEW_DELAY(f, g)     ((f) % ANIM_DELAY(g) == 0)
+#define IS_NEW_FRAME(f, g)     (IS_ANIMATED(g) && IS_NEW_DELAY(f, g))
+
+#define IS_LOOP_SOUND(s)       (sound_info[s].loop)
+
 
 #if 0
 
 #define EL_CUSTOM_128                  (EL_CUSTOM_START + 127)
 #define EL_CUSTOM_END                  (EL_CUSTOM_START + 127)
 
+#define NUM_CUSTOM_ELEMENTS            128
 #define NUM_FILE_ELEMENTS              488
 
 
 
 #define NUM_ACTIONS                            21
 
+/* values for special image configuration suffixes */
+#define GFX_SPECIAL_ARG_EDITOR                 0
+
+#define NUM_SPECIAL_GFX_ARGS                   1
+
 
 /* values for image configuration suffixes */
 #define GFX_ARG_XPOS                           0
@@ -1034,11 +1053,14 @@ struct ElementInfo
   char *token_name;            /* element token prefix used in config files */
   char *sound_class_name;      /* classification for custom sound effects */
   char *editor_description;    /* short description for level editor */
+  char *custom_description;    /* custom description for level editor */
 
   int graphic[NUM_ACTIONS];    /* default graphics for several actions */
                                /* special graphics for left/right/up/down */
   int direction_graphic[NUM_ACTIONS][NUM_DIRECTIONS];
 
+  int editor_graphic;          /* graphic displayed in level editor */
+
   int sound[NUM_ACTIONS];      /* default sounds for several actions */
 };
 
@@ -1077,6 +1099,12 @@ struct ElementDirectionInfo
   int value;
 };
 
+struct SpecialSuffixInfo
+{
+  char *suffix;
+  int value;
+};
+
 
 #if 0
 extern GC                      tile_clip_gc;
@@ -1116,7 +1144,8 @@ extern unsigned long              Properties1[MAX_NUM_ELEMENTS];
 extern unsigned long           Properties2[MAX_NUM_ELEMENTS];
 
 extern int                     GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-extern short                   GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern int                     GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern int                     GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 
 extern int                     lev_fieldx, lev_fieldy;
 extern int                     scroll_x, scroll_y;
@@ -1152,6 +1181,7 @@ extern struct GlobalInfo  global;
 extern struct ElementInfo      element_info[];
 extern struct ElementActionInfo        element_action_info[];
 extern struct ElementDirectionInfo element_direction_info[];
+extern struct SpecialSuffixInfo special_suffix_info[];
 extern struct GraphicInfo      *graphic_info;
 extern struct SoundInfo               *sound_info;
 extern struct ConfigInfo       image_config[], sound_config[];