run:
@$(MAKE_CMD) TARGET=$(DEFAULT_TARGET) && ./rocksndiamonds --verbose
+gdb:
+ @$(MAKE_CMD) TARGET=$(DEFAULT_TARGET) && gdb ./rocksndiamonds
+
backup:
./Scripts/make_backup.sh src
-#define COMPILE_DATE_STRING "[2002-09-06 22:45]"
+#define COMPILE_DATE_STRING "[2002-09-07 12:06]"
static void InitElementProperties(void);
static void InitElementInfo(void);
static void InitGraphicInfo(void);
+static void InitSoundInfo();
static void Execute_Debug_Command(char *);
void OpenAll(void)
static void InitImages()
{
- static char *suffix_list[] =
- {
- ".frame_xpos",
- ".frame_ypos",
- ".num_frames",
- NULL
- };
-
- image_files =
- getFileListFromConfigList(image_config, suffix_list, NUM_IMAGE_FILES);
-
- InitImageList(image_files, NUM_IMAGE_FILES);
+ InitImageList(image_config, image_config_suffix, NUM_IMAGE_FILES);
/* load custom images */
ReloadCustomImages();
+
InitGraphicInfo();
}
static void InitMixer()
{
- static char *suffix_list[] =
- {
- NULL
- };
-
OpenAudio();
- sound_files =
- getFileListFromConfigList(sound_config, suffix_list, NUM_SOUND_FILES);
-
- InitSoundList(sound_files, NUM_SOUND_FILES);
+ InitSoundList(sound_config, sound_config_suffix, NUM_SOUND_FILES);
StartMixer();
}
InitReloadSounds(artwork.snd_current->identifier);
InitReloadMusic(artwork.mus_current->identifier);
- /* initialize sound effect lookup table for element actions */
- InitGameSound();
+ InitSoundInfo();
}
static void InitTileClipmasks()
}
}
-void InitGraphicInfo()
+static void InitGraphicInfo()
{
int i;
- /* always start with reliable default values */
+ image_files = getCurrentImageList();
+
for(i=0; i<MAX_GRAPHICS; i++)
{
+ /* always start with reliable default values */
graphic_info[i].bitmap = NULL;
graphic_info[i].src_x = 0;
graphic_info[i].src_y = 0;
}
}
+static void InitSoundInfo()
+{
+ sound_files = getCurrentSoundList();
+
+ /* initialize sound effect lookup table for element actions */
+ InitGameSound();
+}
+
void InitElementProperties()
{
int i, j;
free(image);
}
-void InitImageList(struct FileInfo *file_list, int num_list_entries)
+struct FileInfo *getCurrentImageList()
{
- if (image_info == NULL)
- image_info = checked_calloc(sizeof(struct ArtworkListInfo));
+ return image_info->file_list;
+}
- if (image_info->artwork_list == NULL)
- image_info->artwork_list =
- checked_calloc(num_list_entries * sizeof(ImageInfo *));
+void InitImageList(struct ConfigInfo *config_list, char *config_suffix_list[],
+ int num_file_list_entries)
+{
+ int i;
+
+ image_info = checked_calloc(sizeof(struct ArtworkListInfo));
image_info->type = ARTWORK_TYPE_GRAPHICS;
- image_info->num_list_entries = num_list_entries;
- image_info->file_list = file_list;
+
+ image_info->num_file_list_entries = num_file_list_entries;
+ image_info->num_suffix_list_entries = 0;
+ for (i=0; config_suffix_list[i] != NULL; i++)
+ image_info->num_suffix_list_entries++;
+
+ image_info->file_list =
+ getFileListFromConfigList(config_list, config_suffix_list,
+ num_file_list_entries);
+ image_info->suffix_list = config_suffix_list;
+
+ image_info->artwork_list =
+ checked_calloc(num_file_list_entries * sizeof(ImageInfo *));
+
image_info->content_list = NULL;
+
image_info->load_artwork = Load_PCX;
image_info->free_artwork = FreeImage;
}
#endif /* TARGET_X11 */
-void InitImageList(struct FileInfo *, int);
+struct FileInfo *getCurrentImageList();
+void InitImageList(struct ConfigInfo *, char **, int);
void ReloadCustomImages();
void FreeAllImages();
struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list,
char *suffix_list[],
- int num_list_entries)
+ int num_file_list_entries)
{
- struct FileInfo *file_list =
- checked_calloc(num_list_entries * sizeof(struct FileInfo));
- int list_pos = 0;
+ struct FileInfo *file_list;
+ int num_suffix_list_entries = 0;
+ int list_pos = -1;
int i, j;
+ file_list = checked_calloc(num_file_list_entries * sizeof(struct FileInfo));
+
+ for (i=0; suffix_list[i] != NULL; i++)
+ num_suffix_list_entries++;
+
+ if (num_suffix_list_entries > 0)
+ {
+ for (i=0; i<num_file_list_entries; i++)
+ {
+ file_list[i].default_parameter =
+ checked_calloc(num_suffix_list_entries * sizeof(int));
+ file_list[i].parameter =
+ checked_calloc(num_suffix_list_entries * sizeof(int));
+
+ for (j=0; j<num_suffix_list_entries; j++)
+ {
+ file_list[i].default_parameter[j] = -1;
+ file_list[i].parameter[j] = -1;
+ }
+ }
+ }
+
for (i=0; config_list[i].token != NULL; i++)
{
int len_config_token = strlen(config_list[i].token);
strcmp(&config_list[i].token[len_config_token - len_suffix],
suffix_list[j]) == 0)
{
+ file_list[list_pos].default_parameter[j] = atoi(config_list[i].value);
+
is_file_entry = FALSE;
break;
}
if (is_file_entry)
{
- if (list_pos >= num_list_entries)
+ list_pos++;
+
+ if (list_pos >= num_file_list_entries)
Error(ERR_EXIT, "inconsistant config list information -- please fix");
file_list[list_pos].token = config_list[i].token;
file_list[list_pos].default_filename = config_list[i].value;
-
- list_pos++;
}
}
- if (list_pos != num_list_entries)
+ if (list_pos != num_file_list_entries - 1)
Error(ERR_EXIT, "inconsistant config list information -- please fix");
return file_list;
static void LoadArtworkConfig(struct ArtworkListInfo *artwork_info)
{
- int num_list_entries = artwork_info->num_list_entries;
+ int num_file_list_entries = artwork_info->num_file_list_entries;
+ int num_suffix_list_entries = artwork_info->num_suffix_list_entries;
struct FileInfo *file_list = artwork_info->file_list;
char *filename = getCustomArtworkConfigFilename(artwork_info->type);
struct SetupFileList *setup_file_list;
- int i;
+ int i, j;
#if 0
printf("GOT CUSTOM ARTWORK CONFIG FILE '%s'\n", filename);
#endif
/* always start with reliable default values */
- for (i=0; i<num_list_entries; i++)
+ for (i=0; i<num_file_list_entries; i++)
+ {
file_list[i].filename = NULL;
+ for (j=0; j<num_suffix_list_entries; j++)
+ {
+ file_list[i].parameter[j] = file_list[i].default_parameter[j];
+ }
+ }
+
if (filename == NULL)
return;
if ((setup_file_list = loadSetupFileList(filename)))
{
- for (i=0; i<num_list_entries; i++)
+ for (i=0; i<num_file_list_entries; i++)
file_list[i].filename =
getStringCopy(getTokenValue(setup_file_list, file_list[i].token));
freeSetupFileList(setup_file_list);
#if 0
- for (i=0; i<num_list_entries; i++)
+ for (i=0; i<num_file_list_entries; i++)
{
printf("'%s' ", file_list[i].token);
if (file_list[i].filename)
char *basename, int list_pos)
{
if (artwork_info->artwork_list == NULL ||
- list_pos >= artwork_info->num_list_entries)
+ list_pos >= artwork_info->num_file_list_entries)
return;
#if 0
{ "Loading music:", TRUE }
};
- int num_list_entries = artwork_info->num_list_entries;
+ int num_file_list_entries = artwork_info->num_file_list_entries;
struct FileInfo *file_list = artwork_info->file_list;
int i;
DrawInitText(draw_init[artwork_info->type].text, 120, FC_GREEN);
#if 0
- printf("DEBUG: reloading %d sounds ...\n", num_list_entries);
+ printf("DEBUG: reloading %d sounds ...\n", num_file_list_entries);
#endif
- for(i=0; i<num_list_entries; i++)
+ for(i=0; i<num_file_list_entries; i++)
{
if (draw_init[artwork_info->type].do_it)
DrawInitText(file_list[i].token, 150, FC_YELLOW);
IS_CHILD_PROCESS(audio.mixer_pid) ? "CHILD" : "PARENT");
#endif
- for(i=0; i<artwork_info->num_list_entries; i++)
+ for(i=0; i<artwork_info->num_file_list_entries; i++)
deleteArtworkListEntry(artwork_info, &artwork_info->artwork_list[i]);
#if 0
free(artwork_info->artwork_list);
artwork_info->artwork_list = NULL;
- artwork_info->num_list_entries = 0;
+ artwork_info->num_file_list_entries = 0;
}
return snd_info;
}
-void InitSoundList(struct FileInfo *file_list, int num_list_entries)
+struct FileInfo *getCurrentSoundList()
{
- if (sound_info == NULL)
- sound_info = checked_calloc(sizeof(struct ArtworkListInfo));
+ return sound_info->file_list;
+}
- if (sound_info->artwork_list == NULL)
- sound_info->artwork_list =
- checked_calloc(num_list_entries * sizeof(SoundInfo *));
+void InitSoundList(struct ConfigInfo *config_list, char *config_suffix_list[],
+ int num_file_list_entries)
+{
+ int i;
+
+ sound_info = checked_calloc(sizeof(struct ArtworkListInfo));
sound_info->type = ARTWORK_TYPE_SOUNDS;
- sound_info->num_list_entries = num_list_entries;
- sound_info->file_list = file_list;
+
+ sound_info->num_file_list_entries = num_file_list_entries;
+ sound_info->num_suffix_list_entries = 0;
+ for (i=0; config_suffix_list[i] != NULL; i++)
+ sound_info->num_suffix_list_entries++;
+
+ sound_info->file_list =
+ getFileListFromConfigList(config_list, config_suffix_list,
+ num_file_list_entries);
+ sound_info->suffix_list = config_suffix_list;
+
+ sound_info->artwork_list =
+ checked_calloc(num_file_list_entries * sizeof(SoundInfo *));
+
sound_info->content_list = NULL;
+
sound_info->load_artwork = Load_WAV;
sound_info->free_artwork = FreeSound;
- num_sounds = sound_info->num_list_entries;
+ num_sounds = sound_info->num_file_list_entries;
Sound = (SoundInfo **)sound_info->artwork_list;
}
void StopSound(int);
void StopSounds(void);
void StopSoundExt(int, int);
-void InitSoundList(struct FileInfo *, int);
+struct FileInfo *getCurrentSoundList();
+void InitSoundList(struct ConfigInfo *, char **, int);
void InitReloadSounds(char *);
void InitReloadMusic(char *);
void FreeAllSounds(void);
struct FileInfo
{
char *token;
- char *default_filename;
+ char *default_filename;
char *filename;
+
+ int *default_parameter; /* array of file parameters */
+ int *parameter; /* array of file parameters */
};
struct ListNodeInfo
struct ArtworkListInfo
{
int type; /* type of artwork */
- int num_list_entries;
- struct FileInfo *file_list; /* static artwork file list */
- struct ListNodeInfo **artwork_list; /* static artwork list */
- struct ListNode *content_list; /* dynamic artwork list */
+
+ int num_file_list_entries;
+ int num_suffix_list_entries;
+
+ struct FileInfo *file_list; /* static artwork file array */
+ char **suffix_list; /* parameter suffixes array */
+
+ struct ListNodeInfo **artwork_list; /* static artwork node array */
+
+ struct ListNode *content_list; /* dynamic artwork node list */
+
void *(*load_artwork)(char *); /* constructor function */
void (*free_artwork)(void *); /* destructor function */
};
"gate.wav"
};
+char *image_config_suffix[] =
+{
+ ".frame_xpos",
+ ".frame_ypos",
+ ".num_frames",
+ NULL
+};
+
+char *sound_config_suffix[] =
+{
+ NULL
+};
+
struct ConfigInfo image_config[] =
{
/* graphics for Boulder Dash style elements and actions */
extern struct GraphicInfo graphic_info[];
extern struct ConfigInfo image_config[], sound_config[];
extern struct FileInfo *image_files, *sound_files;
+extern char *image_config_suffix[], *sound_config_suffix[];
/* often used screen positions */
#define SX 8