From: Holger Schemel Date: Fri, 3 Jun 2005 07:29:34 +0000 (+0200) Subject: rnd-20050603-1-src X-Git-Tag: 3.1.1^2~14 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;ds=inline;h=6890bb7cb72e140f4b82f35217655ae6c5213fec;p=rocksndiamonds.git rnd-20050603-1-src --- diff --git a/src/conftime.h b/src/conftime.h index 0bbfda57..5e4549ef 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2005-05-31 00:09]" +#define COMPILE_DATE_STRING "[2005-06-03 01:24]" diff --git a/src/files.c b/src/files.c index 473a7392..6e1c770f 100644 --- a/src/files.c +++ b/src/files.c @@ -3959,7 +3959,7 @@ void SaveTape(int nr) InitTapeDirectory(leveldir_current->subdir); /* if a tape still exists, ask to overwrite it */ - if (access(filename, F_OK) == 0) + if (fileExists(filename)) { new_tape = FALSE; if (!Request("Replace old tape ?", REQ_ASK)) diff --git a/src/game.c b/src/game.c index af07f9bf..b6c1a518 100644 --- a/src/game.c +++ b/src/game.c @@ -38,6 +38,9 @@ #define USE_NEW_RANDOMIZE (TRUE * USE_NEW_STUFF * 1) #define USE_PUSH_BUGFIX (TRUE * USE_NEW_STUFF * 1) +#define USE_BLOCK_DELAY_BUGFIX (TRUE * USE_NEW_STUFF * 1) +#define USE_GRAVITY_BUGFIX (TRUE * USE_NEW_STUFF * 0) +#define USE_GRAVITY_BUGFIX_2 (TRUE * USE_NEW_STUFF * 1) #define USE_CAN_MOVE_NOT_MOVING (TRUE * USE_NEW_STUFF * 1) #define USE_PREVIOUS_MOVE_DIR (TRUE * USE_NEW_STUFF * 1) @@ -9485,7 +9488,9 @@ static boolean canFallDown(struct PlayerInfo *player) return (IN_LEV_FIELD(jx, jy + 1) && (IS_FREE(jx, jy + 1) || #if USE_NEW_BLOCK_STYLE +#if USE_GRAVITY_BUGFIX Feld[jx][jy + 1] == EL_PLAYER_IS_LEAVING || +#endif #endif (Feld[jx][jy + 1] == EL_ACID && player->can_fall_into_acid)) && IS_WALKABLE_FROM(Feld[jx][jy], MV_DOWN) && @@ -10154,8 +10159,24 @@ void ScrollPlayer(struct PlayerInfo *player, int mode) if (player->block_delay > 0 && Feld[last_jx][last_jy] == EL_EMPTY) { + int last_field_block_delay = player->block_delay; + +#if USE_BLOCK_DELAY_BUGFIX + /* when blocking enabled, correct block delay for fast movement */ + if (player->block_delay > 1 && + player->move_delay_value < MOVE_DELAY_NORMAL_SPEED) + last_field_block_delay = player->move_delay_value; +#endif + +#if USE_GRAVITY_BUGFIX_2 + /* when blocking enabled, correct block delay for gravity movement */ + if (player->block_delay > 1 && + game.gravity && player->MovDir == MV_UP) + last_field_block_delay = player->move_delay_value - 1; +#endif + Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING; - MovDelay[last_jx][last_jy] = player->block_delay + 1; + MovDelay[last_jx][last_jy] = last_field_block_delay + 1; } #else #if USE_NEW_MOVE_STYLE diff --git a/src/init.c b/src/init.c index bce31372..6e970c2f 100644 --- a/src/init.c +++ b/src/init.c @@ -2529,7 +2529,9 @@ void InitElementPropertiesStatic() EL_PENGUIN, EL_PIG, EL_DRAGON, +#if 0 /* USE_GRAVITY_BUGFIX */ EL_PLAYER_IS_LEAVING, /* needed for gravity + "block last field" */ +#endif -1 }; @@ -4172,7 +4174,7 @@ void Execute_Command(char *command) { char *filename = &command[11]; - if (access(filename, F_OK) != 0) + if (!fileExists(filename)) Error(ERR_EXIT, "cannot open file '%s'", filename); LoadLevelFromFilename(&level, filename); @@ -4184,7 +4186,7 @@ void Execute_Command(char *command) { char *filename = &command[10]; - if (access(filename, F_OK) != 0) + if (!fileExists(filename)) Error(ERR_EXIT, "cannot open file '%s'", filename); LoadTapeFromFilename(filename); diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 130182df..967fbcfa 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -780,7 +780,7 @@ static void SaveUserLevelInfo(); void InitUserLevelDirectory(char *level_subdir) { - if (access(getUserLevelDir(level_subdir), F_OK) != 0) + if (!fileExists(getUserLevelDir(level_subdir))) { createDirectory(getUserDataDir(), "user data", PERMS_PRIVATE); createDirectory(getUserLevelDir(NULL), "main user level", PERMS_PRIVATE); @@ -1114,7 +1114,7 @@ void createDirectory(char *dir, char *text, int permission_class) mode_t group_umask = ~(dir_mode & S_IRWXG); posix_umask(normal_umask & group_umask); - if (access(dir, F_OK) != 0) + if (!fileExists(dir)) if (posix_mkdir(dir, dir_mode) != 0) Error(ERR_WARN, "cannot create %s directory '%s'", text, dir); @@ -1417,17 +1417,18 @@ static void *loadSetupFileData(char *filename, boolean use_hash) boolean read_continued_line = FALSE; FILE *file; - if (use_hash) - setup_file_data = newSetupFileHash(); - else - insert_ptr = setup_file_data = newSetupFileList("", ""); - if (!(file = fopen(filename, MODE_READ))) { Error(ERR_WARN, "cannot open configuration file '%s'", filename); + return NULL; } + if (use_hash) + setup_file_data = newSetupFileHash(); + else + insert_ptr = setup_file_data = newSetupFileList("", ""); + while (!feof(file)) { /* read next line of input file */ @@ -1953,10 +1954,21 @@ static boolean LoadLevelInfoFromLevelConf(TreeInfo **node_first, { char *directory_path = getPath2(level_directory, directory_name); char *filename = getPath2(directory_path, LEVELINFO_FILENAME); - SetupFileHash *setup_file_hash = loadSetupFileHash(filename); + SetupFileHash *setup_file_hash; LevelDirTree *leveldir_new = NULL; int i; + /* unless debugging, silently ignore directories without "levelinfo.conf" */ + if (!options.debug && !fileExists(filename)) + { + free(directory_path); + free(filename); + + return FALSE; + } + + setup_file_hash = loadSetupFileHash(filename); + if (setup_file_hash == NULL) { Error(ERR_WARN, "ignoring level directory '%s'", directory_path); @@ -2166,7 +2178,7 @@ static boolean LoadArtworkInfoFromArtworkConf(TreeInfo **node_first, TreeInfo *artwork_new = NULL; int i; - if (access(filename, F_OK) == 0) /* file exists */ + if (fileExists(filename)) setup_file_hash = loadSetupFileHash(filename); if (setup_file_hash == NULL) /* no config file -- look for artwork files */ diff --git a/src/main.h b/src/main.h index c8c83033..1297f845 100644 --- a/src/main.h +++ b/src/main.h @@ -1364,7 +1364,7 @@ #define PROGRAM_VERSION_MAJOR 3 #define PROGRAM_VERSION_MINOR 2 #define PROGRAM_VERSION_PATCH 0 -#define PROGRAM_VERSION_BUILD 2 +#define PROGRAM_VERSION_BUILD 3 #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" #define PROGRAM_AUTHOR_STRING "Holger Schemel"