X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=9b553f1e419672c5990263cd805a235cb1ba70cf;hb=8afc6199767a6fcb7451efd2b3d5b070f6c99efb;hp=38aec9ae656aab1e178dc3bd8fb376a431eb44ca;hpb=87f531efe267aa3d6a27cc3a68c68c1a4df7b18b;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 38aec9ae..9b553f1e 100644 --- a/src/init.c +++ b/src/init.c @@ -29,15 +29,17 @@ static char *image_filename[NUM_PICTURES] = { "RocksScreen.pcx", + "RocksElements.pcx", "RocksDoor.pcx", "RocksHeroes.pcx", "RocksToons.pcx", "RocksSP.pcx", "RocksDC.pcx", "RocksMore.pcx", - "RocksFont.pcx", - "RocksFont2.pcx", - "RocksFont3.pcx" + "RocksFontBig.pcx", + "RocksFontSmall.pcx", + "RocksFontMedium.pcx", + "RocksFontEM.pcx" }; static void InitSetup(void); @@ -46,12 +48,16 @@ static void InitLevelInfo(void); static void InitArtworkInfo(void); static void InitLevelArtworkInfo(void); static void InitNetworkServer(void); +static void InitImages(void); static void InitMixer(void); static void InitSound(void); static void InitGfx(void); static void InitGfxBackground(void); static void InitGadgets(void); static void InitElementProperties(void); +static void InitElementInfo(void); +static void InitGraphicInfo(void); +static void InitSoundInfo(); static void Execute_Debug_Command(char *); void OpenAll(void) @@ -96,10 +102,12 @@ void OpenAll(void) InitGfx(); InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */ + InitElementInfo(); InitLevelInfo(); InitLevelArtworkInfo(); InitGadgets(); /* needs to know number of level series */ + InitImages(); /* needs to know current level directory */ InitSound(); /* needs to know current level directory */ InitGfxBackground(); @@ -168,10 +176,21 @@ void InitNetworkServer() #endif } +static void InitImages() +{ + InitImageList(image_config, image_config_suffix, NUM_IMAGE_FILES); + + /* load custom images */ + ReloadCustomImages(); + + InitGraphicInfo(); +} + static void InitMixer() { OpenAudio(); - InitSoundList(sound_effects, NUM_SOUND_EFFECTS); + + InitSoundList(sound_config, sound_config_suffix, NUM_SOUND_FILES); StartMixer(); } @@ -182,8 +201,7 @@ static void InitSound() InitReloadSounds(artwork.snd_current->identifier); InitReloadMusic(artwork.mus_current->identifier); - /* initialize sound effect lookup table for element actions */ - InitGameSound(); + InitSoundInfo(); } static void InitTileClipmasks() @@ -263,8 +281,8 @@ static void InitTileClipmasks() clip_gc_values.graphics_exposures = False; clip_gc_valuemask = GCGraphicsExposures; - tile_clip_gc = - XCreateGC(display, window->drawable, clip_gc_valuemask, &clip_gc_values); + tile_clip_gc = XCreateGC(display, window->drawable, + clip_gc_valuemask, &clip_gc_values); for(i=0; iclip_mask, - clip_gc_valuemask, &clip_gc_values); + copy_clipmask_gc = XCreateGC(display, pix[PIX_BACK]->clip_mask, + clip_gc_valuemask, &clip_gc_values); /* create only those clipping Pixmaps we really need */ for(i=0; tile_needs_clipping[i].start>=0; i++) @@ -297,11 +314,11 @@ static void InitTileClipmasks() int tile = tile_needs_clipping[i].start + j; int graphic = tile; int src_x, src_y; - int pixmap_nr; + Bitmap *src_bitmap; Pixmap src_pixmap; - getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y); - src_pixmap = pix[pixmap_nr]->clip_mask; + getGraphicSource(graphic, &src_bitmap, &src_x, &src_y); + src_pixmap = src_bitmap->clip_mask; tile_clipmask[tile] = XCreatePixmap(display, window->drawable, TILEX, TILEY, 1); @@ -366,9 +383,9 @@ void InitGfx() pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH); pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH); - pix[PIX_SMALLFONT] = LoadCustomImage(image_filename[PIX_SMALLFONT]); + pix[PIX_FONT_SMALL] = LoadCustomImage(image_filename[PIX_FONT_SMALL]); - InitFontInfo(NULL, NULL, pix[PIX_SMALLFONT]); + InitFontInfo(NULL, NULL, pix[PIX_FONT_SMALL], NULL); DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW); DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED); @@ -377,7 +394,7 @@ void InitGfx() for(i=0; iidentifier; } /* custom level artwork configured in level series configuration file always overrides custom level artwork stored in level series directory - and (level independant) custom artwork configured in setup menue - (the path entry is needed to send it to the sound child process) */ + and (level independant) custom artwork configured in setup menue */ if (leveldir_current->graphics_set != NULL) - { - if (leveldir_current->graphics_path) - free(leveldir_current->graphics_path); - leveldir_current->graphics_path = NULL; - leveldir_current->graphics_path = - getStringCopy(getLevelArtworkDir(artwork.gfx_first)); gfx_new_identifier = leveldir_current->graphics_set; - } if (leveldir_current->sounds_set != NULL) - { - if (leveldir_current->sounds_path) - free(leveldir_current->sounds_path); - leveldir_current->sounds_path = NULL; - leveldir_current->sounds_path = - getStringCopy(getLevelArtworkDir(artwork.snd_first)); snd_new_identifier = leveldir_current->sounds_set; - } if (leveldir_current->music_set != NULL) - { - if (leveldir_current->music_path) - free(leveldir_current->music_path); - leveldir_current->music_path = NULL; - leveldir_current->music_path = - getStringCopy(getLevelArtworkDir(artwork.mus_first)); mus_new_identifier = leveldir_current->music_set; - } if (strcmp(artwork.gfx_current_identifier, gfx_new_identifier) != 0 || last_override_level_graphics != setup.override_level_graphics) { int i; + setLevelArtworkDir(artwork.gfx_first); + ClearRectangle(window, 0, 0, WIN_XSIZE, WIN_YSIZE); for(i=0; i -1) + { + int element = element_to_graphic[i].element; + int graphic = element_to_graphic[i].graphic; + + element_info[element].graphic = graphic; + i++; + } +} + +static void InitGraphicInfo() +{ + int i; + + image_files = getCurrentImageList(); + + for(i=0; i %d\n", image_files[GFX_BD_DIAMOND].parameter[GFXARG_NUM_FRAMES]); + printf("W> %d\n", image_files[GFX_ROBOT_WHEEL].parameter[GFXARG_NUM_FRAMES]); + + graphic_info[GFX_ABLENK].bitmap = getBitmapFromImageID(GFX_ROBOT_WHEEL); + graphic_info[GFX_ABLENK].src_x = 0; + graphic_info[GFX_ABLENK].src_y = 0; + + graphic_info[GFX_ABLENK + 1].bitmap = getBitmapFromImageID(GFX_ROBOT_WHEEL); + graphic_info[GFX_ABLENK + 2].bitmap = getBitmapFromImageID(GFX_ROBOT_WHEEL); + graphic_info[GFX_ABLENK + 3].bitmap = getBitmapFromImageID(GFX_ROBOT_WHEEL); + graphic_info[GFX_ABLENK + 1].src_x = 1 * TILEX; + graphic_info[GFX_ABLENK + 2].src_x = 2 * TILEX; + graphic_info[GFX_ABLENK + 3].src_x = 3 * TILEX; + graphic_info[GFX_ABLENK + 1].src_y = 0; + graphic_info[GFX_ABLENK + 2].src_y = 0; + graphic_info[GFX_ABLENK + 3].src_y = 0; +#endif +} + +static void InitSoundInfo() +{ + sound_files = getCurrentSoundList(); + + /* initialize sound effect lookup table for element actions */ + InitGameSound(); +} + void InitElementProperties() { - int i,j; + int i, j; static int ep_amoebalive[] = { @@ -1738,17 +2109,26 @@ void Execute_Debug_Command(char *command) { if (strcmp(command, "create graphicsinfo.conf") == 0) { - printf("# (Currently only \"name\" and \"sort_priority\" recognized.)\n"); + int i; + + printf("# You can configure additional/alternative image files here.\n"); + printf("# (The images below are default and therefore commented out.)\n"); printf("\n"); printf("%s\n", getFormattedSetupEntry("name", "Classic Graphics")); printf("\n"); printf("%s\n", getFormattedSetupEntry("sort_priority", "100")); + printf("\n"); + + for (i=0; image_config[i].token != NULL; i++) + printf("# %s\n", + getFormattedSetupEntry(image_config[i].token, + image_config[i].value)); } else if (strcmp(command, "create soundsinfo.conf") == 0) { int i; - printf("# You can configure additional/alternative sound effects here\n"); + printf("# You can configure additional/alternative sound files here.\n"); printf("# (The sounds below are default and therefore commented out.)\n"); printf("\n"); printf("%s\n", getFormattedSetupEntry("name", "Classic Sounds")); @@ -1756,10 +2136,10 @@ void Execute_Debug_Command(char *command) printf("%s\n", getFormattedSetupEntry("sort_priority", "100")); printf("\n"); - for (i=0; i