rnd-20031127-1-src
authorHolger Schemel <info@artsoft.org>
Thu, 27 Nov 2003 01:27:26 +0000 (02:27 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:44:44 +0000 (10:44 +0200)
src/Makefile
src/conf_inf.c [new file with mode: 0644]
src/conftime.h
src/files.c
src/game.c
src/main.c
src/main.h
src/tools.c

index 2aa08a2e4ecfabea77daa109f4e6df4ccd58a40c..f4ffbc8a9894fe9e3a3b173c229236f81276a41c 100644 (file)
@@ -136,6 +136,7 @@ SRCS =      main.c          \
        conf_gfx.c      \
        conf_snd.c      \
        conf_mus.c      \
+       conf_inf.c      \
        init.c          \
        config.c        \
        events.c        \
@@ -153,6 +154,7 @@ OBJS =      main.o          \
        conf_gfx.o      \
        conf_snd.o      \
        conf_mus.o      \
+       conf_inf.o      \
        init.o          \
        config.o        \
        events.o        \
diff --git a/src/conf_inf.c b/src/conf_inf.c
new file mode 100644 (file)
index 0000000..07b6375
--- /dev/null
@@ -0,0 +1,360 @@
+/***********************************************************
+* Rocks'n'Diamonds -- McDuffin Strikes Back!               *
+*----------------------------------------------------------*
+* (c) 1995-2002 Artsoft Entertainment                      *
+*               Holger Schemel                             *
+*               Detmolder Strasse 189                      *
+*               33604 Bielefeld                            *
+*               Germany                                    *
+*               e-mail: info@artsoft.org                   *
+*----------------------------------------------------------*
+* conf_inf.c                                               *
+***********************************************************/
+
+#include "libgame/libgame.h"
+#include "main.h"
+
+
+/* List values that are not defined in the configuration file are set to
+   reliable default values. If that value is GFX_ARG_UNDEFINED, it will
+   be dynamically determined, using some of the other list values. */
+
+struct ConfigInfo info_animation_config[] =
+{
+  { "player_1.moving.down",                    "16"                    },
+  { "player_1.moving.up",                      "16"                    },
+  { "player_1.moving.left",                    "16"                    },
+  { "player_1.moving.right",                   "16"                    },
+  { "player_1.pushing.left",                   "16"                    },
+  { "player_1.pushing.right",                  "16"                    },
+  { "end",                                     ""                      },
+
+  { "sand",                                    "-1"                    },
+  { "end",                                     ""                      },
+
+  { "empty_space",                             "-1"                    },
+  { "end",                                     ""                      },
+
+  { "quicksand_empty",                         "-1"                    },
+  { "end",                                     ""                      },
+
+  { "steelwall",                               "-1"                    },
+  { "end",                                     ""                      },
+
+  { "wall",                                    "-1"                    },
+  { "end",                                     ""                      },
+
+  { "expandable_wall.growing.left",            "20"                    },
+  { "wall",                                    "50"                    },
+  { "expandable_wall.growing.right",           "20"                    },
+  { "wall",                                    "50"                    },
+  { "expandable_wall.growing.up",              "20"                    },
+  { "wall",                                    "50"                    },
+  { "expandable_wall.growing.down",            "20"                    },
+  { "wall",                                    "50"                    },
+  { "empty_space",                             "20"                    },
+  { "end",                                     ""                      },
+
+  { "invisible_wall",                          "-1"                    },
+  { "end",                                     ""                      },
+
+  { "wall_slippery",                           "-1"                    },
+  { "end",                                     ""                      },
+
+  { "char_space",                              "10"                    },
+  { "char_exclam",                             "10"                    },
+  { "char_quotedbl",                           "10"                    },
+  { "char_numbersign",                         "10"                    },
+  { "char_dollar",                             "10"                    },
+  { "char_procent",                            "10"                    },
+  { "char_ampersand",                          "10"                    },
+  { "char_apostrophe",                         "10"                    },
+  { "char_parenleft",                          "10"                    },
+  { "char_parenright",                         "10"                    },
+  { "char_asterisk",                           "10"                    },
+  { "char_plus",                               "10"                    },
+  { "char_comma",                              "10"                    },
+  { "char_minus",                              "10"                    },
+  { "char_period",                             "10"                    },
+  { "char_slash",                              "10"                    },
+  { "char_0",                                  "10"                    },
+  { "char_1",                                  "10"                    },
+  { "char_2",                                  "10"                    },
+  { "char_3",                                  "10"                    },
+  { "char_4",                                  "10"                    },
+  { "char_5",                                  "10"                    },
+  { "char_6",                                  "10"                    },
+  { "char_7",                                  "10"                    },
+  { "char_8",                                  "10"                    },
+  { "char_9",                                  "10"                    },
+  { "char_colon",                              "10"                    },
+  { "char_semicolon",                          "10"                    },
+  { "char_less",                               "10"                    },
+  { "char_equal",                              "10"                    },
+  { "char_greater",                            "10"                    },
+  { "char_question",                           "10"                    },
+  { "char_at",                                 "10"                    },
+  { "char_a",                                  "10"                    },
+  { "char_b",                                  "10"                    },
+  { "char_c",                                  "10"                    },
+  { "char_d",                                  "10"                    },
+  { "char_e",                                  "10"                    },
+  { "char_f",                                  "10"                    },
+  { "char_g",                                  "10"                    },
+  { "char_h",                                  "10"                    },
+  { "char_i",                                  "10"                    },
+  { "char_j",                                  "10"                    },
+  { "char_k",                                  "10"                    },
+  { "char_l",                                  "10"                    },
+  { "char_m",                                  "10"                    },
+  { "char_n",                                  "10"                    },
+  { "char_o",                                  "10"                    },
+  { "char_p",                                  "10"                    },
+  { "char_q",                                  "10"                    },
+  { "char_r",                                  "10"                    },
+  { "char_s",                                  "10"                    },
+  { "char_t",                                  "10"                    },
+  { "char_u",                                  "10"                    },
+  { "char_v",                                  "10"                    },
+  { "char_w",                                  "10"                    },
+  { "char_x",                                  "10"                    },
+  { "char_y",                                  "10"                    },
+  { "char_z",                                  "10"                    },
+  { "char_bracketleft",                                "10"                    },
+  { "char_backslash",                          "10"                    },
+  { "char_bracketright",                       "10"                    },
+  { "char_asciicircum",                                "10"                    },
+  { "char_underscore",                         "10"                    },
+  { "char_copyright",                          "10"                    },
+  { "char_aumlaut",                            "10"                    },
+  { "char_oumlaut",                            "10"                    },
+  { "char_uumlaut",                            "10"                    },
+  { "char_degree",                             "10"                    },
+  { "char_trademark",                          "10"                    },
+  { "char_cursor",                             "10"                    },
+  { "end",                                     ""                      },
+
+  { "emerald",                                 "-1"                    },
+  { "end",                                     ""                      },
+
+  { "diamond",                                 "-1"                    },
+  { "end",                                     ""                      },
+
+  { "bd_diamond",                              "-1"                    },
+  { "end",                                     ""                      },
+
+  { "emerald_yellow",                          "50"                    },
+  { "emerald_red",                             "50"                    },
+  { "emerald_purple",                          "50"                    },
+  { "end",                                     ""                      },
+
+  { "bd_rock",                                 "-1"                    },
+  { "end",                                     ""                      },
+
+  { "bomb",                                    "100"                   },
+  { "bomb.exploding",                          "16"                    },
+  { "empty_space",                             "10"                    },
+  { "end",                                     ""                      },
+
+  { "nut",                                     "100"                   },
+  { "nut.breaking",                            "6"                     },
+  { "emerald",                                 "20"                    },
+  { "end",                                     ""                      },
+
+  { "wall_emerald",                            "100"                   },
+  { "wall_emerald.exploding",                  "16"                    },
+  { "emerald",                                 "20"                    },
+  { "end",                                     ""                      },
+
+  { "wall_diamond",                            "100"                   },
+  { "wall_diamond.exploding",                  "16"                    },
+  { "diamond",                                 "20"                    },
+  { "end",                                     ""                      },
+
+  { "wall_bd_diamond",                         "100"                   },
+  { "wall_bd_diamond.exploding",               "16"                    },
+  { "bd_diamond",                              "20"                    },
+  { "end",                                     ""                      },
+
+  { "wall_emerald_yellow",                     "100"                   },
+  { "wall_emerald_yellow.exploding",           "16"                    },
+  { "emerald_yellow",                          "20"                    },
+  { "wall_emerald_red",                                "100"                   },
+  { "wall_emerald_red.exploding",              "16"                    },
+  { "emerald_red",                             "20"                    },
+  { "wall_emerald_purple",                     "100"                   },
+  { "wall_emerald_purple.exploding",           "16"                    },
+  { "emerald_purple",                          "20"                    },
+  { "end",                                     ""                      },
+
+  { "acid",                                    "-1"                    },
+  { "end",                                     ""                      },
+
+  { "key_1",                                   "50"                    },
+  { "key_2",                                   "50"                    },
+  { "key_3",                                   "50"                    },
+  { "key_4",                                   "50"                    },
+  { "end",                                     ""                      },
+
+  { "gate_1",                                  "50"                    },
+  { "gate_2",                                  "50"                    },
+  { "gate_3",                                  "50"                    },
+  { "gate_4",                                  "50"                    },
+  { "end",                                     ""                      },
+
+  { "gate_1_gray",                             "50"                    },
+  { "gate_2_gray",                             "50"                    },
+  { "gate_3_gray",                             "50"                    },
+  { "gate_4_gray",                             "50"                    },
+  { "end",                                     ""                      },
+
+  { "dynamite",                                        "-1"                    },
+  { "end",                                     ""                      },
+
+  { "dynamite.active",                         "96"                    },
+  { "dynamite.exploding",                      "16"                    },
+  { "empty_space",                             "20"                    },
+  { "end",                                     ""                      },
+
+  { "dynabomb.active",                         "100"                   },
+  { "dynabomb.exploding",                      "16"                    },
+  { "empty_space",                             "20"                    },
+  { "end",                                     ""                      },
+
+  { "dynabomb_increase_number",                        "-1"                    },
+  { "end",                                     ""                      },
+
+  { "dynabomb_increase_size",                  "-1"                    },
+  { "end",                                     ""                      },
+
+  { "dynabomb_increase_power",                 "-1"                    },
+  { "end",                                     ""                      },
+
+  { "spaceship.turning_from_right.up",         "8"                     },
+  { "spaceship.turning_from_up.left",          "8"                     },
+  { "spaceship.turning_from_left.down",                "8"                     },
+  { "spaceship.turning_from_down.right",       "8"                     },
+  { "end",                                     ""                      },
+
+  { "bug.turning_from_right.up",               "8"                     },
+  { "bug.turning_from_up.left",                        "8"                     },
+  { "bug.turning_from_left.down",              "8"                     },
+  { "bug.turning_from_down.right",             "8"                     },
+  { "end",                                     ""                      },
+
+  { "bd_butterfly",                            "-1"                    },
+  { "end",                                     ""                      },
+
+  { "bd_firefly",                              "-1"                    },
+  { "end",                                     ""                      },
+
+  { "pacman.right",                            "16"                    },
+  { "pacman.up",                               "16"                    },
+  { "pacman.left",                             "16"                    },
+  { "pacman.down",                             "16"                    },
+  { "end",                                     ""                      },
+
+  { "yamyam",                                  "-1"                    },
+  { "end",                                     ""                      },
+
+  { "dark_yamyam",                             "-1"                    },
+  { "end",                                     ""                      },
+
+  { "robot",                                   "-1"                    },
+  { "end",                                     ""                      },
+
+  { "mole.moving.right",                       "16"                    },
+  { "mole.moving.up",                          "16"                    },
+  { "mole.moving.left",                                "16"                    },
+  { "mole.moving.down",                                "16"                    },
+  { "end",                                     ""                      },
+
+  { "penguin.moving.right",                    "16"                    },
+  { "penguin.moving.up",                       "16"                    },
+  { "penguin.moving.left",                     "16"                    },
+  { "penguin.moving.down",                     "16"                    },
+  { "end",                                     ""                      },
+
+  { "pig.moving.right",                                "16"                    },
+  { "pig.moving.up",                           "16"                    },
+  { "pig.moving.left",                         "16"                    },
+  { "pig.moving.down",                         "16"                    },
+  { "end",                                     ""                      },
+
+  { "dragon.moving.right",                     "16"                    },
+  { "dragon.moving.up",                                "16"                    },
+  { "dragon.moving.left",                      "16"                    },
+  { "dragon.moving.down",                      "16"                    },
+  { "end",                                     ""                      },
+
+  { "satellite",                               "-1"                    },
+  { "end",                                     ""                      },
+
+  { "robot_wheel",                             "50"                    },
+  { "robot_wheel.active",                      "100"                   },
+  { "end",                                     ""                      },
+
+  { "lamp",                                    "50"                    },
+  { "lamp.active",                             "50"                    },
+  { "end",                                     ""                      },
+
+  { "time_orb_full",                           "50"                    },
+  { "time_orb_empty",                          "50"                    },
+  { "end",                                     ""                      },
+
+  { "amoeba_drop",                             "50"                    },
+  { "amoeba.growing",                          "6"                     },
+  { "amoeba_wet",                              "20"                    },
+  { "end",                                     ""                      },
+
+  { "amoeba_dead",                             "-1"                    },
+  { "end",                                     ""                      },
+
+  { "amoeba_wet",                              "-1"                    },
+  { "end",                                     ""                      },
+
+  { "amoeba_wet",                              "100"                   },
+  { "amoeba.growing",                          "6"                     },
+  { "end",                                     ""                      },
+
+  { "amoeba_full",                             "50"                    },
+  { "amoeba_dead",                             "50"                    },
+  { "amoeba.exploding",                                "16"                    },
+  { "diamond",                                 "20"                    },
+  { "end",                                     ""                      },
+
+  { "game_of_life",                            "-1"                    },
+  { "end",                                     ""                      },
+
+  { "biomaze",                                 "-1"                    },
+  { "end",                                     ""                      },
+
+  { "magic_wall.active",                       "-1"                    },
+  { "end",                                     ""                      },
+
+  { "bd_magic_wall.active",                    "-1"                    },
+  { "end",                                     ""                      },
+
+  { "exit_closed",                             "200"                   },
+  { "exit.opening",                            "30"                    },
+  { "exit_open",                               "100"                   },
+  { "exit.closing",                            "30"                    },
+  { "end",                                     ""                      },
+
+  { "exit_open",                               "-1"                    },
+  { "end",                                     ""                      },
+
+  { "sokoban_object",                          "-1"                    },
+  { "end",                                     ""                      },
+
+  { "sokoban_field_empty",                     "-1"                    },
+  { "end",                                     ""                      },
+
+  { "sokoban_field_full",                      "-1"                    },
+  { "end",                                     ""                      },
+
+  { "speed_pill",                              "-1"                    },
+  { "end",                                     ""                      },
+
+  { NULL,                                      NULL                    }
+};
index c2a8e58e76cb088dede9a33740a2893ef8f75dcd..b0cc969be418713bcf515dc1638712cb50e0148d 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-11-25 00:01]"
+#define COMPILE_DATE_STRING "[2003-11-27 02:21]"
index bc12226d7b066a0c5117a51308c41bc0b0dcb16c..a2f7cf69faf45be632ac96a07d0e6b4c20832ca9 100644 (file)
@@ -3064,7 +3064,19 @@ void LoadInfoAnimations()
   int i;
 
   if ((setup_file_list = loadSetupFileList(filename)) == NULL)
-    return;
+  {
+    /* use reliable default values from static configuration */
+    SetupFileList *insert_ptr;
+
+    insert_ptr = setup_file_list =
+      newSetupFileList(info_animation_config[0].token,
+                      info_animation_config[0].value);
+
+    for (i=1; info_animation_config[i].token; i++)
+       insert_ptr = addListEntry(insert_ptr,
+                                 info_animation_config[i].token,
+                                 info_animation_config[i].value);
+  }
 
   element_hash   = newSetupFileHash();
   action_hash    = newSetupFileHash();
@@ -3077,9 +3089,10 @@ void LoadInfoAnimations()
     setHashEntry(action_hash, element_action_info[i].suffix,
                 itoa(element_action_info[i].value));
 
+  /* do not store direction index (bit) here, but direction value! */
   for (i=0; i < NUM_DIRECTIONS; i++)
     setHashEntry(direction_hash, element_direction_info[i].suffix,
-                itoa(element_direction_info[i].value));
+                itoa(1 << element_direction_info[i].value));
 
   for (list = setup_file_list; list != NULL; list = list->next)
   {
index f5558fdb57e8ea0a87f7975c8650490102cce5bb..e0423a0cf4bea429d6ced5eb7ad7ce54bf7a08cf 100644 (file)
@@ -1076,7 +1076,7 @@ void InitGame()
     player->num_special_action_sleeping = 0;
 
     /* determine number of special actions for bored and sleeping animation */
-    for (j=ACTION_BORING_1; j <= ACTION_BORING_8; j++)
+    for (j=ACTION_BORING_1; j <= ACTION_BORING_LAST; j++)
     {
       boolean found = FALSE;
 
@@ -1090,7 +1090,7 @@ void InitGame()
       else
        break;
     }
-    for (j=ACTION_SLEEPING_1; j <= ACTION_SLEEPING_3; j++)
+    for (j=ACTION_SLEEPING_1; j <= ACTION_SLEEPING_LAST; j++)
     {
       boolean found = FALSE;
 
@@ -5992,12 +5992,12 @@ static boolean CheckElementChange(int x, int y, int element, int trigger_event)
 
 static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting)
 {
+  int jx = player->jx, jy = player->jy;
+  int element = player->element_nr;
   boolean was_waiting = player->is_waiting;
 
   if (is_waiting)
   {
-    int jx = player->jx, jy = player->jy;
-    int element = player->element_nr;
     int action;
 
     if (!was_waiting)          /* not waiting -> waiting */
@@ -6037,6 +6037,9 @@ static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting)
   }
   else if (was_waiting)                /* waiting -> not waiting */
   {
+    if (player->is_sleeping)
+      PlayLevelSoundElementAction(jx, jy, element, ACTION_AWAKENING);
+
     player->is_waiting = FALSE;
     player->is_bored = FALSE;
     player->is_sleeping = FALSE;
@@ -6046,6 +6049,9 @@ static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting)
 
     player->anim_delay_counter = 0;
     player->post_delay_counter = 0;
+
+    player->special_action_bored = ACTION_DEFAULT;
+    player->special_action_sleeping = ACTION_DEFAULT;
   }
 }
 
index f2251073255f878e9129a96419995488c5c28ef6..84697de8fc61c16b39bcf2c4c400fc291a4fb391 100644 (file)
@@ -3722,10 +3722,13 @@ struct ElementActionInfo element_action_info[NUM_ACTIONS + 1 + 1] =
   { ".boring[6]",              ACTION_BORING_6,                FALSE   },
   { ".boring[7]",              ACTION_BORING_7,                FALSE   },
   { ".boring[8]",              ACTION_BORING_8,                FALSE   },
+  { ".boring[9]",              ACTION_BORING_9,                FALSE   },
+  { ".boring[10]",             ACTION_BORING_10,               FALSE   },
   { ".sleeping",               ACTION_SLEEPING,                FALSE   },
   { ".sleeping[1]",            ACTION_SLEEPING_1,              FALSE   },
   { ".sleeping[2]",            ACTION_SLEEPING_2,              FALSE   },
   { ".sleeping[3]",            ACTION_SLEEPING_3,              FALSE   },
+  { ".awakening",              ACTION_AWAKENING,               FALSE   },
   { ".dying",                  ACTION_DYING,                   FALSE   },
   { ".turning",                        ACTION_TURNING,                 FALSE   },
   { ".turning_from_left",      ACTION_TURNING_FROM_LEFT,       FALSE   },
index fac1302f60cd1282f81d2c742e75a2f7ca95583e..620167e6278abdf73d6f9f603f2a32c4863e194a 100644 (file)
 #define ACTION_BORING_6                                31
 #define ACTION_BORING_7                                32
 #define ACTION_BORING_8                                33
-#define ACTION_SLEEPING                                34
-#define ACTION_SLEEPING_1                      35
-#define ACTION_SLEEPING_2                      36
-#define ACTION_SLEEPING_3                      37
-#define ACTION_DYING                           38
-#define ACTION_TURNING                         39
-#define ACTION_TURNING_FROM_LEFT               40
-#define ACTION_TURNING_FROM_RIGHT              41
-#define ACTION_TURNING_FROM_UP                 42
-#define ACTION_TURNING_FROM_DOWN               43
-#define ACTION_OTHER                           44
-
-#define NUM_ACTIONS                            45
+#define ACTION_BORING_9                                34
+#define ACTION_BORING_10                       35
+#define ACTION_SLEEPING                                36
+#define ACTION_SLEEPING_1                      37
+#define ACTION_SLEEPING_2                      38
+#define ACTION_SLEEPING_3                      39
+#define ACTION_AWAKENING                       40
+#define ACTION_DYING                           41
+#define ACTION_TURNING                         42
+#define ACTION_TURNING_FROM_LEFT               43
+#define ACTION_TURNING_FROM_RIGHT              44
+#define ACTION_TURNING_FROM_UP                 45
+#define ACTION_TURNING_FROM_DOWN               46
+#define ACTION_OTHER                           47
+
+#define NUM_ACTIONS                            48
+
+#define ACTION_BORING_LAST                     ACTION_BORING_10
+#define ACTION_SLEEPING_LAST                   ACTION_SLEEPING_3
+
 
 /* values for special image configuration suffixes (must match game mode) */
 #define GFX_SPECIAL_ARG_DEFAULT                        0
@@ -1667,5 +1674,6 @@ 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       info_animation_config[];
 
 #endif /* MAIN_H */
index 0244e944d3d0f0d9644ef82a989ecd8b4be8cd14..c9d3e4baf4203d124152a7b8ae9eb2733c0e0efc 100644 (file)
@@ -546,8 +546,13 @@ static int getPlayerAction(struct PlayerInfo *player, int move_dir)
     {
       if (player->anim_delay_counter == 0 && player->post_delay_counter == 0)
       {
+       int last_special_action = player->special_action_sleeping;
+       int num_special_action = player->num_special_action_sleeping;
        int special_action =
-         ACTION_BORING_1 + SimpleRND(player->num_special_action_sleeping);
+         (last_special_action == ACTION_DEFAULT ? ACTION_SLEEPING_1 :
+          last_special_action == ACTION_SLEEPING ? ACTION_SLEEPING :
+          last_special_action < ACTION_SLEEPING_1 + num_special_action - 1 ?
+          last_special_action + 1 : ACTION_SLEEPING);
        int special_graphic =
          el_act_dir2img(player->element_nr, special_action, move_dir);