X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=40ecc4d759b37b0a7d8767933e494e83741a4390;hb=6c244f56b4911dc83930193a43497388b91696af;hp=80073129cc76208eb9d72c61abd0790f39b1e01d;hpb=ea933dd51bfca7ddcc6b75465476cce57afd1682;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 80073129..40ecc4d7 100644 --- a/src/init.c +++ b/src/init.c @@ -383,6 +383,13 @@ void InitFontGraphicInfo() int font_bitmap_id = font_info[i].special_bitmap_id[j]; int graphic = font_info[i].special_graphic[j]; + /* set 'graphic_info' for font entries, if uninitialized (guessed) */ + if (graphic_info[graphic].anim_frames < MIN_NUM_CHARS_PER_FONT) + { + graphic_info[graphic].anim_frames = DEFAULT_NUM_CHARS_PER_FONT; + graphic_info[graphic].anim_frames_per_line= DEFAULT_NUM_CHARS_PER_LINE; + } + /* copy font relevant information from graphics information */ font_bitmap_info[font_bitmap_id].bitmap = graphic_info[graphic].bitmap; font_bitmap_info[font_bitmap_id].src_x = graphic_info[graphic].src_x; @@ -391,6 +398,11 @@ void InitFontGraphicInfo() font_bitmap_info[font_bitmap_id].height = graphic_info[graphic].height; font_bitmap_info[font_bitmap_id].draw_x = graphic_info[graphic].draw_x; font_bitmap_info[font_bitmap_id].draw_y = graphic_info[graphic].draw_y; + + font_bitmap_info[font_bitmap_id].num_chars = + graphic_info[graphic].anim_frames; + font_bitmap_info[font_bitmap_id].num_chars_per_line = + graphic_info[graphic].anim_frames_per_line; } } @@ -423,6 +435,9 @@ void InitElementGraphicInfo() int direction = element_to_graphic[i].direction; int graphic = element_to_graphic[i].graphic; + if (graphic_info[graphic].bitmap == NULL) + continue; + if (action < 0) action = ACTION_DEFAULT; @@ -441,6 +456,9 @@ void InitElementGraphicInfo() int special = property_mapping[i].ext3_index; int graphic = property_mapping[i].artwork_index; + if (graphic_info[graphic].bitmap == NULL) + continue; + if (element >= MAX_NUM_ELEMENTS || special != -1) continue; @@ -473,13 +491,18 @@ void InitElementGraphicInfo() for (act=0; actwidth : TILEX) / TILEX; - int num_ytiles = (src_bitmap ? src_bitmap->height * 2 / 3 : TILEY) / TILEY; int parameter[NUM_GFX_ARGS]; + int num_xtiles = 1, num_ytiles = 1; int i; /* get integer values from string parameters */ @@ -590,21 +613,21 @@ static void set_graphic_parameters(int graphic, char **parameter_raw) if (parameter[GFX_ARG_HEIGHT] != ARG_UNDEFINED_VALUE) graphic_info[graphic].height = parameter[GFX_ARG_HEIGHT]; - /* correct x or y offset dependant of vertical or horizontal frame order */ - if (parameter[GFX_ARG_VERTICAL]) /* frames are ordered vertically */ + if (src_bitmap) { - if (parameter[GFX_ARG_OFFSET] != ARG_UNDEFINED_VALUE) - graphic_info[graphic].offset_y = parameter[GFX_ARG_OFFSET]; - else - graphic_info[graphic].offset_y = graphic_info[graphic].height; + num_xtiles = src_bitmap->width / graphic_info[graphic].width; + num_ytiles = src_bitmap->height / graphic_info[graphic].height; } + + /* correct x or y offset dependant of vertical or horizontal frame order */ + if (parameter[GFX_ARG_VERTICAL]) /* frames are ordered vertically */ + graphic_info[graphic].offset_y = + (parameter[GFX_ARG_OFFSET] != ARG_UNDEFINED_VALUE ? + parameter[GFX_ARG_OFFSET] : graphic_info[graphic].height); else /* frames are ordered horizontally */ - { - if (parameter[GFX_ARG_OFFSET] != ARG_UNDEFINED_VALUE) - graphic_info[graphic].offset_x = parameter[GFX_ARG_OFFSET]; - else - graphic_info[graphic].offset_x = graphic_info[graphic].width; - } + graphic_info[graphic].offset_x = + (parameter[GFX_ARG_OFFSET] != ARG_UNDEFINED_VALUE ? + parameter[GFX_ARG_OFFSET] : graphic_info[graphic].width); /* optionally, the x and y offset of frames can be specified directly */ if (parameter[GFX_ARG_XOFFSET] != ARG_UNDEFINED_VALUE) @@ -622,14 +645,17 @@ static void set_graphic_parameters(int graphic, char **parameter_raw) else graphic_info[graphic].anim_frames = 1; + graphic_info[graphic].anim_frames_per_line = + (parameter[GFX_ARG_FRAMES_PER_LINE] != ARG_UNDEFINED_VALUE ? + parameter[GFX_ARG_FRAMES_PER_LINE] : graphic_info[graphic].anim_frames); + graphic_info[graphic].anim_delay = parameter[GFX_ARG_DELAY]; if (graphic_info[graphic].anim_delay == 0) /* delay must be at least 1 */ graphic_info[graphic].anim_delay = 1; - if (parameter[GFX_ARG_ANIM_MODE] != ANIM_NONE) - graphic_info[graphic].anim_mode = parameter[GFX_ARG_ANIM_MODE]; - else if (graphic_info[graphic].anim_frames > 1) - graphic_info[graphic].anim_mode = ANIM_LOOP; + graphic_info[graphic].anim_mode = parameter[GFX_ARG_ANIM_MODE]; + if (graphic_info[graphic].anim_frames == 1) + graphic_info[graphic].anim_mode = ANIM_NONE; /* automatically determine correct start frame, if not defined */ if (parameter[GFX_ARG_START_FRAME] == ARG_UNDEFINED_VALUE) @@ -1014,9 +1040,9 @@ static void InitSoundInfo() static void ReinitializeGraphics() { + InitGraphicInfo(); /* graphic properties mapping */ InitElementGraphicInfo(); /* element game graphic mapping */ InitElementSpecialGraphicInfo(); /* element special graphic mapping */ - InitGraphicInfo(); /* graphic properties mapping */ InitElementSmallImages(); /* create editor and preview images */ InitFontGraphicInfo(); /* initialize text drawing functions */ @@ -1030,8 +1056,8 @@ static void ReinitializeGraphics() static void ReinitializeSounds() { - InitElementSoundInfo(); /* element game sound mapping */ InitSoundInfo(); /* sound properties mapping */ + InitElementSoundInfo(); /* element game sound mapping */ #if 1 InitElementSoundInfo(); /* element game sound mapping */ @@ -2119,6 +2145,20 @@ void InitElementProperties() }; static int ep_tube_num = SIZEOF_ARRAY_INT(ep_tube); + static int ep_em_slippery_wall[] = + { + }; + static int ep_em_slippery_wall_num = SIZEOF_ARRAY_INT(ep_em_slippery_wall); + + static int ep_can_be_crumbled[] = + { + EL_SAND, + EL_LANDMINE, + EL_TRAP, + EL_TRAP_ACTIVE + }; + static int ep_can_be_crumbled_num = SIZEOF_ARRAY_INT(ep_can_be_crumbled); + static long ep1_bit[] = { EP_BIT_AMOEBALIVE, @@ -2158,7 +2198,9 @@ void InitElementProperties() EP_BIT_BELT, EP_BIT_BELT_ACTIVE, EP_BIT_BELT_SWITCH, - EP_BIT_TUBE + EP_BIT_TUBE, + EP_BIT_EM_SLIPPERY_WALL, + EP_BIT_CAN_BE_CRUMBLED }; static int *ep1_array[] = { @@ -2199,7 +2241,9 @@ void InitElementProperties() ep_belt, ep_belt_active, ep_belt_switch, - ep_tube + ep_tube, + ep_em_slippery_wall, + ep_can_be_crumbled }; static int *ep1_num[] = { @@ -2240,7 +2284,9 @@ void InitElementProperties() &ep_belt_num, &ep_belt_active_num, &ep_belt_switch_num, - &ep_tube_num + &ep_tube_num, + &ep_em_slippery_wall_num, + &ep_can_be_crumbled_num }; static int num_properties1 = SIZEOF_ARRAY(ep1_num, int *); static int num_properties2 = SIZEOF_ARRAY(ep2_num, int *); @@ -2504,20 +2550,27 @@ void InitGfx() } } + for (j=0; j < NUM_INITIAL_FONTS; j++) + { + font_initial[j].num_chars = DEFAULT_NUM_CHARS_PER_FONT; + font_initial[j].num_chars_per_line = DEFAULT_NUM_CHARS_PER_LINE; + } + if (filename_font_initial == NULL) /* should not happen */ Error(ERR_EXIT, "cannot get filename for '%s'", CONFIG_TOKEN_FONT_INITIAL); + /* create additional image buffers for double-buffering */ + bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH); + bitmap_db_door = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH); + /* initialize screen properties */ InitGfxFieldInfo(SX, SY, SXSIZE, SYSIZE, - REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE); + REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, + bitmap_db_field); InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE); InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE); InitGfxScrollbufferInfo(FXSIZE, FYSIZE); - /* create additional image buffers for double-buffering */ - bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH); - bitmap_db_door = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH); - bitmap_font_initial = LoadCustomImage(filename_font_initial); for (j=0; j < NUM_INITIAL_FONTS; j++)