X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Finit.c;h=e19daafde4e658c38b981b711dd60ef64f368108;hp=4a5578e643e3bcc02f2ccc87c6f3b04df1f4d576;hb=cfd77b3698baacb01dff3853c96d0be117db1d30;hpb=8cef2a63b6c56ba086183693d3f73f02862cbd8f diff --git a/src/init.c b/src/init.c index 4a5578e6..e19daafd 100644 --- a/src/init.c +++ b/src/init.c @@ -20,8 +20,7 @@ #include "tools.h" #include "files.h" #include "joystick.h" -#include "gfxload.h" -#include "gifload.h" +#include "image.h" #include "network.h" #include "netserv.h" @@ -70,7 +69,7 @@ void OpenAll(int argc, char *argv[]) InitCounter(); InitSound(); InitSoundServer(); - InitJoystick(); + InitJoysticks(); InitRND(NEW_RANDOMIZE); signal(SIGINT, CloseAllAndExit); @@ -94,49 +93,22 @@ void InitLevelAndPlayerInfo() { int i; - /* initialize local setup */ - setup.sound_on = TRUE; - setup.sound_loops_on = FALSE; - setup.sound_music_on = FALSE; - setup.sound_simple_on = FALSE; - setup.toons_on = TRUE; - setup.direct_draw_on = FALSE; - setup.scroll_delay_on = FALSE; - setup.soft_scrolling_on = TRUE; - setup.fading_on = FALSE; - setup.autorecord_on = FALSE; - setup.quick_doors = FALSE; - for (i=0; iconnected = TRUE; - local_player->local = TRUE; + + if (!LoadLevelInfo()) /* global level info */ + Error(ERR_EXIT, NULL); + + LoadSetup(); /* global setup info */ + LoadLevelSetup(); /* info about last played level */ } void InitNetworkServer() @@ -151,7 +123,7 @@ void InitNetworkServer() if (!ConnectToServer(options.server_host, options.server_port)) Error(ERR_EXIT, "cannot connect to multiplayer server"); - SendToServer_Nickname(local_player->alias_name); + SendToServer_Nickname(setup.alias_name); SendToServer_ProtocolVersion(); if (nr_wanted) @@ -166,16 +138,16 @@ void InitSound() return; #ifndef MSDOS - if (access(sound_device_name,W_OK)<0) + if (access(sound_device_name, W_OK) != 0) { - Error(ERR_RETURN, "cannot access sound device - no sounds"); + Error(ERR_WARN, "cannot access sound device - no sounds"); sound_status = SOUND_OFF; return; } if ((sound_device = open(sound_device_name,O_WRONLY))<0) { - Error(ERR_RETURN, "cannot open sound device - no sounds"); + Error(ERR_WARN, "cannot open sound device - no sounds"); sound_status = SOUND_OFF; return; } @@ -185,11 +157,19 @@ void InitSound() #ifdef VOXWARE sound_loops_allowed = TRUE; + + /* setup.sound_loops_on = TRUE; + */ + #endif #else sound_loops_allowed = TRUE; + + /* setup.sound_loops_on = TRUE; + */ + #endif for(i=0; ipicture_filename) { - sprintf(basefilename,"%s%s",pic->picture_filename,picture_ext); - DrawInitText(basefilename,150,FC_YELLOW); - sprintf(filename,"%s/%s",GFX_PATH,basefilename); + sprintf(basefilename, "%s%s", pic->picture_filename, picture_ext); + DrawInitText(basefilename, 150, FC_YELLOW); + sprintf(filename, "%s/%s/%s", + options.base_directory, GRAPHICS_DIRECTORY, basefilename); #ifdef MSDOS rest(100); @@ -697,7 +693,7 @@ void LoadGfx(int pos, struct PictureFileInfo *pic) #else - gif_err = Read_GIF_to_Pixmaps(display, window, filename, + gif_err = Read_PCX_to_Pixmaps(display, window, filename, &pix[pos], &clipmask[pos]); switch(gif_err) @@ -736,9 +732,10 @@ void LoadGfx(int pos, struct PictureFileInfo *pic) #ifdef XPM_INCLUDE_FILE - sprintf(basefilename,"%s%s",pic->picture_filename,picturemask_ext); - DrawInitText(basefilename,150,FC_YELLOW); - sprintf(filename,"%s/%s",GFX_PATH,basefilename); + sprintf(basefilename, "%s%s", pic->picture_filename, picturemask_ext); + DrawInitText(basefilename, 150, FC_YELLOW); + sprintf(filename, "%s/%s/%s", + options.base_directory, GRAPHICS_DIRECTORY, basefilename); #ifdef DEBUG_TIMING count1 = Counter();