X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Finit.c;h=c591c0db5634dd3f660c7c404c2e9aac58cbc7a2;hb=8be31c2781126204470171aff7af45713ec42e9e;hp=114f61c01aedfa9e6b610e0fa63e513a6520dc02;hpb=74b5b6c19587f93c45b72b1153154030dc99b50d;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 114f61c0..c591c0db 100644 --- a/src/init.c +++ b/src/init.c @@ -45,7 +45,8 @@ struct IconFileInfo static int sound_process_id = 0; #endif -static void InitLevelAndPlayerInfo(void); +static void InitPlayerInfo(void); +static void InitLevelInfo(void); static void InitNetworkServer(void); static void InitDisplay(void); static void InitSound(void); @@ -74,6 +75,8 @@ void OpenAll(int argc, char *argv[]) exit(0); } + InitPlayerInfo(); + InitCounter(); InitSound(); InitSoundServer(); @@ -94,7 +97,7 @@ void OpenAll(int argc, char *argv[]) InitGfx(); InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */ - InitLevelAndPlayerInfo(); + InitLevelInfo(); InitGadgets(); /* needs to know number of level series */ DrawMainMenu(); @@ -102,7 +105,7 @@ void OpenAll(int argc, char *argv[]) InitNetworkServer(); } -void InitLevelAndPlayerInfo() +void InitPlayerInfo() { int i; @@ -117,8 +120,12 @@ void InitLevelAndPlayerInfo() local_player->connected = TRUE; - LoadLevelInfo(); /* global level info */ LoadSetup(); /* global setup info */ +} + +void InitLevelInfo() +{ + LoadLevelInfo(); /* global level info */ LoadLevelSetup_LastSeries(); /* last played series info */ LoadLevelSetup_SeriesInfo(); /* last played level info */ } @@ -158,14 +165,14 @@ void InitSound() if (SDL_Init(SDL_INIT_AUDIO) < 0) { - Error(ERR_WARN, "SDL_Init() failed: %s\n", SDL_GetError()); + Error(ERR_WARN, "SDL_Init() failed: %s", SDL_GetError()); sound_status = SOUND_OFF; return; } - if (Mix_OpenAudio(22050, AUDIO_S16, 2, 256) < 0) + if (Mix_OpenAudio(22050, AUDIO_S16, 2, 512) < 0) { - Error(ERR_WARN, "Mix_OpenAudio() failed: %s\n", SDL_GetError()); + Error(ERR_WARN, "Mix_OpenAudio() failed: %s", SDL_GetError()); sound_status = SOUND_OFF; return; } @@ -221,6 +228,7 @@ void InitSound() if (!LoadSound(&Sound[i])) { sound_status = SOUND_OFF; + sound_loops_allowed = FALSE; return; } } @@ -275,7 +283,7 @@ void InitSoundServer() void InitJoysticks() { -#ifdef USE_SDL_LIBRARY +#ifdef USE_SDL_JOYSTICK static boolean sdl_joystick_subsystem_initialized = FALSE; #endif @@ -286,7 +294,7 @@ void InitJoysticks() joystick_status = JOYSTICK_OFF; -#ifdef USE_SDL_LIBRARY +#ifdef USE_SDL_JOYSTICK if (!sdl_joystick_subsystem_initialized) { @@ -294,7 +302,7 @@ void InitJoysticks() if (SDL_Init(SDL_INIT_JOYSTICK) < 0) { - Error(ERR_EXIT, "SDL_Init() failed: %s\n", SDL_GetError()); + Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError()); return; } } @@ -326,7 +334,7 @@ void InitJoysticks() joystick_status = JOYSTICK_AVAILABLE; } -#else /* !USE_SDL_LIBRARY */ +#else /* !USE_SDL_JOYSTICK */ #ifndef MSDOS for (i=0; iformat, 0x00, 0x00, 0x00)); if ((tile_masked[tile] = SDL_DisplayFormat(sdl_image_tmp)) == NULL) - Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError()); + Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError()); SDL_FreeSurface(sdl_image_tmp); @@ -912,17 +925,17 @@ void LoadGfx(int pos, struct PictureFileInfo *pic) #ifdef USE_SDL_LIBRARY /* load image to temporary surface */ if ((sdl_image_tmp = IMG_Load(filename)) == NULL) - Error(ERR_EXIT, "IMG_Load() failed: %s\n", SDL_GetError()); + Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError()); /* create native non-transparent surface for current image */ if ((pix[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL) - Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError()); + Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError()); /* create native transparent surface for current image */ SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY, SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00)); if ((pix_masked[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL) - Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s\n", SDL_GetError()); + Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError()); /* free temporary surface */ SDL_FreeSurface(sdl_image_tmp); @@ -2254,7 +2267,7 @@ void CloseAllAndExit(int exit_value) } #endif -#ifdef MSDOS +#if defined(MSDOS) || defined(WIN32) dumpErrorFile(); #endif