X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=e756cc4c68f27b3e6b6ab608e11e6f1e7974110e;hb=5693fe58c10d1472842ebe3fa45fbc9cf3aef5e4;hp=ae65640f67f152bd51070ef2da3027a9a0a7c10b;hpb=ae32fd8a4316c5d7f18fe6966f999ebf5509df94;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index ae65640f..e756cc4c 100644 --- a/src/init.c +++ b/src/init.c @@ -1,18 +1,16 @@ /*********************************************************** -* Rocks'n'Diamonds -- McDuffin Strikes Back! * +* Rocks'n'Diamonds -- McDuffin Strikes Back! * *----------------------------------------------------------* -* (c) 1995-98 Artsoft Entertainment * -* Holger Schemel * -* Oststrasse 11a * -* 33604 Bielefeld * -* phone: ++49 +521 290471 * -* email: aeglos@valinor.owl.de * +* (c) 1995-2000 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * *----------------------------------------------------------* -* init.c * +* init.c * ***********************************************************/ -#include - #include "libgame/libgame.h" #include "init.h" @@ -31,8 +29,6 @@ static void InitPlayerInfo(void); static void InitLevelInfo(void); static void InitNetworkServer(void); static void InitSound(void); -static void InitSoundServer(void); -static void InitDisplay(void); static void InitGfx(void); static void InitGfxBackground(void); static void InitGadgets(void); @@ -40,20 +36,14 @@ static void InitElementProperties(void); void OpenAll(void) { -#if !defined(PLATFORM_UNIX) - initErrorFile(); -#endif - if (options.serveronly) { #if defined(PLATFORM_UNIX) NetworkServer(options.server_port, options.serveronly); #else - Error(ERR_WARN, "networking not supported in Windows version"); + Error(ERR_WARN, "networking only supported in Unix version"); #endif - - /* never reached */ - exit(0); + exit(0); /* never reached */ } InitProgramInfo(UNIX_USERDATA_DIRECTORY, @@ -65,14 +55,13 @@ void OpenAll(void) InitCounter(); InitSound(); - InitSoundServer(); InitJoysticks(); InitRND(NEW_RANDOMIZE); - signal(SIGINT, CloseAllAndExit); - signal(SIGTERM, CloseAllAndExit); + InitVideoDisplay(); + InitVideoBuffer(&backbuffer, &window, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, + setup.fullscreen); - InitDisplay(); InitEventFilter(FilterMouseMotionEvents); InitGfx(); @@ -139,13 +128,11 @@ void InitSound() { int i; - OpenAudio(&audio); - - AllocSoundArray(NUM_SOUNDS); + OpenAudio(); for(i=0; i=0; i++) - { - for(j=0; jformat, 0x00, 0x00, 0x00)); - if ((tile_masked[tile] = SDL_DisplayFormat(sdl_image_tmp)) == NULL) - Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError()); - - SDL_FreeSurface(sdl_image_tmp); - - BlitBitmap(src_bitmap, tile_masked[tile], src_x,src_y, TILEX,TILEY, 0,0); - } - } -#endif + tile_clipmask[i] = None; -#else /* !TARGET_SDL */ +#if defined(TARGET_X11) + /* This stuff is needed because X11 (XSetClipOrigin(), to be precise) is + often very slow when preparing a masked XCopyArea() for big Pixmaps. + To prevent this, create small (tile-sized) mask Pixmaps which will then + be set much faster with XSetClipOrigin() and speed things up a lot. */ /* create graphic context structures needed for clipping */ clip_gc_values.graphics_exposures = False; @@ -516,10 +425,7 @@ void InitGfx() } } - /* initialize pixmap array to Pixmap 'None' */ - for(i=0; i=0; i++) { @@ -543,8 +449,8 @@ void InitGfx() src_x, src_y, TILEX, TILEY, 0, 0); } } - -#endif /* !TARGET_SDL */ +#endif /* TARGET_X11_ANTIVE */ +#endif /* TARGET_X11 */ } void InitGfxBackground() @@ -1727,40 +1633,15 @@ void CloseAllAndExit(int exit_value) { int i; -#if defined(TARGET_SDL) StopSounds(); FreeSounds(NUM_SOUNDS); -#else - if (audio.soundserver_pid) - { - StopSounds(); - kill(audio.soundserver_pid, SIGTERM); - FreeSounds(NUM_SOUNDS); - } -#endif + CloseAudio(); for(i=0; i