X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=2f5bd60df686df939d9cff8bf9a4ef1a9c89fe72;hb=891c39ca37c4fea5f6cc4ca40f913a56c68ef495;hp=301f0022ad53f499e762dc15bd04eec51a22984b;hpb=3607ef8e4000754063935d908053d564de92c0a2;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 301f0022..2f5bd60d 100644 --- a/src/init.c +++ b/src/init.c @@ -30,6 +30,8 @@ #include "conf_esg.c" /* include auto-generated data structure definitions */ #include "conf_e2s.c" /* include auto-generated data structure definitions */ #include "conf_fnt.c" /* include auto-generated data structure definitions */ +#include "conf_g2s.c" /* include auto-generated data structure definitions */ +#include "conf_g2m.c" /* include auto-generated data structure definitions */ #define CONFIG_TOKEN_FONT_INITIAL "font.initial" @@ -824,6 +826,10 @@ static void set_graphic_parameters(int graphic, char **parameter_raw) graphic_info[graphic].crumbled_like = -1; /* do not use clone element */ graphic_info[graphic].diggable_like = -1; /* do not use clone element */ graphic_info[graphic].border_size = TILEX / 8; /* "CRUMBLED" border size */ + graphic_info[graphic].anim_delay_fixed = 0; + graphic_info[graphic].anim_delay_random = 0; + graphic_info[graphic].post_delay_fixed = 0; + graphic_info[graphic].post_delay_random = 0; /* optional x and y tile position of animation frame sequence */ if (parameter[GFX_ARG_XPOS] != ARG_UNDEFINED_VALUE) @@ -919,6 +925,20 @@ static void set_graphic_parameters(int graphic, char **parameter_raw) if (parameter[GFX_ARG_BORDER_SIZE] != ARG_UNDEFINED_VALUE) graphic_info[graphic].border_size = parameter[GFX_ARG_BORDER_SIZE]; + /* this is only used for player "boring" and "sleeping" actions */ + if (parameter[GFX_ARG_ANIM_DELAY_FIXED] != ARG_UNDEFINED_VALUE) + graphic_info[graphic].anim_delay_fixed = + parameter[GFX_ARG_ANIM_DELAY_FIXED]; + if (parameter[GFX_ARG_ANIM_DELAY_RANDOM] != ARG_UNDEFINED_VALUE) + graphic_info[graphic].anim_delay_fixed = + parameter[GFX_ARG_ANIM_DELAY_RANDOM]; + if (parameter[GFX_ARG_POST_DELAY_FIXED] != ARG_UNDEFINED_VALUE) + graphic_info[graphic].anim_delay_fixed = + parameter[GFX_ARG_POST_DELAY_FIXED]; + if (parameter[GFX_ARG_POST_DELAY_RANDOM] != ARG_UNDEFINED_VALUE) + graphic_info[graphic].anim_delay_fixed = + parameter[GFX_ARG_POST_DELAY_RANDOM]; + /* this is only used for toon animations */ graphic_info[graphic].step_offset = parameter[GFX_ARG_STEP_OFFSET]; graphic_info[graphic].step_delay = parameter[GFX_ARG_STEP_DELAY]; @@ -1183,6 +1203,39 @@ static void InitElementSoundInfo() } } +static void InitGameModeSoundInfo() +{ + int i; + + /* set values to -1 to identify later as "uninitialized" values */ + for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++) + menu.sound[i] = -1; + + /* initialize gamemode/sound mapping from static configuration */ + for (i=0; gamemode_to_sound[i].sound > -1; i++) + { + int gamemode = gamemode_to_sound[i].gamemode; + int sound = gamemode_to_sound[i].sound; + + if (gamemode < 0) + gamemode = GAME_MODE_DEFAULT; + + menu.sound[gamemode] = sound; + } + + /* now set all '-1' values to levelset specific default values */ + for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++) + if (menu.sound[i] == -1) + menu.sound[i] = menu.sound[GAME_MODE_DEFAULT]; + +#if 0 + /* TEST ONLY */ + for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++) + if (menu.sound[i] != -1) + printf("::: menu.sound[%d] == %d\n", i, menu.sound[i]); +#endif +} + static void set_sound_parameters(int sound, char **parameter_raw) { int parameter[NUM_SND_ARGS]; @@ -1335,34 +1388,34 @@ static void InitSoundInfo() #endif } -static void InitLevelsetMusicInfo() +static void InitGameModeMusicInfo() { struct PropertyMapping *property_mapping = getMusicListPropertyMapping(); int num_property_mappings = getMusicListPropertyMappingSize(); - int i, j; + int default_levelset_music = -1; + int i; /* set values to -1 to identify later as "uninitialized" values */ + for (i=0; i < MAX_LEVELS; i++) + levelset.music[i] = -1; for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++) - for (j=0; j < MAX_LEVELS; j++) - levelset.music[i][j] = -1; + menu.music[i] = -1; -#if 0 /* initialize gamemode/music mapping from static configuration */ - for (i=0; gamemode_to_music[i].element > -1; i++) + for (i=0; gamemode_to_music[i].music > -1; i++) { int gamemode = gamemode_to_music[i].gamemode; - int level = gamemode_to_music[i].level; int music = gamemode_to_music[i].music; - if (gamemode < 0) - gamemode = 0; +#if 0 + printf("::: gamemode == %d, music == %d\n", gamemode, music); +#endif - if (level < 0) - level = 0; + if (gamemode < 0) + gamemode = GAME_MODE_DEFAULT; - levelset.music[gamemode][level] = music; + menu.music[gamemode] = music; } -#endif /* initialize gamemode/music mapping from dynamic configuration */ for (i=0; i < num_property_mappings; i++) @@ -1372,39 +1425,51 @@ static void InitLevelsetMusicInfo() int level = property_mapping[i].ext2_index; int music = property_mapping[i].artwork_index; +#if 0 + printf("::: prefix == %d, gamemode == %d, level == %d, music == %d\n", + prefix, gamemode, level, music); +#endif + if (prefix < 0 || prefix >= NUM_MUSIC_PREFIXES) continue; if (gamemode < 0) - gamemode = 0; + gamemode = GAME_MODE_DEFAULT; + + /* level specific music only allowed for in-game music */ + if (level != -1 && gamemode == GAME_MODE_DEFAULT) + gamemode = GAME_MODE_PLAYING; - if (level < 0) + if (level == -1) + { level = 0; + default_levelset_music = music; + } - levelset.music[gamemode][level] = music; + if (gamemode == GAME_MODE_PLAYING || gamemode == GAME_MODE_DEFAULT) + levelset.music[level] = music; + if (gamemode != GAME_MODE_PLAYING) + menu.music[gamemode] = music; } - /* now set all '-1' values to levelset specific default values */ + /* now set all '-1' values to menu specific default values */ + /* (undefined values of "levelset.music[]" might stay at "-1" to + allow dynamic selection of music files from music directory!) */ + for (i=0; i < MAX_LEVELS; i++) + if (levelset.music[i] == -1) + levelset.music[i] = default_levelset_music; for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++) - { - for (j=0; j < MAX_LEVELS; j++) - { - /* generic default music */ - int default_music = levelset.music[i][0]; /* may still be -1 */ - - /* no music for this specific game mode and level -- use default music */ - if (levelset.music[i][j] == -1) - levelset.music[i][j] = default_music; - } - } + if (menu.music[i] == -1) + menu.music[i] = menu.music[GAME_MODE_DEFAULT]; #if 0 /* TEST ONLY */ + for (i=0; i < MAX_LEVELS; i++) + if (levelset.music[i] != -1) + printf("::: levelset.music[%d] == %d\n", i, levelset.music[i]); for (i=0; i < NUM_SPECIAL_GFX_ARGS; i++) - for (j=0; j < MAX_LEVELS; j++) - if (levelset.music[i][j] != -1) - printf("::: levelset.music[%d][%d] == %d\n", - i, j, levelset.music[i][j]); + if (menu.music[i] != -1) + printf("::: menu.music[%d] == %d\n", i, menu.music[i]); #endif } @@ -1481,6 +1546,7 @@ static void ReinitializeSounds() { InitSoundInfo(); /* sound properties mapping */ InitElementSoundInfo(); /* element game sound mapping */ + InitGameModeSoundInfo(); /* game mode sound mapping */ InitPlayLevelSound(); /* internal game sound settings */ } @@ -1488,7 +1554,7 @@ static void ReinitializeSounds() static void ReinitializeMusic() { InitMusicInfo(); /* music properties mapping */ - InitLevelsetMusicInfo(); /* levelset music mapping */ + InitGameModeMusicInfo(); /* game mode music mapping */ } void InitElementPropertiesStatic() @@ -3131,7 +3197,7 @@ void Execute_Command(char *command) int i; printf("# You can configure additional/alternative image files here.\n"); - printf("# (The images below are default and therefore commented out.)\n"); + printf("# (The entries below are default and therefore commented out.)\n"); printf("\n"); printf("%s\n", getFormattedSetupEntry("name", "Classic Graphics")); printf("\n"); @@ -3150,7 +3216,7 @@ void Execute_Command(char *command) int i; printf("# You can configure additional/alternative sound files here.\n"); - printf("# (The sounds below are default and therefore commented out.)\n"); + printf("# (The entries below are default and therefore commented out.)\n"); printf("\n"); printf("%s\n", getFormattedSetupEntry("name", "Classic Sounds")); printf("\n"); @@ -3166,11 +3232,30 @@ void Execute_Command(char *command) } else if (strcmp(command, "print musicinfo.conf") == 0) { - printf("# (Currently only \"name\" and \"sort_priority\" recognized.)\n"); + int i; + + printf("# You can configure additional/alternative music files here.\n"); + printf("# (The entries below are default and therefore commented out.)\n"); printf("\n"); printf("%s\n", getFormattedSetupEntry("name", "Classic Music")); printf("\n"); printf("%s\n", getFormattedSetupEntry("sort_priority", "100")); + printf("\n"); + + for (i=0; music_config[i].token != NULL; i++) + printf("# %s\n", + getFormattedSetupEntry(music_config[i].token, + music_config[i].value)); + + exit(0); + } + else if (strcmp(command, "print editorsetup.conf") == 0) + { + printf("# You can configure your personal editor element list here.\n"); + printf("# (The entries below are default and therefore commented out.)\n"); + printf("\n"); + + PrintEditorElementList(); exit(0); }