X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Finit.c;h=e19daafde4e658c38b981b711dd60ef64f368108;hb=cfd77b3698baacb01dff3853c96d0be117db1d30;hp=5fecebf52592c8f0cccacc5e86f209965b2d2cda;hpb=3d236f777bca55fef0f6b23122b6affd0f424249;p=rocksndiamonds.git diff --git a/src/init.c b/src/init.c index 5fecebf5..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" @@ -34,7 +33,7 @@ struct PictureFileInfo { char *picture_filename; - BOOL picture_with_mask; + boolean picture_with_mask; }; struct IconFileInfo @@ -57,9 +56,9 @@ static void InitElementProperties(void); void OpenAll(int argc, char *argv[]) { - if (serveronly) + if (options.serveronly) { - NetworkServer(server_port, serveronly); + NetworkServer(options.server_port, options.serveronly); /* never reached */ exit(0); @@ -70,7 +69,7 @@ void OpenAll(int argc, char *argv[]) InitCounter(); InitSound(); InitSoundServer(); - InitJoystick(); + InitJoysticks(); InitRND(NEW_RANDOMIZE); signal(SIGINT, CloseAllAndExit); @@ -92,28 +91,39 @@ void OpenAll(int argc, char *argv[]) void InitLevelAndPlayerInfo() { + int i; + + /* choose default local player */ local_player = &stored_player[0]; + for (i=0; iconnected = TRUE; + if (!LoadLevelInfo()) /* global level info */ Error(ERR_EXIT, NULL); - LoadPlayerInfo(PLAYER_SETUP); /* global setup info */ - LoadPlayerInfo(PLAYER_LEVEL); /* level specific info */ + LoadSetup(); /* global setup info */ + LoadLevelSetup(); /* info about last played level */ } void InitNetworkServer() { int nr_wanted; - if (standalone) + if (!options.network) return; nr_wanted = Request("Choose player", REQ_PLAYER | REQ_STAY_CLOSED); - if (!ConnectToServer(server_host, server_port)) + 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) @@ -128,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; } @@ -147,11 +157,19 @@ void InitSound() #ifdef VOXWARE sound_loops_allowed = TRUE; - sound_loops_on = TRUE; + + /* + setup.sound_loops_on = TRUE; + */ + #endif #else sound_loops_allowed = TRUE; - sound_loops_on = 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); @@ -655,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) @@ -694,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();