From: Holger Schemel Date: Sat, 7 Sep 2002 13:05:59 +0000 (+0200) Subject: rnd-20020907-2-src X-Git-Tag: 3.0.0^2~248 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=68a47a5b92e7c62a8c8a06391e4f9b8d53eeb82f;p=rocksndiamonds.git rnd-20020907-2-src --- diff --git a/src/conftime.h b/src/conftime.h index 0be54307..551ee18b 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2002-09-07 12:06]" +#define COMPILE_DATE_STRING "[2002-09-07 15:04]" diff --git a/src/init.c b/src/init.c index 4c49a237..f2d07f41 100644 --- a/src/init.c +++ b/src/init.c @@ -857,6 +857,8 @@ static void InitGraphicInfo() image_files = getCurrentImageList(); + printf("--> %d\n", image_files[0].parameter[2]); + for(i=0; ifile_list; } -void InitImageList(struct ConfigInfo *config_list, char *config_suffix_list[], +void InitImageList(struct ConfigInfo *config_list, + struct ConfigInfo *config_suffix_list, int num_file_list_entries) { int i; @@ -711,7 +712,7 @@ void InitImageList(struct ConfigInfo *config_list, char *config_suffix_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++) + for (i=0; config_suffix_list[i].token != NULL; i++) image_info->num_suffix_list_entries++; image_info->file_list = diff --git a/src/libgame/image.h b/src/libgame/image.h index b968fee1..9d001aae 100644 --- a/src/libgame/image.h +++ b/src/libgame/image.h @@ -73,7 +73,7 @@ int Read_PCX_to_Pixmap(Display *, Window, GC, char *, Pixmap *, Pixmap *); struct FileInfo *getCurrentImageList(); -void InitImageList(struct ConfigInfo *, char **, int); +void InitImageList(struct ConfigInfo *, struct ConfigInfo *, int); void ReloadCustomImages(); void FreeAllImages(); diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 3c61d46d..498a96e8 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -403,6 +403,14 @@ char *getPath3(char *path1, char *path2, char *path3) return complete_path; } +static char *getStringCat2(char *s1, char *s2) +{ + char *complete_string = checked_malloc(strlen(s1) + strlen(s2) + 1); + + sprintf(complete_string, "%s%s", s1, s2); + return complete_string; +} + char *getStringCopy(char *s) { char *s_copy; @@ -1349,7 +1357,7 @@ boolean FileIsArtworkType(char *basename, int type) /* ========================================================================= */ struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list, - char *suffix_list[], + struct ConfigInfo *suffix_list, int num_file_list_entries) { struct FileInfo *file_list; @@ -1359,22 +1367,29 @@ struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list, file_list = checked_calloc(num_file_list_entries * sizeof(struct FileInfo)); - for (i=0; suffix_list[i] != NULL; i++) + for (i=0; suffix_list[i].token != NULL; i++) num_suffix_list_entries++; - if (num_suffix_list_entries > 0) + /* always start with reliable default values */ + for (i=0; i 0) { - 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)); + int parameter_array_size = num_suffix_list_entries * sizeof(int); + + file_list[i].default_parameter = checked_calloc(parameter_array_size); + file_list[i].parameter = checked_calloc(parameter_array_size); for (j=0; jfile_list; + struct ConfigInfo *suffix_list = artwork_info->suffix_list; 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, j; @@ -1433,12 +1449,12 @@ static void LoadArtworkConfig(struct ArtworkListInfo *artwork_info) /* always start with reliable default values */ for (i=0; ifile_list; } -void InitSoundList(struct ConfigInfo *config_list, char *config_suffix_list[], +void InitSoundList(struct ConfigInfo *config_list, + struct ConfigInfo *config_suffix_list, int num_file_list_entries) { int i; @@ -1737,7 +1738,7 @@ void InitSoundList(struct ConfigInfo *config_list, char *config_suffix_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++) + for (i=0; config_suffix_list[i].token != NULL; i++) sound_info->num_suffix_list_entries++; sound_info->file_list = diff --git a/src/libgame/sound.h b/src/libgame/sound.h index 4b28e3ff..310d7b85 100644 --- a/src/libgame/sound.h +++ b/src/libgame/sound.h @@ -140,7 +140,7 @@ void StopSound(int); void StopSounds(void); void StopSoundExt(int, int); struct FileInfo *getCurrentSoundList(); -void InitSoundList(struct ConfigInfo *, char **, int); +void InitSoundList(struct ConfigInfo *, struct ConfigInfo *, int); void InitReloadSounds(char *); void InitReloadMusic(char *); void FreeAllSounds(void); diff --git a/src/libgame/system.h b/src/libgame/system.h index 497a3958..9cebd02d 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -467,7 +467,7 @@ struct ArtworkListInfo int num_suffix_list_entries; struct FileInfo *file_list; /* static artwork file array */ - char **suffix_list; /* parameter suffixes array */ + struct ConfigInfo *suffix_list; /* parameter suffixes array */ struct ListNodeInfo **artwork_list; /* static artwork node array */ diff --git a/src/main.c b/src/main.c index 68466fe5..713b6a9b 100644 --- a/src/main.c +++ b/src/main.c @@ -136,17 +136,18 @@ char *sound_name[NUM_SOUNDS] = "gate.wav" }; -char *image_config_suffix[] = +struct ConfigInfo image_config_suffix[] = { - ".frame_xpos", - ".frame_ypos", - ".num_frames", - NULL + { ".frame_xpos", "0" }, + { ".frame_ypos", "0" }, + { ".num_frames", "1" }, + + { NULL, NULL } }; -char *sound_config_suffix[] = +struct ConfigInfo sound_config_suffix[] = { - NULL + { NULL, NULL } }; struct ConfigInfo image_config[] = @@ -159,7 +160,7 @@ struct ConfigInfo image_config[] = { "robot_wheel.frame_xpos", "0" }, { "robot_wheel.num_frames", "4" }, - { NULL, NULL }, + { NULL, NULL } }; struct ConfigInfo sound_config[] = @@ -378,7 +379,7 @@ struct ConfigInfo sound_config[] = { "[not used]", "boom.wav" }, #endif - { NULL, NULL }, + { NULL, NULL } }; struct FileInfo *image_files; diff --git a/src/main.h b/src/main.h index 976325da..aa5f6296 100644 --- a/src/main.h +++ b/src/main.h @@ -416,8 +416,8 @@ extern struct GlobalInfo global; extern struct ElementInfo element_info[]; extern struct GraphicInfo graphic_info[]; extern struct ConfigInfo image_config[], sound_config[]; +extern struct ConfigInfo image_config_suffix[], sound_config_suffix[]; extern struct FileInfo *image_files, *sound_files; -extern char *image_config_suffix[], *sound_config_suffix[]; /* often used screen positions */ #define SX 8