rnd-20031008-1-src
[rocksndiamonds.git] / src / main.h
index 8557db58c7b776715ebe91893e0b9f2b3158ce11..e440a8ee18cce9192d0c58b9aa6904119a58c64b 100644 (file)
@@ -14,9 +14,6 @@
 #ifndef MAIN_H
 #define MAIN_H
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <time.h>
 #include <sys/time.h>
 #include <sys/types.h>
 #define EP_INACTIVE            54
 
 /* values for special configurable properties (depending on level settings) */
-#define EP_EM_SLIPPERY_WALL    35
+#define EP_EM_SLIPPERY_WALL    55
 
 /* values for special graphics properties (no effect on game engine) */
 #define EP_GFX_CRUMBLED                56
 #define CE_LEFT_BY_PLAYER      22
 #define CE_OTHER_GETS_ENTERED  23
 #define CE_OTHER_GETS_LEFT     24
+#define CE_SWITCHED            25
+#define CE_OTHER_IS_SWITCHING  26
 
-/* values for derived change events (determined from properties above) */
-#define CE_TOUCHING_SOME_SIDE  25      /* summarized left/right/up/down/any */
-
-#define NUM_CHANGE_EVENTS      26
+#define NUM_CHANGE_EVENTS      27
 
 #define CE_BITMASK_DEFAULT     0
 
                                  (CH_EVENT_VAR(e) &= ~CH_EVENT_BIT(c))) : 0)
 
 /* values for change sides for custom elements */
+#define CH_SIDE_NONE           MV_NO_MOVING
 #define CH_SIDE_LEFT           MV_LEFT
 #define CH_SIDE_RIGHT          MV_RIGHT
 #define CH_SIDE_TOP            MV_UP
 #define MV_BIT_ALONG_RIGHT_SIDE        7
 #define MV_BIT_TURNING_LEFT    8
 #define MV_BIT_TURNING_RIGHT   9
+#define MV_BIT_WHEN_PUSHED     10
 
 /* values for special move patterns for custom elements */
 #define MV_HORIZONTAL          (MV_LEFT | MV_RIGHT)
 #define MV_ALONG_RIGHT_SIDE    (1 << MV_BIT_ALONG_RIGHT_SIDE)
 #define MV_TURNING_LEFT                (1 << MV_BIT_TURNING_LEFT)
 #define MV_TURNING_RIGHT       (1 << MV_BIT_TURNING_RIGHT)
+#define MV_WHEN_PUSHED         (1 << MV_BIT_WHEN_PUSHED)
 
 /* values for slippery property for custom elements */
 #define SLIPPERY_ANY_RANDOM    0
 #define PLAYER_PROTECTED(x,y)  (SHIELD_ON(PLAYERINFO(x, y)) ||         \
                                 PROTECTED_FIELD(x, y))
 
+#define PLAYER_SWITCHING(p,x,y)        ((p)->Switching &&                      \
+                                (p)->switch_x == (x) && (p)->switch_y == (y))
+
 #define PLAYER_NR_GFX(g,i)     ((g) + i * (IMG_PLAYER_2 - IMG_PLAYER_1))
 
 #define ANIM_FRAMES(g)         (graphic_info[g].anim_frames)
 #define EL_CONVEYOR_BELT_4_RIGHT_ACTIVE         (EL_FIRST_RUNTIME_REAL + 25)
 #define EL_EXIT_OPENING                        (EL_FIRST_RUNTIME_REAL + 26)
 #define EL_EXIT_CLOSING                        (EL_FIRST_RUNTIME_REAL + 27)
-#define EL_SP_EXIT_OPEN                        (EL_FIRST_RUNTIME_REAL + 28)
-#define EL_SP_TERMINAL_ACTIVE          (EL_FIRST_RUNTIME_REAL + 29)
-#define EL_SP_BUGGY_BASE_ACTIVATING    (EL_FIRST_RUNTIME_REAL + 30)
-#define EL_SP_BUGGY_BASE_ACTIVE                (EL_FIRST_RUNTIME_REAL + 31)
-#define EL_SP_MURPHY_CLONE             (EL_FIRST_RUNTIME_REAL + 32)
-#define EL_AMOEBA_DROPPING             (EL_FIRST_RUNTIME_REAL + 33)
-#define EL_QUICKSAND_EMPTYING          (EL_FIRST_RUNTIME_REAL + 34)
-#define EL_MAGIC_WALL_ACTIVE           (EL_FIRST_RUNTIME_REAL + 35)
-#define EL_BD_MAGIC_WALL_ACTIVE                (EL_FIRST_RUNTIME_REAL + 36)
-#define EL_MAGIC_WALL_FULL             (EL_FIRST_RUNTIME_REAL + 37)
-#define EL_BD_MAGIC_WALL_FULL          (EL_FIRST_RUNTIME_REAL + 38)
-#define EL_MAGIC_WALL_EMPTYING         (EL_FIRST_RUNTIME_REAL + 39)
-#define EL_BD_MAGIC_WALL_EMPTYING      (EL_FIRST_RUNTIME_REAL + 40)
-#define EL_MAGIC_WALL_DEAD             (EL_FIRST_RUNTIME_REAL + 41)
-#define EL_BD_MAGIC_WALL_DEAD          (EL_FIRST_RUNTIME_REAL + 42)
+#define EL_SP_EXIT_OPENING             (EL_FIRST_RUNTIME_REAL + 28)
+#define EL_SP_EXIT_CLOSING             (EL_FIRST_RUNTIME_REAL + 29)
+#define EL_SP_EXIT_OPEN                        (EL_FIRST_RUNTIME_REAL + 30)
+#define EL_SP_TERMINAL_ACTIVE          (EL_FIRST_RUNTIME_REAL + 31)
+#define EL_SP_BUGGY_BASE_ACTIVATING    (EL_FIRST_RUNTIME_REAL + 32)
+#define EL_SP_BUGGY_BASE_ACTIVE                (EL_FIRST_RUNTIME_REAL + 33)
+#define EL_SP_MURPHY_CLONE             (EL_FIRST_RUNTIME_REAL + 34)
+#define EL_AMOEBA_DROPPING             (EL_FIRST_RUNTIME_REAL + 35)
+#define EL_QUICKSAND_EMPTYING          (EL_FIRST_RUNTIME_REAL + 36)
+#define EL_MAGIC_WALL_ACTIVE           (EL_FIRST_RUNTIME_REAL + 37)
+#define EL_BD_MAGIC_WALL_ACTIVE                (EL_FIRST_RUNTIME_REAL + 38)
+#define EL_MAGIC_WALL_FULL             (EL_FIRST_RUNTIME_REAL + 39)
+#define EL_BD_MAGIC_WALL_FULL          (EL_FIRST_RUNTIME_REAL + 40)
+#define EL_MAGIC_WALL_EMPTYING         (EL_FIRST_RUNTIME_REAL + 41)
+#define EL_BD_MAGIC_WALL_EMPTYING      (EL_FIRST_RUNTIME_REAL + 42)
+#define EL_MAGIC_WALL_DEAD             (EL_FIRST_RUNTIME_REAL + 43)
+#define EL_BD_MAGIC_WALL_DEAD          (EL_FIRST_RUNTIME_REAL + 44)
 
 /* "unreal" (and therefore not drawable) runtime elements */
-#define EL_FIRST_RUNTIME_UNREAL                (EL_FIRST_RUNTIME_REAL + 43)
+#define EL_FIRST_RUNTIME_UNREAL                (EL_FIRST_RUNTIME_REAL + 45)
 
 #define EL_BLOCKED                     (EL_FIRST_RUNTIME_UNREAL + 0)
 #define EL_EXPLOSION                   (EL_FIRST_RUNTIME_UNREAL + 1)
 #define FONT_TEXT_2                            13
 #define FONT_TEXT_3                            14
 #define FONT_TEXT_4                            15
-#define FONT_INPUT_1_ACTIVE                    16
-#define FONT_INPUT_2_ACTIVE                    17
-#define FONT_INPUT_1                           18
-#define FONT_INPUT_2                           19
-#define FONT_OPTION_OFF                                20
-#define FONT_OPTION_ON                         21
-#define FONT_VALUE_1                           22
-#define FONT_VALUE_2                           23
-#define FONT_VALUE_OLD                         24
-#define FONT_LEVEL_NUMBER                      25
-#define FONT_TAPE_RECORDER                     26
-#define FONT_GAME_INFO                         27
-
-#define NUM_FONTS                              28
+#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                      29
+#define FONT_TAPE_RECORDER                     30
+#define FONT_GAME_INFO                         31
+
+#define NUM_FONTS                              32
 #define NUM_INITIAL_FONTS                      4
 
 /* values for game_status (must match special image configuration suffixes) */
 
 #define PROGRAM_VERSION_MAJOR  3
 #define PROGRAM_VERSION_MINOR  0
-#define PROGRAM_VERSION_PATCH  5
+#define PROGRAM_VERSION_PATCH  7
 #define PROGRAM_VERSION_RELEASE        0
-#define PROGRAM_VERSION_STRING "3.0.5"
+#define PROGRAM_VERSION_STRING "3.0.7"
 
 #define PROGRAM_TITLE_STRING   "Rocks'n'Diamonds"
 #define PROGRAM_AUTHOR_STRING  "Holger Schemel"
@@ -1135,6 +1143,8 @@ struct PlayerInfo
   boolean LevelSolved, GameOver;
   boolean snapped;
 
+  int switch_x, switch_y;
+
   int last_move_dir;
   boolean is_moving;
   boolean is_waiting;
@@ -1191,7 +1201,7 @@ struct LevelInfo
   int time_light;
   int time_timegate;
   boolean double_speed;
-  boolean gravity;
+  boolean initial_gravity;
   boolean em_slippery_gems;    /* EM style "gems slip from wall" behaviour */
 
   short field[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
@@ -1242,8 +1252,6 @@ struct GameInfo
   int initial_move_delay;
   int initial_move_delay_value;
 
-  boolean envelope_active;
-
   /* variable within running game */
   int yamyam_content_nr;
   boolean magic_wall_active;
@@ -1254,7 +1262,9 @@ struct GameInfo
   int belt_dir_nr[4];
   int switchgate_pos;
   int balloon_dir;
+  boolean gravity;
   boolean explosions_delayed;
+  boolean envelope_active;
 };
 
 struct GlobalInfo