EL_AMOEBA_GROWING, -1, -1, FALSE,
IMG_AMOEBA_GROWING
},
+ {
+ EL_AMOEBA, ACTION_GROWING, -1, FALSE,
+ IMG_AMOEBA_GROWING
+ },
{
EL_AMOEBA_SHRINKING, -1, -1, FALSE,
IMG_AMOEBA_SHRINKING
},
+ {
+ EL_AMOEBA, ACTION_SHRINKING, -1, FALSE,
+ IMG_AMOEBA_SHRINKING
+ },
{
EL_AMOEBA_WET, -1, -1, FALSE,
IMG_AMOEBA_WET
EL_AMOEBA_DROPPING, -1, -1, FALSE,
IMG_AMOEBA_DROPPING
},
+ {
+ EL_AMOEBA, ACTION_DROPPING, -1, FALSE,
+ IMG_AMOEBA_DROPPING
+ },
{
EL_AMOEBA_DRY, -1, -1, FALSE,
IMG_AMOEBA_DRY
-#define COMPILE_DATE_STRING "[2003-11-21 02:35]"
+#define COMPILE_DATE_STRING "[2003-11-22 03:36]"
}
token_to_value_ptr[] =
{
- { "title", &tmp_music_file_info.title },
- { "artist", &tmp_music_file_info.artist },
- { "album", &tmp_music_file_info.album },
- { "year", &tmp_music_file_info.year },
- { NULL, NULL },
+ { "context", &tmp_music_file_info.context },
+ { "title", &tmp_music_file_info.title },
+ { "artist", &tmp_music_file_info.artist },
+ { "album", &tmp_music_file_info.album },
+ { "year", &tmp_music_file_info.year },
+ { NULL, NULL },
};
int i;
{
char *value = getHashEntry(setup_file_hash, token_to_value_ptr[i].token);
- if (value != NULL)
- *token_to_value_ptr[i].value_ptr = getStringCopy(value);
+ *token_to_value_ptr[i].value_ptr = getStringCopy(value); /* may be NULL */
}
new_music_file_info = checked_calloc(sizeof(struct MusicFileInfo));
printf("::: title == '%s'\n", next->title);
#endif
}
+
+void add_info_animation(int element, int action, int direction, int delay,
+ int *num_list_entries)
+{
+ struct InfoAnimationInfo *new_list_entry;
+ (*num_list_entries)++;
+
+ info_animation_info =
+ checked_realloc(info_animation_info,
+ *num_list_entries * sizeof(struct InfoAnimationInfo));
+ new_list_entry = &info_animation_info[*num_list_entries - 1];
+
+ new_list_entry->element = element;
+ new_list_entry->action = action;
+ new_list_entry->direction = direction;
+ new_list_entry->delay = delay;
+}
+
+void print_unknown_token(char *filename, char *token, int token_nr)
+{
+ if (token_nr == 0)
+ {
+ Error(ERR_RETURN_LINE, "-");
+ Error(ERR_RETURN, "warning: unknown token(s) found in config file:");
+ Error(ERR_RETURN, "- config file: '%s'", filename);
+ }
+
+ Error(ERR_RETURN, "- token: '%s'", token);
+}
+
+void print_unknown_token_end(int token_nr)
+{
+ if (token_nr > 0)
+ Error(ERR_RETURN_LINE, "-");
+}
+
+void LoadInfoAnimations()
+{
+ char *filename = getElementInfoFilename();
+ SetupFileList *setup_file_list, *list;
+ SetupFileHash *element_hash, *action_hash, *direction_hash;
+ int num_list_entries = 0;
+ int num_unknown_tokens = 0;
+ int i;
+
+ if ((setup_file_list = loadSetupFileList(filename)) == NULL)
+ return;
+
+ element_hash = newSetupFileHash();
+ action_hash = newSetupFileHash();
+ direction_hash = newSetupFileHash();
+
+ for (i=0; i < MAX_NUM_ELEMENTS; i++)
+ setHashEntry(element_hash, element_info[i].token_name, itoa(i));
+
+ for (i=0; i < NUM_ACTIONS; i++)
+ setHashEntry(action_hash, element_action_info[i].suffix,
+ itoa(element_action_info[i].value));
+
+ for (i=0; i < NUM_DIRECTIONS; i++)
+ setHashEntry(direction_hash, element_direction_info[i].suffix,
+ itoa(element_direction_info[i].value));
+
+ for (list = setup_file_list; list != NULL; list = list->next)
+ {
+ char *element_token, *action_token, *direction_token;
+ char *element_value, *action_value, *direction_value;
+ int delay = atoi(list->value);
+
+ if (strcmp(list->token, "end") == 0)
+ {
+ add_info_animation(-1, -1, -1, -1, &num_list_entries);
+
+ continue;
+ }
+
+ element_token = list->token;
+ element_value = getHashEntry(element_hash, element_token);
+
+ if (element_value != NULL)
+ {
+ /* element found */
+ add_info_animation(atoi(element_value), -1, -1,
+ delay, &num_list_entries);
+
+ continue;
+ }
+
+ if (strchr(element_token, '.') == NULL)
+ {
+ /* no further suffixes found -- this is not an element */
+ print_unknown_token(filename, list->token, num_unknown_tokens++);
+
+ continue;
+ }
+
+ action_token = strchr(element_token, '.');
+ element_token = getStringCopy(element_token);
+ *strchr(element_token, '.') = '\0';
+
+ element_value = getHashEntry(element_hash, element_token);
+
+ if (element_value == NULL)
+ {
+ /* this is not an element */
+ print_unknown_token(filename, list->token, num_unknown_tokens++);
+ free(element_token);
+
+ continue;
+ }
+
+ action_value = getHashEntry(action_hash, action_token);
+
+ if (action_value != NULL)
+ {
+ /* action found */
+ add_info_animation(atoi(element_value), atoi(action_value), -1,
+ delay, &num_list_entries);
+ free(element_token);
+
+ continue;
+ }
+
+ direction_token = action_token;
+ direction_value = getHashEntry(direction_hash, direction_token);
+
+ if (direction_value != NULL)
+ {
+ /* direction found */
+ add_info_animation(atoi(element_value), -1, atoi(direction_value),
+ delay, &num_list_entries);
+ free(element_token);
+
+ continue;
+ }
+
+ if (strchr(action_token + 1, '.') == NULL)
+ {
+ /* no further suffixes found -- this is not an action or direction */
+ print_unknown_token(filename, list->token, num_unknown_tokens++);
+ free(element_token);
+
+ continue;
+ }
+
+ direction_token = strchr(action_token + 1, '.');
+ action_token = getStringCopy(action_token);
+ *strchr(action_token + 1, '.') = '\0';
+
+ action_value = getHashEntry(action_hash, action_token);
+
+ if (action_value == NULL)
+ {
+ /* this is not an action */
+ print_unknown_token(filename, list->token, num_unknown_tokens++);
+ free(element_token);
+ free(action_token);
+
+ continue;
+ }
+
+ direction_value = getHashEntry(direction_hash, direction_token);
+
+ if (direction_value != NULL)
+ {
+ /* direction found */
+ add_info_animation(atoi(element_value), atoi(action_value),
+ atoi(direction_value),
+ delay, &num_list_entries);
+ free(element_token);
+ free(action_token);
+
+ continue;
+ }
+
+ print_unknown_token(filename, list->token, num_unknown_tokens++);
+
+ free(element_token);
+ free(action_token);
+ }
+
+ print_unknown_token_end(num_unknown_tokens);
+
+ add_info_animation(-999, -999, -999, -999, &num_list_entries);
+
+ freeSetupFileList(setup_file_list);
+ freeSetupFileHash(element_hash);
+ freeSetupFileHash(action_hash);
+ freeSetupFileHash(direction_hash);
+
+#if 0
+ /* TEST ONLY */
+ for (i=0; i < num_list_entries; i++)
+ printf("::: %d, %d, %d => %d\n",
+ info_animation_info[i].element,
+ info_animation_info[i].action,
+ info_animation_info[i].direction,
+ info_animation_info[i].delay);
+#endif
+}
void LoadSpecialMenuDesignSettings();
void LoadUserDefinedEditorElementList(int **, int *);
void LoadMusicInfo();
+void LoadInfoAnimations();
#endif /* FILES_H */
return filename;
}
+char *getElementInfoFilename()
+{
+ static char *filename = NULL;
+
+ if (filename != NULL)
+ free(filename);
+
+ filename = getPath2(getCurrentLevelDir(), ELEMENTINFO_FILENAME);
+
+ return filename;
+}
+
static char *getCorrectedArtworkBasename(char *basename)
{
char *basename_corrected = basename;
char *getScoreFilename(int);
char *getSetupFilename(void);
char *getEditorSetupFilename(void);
+char *getElementInfoFilename(void);
char *getImageFilename(char *);
char *getCustomImageFilename(char *);
char *getCustomSoundFilename(char *);
if (music_already_used)
continue;
-#if 1
+#if 0
if (FileIsSound(basename) || FileIsMusic(basename))
printf("DEBUG: loading music '%s' ...\n", basename);
#endif
#define SETUP_FILENAME "setup.conf"
#define LEVELSETUP_FILENAME "levelsetup.conf"
#define EDITORSETUP_FILENAME "editorsetup.conf"
+#define ELEMENTINFO_FILENAME "elementinfo.conf"
#define LEVELINFO_FILENAME "levelinfo.conf"
#define GRAPHICSINFO_FILENAME "graphicsinfo.conf"
#define SOUNDSINFO_FILENAME "soundsinfo.conf"
#define SETUP_FILENAME "setup.cnf"
#define LEVELSETUP_FILENAME "lvlsetup.cnf"
#define EDITORSETUP_FILENAME "edsetup.conf"
+#define ELEMENTINFO_FILENAME "eleminfo.conf"
#define LEVELINFO_FILENAME "lvlinfo.cnf"
#define GRAPHICSINFO_FILENAME "gfxinfo.cnf"
#define SOUNDSINFO_FILENAME "sndinfo.cnf"
struct SoundInfo *sound_info = NULL;
struct MusicInfo *music_info = NULL;
struct MusicFileInfo *music_file_info = NULL;
+struct InfoAnimationInfo *info_animation_info = NULL;
/* ------------------------------------------------------------------------- */
"-"
},
{
- "nut_breaking",
+ "nut.breaking",
"-",
"-"
},
{
- "diamond_breaking",
+ "diamond.breaking",
"-",
"-"
},
"-"
},
{
- "amoeba_growing",
+ "amoeba.growing",
"-",
"-"
},
{
- "amoeba_shrinking",
+ "amoeba.shrinking",
"-",
"-"
},
"-",
"-"
},
+ {
+ "amoeba",
+ "amoeba",
+ "-"
+ },
{
"[default]",
"default",
#define EL_DYNABOMB_PLAYER_4 (EL_FIRST_DUMMY + 17)
#define EL_SHIELD_NORMAL_ACTIVE (EL_FIRST_DUMMY + 18)
#define EL_SHIELD_DEADLY_ACTIVE (EL_FIRST_DUMMY + 19)
-#define EL_DEFAULT (EL_FIRST_DUMMY + 20)
-#define EL_BD_DEFAULT (EL_FIRST_DUMMY + 21)
-#define EL_SP_DEFAULT (EL_FIRST_DUMMY + 22)
-#define EL_SB_DEFAULT (EL_FIRST_DUMMY + 23)
+#define EL_AMOEBA (EL_FIRST_DUMMY + 20)
+#define EL_DEFAULT (EL_FIRST_DUMMY + 21)
+#define EL_BD_DEFAULT (EL_FIRST_DUMMY + 22)
+#define EL_SP_DEFAULT (EL_FIRST_DUMMY + 23)
+#define EL_SB_DEFAULT (EL_FIRST_DUMMY + 24)
-#define MAX_NUM_ELEMENTS (EL_FIRST_DUMMY + 24)
+#define MAX_NUM_ELEMENTS (EL_FIRST_DUMMY + 25)
/* values for graphics/sounds action types */
int value;
};
+struct InfoAnimationInfo
+{
+ int element;
+ int action;
+ int direction;
+
+ int delay;
+};
+
#if 0
extern GC tile_clip_gc;
extern struct SoundInfo *sound_info;
extern struct MusicInfo *music_info;
extern struct MusicFileInfo *music_file_info;
+extern struct InfoAnimationInfo *info_animation_info;
extern struct ConfigInfo image_config[];
extern struct ConfigInfo sound_config[];
extern struct ConfigInfo music_config[];
static int helpscreen_step[MAX_HELPSCREEN_ELS];
static int helpscreen_frame[MAX_HELPSCREEN_ELS];
+#if 0
static int helpscreen_action[] =
{
IMG_PLAYER_1_MOVING_DOWN, 16,
HA_END
};
+#endif
+
static char *helpscreen_eltext[][2] =
{
{"THE HERO:", "(Is _this_ guy good old Rockford?)"},
};
static int num_helpscreen_els = sizeof(helpscreen_eltext) / (2*sizeof(char *));
+#if 0
static char *helpscreen_music[][3] =
{
{ "Alchemy", "Ian Boddy", "Drive" },
{ "Voyager", "The Alan Parsons Project","Pyramid" },
{ "Twilight Painter", "Tangerine Dream", "Heartbreakers" }
};
+#endif
+
static int num_helpscreen_music = 7;
static int helpscreen_musicpos;
-#if 0
-void OLD_DrawHelpScreenElAction(int start)
+#if 1
+void DrawHelpScreenElAction(int start)
{
int i = 0, j = 0;
- int frame, graphic;
- int xstart = SX+16, ystart = SY+64+2*32, ystep = TILEY+4;
+ int xstart = mSX + 16;
+ int ystart = mSY + 64 + 2 * 32;
+ int ystep = TILEY + 4;
+ int element, action, direction;
+ int graphic;
+ int delay;
+ int sync_frame;
- while(helpscreen_action[j] != HA_END)
+ while (info_animation_info[j].element != -999)
{
- if (i>=start+MAX_HELPSCREEN_ELS || i>=num_helpscreen_els)
+ if (i >= start + MAX_HELPSCREEN_ELS || i >= num_helpscreen_els)
break;
- else if (i<start || helpscreen_delay[i-start])
+ else if (i < start)
{
- if (i>=start && helpscreen_delay[i-start])
- helpscreen_delay[i-start]--;
-
- while(helpscreen_action[j] != HA_NEXT)
+ while (info_animation_info[j].element != -1)
j++;
+
j++;
i++;
+
continue;
}
- j += 3*helpscreen_step[i-start];
- graphic = helpscreen_action[j++];
+ j += helpscreen_step[i - start];
+
+ element = info_animation_info[j].element;
+ action = info_animation_info[j].action;
+ direction = info_animation_info[j].direction;
+
+ if (action != -1 && direction != -1)
+ graphic = el_act_dir2img(element, action, direction);
+ else if (action != -1)
+ graphic = el_act2img(element, action);
+ else if (direction != -1)
+ graphic = el_act2img(element, direction);
+ else
+ graphic = el2img(element);
+
+ delay = info_animation_info[j++].delay;
+
+ if (delay == -1)
+ delay = 1000000;
- if (helpscreen_frame[i-start])
+ if (helpscreen_frame[i - start] == 0)
{
- frame = helpscreen_action[j++] - helpscreen_frame[i-start];
- helpscreen_frame[i-start]--;
+ sync_frame = 0;
+ helpscreen_frame[i - start] = delay - 1;
}
else
{
- frame = 0;
- helpscreen_frame[i-start] = helpscreen_action[j++]-1;
+ sync_frame = delay - helpscreen_frame[i - start];
+ helpscreen_frame[i - start]--;
}
- helpscreen_delay[i-start] = helpscreen_action[j++] - 1;
-
- if (helpscreen_action[j] == HA_NEXT)
+ if (info_animation_info[j].element == -1)
{
- if (!helpscreen_frame[i-start])
- helpscreen_step[i-start] = 0;
+ if (!helpscreen_frame[i - start])
+ helpscreen_step[i - start] = 0;
}
else
{
- if (!helpscreen_frame[i-start])
- helpscreen_step[i-start]++;
- while(helpscreen_action[j] != HA_NEXT)
+ if (!helpscreen_frame[i - start])
+ helpscreen_step[i - start]++;
+ while(info_animation_info[j].element != -1)
j++;
}
+
j++;
- DrawOldGraphicExt(drawto, xstart, ystart+(i-start)*ystep, graphic+frame);
+ ClearRectangleOnBackground(drawto, xstart, ystart + (i - start) * ystep,
+ TILEX, TILEY);
+ DrawGraphicAnimationExt(drawto, xstart, ystart + (i - start) * ystep,
+ graphic, sync_frame, USE_MASKING);
+
i++;
}
- for(i=2;i<16;i++)
- {
- MarkTileDirty(0,i);
- MarkTileDirty(1,i);
- }
+ redraw_mask |= REDRAW_FIELD;
+
+ FrameCounter++;
}
-#endif
+
+#else
void DrawHelpScreenElAction(int start)
{
FrameCounter++;
}
+#endif
void DrawHelpScreenElText(int start)
{
helpscreen_musicpos = 0;
helpscreen_state = 0;
+ LoadInfoAnimations();
LoadMusicInfo();
+ num_helpscreen_els = 0;
+ for (i=0; info_animation_info[i].element != -999; i++)
+ if (info_animation_info[i].element == -1)
+ num_helpscreen_els++;
+
num_helpscreen_music = 0;
for (list = music_file_info; list != NULL; list = list->next)
num_helpscreen_music++;