#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
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);
}
}
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)
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)
for(i=0; i<NUM_BITMAPS; i++)
{
- if (pix[i]->stored_clip_gc)
+ if (pix[i] != NULL && pix[i]->stored_clip_gc)
{
XFreeGC(display, pix[i]->stored_clip_gc);
pix[i]->stored_clip_gc = None;
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<NUM_PICTURES; i++)
{
Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
}
+void Execute_Debug_Command(char *command)
+{
+ if (strcmp(command, "create soundinfo.conf") == 0)
+ {
+ int i;
+
+ printf("# You can configure additional/alternative sound effects here\n");
+ printf("# (The sounds below are default and therefore commented out.)\n");
+ printf("\n");
+
+ for (i=0; i<NUM_SOUND_EFFECTS; i++)
+ printf("# %s\n",
+ getFormattedSetupEntry(sound_effects[i].text,
+ sound_effects[i].default_filename));
+ }
+}
+
void CloseAllAndExit(int exit_value)
{
int i;
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
-/*
-#include <sys/stat.h>
-*/
#include <stdarg.h>
#include <ctype.h>
#include <string.h>
options.network = FALSE;
options.verbose = FALSE;
options.debug = FALSE;
+ options.debug_command = NULL;
while (*options_left)
{
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] [<server host> [<server port>]]\n"
"Options:\n"
" -d, --display <host>[:<scr>] X server display\n"
" -b, --basepath <directory> alternative base directory\n"
" -l, --level <directory> alternative level directory\n"
" -g, --graphics <directory> alternative graphics directory\n"
- " -s, --sounds <directory> alternative graphics directory\n"
- " -m, --music <directory> alternative graphics directory\n"
+ " -s, --sounds <directory> alternative sounds directory\n"
+ " -m, --music <directory> 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 <command> execute special command\n");
+
exit(0);
}
else if (strncmp(option, "-display", option_len) == 0)
{
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);
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); i<TOKEN_VALUE_POSITION; i++)
- entry[i] = ' ';
- entry[i] = '\0';
+ strcat(entry, " ");
+ /* continue with the token's value */
strcat(entry, value);
return entry;
artwork.sounds_set_current = artwork.snd_current->name;
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);
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); i<TOKEN_VALUE_POSITION; i++)
- strcat(entry, " ");
+ /* build complete token string */
+ sprintf(token_string, "%s%s", prefix, token_text);
- /* continue with the token's value (which can have different types) */
- strcat(entry, value_string);
+ /* build setup entry line */
+ line = getFormattedSetupEntry(token_string, value_string);
if (token_type == TYPE_KEY_X11)
{
strcmp(keyname, "(unknown)") != 0)
{
/* add at least one whitespace */
- strcat(entry, " ");
- for (i=strlen(entry); i<TOKEN_COMMENT_POSITION; i++)
- strcat(entry, " ");
+ strcat(line, " ");
+ for (i=strlen(line); i<TOKEN_COMMENT_POSITION; i++)
+ strcat(line, " ");
- strcat(entry, "# ");
- strcat(entry, keyname);
+ strcat(line, "# ");
+ strcat(line, keyname);
}
}
- return entry;
+ return line;
}
void LoadLevelSetup_LastSeries()
#include "sound.h"
#include "misc.h"
#include "setup.h"
+#include "text.h"
/* expiration time (in milliseconds) for sound loops */
#define SOUND_LOOP_EXPIRATION_TIME 200
-#if defined(TARGET_SDL)
/* one second fading interval == 1000 ticks (milliseconds) */
#define SOUND_FADING_INTERVAL 1000
+
+#if defined(TARGET_SDL)
#define SOUND_MAX_VOLUME SDL_MIX_MAXVOLUME
#endif
{
char *filename = getCustomSoundFilename(basename);
+#if 0
+ printf("GOT CUSTOM SOUND FILE '%s'\n", filename);
+#endif
+
if (strcmp(basename, SND_FILE_UNDEFINED) == 0)
{
deleteSoundEntry(snd_info);
void LoadCustomMusic(void)
{
+ static boolean draw_init_text = TRUE; /* only draw at startup */
char *music_directory = getCustomMusicDirectory();
DIR *dir;
struct dirent *dir_entry;
return;
}
+ if (draw_init_text)
+ DrawInitText("Loading music:", 120, FC_GREEN);
+
while ((dir_entry = readdir(dir)) != NULL) /* loop until last dir entry */
{
char *basename = dir_entry->d_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))
closedir(dir);
+ draw_init_text = FALSE;
+
if (num_music == 0)
Error(ERR_WARN, "cannot find any valid music files in directory '%s'",
music_directory);
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<num_sounds; i++)
sound_effect[i].filename = NULL;
freeSetupFileList(setup_file_list);
-#if 1
+#if 0
for (i=0; i<num_sounds; i++)
{
printf("'%s' ", sound_effect[i].text);
static void ReloadCustomSounds()
{
+ static boolean draw_init_text = TRUE; /* only draw at startup */
int i;
#if 0
LoadSoundsInfo();
+ if (draw_init_text)
+ DrawInitText("Loading sounds:", 120, FC_GREEN);
+
#if 0
printf("DEBUG: reloading %d sounds ...\n", num_sounds);
#endif
for(i=0; i<num_sounds; i++)
{
+ if (draw_init_text)
+ DrawInitText(sound_effect[i].text, 150, FC_YELLOW);
+
if (sound_effect[i].filename)
LoadSoundToList(sound_effect[i].filename, i);
else
LoadSoundToList(sound_effect[i].default_filename, i);
}
+ draw_init_text = FALSE;
+
/*
printf("list size == %d\n", getNumNodes(SoundFileList));
*/
boolean network;
boolean verbose;
boolean debug;
+ char *debug_command;
};
struct VideoSystemInfo
{ "sp_disk_orange.pushing", "zonkpush.wav" },
{ "sp_disk_yellow.pushing", "pusch.wav" },
{ "sp_port.passing", "gate.wav" },
- { "sp_exit.entering", "buing.wav" },
+ { "sp_exit.entering", "exit.wav" },
{ "sp_element.exploding", "booom.wav" },
{ "sp_sniksnak.moving", SND_FILE_UNDEFINED },
{ "sp_electron.moving", SND_FILE_UNDEFINED },
{ "[not used]", "warnton.wav" },
{ "[not used]", "whoosh.wav" },
{ "[not used]", "boom.wav" },
- { "[not used]", "exit.wav" },
#endif
};
-#define COMPILE_DATE_STRING "[2002-05-13 21:42]"
+#define COMPILE_DATE_STRING "[2002-05-19 14:04]"