From: Holger Schemel Date: Fri, 2 Mar 2007 00:33:35 +0000 (+0100) Subject: rnd-20070302-1-src X-Git-Tag: 3.2.4^2~81 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=db0cf963a41d958dc11ee1d3cfb2b1f88cba7f76 rnd-20070302-1-src * added new (special) "include: " directive that works in all configuration files (like "graphicsinfo.conf") and that has the same effect as if that directive would be replaced with the content of the specified file (this can be useful to split large configuration files into several smaller ones and include them from one main file, or to store configuration settings that always stay the same into a separate file, while including it and only add those parts that really change) --- diff --git a/ChangeLog b/ChangeLog index 0813cd6a..51a8c9ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-03-01 + * added new (special) "include: " directive that works in all + configuration files (like "graphicsinfo.conf") and that has the same + effect as if that directive would be replaced with the content of the + specified file (this can be useful to split large configuration files + into several smaller ones and include them from one main file, or to + store configuration settings that always stay the same into a separate + file, while including it and only add those parts that really change) + 2007-02-24 * fixed minor bug (screen redraw of player tiles) in EMC graphics engine diff --git a/src/conftime.h b/src/conftime.h index 59a6e932..f1b3d9f6 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-02-26 02:31" +#define COMPILE_DATE_STRING "2007-03-02 00:13" diff --git a/src/engines.h b/src/engines.h index 02061f79..9354c652 100644 --- a/src/engines.h +++ b/src/engines.h @@ -33,7 +33,7 @@ extern int getGameFrameDelay_EM(int); extern void PlayLevelSound_EM(int, int, int, int); extern void InitGraphicInfo_EM(void); -void getGraphicSourceObjectExt_EM(int, int, Bitmap **, int *, int *); +void getGraphicSourceObjectExt_EM(int, int, Bitmap **, int *, int *, int, int); void getGraphicSourcePlayerExt_EM(int, int, int, Bitmap **, int *, int *); #endif /* ENGINES_H */ diff --git a/src/files.c b/src/files.c index 7c35c235..60782f76 100644 --- a/src/files.c +++ b/src/files.c @@ -8453,19 +8453,19 @@ void LoadUserDefinedEditorElementList(int **elements, int *num_elements) { if (num_unknown_tokens == 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_INFO_LINE, "-"); + Error(ERR_INFO, "warning: unknown token(s) found in config file:"); + Error(ERR_INFO, "- config file: '%s'", filename); num_unknown_tokens++; } - Error(ERR_RETURN, "- token: '%s'", list->token); + Error(ERR_INFO, "- token: '%s'", list->token); } } if (num_unknown_tokens > 0) - Error(ERR_RETURN_LINE, "-"); + Error(ERR_INFO_LINE, "-"); while (*num_elements % 4) /* pad with empty elements, if needed */ (*elements)[(*num_elements)++] = EL_EMPTY; @@ -8766,18 +8766,18 @@ 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_INFO_LINE, "-"); + Error(ERR_INFO, "warning: unknown token(s) found in config file:"); + Error(ERR_INFO, "- config file: '%s'", filename); } - Error(ERR_RETURN, "- token: '%s'", token); + Error(ERR_INFO, "- token: '%s'", token); } void print_unknown_token_end(int token_nr) { if (token_nr > 0) - Error(ERR_RETURN_LINE, "-"); + Error(ERR_INFO_LINE, "-"); } void LoadHelpAnimInfo() diff --git a/src/game.c b/src/game.c index 237395e7..afa0f24f 100644 --- a/src/game.c +++ b/src/game.c @@ -13536,9 +13536,9 @@ static void LoadEngineSnapshotValues_RND() if (game.num_random_calls != num_random_calls) { - Error(ERR_RETURN, "number of random calls out of sync"); - Error(ERR_RETURN, "number of random calls should be %d", num_random_calls); - Error(ERR_RETURN, "number of random calls is %d", game.num_random_calls); + Error(ERR_INFO, "number of random calls out of sync"); + Error(ERR_INFO, "number of random calls should be %d", num_random_calls); + Error(ERR_INFO, "number of random calls is %d", game.num_random_calls); Error(ERR_EXIT, "this should not happen -- please debug"); } } diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 2d8188f1..fed6bcdf 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -150,7 +150,8 @@ static void DrawLevelField_EM(int x, int y, int sx, int sy, struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame]; #if 1 - getGraphicSourceObjectExt_EM(tile, frame, &g->bitmap, &g->src_x, &g->src_y); + getGraphicSourceObjectExt_EM(tile, frame, &g->bitmap, &g->src_x, &g->src_y, + x - 2, y - 2); #endif int src_x = g->src_x + g->src_offset_x; diff --git a/src/init.c b/src/init.c index 0521c3b7..4e715dff 100644 --- a/src/init.c +++ b/src/init.c @@ -815,7 +815,7 @@ void InitElementGraphicInfo() for (i = 0; i < MAX_NUM_ELEMENTS; i++) if (element_info[i].graphic[ACTION_DEFAULT] == IMG_UNKNOWN && i != EL_UNKNOWN) - Error(ERR_RETURN, "warning: no graphic for element '%s' (%d)", + Error(ERR_INFO, "warning: no graphic for element '%s' (%d)", element_info[i].token_name, i); } #endif @@ -1192,18 +1192,18 @@ static void set_cloned_graphic_parameters(int graphic) if (num_references_followed >= max_num_images) { - Error(ERR_RETURN_LINE, "-"); - Error(ERR_RETURN, "warning: error found in config file:"); - Error(ERR_RETURN, "- config file: '%s'", getImageConfigFilename()); - Error(ERR_RETURN, "- config token: '%s'", getTokenFromImageID(graphic)); - Error(ERR_RETURN, "error: loop discovered when resolving cloned graphics"); - Error(ERR_RETURN, "custom graphic rejected for this element/action"); + Error(ERR_INFO_LINE, "-"); + Error(ERR_INFO, "warning: error found in config file:"); + Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename()); + Error(ERR_INFO, "- config token: '%s'", getTokenFromImageID(graphic)); + Error(ERR_INFO, "error: loop discovered when resolving cloned graphics"); + Error(ERR_INFO, "custom graphic rejected for this element/action"); if (graphic == fallback_graphic) Error(ERR_EXIT, "fatal error: no fallback graphic available"); - Error(ERR_RETURN, "fallback done to 'char_exclam' for this graphic"); - Error(ERR_RETURN_LINE, "-"); + Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic"); + Error(ERR_INFO_LINE, "-"); graphic_info[graphic] = graphic_info[fallback_graphic]; } @@ -1344,21 +1344,21 @@ static void InitGraphicInfo() src_x + width > src_bitmap_width || src_y + height > src_bitmap_height) { - Error(ERR_RETURN_LINE, "-"); - Error(ERR_RETURN, "warning: error found in config file:"); - Error(ERR_RETURN, "- config file: '%s'", getImageConfigFilename()); - Error(ERR_RETURN, "- config token: '%s'", getTokenFromImageID(i)); - Error(ERR_RETURN, "- image file: '%s'", src_bitmap->source_filename); - Error(ERR_RETURN, + Error(ERR_INFO_LINE, "-"); + Error(ERR_INFO, "warning: error found in config file:"); + Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename()); + Error(ERR_INFO, "- config token: '%s'", getTokenFromImageID(i)); + Error(ERR_INFO, "- image file: '%s'", src_bitmap->source_filename); + Error(ERR_INFO, "error: first animation frame out of bounds (%d, %d) [%d, %d]", src_x, src_y, src_bitmap_width, src_bitmap_height); - Error(ERR_RETURN, "custom graphic rejected for this element/action"); + Error(ERR_INFO, "custom graphic rejected for this element/action"); if (i == fallback_graphic) Error(ERR_EXIT, "fatal error: no fallback graphic available"); - Error(ERR_RETURN, "fallback done to 'char_exclam' for this graphic"); - Error(ERR_RETURN_LINE, "-"); + Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic"); + Error(ERR_INFO_LINE, "-"); graphic_info[i] = graphic_info[fallback_graphic]; } @@ -1372,21 +1372,21 @@ static void InitGraphicInfo() src_x + width > src_bitmap_width || src_y + height > src_bitmap_height) { - Error(ERR_RETURN_LINE, "-"); - Error(ERR_RETURN, "warning: error found in config file:"); - Error(ERR_RETURN, "- config file: '%s'", getImageConfigFilename()); - Error(ERR_RETURN, "- config token: '%s'", getTokenFromImageID(i)); - Error(ERR_RETURN, "- image file: '%s'", src_bitmap->source_filename); - Error(ERR_RETURN, + Error(ERR_INFO_LINE, "-"); + Error(ERR_INFO, "warning: error found in config file:"); + Error(ERR_INFO, "- config file: '%s'", getImageConfigFilename()); + Error(ERR_INFO, "- config token: '%s'", getTokenFromImageID(i)); + Error(ERR_INFO, "- image file: '%s'", src_bitmap->source_filename); + Error(ERR_INFO, "error: last animation frame (%d) out of bounds (%d, %d) [%d, %d]", last_frame, src_x, src_y, src_bitmap_width, src_bitmap_height); - Error(ERR_RETURN, "custom graphic rejected for this element/action"); + Error(ERR_INFO, "custom graphic rejected for this element/action"); if (i == fallback_graphic) Error(ERR_EXIT, "fatal error: no fallback graphic available"); - Error(ERR_RETURN, "fallback done to 'char_exclam' for this graphic"); - Error(ERR_RETURN_LINE, "-"); + Error(ERR_INFO, "fallback done to 'char_exclam' for this graphic"); + Error(ERR_INFO_LINE, "-"); graphic_info[i] = graphic_info[fallback_graphic]; } diff --git a/src/libgame/image.c b/src/libgame/image.c index 6cfa44f4..85a73a54 100644 --- a/src/libgame/image.c +++ b/src/libgame/image.c @@ -385,7 +385,7 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual, if (!private_cmap) { if (options.verbose) - Error(ERR_RETURN, "switching to private colormap"); + Error(ERR_INFO, "switching to private colormap"); /* we just filled up the default colormap -- get a private one which contains all already allocated colors */ @@ -486,7 +486,7 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual, break; default: - Error(ERR_RETURN,"DirectColor, TrueColor or PseudoColor display needed"); + Error(ERR_INFO,"DirectColor, TrueColor or PseudoColor display needed"); SetError(error, "display class not supported"); return NULL; @@ -560,7 +560,7 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual, } default: - Error(ERR_RETURN, "RGB or TrueColor image needed"); + Error(ERR_INFO, "RGB or TrueColor image needed"); SetError(error, "image type not supported"); return NULL; @@ -594,7 +594,7 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual, } default: - Error(ERR_RETURN,"DirectColor, TrueColor or PseudoColor display needed"); + Error(ERR_INFO,"DirectColor, TrueColor or PseudoColor display needed"); SetError(error, "display class not supported"); return NULL; diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 88d2e299..41b68190 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -808,7 +808,7 @@ void Error(int mode, char *format, ...) if (mode & ERR_WARN && !options.verbose) return; - if (mode == ERR_RETURN_LINE) + if (mode == ERR_INFO_LINE) { if (!last_line_was_separator) fprintf_line(program.error_file, format, 79); @@ -1966,7 +1966,7 @@ struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list, !strEqual(&config_list[i].value[len_config_value - 4], ".wav") && !strEqual(config_list[i].value, UNDEFINED_FILENAME)) { - Error(ERR_RETURN, "Configuration directive '%s' -> '%s':", + Error(ERR_INFO, "Configuration directive '%s' -> '%s':", config_list[i].token, config_list[i].value); Error(ERR_EXIT, "This seems to be no valid definition -- please fix"); } @@ -1983,11 +1983,11 @@ struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list, num_file_list_entries_found = list_pos + 1; if (num_file_list_entries_found != num_file_list_entries) { - Error(ERR_RETURN_LINE, "-"); - Error(ERR_RETURN, "inconsistant config list information:"); - Error(ERR_RETURN, "- should be: %d (according to 'src/conf_xxx.h')", + Error(ERR_INFO_LINE, "-"); + Error(ERR_INFO, "inconsistant config list information:"); + Error(ERR_INFO, "- should be: %d (according to 'src/conf_xxx.h')", num_file_list_entries); - Error(ERR_RETURN, "- found to be: %d (according to 'src/conf_xxx.c')", + Error(ERR_INFO, "- found to be: %d (according to 'src/conf_xxx.c')", num_file_list_entries_found); Error(ERR_EXIT, "please fix"); } @@ -2431,53 +2431,53 @@ static void LoadArtworkConfigFromFilename(struct ArtworkListInfo *artwork_info, if (options.debug && dynamic_tokens_found) { - Error(ERR_RETURN_LINE, "-"); - Error(ERR_RETURN, "dynamic token(s) found in config file:"); - Error(ERR_RETURN, "- config file: '%s'", filename); + Error(ERR_INFO_LINE, "-"); + Error(ERR_INFO, "dynamic token(s) found in config file:"); + Error(ERR_INFO, "- config file: '%s'", filename); for (list = setup_file_list; list != NULL; list = list->next) { char *value = getHashEntry(extra_file_hash, list->token); if (value != NULL && strEqual(value, known_token_value)) - Error(ERR_RETURN, "- dynamic token: '%s'", list->token); + Error(ERR_INFO, "- dynamic token: '%s'", list->token); } - Error(ERR_RETURN_LINE, "-"); + Error(ERR_INFO_LINE, "-"); } if (unknown_tokens_found) { - Error(ERR_RETURN_LINE, "-"); - Error(ERR_RETURN, "warning: unknown token(s) found in config file:"); - Error(ERR_RETURN, "- config file: '%s'", filename); + Error(ERR_INFO_LINE, "-"); + Error(ERR_INFO, "warning: unknown token(s) found in config file:"); + Error(ERR_INFO, "- config file: '%s'", filename); for (list = setup_file_list; list != NULL; list = list->next) { char *value = getHashEntry(extra_file_hash, list->token); if (value != NULL && !strEqual(value, known_token_value)) - Error(ERR_RETURN, "- dynamic token: '%s'", list->token); + Error(ERR_INFO, "- dynamic token: '%s'", list->token); } - Error(ERR_RETURN_LINE, "-"); + Error(ERR_INFO_LINE, "-"); } if (undefined_values_found) { - Error(ERR_RETURN_LINE, "-"); - Error(ERR_RETURN, "warning: undefined values found in config file:"); - Error(ERR_RETURN, "- config file: '%s'", filename); + Error(ERR_INFO_LINE, "-"); + Error(ERR_INFO, "warning: undefined values found in config file:"); + Error(ERR_INFO, "- config file: '%s'", filename); for (list = setup_file_list; list != NULL; list = list->next) { char *value = getHashEntry(empty_file_hash, list->token); if (value != NULL) - Error(ERR_RETURN, "- undefined value for token: '%s'", list->token); + Error(ERR_INFO, "- undefined value for token: '%s'", list->token); } - Error(ERR_RETURN_LINE, "-"); + Error(ERR_INFO_LINE, "-"); } freeSetupFileList(setup_file_list); diff --git a/src/libgame/misc.h b/src/libgame/misc.h index 9a5e9186..ab47b2b3 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -36,8 +36,8 @@ #define GetSimpleRandom(max) get_random_number(RANDOM_SIMPLE, max) /* values for Error() */ -#define ERR_RETURN 0 -#define ERR_RETURN_LINE (1 << 0) +#define ERR_INFO 0 +#define ERR_INFO_LINE (1 << 0) #define ERR_WARN (1 << 1) #define ERR_EXIT (1 << 2) #define ERR_HELP (1 << 3) diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 75db82ef..922f8314 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -1610,11 +1610,13 @@ static void printSetupFileHash(SetupFileHash *hash) #define ALLOW_TOKEN_VALUE_SEPARATOR_BEING_WHITESPACE 1 #define CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING 0 -static void *loadSetupFileData(char *filename, boolean use_hash) +static void loadSetupFileData(void *setup_file_data, char *filename, + boolean top_recursion_level, boolean is_hash) { + static SetupFileHash *include_filename_hash = NULL; char line[MAX_LINE_LEN], line_raw[MAX_LINE_LEN], previous_line[MAX_LINE_LEN]; char *token, *value, *line_ptr; - void *setup_file_data, *insert_ptr = NULL; + void *insert_ptr = NULL; boolean read_continued_line = FALSE; boolean token_value_separator_found; #if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING @@ -1622,18 +1624,25 @@ static void *loadSetupFileData(char *filename, boolean use_hash) #endif FILE *file; int line_nr = 0; + int token_count = 0; if (!(file = fopen(filename, MODE_READ))) { Error(ERR_WARN, "cannot open configuration file '%s'", filename); - return NULL; + return; } - if (use_hash) - setup_file_data = newSetupFileHash(); - else - insert_ptr = setup_file_data = newSetupFileList("", ""); + /* use "insert pointer" to store list end for constant insertion complexity */ + if (!is_hash) + insert_ptr = setup_file_data; + + /* on top invocation, create hash to mark included files (to prevent loops) */ + if (top_recursion_level) + include_filename_hash = newSetupFileHash(); + + /* mark this file as already included (to prevent including it again) */ + setHashEntry(include_filename_hash, getBaseNamePtr(filename), "true"); while (!feof(file)) { @@ -1750,14 +1759,14 @@ static void *loadSetupFileData(char *filename, boolean use_hash) { if (!token_value_separator_warning) { - Error(ERR_RETURN_LINE, "-"); + Error(ERR_INFO_LINE, "-"); Error(ERR_WARN, "missing token/value separator(s) in config file:"); - Error(ERR_RETURN, "- config file: '%s'", filename); + Error(ERR_INFO, "- config file: '%s'", filename); token_value_separator_warning = TRUE; } - Error(ERR_RETURN, "- line %d: '%s'", line_nr, line_raw); + Error(ERR_INFO, "- line %d: '%s'", line_nr, line_raw); } #endif } @@ -1780,10 +1789,38 @@ static void *loadSetupFileData(char *filename, boolean use_hash) if (*token) { - if (use_hash) - setHashEntry((SetupFileHash *)setup_file_data, token, value); + if (strEqual(token, "include")) + { + if (getHashEntry(include_filename_hash, value) == NULL) + { + char *basepath = getBasePath(filename); + char *basename = getBaseName(value); + char *filename_include = getPath2(basepath, basename); + +#if 0 + Error(ERR_INFO, "[including file '%s']", filename_include); +#endif + + loadSetupFileData(setup_file_data, filename_include, FALSE, is_hash); + + free(basepath); + free(basename); + free(filename_include); + } + else + { + Error(ERR_WARN, "ignoring already processed file '%s'", value); + } + } else - insert_ptr = addListEntry((SetupFileList *)insert_ptr, token, value); + { + if (is_hash) + setHashEntry((SetupFileHash *)setup_file_data, token, value); + else + insert_ptr = addListEntry((SetupFileList *)insert_ptr, token, value); + + token_count++; + } } } @@ -1791,29 +1828,14 @@ static void *loadSetupFileData(char *filename, boolean use_hash) #if CHECK_TOKEN_VALUE_SEPARATOR__WARN_IF_MISSING if (token_value_separator_warning) - Error(ERR_RETURN_LINE, "-"); + Error(ERR_INFO_LINE, "-"); #endif - if (use_hash) - { - if (hashtable_count((SetupFileHash *)setup_file_data) == 0) - Error(ERR_WARN, "configuration file '%s' is empty", filename); - } - else - { - SetupFileList *setup_file_list = (SetupFileList *)setup_file_data; - SetupFileList *first_valid_list_entry = setup_file_list->next; - - /* free empty list header */ - setup_file_list->next = NULL; - freeSetupFileList(setup_file_list); - setup_file_data = first_valid_list_entry; + if (token_count == 0) + Error(ERR_WARN, "configuration file '%s' is empty", filename); - if (first_valid_list_entry == NULL) - Error(ERR_WARN, "configuration file '%s' is empty", filename); - } - - return setup_file_data; + if (top_recursion_level) + freeSetupFileHash(include_filename_hash); } void saveSetupFileHash(SetupFileHash *hash, char *filename) @@ -1839,12 +1861,27 @@ void saveSetupFileHash(SetupFileHash *hash, char *filename) SetupFileList *loadSetupFileList(char *filename) { - return (SetupFileList *)loadSetupFileData(filename, FALSE); + SetupFileList *setup_file_list = newSetupFileList("", ""); + SetupFileList *first_valid_list_entry; + + loadSetupFileData(setup_file_list, filename, TRUE, FALSE); + + first_valid_list_entry = setup_file_list->next; + + /* free empty list header */ + setup_file_list->next = NULL; + freeSetupFileList(setup_file_list); + + return first_valid_list_entry; } SetupFileHash *loadSetupFileHash(char *filename) { - return (SetupFileHash *)loadSetupFileData(filename, TRUE); + SetupFileHash *setup_file_hash = newSetupFileHash(); + + loadSetupFileData(setup_file_hash, filename, TRUE, TRUE); + + return setup_file_hash; } void checkSetupFileHashIdentifier(SetupFileHash *setup_file_hash, diff --git a/src/libgame/sound.c b/src/libgame/sound.c index a01ce29d..51b62efc 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -913,8 +913,8 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) { if (!mixer[i].active) { - Error(ERR_RETURN, "Mixer_InsertSound: Channel %d inactive", i); - Error(ERR_RETURN, "Mixer_InsertSound: This should never happen!"); + Error(ERR_INFO, "Mixer_InsertSound: Channel %d inactive", i); + Error(ERR_INFO, "Mixer_InsertSound: This should never happen!"); mixer_active_channels--; } @@ -933,7 +933,7 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) /* print some debugging information about audio channel usage */ for (i = audio.first_sound_channel; i < audio.num_channels; i++) { - Error(ERR_RETURN, "Mixer_InsertSound: %d [%d]: %ld (%ld)", + Error(ERR_INFO, "Mixer_InsertSound: %d [%d]: %ld (%ld)", i, mixer[i].active, mixer[i].data_len, (long)mixer[i].data_ptr); } #endif diff --git a/src/network.c b/src/network.c index f2f1ea28..1a0feda6 100644 --- a/src/network.c +++ b/src/network.c @@ -592,10 +592,10 @@ static void Handle_OP_MOVE_PLAYER(unsigned int len) if (server_frame_counter != FrameCounter) { - Error(ERR_RETURN, "client and servers frame counters out of sync"); - Error(ERR_RETURN, "frame counter of client is %d", FrameCounter); - Error(ERR_RETURN, "frame counter of server is %d", server_frame_counter); - Error(ERR_RETURN, "this should not happen -- please debug"); + Error(ERR_INFO, "client and servers frame counters out of sync"); + Error(ERR_INFO, "frame counter of client is %d", FrameCounter); + Error(ERR_INFO, "frame counter of server is %d", server_frame_counter); + Error(ERR_INFO, "this should not happen -- please debug"); stop_network_game = TRUE; diff --git a/src/tools.c b/src/tools.c index f7305299..3f9b7f26 100644 --- a/src/tools.c +++ b/src/tools.c @@ -5736,7 +5736,8 @@ void ResetGfxAnimation_EM(int x, int y, int tile) } void getGraphicSourceObjectExt_EM(int tile, int frame_em, - Bitmap **src_bitmap, int *src_x, int *src_y) + Bitmap **src_bitmap, int *src_x, int *src_y, + int x, int y) { int element = object_mapping[tile].element_rnd; int action = object_mapping[tile].action; @@ -5760,6 +5761,8 @@ void getGraphicSourceObjectExt_EM(int tile, int frame_em, else sync_frame = 7 - frame_em; + SetRandomAnimationValue(x, y); + int frame = getAnimationFrame(g->anim_frames, g->anim_delay, g->anim_mode,