From: Holger Schemel Date: Sun, 19 May 2002 12:09:52 +0000 (+0200) Subject: rnd-20020519-1-src X-Git-Tag: 2.1.0^2~19 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=9c6293f12f9dea224bff9050050253e9f52e3819 rnd-20020519-1-src --- diff --git a/src/game.c b/src/game.c index 0312c695..89d556d3 100644 --- a/src/game.c +++ b/src/game.c @@ -76,31 +76,6 @@ #define DX_TIME (DX + XX_TIME) #define DY_TIME (DY + YY_TIME) -#if 0 -#define IS_LOOP_SOUND(s) ((s) == SND_BD_MAGIC_WALL_RUNNING || \ - (s) == SND_BD_BUTTERFLY_MOVING || \ - (s) == SND_BD_FIREFLY_MOVING || \ - (s) == SND_SP_SNIKSNAK_MOVING || \ - (s) == SND_SP_ELECTRON_MOVING || \ - (s) == SND_DYNAMITE_BURNING || \ - (s) == SND_BUG_MOVING || \ - (s) == SND_SPACESHIP_MOVING || \ - (s) == SND_YAMYAM_MOVING || \ - (s) == SND_YAMYAM_WAITING || \ - (s) == SND_ROBOT_WHEEL_RUNNING || \ - (s) == SND_MAGIC_WALL_RUNNING || \ - (s) == SND_BALLOON_MOVING || \ - (s) == SND_MOLE_MOVING || \ - (s) == SND_TIMEGATE_WHEEL_RUNNING || \ - (s) == SND_CONVEYOR_BELT_RUNNING || \ - (s) == SND_DYNABOMB_BURNING || \ - (s) == SND_PACMAN_MOVING || \ - (s) == SND_PENGUIN_MOVING || \ - (s) == SND_PIG_MOVING || \ - (s) == SND_DRAGON_MOVING || \ - (s) == SND_DRAGON_BREATHING_FIRE) -#endif - /* values for player movement speed (which is in fact a delay value) */ #define MOVE_DELAY_NORMAL_SPEED 8 #define MOVE_DELAY_HIGH_SPEED 4 @@ -4404,6 +4379,9 @@ static void DrawBeltAnimation(int x, int y, int element) int graphic = el2gfx(element) + (belt_dir == MV_LEFT ? 0 : 7); DrawGraphicAnimation(x, y, graphic, 8, delay, mode); + + if (!(FrameCounter % 2)) + PlaySoundLevel(x, y, SND_CONVEYOR_BELT_RUNNING); } } @@ -4754,11 +4732,7 @@ void GameActions() else if (element == EL_SP_TERMINAL_ACTIVE) DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_NORMAL); else if (IS_BELT(element)) - { DrawBeltAnimation(x, y, element); - if (!(FrameCounter % 2)) - PlaySoundLevel(x, y, SND_CONVEYOR_BELT_RUNNING); - } else if (element == EL_SWITCHGATE_OPENING) OpenSwitchgate(x, y); else if (element == EL_SWITCHGATE_CLOSING) diff --git a/src/init.c b/src/init.c index a8bac24c..08069f4a 100644 --- a/src/init.c +++ b/src/init.c @@ -51,9 +51,17 @@ static void InitGfx(void); static void InitGfxBackground(void); static void InitGadgets(void); static void InitElementProperties(void); +static void Execute_Debug_Command(char *); void OpenAll(void) { + if (options.debug_command) + { + Execute_Debug_Command(options.debug_command); + + exit(0); + } + if (options.serveronly) { #if defined(PLATFORM_UNIX) @@ -318,7 +326,7 @@ void FreeTileClipmasks() for(i=0; istored_clip_gc) + if (pix[i] != NULL && pix[i]->stored_clip_gc) { XFreeGC(display, pix[i]->stored_clip_gc); pix[i]->stored_clip_gc = None; @@ -357,7 +365,7 @@ void InitGfx() DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE); rest(200); #endif - DrawInitText("Loading graphics:",120,FC_GREEN); + DrawInitText("Loading graphics:", 120, FC_GREEN); for(i=0; i #include #include -/* -#include -*/ #include #include #include @@ -437,6 +434,7 @@ void GetOptions(char *argv[]) options.network = FALSE; options.verbose = FALSE; options.debug = FALSE; + options.debug_command = NULL; while (*options_left) { @@ -474,19 +472,23 @@ void GetOptions(char *argv[]) Error(ERR_EXIT_HELP, "unrecognized option '%s'", option); else if (strncmp(option, "-help", option_len) == 0) { - printf("Usage: %s [options] [server.name [port]]\n" + printf("Usage: %s [options] [ []]\n" "Options:\n" " -d, --display [:] X server display\n" " -b, --basepath alternative base directory\n" " -l, --level alternative level directory\n" " -g, --graphics alternative graphics directory\n" - " -s, --sounds alternative graphics directory\n" - " -m, --music alternative graphics directory\n" + " -s, --sounds alternative sounds directory\n" + " -m, --music alternative music directory\n" " -n, --network network multiplayer game\n" " --serveronly only start network server\n" " -v, --verbose verbose mode\n" " --debug display debugging information\n", program.command_basename); + + if (options.debug) + printf(" --debug-command execute special command\n"); + exit(0); } else if (strncmp(option, "-display", option_len) == 0) @@ -565,6 +567,15 @@ void GetOptions(char *argv[]) { options.debug = TRUE; } + else if (strncmp(option, "-debug-command", option_len) == 0) + { + if (option_arg == NULL) + Error(ERR_EXIT_HELP, "option '%s' requires an argument", option_str); + + options.debug_command = option_arg; + if (option_arg == next_option) + options_left++; + } else if (*option == '-') { Error(ERR_EXIT_HELP, "unrecognized option '%s'", option_str); diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 7b0189b8..cc66a554 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -984,11 +984,12 @@ char *getFormattedSetupEntry(char *token, char *value) int i; static char entry[MAX_LINE_LEN]; + /* start with the token and some spaces to format output line */ sprintf(entry, "%s:", token); for (i=strlen(entry); iname; artwork.music_set_current = artwork.mus_current->name; +#if 0 + printf("graphics set == %s\n\n", artwork.graphics_set_current); + printf("sounds set == %s\n\n", artwork.sounds_set_current); + printf("music set == %s\n\n", artwork.music_set_current); +#endif + sortTreeInfo(&artwork.gfx_first, compareTreeInfoEntries); sortTreeInfo(&artwork.snd_first, compareTreeInfoEntries); sortTreeInfo(&artwork.mus_first, compareTreeInfoEntries); @@ -1905,19 +1912,18 @@ char *getSetupValue(int type, void *value) char *getSetupLine(struct TokenInfo *token_info, char *prefix, int token_nr) { int i; - static char entry[MAX_LINE_LEN]; + char *line; + static char token_string[MAX_LINE_LEN]; int token_type = token_info[token_nr].type; void *setup_value = token_info[token_nr].value; char *token_text = token_info[token_nr].text; char *value_string = getSetupValue(token_type, setup_value); - /* start with the prefix, token and some spaces to format output line */ - sprintf(entry, "%s%s:", prefix, token_text); - for (i=strlen(entry); id_name; char *filename = getPath2(music_directory, basename); MusicInfo *mus_info = NULL; + if (draw_init_text) + DrawInitText(basename, 150, FC_YELLOW); + if (FileIsSound(basename)) mus_info = Load_WAV(filename); else if (FileIsMusic(basename)) @@ -1750,6 +1763,8 @@ void LoadCustomMusic(void) closedir(dir); + draw_init_text = FALSE; + if (num_music == 0) Error(ERR_WARN, "cannot find any valid music files in directory '%s'", music_directory); @@ -1944,6 +1959,10 @@ static void LoadSoundsInfo() struct SetupFileList *setup_file_list; int i; +#if 0 + printf("GOT CUSTOM SOUND CONFIG FILE '%s'\n", filename); +#endif + /* always start with reliable default values */ for (i=0; i