From 38c26472a6e9f0f037ddfe535d3919c00772b26f Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 13 Jan 2003 02:39:39 +0100 Subject: [PATCH] rnd-20030113-1-src --- CHANGES | 9 +++++++- Makefile | 3 +++ src/conftime.h | 2 +- src/files.c | 51 +++++++++++++++++++++++++++++++++++++++++----- src/files.h | 2 ++ src/game.c | 16 ++------------- src/init.c | 12 +++++++++++ src/libgame/misc.c | 1 + src/main.h | 2 +- 9 files changed, 76 insertions(+), 22 deletions(-) diff --git a/CHANGES b/CHANGES index c9ccb06d..0134d5fe 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,13 @@ -Pre-Release Version 2.2.0rc2 [?? ??? ????] +Pre-Release Version 2.2.0rc2 [13 JAN 2003] ------------------------------------------ - added support for stereo WAV sound files + - moving objects can now have arbitrary animation length + - new batch command for dumping level information + - added support for background images for all menu screens + - added 128 custom elements that can be decorated with own graphics + - added some example levels showing how to create custom artwork + - added new contributed levels from the following players: + + Emanuel Schmieg: "Into The Ice Caves" (22 levels + artwork) Pre-Release Version 2.2.0rc1 [31 DEC 2002] ------------------------------------------ diff --git a/Makefile b/Makefile index a04c870b..ba491935 100644 --- a/Makefile +++ b/Makefile @@ -103,6 +103,9 @@ gdb: enginetest: ./Scripts/make_enginetest.sh +enginetestfast: + ./Scripts/make_enginetest.sh fast + backup: ./Scripts/make_backup.sh src diff --git a/src/conftime.h b/src/conftime.h index 56821dd1..95387954 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-01-12 04:55]" +#define COMPILE_DATE_STRING "[2003-01-13 02:38]" diff --git a/src/files.c b/src/files.c index f4c2065d..6d858c47 100644 --- a/src/files.c +++ b/src/files.c @@ -96,6 +96,11 @@ static void setLevelInfoToDefaults() BorderElement = EL_STEELWALL; + level.no_level_file = FALSE; + + if (leveldir_current == NULL) /* only when dumping level */ + return; + /* try to determine better author name than 'anonymous' */ if (strcmp(leveldir_current->author, ANONYMOUS_NAME) != 0) { @@ -125,8 +130,6 @@ static void setLevelInfoToDefaults() break; } } - - level.no_level_file = FALSE; } static int checkLevelElement(int element) @@ -310,9 +313,8 @@ static int LoadLevel_CNT2(FILE *file, int chunk_size, struct LevelInfo *level) return chunk_size; } -void LoadLevel(int level_nr) +void LoadLevelFromFilename(char *filename) { - char *filename = getLevelFilename(level_nr); char cookie[MAX_LINE_LEN]; char chunk_name[CHUNK_ID_LEN + 1]; int chunk_size; @@ -433,6 +435,9 @@ void LoadLevel(int level_nr) fclose(file); + if (leveldir_current == NULL) /* only when dumping level */ + return; + if (IS_LEVELCLASS_CONTRIBUTION(leveldir_current) || IS_LEVELCLASS_USER(leveldir_current)) { @@ -484,6 +489,13 @@ void LoadLevel(int level_nr) SetBorderElement(); } +void LoadLevel(int level_nr) +{ + char *filename = getLevelFilename(level_nr); + + LoadLevelFromFilename(filename); +} + static void SaveLevel_VERS(FILE *file, struct LevelInfo *level) { putFileVersion(file, level->file_version); @@ -688,6 +700,35 @@ void SaveLevel(int level_nr) SetFilePermissions(filename, PERMS_PRIVATE); } +void DumpLevel(struct LevelInfo *level) +{ + printf_line('-', 79); + printf("Level xxx (file version %06d, game version %06d)\n", + level->file_version, level->game_version); + printf_line('-', 79); + + printf("Level Author: '%s'\n", level->author); + printf("Level Title: '%s'\n", level->name); + printf("\n"); + printf("Playfield Size: %d x %d\n", level->fieldx, level->fieldy); + printf("\n"); + printf("Level Time: %d seconds\n", level->time); + printf("Gems needed: %d\n", level->gems_needed); + printf("\n"); + printf("Time for Magic Wall: %d seconds\n", level->time_magic_wall); + printf("Time for Wheel: %d seconds\n", level->time_wheel); + printf("Time for Light: %d seconds\n", level->time_light); + printf("Time for Timegate: %d seconds\n", level->time_timegate); + printf("\n"); + printf("Amoeba Speed: %d\n", level->amoeba_speed); + printf("\n"); + printf("Gravity: %s\n", (level->gravity ? "yes" : "no")); + printf("Double Speed Movement: %s\n", (level->double_speed ? "yes" : "no")); + printf("EM style slippery gems: %s\n", (level->em_slippery_gems ? "yes" : "no")); + + printf_line('-', 79); +} + /* ========================================================================= */ /* tape file functions */ @@ -1080,7 +1121,7 @@ void DumpTape(struct TapeInfo *tape) } printf_line('-', 79); - printf("Tape of Level %d (file version %06d, game version %06d)\n", + printf("Tape of Level %03d (file version %06d, game version %06d)\n", tape->level_nr, tape->file_version, tape->game_version); printf_line('-', 79); diff --git a/src/files.h b/src/files.h index 81985010..37066d08 100644 --- a/src/files.h +++ b/src/files.h @@ -16,8 +16,10 @@ #include "main.h" +void LoadLevelFromFilename(char *); void LoadLevel(int); void SaveLevel(int); +void DumpLevel(struct LevelInfo *); void LoadTapeFromFilename(char *); void LoadTape(int); diff --git a/src/game.c b/src/game.c index a3cc0df6..901a7fcf 100644 --- a/src/game.c +++ b/src/game.c @@ -4765,7 +4765,7 @@ static void WarnBuggyBase(int x, int y) } #if 1 -static void CheckBuggyBase(int x, int y) +void CheckBuggyBase(int x, int y) { int element = Feld[x][y]; @@ -4858,7 +4858,7 @@ static void ChangeActiveTrap(int x, int y) } #if 1 -static void CheckTrap(int x, int y) +void CheckTrap(int x, int y) { int element = Feld[x][y]; @@ -5342,21 +5342,9 @@ void GameActions() element == EL_SP_BUGGY_BASE_ACTIVATING || element == EL_SP_BUGGY_BASE_ACTIVE) CheckBuggyBase(x, y); -#endif -#if 0 else if (element == EL_TRAP || element == EL_TRAP_ACTIVE) CheckTrap(x, y); -#endif -#if 0 - else if (element == EL_TRAP) - CheckTrap(x, y); -#endif -#if 0 - else if (element == EL_TRAP_ACTIVE) - CheckTrap(x, y); -#endif -#if 0 else if (IS_BELT_ACTIVE(element)) DrawBeltAnimation(x, y, element); else if (element == EL_SWITCHGATE_OPENING) diff --git a/src/init.c b/src/init.c index c25ded77..29f59e29 100644 --- a/src/init.c +++ b/src/init.c @@ -2260,6 +2260,18 @@ void Execute_Command(char *command) exit(0); } + else if (strncmp(command, "dump level ", 11) == 0) + { + char *filename = &command[11]; + + if (access(filename, F_OK) != 0) + Error(ERR_EXIT, "cannot open file '%s'", filename); + + LoadLevelFromFilename(filename); + DumpLevel(&level); + + exit(0); + } else if (strncmp(command, "dump tape ", 10) == 0) { char *filename = &command[10]; diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 30399620..9865b9d6 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -458,6 +458,7 @@ static void printUsage() " \"print graphicsinfo.conf\" print default graphics config\n" " \"print soundsinfo.conf\" print default sounds config\n" " \"print musicinfo.conf\" print default music config\n" + " \"dump level FILE\" dump level data from FILE\n" " \"dump tape FILE\" dump tape data from FILE\n" " \"autoplay LEVELDIR\" play level tapes for LEVELDIR\n" "\n", diff --git a/src/main.h b/src/main.h index 3679d550..93100c54 100644 --- a/src/main.h +++ b/src/main.h @@ -1436,7 +1436,7 @@ #define PROGRAM_VERSION_MAJOR 2 #define PROGRAM_VERSION_MINOR 2 #define PROGRAM_VERSION_PATCH 0 -#define PROGRAM_VERSION_STRING "2.2.0rc2" +#define PROGRAM_VERSION_STRING "2.2.0rc3" #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" #define PROGRAM_AUTHOR_STRING "Holger Schemel" -- 2.34.1