From: Holger Schemel Date: Sat, 3 Jun 2006 18:36:36 +0000 (+0200) Subject: rnd-20060603-1-src X-Git-Tag: 3.2.0^2~9 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=f719b7331067a46dc013dcab78dceeafcaeefdab;p=rocksndiamonds.git rnd-20060603-1-src * fixed crash bug when number of custom graphic frames was set to zero --- diff --git a/ChangeLog b/ChangeLog index 49f4d9af..4594e02d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2006-06-03 + * fixed crash bug when number of custom graphic frames was set to zero + 2006-05-30 * fixed some bugs when displaying title screens from info screen menu diff --git a/src/conftime.h b/src/conftime.h index 3271393a..91a94f88 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-05-30 23:57]" +#define COMPILE_DATE_STRING "[2006-06-03 20:34]" diff --git a/src/files.c b/src/files.c index aa6ce259..5f5b1fbb 100644 --- a/src/files.c +++ b/src/files.c @@ -2527,6 +2527,11 @@ static int LoadLevel_CUS1(FILE *file, int chunk_size, struct LevelInfo *level) #endif #if 1 + /* older game versions that wrote level files with CUS1 chunks used + different default push delay values (not yet stored in level file) */ + element_info[element].push_delay_fixed = 2; + element_info[element].push_delay_random = 8; +#else /* needed for older levels (see src/init.c for details) */ element_info[element].push_delay_fixed = -1; /* initialize later */ element_info[element].push_delay_random = -1; /* initialize later */ @@ -4930,6 +4935,7 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) /* initialize element properties for level editor etc. */ InitElementPropertiesEngine(level->game_version); + InitElementPropertiesAfterLoading(level->game_version); } static void LoadLevel_InitPlayfield(struct LevelInfo *level, char *filename) @@ -6470,6 +6476,7 @@ void LoadTapeFromFilename(char *filename) tape.length_seconds = GetTapeLength(); #if 0 + printf("::: tape file version: %d\n", tape.file_version); printf("::: tape game version: %d\n", tape.game_version); printf("::: tape engine version: %d\n", tape.engine_version); #endif diff --git a/src/game.c b/src/game.c index 7c6b4cff..ed436b4a 100644 --- a/src/game.c +++ b/src/game.c @@ -1767,8 +1767,22 @@ static void InitGameEngine() { if (!IS_CUSTOM_ELEMENT(i)) { +#if 1 + /* set default push delay values (corrected since version 3.0.7-1) */ + if (game.engine_version < VERSION_IDENT(3,0,7,1)) + { + element_info[i].push_delay_fixed = 2; + element_info[i].push_delay_random = 8; + } + else + { + element_info[i].push_delay_fixed = 8; + element_info[i].push_delay_random = 8; + } +#else element_info[i].push_delay_fixed = game.default_push_delay_fixed; element_info[i].push_delay_random = game.default_push_delay_random; +#endif } } @@ -11681,6 +11695,8 @@ int DigField(struct PlayerInfo *player, game.engine_version >= VERSION_IDENT(2,2,0,0)) old_element = Back[jx][jy]; + /* checking here causes player to move into acid even if the current field + cannot be left to that direction */ #if 0 #if USE_FIXED_DONT_RUN_INTO if (player_can_move && DONT_RUN_INTO(element)) @@ -11702,6 +11718,39 @@ int DigField(struct PlayerInfo *player, #endif #endif +#if 1 /* ------------------------------ NEW ------------------------------ */ + + if (IS_WALKABLE(old_element) && !ACCESS_FROM(old_element, move_direction)) + return MP_NO_ACTION; /* field has no opening in this direction */ + + if (IS_PASSABLE(old_element) && !ACCESS_FROM(old_element,opposite_direction)) + return MP_NO_ACTION; /* field has no opening in this direction */ + +#if USE_FIXED_DONT_RUN_INTO + if (player_can_move && element == EL_ACID && move_direction == MV_DOWN) + { + SplashAcid(x, y); + Feld[jx][jy] = EL_PLAYER_1; + InitMovingField(jx, jy, MV_DOWN); + Store[jx][jy] = EL_ACID; + ContinueMoving(jx, jy); + BuryPlayer(player); + + return MP_DONT_RUN_INTO; + } +#endif + +#if USE_FIXED_DONT_RUN_INTO + if (player_can_move && DONT_RUN_INTO(element)) + { + TestIfPlayerRunsIntoBadThing(jx, jy, player->MovDir); + + return MP_DONT_RUN_INTO; + } +#endif + +#else /* ------------------------------ OLD ------------------------------ */ + #if 1 #if USE_FIXED_DONT_RUN_INTO if (player_can_move && DONT_RUN_INTO(element)) @@ -11719,6 +11768,7 @@ int DigField(struct PlayerInfo *player, if (IS_PASSABLE(old_element) && !ACCESS_FROM(old_element,opposite_direction)) return MP_NO_ACTION; /* field has no opening in this direction */ + /* checking here causes player to explode when moving into acid */ #if 1 #if USE_FIXED_DONT_RUN_INTO if (player_can_move && element == EL_ACID && move_direction == MV_DOWN) @@ -11735,6 +11785,8 @@ int DigField(struct PlayerInfo *player, #endif #endif +#endif /* ------------------------------ END ------------------------------ */ + #if 0 #if USE_FIXED_DONT_RUN_INTO if (player_can_move && DONT_RUN_INTO(element)) diff --git a/src/init.c b/src/init.c index 21a989c6..647a1d34 100644 --- a/src/init.c +++ b/src/init.c @@ -1018,6 +1018,9 @@ static void set_graphic_parameters(int graphic) else graphic_info[graphic].anim_frames = 1; + if (graphic_info[graphic].anim_frames == 0) /* frames must be at least 1 */ + graphic_info[graphic].anim_frames = 1; + graphic_info[graphic].anim_frames_per_line = (parameter[GFX_ARG_FRAMES_PER_LINE] != ARG_UNDEFINED_VALUE ? parameter[GFX_ARG_FRAMES_PER_LINE] : anim_frames_per_line); @@ -3919,6 +3922,7 @@ void InitElementPropertiesEngine(int engine_version) engine_version > VERSION_IDENT(2,0,1,0))); } +#if 0 /* set default push delay values (corrected since version 3.0.7-1) */ if (engine_version < VERSION_IDENT(3,0,7,1)) { @@ -3930,7 +3934,9 @@ void InitElementPropertiesEngine(int engine_version) game.default_push_delay_fixed = 8; game.default_push_delay_random = 8; } +#endif +#if 0 /* set uninitialized push delay values of custom elements in older levels */ for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { @@ -3941,7 +3947,9 @@ void InitElementPropertiesEngine(int engine_version) if (element_info[element].push_delay_random == -1) element_info[element].push_delay_random = game.default_push_delay_random; } +#endif +#if 0 /* set some other uninitialized values of custom elements in older levels */ if (engine_version < VERSION_IDENT(3,1,0,0)) { @@ -3955,6 +3963,7 @@ void InitElementPropertiesEngine(int engine_version) element_info[element].ignition_delay = 8; } } +#endif #if 0 /* set element properties that were handled incorrectly in older levels */ @@ -3970,6 +3979,54 @@ void InitElementPropertiesEngine(int engine_version) InitElementGraphicInfo(); } +void InitElementPropertiesAfterLoading(int engine_version) +{ + int i; + +#if 0 + /* set default push delay values (corrected since version 3.0.7-1) */ + if (engine_version < VERSION_IDENT(3,0,7,1)) + { + game.default_push_delay_fixed = 2; + game.default_push_delay_random = 8; + } + else + { + game.default_push_delay_fixed = 8; + game.default_push_delay_random = 8; + } +#endif + +#if 0 + /* set uninitialized push delay values of custom elements in older levels */ + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) + { + int element = EL_CUSTOM_START + i; + + if (element_info[element].push_delay_fixed == -1) + element_info[element].push_delay_fixed = game.default_push_delay_fixed; + if (element_info[element].push_delay_random == -1) + element_info[element].push_delay_random = game.default_push_delay_random; + } +#endif + +#if 1 + /* set some other uninitialized values of custom elements in older levels */ + if (engine_version < VERSION_IDENT(3,1,0,0)) + { + for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) + { + int element = EL_CUSTOM_START + i; + + element_info[element].access_direction = MV_ALL_DIRECTIONS; + + element_info[element].explosion_delay = 17; + element_info[element].ignition_delay = 8; + } + } +#endif +} + static void InitGlobal() { int i; diff --git a/src/init.h b/src/init.h index 75cf288d..1bfd49bc 100644 --- a/src/init.h +++ b/src/init.h @@ -34,6 +34,7 @@ boolean getBitfieldProperty(int *, int, int); void InitElementPropertiesStatic(void); void InitElementPropertiesEngine(int); +void InitElementPropertiesAfterLoading(int); void ReloadCustomArtwork(int); void RedrawBackground();