rnd-20040927-1-src
[rocksndiamonds.git] / src / main.h
index b1c8303ee0eebafe09db794dc4028a5a8ffd3148..9a3343b8c10cd8f826940c8be6c283355ac9166f 100644 (file)
@@ -23,6 +23,7 @@
 #include <fcntl.h>
 
 #include "libgame/libgame.h"
+#include "game_em/game_em.h"
 
 #include "conf_gfx.h"  /* include auto-generated data structure definitions */
 #include "conf_snd.h"  /* include auto-generated data structure definitions */
 #define GFX_ELEMENT(e)         (element_info[e].use_gfx_element ?      \
                                 element_info[e].gfx_element : e)
 
+/* !!! "use sound" deactivated due to problems with level "bug machine" !!! */
+/* (solution: add separate "use sound of element" to level file and editor) */
+#if 0
 #define SND_ELEMENT(e)         GFX_ELEMENT(e)
+#else
+#define SND_ELEMENT(e)         (e)
+#endif
 
 #define IS_PLAYER(x, y)                (ELEM_IS_PLAYER(StorePlayer[x][y]))
 
 #define EL_TRIGGER_ELEMENT             657
 #define EL_TRIGGER_PLAYER              658
 
-#define NUM_FILE_ELEMENTS              659
+#define EL_SP_GRAVITY_ON_PORT_RIGHT    659
+#define EL_SP_GRAVITY_ON_PORT_DOWN     660
+#define EL_SP_GRAVITY_ON_PORT_LEFT     661
+#define EL_SP_GRAVITY_ON_PORT_UP       662
+#define EL_SP_GRAVITY_OFF_PORT_RIGHT   663
+#define EL_SP_GRAVITY_OFF_PORT_DOWN    664
+#define EL_SP_GRAVITY_OFF_PORT_LEFT    665
+#define EL_SP_GRAVITY_OFF_PORT_UP      666
+
+#if 1
+
+#define NUM_FILE_ELEMENTS              667
+
+/* the following EMC style elements are currently not implemented in R'n'D */
+#define EL_BALLOON_SWITCH_NONE         EL_UNKNOWN
+#define EL_EMC_LEVEL_BORDER            EL_UNKNOWN
+#define EL_EMC_ANDROID                 EL_UNKNOWN
+#define EL_EMC_ANDROID_RIGHT           EL_UNKNOWN
+#define EL_EMC_ANDROID_UP              EL_UNKNOWN
+#define EL_EMC_ANDROID_LEFT            EL_UNKNOWN
+#define EL_EMC_ANDROID_DOWN            EL_UNKNOWN
+#define EL_EMC_ANDROID_LEFT_UP         EL_UNKNOWN
+#define EL_EMC_ANDROID_LEFT_DOWN       EL_UNKNOWN
+#define EL_EMC_ANDROID_RIGHT_UP                EL_UNKNOWN
+#define EL_EMC_ANDROID_RIGHT_DOWN      EL_UNKNOWN
+#define EL_EMC_GRASS                   EL_UNKNOWN
+#define EL_EMC_GENERATOR_BALL          EL_UNKNOWN
+#define EL_EMC_GROW                    EL_UNKNOWN
+#define EL_EMC_GATE_1                  EL_UNKNOWN
+#define EL_EMC_GATE_2                  EL_UNKNOWN
+#define EL_EMC_GATE_3                  EL_UNKNOWN
+#define EL_EMC_GATE_4                  EL_UNKNOWN
+#define EL_EMC_GATE_5                  EL_UNKNOWN
+#define EL_EMC_GATE_6                  EL_UNKNOWN
+#define EL_EMC_GATE_7                  EL_UNKNOWN
+#define EL_EMC_GATE_8                  EL_UNKNOWN
+#define EL_EMC_GATE_1_GRAY             EL_UNKNOWN
+#define EL_EMC_GATE_2_GRAY             EL_UNKNOWN
+#define EL_EMC_GATE_3_GRAY             EL_UNKNOWN
+#define EL_EMC_GATE_4_GRAY             EL_UNKNOWN
+#define EL_EMC_GATE_5_GRAY             EL_UNKNOWN
+#define EL_EMC_GATE_6_GRAY             EL_UNKNOWN
+#define EL_EMC_GATE_7_GRAY             EL_UNKNOWN
+#define EL_EMC_GATE_8_GRAY             EL_UNKNOWN
+#define EL_EMC_KEY_1                   EL_UNKNOWN
+#define EL_EMC_KEY_2                   EL_UNKNOWN
+#define EL_EMC_KEY_3                   EL_UNKNOWN
+#define EL_EMC_KEY_4                   EL_UNKNOWN
+#define EL_EMC_KEY_5                   EL_UNKNOWN
+#define EL_EMC_KEY_6                   EL_UNKNOWN
+#define EL_EMC_KEY_7                   EL_UNKNOWN
+#define EL_EMC_KEY_8                   EL_UNKNOWN
+#define EL_EMC_BUMPER                  EL_UNKNOWN
+#define EL_EMC_PLANT                   EL_UNKNOWN
+#define EL_EMC_LENSES                  EL_UNKNOWN
+#define EL_EMC_MAGNIFY                 EL_UNKNOWN
+
+#else
+
+/* the following EMC style elements are currently not implemented in R'n'D */
+#define EL_BALLOON_SWITCH_NONE         667
+#define EL_EMC_LEVEL_BORDER            668
+#define EL_EMC_ANDROID                 669
+#define EL_EMC_ANDROID_RIGHT           670
+#define EL_EMC_ANDROID_UP              671
+#define EL_EMC_ANDROID_LEFT            672
+#define EL_EMC_ANDROID_DOWN            673
+#define EL_EMC_ANDROID_LEFT_UP         674
+#define EL_EMC_ANDROID_LEFT_DOWN       675
+#define EL_EMC_ANDROID_RIGHT_UP                676
+#define EL_EMC_ANDROID_RIGHT_DOWN      677
+#define EL_EMC_GRASS                   678
+#define EL_EMC_GENERATOR_BALL          679
+#define EL_EMC_GROW                    680
+#define EL_EMC_GATE_1                  681
+#define EL_EMC_GATE_2                  682
+#define EL_EMC_GATE_3                  683
+#define EL_EMC_GATE_4                  684
+#define EL_EMC_GATE_5                  685
+#define EL_EMC_GATE_6                  686
+#define EL_EMC_GATE_7                  687
+#define EL_EMC_GATE_8                  688
+#define EL_EMC_GATE_1_GRAY             689
+#define EL_EMC_GATE_2_GRAY             690
+#define EL_EMC_GATE_3_GRAY             691
+#define EL_EMC_GATE_4_GRAY             692
+#define EL_EMC_GATE_5_GRAY             693
+#define EL_EMC_GATE_6_GRAY             694
+#define EL_EMC_GATE_7_GRAY             695
+#define EL_EMC_GATE_8_GRAY             696
+#define EL_EMC_KEY_1                   697
+#define EL_EMC_KEY_2                   698
+#define EL_EMC_KEY_3                   699
+#define EL_EMC_KEY_4                   700
+#define EL_EMC_KEY_5                   701
+#define EL_EMC_KEY_6                   702
+#define EL_EMC_KEY_7                   703
+#define EL_EMC_KEY_8                   704
+#define EL_EMC_BUMPER                  705
+#define EL_EMC_PLANT                   706
+#define EL_EMC_LENSES                  707
+#define EL_EMC_MAGNIFY                 708
+
+#define NUM_FILE_ELEMENTS              709
+
+#endif
 
 
 /* "real" (and therefore drawable) runtime elements */
 #define GFX_ARG_POST_DELAY_FIXED               28
 #define GFX_ARG_POST_DELAY_RANDOM              29
 #define GFX_ARG_NAME                           30
+#define GFX_ARG_SCALE_UP                       31
 
-#define NUM_GFX_ARGS                           31
+#define NUM_GFX_ARGS                           32
 
 
 /* values for sound configuration suffixes */
 #define SND_ARG_MODE_LOOP                      0
+#define SND_ARG_VOLUME                         1
+#define SND_ARG_PRIORITY                       2
 
-#define NUM_SND_ARGS                           1
+#define NUM_SND_ARGS                           3
 
 
 /* values for music configuration suffixes */
 
 #define PROGRAM_VERSION_MAJOR  3
 #define PROGRAM_VERSION_MINOR  1
-#define PROGRAM_VERSION_PATCH  0
-#define PROGRAM_VERSION_BUILD  3
+#define PROGRAM_VERSION_PATCH  1
+#define PROGRAM_VERSION_BUILD  0
 
 #define PROGRAM_TITLE_STRING   "Rocks'n'Diamonds"
 #define PROGRAM_AUTHOR_STRING  "Holger Schemel"
-#define PROGRAM_COPYRIGHT_STRING "Copyright ©1995-2003 by Holger Schemel"
+#define PROGRAM_COPYRIGHT_STRING "Copyright ©1995-2004 by Holger Schemel"
 
 #define ICON_TITLE_STRING      PROGRAM_TITLE_STRING
 #define COOKIE_PREFIX          "ROCKSNDIAMONDS"
@@ -1366,6 +1481,8 @@ struct PlayerInfo
   boolean use_murphy_graphic;
 
   boolean block_last_field;
+  int block_delay;
+
   boolean can_fall_into_acid;
 
   boolean LevelSolved, GameOver;
@@ -1402,13 +1519,23 @@ struct PlayerInfo
 
   int show_envelope;
 
+#if 1  /* USE_NEW_MOVE_DELAY */
+  int move_delay;
+  int move_delay_value;
+#else
   unsigned long move_delay;
   int move_delay_value;
+#endif
 
   int move_delay_reset_counter;
 
+#if 1  /* USE_NEW_PUSH_DELAY */
+  int push_delay;
+  int push_delay_value;
+#else
   unsigned long push_delay;
   unsigned long push_delay_value;
+#endif
 
   unsigned long actual_frame_counter;
 
@@ -1447,6 +1574,13 @@ struct LevelFileInfo
 
 struct LevelInfo
 {
+  struct LevelFileInfo file_info;
+
+  /* level stored in native format for the native game engines */
+  struct LevelInfo_EM *native_em_level;
+
+  int game_engine_type;
+
   int file_version;    /* file format version the level is stored with    */
   int game_version;    /* game release version the level was created with */
 
@@ -1484,13 +1618,16 @@ struct LevelInfo
   boolean double_speed;
   boolean initial_gravity;
   boolean em_slippery_gems;    /* EM style "gems slip from wall" behaviour */
-  boolean block_last_field;    /* player blocks previous field while moving */
-  boolean sp_block_last_field; /* player blocks previous field while moving */
   boolean use_spring_bug;      /* for compatibility with old levels */
   boolean instant_relocation;  /* no visual delay when relocating player */
   boolean can_pass_to_walkable;        /* player can pass to empty or walkable tile */
   boolean grow_into_diggable;  /* amoeba can grow into anything diggable */
 
+  boolean block_last_field;    /* player blocks previous field while moving */
+  boolean sp_block_last_field; /* player blocks previous field while moving */
+  int block_delay;             /* delay for blocking previous field */
+  int sp_block_delay;          /* delay for blocking previous field */
+
   /* ('int' instead of 'boolean' because used as selectbox value in editor) */
   int use_step_counter;                /* count steps instead of seconds for level */
 
@@ -1499,6 +1636,8 @@ struct LevelInfo
   boolean use_custom_template; /* use custom properties from template file */
 
   boolean no_valid_file;       /* set when level file missing or invalid */
+
+  boolean changed;             /* set when level was changed in the editor */
 };
 
 struct TapeInfo
@@ -1550,6 +1689,10 @@ struct GameInfo
   int initial_move_delay_value;
   int initial_push_delay_value;
 
+  /* flags to handle bugs in and changes between different engine versions */
+  /* (for the latest engine version, these flags should always be "FALSE") */
+  boolean use_bug_change_when_pushing;
+
   /* variable within running game */
   int yamyam_content_nr;
   boolean magic_wall_active;
@@ -1576,6 +1719,9 @@ struct GlobalInfo
   char *autoplay_leveldir;
   int autoplay_level_nr;
 
+  char *convert_leveldir;
+  int convert_level_nr;
+
   int num_toons;
 
   float frames_per_second;
@@ -1644,6 +1790,15 @@ struct ElementGroupInfo
   int choice_pos;              /* current element choice position */
 };
 
+struct ElementNameInfo
+{
+  /* ---------- token and description strings ---------- */
+
+  char *token_name;            /* element token used in config files */
+  char *class_name;            /* element class used in config files */
+  char *editor_description;    /* pre-defined description for level editor */
+};
+
 struct ElementInfo
 {
   /* ---------- token and description strings ---------- */
@@ -1689,6 +1844,7 @@ struct ElementInfo
   int move_pattern;            /* direction movable element moves to */
   int move_direction_initial;  /* initial direction element moves to */
   int move_stepsize;           /* step size element moves with */
+
   int move_enter_element;      /* element that can be entered (and removed) */
   int move_leave_element;      /* element that can be left behind */
   int move_leave_type;         /* change (limited) or leave (unlimited) */
@@ -1765,6 +1921,7 @@ struct GraphicInfo
   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 anim_delay_fixed;                /* optional delay values for bored and   */
   int anim_delay_random;       /* sleeping player animations (animation */
@@ -1787,6 +1944,8 @@ struct GraphicInfo
 struct SoundInfo
 {
   boolean loop;
+  int volume;
+  int priority;
 };
 
 struct MusicInfo
@@ -1942,6 +2101,7 @@ extern struct GlobalInfo  global;
 extern struct MenuInfo         menu;
 extern struct DoorInfo         door_1, door_2;
 extern struct ElementInfo      element_info[];
+extern struct ElementNameInfo  element_name_info[];
 extern struct ElementActionInfo        element_action_info[];
 extern struct ElementDirectionInfo element_direction_info[];
 extern struct SpecialSuffixInfo special_suffix_info[];
@@ -1954,12 +2114,12 @@ extern struct MusicInfo        *music_info;
 extern struct MusicFileInfo    *music_file_info;
 extern struct HelpAnimInfo     *helpanim_info;
 extern SetupFileHash           *helptext_info;
+extern struct ConfigTypeInfo   image_config_suffix[];
+extern struct ConfigTypeInfo   sound_config_suffix[];
+extern struct ConfigTypeInfo   music_config_suffix[];
 extern struct ConfigInfo       image_config[];
 extern struct ConfigInfo       sound_config[];
 extern struct ConfigInfo       music_config[];
-extern struct ConfigInfo       image_config_suffix[];
-extern struct ConfigInfo       sound_config_suffix[];
-extern struct ConfigInfo       music_config_suffix[];
 extern struct ConfigInfo       helpanim_config[];
 extern struct ConfigInfo       helptext_config[];