X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=88806e9e849096f53439aeb94b6279bb22c10797;hb=fe0d059d4646a35d85ef508c70eaaaae393302f2;hp=7d0c731ba252e532f0df5cf6ca38a648c8818fb0;hpb=234748b5eb0bc4fe29a36fd25a1d25658f53858a;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 7d0c731b..88806e9e 100644 --- a/src/init.c +++ b/src/init.c @@ -55,6 +55,8 @@ static char *image_filename[NUM_PICTURES] = #endif }; +static Bitmap *bitmap_font_initial = NULL; + static void InitSetup(void); static void InitPlayerInfo(void); static void InitLevelInfo(void); @@ -113,12 +115,14 @@ void OpenAll(void) InitEventFilter(FilterMouseMotionEvents); - InitGfx(); InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */ InitElementInfo(); + InitGfx(); + InitLevelInfo(); InitLevelArtworkInfo(); + InitImages(); /* needs to know current level directory */ InitSound(); /* needs to know current level directory */ InitGadgets(); /* needs images + number of level series */ @@ -189,14 +193,29 @@ void InitNetworkServer() #endif } +static void ReinitializeGraphics() +{ + ReloadCustomImages(); /* load custom image files */ + + InitGraphicInfo(); /* initialize graphic info from config file */ + + InitFontInfo(new_graphic_info[IMG_MENU_FONT_BIG].bitmap, + new_graphic_info[IMG_MENU_FONT_MEDIUM].bitmap, + new_graphic_info[IMG_MENU_FONT_SMALL].bitmap, + new_graphic_info[IMG_MENU_FONT_EM].bitmap); + + if (bitmap_font_initial) + { + FreeBitmap(bitmap_font_initial); + bitmap_font_initial = NULL; + } +} + static void InitImages() { InitImageList(image_config, image_config_suffix, NUM_IMAGE_FILES); - /* load custom images */ - ReloadCustomImages(); - - InitGraphicInfo(); + ReinitializeGraphics(); } static void InitMixer() @@ -287,7 +306,7 @@ static void InitTileClipmasks() int i; /* initialize pixmap array for special X11 tile clipping to Pixmap 'None' */ - for(i=0; idrawable, clip_gc_valuemask, &clip_gc_values); - for(i=0; iclip_mask) { @@ -312,6 +332,7 @@ static void InitTileClipmasks() clip_gc_valuemask, &clip_gc_values); } } +#endif #if defined(TARGET_X11_NATIVE) @@ -323,11 +344,11 @@ static void InitTileClipmasks() clip_gc_valuemask, &clip_gc_values); /* create only those clipping Pixmaps we really need */ - for(i=0; tile_needs_clipping[i].start>=0; i++) + for (i=0; tile_needs_clipping[i].start>=0; i++) { int j; - for(j=0; jstored_clip_gc) { @@ -379,12 +401,16 @@ void FreeTileClipmasks() pix[i]->stored_clip_gc = None; } } +#endif + #endif /* TARGET_X11 */ } void InitGfx() { +#if 0 int i; +#endif /* initialize some global variables */ global.frames_per_second = 0; @@ -399,30 +425,42 @@ void InitGfx() InitGfxScrollbufferInfo(FXSIZE, FYSIZE); /* create additional image buffers for double-buffering */ - pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH); - pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH); + bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH); + bitmap_db_door = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH); +#if 0 pix[PIX_FONT_SMALL] = LoadCustomImage(image_filename[PIX_FONT_SMALL]); InitFontInfo(NULL, NULL, pix[PIX_FONT_SMALL], NULL); +#else + bitmap_font_initial = LoadCustomImage(image_filename[PIX_FONT_SMALL]); + + InitFontInfo(NULL, NULL, bitmap_font_initial, NULL); +#endif DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW); DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED); DrawInitText("Loading graphics:", 120, FC_GREEN); - for(i=0; i -1) + { + int action = element_to_graphic[i].action; + int graphic = element_to_graphic[i].graphic; + + if (action == -1) + action = GFX_ACTION_DEFAULT; + + gfx_action[graphic] = action; + + i++; + } + + for (i=0; i src_bitmap->width || + src_y + TILEY > src_bitmap->height) + Error(ERR_EXIT, "InitGraphicInfo: image bitmap '%s' too small for graphic object %d (normal size)", src_bitmap->source_filename, i); + + getMiniGraphicSource(i, &src_bitmap, &src_x, &src_y); + if (src_x + MINI_TILEX > src_bitmap->width || + src_y + MINI_TILEY > src_bitmap->height) + Error(ERR_EXIT, "InitGraphicInfo: image bitmap '%s' too small for graphic object %d ('mini' size)", src_bitmap->source_filename, i); + + getMicroGraphicSource(i, &src_bitmap, &src_x, &src_y); + if (src_x + MICRO_TILEX > src_bitmap->width || + src_y + MICRO_TILEY > src_bitmap->height) + Error(ERR_EXIT, "InitGraphicInfo: image bitmap '%s' too small for graphic object %d ('micro' size)", src_bitmap->source_filename, i); + + +#if 0 + { + int j; + + if (i == IMG_EMERALD) + { + for (j=0; j %d\n", image_config_suffix[j].token, parameter[j]); + printf("-> %d\n", new_graphic_info[i].anim_frames); + printf("\n"); + } + } +#endif + } + #if 0 printf("D> %d\n", image_files[GFX_BD_DIAMOND].parameter[GFX_ARG_NUM_FRAMES]); printf("W> %d\n", image_files[GFX_ROBOT_WHEEL].parameter[GFX_ARG_NUM_FRAMES]); @@ -1722,7 +1830,7 @@ void InitElementProperties() EL_SP_SNIKSNAK, EL_SP_ELECTRON, EL_BALLOON, - EL_SPRING_MOVING + EL_SPRING }; static int ep_can_move_num = SIZEOF_ARRAY_INT(ep_can_move); @@ -2390,20 +2498,20 @@ void InitElementProperties() static int num_properties1 = SIZEOF_ARRAY(ep1_num, int *); static int num_properties2 = SIZEOF_ARRAY(ep2_num, int *); - for(i=0; i