X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Finit.c;h=ce82c209eb9c6dbeeaa5490c1d8976831303d17f;hp=76ff5941d1545618b35b4f9d48c1d37d9d5be89d;hb=e5c5bf5c4a76a04f9bf64e92227bf2ef969fd25c;hpb=d32496fdd3867910a188acba0ac132f66c99306c diff --git a/src/init.c b/src/init.c index 76ff5941..ce82c209 100644 --- a/src/init.c +++ b/src/init.c @@ -23,6 +23,7 @@ #include "gfxload.h" #include "gifload.h" #include "network.h" +#include "netserv.h" #ifdef DEBUG /* @@ -33,7 +34,7 @@ struct PictureFileInfo { char *picture_filename; - BOOL picture_with_mask; + boolean picture_with_mask; }; struct IconFileInfo @@ -56,6 +57,14 @@ static void InitElementProperties(void); void OpenAll(int argc, char *argv[]) { + if (options.serveronly) + { + NetworkServer(options.server_port, options.serveronly); + + /* never reached */ + exit(0); + } + InitLevelAndPlayerInfo(); InitCounter(); @@ -83,6 +92,23 @@ void OpenAll(int argc, char *argv[]) void InitLevelAndPlayerInfo() { + int i; + + /* initialize local player's 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; + setup.joystick_nr = 0; + + /* choose default local player */ local_player = &stored_player[0]; if (!LoadLevelInfo()) /* global level info */ @@ -90,18 +116,27 @@ void InitLevelAndPlayerInfo() LoadPlayerInfo(PLAYER_SETUP); /* global setup info */ LoadPlayerInfo(PLAYER_LEVEL); /* level specific info */ + + /* after LoadPlayerInfo(), because it overwrites 'local_player' */ + for (i=0; iconnected = TRUE; + local_player->local = TRUE; } 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); @@ -115,7 +150,7 @@ void InitSound() { int i; - if (sound_status==SOUND_OFF) + if (sound_status == SOUND_OFF) return; #ifndef MSDOS @@ -126,7 +161,7 @@ void InitSound() return; } - if ((sound_device=open(sound_device_name,O_WRONLY))<0) + if ((sound_device = open(sound_device_name,O_WRONLY))<0) { Error(ERR_RETURN, "cannot open sound device - no sounds"); sound_status = SOUND_OFF; @@ -134,18 +169,18 @@ void InitSound() } close(sound_device); - sound_status=SOUND_AVAILABLE; + sound_status = SOUND_AVAILABLE; #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;i