X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Finit.c;h=2ddbbcd5769c56c30cadc67d8092fc3fefb3f9f2;hb=0a05f4c2fbfe8ef1c372694a10d94818bff18d09;hp=df4099e162cedaa88202b97e56f9446deff7a692;hpb=41e8d55b767c898f20c29a1b0b8d2ef8840be2f5;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index df4099e1..2ddbbcd5 100644 --- a/src/init.c +++ b/src/init.c @@ -24,11 +24,27 @@ #include "network.h" #include "netserv.h" +static char *image_filename[NUM_PICTURES] = +{ + "RocksScreen.pcx", + "RocksDoor.pcx", + "RocksHeroes.pcx", + "RocksToons.pcx", + "RocksSP.pcx", + "RocksDC.pcx", + "RocksMore.pcx", + "RocksFont.pcx", + "RocksFont2.pcx", + "RocksFont3.pcx" +}; + static void InitPlayerInfo(void); +static void InitSetup(void); static void InitLevelInfo(void); static void InitNetworkServer(void); static void InitSound(void); static void InitGfx(void); +static void InitCustomGraphics(void); static void InitGfxBackground(void); static void InitGadgets(void); static void InitElementProperties(void); @@ -48,8 +64,10 @@ 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); + MSDOS_POINTER_FILENAME, + COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL); + InitSetup(); InitPlayerInfo(); InitCounter(); @@ -69,12 +87,19 @@ void OpenAll(void) InitLevelInfo(); InitGadgets(); /* needs to know number of level series */ + InitCustomGraphics(); + InitGfxBackground(); DrawMainMenu(); InitNetworkServer(); } +void InitSetup() +{ + LoadSetup(); /* global setup info */ +} + void InitPlayerInfo() { int i; @@ -86,8 +111,6 @@ void InitPlayerInfo() stored_player[i].connected = FALSE; local_player->connected = TRUE; - - LoadSetup(); /* global setup info */ } void InitLevelInfo() @@ -143,161 +166,14 @@ void InitSound() StartSoundserver(); } -void InitJoysticks() -{ -#if defined(TARGET_SDL) - static boolean sdl_joystick_subsystem_initialized = FALSE; -#endif - - int i; - - /* always start with reliable default values */ - joystick.status = JOYSTICK_NOT_AVAILABLE; - for (i=0; i= SDL_NumJoysticks()) - joystick_nr = -1; - - /* misuse joystick file descriptor variable to store joystick number */ - joystick.fd[i] = joystick_nr; - - /* this allows subsequent calls to 'InitJoysticks' for re-initialization */ - if (Check_SDL_JoystickOpened(joystick_nr)) - Close_SDL_Joystick(joystick_nr); - - if (!setup.input[i].use_joystick) - continue; - - if (!Open_SDL_Joystick(joystick_nr)) - { - Error(ERR_WARN, "cannot open joystick %d", joystick_nr); - continue; - } - - joystick.status = JOYSTICK_ACTIVATED; - } - -#else /* !TARGET_SDL */ - -#if defined(PLATFORM_UNIX) - for (i=0; i= num_joysticks) - joystick_nr = -1; - - /* misuse joystick file descriptor variable to store joystick number */ - joystick.fd[i] = joystick_nr; - } -#endif - -#endif /* !TARGET_SDL */ -} - -void InitGfx() +void InitTileClipmasks() { - int i; - #if defined(TARGET_X11) GC copy_clipmask_gc; XGCValues clip_gc_values; unsigned long clip_gc_valuemask; #endif -#if !defined(PLATFORM_MSDOS) - static char *image_filename[NUM_PICTURES] = - { - "RocksScreen.pcx", - "RocksDoor.pcx", - "RocksHeroes.pcx", - "RocksToons.pcx", - "RocksSP.pcx", - "RocksDC.pcx", - "RocksMore.pcx", - "RocksFont.pcx", - "RocksFont2.pcx", - "RocksFont3.pcx" - }; -#else - static char *image_filename[NUM_PICTURES] = - { - "Screen.pcx", - "Door.pcx", - "Heroes.pcx", - "Toons.pcx", - "SP.pcx", - "DC.pcx", - "More.pcx", - "Font.pcx", - "Font2.pcx", - "Font3.pcx" - }; -#endif - #if defined(TARGET_X11_NATIVE) static struct { @@ -352,43 +228,7 @@ void InitGfx() }; #endif - /* initialize some global variables */ - global.frames_per_second = 0; - global.fps_slowdown = FALSE; - global.fps_slowdown_factor = 1; - - /* initialize screen properties */ - InitGfxFieldInfo(SX, SY, SXSIZE, SYSIZE, - REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE); - InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE); - InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE); - 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); - - pix[PIX_SMALLFONT] = LoadImage(image_filename[PIX_SMALLFONT]); - InitFontInfo(NULL, NULL, pix[PIX_SMALLFONT]); - - DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW); - DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED); -#if defined(PLATFORM_MSDOS) - DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE); - rest(200); -#endif - DrawInitText("Loading graphics:",120,FC_GREEN); - - for(i=0; i/graphics */ + filename = getPath2(getUserDataDir(), GRAPHICS_DIRECTORY); + if (access(dir, F_OK) == 0) + { + } + + + + +(leveldir_current->user_defined ? + getUserLevelDir("") : + options.level_directory), + leveldir_current->fullpath, + basename); + + + + filename = getPath3((leveldir_current->user_defined ? + getUserLevelDir("") : + options.level_directory), + leveldir_current->fullpath, + basename); +#endif +} + void InitGfxBackground() { int x, y; @@ -1639,8 +1569,8 @@ void CloseAllAndExit(int exit_value) for(i=0; i