rnd-20031019-1-src
authorHolger Schemel <info@artsoft.org>
Sat, 18 Oct 2003 22:54:09 +0000 (00:54 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:44:17 +0000 (10:44 +0200)
* fixed serious bug in code for delayed element pushing
* fixed little bug in animation frame selection for pushed elements

ChangeLog
src/conftime.h
src/files.c
src/game.c
src/init.c
src/libgame/misc.c
src/libgame/setup.c
src/libgame/setup.h
src/libgame/system.h
src/tools.c

index 07127588154f2cfdc7d86ac0bcf6cb56f7b42ad6..f33feed453e099d2f955a2aacc8312497aa5dffb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,14 @@
+2003-10-18
+       * fixed serious bug in code for delayed element pushing
+       * fixed little bug in animation frame selection for pushed elements
+
 2003-10-08
-       * added config directive for opening and closing Supaplex exit
+       * added configuration option for opening and closing Supaplex exit
+       * added configuration option for moving up/down animation for Murphy
        * fixed incorrectly displayed animation for attacking dragon
        * fixed bug with not setting initial gravity for each new game
+       * fixed bug with teleportation of player by custom element change
+       * fixed bug with player not getting smashed by rock sometimes
 
 2003-10-06
        * Version number set to 3.0.7.
index ae48cd90e41d417079e62998a57fd3dde19d5e35..05e72bcb39a91d80cb1c61ce70f0ce258bec4b9a 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-10-14 00:21]"
+#define COMPILE_DATE_STRING "[2003-10-19 00:50]"
index 3f22b604963ec8a996dd949b468b368c86e454ec..fc7bfb7b51ed33ba0222b1b5706731ccb6d453aa 100644 (file)
@@ -186,7 +186,7 @@ static void setLevelInfoToDefaults(struct LevelInfo *level)
     element_info[element].collect_score = 10;          /* special default */
     element_info[element].collect_count = 1;           /* special default */
 
-    element_info[element].push_delay_fixed = 2;                /* special default */
+    element_info[element].push_delay_fixed = 8;                /* special default */
     element_info[element].push_delay_random = 8;       /* special default */
     element_info[element].move_delay_fixed = 0;
     element_info[element].move_delay_random = 0;
index 8ff077ef02242dad5f2e90b7c9a4a05417a3662f..584c1a927cdfbb9f6ce19cb6bd955e766aff5f52 100644 (file)
@@ -927,7 +927,7 @@ static void InitGameEngine()
   {
     if (!IS_CUSTOM_ELEMENT(i))
     {
-      element_info[i].push_delay_fixed = 2;
+      element_info[i].push_delay_fixed = 8;
       element_info[i].push_delay_random = 8;
     }
   }
@@ -7909,7 +7909,13 @@ int DigField(struct PlayerInfo *player,
        if (!FrameReached(&player->push_delay, player->push_delay_value) &&
            !(tape.playing && tape.file_version < FILE_VERSION_2_0) &&
            element != EL_SPRING && element != EL_BALLOON)
+       {
+         /* make sure that there is no move delay before next try to push */
+         if (game.engine_version >= VERSION_IDENT(3,0,7))
+           player->move_delay = INITIAL_MOVE_DELAY_OFF;
+
          return MF_NO_ACTION;
+       }
 
        if (IS_SB_ELEMENT(element))
        {
index a4a926005cc45df991a2855d54b0146c47b3bdd5..ebc9f2fddd5d8a32d58d951ccdabf5121b79252c 100644 (file)
@@ -2946,22 +2946,6 @@ void InitElementPropertiesEngine(int engine_version)
                 (level.em_slippery_gems &&
                  engine_version > VERSION_IDENT(2,0,1)));
   }
-
-#if 0
-  /* dynamically adjust element properties according to game engine version */
-#if 0
-  if (engine_version < RELEASE_IDENT(2,2,0,7))
-#endif
-  {
-    for (i=0; i < NUM_CUSTOM_ELEMENTS; i++)
-    {
-      int element = EL_CUSTOM_START + i;
-
-      element_info[element].push_delay_fixed = 2;
-      element_info[element].push_delay_random = 8;
-    }
-  }
-#endif
 }
 
 static void InitGlobal()
index 50a713f456be8c011b279044121e088516d57042..84ec36021cfc3dbc20c8dbcc06e08f7000b3f69f 100644 (file)
@@ -2293,6 +2293,9 @@ void LoadArtworkConfig(struct ArtworkListInfo *artwork_info)
   printf("GOT CUSTOM ARTWORK CONFIG FILE '%s'\n", filename);
 #endif
 
+  DrawInitText("Loading artwork config:", 120, FC_GREEN);
+  DrawInitText(ARTWORKINFO_FILENAME(artwork_info->type), 150, FC_YELLOW);
+
   /* always start with reliable default values */
   for (i=0; i<num_file_list_entries; i++)
   {
index e8ae45f215a6191d1dd508037279d21c2e303ba0..119533755368e60bc41368cecbd369fbdf885261 100644 (file)
 #include "misc.h"
 #include "hash.h"
 
-/* file names and filename extensions */
-#if !defined(PLATFORM_MSDOS)
-#define LEVELSETUP_DIRECTORY   "levelsetup"
-#define SETUP_FILENAME         "setup.conf"
-#define LEVELSETUP_FILENAME    "levelsetup.conf"
-#define LEVELINFO_FILENAME     "levelinfo.conf"
-#define GRAPHICSINFO_FILENAME  "graphicsinfo.conf"
-#define SOUNDSINFO_FILENAME    "soundsinfo.conf"
-#define MUSICINFO_FILENAME     "musicinfo.conf"
-#define LEVELFILE_EXTENSION    "level"
-#define TAPEFILE_EXTENSION     "tape"
-#define SCOREFILE_EXTENSION    "score"
-#else
-#define LEVELSETUP_DIRECTORY   "lvlsetup"
-#define SETUP_FILENAME         "setup.cnf"
-#define LEVELSETUP_FILENAME    "lvlsetup.cnf"
-#define LEVELINFO_FILENAME     "lvlinfo.cnf"
-#define GRAPHICSINFO_FILENAME  "gfxinfo.cnf"
-#define SOUNDSINFO_FILENAME    "sndinfo.cnf"
-#define MUSICINFO_FILENAME     "musinfo.cnf"
-#define LEVELFILE_EXTENSION    "lvl"
-#define TAPEFILE_EXTENSION     "tap"
-#define SCOREFILE_EXTENSION    "sco"
-#endif
 
 #define NUM_LEVELCLASS_DESC    8
+
 static char *levelclass_desc[NUM_LEVELCLASS_DESC] =
 {
   "Tutorial Levels",
@@ -61,14 +38,15 @@ static char *levelclass_desc[NUM_LEVELCLASS_DESC] =
   "DX Boulderdash"
 };
 
-#define LEVELCOLOR(n)  (IS_LEVELCLASS_TUTORIAL(n) ?            FC_BLUE : \
-                        IS_LEVELCLASS_CLASSICS(n) ?            FC_RED : \
-                        IS_LEVELCLASS_BD(n) ?                  FC_GREEN : \
-                        IS_LEVELCLASS_EM(n) ?                  FC_YELLOW : \
-                        IS_LEVELCLASS_SP(n) ?                  FC_GREEN : \
-                        IS_LEVELCLASS_DX(n) ?                  FC_YELLOW : \
-                        IS_LEVELCLASS_CONTRIBUTION(n) ?        FC_GREEN : \
-                        IS_LEVELCLASS_USER(n) ?                FC_RED : \
+
+#define LEVELCOLOR(n)  (IS_LEVELCLASS_TUTORIAL(n) ?            FC_BLUE :    \
+                        IS_LEVELCLASS_CLASSICS(n) ?            FC_RED :     \
+                        IS_LEVELCLASS_BD(n) ?                  FC_GREEN :   \
+                        IS_LEVELCLASS_EM(n) ?                  FC_YELLOW :  \
+                        IS_LEVELCLASS_SP(n) ?                  FC_GREEN :   \
+                        IS_LEVELCLASS_DX(n) ?                  FC_YELLOW :  \
+                        IS_LEVELCLASS_CONTRIBUTION(n) ?        FC_GREEN :   \
+                        IS_LEVELCLASS_USER(n) ?                FC_RED :     \
                         FC_BLUE)
 
 #define LEVELSORTING(n)        (IS_LEVELCLASS_TUTORIAL(n) ?            0 : \
@@ -81,44 +59,23 @@ static char *levelclass_desc[NUM_LEVELCLASS_DESC] =
                         IS_LEVELCLASS_USER(n) ?                7 : \
                         9)
 
-#define ARTWORKCOLOR(n)        (IS_ARTWORKCLASS_CLASSICS(n) ?          FC_RED : \
-                        IS_ARTWORKCLASS_CONTRIBUTION(n) ?      FC_YELLOW : \
-                        IS_ARTWORKCLASS_LEVEL(n) ?             FC_GREEN : \
-                        IS_ARTWORKCLASS_USER(n) ?              FC_RED : \
+#define ARTWORKCOLOR(n)        (IS_ARTWORKCLASS_CLASSICS(n) ?          FC_RED :     \
+                        IS_ARTWORKCLASS_CONTRIBUTION(n) ?      FC_YELLOW :  \
+                        IS_ARTWORKCLASS_LEVEL(n) ?             FC_GREEN :   \
+                        IS_ARTWORKCLASS_USER(n) ?              FC_RED :     \
                         FC_BLUE)
 
 #define ARTWORKSORTING(n) (IS_ARTWORKCLASS_CLASSICS(n) ?       0 : \
-                        IS_ARTWORKCLASS_CONTRIBUTION(n) ?      1 : \
-                        IS_ARTWORKCLASS_LEVEL(n) ?             2 : \
-                        IS_ARTWORKCLASS_USER(n) ?              3 : \
-                        9)
+                          IS_ARTWORKCLASS_CONTRIBUTION(n) ?    1 : \
+                          IS_ARTWORKCLASS_LEVEL(n) ?           2 : \
+                          IS_ARTWORKCLASS_USER(n) ?            3 : \
+                          9)
 
 #define TOKEN_VALUE_POSITION           40
 #define TOKEN_COMMENT_POSITION         60
 
 #define MAX_COOKIE_LEN                 256
 
-#define ARTWORKINFO_FILENAME(type)     ((type) == ARTWORK_TYPE_GRAPHICS ? \
-                                        GRAPHICSINFO_FILENAME :           \
-                                        (type) == ARTWORK_TYPE_SOUNDS ?   \
-                                        SOUNDSINFO_FILENAME :             \
-                                        (type) == ARTWORK_TYPE_MUSIC ?    \
-                                        MUSICINFO_FILENAME : "")
-
-#define ARTWORK_DIRECTORY(type)                ((type) == ARTWORK_TYPE_GRAPHICS ? \
-                                        GRAPHICS_DIRECTORY :              \
-                                        (type) == ARTWORK_TYPE_SOUNDS ?   \
-                                        SOUNDS_DIRECTORY :                \
-                                        (type) == ARTWORK_TYPE_MUSIC ?    \
-                                        MUSIC_DIRECTORY : "")
-
-#define OPTIONS_ARTWORK_DIRECTORY(type)        ((type) == ARTWORK_TYPE_GRAPHICS ? \
-                                        options.graphics_directory :      \
-                                        (type) == ARTWORK_TYPE_SOUNDS ?   \
-                                        options.sounds_directory :        \
-                                        (type) == ARTWORK_TYPE_MUSIC ?    \
-                                        options.music_directory : "")
-
 
 /* ------------------------------------------------------------------------- */
 /* file functions                                                            */
@@ -1172,10 +1129,10 @@ char *getListEntry(SetupFileList *list, char *token)
     return getListEntry(list->next, token);
 }
 
-void setListEntry(SetupFileList *list, char *token, char *value)
+SetupFileList *setListEntry(SetupFileList *list, char *token, char *value)
 {
   if (list == NULL)
-    return;
+    return NULL;
 
   if (strcmp(list->token, token) == 0)
   {
@@ -1183,11 +1140,13 @@ void setListEntry(SetupFileList *list, char *token, char *value)
       free(list->value);
 
     list->value = getStringCopy(value);
+
+    return list;
   }
   else if (list->next == NULL)
-    list->next = newSetupFileList(token, value);
+    return (list->next = newSetupFileList(token, value));
   else
-    setListEntry(list->next, token, value);
+    return setListEntry(list->next, token, value);
 }
 
 #ifdef DEBUG
@@ -1308,13 +1267,13 @@ static void *loadSetupFileData(char *filename, boolean use_hash)
   int line_len;
   char line[MAX_LINE_LEN];
   char *token, *value, *line_ptr;
-  void *setup_file_data;
+  void *setup_file_data, *insert_ptr;
   FILE *file;
 
   if (use_hash)
     setup_file_data = newSetupFileHash();
   else
-    setup_file_data = newSetupFileList("", "");
+    insert_ptr = setup_file_data = newSetupFileList("", "");
 
   if (!(file = fopen(filename, MODE_READ)))
   {
@@ -1379,7 +1338,7 @@ static void *loadSetupFileData(char *filename, boolean use_hash)
       if (use_hash)
        setHashEntry((SetupFileHash *)setup_file_data, token, value);
       else
-       setListEntry((SetupFileList *)setup_file_data, token, value);
+       insert_ptr = setListEntry((SetupFileList *)insert_ptr, token, value);
     }
   }
 
index 5ae3bc4b97c36f72e00a292c0e25859a72219405..954079151d136591a40740c3aba9c16bf56d8719 100644 (file)
@@ -230,10 +230,10 @@ boolean checkCookieString(const char *, const char *);
 
 char *getFormattedSetupEntry(char *, char *);
 
-struct SetupFileList *newSetupFileList(char *, char *);
-void freeSetupFileList(struct SetupFileList *);
-char *getListEntry(struct SetupFileList *, char *);
-void setListEntry(struct SetupFileList *, char *, char *);
+SetupFileList *newSetupFileList(char *, char *);
+void freeSetupFileList(SetupFileList *);
+char *getListEntry(SetupFileList *, char *);
+SetupFileList *setListEntry(SetupFileList *, char *, char *);
 SetupFileList *loadSetupFileList(char *);
 
 SetupFileHash *newSetupFileHash();
index 007e02d3542f7583735f555a5889b0f71a839e30..d1c41d2a91164a39378f07590767a0b548bf61c3 100644 (file)
 #define RO_BASE_PATH           RO_GAME_DIR
 #define RW_BASE_PATH           RW_GAME_DIR
 
+/* directory names */
 #define GRAPHICS_DIRECTORY     "graphics"
 #define SOUNDS_DIRECTORY       "sounds"
 #define MUSIC_DIRECTORY                "music"
 #define MUS_CLASSIC_SUBDIR     "mus_orig"
 #endif
 
+/* file names and filename extensions */
+#if !defined(PLATFORM_MSDOS)
+#define LEVELSETUP_DIRECTORY   "levelsetup"
+#define SETUP_FILENAME         "setup.conf"
+#define LEVELSETUP_FILENAME    "levelsetup.conf"
+#define LEVELINFO_FILENAME     "levelinfo.conf"
+#define GRAPHICSINFO_FILENAME  "graphicsinfo.conf"
+#define SOUNDSINFO_FILENAME    "soundsinfo.conf"
+#define MUSICINFO_FILENAME     "musicinfo.conf"
+#define LEVELFILE_EXTENSION    "level"
+#define TAPEFILE_EXTENSION     "tape"
+#define SCOREFILE_EXTENSION    "score"
+#else
+#define LEVELSETUP_DIRECTORY   "lvlsetup"
+#define SETUP_FILENAME         "setup.cnf"
+#define LEVELSETUP_FILENAME    "lvlsetup.cnf"
+#define LEVELINFO_FILENAME     "lvlinfo.cnf"
+#define GRAPHICSINFO_FILENAME  "gfxinfo.cnf"
+#define SOUNDSINFO_FILENAME    "sndinfo.cnf"
+#define MUSICINFO_FILENAME     "musinfo.cnf"
+#define LEVELFILE_EXTENSION    "lvl"
+#define TAPEFILE_EXTENSION     "tap"
+#define SCOREFILE_EXTENSION    "sco"
+#endif
+
 
 /* areas in bitmap PIX_DOOR */
 /* meaning in PIX_DB_DOOR: (3 PAGEs)
                                 (artwork).snd_current_identifier :     \
                                 (artwork).mus_current_identifier)
 
+#define ARTWORKINFO_FILENAME(type)                                     \
+                               ((type) == ARTWORK_TYPE_GRAPHICS ?      \
+                                GRAPHICSINFO_FILENAME :                \
+                                (type) == ARTWORK_TYPE_SOUNDS ?        \
+                                SOUNDSINFO_FILENAME :                  \
+                                (type) == ARTWORK_TYPE_MUSIC ?         \
+                                MUSICINFO_FILENAME : "")
+
+#define ARTWORK_DIRECTORY(type)                                                \
+                               ((type) == ARTWORK_TYPE_GRAPHICS ?      \
+                                GRAPHICS_DIRECTORY :                   \
+                                (type) == ARTWORK_TYPE_SOUNDS ?        \
+                                SOUNDS_DIRECTORY :                     \
+                                (type) == ARTWORK_TYPE_MUSIC ?         \
+                                MUSIC_DIRECTORY : "")
+
+#define OPTIONS_ARTWORK_DIRECTORY(type)                                        \
+                               ((type) == ARTWORK_TYPE_GRAPHICS ?      \
+                                options.graphics_directory :           \
+                                (type) == ARTWORK_TYPE_SOUNDS ?        \
+                                options.sounds_directory :             \
+                                (type) == ARTWORK_TYPE_MUSIC ?         \
+                                options.music_directory : "")
+
 
 /* type definitions */
 typedef int (*EventFilter)(const Event *);
index 932df515bd7080d4cd4c671a4e204930d5eb2210..d98a4c1bb7085590176e46f3ed4f07274bc452e1 100644 (file)
@@ -743,7 +743,11 @@ void DrawPlayer(struct PlayerInfo *player)
     {
       int element = MovingOrBlocked2Element(next_jx, next_jy);
       int graphic = el_act_dir2img(element, ACTION_PUSHING, move_dir);
+#if 1
+      int frame = getGraphicAnimationFrame(graphic, player->StepFrame);
+#else
       int frame = getGraphicAnimationFrame(graphic, player->Frame);
+#endif
 
       DrawGraphicShifted(px, py, sxx, syy, graphic, frame,
                         NO_CUTTING, NO_MASKING);