From: Holger Schemel Date: Wed, 8 Jan 2003 00:18:14 +0000 (+0100) Subject: rnd-20030108-1-src X-Git-Tag: 3.0.0^2~183 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=69811dad502415dbda5610aef1d3ee303645baab;p=rocksndiamonds.git rnd-20030108-1-src --- diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 0a6beead..d6aff231 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -15,6 +15,10 @@ #include "main.h" +/* List values that are not defined in the configuration file are set to + reliable default values. If that value is GFX_ARG_UNDEFINED, it will + be dynamically determined, using some of the other list values. */ + struct ConfigInfo image_config_suffix[] = { { ".xpos", "0", TYPE_INTEGER }, @@ -23,7 +27,7 @@ struct ConfigInfo image_config_suffix[] = { ".vertical", "false", TYPE_BOOLEAN }, { ".xoffset", GFX_ARG_UNDEFINED, TYPE_INTEGER }, { ".yoffset", GFX_ARG_UNDEFINED, TYPE_INTEGER }, - { ".frames", "1", TYPE_INTEGER }, + { ".frames", GFX_ARG_UNDEFINED, TYPE_INTEGER }, { ".start_frame", GFX_ARG_UNDEFINED, TYPE_INTEGER }, { ".delay", "1", TYPE_INTEGER }, { ".mode_loop", "false", TYPE_BOOLEAN }, diff --git a/src/conftime.h b/src/conftime.h index 0412a164..4a631944 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-01-07 04:02]" +#define COMPILE_DATE_STRING "[2003-01-08 01:08]" diff --git a/src/init.c b/src/init.c index f497ec24..ce1e9298 100644 --- a/src/init.c +++ b/src/init.c @@ -777,7 +777,6 @@ static void InitGraphicInfo() { static boolean clipmasks_initialized = FALSE; static int gfx_action[NUM_IMAGE_FILES]; - Bitmap *src_bitmap; int src_x, src_y; int first_frame, last_frame; int i; @@ -827,9 +826,12 @@ static void InitGraphicInfo() for (i=0; iwidth : TILEX) / TILEX; + int num_ytiles = (src_bitmap ? src_bitmap->height * 2 / 3 : TILEY) / TILEY; int *parameter = image_files[i].parameter; - new_graphic_info[i].bitmap = getBitmapFromImageID(i); + new_graphic_info[i].bitmap = src_bitmap; new_graphic_info[i].src_x = parameter[GFX_ARG_XPOS] * TILEX; new_graphic_info[i].src_y = parameter[GFX_ARG_YPOS] * TILEY; @@ -849,7 +851,15 @@ static void InitGraphicInfo() if (parameter[GFX_ARG_YOFFSET] != GFX_ARG_UNDEFINED_VALUE) new_graphic_info[i].offset_y = parameter[GFX_ARG_YOFFSET]; - new_graphic_info[i].anim_frames = parameter[GFX_ARG_FRAMES]; + /* automatically determine correct number of frames, if not defined */ + if (parameter[GFX_ARG_FRAMES] != GFX_ARG_UNDEFINED_VALUE) + new_graphic_info[i].anim_frames = parameter[GFX_ARG_FRAMES]; + else if (parameter[GFX_ARG_XPOS] == 0 && !parameter[GFX_ARG_VERTICAL]) + new_graphic_info[i].anim_frames = num_xtiles; + else if (parameter[GFX_ARG_YPOS] == 0 && parameter[GFX_ARG_VERTICAL]) + new_graphic_info[i].anim_frames = num_ytiles; + else + new_graphic_info[i].anim_frames = 1; new_graphic_info[i].anim_delay = parameter[GFX_ARG_DELAY]; if (new_graphic_info[i].anim_delay == 0) /* delay must be at least 1 */ @@ -864,7 +874,7 @@ static void InitGraphicInfo() new_graphic_info[i].anim_mode = ANIM_PINGPONG; else if (parameter[GFX_ARG_MODE_PINGPONG2]) new_graphic_info[i].anim_mode = ANIM_PINGPONG2; - else if (parameter[GFX_ARG_FRAMES] > 1) + else if (new_graphic_info[i].anim_frames > 1) new_graphic_info[i].anim_mode = ANIM_LOOP; else new_graphic_info[i].anim_mode = ANIM_NONE; @@ -930,8 +940,8 @@ static void InitGraphicInfo() getTokenFromImageID(i)); Error(ERR_RETURN, "- image file: '%s'", src_bitmap->source_filename); - Error(ERR_EXIT, "error: last animation frame out of bounds (%d,%d)", - src_x, src_y); + Error(ERR_EXIT, "error: last animation frame (%d) out of bounds (%d,%d)", + last_frame, src_x, src_y); } #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND) diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 7caaa3af..30399620 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1566,8 +1566,13 @@ static void LoadArtworkConfig(struct ArtworkListInfo *artwork_info) { char *filename = getTokenValue(setup_file_list, file_list[i].token); - if (filename == NULL) + if (filename) + for (j=0; j