X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=eee87022ee3146e7e37a903467f5a88f41fec398;hb=1101077a226b09854650662759bf12caf7c84f8d;hp=b45aa038385e924a91343f2c841e5c5a593f617f;hpb=06caafc8481189a73ffc5beb2105aaec5ac0acb5;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index b45aa038..eee87022 100644 --- a/src/init.c +++ b/src/init.c @@ -157,19 +157,12 @@ void InitSound() OpenAudio(); - for(i=0; iclip_mask, - clip_gc_valuemask, &clip_gc_values); - clip_gc_values.graphics_exposures = False; clip_gc_valuemask = GCGraphicsExposures; tile_clip_gc = @@ -268,11 +254,19 @@ void InitTileClipmasks() clip_gc_values.clip_mask = pix[i]->clip_mask; clip_gc_valuemask = GCGraphicsExposures | GCClipMask; pix[i]->stored_clip_gc = XCreateGC(display, window->drawable, - clip_gc_valuemask,&clip_gc_values); + clip_gc_valuemask, &clip_gc_values); } } #if defined(TARGET_X11_NATIVE) + + /* create graphic context structures needed for clipping */ + clip_gc_values.graphics_exposures = False; + clip_gc_valuemask = GCGraphicsExposures; + 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++) { @@ -296,10 +290,42 @@ void InitTileClipmasks() src_x, src_y, TILEX, TILEY, 0, 0); } } + + XFreeGC(display, copy_clipmask_gc); + #endif /* TARGET_X11_NATIVE */ #endif /* TARGET_X11 */ } +void FreeTileClipmasks() +{ +#if defined(TARGET_X11) + int i; + + for(i=0; istored_clip_gc) + { + XFreeGC(display, pix[i]->stored_clip_gc); + pix[i]->stored_clip_gc = None; + } + } +#endif /* TARGET_X11 */ +} + void InitGfx() { int i; @@ -355,9 +381,9 @@ void InitGfxBackground() fieldbuffer = pix[PIX_DB_FIELD]; SetDrawtoField(DRAW_BACKBUFFER); - BlitBitmap(pix[PIX_BACK], backbuffer, 0,0, WIN_XSIZE,WIN_YSIZE, 0,0); - ClearRectangle(backbuffer, REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE); - ClearRectangle(pix[PIX_DB_DOOR], 0,0, 3*DXSIZE,DYSIZE+VYSIZE); + BlitBitmap(pix[PIX_BACK], backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); + ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE); + ClearRectangle(pix[PIX_DB_DOOR], 0, 0, 3 * DXSIZE, DYSIZE + VYSIZE); for(x=0; xname) + { + int i; + + ClearRectangle(window, 0, 0, WIN_XSIZE, WIN_YSIZE); + + for(i=0; iname; + } + + if (artwork.sounds_set_current != artwork.snd_current->name) + { + InitReloadSounds(artwork.snd_current->name); + + artwork.sounds_set_current = artwork.snd_current->name; + } + + if (artwork.music_set_current != artwork.mus_current->name) + { + InitReloadMusic(artwork.mus_current->name); + + artwork.music_set_current = artwork.mus_current->name; + } +} + void InitGadgets() { CreateLevelEditorGadgets(); @@ -1529,9 +1593,11 @@ void CloseAllAndExit(int exit_value) int i; StopSounds(); - FreeSounds(NUM_SOUNDS); CloseAudio(); + FreeAllSounds(); + FreeAllMusic(); + FreeTileClipmasks(); for(i=0; i