/*********************************************************** * Mirror Magic -- McDuffin's Revenge * *----------------------------------------------------------* * (c) 1994-2001 Artsoft Entertainment * * Holger Schemel * * Detmolder Strasse 189 * * 33604 Bielefeld * * Germany * * e-mail: info@artsoft.org * *----------------------------------------------------------* * init.c * ***********************************************************/ #include #include "libgame/libgame.h" #include "init.h" #include "events.h" #include "screens.h" #include "editor.h" #include "game.h" #include "tools.h" #include "files.h" static void InitPlayerInfo(void); static void InitLevelInfo(void); static void InitSound(void); static void InitGfx(void); static void InitGfxBackground(void); static void InitGadgets(void); static void InitElementProperties(void); void OpenAll(void) { InitProgramInfo(UNIX_USERDATA_DIRECTORY, PROGRAM_TITLE_STRING, WINDOW_TITLE_STRING, ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME, MSDOS_POINTER_FILENAME); InitPlayerInfo(); InitCounter(); InitSound(); InitRND(NEW_RANDOMIZE); InitVideoDisplay(); InitVideoBuffer(&backbuffer, &window, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen); InitColor(); InitEventFilter(FilterMouseMotionEvents); InitGfx(); InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */ InitLevelInfo(); InitGadgets(); /* needs to know number of level series */ InitGfxBackground(); DrawMainMenu(); } void InitPlayerInfo() { #if 0 /* choose default local player */ local_player = &stored_player[0]; #endif LoadSetup(); /* global setup info */ } void InitLevelInfo() { LoadLevelInfo(); /* global level info */ LoadLevelSetup_LastSeries(); /* last played series info */ LoadLevelSetup_SeriesInfo(); /* last played level info */ } void InitSound() { int i; 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 = XCreateGC(display, window->drawable, clip_gc_valuemask, &clip_gc_values); for(i=0; iclip_mask) { clip_gc_values.graphics_exposures = False; 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); } } #if defined(TARGET_X11_NATIVE) /* create only those clipping Pixmaps we really need */ for(i=0; tile_needs_clipping[i].start>=0; i++) { int j; for(j=0; jclip_mask; tile_clipmask[tile] = XCreatePixmap(display, window->drawable, TILEX, TILEY, 1); XCopyArea(display, src_pixmap, tile_clipmask[tile], copy_clipmask_gc, src_x, src_y, TILEX, TILEY, 0, 0); } } #endif /* TARGET_X11_NATIVE */ #endif /* TARGET_X11 */ } void InitGfxBackground() { int x, y; drawto = backbuffer; 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); for(x=0; x