X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Finit.c;h=fe585257360fc68d0dc3785be8dbf0f4761013b4;hp=b4efdc4e7cc90d6b8ea73f2cb108fa9fd8ddaae6;hb=bcb3453f710b95ec98b188b95574bea9ab336e96;hpb=e0560b41a1796a02b15937b0ae5453bca745e5ff diff --git a/src/init.c b/src/init.c index b4efdc4e..fe585257 100644 --- a/src/init.c +++ b/src/init.c @@ -1,7 +1,7 @@ /*********************************************************** * Rocks'n'Diamonds -- McDuffin Strikes Back! * *----------------------------------------------------------* -* (c) 1995-2000 Artsoft Entertainment * +* (c) 1995-2001 Artsoft Entertainment * * Holger Schemel * * Detmolder Strasse 189 * * 33604 Bielefeld * @@ -11,8 +11,6 @@ * init.c * ***********************************************************/ -#include - #include "libgame/libgame.h" #include "init.h" @@ -23,15 +21,31 @@ #include "tape.h" #include "tools.h" #include "files.h" -#include "joystick.h" #include "network.h" #include "netserv.h" +#include "cartoons.h" +#include "config.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 InitSetup(void); static void InitPlayerInfo(void); static void InitLevelInfo(void); +static void InitArtworkInfo(void); static void InitNetworkServer(void); static void InitSound(void); -static void InitSoundServer(void); static void InitGfx(void); static void InitGfxBackground(void); static void InitGadgets(void); @@ -50,15 +64,16 @@ void OpenAll(void) } InitProgramInfo(UNIX_USERDATA_DIRECTORY, - PROGRAM_TITLE_STRING, WINDOW_TITLE_STRING, + PROGRAM_TITLE_STRING, getWindowTitleString(), 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(); InitSound(); - InitSoundServer(); InitJoysticks(); InitRND(NEW_RANDOMIZE); @@ -68,6 +83,7 @@ void OpenAll(void) InitEventFilter(FilterMouseMotionEvents); + InitArtworkInfo(); InitGfx(); InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */ @@ -75,11 +91,18 @@ void OpenAll(void) InitGadgets(); /* needs to know number of level series */ InitGfxBackground(); + InitToons(); + DrawMainMenu(); InitNetworkServer(); } +void InitSetup() +{ + LoadSetup(); /* global setup info */ +} + void InitPlayerInfo() { int i; @@ -88,14 +111,9 @@ void InitPlayerInfo() local_player = &stored_player[0]; for (i=0; iconnected = TRUE; - - LoadSetup(); /* global setup info */ } void InitLevelInfo() @@ -105,6 +123,11 @@ void InitLevelInfo() LoadLevelSetup_SeriesInfo(); /* last played level info */ } +void InitArtworkInfo() +{ + LoadArtworkInfo(); +} + void InitNetworkServer() { #if defined(PLATFORM_UNIX) @@ -134,11 +157,9 @@ void InitSound() OpenAudio(); - AllocSoundArray(NUM_SOUNDS); - for(i=0; i= SDL_NumJoysticks()) - joystick_nr = -1; - - /* misuse joystick file descriptor variable to store joystick number */ - stored_player[i].joystick_fd = 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_AVAILABLE; - } - -#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 */ - stored_player[i].joystick_fd = joystick_nr; - } -#endif - -#endif /* !TARGET_SDL */ -} - -void InitGfx() -{ - 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 - -#ifdef TARGET_X11 +#if defined(TARGET_X11_NATIVE) static struct { int start; @@ -395,45 +236,18 @@ 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=0; i++) { @@ -485,9 +296,57 @@ void InitGfx() src_x, src_y, TILEX, TILEY, 0, 0); } } +#endif /* TARGET_X11_NATIVE */ #endif /* TARGET_X11 */ } +void InitGfx() +{ + int i; + + /* 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] = LoadCustomImage(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