rnd-20061017-1-src
[rocksndiamonds.git] / src / main.h
index 24cc61c8312dabbebc5836b78216356aaaf8cc85..3c3a40fb5181bd3a297542b5e64c20d6138642c8 100644 (file)
@@ -1,7 +1,7 @@
 /***********************************************************
 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
 *----------------------------------------------------------*
-* (c) 1995-2002 Artsoft Entertainment                      *
+* (c) 1995-2006 Artsoft Entertainment                      *
 *               Holger Schemel                             *
 *               Detmolder Strasse 189                      *
 *               33604 Bielefeld                            *
 #define EP_BITMASK_DEFAULT             0
 
 #define PROPERTY_BIT(p)                        (1 << ((p) % 32))
-#if 1
 #define PROPERTY_VAR(e,p)              (element_info[e].properties[(p) / 32])
-#else
-#define PROPERTY_VAR(e,p)              (Properties[e][(p) / 32])
-#endif
 #define HAS_PROPERTY(e,p)      ((PROPERTY_VAR(e, p) & PROPERTY_BIT(p)) != 0)
 #define SET_PROPERTY(e,p,v)    ((v) ?                                     \
                                 (PROPERTY_VAR(e,p) |=  PROPERTY_BIT(p)) : \
 #define SND_ELEMENT(e)         (e)
 #endif
 
-#if 1
 #define GROUP_NR(e)            ((e) - EL_GROUP_START)
 #define IS_IN_GROUP(e, nr)     (element_info[e].in_group[nr] == TRUE)
 #define IS_IN_GROUP_EL(e, ge)  (IS_IN_GROUP(e, (ge) - EL_GROUP_START))
 
-#if 1
 #define IS_EQUAL_OR_IN_GROUP(e, ge)                                    \
        (ge == EL_ANY_ELEMENT ? TRUE :                                  \
         IS_GROUP_ELEMENT(ge) ? IS_IN_GROUP(e, GROUP_NR(ge)) : (e) == (ge))
-#else
-#define IS_EQUAL_OR_IN_GROUP(e, ge)                                    \
-       (IS_GROUP_ELEMENT(ge) ? IS_IN_GROUP(e, GROUP_NR(ge)) : (e) == (ge))
-#endif
-
-#endif
 
 #define IS_PLAYER(x, y)                (ELEM_IS_PLAYER(StorePlayer[x][y]))
 
 #define ANIM_DELAY(g)          (graphic_info[g].anim_delay)
 #define ANIM_MODE(g)           (graphic_info[g].anim_mode)
 
+#define IS_ANIM_MODE_CE(g)     (graphic_info[g].anim_mode & (ANIM_CE_VALUE |  \
+                                                             ANIM_CE_SCORE |  \
+                                                             ANIM_CE_DELAY))
 #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 MAX_NUM_AMOEBA         100
 
-#if 0  /* game.h */
-#define MAX_INVENTORY_SIZE     1000
-#define STD_NUM_KEYS           4
-#define MAX_NUM_KEYS           8
-#endif
-
 #define NUM_BELTS              4
 #define NUM_BELT_PARTS         3
 #define NUM_ENVELOPES          4
 
 #define EL_BD_EXPANDABLE_WALL          713
 
-#define EL_LAST_CE_8                   714
-#define EL_LAST_CE_7                   715
-#define EL_LAST_CE_6                   716
-#define EL_LAST_CE_5                   717
-#define EL_LAST_CE_4                   718
-#define EL_LAST_CE_3                   719
-#define EL_LAST_CE_2                   720
-#define EL_LAST_CE_1                   721
+#define EL_PREV_CE_8                   714
+#define EL_PREV_CE_7                   715
+#define EL_PREV_CE_6                   716
+#define EL_PREV_CE_5                   717
+#define EL_PREV_CE_4                   718
+#define EL_PREV_CE_3                   719
+#define EL_PREV_CE_2                   720
+#define EL_PREV_CE_1                   721
 #define EL_SELF                                722
 #define EL_NEXT_CE_1                   723
 #define EL_NEXT_CE_2                   724
 #define NUM_MUS_ARGS                   1
 
 
-/* values for font configuration */
+/* values for font configuration (definitions must match those from main.c) */
 #define FONT_INITIAL_1                 0
 #define FONT_INITIAL_2                 1
 #define FONT_INITIAL_3                 2
 #define FONT_INITIAL_4                 3
 #define FONT_TITLE_1                   4
 #define FONT_TITLE_2                   5
-#define FONT_MENU_1                    6
-#define FONT_MENU_2                    7
-#define FONT_TEXT_1_ACTIVE             8
-#define FONT_TEXT_2_ACTIVE             9
-#define FONT_TEXT_3_ACTIVE             10
-#define FONT_TEXT_4_ACTIVE             11
-#define FONT_TEXT_1                    12
-#define FONT_TEXT_2                    13
-#define FONT_TEXT_3                    14
-#define FONT_TEXT_4                    15
-#define FONT_ENVELOPE_1                        16
-#define FONT_ENVELOPE_2                        17
-#define FONT_ENVELOPE_3                        18
-#define FONT_ENVELOPE_4                        19
-#define FONT_INPUT_1_ACTIVE            20
-#define FONT_INPUT_2_ACTIVE            21
-#define FONT_INPUT_1                   22
-#define FONT_INPUT_2                   23
-#define FONT_OPTION_OFF                        24
-#define FONT_OPTION_ON                 25
-#define FONT_VALUE_1                   26
-#define FONT_VALUE_2                   27
-#define FONT_VALUE_OLD                 28
-#define FONT_LEVEL_NUMBER_ACTIVE       29
-#define FONT_LEVEL_NUMBER              30
-#define FONT_TAPE_RECORDER             31
-#define FONT_GAME_INFO                 32
-
-#define NUM_FONTS                      33
+#define FONT_MENU_1_ACTIVE             6
+#define FONT_MENU_2_ACTIVE             7
+#define FONT_MENU_1                    8
+#define FONT_MENU_2                    9
+#define FONT_TEXT_1_ACTIVE             10
+#define FONT_TEXT_2_ACTIVE             11
+#define FONT_TEXT_3_ACTIVE             12
+#define FONT_TEXT_4_ACTIVE             13
+#define FONT_TEXT_1                    14
+#define FONT_TEXT_2                    15
+#define FONT_TEXT_3                    16
+#define FONT_TEXT_4                    17
+#define FONT_ENVELOPE_1                        18
+#define FONT_ENVELOPE_2                        19
+#define FONT_ENVELOPE_3                        20
+#define FONT_ENVELOPE_4                        21
+#define FONT_INPUT_1_ACTIVE            22
+#define FONT_INPUT_2_ACTIVE            23
+#define FONT_INPUT_1                   24
+#define FONT_INPUT_2                   25
+#define FONT_OPTION_OFF                        26
+#define FONT_OPTION_ON                 27
+#define FONT_VALUE_1                   28
+#define FONT_VALUE_2                   29
+#define FONT_VALUE_OLD                 30
+#define FONT_LEVEL_NUMBER_ACTIVE       31
+#define FONT_LEVEL_NUMBER              32
+#define FONT_TAPE_RECORDER             33
+#define FONT_GAME_INFO                 34
+
+#define NUM_FONTS                      35
 #define NUM_INITIAL_FONTS              4
 
+#define FONT_ACTIVE(f)                                                   \
+       ((f) == FONT_MENU_1             ? FONT_MENU_1_ACTIVE            : \
+        (f) == FONT_MENU_2             ? FONT_MENU_2_ACTIVE            : \
+        (f) == FONT_TEXT_1             ? FONT_TEXT_1_ACTIVE            : \
+        (f) == FONT_TEXT_2             ? FONT_TEXT_2_ACTIVE            : \
+        (f) == FONT_TEXT_3             ? FONT_TEXT_3_ACTIVE            : \
+        (f) == FONT_TEXT_4             ? FONT_TEXT_4_ACTIVE            : \
+        (f) == FONT_INPUT_1            ? FONT_INPUT_1_ACTIVE           : \
+        (f) == FONT_INPUT_2            ? FONT_INPUT_2_ACTIVE           : \
+        (f) == FONT_LEVEL_NUMBER       ? FONT_LEVEL_NUMBER_ACTIVE      : \
+        (f))
+
+
 /* values for game_status (must match special image configuration suffixes) */
 #define GAME_MODE_DEFAULT              0
 #define GAME_MODE_TITLE                        1
 /* program information and versioning definitions */
 #define PROGRAM_VERSION_MAJOR          3
 #define PROGRAM_VERSION_MINOR          2
-#define PROGRAM_VERSION_PATCH          1
+#define PROGRAM_VERSION_PATCH          3
 #define PROGRAM_VERSION_BUILD          0
 
 #define PROGRAM_TITLE_STRING           "Rocks'n'Diamonds"
 #define NUM_ENGINE_TYPES               3
 
 
+struct BorderInfo
+{
+  int draw_masked[NUM_SPECIAL_GFX_ARGS];
+};
+
+struct MenuMainButtonInfo
+{
+  struct Rect name;
+  struct Rect levels;
+  struct Rect scores;
+  struct Rect editor;
+  struct Rect info;
+  struct Rect game;
+  struct Rect setup;
+  struct Rect quit;
+
+  struct Rect prev_level;
+  struct Rect next_level;
+};
+
+struct MenuMainTextInfo
+{
+  struct Rect name;
+  struct Rect levels;
+  struct Rect scores;
+  struct Rect editor;
+  struct Rect info;
+  struct Rect game;
+  struct Rect setup;
+  struct Rect quit;
+
+  struct Rect current_level;
+  struct Rect first_level;
+  struct Rect last_level;
+  struct Rect levelset_info;
+  struct Rect level_info;
+};
+
+struct MenuMainInputInfo
+{
+  struct Rect name;
+};
+
+struct MenuMainInfo
+{
+  struct MenuMainButtonInfo button;
+  struct MenuMainTextInfo text;
+  struct MenuMainInputInfo input;
+};
+
 struct MenuInfo
 {
   int draw_xoffset[NUM_SPECIAL_GFX_ARGS];
@@ -1839,8 +1889,13 @@ struct MenuInfo
 
   int list_size[NUM_SPECIAL_GFX_ARGS];
 
+  int fade_delay;
+  int post_delay;
+
   int sound[NUM_SPECIAL_GFX_ARGS];
   int music[NUM_SPECIAL_GFX_ARGS];
+
+  struct MenuMainInfo main;
 };
 
 struct DoorInfo
@@ -1852,6 +1907,15 @@ struct DoorInfo
   int anim_mode;
 };
 
+struct PreviewInfo
+{
+  int x, y;
+  int xsize, ysize;
+  int tile_size;
+  int step_offset;
+  int step_delay;
+};
+
 struct HiScore
 {
   char Name[MAX_PLAYER_NAME_LEN + 1];
@@ -1953,7 +2017,6 @@ struct LevelInfo
   int explosion_element[MAX_PLAYERS];
   boolean use_explosion_element[MAX_PLAYERS];
 
-#if 1
   /* values for the new EMC elements */
   int android_move_time;
   int android_clone_time;
@@ -1970,12 +2033,8 @@ struct LevelInfo
   struct Content ball_content[MAX_ELEMENT_CONTENTS];
   int num_ball_contents;
 
-#if 0
-  boolean android_array[16];
-#endif
   int num_android_clone_elements;
   int android_clone_element[MAX_ANDROID_ELEMENTS];
-#endif
 
   int can_move_into_acid_bits; /* bitfield to store property for elements */
   int dont_collide_with_bits;  /* bitfield to store property for elements */
@@ -2221,20 +2280,28 @@ struct GraphicInfo
 
   int src_x, src_y;            /* start position of animation frames */
   int width, height;           /* width/height of each animation frame */
+
   int offset_x, offset_y;      /* x/y offset to next animation frame */
   int offset2_x, offset2_y;    /* x/y offset to second movement tile */
+
   boolean double_movement;     /* animation has second movement tile */
   int swap_double_tiles;       /* explicitely force or forbid tile swapping */
+
   int anim_frames;
   int anim_frames_per_line;
   int anim_start_frame;
   int anim_delay;              /* important: delay of 1 means "no delay"! */
   int anim_mode;
+
   boolean anim_global_sync;
+
   int crumbled_like;           /* element for cloning crumble graphics */
   int diggable_like;           /* element for cloning digging graphics */
+
   int border_size;             /* border size for "crumbled" graphics */
+
   int scale_up_factor;         /* optional factor for scaling image up */
+
   int clone_from;              /* graphic for cloning *all* settings */
 
   int anim_delay_fixed;                /* optional delay values for bored and   */
@@ -2324,8 +2391,9 @@ struct HelpAnimInfo
 };
 
 
-extern Bitmap                 *bitmap_db_title;
+extern Bitmap                 *bitmap_db_cross;
 extern Bitmap                 *bitmap_db_field;
+extern Bitmap                 *bitmap_db_panel;
 extern Bitmap                 *bitmap_db_door;
 extern Pixmap                  tile_clipmask[];
 extern DrawBuffer             *fieldbuffer;
@@ -2372,10 +2440,6 @@ extern short                     ExplodeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern int                     RunnerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern int                     PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 
-#if 0
-extern unsigned long           Properties[MAX_NUM_ELEMENTS][NUM_EP_BITFIELDS];
-#endif
-
 extern int                     GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern int                     GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern int                     GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
@@ -2400,8 +2464,6 @@ extern int                        ExitX, ExitY;
 extern int                     AllPlayersGone;
 
 extern int                     TimeFrames, TimePlayed, TimeLeft, TapeTime;
-extern boolean                 SiebAktiv;
-extern int                     SiebCount;
 
 extern boolean                 network_player_action_received;
 
@@ -2412,8 +2474,10 @@ extern struct LevelInfo          level, level_template;
 extern struct HiScore          highscore[];
 extern struct TapeInfo         tape;
 extern struct GlobalInfo       global;
+extern struct BorderInfo       border;
 extern struct MenuInfo         menu;
 extern struct DoorInfo         door_1, door_2;
+extern struct PreviewInfo      preview;
 extern struct ElementInfo      element_info[];
 extern struct ElementNameInfo  element_name_info[];
 extern struct ElementActionInfo        element_action_info[];