X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=42e502dcd94996ea0212e08d9c2bd7d77b4d6e7f;hb=c38b8938950533926b72af227c38513fe665a8f6;hp=32b2cb8e3d6504c2f426e26ba65b554695b3c855;hpb=cd9add1d9479d1938d05ca9df4f31c3f99bd5f3e;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 32b2cb8e..42e502dc 100644 --- a/src/init.c +++ b/src/init.c @@ -31,6 +31,15 @@ static char *image_filename[NUM_PICTURES] = { +#if 0 + "RocksScreen.pcx", + "RocksDoor.pcx", + "RocksToons.pcx", + "RocksFontBig.pcx", + "RocksFontSmall.pcx", + "RocksFontMedium.pcx", + "RocksFontEM.pcx" +#else "RocksScreen.pcx", "RocksElements.pcx", "RocksDoor.pcx", @@ -43,8 +52,11 @@ static char *image_filename[NUM_PICTURES] = "RocksFontSmall.pcx", "RocksFontMedium.pcx", "RocksFontEM.pcx" +#endif }; +static Bitmap *bitmap_font_initial = NULL; + static void InitSetup(void); static void InitPlayerInfo(void); static void InitLevelInfo(void); @@ -103,15 +115,17 @@ void OpenAll(void) InitEventFilter(FilterMouseMotionEvents); - InitGfx(); InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */ InitElementInfo(); + InitGfx(); + InitLevelInfo(); InitLevelArtworkInfo(); - InitGadgets(); /* needs to know number of level series */ + InitImages(); /* needs to know current level directory */ InitSound(); /* needs to know current level directory */ + InitGadgets(); /* needs images + number of level series */ InitGfxBackground(); InitToons(); @@ -179,14 +193,24 @@ void InitNetworkServer() #endif } +static void ReinitializeGraphics() +{ + ReloadCustomImages(); /* load custom image files */ + + InitGraphicInfo(); /* initialize graphic info from config file */ + + InitFontInfo(bitmap_font_initial, + 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); +} + static void InitImages() { InitImageList(image_config, image_config_suffix, NUM_IMAGE_FILES); - /* load custom images */ - ReloadCustomImages(); - - InitGraphicInfo(); + ReinitializeGraphics(); } static void InitMixer() @@ -214,6 +238,8 @@ static void InitTileClipmasks() unsigned long clip_gc_valuemask; #if defined(TARGET_X11_NATIVE) + +#if 0 GC copy_clipmask_gc; static struct @@ -267,13 +293,15 @@ static void InitTileClipmasks() { GFX2_SHIELD_ACTIVE, 3 }, { -1, 0 } }; +#endif + #endif /* TARGET_X11_NATIVE */ #endif /* TARGET_X11 */ 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) { @@ -298,9 +327,11 @@ static void InitTileClipmasks() clip_gc_valuemask, &clip_gc_values); } } +#endif #if defined(TARGET_X11_NATIVE) +#if 0 /* create graphic context structures needed for clipping */ clip_gc_values.graphics_exposures = False; clip_gc_valuemask = GCGraphicsExposures; @@ -308,11 +339,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) { @@ -363,12 +396,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; @@ -383,30 +420,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(bitmap_font_initial, NULL, NULL, NULL, 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; iidentifier; char *snd_new_identifier = artwork.snd_current->identifier; char *mus_new_identifier = artwork.mus_current->identifier; + boolean redraw_screen = FALSE; + + if (leveldir_current_identifier == NULL) + leveldir_current_identifier = leveldir_current->identifier; + +#if 0 + printf("CURRENT GFX: '%s' ['%s']\n", artwork.gfx_current->identifier, + leveldir_current->graphics_set); + printf("CURRENT LEV: '%s' / '%s'\n", leveldir_current_identifier, + leveldir_current->identifier); +#endif #if 0 printf("graphics --> '%s' ('%s')\n", @@ -492,31 +552,48 @@ void ReloadCustomArtwork() if (strcmp(artwork.gfx_current_identifier, gfx_new_identifier) != 0 || last_override_level_graphics != setup.override_level_graphics) { +#if 0 + printf("CHANGED GFX: '%s' -> '%s'\n", + artwork.gfx_current_identifier, gfx_new_identifier); +#endif + +#if 0 int i; +#endif setLevelArtworkDir(artwork.gfx_first); ClearRectangle(window, 0, 0, WIN_XSIZE, WIN_YSIZE); - for(i=0; iidentifier; +#endif last_override_level_graphics = setup.override_level_graphics; + + redraw_screen = TRUE; } if (strcmp(artwork.snd_current_identifier, snd_new_identifier) != 0 || @@ -529,6 +606,8 @@ void ReloadCustomArtwork() artwork.snd_current_identifier = snd_new_identifier; last_override_level_sounds = setup.override_level_sounds; + + redraw_screen = TRUE; } if (strcmp(artwork.mus_current_identifier, mus_new_identifier) != 0 || @@ -541,6 +620,17 @@ void ReloadCustomArtwork() artwork.mus_current_identifier = mus_new_identifier; last_override_level_music = setup.override_level_music; + + redraw_screen = TRUE; + } + + if (redraw_screen) + { + InitGfxBackground(); + + /* force redraw of (open or closed) door graphics */ + SetDoorState(DOOR_OPEN_ALL); + CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY); } #if 0 @@ -926,13 +1016,13 @@ void InitElementInfo() int i, act, dir; /* set values to -1 to identify later as "uninitialized" values */ - 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]); @@ -1682,7 +1862,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); @@ -2350,20 +2530,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